@galacean/effects-threejs 0.0.0-experimental-downgrade628-20240904 → 0.0.0-experimental-20250807
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/README.md +21 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +31701 -23203
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +3 -16
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +31607 -23150
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +17 -6
- package/dist/three-composition.d.ts +8 -44
- package/dist/three-display-object.d.ts +14 -5
- package/dist/three-engine.d.ts +14 -0
- package/dist/three-geometry.d.ts +8 -2
- package/dist/three-mesh.d.ts +4 -2
- package/dist/three-sprite-component.d.ts +41 -0
- package/dist/three-text-component.d.ts +18 -0
- package/dist/three-texture.d.ts +9 -166
- package/package.json +5 -5
- package/dist/three-render-frame.d.ts +0 -57
package/dist/index.min.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
!/*!
|
|
2
2
|
* Name: @galacean/effects-threejs
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v0.0.0-experimental-
|
|
7
|
-
*/
|
|
8
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,(function(t,e){"use strict";function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var i=r(e),n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var a=function(){return a=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},a.apply(this,arguments)};function s(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?n(t.value):function(t){return t instanceof r?t:new r((function(e){e(t)}))}(t.value).then(a,s)}u((i=i.apply(t,e||[])).next())}))}function u(t,e){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function c(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function h(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var f=6,p="PRE_COLOR_0",d="PRE_COLOR_SIZE_0",m="PRE_MAIN_COLOR_0",v="PRE_MAIN_COLOR_SIZE_0",y="editor",x="none",g={"Filter not imported":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg","Item duration can't be less than 0":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"};var T=[],E={};function S(){"function"==typeof WebGL2RenderingContext?b(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(b(WebGLRenderingContext),b(WebGLRenderingContext.prototype)):T.push("iOS16 lockdown mode, WebGL Constants not in global"),T.length||"HALF_FLOAT"in E||(E.HALF_FLOAT=5131)}function b(t){for(var e in t)/^[A-Z_]/.test(e)&&(E[e]=t[e])}T.length||S();var R,_,A,C,w,O,M,L,I,P,V,F,N={},z={};function D(t,e,r){t in N&&console.error("Filter ".concat(t," registered twice.")),N[t]=e,z[t]=r}function U(t){Object.keys(t).forEach((function(e){var r=l(t[e],2);D(e,r[0],r[1])}))}function B(t){var e=z[t.name];if(!e)throw Error("Filter ".concat(t.name," not imported, see ").concat(g["Filter not imported"]));return e(t)}function k(t,e){var r=N[t.name];if(!r)throw Error("Filter ".concat(t.name," not imported, see ").concat(g["Filter not imported"]));var i=r(t,e);return i.passSplitOptions||(i.passSplitOptions={attachments:[{texture:{format:E.RGBA}}]}),i}function G(t,e){return t.includes(e)||t.push(e),t}function X(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function H(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var o=t[n];if(i)for(;t[n-1][r]<o[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>o[r]&&(t[n]=t[n-1],0!=--n););t[n]=o}}}function Y(t,e,r,i){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);isNaN(i)||(n=Math.min(n,i));var o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(o);return a.set(t),a}return t}function j(t,e){var r=[0,0,0,0];if(rr(t)){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else t instanceof Array&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)r[o]/=255;return r}function W(t,e,r){if(t.length){for(var i=void 0,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){i=q(o.color,a.color,(e-o.stop)/(a.stop-o.stop));break}}return i||(i=t[t.length-1].color),r?i.map((function(t){return t/255})):i}return[0,0,0,0]}function Z(t){var e=[];if(t instanceof Array?t.forEach((function(t){var r=l(t,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];e.push({stop:Q(i),color:[n,o,a,s]})})):Object.keys(t).forEach((function(r){var i=j(t[r]);e.push({stop:Q(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 q(t,e,r,i){var n=[],o=1-r;if(i)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*r;else{for(a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*o+e[a]*e[a]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function Q(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function K(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function J(){return K()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function $(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=Z(t);if(n.length){i.set(n[0].color,0);for(var o=1;o<127;o++){for(var a=o/e,s=void 0,u=void 0,c=0;c<n.length&&(s=n[c],u=n[c+1],!(s.stop<=a&&u.stop>a));c++);var l=q(s.color,u.color,(a-s.stop)/(u.stop-s.stop));i.set(l,4*o)}i.set(n[n.length-1].color,508)}return r}function tt(e,r){void 0===r&&(r=t.OrderType.ascending);var i=e.length;if(i<=1||r===t.OrderType.none)return e;if(i<=30){for(var n=1;n<i;n++)rt(e,n,r);return e}return it(e,r)}function et(e,r,i){return void 0===i&&(i=t.OrderType.ascending),e.includes(r)?e:(e.push(r),1===e.length||i!==t.OrderType.none&&rt(e,e.length-1,i),e)}function rt(e,r,i){var n=e[r];if(i!==t.OrderType.ascending)for(;r>=1&&e[r-1].priority<n.priority&&(e[r]=e[r-1],0!=--r););else for(;r>=1&&e[r-1].priority>n.priority&&(e[r]=e[r-1],0!=--r););e[r]=n}function it(e,r,i,n){var o,a;if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var s=e[i],u=i,c=n;u<c;){if(r===t.OrderType.ascending){for(;e[c].priority>s.priority&&c>=u;)c--;for(;e[u].priority<=s.priority&&u<c;)u++}else{for(;e[c].priority<s.priority&&c>=u;)c--;for(;e[u].priority>=s.priority&&u<c;)u++}o=l([e[c],e[u]],2),e[u]=o[0],e[c]=o[1]}return a=l([e[u],e[i]],2),e[i]=a[0],e[u]=a[1],it(e,r,i,u-1),it(e,r,c+1,n),e}function nt(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function ot(t){return/^[^\d.][\w-]*$/.test(t)}
|
|
9
|
-
/*!
|
|
10
|
-
* Name: @galacean/effects-specification
|
|
11
|
-
* Description: Galacean Effects JSON Specification
|
|
12
|
-
* Author: Ant Group CO., Ltd.
|
|
13
|
-
* Version: v1.3.0
|
|
14
|
-
*/t.OrderType=void 0,(R=t.OrderType||(t.OrderType={}))[R.none=1]="none",R[R.ascending=2]="ascending",R[R.descending=3]="descending",function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(_||(_={})),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"}(A||(A={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(C||(C={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(w||(w={})),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"}(O||(O={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(M||(M={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(L||(L={})),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"}(I||(I={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.filter="8",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox"}(P||(P={})),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"}(V||(V={})),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"}(F||(F={}));var at,st,ut,ct,lt,ht,ft,pt,dt;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(at||(at={})),function(t){t[t.destroy=0]="destroy",t[t.pause=1]="pause",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.pause_destroy=3]="pause_destroy"}(st||(st={})),function(t){t.video="video",t.image="image"}(ut||(ut={})),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"}(ct||(ct={})),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"}(lt||(lt={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(ht||(ht={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(ft||(ft={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(pt||(pt={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(dt||(dt={}));var mt,vt,yt,xt,gt,Tt,Et,St,bt;!function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(mt||(mt={})),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"}(yt||(yt={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive"}(xt||(xt={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(gt||(gt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Tt||(Tt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Et||(Et={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(St||(St={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(bt||(bt={}));var Rt=Object.freeze({__proto__:null,get BackgroundType(){return ut},get BezierKeyframeType(){return lt},get BlendingMode(){return A},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return at},get CompositionEndBehavior(){return st},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_DESTROY_CHILDREN:6,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_RESTART:5,get FontStyle(){return bt},get InteractBehavior(){return I},get InteractType(){return L},get ItemEndBehavior(){return ht},get ItemType(){return P},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return w},get MaterialBlending(){return yt},get MaterialType(){return vt},get ModelBoundingType(){return mt},get ParentItemEndBehavior(){return ft},get ParticleInteractionBehavior(){return pt},get ParticleOrigin(){return F},get PluginType(){return M},get RenderLevel(){return _},get RenderMode(){return V},get RenderMode3D(){return xt},get ShapeArcMode(){return dt},get ShapeType(){return O},get SideMode(){return C},get TextAlignment(){return Et},get TextBaseline(){return Tt},get TextOverflow(){return gt},get TextWeight(){return St},get ValueType(){return ct}}),_t=2*Math.PI,At=Math.PI/180,Ct=180/Math.PI,wt=1e-6;function Ot(t,e){return Math.abs(t-e)<wt||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var Mt=function(t,e,r){return(1-r)*t+r*e};function Lt(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,o=Math.min(i,n),a=Math.max(i,n);return Math.min(Math.max(t,o),a)}var It,Pt=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this},t.prototype.setFromArray=function(t,e){var r,i;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this},t.prototype.sum=function(){return this.x+this.y},t.prototype.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},t.prototype.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},t.prototype.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},t.prototype.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},t.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},t.prototype.isZero=function(){var t=wt,e=(this,this.x),r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=t},t.prototype.toArray=function(){return[this.x,this.y]},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.ONE=new t(1,1),t.ZERO=new t(0,0),t}(),Vt=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}return t.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},t.prototype.setFromArray=function(t,e){var r,i,n;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.prototype.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z},t.prototype.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},t.prototype.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},t.prototype.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.cross=function(t){return this.crossVectors(this,t)},t.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},t.prototype.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},t.prototype.distance=function(t){return Math.sqrt(this.distanceSquared(t))},t.prototype.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},t.prototype.isZero=function(){var t,e=wt,r=(t=this).x,i=t.y,n=t.z;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toVector2=function(){return new Pt(this.x,this.y)},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t.prototype.applyEuler=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyMatrix=function(t,e){return t.transformPoint(this,e)},t.prototype.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},t.prototype.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.X=new t(1,0,0),t.Y=new t(0,1,0),t.Z=new t(0,0,1),t.ONE=new t(1,1,1),t.ZERO=new t(0,0,0),t}(),Ft=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setFromEuler=function(t){return t.toQuaternion(this),this},t.prototype.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.z*n,this.w=Math.cos(i),this},t.prototype.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},t.prototype.setFromRotationMatrix=function(t){var e=t.elements,r=e[0],i=e[4],n=e[8],o=e[1],a=e[5],s=e[9],u=e[2],c=e[6],l=e[10],h=r+a+l;if(h>0){var f=.5/Math.sqrt(h+1);this.w=.25/f,this.x=(c-s)*f,this.y=(n-u)*f,this.z=(o-i)*f}else if(r>a&&r>l){f=2*Math.sqrt(1+r-a-l);this.w=(c-s)/f,this.x=.25*f,this.y=(i+o)/f,this.z=(n+u)/f,this.negate()}else if(a>l){f=2*Math.sqrt(1+a-r-l);this.w=(n-u)/f,this.x=(i+o)/f,this.y=.25*f,this.z=(s+c)/f,this.negate()}else{f=2*Math.sqrt(1+l-r-a);this.w=(o-i)/f,this.x=(n+u)/f,this.y=(s+c)/f,this.z=.25*f,this.negate()}return this},t.prototype.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=r),this.normalize()},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(Lt(this.dot(t),-1,1)))},t.prototype.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},t.prototype.identity=function(){return this.set(0,0,0,1)},t.prototype.invert=function(){return this.conjugate()},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},t.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},t.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},t.prototype.multiplyQuaternions=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=e.x,s=e.y,u=e.z,c=e.w;return this.x=r*c+o*a+i*u-n*s,this.y=i*c+o*s+n*a-r*u,this.z=n*c+o*u+r*s-i*a,this.w=o*c-r*a-i*s-n*u,this},t.prototype.slerp=function(t,e){var r;if(0===e)return this;if(1===e)return this.copyFrom(t);var i=(r=this).x,n=r.y,o=r.z,a=r.w,s=a*t.w+i*t.x+n*t.y+o*t.z;if(s<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,s=-s):this.copyFrom(t),s>=1)return this.w=a,this.x=i,this.y=n,this.z=o,this;var u=1-s*s;if(u<=Number.EPSILON){var c=1-e;return this.w=c*a+e*this.w,this.x=c*i+e*this.x,this.y=c*n+e*this.y,this.z=c*o+e*this.z,this.normalize(),this}var l=Math.sqrt(u),h=Math.atan2(l,s),f=Math.sin((1-e)*h)/l,p=Math.sin(e*h)/l;return this.w=a*f+this.w*p,this.x=i*f+this.x*p,this.y=n*f+this.y*p,this.z=o*f+this.z*p,this},t.prototype.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},t.prototype.rotateVector3=function(t,e){var r,i=(r=this).x,n=r.y,o=r.z,a=r.w,s=t.x,u=t.y,c=t.z,l=a*s+n*c-o*u,h=a*u+o*s-i*c,f=a*c+i*u-n*s,p=-i*s-n*u-o*c,d=null!=e?e:t;return d.x=l*a+p*-i+h*-o-f*-n,d.y=h*a+p*-n+f*-i-l*-o,d.z=f*a+p*-o+l*-n-h*-i,d},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},t.prototype.toEuler=function(t){return t.setFromQuaternion(this)},t.prototype.toMatrix4=function(t){return t.compose(Vt.ZERO,this,Vt.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,r){return(new t).setFromAxisAngle(e,r)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return(new t).setFromUnitVectors(e,r)},t.tempVec0=new Vt,t}(),Nt=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a},zt=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},Dt=function(){function t(t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===l&&(l=1),void 0===h&&(h=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===d&&(d=0),void 0===m&&(m=1),this.elements=[t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m]}return t.prototype.set=function(t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=o,v[6]=a,v[7]=s,v[8]=u,v[9]=c,v[10]=l,v[11]=h,v[12]=f,v[13]=p,v[14]=d,v[15]=m,this},t.prototype.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u,c,l,h,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]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=c,v[10]=l,v[14]=h,v[3]=f,v[7]=p,v[11]=d,v[15]=m,this},t.prototype.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.w)},t.prototype.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[e+r];return this},t.prototype.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},t.prototype.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},t.prototype.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},t.prototype.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},t.prototype.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},t.prototype.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),o=Math.sin(r),a=1-n,s=i.x,u=i.y,c=i.z,l=a*s,h=a*u;return this.set(l*s+n,l*u+o*c,l*c-o*u,0,l*u-o*c,h*u+n,h*c+o*s,0,l*c+o*u,h*c-o*s,a*c*c+n,0,0,0,0,1)},t.prototype.setFromEuler=function(t){return t.toMatrix4(this),this},t.prototype.setFromQuaternion=function(t){return this.compose(Vt.ZERO,t,Vt.ONE)},t.prototype.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},t.prototype.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,0,0,0,1)},t.prototype.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.prototype.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},t.prototype.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},t.prototype.copyFrom=function(t){return this.elements=zt([],Nt(t.elements),!1),this},t.prototype.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},t.prototype.lookAt=function(e,r,i){var n=t.tempVec0,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,r),a.normalize(),n.crossVectors(i,a),n.normalize(),o.crossVectors(a,n);var s=this.elements;return s[0]=n.x,s[1]=o.x,s[2]=a.x,s[3]=0,s[4]=n.y,s[5]=o.y,s[6]=a.y,s[7]=0,s[8]=n.z,s[9]=o.z,s[10]=a.z,s[11]=0,s[12]=-n.dot(e),s[13]=-o.dot(e),s[14]=-a.dot(e),s[15]=1,this},t.prototype.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[n]*e;return this},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.multiplyMatrices=function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],u=r[12],c=r[1],l=r[5],h=r[9],f=r[13],p=r[2],d=r[6],m=r[10],v=r[14],y=r[3],x=r[7],g=r[11],T=r[15],E=i[0],S=i[4],b=i[8],R=i[12],_=i[1],A=i[5],C=i[9],w=i[13],O=i[2],M=i[6],L=i[10],I=i[14],P=i[3],V=i[7],F=i[11],N=i[15];return n[0]=o*E+a*_+s*O+u*P,n[4]=o*S+a*A+s*M+u*V,n[8]=o*b+a*C+s*L+u*F,n[12]=o*R+a*w+s*I+u*N,n[1]=c*E+l*_+h*O+f*P,n[5]=c*S+l*A+h*M+f*V,n[9]=c*b+l*C+h*L+f*F,n[13]=c*R+l*w+h*I+f*N,n[2]=p*E+d*_+m*O+v*P,n[6]=p*S+d*A+m*M+v*V,n[10]=p*b+d*C+m*L+v*F,n[14]=p*R+d*w+m*I+v*N,n[3]=y*E+x*_+g*O+T*P,n[7]=y*S+x*A+g*M+T*V,n[11]=y*b+x*C+g*L+T*F,n[15]=y*R+x*w+g*I+T*N,this},t.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},t.prototype.determinant=function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],u=t[13],c=t[2],l=t[6],h=t[10],f=t[14];return t[3]*(+n*s*l-i*u*l-n*a*h+r*u*h+i*a*f-r*s*f)+t[7]*(+e*s*f-e*u*h+n*o*h-i*o*f+i*u*c-n*s*c)+t[11]*(+e*u*l-e*a*f-n*o*l+r*o*f+n*a*c-r*u*c)+t[15]*(-i*a*c-e*s*l+e*a*h+i*o*l-r*o*h+r*s*c)},t.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},t.prototype.invert=function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],l=t[9],h=t[10],f=t[11],p=t[12],d=t[13],m=t[14],v=t[15],y=l*m*u-d*h*u+d*s*f-a*m*f-l*s*v+a*h*v,x=p*h*u-c*m*u-p*s*f+o*m*f+c*s*v-o*h*v,g=c*d*u-p*l*u+p*a*f-o*d*f-c*a*v+o*l*v,T=p*l*s-c*d*s-p*a*h+o*d*h+c*a*m-o*l*m,E=e*y+r*x+i*g+n*T;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/E;return t[0]=y*S,t[1]=(d*h*n-l*m*n-d*i*f+r*m*f+l*i*v-r*h*v)*S,t[2]=(a*m*n-d*s*n+d*i*u-r*m*u-a*i*v+r*s*v)*S,t[3]=(l*s*n-a*h*n-l*i*u+r*h*u+a*i*f-r*s*f)*S,t[4]=x*S,t[5]=(c*m*n-p*h*n+p*i*f-e*m*f-c*i*v+e*h*v)*S,t[6]=(p*s*n-o*m*n-p*i*u+e*m*u+o*i*v-e*s*v)*S,t[7]=(o*h*n-c*s*n+c*i*u-e*h*u-o*i*f+e*s*f)*S,t[8]=g*S,t[9]=(p*l*n-c*d*n-p*r*f+e*d*f+c*r*v-e*l*v)*S,t[10]=(o*d*n-p*a*n+p*r*u-e*d*u-o*r*v+e*a*v)*S,t[11]=(c*a*n-o*l*n-c*r*u+e*l*u+o*r*f-e*a*f)*S,t[12]=T*S,t[13]=(c*d*i-p*l*i+p*r*h-e*d*h-c*r*m+e*l*m)*S,t[14]=(p*a*i-o*d*i-p*r*s+e*d*s+o*r*m-e*a*m)*S,t[15]=(o*l*i-c*a*i+c*r*s-e*l*s-o*r*h+e*a*h)*S,this},t.prototype.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},t.prototype.compose=function(t,e,r,i){void 0===i&&(i=Vt.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,c=-i.x,l=-i.y,h=-i.z,f=o+o,p=a+a,d=s+s,m=o*f,v=o*p,y=o*d,x=a*p,g=a*d,T=s*d,E=u*f,S=u*p,b=u*d,R=r.x,_=r.y,A=r.z;return n[0]=(1-(x+T))*R,n[1]=(v+b)*R,n[2]=(y-S)*R,n[3]=0,n[4]=(v-b)*_,n[5]=(1-(m+T))*_,n[6]=(g+E)*_,n[7]=0,n[8]=(y+S)*A,n[9]=(g-E)*A,n[10]=(1-(m+x))*A,n[11]=0,n[12]=c*n[0]+l*n[4]+h*n[8]-c+t.x,n[13]=c*n[1]+l*n[5]+h*n[9]-l+t.y,n[14]=c*n[2]+l*n[6]+h*n[10]-h+t.z,this},t.prototype.decompose=function(e,r,i){var n=t.tempVec0,o=this.elements,a=n.set(o[0],o[1],o[2]).length(),s=n.set(o[4],o[5],o[6]).length(),u=n.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),e.x=o[12],e.y=o[13],e.z=o[14];var c=t.tempMat0;c.copyFrom(this);var l=1/a,h=1/s,f=1/u;return c.elements[0]*=l,c.elements[1]*=l,c.elements[2]*=l,c.elements[4]*=h,c.elements[5]*=h,c.elements[6]*=h,c.elements[8]*=f,c.elements[9]*=f,c.elements[10]*=f,r.setFromRotationMatrix(c),i.x=a,i.y=s,i.z=u,this},t.prototype.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},t.prototype.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},t.prototype.getTransform=function(){var t=new Vt,e=new Ft,r=new Vt;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},t.prototype.orthographic=function(t,e,r,i,n,o){var a=1/(e-t),s=1/(r-i),u=1/(o-n),c=-(e+t)*a,l=-(r+i)*s,h=-(o+n)*u;a*=2,s*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=c,f[13]=l,f[14]=h,f[15]=1,this},t.prototype.perspective=function(t,e,r,i,n){var o=1/Math.tan(.5*t),a=1/(r-i),s=this.elements;return s[0]=n?o:o/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?o*e:o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(i+r)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*i*r*a,s[15]=0,null!==i&&i!==1/0||(s[10]=-1,s[14]=-2*r),this},t.prototype.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14];var s=o[3]*r+o[7]*i+o[11]*n+o[15];return a.multiply(1/s)},t.prototype.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14],a},t.prototype.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n,a.y=o[1]*r+o[5]*i+o[9]*n,a.z=o[2]*r+o[6]*i+o[10]*n,a.normalize()},t.prototype.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*r+a[4]*i+a[8]*n+a[12]*o,s.y=a[1]*r+a[5]*i+a[9]*n+a[13]*o,s.z=a[2]*r+a[6]*i+a[10]*n+a[14]*o,s.w=a[3]*r+a[7]*i+a[11]*n+a[15]*o,s},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!Ot(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return zt([],Nt(this.elements),!1)},t.prototype.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,r,i){return(new t).lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,o){return(new t).perspective(e,r,i,n,o)},t.fromColumnVectors=function(e,r,i,n){return(new t).setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromScale=function(e,r,i){return(new t).setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return(new t).setFromTranslation(e,r,i)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,r){return(new t).setFromRotationAxis(e,r)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,r,i){return(new t).setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return(new t).setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,c,l,h,f,p,d,m,v){return new t(e,o,c,p,r,a,l,d,i,s,h,m,n,u,f,v)},t.IDENTITY=new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),t.ZERO=new t(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),t.tempVec0=new Vt,t.tempVec1=new Vt,t.tempVec2=new Vt,t.tempMat0=new t,t}();!function(t){t[t.XYZ=0]="XYZ",t[t.XZY=1]="XZY",t[t.YXZ=2]="YXZ",t[t.YZX=3]="YZX",t[t.ZXY=4]="ZXY",t[t.ZYX=5]="ZYX"}(It||(It={}));var Ut,Bt,kt=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}return t.prototype.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,this},t.prototype.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},t.prototype.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var r=t.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],u=r[9],c=r[2],l=r[6],h=r[10];switch(e){case It.XYZ:this.y=Math.asin(Lt(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(l,s),this.z=0);break;case It.YXZ:this.x=Math.asin(-Lt(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-c,i),this.z=0);break;case It.ZXY:this.x=Math.asin(Lt(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-c,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case It.ZYX:this.y=Math.asin(-Lt(c,-1,1)),Math.abs(c)<.9999999?(this.x=Math.atan2(l,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case It.YZX:this.z=Math.asin(Lt(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,i)):(this.x=0,this.y=Math.atan2(o,h));break;case It.XZY:this.z=Math.asin(-Lt(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(l,s),this.y=Math.atan2(o,i)):(this.x=Math.atan2(-u,h),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=Ct,this.y*=Ct,this.z*=Ct,this.order=e,this},t.prototype.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},t.prototype.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},t.prototype.setFromArray=function(t,e,r){var i,n,o,a;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!==(i=t[e])&&void 0!==i?i:0,this.y=null!==(n=t[e+1])&&void 0!==n?n:0,this.z=null!==(o=t[e+2])&&void 0!==o?o:0,this.order=null!==(a=t[e+3])&&void 0!==a?a:r,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.order)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},t.prototype.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},t.prototype.addEulers=function(t,e){return t.order!=e.order?(console.error("add euler with different order"),this):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order,this)},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.reorder=function(t){var e=new Ft;return e.setFromEuler(this),this.setFromQuaternion(e,t)},t.prototype.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},t.prototype.toVector3=function(t){return t.set(this.x,this.y,this.z)},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toQuaternion=function(t){var e,r=(e=this).x,i=e.y,n=e.z,o=e.order,a=Math.cos(r*At*.5),s=Math.cos(i*At*.5),u=Math.cos(n*At*.5),c=Math.sin(r*At*.5),l=Math.sin(i*At*.5),h=Math.sin(n*At*.5);switch(o){case It.XYZ:t.set(c*s*u+a*l*h,a*l*u-c*s*h,a*s*h+c*l*u,a*s*u-c*l*h);break;case It.YXZ:t.set(c*s*u+a*l*h,a*l*u-c*s*h,a*s*h-c*l*u,a*s*u+c*l*h);break;case It.ZXY:t.set(c*s*u-a*l*h,a*l*u+c*s*h,a*s*h+c*l*u,a*s*u-c*l*h);break;case It.ZYX:t.set(c*s*u-a*l*h,a*l*u+c*s*h,a*s*h-c*l*u,a*s*u+c*l*h);break;case It.YZX:t.set(c*s*u+a*l*h,a*l*u+c*s*h,a*s*h-c*l*u,a*s*u-c*l*h);break;case It.XZY:t.set(c*s*u-a*l*h,a*l*u-c*s*h,a*s*h+c*l*u,a*s*u+c*l*h);break;default:console.error("unknown euler order: "+o)}return t},t.prototype.toMatrix4=function(t){var e,r=t.elements,i=(e=this).x,n=e.y,o=e.z,a=e.order,s=Math.cos(i*At),u=Math.sin(i*At),c=Math.cos(n*At),l=Math.sin(n*At),h=Math.cos(o*At),f=Math.sin(o*At);if(a===It.XYZ){var p=s*h,d=s*f,m=u*h,v=u*f;r[0]=c*h,r[4]=-c*f,r[8]=l,r[1]=d+m*l,r[5]=p-v*l,r[9]=-u*c,r[2]=v-p*l,r[6]=m+d*l,r[10]=s*c}else if(a===It.YXZ){var y=c*h,x=c*f,g=l*h,T=l*f;r[0]=y+T*u,r[4]=g*u-x,r[8]=s*l,r[1]=s*f,r[5]=s*h,r[9]=-u,r[2]=x*u-g,r[6]=T+y*u,r[10]=s*c}else if(a===It.ZXY){y=c*h,x=c*f,g=l*h,T=l*f;r[0]=y-T*u,r[4]=-s*f,r[8]=g+x*u,r[1]=x+g*u,r[5]=s*h,r[9]=T-y*u,r[2]=-s*l,r[6]=u,r[10]=s*c}else if(a===It.ZYX){p=s*h,d=s*f,m=u*h,v=u*f;r[0]=c*h,r[4]=m*l-d,r[8]=p*l+v,r[1]=c*f,r[5]=v*l+p,r[9]=d*l-m,r[2]=-l,r[6]=u*c,r[10]=s*c}else if(a===It.YZX){var E=s*c,S=s*l,b=u*c,R=u*l;r[0]=c*h,r[4]=R-E*f,r[8]=b*f+S,r[1]=f,r[5]=s*h,r[9]=-u*h,r[2]=-l*h,r[6]=S*f+b,r[10]=E-R*f}else if(a===It.XZY){E=s*c,S=s*l,b=u*c,R=u*l;r[0]=c*h,r[4]=-f,r[8]=l*h,r[1]=E*f+R,r[5]=s*h,r[9]=S*f-b,r[2]=b*f-S,r[6]=u*h,r[10]=R*f+E}else console.error("toMatrix4: Invalid order "+a);return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,t},t.fromRotationMatrix4=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromArray(e,r,i)},t.DEFAULT_ORDER=It.ZYX,t.tempQuat0=new Ft,t.tempMat0=new Dt,t}(),Gt=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this.w=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z+this.w},t.prototype.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},t.prototype.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},t.prototype.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.isZero=function(){var t,e=wt,r=(t=this).x,i=t.y,n=t.z,o=t.w;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e&&Math.abs(o)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector3=function(){return new Vt(this.x,this.y,this.z)},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},t.prototype.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.ONE=new t(1,1,1,1),t.ZERO=new t(0,0,0,0),t}(),Xt=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a},Ht=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},Yt=function(){function t(t,e,r,i,n,o,a,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,r,i,n,o,a,s,u]}return t.prototype.set=function(t,e,r,i,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=i,c[6]=a,c[1]=e,c[4]=n,c[7]=s,c[2]=r,c[5]=o,c[8]=u,this},t.prototype.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=e,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=u,this},t.prototype.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.z)},t.prototype.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[e+r];return this},t.prototype.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,o=e+e,a=r+r,s=i+i,u=e*o,c=e*a,l=e*s,h=r*a,f=r*s,p=i*s,d=n*o,m=n*a,v=n*s,y=this.elements;return y[0]=1-(h+p),y[1]=c+v,y[2]=l-m,y[3]=c-v,y[4]=1-(u+p),y[5]=f+d,y[6]=l+m,y[7]=f-d,y[8]=1-(u+h),this},t.prototype.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},t.prototype.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},t.prototype.copyFrom=function(t){return this.elements=Ht([],Xt(t.elements),!1),this},t.prototype.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},t.prototype.scale=function(t,e){var r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],o=i[3],a=i[6],s=i[1],u=i[4],c=i[7];return i[0]=e*n+r*s,i[3]=e*o+r*u,i[6]=e*a+r*c,i[1]=-r*n+e*s,i[4]=-r*o+e*u,i[7]=-r*a+e*c,this},t.prototype.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.multiplyMatrices=function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[3],s=r[6],u=r[1],c=r[4],l=r[7],h=r[2],f=r[5],p=r[8],d=i[0],m=i[3],v=i[6],y=i[1],x=i[4],g=i[7],T=i[2],E=i[5],S=i[8];return n[0]=o*d+a*y+s*T,n[3]=o*m+a*x+s*E,n[6]=o*v+a*g+s*S,n[1]=u*d+c*y+l*T,n[4]=u*m+c*x+l*E,n[7]=u*v+c*g+l*S,n[2]=h*d+f*y+p*T,n[5]=h*m+f*x+p*E,n[8]=h*v+f*g+p*S,this},t.prototype.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8];return e*(o*c-u*a)+n*(u*i-r*c)+s*(r*a-o*i)},t.prototype.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8],l=c*o-u*a,h=u*i-c*r,f=a*r-o*i,p=e*l+n*h+s*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;return t[0]=l*d,t[1]=(s*a-c*n)*d,t[2]=(u*n-s*o)*d,t[3]=h*d,t[4]=(c*e-s*i)*d,t[5]=(s*r-u*e)*d,t[6]=f*d,t[7]=(n*i-a*e)*d,t[8]=(o*e-n*r)*d,this},t.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},t.prototype.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[3]*i+o[6]*n,a.y=o[1]*r+o[4]*i+o[7]*n,a.z=o[2]*r+o[5]*i+o[8]*n,a},t.prototype.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!Ot(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return Ht([],Xt(this.elements),!1)},t.prototype.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return(new t).setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,c){return new t(e,n,s,r,o,u,i,a,c)},t}(),jt=function(){function t(t,e){void 0===t&&(t=Vt.ZERO),void 0===e&&(e=Vt.X),this.origin=new Vt,this.direction=new Vt,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}return t.prototype.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},t.prototype.clone=function(){return new t(this.origin,this.direction)},t.prototype.copyFrom=function(t){return this.set(t.origin,t.direction)},t.prototype.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},t.prototype.at=function(t,e){var r=e||new Vt;return r.copyFrom(this.origin),r.addScaledVector(this.direction,t)},t.prototype.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},t.prototype.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},t.prototype.intersectBox=function(t,e){var r,i,n,o,a,s,u,c,l,h,f=(r=this.origin).x,p=r.y,d=r.z,m=(i=this.direction).x,v=i.y,y=i.z,x=(n=t.min).x,g=n.y,T=n.z,E=(o=t.max).x,S=o.y,b=o.z,R=1/m,_=1/v,A=1/y;if(R>=0?(a=(x-f)*R,s=(E-f)*R):(a=(E-f)*R,s=(x-f)*R),_>=0?(u=(g-p)*_,c=(S-p)*_):(u=(S-p)*_,c=(g-p)*_),!(a>c||u>s||((u>a||a!=a)&&(a=u),(c<s||s!=s)&&(s=c),(u>a||a!=a)&&(a=u),(c<s||s!=s)&&(s=c),A>=0?(l=(T-d)*A,h=(b-d)*A):(l=(b-d)*A,h=(T-d)*A),a>h||l>s||((l>a||a!=a)&&(a=l),(h<s||s!=s)&&(s=h),s<0))))return a>=0?this.at(a,e):this.at(s,e)},t.prototype.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new Vt).copyFrom(this.origin):void 0;var o=-(this.origin.dot(r)+i)/n;return o>=0?this.at(o,e):void 0},t.prototype.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,this.origin),o=n.dot(this.direction),a=n.dot(n)-o*o,s=e.radius*e.radius;if(!(a>s)){var u=Math.sqrt(s-a),c=o-u,l=o+u;if(!(l<0))return c>=0?this.at(c,r):this.at(l,r)}},t.prototype.intersectTriangle=function(e,r,i){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),c=t.tempVec1.subtractVectors(s,o),l=t.tempVec2.subtractVectors(this.origin,o),h=t.tempVec3.crossVectors(u,c),f=this.direction.dot(h);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}c.crossVectors(l,c);var p=n*this.direction.dot(c);if(!(p<0)){u.cross(l);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*l.dot(h);if(!(m<0))return this.at(m/f,r)}}},t.tempVec0=new Vt,t.tempVec1=new Vt,t.tempVec2=new Vt,t.tempVec3=new Vt,t}(),Wt=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}return t.prototype.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,this},t.prototype.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},t.prototype.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},t.prototype.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.r=null!==(r=t[e])&&void 0!==r?r:0,this.g=null!==(i=t[e+1])&&void 0!==i?i:0,this.b=null!==(n=t[e+2])&&void 0!==n?n:0,this.a=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.setFromHSV=function(t,e,r,i){void 0===i&&(i=1);var n=r*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,c=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,c=a):o>=3&&o<=4?(u=a,c=n):o>=4&&o<=5?(s=a,c=n):o>=5&&o<=6&&(s=n,c=a);var l=r-n;return this.set(s+l,u+l,c+l,i)},t.prototype.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,n)},t.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.prototype.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):t instanceof Array?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},t.prototype.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):t instanceof Array?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},t.prototype.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):t instanceof Array?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},t.prototype.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):t instanceof Array?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},t.prototype.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},t.prototype.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},t.prototype.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},t.prototype.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},t.prototype.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},t.prototype.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},t.prototype.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},t.prototype.toArray=function(){return[this.r,this.g,this.b,this.a]},t.prototype.toVector4=function(){return new Gt(this.r,this.g,this.b,this.a)},t.prototype.toHSV=function(){var e,r=(e=this).r,i=e.g,n=e.b,o=e.a,a=Math.max(r,i,n),s=Math.min(r,i,n),u=a-s,c=0,l=0;return 0!==a&&(l=u/a),a!=s&&(a==r?(c=(i-n)/u,i<n&&(c+=6)):a==i?c=(n-r)/u+2:a==n&&(c=(r-i)/u+4),c*=60),new t(c,l,a,o)},t.prototype.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),o=t.ToHex(Math.round(255*this.a));return e?"#"+r+i+n+o:"#"+r+i+n},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),(new t).setFromHSV(e,r,i,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t.BLACK=new t(0,0,0,1),t.BLUE=new t(0,0,1,1),t.CLEAR=new t(0,0,0,0),t.CYAN=new t(0,1,1,1),t.GRAY=new t(.5,.5,.5,1),t.GREEN=new t(0,1,0,1),t.MAGENTA=new t(1,0,1,1),t.RED=new t(1,0,0,1),t.WHITE=new t(1,1,1,1),t.YELLOW=new t(1,.92,.016,1),t}(),Zt=function(){function t(t,e){void 0===t&&(t=new Vt(1/0,1/0,1/0)),void 0===e&&(e=new Vt(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}return t.prototype.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},t.prototype.setFromArray=function(t){for(var e=Number(1/0),r=Number(1/0),i=Number(1/0),n=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var c=t[s],l=t[s+1],h=t[s+2];c<e&&(e=c),l<r&&(r=l),h<i&&(i=h),c>n&&(n=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,r,i),this.max.set(n,o,a),this},t.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},t.prototype.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),this},t.prototype.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},t.prototype.clone=function(){return(new t).copyFrom(this)},t.prototype.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},t.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},t.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},t.prototype.getCenter=function(t){return void 0===t&&(t=new Vt),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},t.prototype.getSize=function(t){return void 0===t&&(t=new Vt),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},t.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},t.prototype.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},t.prototype.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},t.prototype.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}for(var n=e.children,o=0,a=n.length;o<a;o++)this.expandByObject(n[o]);return this},t.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},t.prototype.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},t.prototype.getParameter=function(t,e){return void 0===e&&(e=new Vt),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},t.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},t.prototype.intersectsSphere=function(t){var e=new Vt;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},t.prototype.clampPoint=function(t,e){return void 0===e&&(e=new Vt),e.copyFrom(t).clamp(this.min,this.max)},t.prototype.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},t.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},t.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.applyMatrix4=function(t,e){if(void 0===e&&(e=new Vt),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},t.prototype.getOBBPoints=function(t,e){if(void 0===e&&(e=new Vt),this.isEmpty())return[];var r=[];return r[0]=new Vt(this.min.x,this.min.y,this.min.z),r[1]=new Vt(this.min.x,this.min.y,this.max.z),r[2]=new Vt(this.min.x,this.max.y,this.min.z),r[3]=new Vt(this.min.x,this.max.y,this.max.z),r[4]=new Vt(this.max.x,this.min.y,this.min.z),r[5]=new Vt(this.max.x,this.min.y,this.max.z),r[6]=new Vt(this.max.x,this.max.y,this.min.z),r[7]=new Vt(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},t.prototype.getBoundingSphere=function(t){this.getCenter(t.center);var e=new Vt;return t.radius=.5*this.getSize(e).length(),t},t.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},t.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),qt=function(){function t(t,e){void 0===t&&(t=Vt.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}return t.prototype.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},t.prototype.setFromPoints=function(t,e){var r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var o=(new Zt).setFromPoints(t);o.getCenter(r),this.radius=o.getSize().length()/2}return this},t.prototype.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},t.prototype.isEmpty=function(){return this.radius<0},t.prototype.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},t.prototype.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},t.prototype.distanceToPoint=function(t){return t.distance(this.center)-this.radius},t.prototype.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},t.prototype.intersectsBox=function(t){return t.intersectsSphere(this)},t.prototype.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new Vt),e.copyFrom(t),r>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},t.prototype.getBoundingBox=function(t){return void 0===t&&(t=new Zt),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},t.prototype.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],o=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*o,this},t.prototype.translate=function(t){return this.center.add(t),this},t.prototype.expandByPoint=function(t){var e=(new Vt).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},t.prototype.union=function(t){var e=new Vt,r=new Vt;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},t.prototype.intersect=function(t){var e=(new Vt).subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},t.prototype.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},t.prototype.clone=function(){return(new t).copyFrom(this)},t}(),Qt=Object.freeze({__proto__:null,get EulerOrder(){return It},Euler:kt,Quaternion:Ft,Vector2:Pt,Vector3:Vt,Vector4:Gt,Matrix3:Yt,Matrix4:Dt,Ray:jt,PI2:_t,DEG2RAD:At,RAD2DEG:Ct,NumberEpsilon:wt,isZero:function(t){return isNaN(t)||Math.abs(t)<wt},isEqual:Ot,damp:function(t,e,r,i){return Mt(t,e,1-Math.exp(-r*i))},lerp:Mt,degToRad:function(t){return t*At},radToDeg:function(t){return t*Ct},clamp:Lt,Color:Wt,Box3:Zt,Sphere:qt}),Kt=(Ut=new Float32Array(1),Bt=new Int32Array(Ut.buffer),function(t){Ut[0]=t;var e=Bt[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)}),Jt=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]=Kt(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=Kt(t[r])},t}();var $t,te=new kt,ee=new Dt;function re(t,e,r,i,n,o,a){var s=t,u=i/n,c=i,l=e.speedOverLifetime;l&&(c=l.getIntegrateValue(0,i,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;s.copyFrom(o),s.addScaledVector(a,c),s.addScaledVector(r,h);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{},d=["x","y","z"];if(p.enabled){var m=new Vt;p.center&&m.setFromArray(p.center);var v=s.clone().subtract(m),y=p.asRotation,x=d.map((function(t){var e=p[t];return e?y?e.getValue(u):e.getIntegrateValue(0,i,n):0}));te.setFromArray(x).negate(),ee.setFromEuler(te);var g=ee.transformPoint(v);s.addVectors(m,g)}if(f.enabled)for(var T=f.asMovement,E=0;E<3;E++){var S=f[d[E]];if(S){var b=T?S.getValue(u):S.getIntegrateValue(0,i,n);s.setElement(E,s.getElement(E)+b)}}return s}function ie(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function ne(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function oe(t,e,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)t[n]=e[n+i];return t}function ae(t,e){1===arguments.length&&(e=t,t=[]);var r=e,i=Math.hypot.apply(Math,h([],l(r),!1));if(0===i)return oe(t,r,r.length);for(var n=0;n<r.length;n++)t[n]=r[n]/i;return t}function se(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(i=0;i<e.length;i++)t[i]=e[i]}else if(r&&t!==r)for(i=0;i<r.length;i++)t[i]=r[i];return t}var ue=(($t={})[F.PARTICLE_ORIGIN_CENTER]=[0,0],$t[F.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],$t[F.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],$t[F.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],$t[F.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],$t[F.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],$t[F.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],$t[F.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],$t[F.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],$t);function ce(t,e){return t?[t[0]-.5,.5-t[1]]:e?ue[e]:[0,0]}function le(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function he(t,e,r){var i=r.position,n=new Vt(t,e,0),o=new Vt;return r.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(i),new jt(i,o)}function fe(t,e,r){var i=t.x,n=t.y,o=t.z,a=new Vt(i-e,n+r,o),s=new Vt(i-e,n-r,o),u=new Vt(i+e,n-r,o),c=new Vt(i+e,n+r,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:c}]}function pe(t,e,r){return void 0===r&&(r=1e-6),Math.abs(t-e)<r}function de(t,e){void 0===e&&(e=2);var r=Math.pow(10,e);return Math.floor(t*r)/r}var me={getPointInCurve:function(t){var e=l(t,2);e[0];var r=e[1],i=this.getPointIndexInCurve(t),n=i.xIndex,o=i.yIndex,a=r[n],s=r[o];return new Pt(a,s)},getPointIndexInCurve:function(t){var e=l(t,3),r=e[0],i=e[2],n=r===lt.LINE||r===lt.EASE_OUT?0:r===lt.EASE_IN||r===lt.EASE||r===lt.HOLD&&i===lt.EASE_IN?2:0;return{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=l(t,3),r=e[0];e[1];var i=e[2];return!(r!==lt.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(r)},isRightSideEase:function(t){var e=l(t,3),r=e[0];e[1];var i=e[2];return!(r!==lt.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(r)},isKeyframeTypeLeftSideEase:function(t){return[lt.EASE,lt.EASE_IN,lt.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[lt.EASE,lt.EASE_OUT,lt.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=l(t,3),r=e[0];e[1];var i=e[2];return r===lt.HOLD&&[lt.HOLD,lt.LINE_OUT,lt.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=l(t,3),r=e[0];e[1];var i=e[2];return r===lt.HOLD&&[lt.HOLD,lt.LINE,lt.EASE_IN].includes(i)}},ve=function(t,e){this.points=t,this.totalLength=e},ye={},xe={},ge=.1;function Te(t,e){return 1-3*e+3*t}function Ee(t,e){return 3*e-6*t}function Se(t){return 3*t}function be(t,e,r){return((Te(e,r)*t+Ee(e,r))*t+Se(e))*t}function Re(t,e,r){return 3*Te(e,r)*t*t+2*Ee(e,r)*t+Se(e)}var _e,Ae=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=de(e.x-t.x,3)+"_"+de(e.y-t.y,3)+"_"+de(e.z-t.z,3)+"&"+de(r.x-t.x,3)+"_"+de(r.y-t.y,3)+"_"+de(r.z-t.z,3)+"&"+de(i.x-t.x,3)+"_"+de(i.y-t.y,3)+"_"+de(i.z-t.z,3);if(xe[n])return{data:xe[n],interval:t};for(var o=[],a=null,s=0,u=0,c=0;c<300;c+=1){var l=new Vt,h=c/299;u=0,l.x=3*Math.pow(1-h,2)*h*(r.x-t.x)+3*(1-h)*Math.pow(h,2)*(i.x-t.x)+Math.pow(h,3)*(e.x-t.x),l.y=3*Math.pow(1-h,2)*h*(r.y-t.y)+3*(1-h)*Math.pow(h,2)*(i.y-t.y)+Math.pow(h,3)*(e.y-t.y),l.z=3*Math.pow(1-h,2)*h*(r.z-t.z)+3*(1-h)*Math.pow(h,2)*(i.z-t.z)+Math.pow(h,3)*(e.z-t.z),null!==a&&(u+=Math.pow(l.x-a.x,2),u+=Math.pow(l.y-a.y,2),u+=Math.pow(l.z-a.z,2)),a=l,s+=u=Math.sqrt(u),o[c]={partialLength:u,point:l}}var f=new ve(o,s);return xe[n]=f,{data:f,interval:new Vt(t.x,t.y,t.z)}}(t,e,r,i),o=n.data,a=n.interval;this.lengthData=o,this.interval=a,this.totalLength=o.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(pe(1-t,0))return e.points[299].point.clone().add(this.interval);if(pe(e.totalLength,0))return this.p1.clone();var r=new Vt,i=de(e.totalLength*t,4),n=this.catching.lastAddedLength,o=this.catching.lastPoint;if(pe(n,i))return e.points[o].point.clone().add(this.interval);var a=!0,s=1;for(i<n&&(s=-1);a;){if(i>=n){if(299===o){r.x=e.points[o].point.x,r.y=e.points[o].point.y,r.z=e.points[o].point.z;break}if(i<n+e.points[o+1].partialLength){var u=(i-n)/e.points[o+1].partialLength;r.x=e.points[o].point.x+(e.points[o+1].point.x-e.points[o].point.x)*u,r.y=e.points[o].point.y+(e.points[o+1].point.y-e.points[o].point.y)*u,r.z=e.points[o].point.z+(e.points[o+1].point.z-e.points[o].point.z)*u;break}}s>0&&o<299?(o+=s,n+=de(e.points[o].partialLength,5)):s<0&&o>0?(n-=de(e.points[o].partialLength,5),o+=s):a=!1}return this.catching.lastPoint=o,this.catching.lastAddedLength=n,r.add(this.interval),r},t}(),Ce=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)}return t.prototype.precompute=function(){this.precomputed=!0,this.mX1===this.mY1&&this.mX2===this.mY2||this.calcSampleValues()},t.prototype.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(),be(this.getTForX(t),this.mY1,this.mY2))},t.prototype.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=be(t*ge,this.mX1,this.mX2)},t.prototype.getTForX=function(t){for(var e=this.mSampleValues,r=0,i=1;10!==i&&e[i]<=t;++i)r+=ge;var n=r+(t-e[--i])/(e[i+1]-e[i])*ge,o=Re(n,this.mX1,this.mX2);return o>=.001?function(t,e,r,i){for(var n=0;n<4;++n){var o=Re(e,r,i);if(0===o)return e;e-=(be(e,r,i)-t)/o}return e}(t,n,this.mX1,this.mX2):0===o?n:function(t,e,r,i,n){var o,a,s=0;do{(o=be(a=e+(r-e)/2,i,n)-t)>0?r=a:e=a}while(Math.abs(o)>1e-7&&++s<10);return a}(t,r,r+ge,this.mX1,this.mX2)},t}();function we(t,e){var r=function(t,e,r){var i=l(t,2),n=i[1],o=me.isHoldOutKeyframe(t),a=me.isHoldInKeyframe(e),s=!a&&me.isRightSideEase(t),u=!o&&me.isLeftSideEase(e);if(s&&!u&&!a){var c=new Pt(n[n.length-4],n[n.length-3]),h=new Pt(n[n.length-2],n[n.length-1]),f=me.getPointInCurve(e),p=new Pt(f.x,f.y);return{type:"ease",p0:c,p1:h,p2:y=new Pt(p.x-(p.x-c.x)/10,p.y),p3:p}}if(!s&&u&&!o){var d=l(e,2)[1],m=me.getPointInCurve(t),v=new Pt(m.x,m.y),y=new Pt(d[0],d[1]);p=new Pt(d[2],d[3]);return{type:"ease",p0:v,p1:new Pt(v.x+(p.x-v.x)/10,v.y),p2:y,p3:p}}if(s&&u){d=l(e,2)[1];return{type:"ease",p0:new Pt(n[n.length-4],n[n.length-3]),p1:new Pt(n[n.length-2],n[n.length-1]),p2:y=new Pt(d[0],d[1]),p3:p=new Pt(d[2],d[3])}}var x=me.getPointInCurve(t),g=me.getPointInCurve(e);o?g.y=x.y:a&&(x.y=g.y);return r?{type:"ease",p0:x,p1:y=new Pt((g.x-x.x)/3+x.x,(g.y-x.y)/3+x.y),p2:p=new Pt((g.x-x.x)/3*2+x.x,(g.y-x.y)/3*2+x.y),p3:g,isHold:o||a,leftHoldLine:o,rightHoldLine:a}:{type:"line",p0:x,p1:g,isHold:o||a,leftHoldLine:o,rightHoldLine:a}}(t,e,!0),i=r.p0,n=r.p1,o=r.p2,a=r.p3;nt(o),nt(a);var s,u,c=a.x-i.x,h=a.y-i.y,f=de((n.x-i.x)/c,5),p=de((o.x-i.x)/c,5);pe(h,0)?s=u=NaN:(s=de((n.y-i.y)/h,5),u=de((o.y-i.y)/h,5)),f<0&&(console.error("invalid bezier points, x1 < 0",i,n,o,a),f=0),p<0&&(console.error("invalid bezier points, x2 < 0",i,n,o,a),p=0),f>1&&(console.error("invalid bezier points, x1 >= 1",i,n,o,a),f=1),p>1&&(console.error("invalid bezier points, x2 >= 1",i,n,o,a),p=1);var d,m=("bez_"+f+"_"+s+"_"+p+"_"+u).replace(/\./g,"p");return ye[m]?d=ye[m]:(d=new Ce(f,s,p,u),ye[m]=d),{points:[i,n,o,a],timeInterval:c,valueInterval:h,curve:d}}var Oe="not_implement",Me=function(){function t(t){this.onCreate(t)}return t.getAllData=function(t,e){for(var r=new(e?Jt:Float32Array)(4*t.index),i=0,n=0,o=t.curves;i<o.length;i++){var a=o[i].toData();r.set(a,n),n+=a.length}return e?r.data:r},t.prototype.onCreate=function(t){throw Error(Oe)},t.prototype.getIntegrateValue=function(t,e,r){throw Error(Oe)},t.prototype.getIntegrateByTime=function(t,e){throw Error(Oe)},t.prototype.getValue=function(t){throw Error(Oe)},t.prototype.toUniform=function(t){throw Error(Oe)},t.prototype.map=function(t){throw Error(Oe)},t.prototype.scaleXCoord=function(t){return this},t.prototype.toData=function(){throw Error(Oe)},t}(),Le=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.value=t},e.prototype.getIntegrateValue=function(t,e,r){return this.value*(e-t)},e.prototype.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},e.prototype.getValue=function(t){return this.value},e.prototype.toUniform=function(){return new Float32Array([0,this.value,0,0])},e.prototype.map=function(t){var e=this.value;return this.value=t(e),this},e}(Me),Ie=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.items=t},e.prototype.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},e.prototype.map=function(t){return this.items=this.items.map(t),this},e}(Me),Pe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.getValue=function(t){return ar(this.min,this.max)},e.prototype.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(Me),Ve=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var o=Math.random();i[n]=e[n]*(1-o)+r[n]*o}return i},e.prototype.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Me),Fe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},e.prototype.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},e.prototype.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},e.prototype.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,o=this.xCoord*r;return((i+e/o*(n-i)+i)*e-(i+t/o*(n-i)+i)*t)/2},e.prototype.getIntegrateByTime=function(t,e){return Xe(e,0,this.xCoord,this.min,this.max)-Xe(t,0,this.xCoord,this.min,this.max)},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e.prototype.scaleXCoord=function(t){return this.xCoord=t,this},e}(Me),Ne=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.stops=Z(t)},e.prototype.getStops=function(){return this.stops},e.prototype.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return q(n.color,o.color,a,!0)}}return e[r].color.slice()},e}(Me),ze=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},e.prototype.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1],a=n[0],s=o[0];if(t>=a&&t<=s){var u=(t-a)/(s-a),c=n[1];return c+u*(o[1]-c)}}return e[r][1]},e.prototype.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},e.prototype.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},e.prototype.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?Xe:Ge,a=0;a<n;a++){var s=r[a],u=r[a+1],c=s[0],l=u[0];if(t>c&&t<=l)return i+o(t,c,l,s[1],u[1]);i+=o(l,c,l,s[1],u[1])}return i},e.prototype.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},e.prototype.toUniform=function(t){var e=t.index,r=this.keys,i=Math.ceil(r.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},e.prototype.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(Me),De=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){var e=t;this.curveMap={},this.keys=[];for(var r=0;r<e.length-1;r++){var i=we(e[r],e[r+1]),n=i.points,o=i.curve,a=i.timeInterval,s=i.valueInterval,u=n[0],c=n[n.length-1];this.keys.push(h(h([],l(u.toArray()),!1),l(n[1].toArray()),!1)),this.keys.push(h(h([],l(c.toArray()),!1),l(n[2].toArray()),!1)),this.curveMap["".concat(u.x,"&").concat(c.x)]={points:n,timeInterval:a,valueInterval:s,curve:o}}},e.prototype.getValue=function(t){var e=0,r=Object.keys(this.curveMap),i=Number(r[0].split("&")[0]),n=Number(r[r.length-1].split("&")[1]);if(t<=i)return this.getCurveValue(r[0],i);if(t>=n)return this.getCurveValue(r[r.length-1],n);for(var o=0;o<r.length;o++){var a=l(r[o].split("&"),2),s=a[0],u=a[1];if(t>=Number(s)&&t<Number(u)){e=this.getCurveValue(r[o],t);break}}return e},e.prototype.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=(e-t)/r,n=0,o=Object.keys(this.curveMap);if(i<=Number(o[0].split("&")[0]))return 0;for(var a=0;a<o.length;a++){var s=l(o[a].split("&"),2),u=s[0],c=s[1];if(i>=Number(c)&&(n+=r*this.getCurveIntegrateValue(o[a],Number(c))),i>=Number(u)&&i<Number(c)){n+=r*this.getCurveIntegrateValue(o[a],i);break}}return n},e.prototype.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},e.prototype.getCurveIntegrateValue=function(t,e){for(var r=this.curveMap[t],i=l(r.points,1)[0],n=r.timeInterval,o=r.valueInterval,a=0,s=(e-i.x)/20,u=0;u<=20;u++){var c=u*s/n,h=i.y+o*r.curve.getValue(c);a+=0===u||20===u?h:u%2==1?4*h:2*h}return a*=s/3},e.prototype.getCurveValue=function(t,e){var r=this.curveMap[t],i=l(r.points,1)[0],n=r.timeInterval,o=r.valueInterval,a=(e-i.x)/n,s=r.curve.getValue(a);return i.y+o*s},e.prototype.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])},e.prototype.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},e}(Me),Ue=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){var e=l(t,3),r=e[0],i=e[1],n=e[2];if(this.curveSegments={},n.length)for(var o=0;o<r.length-1;o++){var a=r[o],s=r[o+1],u=new Vt(i[o][0],i[o][1],i[o][2]),c=new Vt(i[o+1][0],i[o+1][1],i[o+1][2]),h=new Vt(n[2*o][0],n[2*o][1],n[2*o][2]),f=new Vt(n[2*o+1][0],n[2*o+1][1],n[2*o+1][2]),p=we(a,s),d=p.points,m=p.curve,v=p.timeInterval,y=p.valueInterval,x=d[0],g=d[d.length-1],T=new Ae(u,c,h,f);this.curveSegments["".concat(x.x,"&").concat(g.x)]={points:d,timeInterval:v,valueInterval:y,easingCurve:m,pathCurve:T}}},e.prototype.getValue=function(t){var e=de(t,5),r=0,i=new Vt,n=Object.keys(this.curveSegments);if(!n.length)return i;var o=Number(n[0].split("&")[0]),a=Number(n[n.length-1].split("&")[1]);if(e<=o)return i=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)return i=this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=l(n[s].split("&"),2),c=u[0],h=u[1];if(e>=Number(c)&&e<Number(h)){var f=this.curveSegments[n[s]].pathCurve;r=this.getPercValue(n[s],e),i=f.getPointInPercent(r)}}return i},e.prototype.getPercValue=function(t,e){var r=this.curveSegments[t],i=l(r.points,1)[0],n=r.timeInterval,o=de((e-i.x)/n,4);return Lt(r.easingCurve.getValue(o),0,1)},e}(Me),Be=((_e={})[ct.RANDOM]=function(t){return t[0]instanceof Array?new Ve(t):new Pe(t)},_e[ct.CONSTANT]=function(t){return new Le(t)},_e[ct.CONSTANT_VEC2]=function(t){return new Le(t)},_e[ct.CONSTANT_VEC3]=function(t){return new Le(t)},_e[ct.CONSTANT_VEC4]=function(t){return new Le(t)},_e[ct.RGBA_COLOR]=function(t){return new Le(t)},_e[ct.COLORS]=function(t){return new Ie(t.map((function(t){return j(t,!1)})))},_e[ct.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Fe([t[0][1],t[1][1]]):new ze(t)},_e[ct.GRADIENT_COLOR]=function(t){return new Ne(t)},_e[ct.BEZIER_CURVE]=function(t){return 1===t.length?new Le(t[0][1][1]):new De(t)},_e[ct.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Le(new(Vt.bind.apply(Vt,h([void 0],l(t[1][0]),!1)))):new Ue(t)},_e);function ke(t){if(!t||!isNaN(+t))return new Le(t||0);if(t instanceof Me)return t;if(nr(Be[t[0]]))return Be[t[0]](t[1]);throw new Error("ValueType: ".concat(t[0]," is not support"))}function Ge(t,e,r,i,n){var o=t-e;return(i+i+(n-i)*o/(r-e))*o/2}function Xe(t,e,r,i,n){var o=t*t,a=e*e;return(2*(o*t)*(i-n)+3*o*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function He(t,e){if(e){var r=e[0],i=e[1];if(r===ct.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===ct.LINE){if(2===(n=i.length)&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++;var o=Math.ceil(n/2);t.lineSegCount+=o,t.curves.push(i),t.index+=o,t.max=Math.max(t.max,o)}else if(r===ct.BEZIER_CURVE){n=i.length-1;t.index+=2*n,t.curves.push(i),t.max=Math.max(t.max,2*n),t.curveCount+=2*n}}}function Ye(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var je,We=new kt,Ze=new Vt(1,1,1),qe=new Vt(0,0,0),Qe=function(){function t(t,e){var r,i=t.positionOverLifetime,n=void 0===i?{}:i,o=e.transform,a=e.duration,s=e.endBehavior,u=o.scale;this.transform=o,this.basicTransform={position:o.position.clone(),rotation:o.getRotation(),scale:u},n.path&&(this.basicTransform.path=ke(n.path)),this.positionOverLifetime=n,this.options={startSpeed:n.startSpeed||0,startSize:u&&u.x||1,sizeAspect:u&&u.x/(u.y||1)||1,startColor:[1,1,1,1],duration:a||0,looping:s&&s===ht.loop,gravity:Vt.fromArray(n.gravity||[]),gravityModifier:ke(null!==(r=n.gravityOverLifetime)&&void 0!==r?r:0),direction:n.direction?Vt.fromArray(n.direction).normalize():new Vt,endBehavior:s||0};var c=t.sizeOverLifetime;c&&(c.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=ke(c.x||1),this.sizeYOverLifetime=ke(c.y||1),this.sizeZOverLifetime=ke(c.z||1)):this.sizeXOverLifetime=ke(c.size||1));var l=n.linearX||n.linearY||n.linearZ;l&&(this.linearVelOverLifetime={x:n.linearX&&ke(n.linearX),y:n.linearY&&ke(n.linearY),z:n.linearZ&&ke(n.linearZ),asMovement:n.asMovement,enabled:!!l});var h=n.orbitalX||n.orbitalY||n.orbitalZ;h&&(this.orbitalVelOverLifetime={x:n.orbitalX&&ke(n.orbitalX),y:n.orbitalY&&ke(n.orbitalY),z:n.orbitalZ&&ke(n.orbitalZ),center:ie(n.orbCenter),asRotation:n.asRotation,enabled:!!h}),this.speedOverLifetime=n.speedOverLifetime&&ke(n.speedOverLifetime);var f=t.rotationOverLifetime;if(f&&(this.rotationOverLifetime={asRotation:f.asRotation,separateAxes:f.separateAxes,z:ke(f.z||0)},f.separateAxes)){var p=this.rotationOverLifetime;p.x=ke(f.x||0),p.y=ke(f.y||0)}this.gravityModifier=this.options.gravityModifier}return t.prototype.getVelocity=function(){return this.velocity||(this.velocity=this.options.direction.clone().multiply(this.options.startSpeed)),this.velocity},t.prototype.willTranslate=function(){return!!(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled||this.orbitalVelOverLifetime&&this.orbitalVelOverLifetime.enabled||this.options.gravityModifier&&!this.options.gravity.isZero()||this.options.startSpeed&&!this.options.direction.isZero())},t.prototype.updatePosition=function(t,e,r){this.basicTransform.position.set(t,e,r)},t.prototype.updateRotation=function(t,e,r){this.basicTransform.rotation.set(t,e,r)},t.prototype.getRenderData=function(t,e){var r,i,n=this.options,o=Ze.setFromNumber(1),a=We.set(0,0,0),s=t<0?t:Math.max(t,0),u=n.duration,c=s/u,l={life:c,transform:this.transform,startSize:this.basicTransform.scale.clone()},h=this.basicTransform;c=c<0?0:c>1?1:c,this.sizeXOverLifetime&&(o.x=this.sizeXOverLifetime.getValue(c),this.sizeSeparateAxes?(o.y=this.sizeYOverLifetime.getValue(c),o.z=this.sizeZOverLifetime.getValue(c)):o.z=o.y=o.x,r=!0),(r||e)&&l.transform.setScale(o.x,o.y,o.z);var f,p=this.rotationOverLifetime;if(p){var d=function(t){return p.asRotation?t.getValue(c):t.getIntegrateValue(0,c,u)},m=d(p.z),v=p.separateAxes;a.x=v?d(p.x):0,a.y=v?d(p.y):0,a.z=m,i=!0}if(i||e){var y=We.addEulers(h.rotation,a);l.transform.setRotation(y.x,y.y,y.z)}(this.willTranslate()||e)&&(f=re(Ze.setFromNumber(0),this,n.gravity,s,u,h.position,this.getVelocity()));if(h.path&&(f||(f=qe.copyFrom(h.position)),f.add(h.path.getValue(c))),f&&l.transform.setPosition(f.x,f.y,f.z),l.startSize){var x=l.transform.scale;l.transform.setScale(x.x*l.startSize.x,x.y*l.startSize.y,x.z*l.startSize.z)}return l},t}(),Ke="[Galacean Effects]";function Je(t){return["%c".concat(Ke),"background: #AA0100; color: white","".concat(t)]}var $e,tr={error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.error.apply(console,h(h([],l(Je(t)),!1),[e],!1)),null==je||je("error",t,e)},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.debug.apply(console,h([],l(Je(t)),!1)),null==je||je("info",t,e)},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.warn.apply(console,h([],l(Je(t)),!1)),null==je||je("warn",t,e)},register:function(t){t&&nr(t)&&(je=t)}};function er(){}function rr(t){return"string"==typeof t}t.DestroyOptions=void 0,($e=t.DestroyOptions||(t.DestroyOptions={}))[$e.destroy=0]="destroy",$e[$e.keep=1]="keep",$e[$e.force=0]="force";var ir=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function nr(t){return"[object Function]"===Object.prototype.toString.call(t)}function or(t){return"[object Object]"===Object.prototype.toString.call(t)}function ar(t,e){return t+Math.random()*(e-t)}function sr(){throw Error("destroyed item cannot be used again")}var ur,cr=new Ft,lr=1,hr=function(){function t(t,e){void 0===t&&(t={}),this.position=new Vt(0,0,0),this.quat=new Ft(0,0,0,1),this.rotation=new kt(0,0,0),this.scale=new Vt(1,1,1),this.anchor=new Vt(0,0,0),this.children=[],this.worldMatrix=Dt.fromIdentity(),this.localMatrix=Dt.fromIdentity(),this.valid=!1,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new Vt(0,0,0),quat:new Ft(0,0,0,1),scale:new Vt(1,1,1)},this.name="transform_".concat(lr++),t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}return t.getRotation=function(t,e){var r=cr.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},Object.defineProperty(t.prototype,"parentTransform",{get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentMatrixDirty",{get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())},enumerable:!1,configurable:!0}),t.prototype.setPosition=function(t,e,r){this.position.x===t&&this.position.y===e&&this.position.z===r||(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.translate=function(t,e,r){0===t&&0===e&&0===r||(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setRotation=function(t,e,r){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===r||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setQuaternion=function(t,e,r,i){this.quat.x===t&&this.quat.y===e&&this.quat.z===r&&this.quat.w===i||(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setScale=function(t,e,r){this.scale.x===t&&this.scale.y===e&&this.scale.z===r||(this.scale.x=t||1e-5,this.scale.y=e||1e-5,this.scale.z=r||1e-5,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.scaleBy=function(t,e,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.setAnchor=function(t,e,r){this.anchor.x===t&&this.anchor.y===e&&this.anchor.z===r||(this.anchor.x=t,this.anchor.y=e,this.anchor.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setTransform=function(t,e){var r,i=t.position,n=t.rotation,o=t.scale,a=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(i instanceof Vt?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),a)a instanceof Ft?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(n){var c=e?-1:1;n instanceof kt?this.setRotation(n.x*c,n.y*c,n.z*c):this.setRotation(n[0]*c,n[1]*c,n[2]*c)}o&&(o instanceof Vt?this.setScale(o.x,o.y,o.z):this.setScale(o[0],o[1],o[2])),u&&(u instanceof Vt?this.setAnchor(u.x,u.y,u.z):this.setAnchor(u[0],u[1],null!==(r=u[2])&&void 0!==r?r:0))},t.prototype.addChild=function(t){G(this.children,t)},t.prototype.removeChild=function(t){X(this.children,t)},t.prototype.getRotation=function(){return t.getRotation(this.quat,new kt)},t.prototype.getQuaternion=function(){return this.quat},t.prototype.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},t.prototype.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},t.prototype.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},t.prototype.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},t.prototype.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return this.worldTRSCache.scale.clone()},t.prototype.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},t.prototype.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new kt)},t.prototype.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.copyFrom(this.worldTRSCache.scale)},t.prototype.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},t.prototype.getValid=function(){return this.valid},t.prototype.dispose=function(){},t.prototype.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},t.prototype.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t}(),fr=function(){function t(t,e){this._v_priority=0,this.visible=!0,this._contentVisible=!1,this.timeInms=0,this.time=0,this._frozen=!1;var r=t.id,i=t.name,n=t.delay,o=t.parentId,s=t.endBehavior,u=t.transform,c=t.listIndex,l=void 0===c?0:c,h=t.duration,f=void 0===h?0:h;if(this.composition=e,this.id=r,this.name=i,this.delay=n,this.transform=new hr(a({name:this.name},u),e.transform),this.parentId=o,this.duration=f,this.delayInms=1e3*(n||0),this.durInms=1e3*this.duration,this.endBehavior=s,this.lifetime=-this.delayInms/this.durInms,this.listIndex=l,this.speed=1,this.onConstructed(t),f<=0)throw Error("Item duration can't be less than 0, see ".concat(g["Item duration can't be less than 0"]))}return t.isComposition=function(t){return t.type===P.composition},t.isSprite=function(t){return t.type===P.sprite},t.isParticle=function(t){return t.type===P.particle},t.isFilterSprite=function(t){return t.type===P.filter},t.isNull=function(t){return t.type===P.null},t.isTree=function(t){return t.type===P.tree},t.isCamera=function(t){return t.type===P.camera},t.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},Object.defineProperty(t.prototype,"contentVisible",{get:function(){return this._contentVisible&&this.visible},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"content",{get:function(){return this._content},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reusable",{get:function(){var t,e;return null!==(e=null===(t=this.composition)||void 0===t?void 0:t.reusable)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return P.base},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frozen",{get:function(){return this._frozen},set:function(t){this.handleFrozenChanged(this._frozen=!!t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lifetimeStarted",{get:function(){return this.started&&!this.delaying},enumerable:!1,configurable:!0}),t.prototype.setSpeed=function(t){this.speed=t},t.prototype.getSpeed=function(){return this.speed},t.prototype.start=function(){this.started&&!this.ended||(this.started=!0,this.delaying=!0,this.timeInms=0,this.time=0,this.callEnd=!1,this.ended=!1)},t.prototype.stop=function(){this.doStop(),this.started=!1},t.prototype.doStop=function(){this._content&&this._content.stop&&this._content.stop()},t.prototype.createContent=function(){return this._content||(this._content=this.doCreateContent(this.composition)),this._content},t.prototype.doCreateContent=function(t){},t.prototype.onConstructed=function(t){},t.prototype.onUpdate=function(t){var e,r;if(this.started&&!this.frozen&&this.composition){var i=t*this.speed,n=this.timeInms+=i;this.time+=i/1e3;var o=n-this.delayInms;if(this.delaying&&o>=0&&(this.delaying=!1,this.transform.setValid(!0),this.createContent(),this._contentVisible=!0,this.onLifetimeBegin(this.composition,this.content),this.composition.itemLifetimeEvent(this,!0)),!this.delaying){var a=o/this.durInms,s=this.isEnded(o),u=!0;if(this.transform.setValid(!0),s)if(u=!1,this.callEnd||(this.callEnd=!0,this.composition.itemLifetimeEvent(this,!1),this.onEnd()),2!==this.endBehavior&&5!==this.endBehavior){if(this.ended=!0,this.transform.setValid(!1),1===this.endBehavior||3===this.endBehavior?null===(r=(e=this.composition).onPlayerPause)||void 0===r||r.call(e,this):4===this.endBehavior&&(this.transform.setValid(!0),u=!0,a=1,i=0),this.reusable)0===this.endBehavior&&(this._contentVisible=!1,u=!0,i=0,this.type===P.composition&&this.handleVisibleChanged(!1));else{if(0===this.endBehavior||3===this.endBehavior||6===this.endBehavior)return this.dispose();1===this.endBehavior&&(this.endBehavior=2)}a=Math.min(a,1)}else u=!0,5===this.endBehavior&&(this.ended=!0);else this.callEnd&&this.reusable&&(this.setVisible(!0),this.callEnd=!1);this.lifetime=a%1,u&&this.onItemUpdate(i,a)}}},t.prototype.onItemRemoved=function(t,e){},t.prototype.onItemUpdate=function(t,e){},t.prototype.onLifetimeBegin=function(t,e){},t.prototype.onEnd=function(){},t.prototype.setColor=function(t,e,r,i){},t.prototype.setOpacity=function(t){},t.prototype.getVisible=function(){return this.visible},t.prototype.setVisible=function(t){this.visible!==t&&(this.visible=!!t,this.handleVisibleChanged(this.visible))},t.prototype.handleVisibleChanged=function(t){},t.prototype.handleFrozenChanged=function(t){},t.prototype.getWorldTransform=function(t){var e=null!=t?t:new hr({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},t.prototype.getNodeTransform=function(t){return this.transform},t.prototype.translate=function(t,e,r){this.transform.translate(t,e,r)},t.prototype.rotate=function(t,e,r){var i=new kt(t,e,r),n=Ft.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},t.prototype.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},t.prototype.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,o=i.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition(2*t*n/a,-2*e*o/s,r)}},t.prototype.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},t.prototype.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},t.prototype.setScale=function(t,e,r){this.transform.setScale(t,e,r)},t.prototype.getBoundingBox=function(){},t.prototype.getHitTestParams=function(t){},t.prototype.getRenderData=function(){return{transform:this.transform,life:0,visible:this.visible}},t.prototype.getCurrentPosition=function(){var t=new Vt;return this.transform.assignWorldTRS(t),t},t.prototype.isEnded=function(t){return t-this.durInms>.001},t.prototype.reset=function(){this.composition&&(this.onItemRemoved(this.composition,this._content),this._content=void 0,this._contentVisible=!1),this.started=!1},t.prototype.translateByPixel=function(t,e){if(this.composition){var r=this.composition.renderer.canvas.getBoundingClientRect(),i=r.width,n=r.height,o=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(o),s=a.x,u=a.y;this.transform.translate(2*t*s/i,-2*e*u/n,0)}},t.prototype.dispose=function(){this.composition&&(this.composition.destroyItem(this),this.reset(),this.onUpdate=function(){return-1},this.composition=null,this._contentVisible=!1,this.transform.setValid(!1))},t}();function pr(t,e){var r=t.type,i=t.pluginName;if(!i)switch(r){case P.null:case P.base:i="cal";break;case P.sprite:i="sprite";break;case P.particle:i="particle";break;case P.interact:i="interact";break;case P.camera:i="camera";break;case P.filter:i="filter";break;case P.text:i="text";break;case P.tree:i="tree";break;default:throw new Error("invalid vfx item type")}return e.pluginSystem.createPluginItem(i,t,e)}t.Item=void 0,(ur=t.Item||(t.Item={})).is=function(t,e){return t.type===e},ur.isFilter=function(t){return t.type===P.filter},ur.isComposition=function(t){return t.type===P.composition},ur.isParticle=function(t){return t.type===P.particle},ur.isNull=function(t){return t.type===P.null};var dr={},mr=[],vr={};function yr(t,e,r,i){vr[t]=r,dr[t]=e,i&&G(mr,t)}var xr=function(){function t(t){var e={},r=[],i=function(t){var i=dr[t];r.includes(i)||(r.push(i),e[t]=i)};mr.forEach(i),t.forEach(i),this.plugins=Object.keys(e).map((function(t){var e=dr[t];if(!e)throw new Error("plugin '".concat(t,"' not found.")+function(t){var e=gr[t];return e?"\nInstall Plugin: npm i ".concat(e,"@latest --save\nImport Plugin: import '").concat(e,"'"):""}(t));var r=new e;return r.name=t,r})).sort((function(t,e){return t.order-e.order}))}return t.prototype.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionConstructed(t,e)}))},t.prototype.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},t.prototype.resetComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionReset(t,e)}))},t.prototype.createPluginItem=function(t,e,r){var i=vr[t];if(!i)throw new Error("plugin ".concat(t," no registered constructor"));var n=new i(e,r);if(!(n instanceof fr))throw new Error("plugin ".concat(t," invalid constructor type"));return n},t.prototype.processRawJSON=function(t,e){return s(this,void 0,void 0,(function(){return u(this,(function(r){return[2,this.callStatic("processRawJSON",t,e)]}))}))},t.prototype.callStatic=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return s(this,void 0,void 0,(function(){var r,i,n,o,a;return u(this,(function(s){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],a=dr[o.name],t in a&&r.push(Promise.resolve(a[t].apply(a,h([],l(e),!1))));return[2,Promise.all(r)]}))}))},t.prototype.precompile=function(t,e,r){return s(this,void 0,void 0,(function(){return u(this,(function(i){return[2,this.callStatic("precompile",t,e,r)]}))}))},t.prototype.loadResources=function(t,e){return s(this,void 0,void 0,(function(){return u(this,(function(r){return[2,this.callStatic("prepareResource",t,e)]}))}))},t}(),gr={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",tree:"@galacean/effects-plugin-model",model:"@galacean/effects-plugin-model","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",spine:"@galacean/effects-plugin-spine"};var Tr,Er=function(){function t(){this.order=100,this.name=""}return t.precompile=function(t,e){return Promise.resolve()},t.prototype.onCompositionConstructed=function(t,e){},t.prototype.onCompositionItemLifeBegin=function(t,e){},t.prototype.onCompositionItemLifeEnd=function(t,e){},t.prototype.onCompositionItemRemoved=function(t,e){},t.prototype.onCompositionReset=function(t,e){},t.prototype.onCompositionWillReset=function(t,e){},t.prototype.onCompositionDestroyed=function(t){},t.prototype.onCompositionUpdate=function(t,e){},t.prototype.prepareRenderFrame=function(t,e){return!1},t.prototype.postProcessFrame=function(t,e){},t}(),Sr=function(){function t(t,e){this.transform=t;var r=t.position,i=t.getRotation(),n=e.options,o=n.near,a=n.far,s=n.fov,u=n.clipMode;if(this.clipMode=u,this.options={position:r.clone(),rotation:i.clone(),near:ke(o),far:ke(a),fov:ke(s)},e.positionOverLifetime){var c=e.positionOverLifetime,l=c.path,h=c.linearX,f=void 0===h?0:h,p=c.linearY,d=void 0===p?0:p,m=c.linearZ,v=void 0===m?0:m;this.translateOverLifetime={path:l&&ke(l),x:ke(f),y:ke(d),z:ke(v)}}if(e.rotationOverLifetime){var y=e.rotationOverLifetime,x=y.separateAxes,g=y.x,T=void 0===g?0:g,E=y.y,S=void 0===E?0:E,b=y.z,R=void 0===b?0:b;this.rotationOverLifetime={separateAxes:x,x:ke(T),y:ke(S),z:ke(R)}}}return t.prototype.update=function(t){var e=new Ft,r=new Vt,i=new kt;r.copyFrom(this.options.position),i.copyFrom(this.options.rotation);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(t=Lt(t,0,1),n&&(r.x+=n.x.getValue(t),r.y+=n.y.getValue(t),r.z+=n.z.getValue(t),n.path)){var a=n.path.getValue(t);r.add(a)}if(o){var s=o.z.getValue(t);i.z+=s,o.separateAxes?(i.x+=o.x.getValue(t),i.y+=o.y.getValue(t)):(i.x+=s,i.y+=s)}this.far=this.options.far.getValue(t),this.near=this.options.near.getValue(t),this.fov=this.options.fov.getValue(t),this.transform.setPosition(r.x,r.y,r.z),this.transform.setRotation(i.x,i.y,i.z),this.transform.assignWorldTRS(r,e),this.position=r,this.rotation=hr.getRotation(e,i)},t}(),br=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(Er),Rr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return P.camera},enumerable:!1,configurable:!0}),e.prototype.onConstructed=function(t){this.model=t.content},e.prototype.onItemUpdate=function(t,e){var r;null===(r=this.controller)||void 0===r||r.update(e),this.updateCamera()},e.prototype.updateCamera=function(){if(this.controller&&this.composition){var t=this.composition.camera;t.near=this.controller.near,t.far=this.controller.far,t.fov=this.controller.fov,t.clipMode=this.controller.clipMode,t.position=this.controller.position,t.rotation=this.controller.rotation}},e.prototype.getCurrentPosition=function(){return this.controller.position},e.prototype.doCreateContent=function(){return this.controller||(this.controller=new Sr(this.transform,this.model)),this.controller},e}(fr);t.HitTestType=void 0,(Tr=t.HitTestType||(t.HitTestType={}))[Tr.triangle=1]="triangle",Tr[Tr.box=2]="box",Tr[Tr.sphere=3]="sphere",Tr[Tr.custom=4]="custom";var _r,Ar,Cr="click",wr="touchstart",Or="touchmove",Mr="touchend",Lr=I,Ir=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}return t.prototype.bindListeners=function(){var t,e,r,i,n,o,a=this;o=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",l=function(t,e,r,i,o){void 0===i&&(i=0),void 0===o&&(o=0);var s=0,u=0,c=performance.now();if(!a.target)return tr.error("Trigger TouchEvent after EventSystem is disposed"),{x:e,y:r,vx:0,vy:u,dx:i,dy:o,ts:c,width:0,height:0,origin:t};var l=a.target,h=l.width,f=l.height;if(n){var p=c-n.ts;s=(i-n.dx)/p||0,u=(o-n.dy)/p||0,n={dx:i,dy:o,ts:c}}return{x:e,y:r,vx:s,vy:u,dx:i,dy:o,ts:c,width:h,height:f,origin:t}};J()&&(o=function(t){var e=t,r=e.touches,i=e.changedTouches;return r[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((t={})[s]=function(t){if(a.enabled){var s=o(t),u=Pr(s);e=u.x,r=u.y,n=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:e,y:r},a.dispatchEvent(wr,l(t,e,r))}},t[u]=function(t){if(i&&a.enabled){var n=Pr(o(t));e=n.x,r=n.y,a.dispatchEvent(Or,l(t,e,r,e-i.x,r-i.y))}},t[c]=function(t){if(i&&a.enabled){!a.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var n=o(t),s=Pr(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);e=s.x,r=s.y,u<4&&a.dispatchEvent(Cr,l(t,e,r)),a.dispatchEvent(Mr,l(t,e,r,e-i.x,r-i.y))}i=0},t),Object.keys(this.nativeHandlers).forEach((function(t){var e;null===(e=a.target)||void 0===e||e.addEventListener(String(t),a.nativeHandlers[t])}))},t.prototype.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach((function(t){return t(e)}))},t.prototype.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),G(r,e),function(){X(r,e)}},t.prototype.removeEventListener=function(t,e){var r=this.handlers[t];r&&X(r,e)},t.prototype.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var r;null===(r=t.target)||void 0===r||r.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function Pr(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),o=n.left,a=n.top;return{x:(r-o)/n.width*2-1,y:1-(i-a)/n.height*2}}function Vr(t){switch(t){case A.ALPHA:case A.ADD:case A.SUBTRACTION:case A.STRONG_LIGHT:case A.WEAK_LIGHT:return 1;case A.SUPERPOSITION:return 2;case A.BRIGHTNESS:return 3;case A.MULTIPLY:return 0;default:return 1}}t.ShaderType=void 0,(_r=t.ShaderType||(t.ShaderType={}))[_r.vertex=0]="vertex",_r[_r.fragment=1]="fragment";var Fr,Nr,zr=((Ar={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},Ar[t.ShaderType.fragment]={in:"varying"},Ar);function Dr(t,e,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach((function(t){var e=l(t,2),r=e[0],i=e[1];!0===i?n.push("#define ".concat(r)):Number.isFinite(i)&&n.push("#define ".concat(r," ").concat(i))})),o=n.length?n.join("\n")+"\n":"");var a="WEBGL".concat(i),s=(o+="\n#ifndef ".concat(a,"\n#define ").concat(a,"\n#endif"))+"\n"+e,u=s.match(/#version\s+\b\d{3}\b\s*(es)?/),c=u?u[0]:"";if(c&&c.includes("300")){var h=new RegExp("".concat(c),"g");1===i&&(s=s.replace(/\b(in|out)\b/g,(function(t){var e;return null!==(e=zr[r][t])&&void 0!==e?e:t}))),s=s.replace(h,"\n")}return s}function Ur(t,e){switch(e){case void 0:case A.ALPHA:t.blendFunction=[E.ONE,E.ONE_MINUS_SRC_ALPHA,E.ONE,E.ONE_MINUS_SRC_ALPHA];break;case A.ADD:t.blendFunction=[E.ONE,E.ONE,E.ONE,E.ONE];break;case A.SUBTRACTION:t.blendFunction=[E.ONE,E.ONE,E.ZERO,E.ONE],t.blendEquation=[E.FUNC_REVERSE_SUBTRACT,E.FUNC_REVERSE_SUBTRACT];break;case A.SUPERPOSITION:t.blendFunction=[E.ONE,E.ONE,E.ONE,E.ONE];break;case A.MULTIPLY:t.blendFunction=[E.DST_COLOR,E.ONE_MINUS_SRC_ALPHA,E.DST_COLOR,E.ONE_MINUS_SRC_ALPHA];break;case A.BRIGHTNESS:t.blendFunction=[E.ONE,E.ONE_MINUS_SRC_ALPHA,E.ONE,E.ONE_MINUS_SRC_ALPHA];break;case A.STRONG_LIGHT:t.blendFunction=[E.DST_COLOR,E.DST_ALPHA,E.ZERO,E.ONE];break;case A.WEAK_LIGHT:t.blendFunction=[E.DST_COLOR,E.ZERO,E.ZERO,E.ONE];break;default:console.warn("blendMode ".concat(e," not in specification, please set blend params separately"))}}function Br(t,e){e===C.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=E.CW,t.cullFace=e===C.BACK?E.BACK:E.FRONT)}function kr(t,e){switch(e){case void 0:t.stencilTest=!1;break;case w.MASK:t.stencilTest=!0,t.stencilFunc=[E.ALWAYS,E.ALWAYS],t.stencilOpZPass=[E.REPLACE,E.REPLACE];break;case w.OBSCURED:t.stencilTest=!0,t.stencilFunc=[E.EQUAL,E.EQUAL];break;case w.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[E.NOTEQUAL,E.NOTEQUAL];break;case w.NONE:t.stencilTest=!1;break;default:console.warn("maskMode ".concat(e," not in specification, please set stencil params seperately"))}}t.TextureLoadAction=void 0,(Fr=t.TextureLoadAction||(t.TextureLoadAction={}))[Fr.whatever=0]="whatever",Fr[Fr.clear=2]="clear",t.TextureSourceType=void 0,(Nr=t.TextureSourceType||(t.TextureSourceType={}))[Nr.none=0]="none",Nr[Nr.data=1]="data",Nr[Nr.image=2]="image",Nr[Nr.compressed=3]="compressed",Nr[Nr.video=4]="video",Nr[Nr.canvas=5]="canvas",Nr[Nr.framebuffer=6]="framebuffer",Nr[Nr.mipmaps=7]="mipmaps";var Gr=function(){function t(){this.callbacks={}}return t.prototype.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},t.prototype.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},t.prototype.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},t.prototype.download=function(t,e,r,i){var n=this;if(void 0===e&&(e="json"),!this.start(t,r,i)){var o=new XMLHttpRequest,a=function(){n.finish(t,o.status,o.response)};o.responseType=e,o.addEventListener("load",(function(){200==o.status||0==o.status?n.finish(t,200,o.response):a()})),o.addEventListener("error",a),o.open("GET",t,!0),o.send()}},t.prototype.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},t.prototype.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e||0==e?[r]:[e,r],o=n.length-1,a=i.length;o<a;o+=2)i[o].apply(null,n)},t}(),Xr=!1;function Hr(t,e){return s(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return!Xr&&e?[3,2]:[4,Yr(t)];case 1:case 5:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,Yr(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),Xr=!0,[4,Yr(t)];case 6:return[2]}}))}))}function Yr(t){return s(this,void 0,void 0,(function(){var e,r;return u(this,(function(i){if(e="",t instanceof HTMLImageElement){if(t.complete)return[2,t];e=t.src}else t instanceof Blob?(e=URL.createObjectURL(t),r=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: ".concat(JSON.stringify(t)));return[2,new Promise((function(t,i){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,r&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,r&&URL.revokeObjectURL(e),i("Load image fail: ".concat(e,", reason: ").concat(JSON.stringify(t)))},n.src=e}))]}))}))}function jr(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new Promise((function(e,r){(new Gr).downloadBinary(t,e,(function(e,i){r("Couldn't load bins ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))}function Wr(t){return s(this,void 0,void 0,(function(){var e;return u(this,(function(r){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,K()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,r){var i=e.play();i?i.then((function(){return t(e)})):e.addEventListener("loadeddata",(function r(){t(e),e.removeEventListener("loadeddata",r)}),!0),e.addEventListener("error",(function(t){r(t)}))}))]}))}))}function Zr(e,r,i){return void 0===i&&(i=[]),s(this,void 0,void 0,(function(){var n,o,s,c,l,h,f;return u(this,(function(u){switch(u.label){case 0:return 34067!==e.target?[3,2]:(s=(n=e).mipmaps,c=n.target,l=s.map((function(t){return Promise.all(t.map((function(t){return qr(t,r)})))})),[4,Promise.all(l)]);case 1:return h=u.sent(),f=i[s[0][0][1][0]].url,[2,a(a({keepImageSource:!1},e),{mipmaps:h,sourceFrom:{target:c,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:s.map((function(t){return t.map((function(t){return[t[1][1],t[1][2]]}))}))}})];case 2:return s=(o=e).mipmaps,c=o.target,l=s.map((function(t){return qr(t,r)})),[4,Promise.all(l)];case 3:return h=u.sent(),f=i[s[0][1][0]].url,[2,a(a({keepImageSource:!1},e),{mipmaps:h,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:s.map((function(t){return[t[1][1],t[1][2]]}))}})]}}))}))}function qr(t,e){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return u(this,(function(s){if(r=l(t[1],3),i=r[0],n=r[1],o=r[2],!(a=e[i]))throw new Error("invalid bin pointer: ".concat(JSON.stringify(t)));return[2,Yr(new Blob([new Uint8Array(a,n,o)]))]}))}))}var Qr=1,Kr=function(){function e(){this.destroyed=!1,this.id="Tex"+Qr++}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getWidth=function(){return this.width||0},e.prototype.getHeight=function(){return this.height||0},e.prototype.uploadCurrentVideoFrame=function(){},e.prototype.offloadData=function(){},e.prototype.reloadData=function(){},e.prototype.initialize=function(){},e.prototype.assembleOptions=function(e){var r=e.target,i=void 0===r?E.TEXTURE_2D:r,n=e.format,o=void 0===n?E.RGBA:n;return e.sourceType||(e.sourceType="image"in e?t.TextureSourceType.image:"data"in e?t.TextureSourceType.data:"video"in e?t.TextureSourceType.video:0),a({minFilter:E.NEAREST,magFilter:E.NEAREST,wrapS:E.CLAMP_TO_EDGE,wrapT:E.CLAMP_TO_EDGE,target:i,format:E.RGBA,internalFormat:o,type:E.UNSIGNED_BYTE},e)},e}();function Jr(t,e,r,i){var n,o,a=e.length/r/i;return o=n=4===a||0===a?E.RGBA:3===a?E.RGB:2===a?E.LUMINANCE_ALPHA:E.LUMINANCE,Kr.createWithData(t,{data:e,width:r,height:i},{type:E.HALF_FLOAT,format:n,internalFormat:o,wrapS:E.CLAMP_TO_EDGE,wrapT:E.CLAMP_TO_EDGE})}var $r=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw Error("texture missing KTX identifier");var n=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===o.getUint32(0,!0);this.glType=o.getUint32(1*n,a),this.glTypeSize=o.getUint32(2*n,a),this.glFormat=o.getUint32(3*n,a),this.glInternalFormat=o.getUint32(4*n,a),this.glBaseInternalFormat=o.getUint32(5*n,a),this.pixelWidth=o.getUint32(6*n,a),this.pixelHeight=o.getUint32(7*n,a),this.pixelDepth=o.getUint32(8*n,a),this.numberOfArrayElements=o.getUint32(9*n,a),this.numberOfFaces=o.getUint32(10*n,a),this.numberOfMipmapLevels=o.getUint32(11*n,a),this.bytesOfKeyValueData=o.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:tr.warn("Number of faces expected"+e+", but found "+this.numberOfFaces):tr.warn("Texture arrays not currently supported"):tr.warn("Only 2D textures currently supported")}return t.prototype.mipmaps=function(t){for(var e=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,s);e.push({data:c,width:i,height:n}),r+=s+4,r+=3-(s+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function ti(e){var r=new $r(e,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,c=r.glFormat,l=i>=Math.floor(Math.log2(Math.max(n,o))+1);return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?E.TEXTURE_CUBE_MAP:E.TEXTURE_2D,internalFormat:u,format:c,mipmaps:r.mipmaps(l)}}var ei,ri=function(){function e(){this.reloadPending={}}return e.prototype.reload=function(t){return s(this,void 0,void 0,(function(){var e,r;return u(this,(function(i){switch(i.label){case 0:return e=t.id,this.reloadPending[e]?[2]:t.sourceFrom?(this.reloadPending[e]=!0,[4,this.loadSource(t.sourceFrom)]):[3,2];case 1:return r=i.sent(),t.updateSource(r),this.reloadPending[e]=!1,[3,3];case 2:throw new Error("No source from");case 3:return[2]}}))}))},e.prototype.canOffloadTexture=function(e){if(e){var r=e.type;if(r===t.TextureSourceType.compressed||r===t.TextureSourceType.image){var i=e,n=i.target,o=i.map,a=e.url;return n===E.TEXTURE_CUBE_MAP?"object"==typeof o&&!!o:rr(a)&&a.length>0}if(r===t.TextureSourceType.mipmaps){var s=e,u=s.bin,c=s.mipmaps,l=e,h=(n=l.target,l.maps),f=e.urls;return u?c.length>0:n===E.TEXTURE_CUBE_MAP?h.every((function(t){return"object"==typeof t&&t})):f.every((function(t){return rr(t)&&t.length>0}))}}return!1},e.prototype.loadSource=function(e,r){return s(this,void 0,void 0,(function(){var i,n,o,s,c,l,h,f,p,d,m,v,y,x,g,T,S,b=this;return u(this,(function(u){switch(u.label){case 0:return i=e.type,n=e.target,o=e.map,s=e.url,l=(c=e).bin,h=c.mipmaps,f=e.urls,p=e.maps,n!==E.TEXTURE_CUBE_MAP||i===t.TextureSourceType.mipmaps?[3,2]:[4,this.loadCubeMap(o)];case 1:return d=u.sent(),[2,a(a({},r),{cube:d,target:E.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:a({},o),target:E.TEXTURE_CUBE_MAP}})];case 2:return i!==t.TextureSourceType.image?[3,4]:[4,Yr(s)];case 3:return m=u.sent(),[2,a(a({},r),{image:m,sourceType:t.TextureSourceType.image,sourceFrom:{type:i,url:s,target:E.TEXTURE_2D}})];case 4:return i!==t.TextureSourceType.video?[3,6]:[4,Wr(s)];case 5:return v=u.sent(),[2,a(a({},r),{video:v,sourceType:t.TextureSourceType.video})];case 6:return i!==t.TextureSourceType.compressed?[3,8]:[4,jr(s)];case 7:return y=u.sent(),[2,a(a(a({},ti(y)),r),{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:return i!==t.TextureSourceType.mipmaps?[3,17]:l?[4,jr(l)]:[3,13];case 9:return x=u.sent(),g=null!=n?n:E.TEXTURE_2D,T=g===E.TEXTURE_2D?h.slice():h.map((function(t){return t.slice()})),S=void 0,n!==E.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(h.map((function(t){return b.loadMipmapImages(t,x)})))];case 10:return S=u.sent(),[3,12];case 11:S=this.loadMipmapImages(h,x),u.label=12;case 12:return[2,a(a({},r),{mipmaps:S,target:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:l,mipmaps:T,target:g,type:t.TextureSourceType.mipmaps}})];case 13:return n!==E.TEXTURE_2D&&n?[3,15]:[4,Promise.all(f.map((function(t){return Yr(t)})))];case 14:return S=u.sent(),[2,a(a({},r),{mipmaps:S,target:E.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:f.slice(),target:E.TEXTURE_2D}})];case 15:return n!==E.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(p.map((function(t){return b.loadCubeMap(t)})))];case 16:return S=u.sent(),[2,a(a({},r),{mipmaps:S,target:E.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:p.map((function(t){return a({},t)})),target:E.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: ".concat(i))}}))}))},e.prototype.loadMipmapImages=function(t,e){return s(this,void 0,void 0,(function(){return u(this,(function(r){return[2,Promise.all(t.map((function(t){return Yr(new Blob([new Uint8Array(e,t[0],t[1])]))})))]}))}))},e.prototype.loadCubeMap=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,Promise.all(t.map((function(t){return Yr(t)})))]}))}))},e}();var ii,ni=function(){function t(t){this.destroyed=!1;var e=t.name,r=void 0===e?"defaultDataBlock":e;this.name=r}return t.prototype.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(r){e.setUniformValue(r,t[r])}))},t.prototype.invalidAllFlags=function(){},t.prototype.updateUniformSubData=function(t,e,r){},t}();function oi(t){return"object"==typeof t&&t&&void 0===t.length&&t instanceof Kr}t.MaterialRenderType=void 0,(ii=t.MaterialRenderType||(t.MaterialRenderType={}))[ii.normal=0]="normal",ii[ii.transformFeedback=1]="transformFeedback";var ai,si,ui=1,ci=function(){function e(e){this.props=e,this.destroyed=!1,this.initialized=!1;var r=e.name,i=void 0===r?"Material"+ui++:r,n=e.renderType,o=void 0===n?t.MaterialRenderType.normal:n,s=e.shader,u=e.uniformSemantics;this.name=i,this.renderType=o,this.shaderSource=s,this.uniformSemantics=a({},u)}return Object.defineProperty(e.prototype,"blending",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendFunction",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendEquation",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilRef",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpZPass",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"culling",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cullFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendColor",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthRange",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polygonOffsetFill",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polygonOffset",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sampleAlphaToCoverage",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpFail",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpZFail",{set:function(t){},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){},e.prototype.use=function(t,e){},e}(),li="uniform vec2 uFilterSourceSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));return mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}";t.ShaderCompileResultStatus=void 0,(ai=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[ai.noShader=0]="noShader",ai[ai.success=1]="success",ai[ai.fail=2]="fail",ai[ai.compiling=3]="compiling",t.GLSLVersion=void 0,(si=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",si.GLSL3="300 es";var hi=function(t){this.source=t},fi="effects-internal-copy",pi="effects-internal-copy-mesh",di="\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",mi="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\n".concat(li,"\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n fragColor = filterMain(vTex,uFilterSource);\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n");function vi(e,r){var i=2===e,n=i?"#version 300 es":"";return{name:fi,vertex:Dr([],n+"\n"+di,t.ShaderType.vertex,e),fragment:Dr([],n+"\n"+mi,t.ShaderType.fragment,e),glslVersion:i?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:pi+ +r}}var yi,xi={format:E.RGBA,type:E.UNSIGNED_BYTE,minFilter:E.LINEAR,magFilter:E.LINEAR,wrapS:E.CLAMP_TO_EDGE,wrapT:E.CLAMP_TO_EDGE},gi=Symbol("dispose"),Ti=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}return e.prototype.requestColorAttachmentTexture=function(e){var r=this,i=e.width,n=e.height,o=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:i,height:n},name:o},s=[o];Object.getOwnPropertyNames(xi).forEach((function(t){var r,i=null!==(r=e[t])&&void 0!==r?r:xi[t];a[t]=i,s.push(t,i)}));var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var l=this.engine;nt(l),c=Kr.create(l,a),this.textureCache[u]=c,this.textureRef[u]=1,c[gi]=c.dispose,c.dispose=function(){return r.removeTexture(u)}}return c},e.prototype.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("ref count < 0");var r=this.textureCache[t];r&&(r[gi](),r.dispose=r[gi]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.prototype.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var r=t.textureCache[e];r[gi](),r.dispose=r[gi]})),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),Ei=function(){function t(t){void 0===t&&(t={}),this.semantics=a({},t)}return t.prototype.toObject=function(){return a({},this.semantics)},t.prototype.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},t.prototype.getSemanticValue=function(t,e){var r=this.semantics[t];return nr(r)?r(e):r},t.prototype.hasSemanticValue=function(t){return t in this.semantics},t.prototype.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}(),Si=((yi={})[E.FLOAT]=Float32Array.BYTES_PER_ELEMENT,yi[E.INT]=Int32Array.BYTES_PER_ELEMENT,yi[E.SHORT]=Int16Array.BYTES_PER_ELEMENT,yi[E.BYTE]=Int8Array.BYTES_PER_ELEMENT,yi),bi=function(){function t(t){this.name=t}return t.prototype.initialize=function(){},t.prototype.flush=function(){},t}();function Ri(t){return t===E.INT?new Int32Array(0):t===E.SHORT?new Int16Array(0):new Float32Array(0)}var _i="lookup_texture",Ai="offscreen_canvas",Ci={};function wi(t){return Ci[t]}var Oi,Mi,Li=1,Ii=function(){function e(t,e){this.engine=t,this.destroyed=!1,this.visible=!0;var r=e.material,i=e.geometry,n=e.name,o=void 0===n?"<unnamed>":n,a=e.priority,s=void 0===a?0:a,u=e.worldMatrix,c=void 0===u?Dt.fromIdentity():u;this.id="Mesh"+Li++,this.name=o,this.geometry=i,this.material=r,this.priority=s,this.worldMatrix=c}return Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},set:function(t){this._priority=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.setVisible=function(t){this.visible=t},e.prototype.render=function(t){var e=t.renderingData,r=this.material;e.currentFrame.globalUniforms&&(e.currentCamera&&(t.setGlobalMatrix("effects_MatrixInvV",e.currentCamera.getInverseViewMatrix()),t.setGlobalMatrix("effects_MatrixV",e.currentCamera.getViewMatrix()),t.setGlobalMatrix("effects_MatrixVP",e.currentCamera.getViewProjectionMatrix()),t.setGlobalMatrix("_MatrixP",e.currentCamera.getProjectionMatrix())),t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix)),e.currentFrame.editorTransform&&r.setVector4("uEditorTransform",e.currentFrame.editorTransform),r.use(t,e.currentFrame.globalUniforms);var i=this.geometry;i.flush(),t.drawGeometry(i,r)},e.prototype.getVisible=function(){return this.visible},e.prototype.firstGeometry=function(){return this.geometry},e.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},e.prototype.restore=function(){},e.prototype.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var r=null==e?void 0:e.material;r!==t.DestroyOptions.keep&&this.material.dispose(r),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},e}(),Pi=1e3;t.RenderPassAttachmentStorageType=void 0,(Oi=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[Oi.none=0]="none",Oi[Oi.color=1]="color",Oi[Oi.stencil_8_opaque=2]="stencil_8_opaque",Oi[Oi.depth_16_opaque=3]="depth_16_opaque",Oi[Oi.depth_stencil_opaque=4]="depth_stencil_opaque",Oi[Oi.depth_16_texture=5]="depth_16_texture",Oi[Oi.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(Mi=t.TextureStoreAction||(t.TextureStoreAction={}))[Mi.store=0]="store",Mi[Mi.clear=2]="clear";var Vi,Fi=function(){function e(e,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(i instanceof Kr)this.texture=i,this.externalTexture=!0;else if(i){var o=i.wrapT,s=i.wrapS,u=i.minFilter,c=i.magFilter,l=i.internalFormat,h=i.format,f=void 0===h?E.RGBA:h,p=i.type,d=void 0===p?E.UNSIGNED_BYTE:p;this.externalTexture=!1,this.textureOptions={size:n,format:f,type:d,internalFormat:l||f,wrapT:o,wrapS:s,minFilter:u,magFilter:c,name:r.name},this.texture=Kr.create(e,a(a({},this.textureOptions),{sourceType:t.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"storageType",{get:function(){return t.RenderPassAttachmentStorageType.color},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.texture.getWidth()||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.texture.getHeight()||0},enumerable:!1,configurable:!0}),e}();t.RenderPassDestroyAttachmentType=void 0,(Vi=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[Vi.force=0]="force",Vi[Vi.keep=1]="keep",Vi[Vi.keepExternal=2]="keepExternal",Vi[Vi.destroy=0]="destroy";var Ni=1,zi=function(){function e(e,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+Ni++:i,o=r.clearAction,s=r.semantics,u=r.depthStencilAttachment,c=r.storeAction,l=r.priority,h=void 0===l?0:l,f=r.meshOrder,p=void 0===f?t.OrderType.ascending:f,d=r.meshes,m=void 0===d?[]:d,v=r.delegate,y=void 0===v?{}:v;this.name=n,this.renderer=e,this.priority=h,this.meshOrder=p,this.meshes=tt(m.slice(),this.meshOrder),this.depthStencilType=(null==u?void 0:u.storageType)||t.RenderPassAttachmentStorageType.none,this.clearAction=a({},o),this.storeAction=a({colorAction:t.TextureStoreAction.store,depthAction:t.TextureStoreAction.store,stencilAction:t.TextureStoreAction.store},c),this.semantics=new Ei(s),this.options=r,this.delegate=y,this.setViewportOptions(r)}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewport",{get:function(){return this.getViewport()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilAttachment",{get:function(){return this.getStencilAttachment()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthAttachment",{get:function(){return this.getDepthAttachment()},enumerable:!1,configurable:!0}),e.prototype.addMesh=function(t){et(this.meshes,t,this.meshOrder)},e.prototype.removeMesh=function(t){X(this.meshes,t)},e.prototype.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,h([0,0],l(t),!1)),tt(this.meshes,this.meshOrder),this.meshes},e.prototype.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.prototype.configure=function(t){if(this.frameBuffer)t.setFrameBuffer(this.frameBuffer);else{var e=l(this.getViewport(),4),r=e[0],i=e[1],n=e[2],o=e[3];t.setViewport(r,i,n,o)}},e.prototype.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.prototype.frameCleanup=function(t){},e.prototype.resetColorAttachments=function(e){var r=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=e.map((function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new Fi(r.renderer.engine,{texture:e})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=i,this.frameBuffer&&(this.frameBuffer.bind(),this.frameBuffer.resetColorTextures(e.map((function(t){return t}))))}else this.resetAttachments({attachments:e.map((function(t){return{texture:t}}))})},e.prototype.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.prototype.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.frameBuffer){var e=this.customViewport;this.frameBuffer.isCustomViewport=!1,this.frameBuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.frameBuffer&&(this.frameBuffer.isCustomViewport=!0,this.frameBuffer.viewportScale=this.viewportScale)},e.prototype._resetAttachments=function(){var e,r,i=this,n=this.renderer,o=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null===(e=this.frameBuffer)||void 0===e||e.dispose({depthStencilAttachment:t.RenderPassDestroyAttachmentType.keepExternal}),this.frameBuffer=null);var s=this.viewportScale,u=this.isCustomViewport?this.customViewport:[0,0,n.getWidth()*s,n.getHeight()*s],c=[u[2],u[3]],l=this.name;if(null===(r=o.attachments)||void 0===r?void 0:r.length){var h=o.attachments.map((function(t,e){var r;return new Fi(i.renderer.engine,a({size:c,name:(null===(r=t.texture)||void 0===r?void 0:r.name)||"".concat(l,"##color_").concat(e)},t))}));this.attachments=h;var f=Rn.create({storeAction:this.storeAction,name:l,viewport:u,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:o.depthStencilAttachment||{storageType:t.RenderPassAttachmentStorageType.none}},n);f.bind(),f.unbind(),this.frameBuffer=f}else this.attachments.length=0},e.prototype.getViewport=function(){var t,e=(null===(t=this.frameBuffer)||void 0===t?void 0:t.viewport)||this.customViewport;if(e)return e;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},e.prototype.getDepthAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:t.getDepthTexture()?this.getDepthTexture(t.getDepthTexture(),t.externalStorage):void 0}},e.prototype.getStencilAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:t.getStencilTexture()?this.getStencilTexture(t.getStencilTexture(),t.externalStorage):void 0}},e.prototype.getDepthTexture=function(t,e){var r;if(!this.depthTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.prototype.getStencilTexture=function(t,e){var r;if(!this.stencilTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.prototype.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.prototype.dispose=function(e){var r,i;if(!this.destroyed){var n=(null==e?void 0:e.meshes)||void 0;n!==t.DestroyOptions.keep&&this.meshes.forEach((function(t){t.dispose(n)})),this.meshes.length=0;var o=(null==e?void 0:e.colorAttachment)?e.colorAttachment:t.RenderPassDestroyAttachmentType.force;this.attachments.forEach((function(e){e.externalTexture&&o===t.RenderPassDestroyAttachmentType.keepExternal||o===t.RenderPassDestroyAttachmentType.keep||e.dispose()})),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force,s=this.frameBuffer;if(s)s.dispose({depthStencilAttachment:a}),s.externalStorage&&a===t.RenderPassDestroyAttachmentType.keepExternal||a===t.RenderPassDestroyAttachmentType.keep||(null===(r=this.stencilTexture)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose());this.options=this.renderer=null,this.initialize=sr}},e}(),Di="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",Ui="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define SPRITE_SHADER 1\nin vec4 aPoint;in vec2 aIndex;uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixInvV;uniform mat4 effects_MatrixVP;out vec4 vColor;out vec4 vTexCoord;\n#ifdef ADJUST_LAYER\nout vec2 vFeatherCoord;\n#endif\nout highp vec3 vParams;const float d2r=3.141592653589793/180.;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec4 filterMain(float t,vec4 position);\n#pragma FILTER_VERT\nvec3 rotateByQuat(vec3 a,vec4 quat){vec3 qvec=quat.xyz;vec3 uv=cross(qvec,a);vec3 uuv=cross(qvec,uv)*2.;return a+(uv*2.*quat.w+uuv);}void main(){int index=int(aIndex.x);vec4 texParams=uTexParams[index];mat4 mainData=uMainData[index];float life=mainData[1].z;if(life<0.||life>1.){gl_Position=vec4(3.,3.,3.,1.);}else{vec4 _pos=mainData[0];vec2 size=mainData[1].xy;vec3 point=rotateByQuat(vec3(aPoint.xy*size,0.),mainData[2]);vec4 pos=vec4(_pos.xyz,1.0);float renderMode=texParams.z;if(renderMode==0.){pos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixInvV[0].xyz*point.x+effects_MatrixInvV[1].xyz*point.y;}else if(renderMode==1.){pos.xyz+=point;pos=effects_ObjectToWorld*pos;}else if(renderMode==2.){pos=effects_ObjectToWorld*pos;pos.xy+=point.xy;}else if(renderMode==3.){pos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixInvV[0].xyz*point.x+effects_MatrixInvV[2].xyz*point.y;}gl_Position=effects_MatrixVP*pos;\n#ifdef ADJUST_LAYER\nvec4 filter_Position=filterMain(life,pos);\n#endif\ngl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#ifdef ADJUST_LAYER\nfilter_Position=vec4(filter_Position.xy*uEditorTransform.xy+uEditorTransform.zw*filter_Position.w,filter_Position.zw);\n#endif\n#endif\n#ifdef ADJUST_LAYER\nvTexCoord=vec4(filter_Position.xy/filter_Position.w+1.,gl_Position.xy/gl_Position.w+1.)/2.;vFeatherCoord=aPoint.zw;\n#else\nvec4 texOffset=uTexOffset[index];vTexCoord=vec4(aPoint.zw*texOffset.zw+texOffset.xy,texParams.xy);\n#endif\nvColor=mainData[3];vParams=vec3(aIndex.y,texParams.y,texParams.x);}}",Bi="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define SPRITE_SHADER 1\nin vec4 vColor;in vec4 vTexCoord;in highp vec3 vParams;\n#ifdef ADJUST_LAYER\nuniform sampler2D uSamplerPre;vec4 filterMain(vec2 coord,sampler2D tex);in vec2 vFeatherCoord;uniform sampler2D uFeatherSampler;\n#endif\nuniform sampler2D uSampler0;uniform sampler2D uSampler1;uniform sampler2D uSampler2;uniform sampler2D uSampler3;uniform sampler2D uSampler4;uniform sampler2D uSampler5;uniform sampler2D uSampler6;uniform sampler2D uSampler7;\n#if MAX_FRAG_TEX == 16\nuniform sampler2D uSampler8;uniform sampler2D uSampler9;uniform sampler2D uSampler10;uniform sampler2D uSampler11;uniform sampler2D uSampler12;uniform sampler2D uSampler13;uniform sampler2D uSampler14;uniform sampler2D uSampler15;\n#endif\nvec4 texture2DbyIndex(float index,vec2 coord);\n#pragma FILTER_FRAG\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\nvoid main(){vec4 color=vec4(0.);\n#ifdef ADJUST_LAYER\nvec2 featherCoord=abs(vFeatherCoord-vec2(0.5))/0.5;float cc=sqrt(max(featherCoord.x,featherCoord.y));float blend=vColor.a*texture2D(uFeatherSampler,vec2(cc,0.)).r;if(blend>=1.){color=filterMain(vTexCoord.xy,uSamplerPre);}else if(blend<=0.){color=texture2D(uSamplerPre,vTexCoord.zw);}else{color=mix(texture2D(uSamplerPre,vTexCoord.zw),filterMain(vTexCoord.xy,uSamplerPre),blend);}\n#else\nvec4 texColor=texture2DbyIndex(round(vParams.x),vTexCoord.xy);color=blendColor(texColor,vColor,round(vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);fragColor=color;}vec4 texture2DbyIndex(float index,vec2 coord){\n#ifndef ADJUST_LAYER\nif(index==0.){return texture2D(uSampler0,coord);}if(index==1.){return texture2D(uSampler1,coord);}if(index==2.){return texture2D(uSampler2,coord);}if(index==3.){return texture2D(uSampler3,coord);}if(index==4.){return texture2D(uSampler4,coord);}if(index==5.){return texture2D(uSampler5,coord);}if(index==6.){return texture2D(uSampler6,coord);}if(index==7.){return texture2D(uSampler7,coord);}\n#if MAX_FRAG_TEX == 16\nif(index==8.){return texture2D(uSampler8,coord);}if(index==9.){return texture2D(uSampler9,coord);}if(index==10.){return texture2D(uSampler10,coord);}if(index==11.){return texture2D(uSampler11,coord);}if(index==12.){return texture2D(uSampler12,coord);}if(index==13.){return texture2D(uSampler13,coord);}if(index==14.){return texture2D(uSampler14,coord);}if(index==15.){return texture2D(uSampler15,coord);}\n#endif\nreturn texture2D(uSampler0,coord);\n#else\nreturn vec4(0.);\n#endif\n}",ki="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#ifdef USE_FILTER\nuniform vec4 uFSprite;\n#endif\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\n#pragma FILTER_FRAG\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}\n#ifdef USE_FILTER\n#ifdef USE_SPRITE\ntexOffset=uTexOffset/uFSprite.xy;\n#endif\ncolor=filterMain(vTexCoord,uMaskTex);\n#else\nif(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#endif\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n",Gi="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef USE_FILTER\n#pragma FILTER_VERT\n#endif\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef USE_FILTER\nfilterMain(life);\n#endif\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",Xi="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nout float vLife;out vec2 vTexCoord;out vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",Hi="uniform vec4 uTexRange;uniform vec2 uFilterSourceSize;\n#define INTERPOLATION 0\nvec4 filterMain(vec2 texCoord,sampler2D source){float x=uTexRange.x+texCoord.x*uTexRange.y;\n#if INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 color=mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nvec4 color=texture2D(source,vec2(x,texCoord.y));\n#endif\nx=uTexRange.z+texCoord.x*uTexRange.w;vec4 opacity=texture2D(source,vec2(x,texCoord.y));return vec4(color.rgb,opacity.r);}",Yi="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",ji="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",Wi="uniform sampler2D uLastSource;uniform vec4 uParams;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);if(uParams.x<1.){return c1;}vec4 c2=texture2D(uLastSource,coord);return mix(c1,c2,uParams.y);}",Zi="uniform vec4 uWaveParams;\n#ifdef PATICLE_SHADER\nin vec4 vWaveParams;\n#else\nuniform vec4 vWaveParams;\n#endif\nvec4 filterMain(vec2 texCoord,sampler2D tex){vec2 vp=texCoord-uWaveParams.xy;float xx=dot(vp,uWaveParams.zw);float d=sin(vWaveParams.x*xx+vWaveParams.y)*vWaveParams.z;vec2 up=vec2(-uWaveParams.w,uWaveParams.z)*d;return texture2D(tex,clamp(texCoord+up,0.,1.));}",qi="uniform vec4 uMovementValue;uniform vec4 uStrengthValue;uniform vec4 uPeriodValue;out vec4 vWaveParams;void filterMain(float lifetime){const float pi2=3.14159265;vWaveParams=vec4(getValueFromTime(lifetime,uPeriodValue)*pi2,getValueFromTime(lifetime,uMovementValue)*pi2,getValueFromTime(lifetime,uStrengthValue),0.);}",Qi="uniform sampler2D uBloomBlur;uniform vec4 uBloomParams;vec4 filterMain(vec2 coord,sampler2D tex){const vec3 gamma=vec3(1./2.2);vec4 c1=texture2D(tex,coord);vec4 bloomColor=texture2D(uBloomBlur,coord);float alpha=max(c1.a,bloomColor.a);vec3 color=max(c1.rgb*c1.a,bloomColor.rgb*bloomColor.a)/alpha*uBloomParams.y+bloomColor.rgb*uBloomParams.x;return vec4(color,alpha);}",Ki="uniform vec4 uColorThreshold;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);vec3 color=c1.rgb*c1.a;vec3 s=step(uColorThreshold.xyz,color);float m=min(s.r+s.g+s.b,1.);return c1*m;}",Ji="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",$i="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=ACESToneMapping(finalColor);}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",tn="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);}",en="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);}",rn="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);}",nn="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",on=function(e){function r(r,i){var n=e.call(this,r,i)||this,o=n.renderer.engine,a=bi.create(o,{mode:E.TRIANGLE_STRIP,attributes:{aPos:{type:E.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=ci.create(o,{shader:{vertex:Ji,fragment:nn,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=Ii.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}return o(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var r=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",r),e.renderMeshes([this.screenMesh])},r}(zi),an=function(e){function r(r,i,n){var o=e.call(this,r,n)||this;o.type=i;var a=o.renderer.engine,s="PostProcess",u=bi.create(a,{name:s,mode:E.TRIANGLE_STRIP,attributes:{aPos:{type:E.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:Ji,fragment:"H"==i?tn:en,glslVersion:t.GLSLVersion.GLSL1},l=ci.create(a,{name:s,shader:c});return l.blending=!1,l.depthTest=!1,l.culling=!1,o.screenMesh=Ii.create(a,{name:s,geometry:u,material:l,priority:0}),o.priority=5e3,o}return o(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",pn(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFrameBuffer().getColorTextures()[0])},r}(zi),sn=function(e){function r(t,r){var i=e.call(this,t,r)||this,n="PostProcess",o=i.renderer.engine,a=bi.create(o,{name:n,mode:E.TRIANGLE_STRIP,attributes:{aPos:{type:E.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:Ji,fragment:rn},u=ci.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=Ii.create(o,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}return o(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",pn(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},r}(zi),un=function(e){function r(r,i){var n=e.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new Fi(a);var s=bi.create(a,{name:o,mode:E.TRIANGLE_STRIP,attributes:{aPos:{type:E.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=ci.create(a,{name:o,shader:{vertex:Ji,fragment:$i,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=Ii.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}return o(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFrameBuffer(null)},r.prototype.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var r=e.renderingData.currentFrame.globalVolume,i=r.bloomIntensity,n=r.brightness,o=r.saturation,a=r.contrast,s=r.useBloom,u=r.useToneMapping;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",n),this.screenMesh.material.setFloat("_Saturation",o),this.screenMesh.material.setFloat("_Contrast",a),this.screenMesh.material.setInt("_UseBloom",s),s&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i)),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},r}(zi),cn={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},ln="_effects_default_",hn=1,fn=function(){function e(e){var r;this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=e.camera,n=e.keepColorBuffer,o=e.renderer,s=e.editorTransform,u=void 0===s?[1,1,0,0]:s,c=e.globalVolume,l=e.clearAction,h=void 0===l?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:l,f=o.engine;c&&(this.globalVolume=a(a({},cn),c)),this.globalUniforms=new mn;var p,d=[],m={};if(this.renderer=o,this.globalVolume){var v=this.globalVolume.useHDR?E.HALF_FLOAT:E.UNSIGNED_BYTE;d=[{texture:{format:E.RGBA,type:v,magFilter:E.LINEAR,minFilter:E.LINEAR}}],p={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var y=[new zi(o,{name:ln,priority:Pi,meshOrder:t.OrderType.ascending,depthStencilAttachment:p,attachments:d,clearAction:m})];if(this.setRenderPasses(y),this.globalVolume){var x=this.globalVolume.useBloom,g=new Fi(f);if(x){var T=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],S=new Array(7),b=(v=this.globalVolume.useHDR?E.HALF_FLOAT:E.UNSIGNED_BYTE,new on(o,{name:"BloomThresholdPass",attachments:[{texture:{format:E.RGBA,type:v,minFilter:E.LINEAR,magFilter:E.LINEAR}}]}));b.sceneTextureHandle=g,this.addRenderPass(b);for(var R=0;R<7;R++){S[R]=new Fi(f);var _=new an(o,"H",{name:"GaussianDownPassH"+R,viewport:T,attachments:[{texture:{format:E.RGBA,type:v,minFilter:E.LINEAR,magFilter:E.LINEAR}}]}),A=new an(o,"V",{name:"GaussianDownPassV"+R,viewport:T,attachments:[{texture:{format:E.RGBA,type:v,minFilter:E.LINEAR,magFilter:E.LINEAR}}]});A.gaussianResult=S[R],this.addRenderPass(_),this.addRenderPass(A),T[2]/=2,T[3]/=2}T[2]*=4,T[3]*=4;for(R=0;R<6;R++){var C=new sn(o,{name:"GaussianUpPass"+R,viewport:T,attachments:[{texture:{format:E.RGBA,type:v,minFilter:E.LINEAR,magFilter:E.LINEAR}}]});C.gaussianDownSampleResult=S[5-R],this.addRenderPass(C),T[2]*=2,T[3]*=2}}var w=void 0;w=x?new un(o,g):new un(o),this.addRenderPass(w)}this.semantics=new Ei(e.semantics),this.clearAction=h,this.name="RenderFrame".concat(hn++);var O=y[0],M={type:E.UNSIGNED_BYTE,format:E.RGBA,internalFormat:E.RGBA,wrapS:E.MIRRORED_REPEAT,wrapT:E.MIRRORED_REPEAT,minFilter:E.NEAREST,magFilter:E.NEAREST};this.emptyTexture=Kr.create(f,a({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},M)),this.transparentTexture=Kr.create(f,a({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},M)),this.camera=i,this.keepColorBuffer=n,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=Gt.fromArray(u),e.clearAction||this.resetClearActions(),this.passTextureCache=new Ti(f);var L=f.gpuCapability,I=L.detail,P=vi(L.level,I.readableDepthStencilTextures&&I.writableFragDepth);null===(r=this.renderer.getShaderLibrary())||void 0===r||r.addShader(P)}return Object.defineProperty(e.prototype,"renderPasses",{get:function(){return this._renderPasses.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.addMeshToDefaultRenderPass=function(t){for(var e=this.renderPasses,r=this.renderPassInfoMap,i=t.priority,n=1;n<e.length;n++){var o=e[n-1],a=r.get(e[n]),s=r.get(o);if(a&&s&&(a.listStart>i&&(i>s.listEnd||1===n)))return this.addToRenderPass(o,t)}for(var u=e.length-1,c=e[u];u>=0&&!c.name.includes(ln);)c=e[--u];return this.addToRenderPass(c,t)},e.prototype.removeMeshFromDefaultRenderPass=function(e){for(var r,i,n,o=this,s=this.renderPasses,u=this.renderPassInfoMap,c=s.length-1;c>=0;c--){var l=s[c],h=u.get(l);if(h&&(h.listStart<=e.priority&&h.listEnd>=e.priority)){var f=l.meshes.indexOf(e);if(-1===f)return;var p=1===f&&l.meshes[0].name===fi;if(l.removeMesh(e),p){var d=s[c+1],m=l.meshes;h.intermedia||null===(r=h.preRenderPass)||void 0===r||r.resetColorAttachments([]);for(var v=1;v<m.length;v++)null===(i=h.preRenderPass)||void 0===i||i.addMesh(m[v]);var y=null===(n=l.attachments[0])||void 0===n?void 0:n.texture,x=y===this.resource.color_a||y===this.resource.color_b;l.dispose({meshes:t.DestroyOptions.keep,colorAttachment:x?t.RenderPassDestroyAttachmentType.keep:t.RenderPassDestroyAttachmentType.destroy,depthStencilAttachment:t.RenderPassDestroyAttachmentType.keep}),X(s,l),this.removeRenderPass(l),u.delete(l),d&&this.updateRenderInfo(d),h.preRenderPass&&this.updateRenderInfo(h.preRenderPass),h.prePasses&&h.prePasses.forEach((function(e){if(o.removeRenderPass(e.pass),!1!==(null==e?void 0:e.destroyOptions)){e.pass.attachments.forEach((function(t){t.texture===o.resource.color_b&&t.texture===o.resource.color_a||t.texture.dispose()}));var r=a(a({},(null==e?void 0:e.destroyOptions)?e.destroyOptions:{}),{depthStencilAttachment:t.RenderPassDestroyAttachmentType.keep});e.pass.dispose(r)}})),this.resetRenderPassDefaultAttachment(s,Math.max(c-1,0)),1===s.length&&(s[0].resetColorAttachments([]),this.removeRenderPass(this.resource.finalCopyRP))}return this.resetClearActions()}}},e.prototype.splitDefaultRenderPassByMesh=function(e,r){var i,n,o,a=this.findMeshRenderPassIndex(e),s=this.renderPasses[a];this.createResource();var u=s.meshes.indexOf(e),c=s.meshes.slice(0,u),f=s.meshes.slice(u),p=this.renderPassInfoMap;if(!(null===(i=r.attachments)||void 0===i?void 0:i.length))throw Error("should include at least one color attachment");var d=this.renderPasses,m=d.indexOf(s);d[m-1],X(d,s);var v=p.get(s);p.delete(s);var y=2===this.renderer.engine.gpuCapability.level?E.LINEAR:E.NEAREST,x=new zi(this.renderer,{name:ln+m,priority:s.priority,attachments:[{texture:{sourceType:t.TextureSourceType.framebuffer,format:E.RGBA,name:"frame_a",minFilter:y,magFilter:y}}],clearAction:s.clearAction||{colorAction:t.TextureLoadAction.clear},storeAction:s.storeAction,depthStencilAttachment:this.resource.depthStencil,meshes:c,meshOrder:t.OrderType.ascending});f.unshift(this.createCopyMesh());var g=this.renderPasses;g[a]=x;var T=[],S=f.slice();r.prePasses&&(r.prePasses.forEach((function(t,e){t.priority=s.priority+1+e,t.setMeshes(f),T.push(t)})),g.splice.apply(g,h([a+1,0],l(T),!1)),S.splice(0,2));var b=this.resource.finalCopyRP;g.includes(b)||g.push(b);var R=T[T.length-1];R.initialize(this.renderer);var _=new zi(this.renderer,{name:ln+(m+1),priority:s.priority+1+((null===(n=r.prePasses)||void 0===n?void 0:n.length)||0),meshes:S,meshOrder:t.OrderType.ascending,depthStencilAttachment:this.resource.depthStencil,storeAction:r.storeAction,clearAction:{depthAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.whatever,colorAction:t.TextureLoadAction.whatever}});return g.splice(a+1+((null===(o=r.prePasses)||void 0===o?void 0:o.length)||0),0,_),this.setRenderPasses(g),this.updateRenderInfo(R),this.updateRenderInfo(x),this.updateRenderInfo(_),p.get(x).prePasses=v.prePasses,T.pop(),p.get(R).prePasses=T.map((function(t,e){return{pass:t,destroyOptions:!1}})),this.resetClearActions(),R},e.prototype.dispose=function(e){var r,i;(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var n=(null==e?void 0:e.passes)?e.passes:void 0;n!==t.DestroyOptions.keep&&this._renderPasses.forEach((function(t){t.dispose(n)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null===(i=null===(r=this.resource.depthStencil)||void 0===r?void 0:r.texture)||void 0===i||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},e.prototype.resetRenderPassDefaultAttachment=function(t,e){for(var r,i,n,o=this.resource,a=o.color_a,s=o.color_b,u=e;u<t.length;u++){var c=t[u],l=null===(r=c.attachments[0])||void 0===r?void 0:r.texture;if(l&&n===l){var h=l===a?s:a;c.resetColorAttachments([h])}(l=null===(i=c.attachments[0])||void 0===i?void 0:i.texture)&&(n=l)}},e.prototype.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(ln)||!r.meshes.includes(t)||(e=i,!1)})),e},e.prototype.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e)},e.prototype.getRPAttachments=function(t,e){var r;if(1===(null==t?void 0:t.length)){var i=t[0],n=i.texture,o=i.persistent,a=n.format,s=null!==(r=null==e?void 0:e.getInitAttachments())&&void 0!==r?r:[];if(a===E.RGBA&&!o){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[0].texture===u?this.resource.color_b:u}]}}return t},e.prototype.resetClearActions=function(){var e=this.renderPasses.length>1?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;this.clearAction.stencilAction=e,this.clearAction.depthAction=e,this.clearAction.colorAction=e,this.keepColorBuffer&&(this.clearAction.colorAction=t.TextureLoadAction.whatever)},e.prototype.updateRenderInfo=function(e){var r,i=this,n=this.renderPassInfoMap,o=this.renderPasses;n.has(e)?r=n.get(e):(r={intermedia:!1,renderPass:e,listStart:0,listEnd:0},n.set(e,r)),r.intermedia=e.attachments.length>0;var a=e.meshes;a[0]?(r.listStart=(a[0].name===fi?a[1]:a[0]).priority,r.listEnd=a[a.length-1].priority):(r.listStart=0,r.listEnd=0);var s=o.indexOf(e),u=0===s?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;return 0===s&&(e.clearAction.colorAction=t.TextureLoadAction.clear),e.clearAction.depthAction=u,e.clearAction.stencilAction=u,s>-1?e.semantics.setSemantic("EDITOR_TRANSFORM",(function(){return i.editorTransform})):e.semantics.setSemantic("EDITOR_TRANSFORM",void 0),r.preRenderPass=o[s-1],r},e.prototype.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.prototype.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.prototype.createResource=function(){var e,r=this.renderer.engine;if(!this.resource){var i=r.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?E.LINEAR:E.NEAREST,c=Kr.create(r,{sourceType:t.TextureSourceType.framebuffer,format:E.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=Kr.create(r,{sourceType:t.TextureSourceType.framebuffer,format:E.RGBA,data:{width:a,height:s},minFilter:u,magFilter:u,name:"frame_b"}),h=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new zi(this.renderer,{depthStencilAttachment:{storageType:h},attachments:[{texture:c}]}).initialize(this.renderer),p=new dn(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,colorAction:t.TextureLoadAction.clear},meshOrder:t.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null===(e=f.getDepthAttachment())||void 0===e?void 0:e.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:l,finalCopyRP:p,depthStencil:f.depthAttachment,resRP:f}}},e.prototype.createCopyMesh=function(t){var e=fi,r=this.renderer.engine,i=bi.create(r,{name:e,mode:E.TRIANGLE_STRIP,attributes:{aPos:{type:E.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=vi(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=ci.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:e,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[E.SRC_ALPHA,E.ONE_MINUS_SRC_ALPHA,E.SRC_ALPHA,E.ONE_MINUS_SRC_ALPHA]),Ii.create(r,{name:e,geometry:i,material:o,priority:0})},e.prototype.removeRenderPass=function(t){X(this._renderPasses,t)},e}();function pn(t){return t?new Pt(t.getWidth(),t.getHeight()):new Pt}var dn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(null)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",pn(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(zi),mn=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},vn=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t}(),yn="function"==typeof WebGL2RenderingContext,xn=function(){function t(t){this.setupCapability(t)}return t.prototype.setupCapability=function(t){var e,r=yn&&t instanceof WebGL2RenderingContext?2:1,i=2===r,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),a=!!t.getExtension("OES_texture_half_float_linear"),s=!!t.getExtension("OES_texture_float_linear");this.level=r,this.type=i?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),i&&!a&&(a=gn(t,t.HALF_FLOAT)),i&&!s&&(s=gn(t,t.FLOAT)),this.internalFormatDepth16=i?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=i?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=i||t.getExtension("OES_texture_float")?t.FLOAT:0,c=i?WebGL2RenderingContext.HALF_FLOAT:(null===(e=t.getExtension("OES_texture_half_float"))||void 0===e?void 0:e.HALF_FLOAT_OES)||0,l={floatTexture:u,halfFloatTexture:c,maxSample:i?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:i?!!t.getExtension("EXT_color_buffer_float"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:i?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:bn(t),halfFloatLinear:a,floatLinear:s,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:i||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:i||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:i||!!this.drawBufferExtension,asyncShaderCompile:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:i||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:i||!!o,writableFragDepth:i||!!t.getExtension("EXT_frag_depth")};this.detail=l,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},t.prototype.framebufferTexture2D=function(t,e,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw new Error("draw multiple color buffers not available");var a=o?o["COLOR_ATTACHMENT".concat(r,"_WEBGL")]:t["COLOR_ATTACHMENT".concat(r)];a?t.framebufferTexture2D(e,a,i,n,0):console.error("invalid color attachment index: "+r)},t.prototype.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1!==this.level||r){var i=e.map((function(e,i){return e?r?r["COLOR_ATTACHMENT".concat(i,"_WEBGL")]:t["COLOR_ATTACHMENT".concat(i)]:t.NONE}));r?r.drawBuffersWEBGL(i):t.drawBuffers(i)}else if(e.length>1)throw Error("draw buffers not available")},t.prototype.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function gn(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(i=!0),t.deleteTexture(r),i}var Tn,En,Sn={NONE:0,PVRTC:1,ASTC:2};function bn(t){return t.getExtension("WEBGL_compressed_texture_astc")?Sn.ASTC:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?Sn.PVRTC:Sn.NONE}t.FilterMode=void 0,(Tn=t.FilterMode||(t.FilterMode={}))[Tn.Nearest=0]="Nearest",Tn[Tn.Linear=1]="Linear",t.RenderTextureFormat=void 0,(En=t.RenderTextureFormat||(t.RenderTextureFormat={}))[En.RGBA32=0]="RGBA32",En[En.RGBAHalf=1]="RGBAHalf";var Rn=function(){function t(){}return t.prototype.resize=function(t,e,r,i){},t.prototype.resetColorTextures=function(t){},t.prototype.unbind=function(){},t.prototype.bind=function(){},Object.defineProperty(t.prototype,"stencilStorage",{get:function(){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthStorage",{get:function(){},enumerable:!1,configurable:!0}),t.prototype.getDepthTexture=function(){},t.prototype.getStencilTexture=function(){},t.prototype.getColorTextures=function(){return[]},t.prototype.dispose=function(t){},t}(),_n=function(){function t(){}return t.prototype.setGlobalFloat=function(t,e){},t.prototype.setGlobalInt=function(t,e){},t.prototype.setGlobalMatrix=function(t,e){},t.prototype.getFrameBuffer=function(){return null},t.prototype.setFrameBuffer=function(t){},t.prototype.setViewport=function(t,e,r,i){},t.prototype.resize=function(t,e){},t.prototype.clear=function(t){},t.prototype.getWidth=function(){return 0},t.prototype.getHeight=function(){return 0},t.prototype.addLostHandler=function(t){},t.prototype.addRestoreHandler=function(t){},t.prototype.lost=function(t){},t.prototype.restore=function(){},t.prototype.getShaderLibrary=function(){},t.prototype.renderRenderFrame=function(t){},t.prototype.renderMeshes=function(t){},t.prototype.drawGeometry=function(t,e){},t.prototype.getTemporaryRT=function(t,e,r,i,n,o){return null},t.prototype.dispose=function(t){},t}(),An=1,Cn=function(){function e(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,n),this.updateMesh()}return e.prototype.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new Vt,n=new Ft,o=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,o),e.x=o.x,e.y=o.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},e.prototype.createMaterial=function(e){var r,i=[["ENV_EDITOR",(null===(r=this.engine.renderer)||void 0===r?void 0:r.env)===y]],n=ke(this.color).getValue(0),o=this.engine.gpuCapability.level,a={shader:{vertex:Dr(i,"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",t.ShaderType.vertex,o),fragment:Dr(i,"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n",t.ShaderType.fragment,o),glslVersion:t.GLSLVersion.GLSL1,cacheId:"".concat(e.cachePrefix,"_effects_interact")},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=ci.create(this.engine,a);return s.depthTest=!1,s.setVector4("uPos",new Gt(0,0,0,0)),s.setVector2("uSize",new Pt(1,1)),s.setVector4("uColor",new Gt(n[0]/255,n[1]/255,n[2]/255,n[3])),s.setQuaternion("uQuat",new Ft(0,0,0,0)),s},e.prototype.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return bi.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:E.LINES,maxVertex:4})},e.prototype.createMesh=function(t,e){return Ii.create(this.engine,{name:"Interact_preview"+An++,priority:0,worldMatrix:Dt.fromIdentity(),geometry:t,material:e})},e}(),wn=function(e){function r(t,r){var i,n=e.call(this,t,r)||this;return n.downgrade=.95,n.dragRatio=[1,1],n.engine=null===(i=n.composition)||void 0===i?void 0:i.getEngine(),n}return o(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return P.interact},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"enable",{get:function(){return this.enabled},set:function(t){this.enabled=t,t||(this.bouncingArg=null)},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){this.ui=t.content,this.enabled=!0},r.prototype.onLifetimeBegin=function(t){var e,r,i,n=this.ui.options,o=(null!==(r=null===(e=this.engine)||void 0===e?void 0:e.renderer)&&void 0!==r?r:{}).env;null===(i=this.composition)||void 0===i||i.addInteractiveItem(this,n.type),n.type===L.DRAG&&(o!==y||n.enableInEditor)&&t.event&&this.beginDragTarget(n,t.event)},r.prototype.onItemUpdate=function(){var t;null===(t=this.previewContent)||void 0===t||t.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,On(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.prototype.onEnd=function(){this.composition&&this.composition.removeInteractiveItem(this,this.ui.options.type)},r.prototype.onItemRemoved=function(){var t;this.clickable=!1,null===(t=this.previewContent)||void 0===t||t.mesh.dispose(),this.endDragTarget()},r.prototype.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),r=fe(Vt.ZERO,.5,.5);return r.forEach((function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)})),{type:t.HitTestType.triangle,area:r}},r.prototype.getHitTestParams=function(){if(this.clickable&&this.canInteract()){var t=this.ui.options.behavior,e=this.getBoundingBox();return e?{type:e.type,triangles:e.area,behavior:t}:void 0}},r.prototype.doCreateContent=function(t){var e,r=this.ui.options,i=r.type,n=r.showPreview,o=this.engine,a=(null!==(e=null==o?void 0:o.renderer)&&void 0!==e?e:{}).env;if(nt(o),i===L.CLICK&&(this.clickable=!0,n&&a===y)){var s=t.getRendererOptions();this.previewContent=new Cn(this.ui,s,this.transform,o)}return{}},r.prototype.beginDragTarget=function(t,e){var r=this;if("camera"===t.target){var i,n={touchstart:function(t){var e;if(r.canInteract()){r.dragEvent=null,r.bouncingArg=null;var n=null===(e=r.composition)||void 0===e?void 0:e.camera;i={x:t.x,y:t.y,cameraParam:{position:(null==n?void 0:n.position.toArray())||[0,0,8],fov:(null==n?void 0:n.fov)||60}}}},touchmove:function(t){r.handleDragMove(i,t),r.bouncingArg=t},touchend:function(t){if(r.canInteract()){var e=r.bouncingArg;if(!On(e,3)&&e){e.vx*=5,e.vy*=5,r.dragEvent=a({},i)}i=null}}};Object.keys(n).forEach((function(t){e.addEventListener(t,n[t])})),n.touchmove({dx:0,dy:0,width:1,height:1}),this.endDragTarget=function(){Object.keys(n).forEach((function(t){e.removeEventListener(t,n[t])}))}}},r.prototype.endDragTarget=function(){},r.prototype.handleDragMove=function(t,e){var r,i;if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.composition){var n=this.ui.options,o=t.cameraParam,a=o.position,s=o.fov,u=e.dy,c=e.dx*e.width/e.height,h=a[2],f=Math.tan(s*Math.PI/180/2)*Math.abs(h),p=u*f,d=c*f,m=a[0]-this.dragRatio[0]*d,v=a[1]-this.dragRatio[1]*p;if(n.dxRange){var y=l(n.dxRange,2);(m=Lt(m,x=y[0],g=y[1]))!==x&&m!==g&&x!==g&&(null===(r=e.origin)||void 0===r||r.preventDefault())}if(n.dyRange){var x,g,T=l(n.dyRange,2);(v=Lt(v,x=T[0],g=T[1]))!==x&&v!==g&&x!==g&&(null===(i=e.origin)||void 0===i||i.preventDefault())}this.composition.camera.position=new Vt(m,v,h)}},r.prototype.canInteract=function(){var t;return Boolean(null===(t=this.composition)||void 0===t?void 0:t.interactive)&&this.enabled},r}(fr);function On(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}var Mn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.mesh=[],e}return o(e,t),e.prototype.onCompositionItemLifeBegin=function(t,e){e instanceof wn&&e.previewContent&&this.addMesh(e.previewContent.mesh)},e.prototype.onCompositionItemRemoved=function(t,e){e instanceof wn&&e.previewContent&&this.removeMesh(e.previewContent.mesh,t.renderFrame)},e.prototype.prepareRenderFrame=function(t,e){return this.mesh&&this.mesh.forEach((function(t){return e.addMeshToDefaultRenderPass(t)})),this.mesh=[],!1},e.prototype.addMesh=function(t){this.mesh.push(t)},e.prototype.removeMesh=function(t,e){e.removeMeshFromDefaultRenderPass(t)},e}(Er),Ln=function(){};t.maxSpriteMeshItemCount=8,t.maxSpriteTextureCount=8;var In=1,Pn=function(){function e(t,e,r){this.engine=t,this.composition=r,this.items=[],this.dirty=!1;var i=e.wireframe,n=this.createGeometry(i?E.LINES:E.TRIANGLES),o=this.createMaterial(e,2);this.wireframe=i,this.mesh=Ii.create(t,{name:"MSprite"+In++,priority:0,worldMatrix:Dt.fromIdentity(),geometry:n,material:o})}return e.prototype.setItems=function(e){var r,i,n,o,a,s=[],u=[],c=2,l=0,h=0,f=0;if(!e.length)return this.mesh.setVisible(!1),!0;for(var p=0;p<e.length;p++)if(e[p].renderInfo){a=e[p].renderInfo;break}if(!a)return!0;this.items=e.slice(),e.length>2&&(c=t.maxSpriteMeshItemCount),this.mtlSlotCount!==c&&this.mesh.setMaterial(this.createMaterial(a,c),{textures:t.DestroyOptions.keep});var d=null!==(o=null===(n=null===(i=null===(r=a.filter)||void 0===r?void 0:r.passSplitOptions)||void 0===i?void 0:i.attachments)||void 0===n?void 0:n.length)&&void 0!==o?o:0;this.splitLayer=d>0;for(p=0;p<e.length;p++){(A=null==(m=e[p])?void 0:m.renderer.texture)&&G(u,A),m.mesh=this}for(p=0;p<e.length;p++){var m,v=(A=null==(m=e[p])?void 0:m.renderer.texture)?u.indexOf(A):-1,y=this.getItemInitData(m,p,f,v);l+=y.aPoint.length,h+=y.index.length,s.push(y),f+=y.aPoint.length/6,this.updateItem(m,!0)}var x={aPoint:new Float32Array(l),index:new Uint16Array(h)},g={aPoint:0,index:0},T=function(t){var e=s[t];Object.keys(x).forEach((function(t){var r=x[t],i=e[t];r.set(i,g[t]),g[t]+=i.length}))};for(p=0;p<s.length;p++)T(p);var S=this.mesh,b=S.material,R=S.geometry,_=x.index;R.setIndexData(_),R.setAttributeData("aPoint",x.aPoint),R.setDrawCount(h),this.mesh.setVisible(!!R.getDrawCount()),this.mesh.priority=e[0].listIndex;for(p=0;p<u.length;p++){var A=u[p];b.setTexture("uSampler"+p,A)}for(var C=e[0].emptyTexture,w=u.length;w<t.maxSpriteMeshItemCount;w++)b.setTexture("uSampler"+w,C);if(this.splitLayer){var O=function(t,e){var r;if(e){for(var i=128,n=new Uint8Array(i),o=0,a=i-1;o<i;o++){var s=o/a,u=e.getValue(s);n[o]=Math.round(255*u)}r=Kr.createWithData(t,{width:i,height:1,data:n},{name:"feather",format:E.LUMINANCE,minFilter:E.LINEAR,magFilter:E.LINEAR,wrapS:E.CLAMP_TO_EDGE,wrapT:E.CLAMP_TO_EDGE})}else r=Kr.createWithData(t);return r}(this.engine,e[0].feather);b.setTexture("uFeatherSampler",O)}},e.prototype.updateItem=function(t,e){var r=this.items.indexOf(t);if(!(r<=-1)){var i=this.mesh.material.getVector4Array("uTexParams"),n=4*r,o=t.getRenderData(t.time,e),a=this.mesh.material.getMatrixArray("uMainData"),s=16*r,u=s,c=s+4,f=s+8,p=s+12,d=new Vt,m=new Ft,v=new Vt,y=o.color||[a[p],a[p+1],a[p+2],a[p+3]];if(o.visible)o.transform.assignWorldTRS(d,m,v);else if(!e)return void(a[c+2]=-1);var x=h(h([],l(d.toArray()),!1),[0],!1),g=h(h([],l(v.toArray()),!1),[0],!1),T=m.toArray();isNaN(t.getCustomOpacity())||(y[3]=t.getCustomOpacity());for(var E=0;E<4;E++)a[u+E]=x[E],a[f+E]=T[E],a[c+E]=g[E],a[p+E]=y[E];if(g[2]=o.life,a[c+2]=o.life,e){var S=t.renderer;i[n]=S.occlusion?+S.transparentOcclusion:1,i[n+2]=S.renderMode,i[n+1]=+this.preMultiAlpha}if(o.texOffset){var b=this.mesh.material.getVector4Array("uTexOffset");for(E=0;E<4;E++)b[4*r+E]=o.texOffset[E]}}},e.prototype.applyChange=function(){this.dirty&&(this.setItems(this.items),this.dirty=!1)},e.prototype.getItemInitData=function(t,e,r,i){var n=t.geoData;this.lineMode?n=this.getItemGeometryData(t,e):n||(n=t.geoData=this.getItemGeometryData(t,e));var o=n.aPoint;if(o[4]!==e||o[5]!==i)for(var a=0;a<o.length;a+=6)o[a+4]=e,o[a+5]=i;var s=n.index,u=s.length,c=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new s.constructor(u);if(!this.wireframe)for(a=0;a<u;a++)c[a]=r+s[a];return{aPoint:n.aPoint,index:c}},e.prototype.getItemRegionData=function(t){var e=this.items.indexOf(t);if(e>-1){var r=this.mesh.material.getMatrixArray("uMainData"),i=16*e;if(null===r)return;return{position:[r[i]||0,r[i+1]||0,r[i+2]||0],size:[r[i+4],r[i+5]],quat:[r[i+8],r[i+9],r[i+10],r[i+11]],color:[r[i+12],r[i+13],r[i+14],r[i+15]]}}},e.prototype.invalidMaterial=function(){this.mtlSlotCount=0},e.prototype.createGeometry=function(e){var r=Float32Array.BYTES_PER_ELEMENT;return bi.create(this.engine,{attributes:{aPoint:{size:4,offset:0,stride:f*r,releasable:!0,type:E.FLOAT,data:new Float32Array(0)},aIndex:{size:2,offset:4*r,stride:f*r,dataSource:"aPoint",type:E.FLOAT}},indices:{data:new Uint16Array(0),releasable:!0},mode:e,maxVertex:4*t.maxSpriteMeshItemCount})},e.prototype.createMaterial=function(t,e){var r,i,n,o=t.filter,s=t.side,u=t.occlusion,l=t.blending,h=t.maskMode,f=t.mask,p=(null==o?void 0:o.mesh)||{},d=this.engine,m={shader:zn(t,e,d.gpuCapability.level,null===(n=d.renderer)||void 0===n?void 0:n.env)};this.preMultiAlpha=Vr(l),this.mtlSlotCount=e;var v=ci.create(d,m),y=a({side:s,blending:!0,blendMode:l,mask:f,maskMode:h,depthTest:!0,depthMask:u},p.materialStates);v.blending=y.blending,v.stencilRef=void 0!==y.mask?[y.mask,y.mask]:void 0,v.depthTest=y.depthTest,v.depthMask=y.depthMask,y.blending&&Ur(v,y.blendMode),v.blendFunction=y.blendFunction,kr(v,y.maskMode),Br(v,y.side);var x=p.uniformValues;if(x)try{for(var g=c(Object.keys(x)),T=g.next();!T.done;T=g.next()){var E=T.value,S=x[E];S instanceof Kr?v.setTexture(E,S):"number"==typeof S?v.setFloat(E,S):2===S.length?v.setVector2(E,Pt.fromArray(S)):4===S.length?v.setVector4(E,Gt.fromArray(S)):v.setMatrix(E,Dt.fromArray(S))}}catch(t){r={error:t}}finally{try{T&&!T.done&&(i=g.return)&&i.call(g)}finally{if(r)throw r.error}}for(var b=[],R=[],_=[],A=0;A<e;A++)b.push(Dt.fromIdentity()),R.push(new Gt),_.push(new Gt);return v.hasUniform("uMainData")||v.setMatrixArray("uMainData",b),v.hasUniform("uTexParams")||v.setVector4Array("uTexParams",R),v.hasUniform("uTexOffset")||v.setVector4Array("uTexOffset",_),v},e.prototype.getItemGeometryData=function(t,e){var r=t.splits,i=t.renderer,n=t.textureSheetAnimation,o=t.startSize,a=o.x,s=o.y;if(i.shape){for(var u=i.shape,c=u.index,l=u.aPoint,h=new Float32Array(l),f=0;f<h.length;f+=6)h[f]*=a,h[f+1]*=s;return{index:c,aPoint:Array.from(h)}}var p=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],d=[],m=[],v=2,y=2;1===r.length&&(v=1,y=1);for(var x=0;x<v;x++)for(var g=0;g<y;g++){var T=4*(2*g+x),E=n?[0,0,1,1,r[0][4]]:r[2*g+x],S=E[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],b=((x+x+1)/v-1)/2,R=((g+g+1)/y-1)/2,_=E[0],A=E[1],C=E[4]?E[3]:E[2],w=E[4]?E[2]:E[3],O=[p[0]/v+b,p[1]/y+R,p[2]/v+b,p[3]/y+R,p[4]/v+b,p[5]/y+R,p[6]/v+b,p[7]/y+R];d.push(O[0]*a,O[1]*s,S[0]*C+_,S[1]*w+A,e,0,O[2]*a,O[3]*s,S[2]*C+_,S[3]*w+A,e,0,O[4]*a,O[5]*s,S[4]*C+_,S[5]*w+A,e,0,O[6]*a,O[7]*s,S[6]*C+_,S[7]*w+A,e,0),this.lineMode?m.push(T,1+T,1+T,3+T,3+T,2+T,2+T,T):m.push(T,1+T,2+T,2+T,1+T,3+T)}return{index:m,aPoint:d}},e}();function Vn(t){var e,r=t.renderer,i=t.filter,n=r.blending,o=r.side,a=r.occlusion,s=r.mask,u=r.maskMode,c=r.order,l=+n,h=t.cachePrefix||"-",f=(null===(e=null==i?void 0:i.mesh)||void 0===e?void 0:e.shaderCacheId)||"$F$";return{side:o,occlusion:a,blending:n,mask:s,maskMode:u,cachePrefix:h,filter:i,cacheId:"".concat(h,".").concat(f,".").concat(+o,"+").concat(+a,"+").concat(l,"+").concat(c,"+").concat(u,".").concat(s)}}function Fn(e,r,i){var n=null!=i?i:{},o=n.count,a=void 0===o?2:o,s=n.env,u=void 0===s?"":s,c=n.ignoreBlend,l=n.wireframe,h=[["MAX_ITEM_COUNT",a],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===y],["ADJUST_LAYER",!!r],["USE_BLEND",!c],["MAX_FRAG_TEX",t.maxSpriteTextureCount>=16?16:8]],f=l?Di:Bi.replace(/#pragma\s+FILTER_FRAG/,(null==r?void 0:r.fragment)||""),p=Ui.replace(/#pragma\s+FILTER_VERT/,(null==r?void 0:r.vertex)||"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:Dr(h,f,t.ShaderType.fragment,e),vertex:Dr(h,p,t.ShaderType.vertex,e),glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,marcos:h,shared:!0}}function Nn(t,e){return t.filter?"".concat(t.filter.mesh.shaderCacheId,"_effects_filter"):"".concat(t.cachePrefix,"_effects_sprite_").concat(e)}function zn(t,e,r,i){var n=t.filter,o=t.wireframe,a=Fn(r,null==n?void 0:n.mesh,{count:e,wireframe:o,env:i});return a.shared=!0,o||(a.cacheId=Nn(t,e)),a}function Dn(e){t.maxSpriteMeshItemCount=e}var Un="listIndex",Bn=function(){function e(t){this.composition=t,this.meshSplits=[],this.items=[],this.meshes=[],this.time=0,this.itemsToRemove=[],this.itemsToAdd=[],this.engine=t.getEngine()}return e.prototype.resetMeshSplits=function(){this.meshSplits.length=0,this.meshes.length=0,this.items.length=0,this.itemsToAdd.length=0,this.itemsToRemove.length=0},e.prototype.diffMeshSplits=function(){for(var e,r,i,n,o,a,s=this.meshSplits,u=this.itemsToRemove,c=this.itemsToAdd,f=[],p=[],d=[],m=[],v=this.items,y={layerToAdd:[]},x=[],g=0;g<u.length;g++){if(kn(S=u[g]))f.push.apply(f,h([],l(this.removeMeshSplitsItem(v,S,s,u)),!1)),this.check();else{var T=v.indexOf(S);T>-1&&(v.splice(T,1),x.length=0,T>0&&(x=this.combineSplits(v,T-1,s),f.push.apply(f,h([],l(x),!1))),!x.length&&T<=v.length-1&&(x=this.combineSplits(v,T,s),f.push.apply(f,h([],l(x),!1))),this.check())}}var E=!1;for(g=0;g<c.length;g++)for(var S=c[g],b=this.addMeshSplitsItem(v,S,s),R=0;R<b.length;R++){var _=b[R];if(_.spriteMesh)throw new Error("no sprite mesh in neo split");var A=_.spriteMesh=new Pn(this.engine,_.renderInfo,this.composition);p.push(A.mesh),A.setItems(_.items.map((function(t){return t.content}))),A.applyChange(),A.splitLayer&&(null===(e=y.layerToAdd)||void 0===e||e.push(A)),_.dirty=!1,this.check(),E=!0}if(E){var C,w=function(e){var u=s[e],c=s[e+1];if(c.cacheId===u.cacheId&&!(null===(r=c.spriteMesh)||void 0===r?void 0:r.splitLayer)&&!(null===(i=u.spriteMesh)||void 0===i?void 0:i.splitLayer)&&u.items.length+c.items.length<=t.maxSpriteMeshItemCount){var l=u.items[0],h=c.items[c.items.length-1],f=O.getMeshSplits(v,v.indexOf(l),v.indexOf(h));if(1===f.length){Object.keys(f[0]).forEach((function(t){u[t]=f[0][t]})),null===(n=u.spriteMesh)||void 0===n||n.setItems(u.items.map((function(t){return t.content}))),null===(o=u.spriteMesh)||void 0===o||o.applyChange();var m=null===(a=c.spriteMesh)||void 0===a?void 0:a.mesh;u.spriteMesh&&u.spriteMesh.mesh&&(u.spriteMesh.mesh.priority=c.indexEnd),p.includes(m)?X(p,m):G(d,m),s.splice(e+1,1),e--}}C=e},O=this;for(g=0;g<s.length-1;g++)w(g),g=C}u.length=0;for(g=0;g<s.length;g++){var M=(I=s[g]).spriteMesh;if(0===I.items.length)throw new Error("split not combined");if(I.dirty){var L=I.indexStart;M.mesh.priority!==L&&(M.mesh.priority=L,m.push(M.mesh)),M.setItems(I.items.map((function(t){return t.content})))}M.applyChange(),I.dirty=!1}if(f.length)for(g=0;g<f.length;g++){var I,P=(A=(I=f[g]).spriteMesh).mesh;P.dispose({material:{textures:t.DestroyOptions.keep}}),d.push(P)}if(this.itemsToRemove.length=0,this.itemsToAdd.length=0,p.length+d.length+m.length){var V=this.meshes;return this.meshSplits.forEach((function(t,e){return V[e]=t.spriteMesh.mesh})),V.length=this.meshSplits.length,{add:p.length?p:void 0,remove:d.length?d:void 0,modify:m.length?m:void 0,layer:y.layerToAdd.length>0?y:void 0}}},e.prototype.addItem=function(t){this.items.includes(t)?X(this.itemsToRemove,t):G(this.itemsToAdd,t)},e.prototype.removeItem=function(t){this.items.includes(t)?kn(t)?this.itemsToRemove.unshift(t):this.itemsToRemove.push(t):X(this.itemsToAdd,t)},e.prototype.getSpriteMesh=function(t){for(var e=this.meshSplits,r=0;r<e.length;r++){var i=e[r].spriteMesh;if(i.items.indexOf(t)>-1)return i}},e.prototype.onUpdate=function(t){for(var e=this.meshSplits,r=0;r<e.length;r++){for(var i=e[r].spriteMesh,n=i.items,o=0;o<n.length;o++){var a=n[o];a.ended||i.updateItem(a)}i.applyChange()}},e.prototype.dispose=function(){this.meshSplits.forEach((function(t){var e;null===(e=t.spriteMesh)||void 0===e||e.mesh.dispose()}))},e.prototype.check=function(){},e.prototype.addMeshSplitsItem=function(t,e,r){if(-1!==t.indexOf(e))throw Error("item has been added");if(!r[0]){if(H(t,e,Un),kn(e)){var i=e.createContent(),n={indexStart:e.listIndex,indexEnd:e.listIndex,items:[e],renderInfo:i.renderInfo,cacheId:i.renderInfo.cacheId,textures:[e.content.renderer.texture]};return r.unshift(n),[n]}return[]}for(var o=function(i){var n=r[i],o=e.listIndex;if(kn(e)){if(o<=n.indexEnd){H(t,e,Un);var s=t.indexOf(e),u=Math.min(s,t.indexOf(n.items[0])),c=Math.max(s,t.indexOf(n.items[n.items.length-1])),l=a.getMeshSplits(t,u,c),h=l.findIndex((function(t){return t.items.includes(e)}));if(2===l.length)return r.splice(i+h,0,l[h]),Object.keys(l[1-h]).forEach((function(t){n[t]=l[1-h][t]})),{value:[l[h]]};if(3===l.length){if(Object.keys(l[0]).forEach((function(t){n[t]=l[0][t]})),r.splice(i+1,0,l[1],l[2]),1!==h)throw Error("neo split not in middle");return{value:[l[1],l[2]]}}if(1!==l.length)throw Error("invalid splits 1");return Object.keys(l[0]).forEach((function(t){n[t]=l[0][t]})),{value:[]}}}else{if(o<n.indexStart||o===n.indexEnd)return H(t,e,Un),{value:[]};if(o<n.indexEnd){H(t,e,Un);var f=n.items[n.items.length-1],p=t.indexOf(f),d=a.getMeshSplits(t,t.indexOf(n.items[0]),p);if(Object.keys(d[0]).forEach((function(t){n[t]=d[0][t]})),2===d.length)return r.splice(i+1,0,d[1]),{value:[d[1]]};if(1!==d.length)throw Error("invalid splits 2")}}},a=this,s=0;s<r.length;s++){var u=o(s);if("object"==typeof u)return u.value}if(H(t,e,Un),kn(e)){var c=r[r.length-1],l=this.getMeshSplits(t,t.indexOf(c.items[0]),t.indexOf(e));if(Object.keys(l[0]).forEach((function(t){c[t]=l[0][t]})),2===l.length)return r.push(l[1]),[l[1]];if(1!==l.length)throw Error("invalid splits 3")}return[]},e.prototype.removeMeshSplitsItem=function(t,e,r,i){for(var n,o,a=null,s=-1,u=[],c=0;c<r.length;c++){var l=r[c];if(l.indexStart<=e.listIndex&&l.indexEnd>=e.listIndex){a=l,s=c;break}}if(a){var h=a.items.indexOf(e);if(h<0){if(null==i?void 0:i.includes(e))return[];throw Error("item not found")}if(a.items.splice(h,1),a.dirty=!0,X(t,e),0===a.items.length){if(X(r,a),u.push(a),a=r[s-=1],!r.length||s<0)return u}else a.indexEnd=a.items[a.items.length-1].listIndex,a.indexStart=a.items[0].listIndex;if(0===s||s===r.length-2){var f=r[s],p=r[s+1];if(f&&p){var d=f.items[0],m=p.items[p.items.length-1];1===(v=this.getMeshSplits(t,t.indexOf(d),t.indexOf(m))).length&&(v[0].spriteMesh=r[s].spriteMesh,null===(n=v[0].spriteMesh)||void 0===n||n.invalidMaterial(),r[s]=v[0],u.push(r.splice(s+1,1)[0]))}}else if(s===r.length-1)if(0===a.items.length)u.push(r.splice(s,1)[0]);else{f=r[s-1],p=r[s],d=f.items[0],m=p.items[p.items.length-1];1===(v=this.getMeshSplits(t,t.indexOf(d),t.indexOf(m))).length&&(v[0].spriteMesh=r[s-1].spriteMesh,null===(o=v[0].spriteMesh)||void 0===o||o.invalidMaterial(),r[s-1]=v[0],u.push(r.splice(s,1)[0]))}else{var v;f=r[s-1],p=r[s+1],d=f.items[0],m=p.items[p.items.length-1];2===(v=this.getMeshSplits(t,t.indexOf(d),t.indexOf(m))).length&&(v[0].spriteMesh=r[s].spriteMesh,v[1].spriteMesh=r[s+1].spriteMesh,r[s]=v[0],r[s+1]=v[1],u.push(r.splice(s-1,1)[0]))}}return u},e.prototype.combineSplits=function(t,e,r){var i=t[e],n=[];if(kn(i)&&i.composition){for(var o=void 0,a=0;a<r.length;a++){if(r[a].items.includes(i)){o=a;break}}var s=void 0,u=void 0;if(0===o?(s=r[o],u=r[o+1]):(s=r[o-1],u=r[o]),s&&u){var c=t.indexOf(s.items[0]),l=t.indexOf(u.items[u.items.length-1]);if(Number.isInteger(c)&&Number.isInteger(l)){var h=this.getMeshSplits(t,c,l);1===h.length&&(h[0].spriteMesh=r[o].spriteMesh,0===o?(r[0]=h[0],n.push(r.splice(1,1)[0])):(n.push(r.splice(o-1,1)[0]),r[o-1]=h[0]))}}}return n},e.prototype.getMeshSplits=function(e,r,i,n){void 0===r&&(r=0),void 0===i&&(i=e.length-1);for(var o=null,a=[],s=r;s<=i;s++){var u=e[s];if(n||u.started&&!(u.lifetime<0))if(kn(u)){var c=u.createContent().renderInfo.cacheId,l=u.content.renderer.texture,h=!0;if(o){var f=o.textures.includes(l)?0:1;o.cacheId===c&&fr.isSprite(u)&&o.items.length<t.maxSpriteMeshItemCount&&f+o.textures.length<=t.maxSpriteTextureCount?(H(o.items,u,Un),G(o.textures,l),h=!1):a.push(o)}h&&(o={indexStart:u.listIndex,cacheId:c,renderInfo:u.content.renderInfo,items:[u],textures:[l]})}else{if(n&&!u.contentVisible)continue;o&&(a.push(o),o=null)}}return o&&a.push(o),a.forEach((function(t){t.indexEnd=t.items[t.items.length-1].listIndex,t.dirty=!0})),a},e}();function kn(t){return fr.isSprite(t)||fr.isFilterSprite(t)}var Gn={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},Xn=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="sprite",t}return o(r,e),r.precompile=function(e,r,i){var n,o=r.getShaderLibrary(),a=r.engine.gpuCapability,s=a.level,u=a.detail,c=(null!=i?i:{}).env;if(!o.shaderResults[Nn(Gn,2)]){o.addShader(zn(Gn,2,s,c)),o.addShader(zn(Gn,t.maxSpriteMeshItemCount,s,c));var l=!1;null===(n=e[0])||void 0===n||n.items.forEach((function(e){t.Item.isFilter(e)&&e.content.filter&&(l=!0,B(e.content.filter).forEach((function(t){if(!t.isParticle){var e=Fn(s,t,t);t.shaderCacheId&&(e.cacheId="".concat(t.shaderCacheId,"_effects_filter")),o.addShader(e)}})))})),l&&o.addShader(vi(s,!1)),u.writableFragDepth&&o.addShader(vi(s,!0))}return Promise.resolve()},r.prototype.onCompositionDestroyed=function(t){t.loaderData.spriteGroup.dispose(),delete t.loaderData.spriteGroup},r.prototype.onCompositionReset=function(t,e){if(!t.loaderData.spriteGroup){var r=new Bn(t);t.loaderData.spriteGroup=r,r.resetMeshSplits()}},r.prototype.onCompositionItemLifeBegin=function(t,e){var r=t.loaderData.spriteGroup;e.type!==P.composition&&r.addItem(e)},r.prototype.onCompositionItemRemoved=function(t,e){t.loaderData.spriteGroup.removeItem(e)},r.prototype.onCompositionUpdate=function(t,e){t.loaderData.spriteGroup.onUpdate(e)},r.prototype.prepareRenderFrame=function(t,e){var r,i,n,o=t.loaderData.spriteGroup.diffMeshSplits();return!!o&&(null===(r=o.remove)||void 0===r||r.forEach((function(t){return e.removeMeshFromDefaultRenderPass(t)})),null===(i=o.add)||void 0===i||i.forEach((function(t){return e.addMeshToDefaultRenderPass(t)})),null===(n=o.modify)||void 0===n||n.forEach((function(t){e.removeMeshFromDefaultRenderPass(t),e.addMeshToDefaultRenderPass(t)})),!!(this.layerInfo=o.layer))},r.prototype.postProcessFrame=function(t,e){var r,i;null===(i=null===(r=this.layerInfo)||void 0===r?void 0:r.layerToAdd)||void 0===i||i.forEach((function(t){var r=t.items[0].filter;if(void 0!==r){var i=r.passSplitOptions,n=e.splitDefaultRenderPassByMesh(t.mesh,i);r.renderPassDelegate&&(n.delegate=r.renderPassDelegate),r.onRenderPassCreated&&r.onRenderPassCreated(n,e)}})),this.layerInfo=void 0},r}(Er),Hn=new kt,Yn=new Vt(1,1,1);new Vt;var jn=function(){function t(t,e){var r;this.vfxItem=e,this.active=!1,this.transform=e.transform;var i=this.transform.scale;this.basicTransform={position:this.transform.position.clone(),rotation:this.transform.getRotation(),scale:new Vt(i.x,i.y,i.x)};var n=t.rotationOverLifetime,o=t.sizeOverLifetime,a=t.positionOverLifetime,s=void 0===a?{}:a;if(s){s.path&&(this.basicTransform.path=ke(s.path));var u=s.linearX||s.linearY||s.linearZ;u&&(this.linearVelOverLifetime={x:s.linearX&&ke(s.linearX),y:s.linearY&&ke(s.linearY),z:s.linearZ&&ke(s.linearZ),asMovement:s.asMovement,enabled:!!u});var c=s.orbitalX||s.orbitalY||s.orbitalZ;c&&(this.orbitalVelOverLifetime={x:s.orbitalX&&ke(s.orbitalX),y:s.orbitalY&&ke(s.orbitalY),z:s.orbitalZ&&ke(s.orbitalZ),center:ie(s.orbCenter),asRotation:s.asRotation,enabled:!!c}),this.speedOverLifetime=s.speedOverLifetime&&ke(s.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=ke(o.x||1),this.sizeYOverLifetime=ke(o.y||1),this.sizeZOverLifetime=ke(o.z||1)):this.sizeXOverLifetime=ke(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:ke(n.z||0)},n.separateAxes)){var l=this.rotationOverLifetime;l.x=ke(n.x||0),l.y=ke(n.y||0)}this.options={reusable:!!e.reusable,delay:e.delay||0,startSpeed:s.startSpeed||0,startSize:i&&i.x||1,sizeAspect:i&&i.x/(i.y||1)||1,duration:e.duration||0,looping:e.endBehavior&&e.endBehavior===ht.loop,endBehavior:e.endBehavior||0,gravity:Vt.fromArray(s.gravity||[]),gravityModifier:ke(null!==(r=s.gravityOverLifetime)&&void 0!==r?r:0),direction:s.direction?Vt.fromArray(s.direction).normalize():new Vt},this.id=e.id,this.time=0,this.name=e.name,this.visible=e.getVisible()}return Object.defineProperty(t.prototype,"ended",{get:function(){return this.time>this.options.duration&&!this.options.looping&&!this.options.reusable},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startSize",{get:function(){return this.basicTransform.scale},set:function(t){this.basicTransform.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"velocity",{get:function(){return this._velocity||(this._velocity=this.options.direction.clone(),this._velocity.multiply(this.options.startSpeed)),this._velocity},enumerable:!1,configurable:!0}),t.prototype.getWillTranslate=function(){return!!(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled||this.orbitalVelOverLifetime&&this.orbitalVelOverLifetime.enabled||this.options.gravityModifier&&!this.options.gravity.isZero()||this.options.startSpeed&&!this.options.direction.isZero())},t.prototype.updateTime=function(t){var e=t-this.options.delay,r=this.options.duration;if(e>=r&&this.options.looping){for(var i=e-r;i>r;)i-=r;this.time=i}else{var n=4===this.options.endBehavior;this.time=n?Math.min(r,e):e}},t.prototype.getRenderData=function(t,e){var r=this.options,i=Yn.setFromNumber(1),n=Hn.set(0,0,0),o=!1,a=!1,s=t<0?t:Math.max(t,0),u=r.duration,c=s/u,l={life:c,transform:this.transform};c=c<0?0:c>1?1:c,this.sizeXOverLifetime&&(i.x=this.sizeXOverLifetime.getValue(c),this.sizeSeparateAxes?(i.y=this.sizeYOverLifetime.getValue(c),i.z=this.sizeZOverLifetime.getValue(c)):i.z=i.y=i.x,o=!0),this.calculateScaling(o,i,e);var h,f=this.rotationOverLifetime;if(f){var p=function(t){return f.asRotation?t.getValue(c):t.getIntegrateValue(0,c,u)},d=p(f.z),m=f.separateAxes;n.x=m?p(f.x):0,n.y=m?p(f.y):0,n.z=d,a=!0}if(a||e){var v=Hn.addEulers(this.basicTransform.rotation,n);l.transform.setRotation(v.x,v.y,v.z)}return(this.getWillTranslate()||e)&&re(h=new Vt,this,this.options.gravity,s,u,this.basicTransform.position,this.velocity),this.basicTransform.path&&(h||(h=this.basicTransform.position.clone()),h.add(this.basicTransform.path.getValue(c))),h&&this.transform.setPosition(h.x,h.y,h.z),l.active=this.active,l},t.prototype.calculateScaling=function(t,e,r){this.transform.setScale(e.x*this.startSize.x,e.y*this.startSize.y,e.z*this.startSize.z)},t}(),Wn=[[0,0,1,1,void 0]],Zn=[1,1,1,1],qn=function(t){function e(e,r,i){var n,o,s,u,c,l,h,f,p=t.call(this,e,i)||this;p.startColor=[1,1,1,1];var d=e.interaction,m=e.renderer,v=e.options,y=e.listIndex,x=void 0===y?0:y,g=r.emptyTexture,T=i.transform.scale;p.options=a(a({},p.options),{startColor:v.startColor||[1,1,1,1]}),p.interaction=d,p.renderer={renderMode:null!==(n=m.renderMode)&&void 0!==n?n:V.BILLBOARD,blending:null!==(o=m.blending)&&void 0!==o?o:A.ALPHA,texture:p.initTexture(m.texture,g),occlusion:!!m.occlusion,transparentOcclusion:!!m.transparentOcclusion||m.maskMode===w.MASK,side:null!==(s=m.side)&&void 0!==s?s:C.DOUBLE,shape:m.shape,mask:null!==(u=m.mask)&&void 0!==u?u:0,maskMode:null!==(c=m.maskMode)&&void 0!==c?c:w.NONE,order:x};var E=ce(m.anchor,m.particleOrigin);m.anchor||void 0===m.particleOrigin||p.basicTransform.position.add([-E[0]*T.x,-E[1]*T.y,0]),p.transform.setAnchor(E[0]*T.x,E[1]*T.y,0);var S=e.colorOverLifetime;return S&&(p.opacityOverLifetime=ke(null!==(l=S.opacity)&&void 0!==l?l:1),S.color&&S.color[0]===ct.GRADIENT_COLOR&&(p.colorOverLifetime=Z(S.color[1]))),(null===(h=e.filter)||void 0===h?void 0:h.feather)&&1!==(null===(f=e.filter)||void 0===f?void 0:f.feather)&&(p.feather=ke(e.filter.feather)),p.emptyTexture=g,p.splits=e.splits||Wn,p.listIndex=i.listIndex||0,p.textureSheetAnimation=e.textureSheetAnimation,p.cachePrefix="-",p.parentId=i.parentId,p.reusable=i.reusable,p._renderInfo=Vn(p),p}return o(e,t),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},set:function(t){this._filter=t,this._renderInfo.filter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderInfo",{get:function(){return this._renderInfo},enumerable:!1,configurable:!0}),e.prototype.initTexture=function(t,e){return null!=t?t:e},e.prototype.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},e.prototype.setColor=function(t,e,r,i){this.customColor=[t,e,r,i]},e.prototype.setOpacity=function(t){this.customOpacity=t},e.prototype.getCustomOpacity=function(){return this.customOpacity},e.prototype.getRenderData=function(e,r){var i,n=t.prototype.getRenderData.call(this,e,r),o=ne(Zn,1),a=e<0?e:Math.max(e,0),s=this.options.duration,u=a/s<0?0:a/s>1?1:a/s;if(this.customColor)n.color=this.customColor;else{var c=this.opacityOverLifetime,l=this.colorOverLifetime;l&&(o=W(l,u,!0),i=!0),c&&(o[3]*=c.getValue(u),i=!0),(i||r)&&(n.color=se(this.startColor,o,this.options.startColor))}var h=this.textureSheetAnimation;if(h){var f=h.total||h.row*h.col,p=0,d=0,m=1,v=1,y=void 0;if(this.splits){var x=this.splits[0];y=x[4],p=x[0],d=x[1],y?(m=x[3],v=x[2]):(m=x[2],v=x[3])}var g=void 0,T=void 0;y?(g=1/h.row*m,T=1/h.col*v):(g=1/h.col*m,T=1/h.row*v);var E=void 0;if(h.animate){var S=Math.round(u*(f-1)),b=Math.floor(S/h.col),R=S-b*h.col;E=y?[g*b,T*(h.col-R)]:[g*R,T*(1+b)]}else E=[0,T];n.texOffset=[p+E[0],v+d-E[1],g,T]}else r&&(n.texOffset=[0,0,1,1]);return n.visible=this.vfxItem.contentVisible,n.startSize=this.startSize,n},e.prototype.calculateScaling=function(t,e,r){(t||r)&&this.transform.setScale(e.x,e.y,e.z)},e}(jn),Qn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return o(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return P.sprite},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){this.sprite=t.content},r.prototype.onLifetimeBegin=function(t,e){e.active=!0},r.prototype.onItemRemoved=function(t,e){e&&(delete e.mesh,t.destroyTextures(e.getTextures()))},r.prototype.onItemUpdate=function(t,e){var r;null===(r=this.content)||void 0===r||r.updateTime(this.time)},r.prototype.getCurrentPosition=function(){var t=new Vt;return this.transform.assignWorldTRS(t),t},r.prototype.setColor=function(t,e,r,i){this.content.setColor(t,e,r,i)},r.prototype.setOpacity=function(t){this.content.setOpacity(t)},r.prototype.getBoundingBox=function(){var e=this.content;if(e&&this.transform){var r=this.transform.getWorldMatrix(),i=e.startSize,n=fe(Vt.ZERO,i.x/2,i.y/2);return n.forEach((function(t){r.transformPoint(t.p0),r.transformPoint(t.p1),r.transformPoint(t.p2)})),{type:t.HitTestType.triangle,area:n}}},r.prototype.getHitTestParams=function(t){var e,r,i=this.content,n=null===(e=this.composition)||void 0===e?void 0:e.loaderData.spriteGroup,o=i&&i.interaction;if((t||o)&&n&&i){var a=this.getBoundingBox();if(a)return{behavior:(null===(r=i.interaction)||void 0===r?void 0:r.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===C.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(t){var e=t.getRendererOptions().emptyTexture,r=new qn(this.sprite,{emptyTexture:e},this);return r.getRenderData(0,!0),r},r.prototype.createWireframeMesh=function(t,e){var r=new Pn(this.composition.getEngine(),a({wireframe:!0},t.renderInfo),this.composition);return r.setItems([t]),r.mesh.material.setVector3("uFrameColor",Vt.fromArray(e)),r.mesh.priority=999,r},r}(fr),Kn=1,Jn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return P.filter},enumerable:!1,configurable:!0}),e.prototype.onConstructed=function(e){t.prototype.onConstructed.call(this,e),this.filterOptions=e.content.filter,this.cachePrefix="filter:"+Kn++,this.sprite.renderer.texture=this.composition.renderFrame.transparentTexture},e.prototype.onItemUpdate=function(e,r){var i,n,o,a,s;t.prototype.onItemUpdate.call(this,e,r);var u=null===(o=this._content)||void 0===o?void 0:o.mesh;if(u){var l=this.filter.mesh.variables;if(l){var h=u.mesh.material;try{for(var f=c(Object.keys(l)),p=f.next();!p.done;p=f.next()){var d=p.value,m=l[d](r);m.length>4?h.setMatrix(d,Dt.fromArray(m)):h.setVector4(d,Gt.fromArray(m))}}catch(t){i={error:t}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}finally{if(i)throw i.error}}}}null===(s=(a=this.filter).onItemUpdate)||void 0===s||s.call(a,e,this)},e.prototype.onItemRemoved=function(e,r){var i,n;null===(n=(i=this.filter).onItemRemoved)||void 0===n||n.call(i,this),t.prototype.onItemRemoved.call(this,e,r)},e.prototype.doCreateContent=function(e){var r,i=t.prototype.doCreateContent.call(this,e),n=k(this.filterOptions,e);this.filter=n,i.renderInfo.filter=n,i.filter=n,i.renderInfo.cacheId=i.renderInfo.cacheId.replace("$F$",null!==(r=n.mesh.shaderCacheId)&&void 0!==r?r:"");var o=n.mesh.variables;return n.mesh.uniformValues||(n.mesh.uniformValues={}),o&&Object.keys(o).forEach((function(t){var e=o[t];n.mesh.uniformValues[t]=e(0)})),i},e}(Qn),$n=function(t){this.content=t},to=function(){function t(t){this.sort=t,this.length=0}return t.prototype.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},t.prototype.insertNode=function(t,e){var r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},t.prototype.shiftNode=function(t){var e=new $n(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(this.sort(r.content,e.content)<=0))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},t.prototype.pushNode=function(t){var e=new $n(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(this.sort(e.content,r.content)<=0))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},t.prototype.removeNode=function(t){var e=this.first;if(this.length--,e===t)(r=this.first=e.next)&&(r.pre=null);else if((e=this.last)===t){var r;(r=this.last=e.pre)&&(r.next=null)}else if(t){var i=t.pre,n=t.next;i.next=n,n&&(n.pre=i)}t.pre=null,t.next=null},t.prototype.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},t.prototype.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do{t.call(e||this,r.content,i--)}while(r=r.pre)},t}(),eo=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=ro(this.arc,this.arcMode,t)*At,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new Vt(r,i,0),o=Math.tan(this.angle*At),a=n.clone().multiply(o);return a.z+=1,{position:n.multiply(ar(0,1)),direction:a.normalize()}},t}();function ro(t,e,r){if(e===dt.RANDOM)t=ar(0,t);else if(e===dt.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===dt.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);t*=Math.floor(i)%2?1-n:n}else e===dt.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var io,no=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=ro(this.arc,this.arcMode,t)*At,r=new Vt(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),oo=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=ar(-this._d,this._d),r=ar(-this._h,this._h);return{direction:new Vt(0,0,1),position:new Vt(e,r,0)}},t}(),ao=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=ro(this.arc,this.arcMode,t)*At,r=new Vt(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(e),s=new Vt;return e<o?s.set(i,i*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-i,-i*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(i,i*a,0),{direction:r,position:s}},t}(),so=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===dt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):ar(0,1);return{direction:new Vt(0,1,0),position:new Vt(this._d*(e-.5),0,0)}},t}(),uo=new Dt,co=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=ar(0,2*Math.PI),n=ro(this.arc,this.arcMode,t)*At,o=uo.setFromRotationZ(n),a=new Vt(Math.cos(i),Math.sin(i),0),s=new Vt(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),lo=new Dt,ho=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.getHorizontalAngle=function(){return ar(-90,90)},t.prototype.generate=function(t){var e=ro(this.arc,this.arcMode,t)*At,r=this.getHorizontalAngle()*At,i=this.radius,n=new Vt(Math.cos(r),0,Math.sin(r)),o=lo.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(i),direction:o}},t}(),fo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.getHorizontalAngle=function(){return ar(0,90)},e}(ho),po=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=Lt(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=e.length/2-1,i=Math.floor(ro(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,o=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new Vt(n,o,0);return{position:new Vt(n*this.width,o*this.height,0),direction:a.normalize()}},t}(),mo=function(){function t(){}return t.prototype.generate=function(){return{position:new Vt,direction:new Vt}},t}(),vo=((io={})[O.NONE]=mo,io[O.CONE]=eo,io[O.SPHERE]=ho,io[O.HEMISPHERE]=fo,io[O.CIRCLE]=no,io[O.DONUT]=co,io[O.RECTANGLE]=oo,io[O.EDGE]=so,io[O.RECTANGLE_EDGE]=ao,io[O.TEXTURE]=po,io);function yo(t){if(!t)return new mo;var e=a({radius:1,arc:360,angle:0,arcMode:dt.RANDOM},t),r=t.type,i=vo[r];if(!i)throw Error("invalid shape:"+r);var n=new i(e);if(r!==O.NONE){var o=t,s=o.alignSpeedDirection,u=o.upDirection,c=void 0===u?[0,0,1]:u;n.alignSpeedDirection=s,n.upDirection=Vt.fromArray(c).normalize()}return n}function xo(t,e,r,i,n){var o,a;if(n===function(t,e,r,i){for(var n=0,o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,r,i)>0)for(o=e;o<r;o+=i)a=No(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=No(o,t[o],t[o+1],a);return a&&Mo(a,a.next)&&(zo(a),a=a.next),a}function go(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!Mo(i,i.next)&&0!==Oo(i.prev,i,i.next))i=i.next;else{if(zo(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function To(t){var e=t.prev,r=t,i=t.next;if(Oo(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Co(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&Oo(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Eo(t,e,r,i){var n=t.prev,o=t,a=t.next;if(Oo(n,o,a)>=0)return!1;for(var s=n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,u=n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,c=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,h=_o(s,u,e,r,i),f=_o(c,l,e,r,i),p=t.prevZ,d=t.nextZ;p&&p.z>=h&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&Co(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Oo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&Co(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Oo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&Co(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Oo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&Co(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Oo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function So(t,e){return t.x-e.x}function bo(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===a)return r;var u,c=r,l=r.x,h=r.y,f=1/0;i=r;do{n>=i.x&&i.x>=l&&n!==i.x&&Co(o<h?n:a,o,l,h,o<h?a:n,o,i.x,i.y)&&(u=Math.abs(o-i.y)/(n-i.x),Vo(i,t)&&(u<f||u===f&&(i.x>r.x||i.x===r.x&&Ro(r,i)))&&(r=i,f=u)),i=i.next}while(i!==c);return r}(t,e),e){var r=Fo(e,t);go(e,e.next),go(r,r.next)}}function Ro(t,e){return Oo(t.prev,t,e.prev)<0&&Oo(e.next,t,t.next)<0}function _o(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 Ao(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 Co(t,e,r,i,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function wo(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&&Lo(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Vo(t,e)&&Vo(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(Oo(t.prev,t,e.prev)||Oo(t,e.prev,e))||Mo(t,e)&&Oo(t.prev,t,t.next)>0&&Oo(e.prev,e,e.next)>0)}function Oo(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Mo(t,e){return t.x===e.x&&t.y===e.y}function Lo(t,e,r,i){var n=Po(Oo(t,e,r)),o=Po(Oo(t,e,i)),a=Po(Oo(r,i,t)),s=Po(Oo(r,i,e));return n!==o&&a!==s||(!(0!==n||!Io(t,r,e))||(!(0!==o||!Io(t,i,e))||(!(0!==a||!Io(r,t,i))||!(0!==s||!Io(r,e,i)))))}function Io(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 Po(t){return t>0?1:t<0?-1:0}function Vo(t,e){return Oo(t.prev,t,t.next)<0?Oo(t,e,t.next)>=0&&Oo(t,t.prev,e)>=0:Oo(t,e,t.prev)<0||Oo(t,t.next,e)<0}function Fo(t,e){var r=new Do(t.i,t.x,t.y),i=new Do(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function No(t,e,r,i){var n=new Do(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 zo(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 Do(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 Uo=0;function Bo(t,e,r,i){r=r||2,Uo=i||0;var n,o,a,s,u,c,l,h=e&&e.length,f=h?e[0]*r:t.length,p=xo(t,0,f,r,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(t,e,r,i){var n,o,a,s=[];for(n=0,o=e.length;n<o;n++)(a=xo(t,e[n]*i,n<o-1?e[n+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),s.push(Ao(a));for(s.sort(So),n=0;n<s.length;n++)bo(s[n],r),r=go(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=a=t[0],o=s=t[1];for(var m=r;m<f;m+=r)(u=t[m])<n&&(n=u),(c=t[m+1])<o&&(o=c),u>a&&(a=u),c>s&&(s=c);l=0!==(l=Math.max(a-n,s-o))?1/l:0}return ko(p,d,r,n,o,l),d}function ko(t,e,r,i,n,o,a){if(t){!a&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=_o(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,o,a,s,u,c=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,i=r,s=0,e=0;e<c&&(s++,i=i.nextZ);e++);for(u=c;s>0||u>0&&i;)0!==s&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,c*=2}while(a>1)}(n)}(t,i,n,o);for(var s,u,c=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?Eo(t,i,n,o):To(t))e.push(s.i/r+Uo),e.push(t.i/r+Uo),e.push(u.i/r+Uo),zo(t),t=u.next,c=u.next;else if((t=u)===c){a?1===a?ko(t=Go(go(t),e,r),e,r,i,n,o,2):2===a&&Xo(t,e,r,i,n,o):ko(go(t),e,r,i,n,o,1);break}}}function Go(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!Mo(n,o)&&Lo(n,i,i.next,o)&&Vo(n,o)&&Vo(o,n)&&(e.push(n.i/r+Uo),e.push(i.i/r+Uo),e.push(o.i/r+Uo),zo(i),zo(i.next),i=t=o),i=i.next}while(i!==t);return go(i)}function Xo(t,e,r,i,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&wo(a,s)){var u=Fo(a,s);return a=go(a,a.next),u=go(u,u.next),ko(a,e,r,i,n,o),void ko(u,e,r,i,n,o)}s=s.next}a=a.next}while(a!==t)}var Ho=2;function Yo(t,e){for(var r=t.s,i=t.p,n=r[1],o=i[1],a=0,s=0;s<n.length;s++){a+=(E=n[s]).length-1}var u,c=new Float32Array(a*f),l=e.indexBase,h=void 0===l?0:l,p=e.uvTransform,d=0,m=0,v=0,y=1,x=1;p&&(m=p[0],v=p[1],u=p[4],y=u?p[3]:p[2],x=u?p[2]:p[3]);var g=[0,0],T=0===u?0:-Math.PI/2;for(s=0;s<n.length;s++)for(var E=n[s],S=o[s],b=o[s+1]||o[0],R=E,_=[0,0],A=0;A<R.length-1;A++){Zo(_,R[A],S,b,S[4],S[5],b[2],b[3]),w(_[0],_[1])}var C=Bo(Array.from(c),null,f,h);return{aPoint:c,index:new Uint16Array(C)};function w(t,e){c[d++]=t/2,c[d++]=e/2,p?(g[0]=t,g[1]=e,Wo(g,g,T),c[d++]=m+(g[0]+1)/2*y,c[d++]=v+(g[1]+1)/2*x):(c[d++]=(t+1)/2,c[d++]=(e+1)/2),d+=Ho}}function jo(t,e){for(var r=[],i=function(t){var e=[];return t.gs?t.gs.forEach((function(t){e.push({p:[ct.SHAPE_POINTS,t.p],s:[ct.SHAPE_SPLITS,t.s]})})):t.g?e.push({p:[ct.SHAPE_POINTS,t.g.p],s:[ct.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,o=0,a=0,s=0;s<i.length;s++){n+=(f=Yo(i[s],{indexBase:n,uvTransform:e})).aPoint.length/5,r.push(f),o+=f.aPoint.length,a+=f.index.length}if(1===r.length)return r[0];for(var u=new Float32Array(o),c=new Uint16Array(a),l=(s=0,0),h=0;s<r[s];s++){var f=r[s];u.set(f.aPoint,l),l+=f.aPoint.length,c.set(f.index,h),h+=f.index.length}return{aPoint:u,index:c}}function Wo(t,e,r){var i=Math.cos(r),n=Math.sin(r),o=e[0],a=e[1];return t[0]=i*o+n*a,t[1]=-n*o+i*a,t}function Zo(t,e,r,i,n,o,a,s){var u=1-e,c=u*u*u,l=3*e*u*u,h=3*e*e*u,f=e*e*e;return t[0]=c*r[0]+l*n+h*a+f*i[0],t[1]=c*r[1]+l*o+h*s+f*i[1],t}var qo=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+r||1,this.count=i instanceof Me?i:ke(i),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}return t.prototype.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},t.prototype.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},t.prototype.clone=function(){return new t(this)},t}(),Qo=new Vt,Ko=new Vt,Jo=function(){function e(e,r){var i;this.pointStart=[];var n=e.colorOverLifetime,o=e.colorOverTrail,a=e.maxTrailCount,s=e.opacityOverLifetime,u=void 0===s?ke(1):s,c=e.widthOverTrail,l=e.name,h=e.occlusion,f=e.blending,p=e.maskMode,d=e.order,m=e.textureMap,v=void 0===m?[0,0,1,1]:m,x=e.texture,g=e.transparentOcclusion,T=e.minimumVertexDistance,S=e.lifetime,b=e.matrix,R=r.gpuCapability,_=R.detail,A=R.level,C=Math.max(e.pointCountPerTrail,2),w={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},O=_.maxVertexTextures>0,M=(null!==(i=r.renderer)&&void 0!==i?i:{}).env,L={},I=[["ENABLE_VERTEX_TEXTURE",O],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",M===y]],P=a>64,V=0;n&&(I.push(["COLOR_OVER_LIFETIME",!0]),V|=1,L.uColorOverLifetime=Kr.createWithData(r,$(n))),o&&(I.push(["COLOR_OVER_TRAIL",!0]),V|=4,L.uColorOverTrail=Kr.createWithData(r,$(o))),P?(I.push(["ATTR_TRAIL_START",1]),V|=8):L.uTrailStart=new Float32Array(a),L.uOpacityOverLifetimeValue=u.toUniform(w);var F=c.toUniform(w);I.push(["VERT_CURVE_VALUE_COUNT",w.index],["VERT_MAX_KEY_FRAME_COUNT",w.max]),L.uVCurveValues=Me.getAllData(w);var N={shader:{vertex:Dr(I,Xi,t.ShaderType.vertex,A),fragment:Dr(I,ki,t.ShaderType.fragment,A),marcos:I,glslVersion:1===A?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(l),cacheId:"-t:+".concat(V,"+").concat(w.index,"+").concat(w.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},z=C*a*2,D=(C-1)*a,U=Float32Array.BYTES_PER_ELEMENT,B=12*U,k={attributes:{aColor:{size:4,stride:B,data:new Float32Array(12*z)},aSeed:{size:1,stride:B,offset:4*U,dataSource:"aColor"},aInfo:{size:3,stride:B,offset:5*U,dataSource:"aColor"},aPos:{size:4,stride:B,offset:8*U,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(z)},aDir:{size:3,data:new Float32Array(3*z)}},indices:{data:new Uint16Array(6*z)},drawCount:6*D,name:"trail#".concat(l),bufferUsage:E.DYNAMIC_DRAW};if(P)k.attributes.aTrailStart={size:1,data:new Float32Array(z)};else{var G=new Float32Array(z);k.attributes.aTrailStartIndex={size:1,data:G};for(var X=0;X<a;X++)for(var H=2*C,Y=X*H,j=0;j<H;j++)G[Y+j]=X}var W=Vr(f),Z=ci.create(r,N);Z.blending=!0,Z.depthMask=h,Z.depthTest=!0,kr(Z,p),Ur(Z,f);var q=this.mesh=Ii.create(r,{name:"MTrail_".concat(l),material:Z,geometry:bi.create(r,k),priority:d}),Q=null!=x?x:Kr.createWithData(r);Object.keys(L).map((function(t){var e=L[t];if(e instanceof Kr)Z.setTexture(t,e);else if("uTrailStart"===t)Z.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var r=[],i=0;i<e.length;i+=4){var n=new Gt(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}Z.setVector4Array(t,r)}else Z.setVector4(t,Gt.fromArray(e))})),Z.setFloat("uTime",0),Z.setVector4("uWidthOverTrail",Gt.fromArray(F)),Z.setVector2("uTexOffset",new Pt(0,0)),Z.setVector4("uTextureMap",Gt.fromArray(v)),Z.setVector4("uParams",new Gt(0,C-1,0,0)),Z.setTexture("uMaskTex",Q),Z.setVector4("uColorParams",new Gt(x?1:0,+W,0,+(h&&!g))),this.maxTrailCount=a,this.pointCountPerTrail=C,this.checkVertexDistance=T>0,this.minimumVertexDistance=Math.pow(T||.001,2),this.useAttributeTrailStart=P,this.lifetime=S,b&&(this.mesh.worldMatrix=b),this.geometry=q.firstGeometry(),this.trailCursors=new Uint16Array(a)}return Object.defineProperty(e.prototype,"time",{get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)},enumerable:!1,configurable:!0}),e.prototype.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=i%n,u=(i-1)%n,c=(i-2)%n,l=this.getTrailPosition(t,u,Qo);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var h=t*n+s,f=ra(l,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,v=6*h,y=new Float32Array(6);y.set(f,0),y.set(f,3),o.setAttributeSubData("aDir",v,y),o.setAttributeSubData("aTime",2*h,new Float32Array([p,p]));var x=r.color||[1,1,1,1],g=new Float32Array(24),T=e.toArray();if(g.set(x,0),g.set(d,4),g[7]=0,g.set(T,8),g[11]=.5*m,g.set(x,12),g.set(d,16),g[19]=1,g.set(T,20),g[23]=-.5*m,o.setAttributeSubData("aColor",24*h,g),u>=0){var E=this.getTrailPosition(t,c,Ko),S=new Float32Array(ra(E,l,e)),b=6*(t*n+u);o.setAttributeSubData("aDir",b,S),o.setAttributeSubData("aDir",b+3,S);var R=t*n*2,_=new Uint16Array([2*u+R,2*u+1+R,2*s+R,2*s+R,2*u+1+R,2*s+1+R]),A=6*(t*a+(i-1)%a);o.setIndexSubData(A,_)}i=++this.trailCursors[t];var C=this.mesh.material,w=C.getVector4("uParams"),O=d[2];if(this.useAttributeTrailStart){for(var M=2*n,L=new Float32Array(M),I=0;I<M;I++)L[I]=O;o.setAttributeSubData("aTrailStart",t*L.length,L)}else{var P=C.getFloats("uTrailStart");null!=P&&(P[t]=O,C.setFloats("uTrailStart",P))}w&&(w.y=Math.max(w.y,i-1)-Math.max(0,i-n),C.setVector4("uParams",w))}},e.prototype.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,o=this.geometry.getAttributeData("aColor");return r.x=o[n],r.y=o[1+n],r.z=o[2+n],r}},e.prototype.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},e.prototype.minusTime=function(t){for(var e=this.geometry.getAttributeData("aTime"),r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.prototype.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();null==r||r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),this.trailCursors[t]=0}},e.prototype.getPointStartPos=function(t){return this.pointStart[t]},e.prototype.setPointStartPos=function(t,e){this.pointStart[t]=e},e.prototype.onUpdate=function(t){},e}(),$o=new Vt,ta=new Vt,ea=new Vt;function ra(t,e,r){var i=$o;return t||r?(t?r?(ta.subtractVectors(e,t).normalize(),ta.subtractVectors(r,e),ea.copyFrom(ta).normalize(),i.addVectors(ta,ea)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}var ia=function(){function t(t,e,r){var i,n,o,a,s,u,c=r.composition,l=r.endBehavior,h=r.name;if(c){var f,p=c.getEngine(),d=e.cachePrefix,m=void 0===d?"":d,v=t.options,y=t.positionOverLifetime,x=t.shape,g=r.duration||1,T=y.gravityOverLifetime,E=ie(y.gravity),S=t.textureSheetAnimation,b=S?{animationDelay:ke(S.animationDelay||0),animationDuration:ke(S.animationDuration||1),cycles:ke(S.cycles||1),animate:S.animate,col:S.col,row:S.row,total:S.total||S.col*S.row}:void 0,R=Dt.fromIdentity(),_=!!(x&&x.turbulenceX||x.turbulenceY||x.turbulenceZ);_&&(f=[ke(null!==(i=x.turbulenceX)&&void 0!==i?i:0),ke(null!==(n=x.turbulenceY)&&void 0!==n?n:0),ke(null!==(o=x.turbulenceZ)&&void 0!==o?o:0)]),this.name=h,this.shape=yo(x),this.emission={rateOverTime:ke(t.emission.rateOverTime),burstOffsets:pa(null!==(a=t.emission.burstOffsets)&&void 0!==a?a:[]),bursts:(t.emission.bursts||[]).map((function(t){return new qo(t)}))},this.textureSheetAnimation=b;var O,M=t.renderer||{},L={},I=t.rotationOverLifetime;I&&(L.asRotation=!!I.asRotation,L.z=I.z?ke(I.z):ke(0),I.separateAxes&&(L.x=I.x&&ke(I.x),L.y=I.y&&ke(I.y))),y.forceTarget&&(O={target:y.target||[0,0,0],curve:ke(y.forceCurve||[ct.LINE,[[0,0],[1,1]]])});var P={x:y.linearX&&ke(y.linearX||0),y:y.linearY&&ke(y.linearY||0),z:y.linearZ&&ke(y.linearZ||0),asMovement:y.asMovement},F={x:y.orbitalX&&ke(y.orbitalX),y:y.orbitalY&&ke(y.orbitalY),z:y.orbitalZ&&ke(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},N=t.sizeOverLifetime||{},z=t.colorOverLifetime,D=r.listIndex,U=m,B=(null==N?void 0:N.separateAxes)?{separateAxes:!0,x:ke(N.x),y:ke(N.y)}:{separateAxes:!1,x:ke(("size"in N?N.size:N.x)||1)},k=Pt.fromArray(ce(M.anchor,M.particleOrigin));this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:ke(v.startLifetime),startDelay:ke(v.startDelay||0),startSpeed:ke(y.startSpeed||0),startColor:ke(v.startColor),endBehavior:l,duration:g,looping:l===ht.loop,maxCount:null!==(s=v.maxCount)&&void 0!==s?s:0,gravityModifier:ke(T||0).scaleXCoord(g),gravity:E,start3DSize:!!v.start3DSize,startTurbulence:_,turbulence:f,speedOverLifetime:y.speedOverLifetime&&ke(y.speedOverLifetime),linearVelOverLifetime:P,orbitalVelOverLifetime:F,forceTarget:O},v.startRotationZ&&(this.options.startRotation=ke(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=ke(v.startRotationX||0),this.options.startRotationY=ke(v.startRotationY||0),this.options.startRotationZ=ke(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=ke(v.startSizeX),this.options.startSizeY=ke(v.startSizeY)):(this.options.startSize=ke(v.startSize),this.options.sizeAspect=ke(v.sizeAspect||1));var G={listIndex:D,meshSlots:v.meshSlots,name:h,matrix:R,filter:t.filter,shaderCachePrefix:U,renderMode:M.renderMode||V.BILLBOARD,side:M.side||C.DOUBLE,gravity:E,duration:r.duration,blending:M.blending||A.ALPHA,rotationOverLifetime:L,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:b,occlusion:!!M.occlusion,transparentOcclusion:!!M.transparentOcclusion,maxCount:v.maxCount,mask:M.mask,maskMode:null!==(u=M.maskMode)&&void 0!==u?u:w.NONE,forceTarget:O,diffuse:M.texture,sizeOverLifetime:B,anchor:k};if(z){var X=z.color,H=z.opacity;G.colorOverLifetime={},H&&(G.colorOverLifetime.opacity=ke(z.opacity)),X&&(X[0]===ct.GRADIENT_COLOR?G.colorOverLifetime.color=z.color[1]:X[0]===ct.RGBA_COLOR?G.colorOverLifetime.color=Kr.createWithData(p,{data:new Uint8Array(X[1]),width:1,height:1}):X instanceof Kr&&(G.colorOverLifetime.color=X))}var Y,j=[],W=[0,0,1,1];if(t.splits){var Z=t.splits[0];W=(Y=Z[4])?[Z[0],Z[1],Z[3],Z[2]]:[Z[0],Z[1],Z[2],Z[3]]}if(b&&!b.animate)for(var q=Y?b.row:b.col,Q=Y?b.col:b.row,K=b.total||q*Q,J=0,$=0;$<q;$++)for(var tt=0;tt<Q&&J<K;tt++,J++)j.push([$*W[2]/q+W[0],tt*W[3]/Q+W[1],W[2]/q,W[3]/Q]);else j.push(W);G.textureFlip=Y,this.uvs=j,this.particleMesh=new ya(G,{composition:c});var et=t.trails;if(et){this.trails={lifetime:ke(et.lifetime),dieWithParticles:!1!==et.dieWithParticles,sizeAffectsWidth:!!et.sizeAffectsWidth,sizeAffectsLifetime:!!et.sizeAffectsLifetime,inheritParticleColor:!!et.inheritParticleColor,parentAffectsPosition:!!et.parentAffectsPosition};var rt={name:r.name+"_trail",matrix:R,minimumVertexDistance:et.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(et.maxPointPerTrail)||32,blending:et.blending,texture:et.texture,opacityOverLifetime:ke(et.opacityOverLifetime||1),widthOverTrail:ke(et.widthOverTrail||1),order:D+(et.orderOffset||0),shaderCachePrefix:U,lifetime:this.trails.lifetime,occlusion:!!et.occlusion,transparentOcclusion:!!et.transparentOcclusion,textureMap:et.textureMap,mask:M.mask,maskMode:M.maskMode};et.colorOverLifetime&&et.colorOverLifetime[0]===ct.GRADIENT_COLOR&&(rt.colorOverLifetime=et.colorOverLifetime[1]),et.colorOverTrail&&et.colorOverTrail[0]===ct.GRADIENT_COLOR&&(rt.colorOverTrail=et.colorOverTrail[1]),this.trailMesh=new Jo(rt,p)}this.transform=r.transform;var it,nt=this.transform.position.clone(),ot=this.transform.rotation.clone(),at=t.emitterTransform&&t.emitterTransform.path;at&&(at[0]===ct.CONSTANT_VEC3?nt.add(at[1]):it=ke(at)),this.basicTransform={position:nt,rotation:ot,path:it},this.updateEmitterTransform(0);var st=[this.particleMesh.mesh];this.trailMesh&&st.push(this.trailMesh.mesh),this.meshes=st,this.reusable=r.reusable,this.setVisible(r.contentVisible);var ut=t.interaction;ut&&(this.interaction={multiple:ut.multiple,radius:ut.radius,behavior:ut.behavior})}}return Object.defineProperty(t.prototype,"timePassed",{get:function(){return this.lastUpdate-this.loopStartTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lifetime",{get:function(){return this.timePassed/this.options.duration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"particleCount",{get:function(){return this.particleLink.length},enumerable:!1,configurable:!0}),t.prototype.updateEmitterTransform=function(t){var e=this.transform.parentTransform,r=this.basicTransform,i=r.path,n=r.position.clone();if(i){var o=this.options.duration;n.add(i.getValue(t/o))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.getWorldMatrix();this.particleMesh.mesh.worldMatrix=a,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=a)}},t.prototype.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var o=i.first;i.removeNode(o),r=n[1]=o.content[1]}i.pushNode(n),this.particleMesh.setPoint(t,r),this.clearPointTrail(r),this.trailMesh&&this.trailMesh.setPointStartPos(r,this.transform.parentTransform.position.clone())},t.prototype.setVisible=function(t){this.particleMesh.mesh.setVisible(t),this.trailMesh&&this.trailMesh.mesh.setVisible(t)},t.prototype.setOpacity=function(t){var e,r=this.particleMesh.mesh.material,i=this.particleMesh.mesh.geometry,n=(null===(e=r.getVector4("uOpacityOverLifetimeValue"))||void 0===e?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new Gt(n[0],n[1],n[2],t));for(var o=i.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},t.prototype.setColor=function(t,e,r,i){var n,o=this.particleMesh.mesh.material,a=this.particleMesh.mesh.geometry,s=(null===(n=o.getVector4("uOpacityOverLifetimeValue"))||void 0===n?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new Gt(s[0],s[1],s[2],i));for(var u=a.getAttributeData("aColor")||[],c=0;c<u.length;c+=32)u[8*c+4]=t,u[8*c+5]=e,u[8*c+6]=r,u[8*c+7]=i},t.prototype.setParentTransform=function(t){},t.prototype.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(r){t.push(e[r])})),this.trailMesh){var r=this.trailMesh.mesh.material.textures;Object.keys(r).forEach((function(e){t.push(r[e])}))}return t},t.prototype.start=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},t.prototype.stop=function(){this.ended=!0,this.started=!1},t.prototype.reset=function(){var t;this.particleMesh.clearPoints(),null===(t=this.trailMesh)||void 0===t||t.clearAllTrails(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new to((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1},t.prototype.onUpdate=function(t){var e,r=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,n=this.particleMesh,o=this.trailMesh,a=this.options,s=this.loopStartTime,u=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,n.time=i,o&&(o.time=i,o.onUpdate(t));var c=this.particleLink,f=(i-s)/a.duration,p=this.timePassed,d=!1,m=function(){r.trails&&!d&&(d=!0,c.forEach((function(t){var e=l(t,4),i=e[0],n=e[1],o=e[2],a=e[3];i<p?r.clearPointTrail(n):p>o&&r.updatePointTrail(n,f,a,o)})))};if(this.ended){if(!a.looping)if(this.reusable);else if(0===a.endBehavior){var v=c.last;v&&v.content[0]-s<p&&(this.onUpdate=function(){return r.onDestroy()})}}else{var y=a.duration,x=this.lifetime;if(p<y){var g=1/u.rateOverTime.getValue(x),T=Math.floor((p-this.lastEmitTime)/g),E=T,S=g/T,b=i,R=a.maxCount;this.updateEmitterTransform(p);for(var _=function(){var t=c.first;return r.emissionStopped||c.length===R&&t&&t.content[0]-s>p},A=0;A<E&&A<R&&!_();A++){(V=this.createPoint(x)).delay+=b+A*S,this.addParticle(V,R),this.lastEmitTime=p}for(var C=u.bursts,w=(null==C?void 0:C.length)-1,O=0;w>=0&&O<R&&!_();w--){var M=C[w],L=!M.disabled&&M.getGeneratorOptions(p,x);if(L){var I=u.burstOffsets[w],P=I&&I[L.cycleIndex]||[0,0,0];M.once&&this.removeBurst(w);for(A=0;A<L.count&&O<R&&!_();A++){var V;(V=this.initPoint(this.shape.generate({total:L.total,index:L.index,burstIndex:A,burstCount:L.count}))).delay+=b,O++,(e=V.transform).translate.apply(e,h([],l(P),!1)),this.addParticle(V,R)}}}}else if(a.looping)m(),this.loopStartTime=i-y,this.lastEmitTime-=y,this.lastUpdate-=y,u.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=y,t[2]-=y,t[3].delay-=y})),n.minusTime(y),o&&o.minusTime(y),this.onIterate(this);else{this.ended=!0,this.onEnd(this),4===a.endBehavior&&(this.frozen=!0)}}m()}},t.prototype.onDestroy=function(){},t.prototype.getParticleBoxes=function(){var t=this.particleLink,e=this.particleMesh,r=[],i=this.particleCount,n=0;if(!t||!e)return r;for(var o=t.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);r.push({center:c,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>i&&(a=!0)}return r},t.prototype.raycast=function(t){var e=this.particleLink,r=this.particleMesh;if(e&&r){var i=e.last,n=[],o=new Vt,a=!1;if(i&&i.content)do{var s=l(i.content,4),u=s[0],c=s[1];s[2];var h=s[3];if(!(u>this.timePassed))break;var f=this.getPointPosition(h),p=t.ray,d=!1;p&&(d=!!p.intersectSphere({center:f,radius:t.radius},o)),d&&(t.removeParticle&&(r.removePoint(c),this.clearPointTrail(c),e.removeNode(i),i.content[0]=0,e.shiftNode(i.content)),n.push(f),t.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},t.prototype.clearPointTrail=function(t){var e;this.trails&&this.trails.dieWithParticles&&(null===(e=this.trailMesh)||void 0===e||e.clearTrail(t))},t.prototype.updatePointTrail=function(t,e,r,i){if(this.trailMesh){var n=this.trails,o=this.particleMesh,a=this.getPointPosition(r),s=n.inheritParticleColor?o.getPointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),c=1,l=n.lifetime.getValue(e);if(n.sizeAffectsWidth&&(c*=u[0]),n.sizeAffectsLifetime&&(l*=u[0]),n.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var h=this.trailMesh.getPointStartPos(t);h&&a.subtract(h)}this.trailMesh.addPoint(t,a,{color:s,lifetime:l,size:c,time:i})}},t.prototype.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,o=t.gravity,a=void 0===o?[]:o,s=this.options.forceTarget,u=this.lastUpdate-n,c=new Vt,l=Vt.fromArray(a);e.assignWorldTRS(c);var h=re(new Vt,this.options,l,u,i,c,r);if(s){var f=s.target||[0,0,0],p=s.curve.getValue(u/i),d=1-p;h.x=h.x*d+f[0]*p,h.y=h.y*d+f[1]*p,h.z=h.z*d+f[2]*p}return h},t.prototype.onEnd=function(t){},t.prototype.onIterate=function(t){},t.prototype.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),o=e.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),a=o.transformPoint(t.position,new Vt),s=new hr({position:a,valid:!0}),u=t.direction;if(u=o.transformNormal(u,na).normalize(),e.startTurbulence&&e.turbulence){for(var c=0;c<3;c++)ca.setElement(c,e.turbulence[c].getValue(r));la.setFromVector3(ca.negate()),fa.setFromEuler(la).transformNormal(u).normalize()}var l,h=sa,f=ua;i.alignSpeedDirection?(f.copyFrom(u),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=Vt.Z.clone(),o.transformNormal(this.upDirectionWorld)),h.crossVectors(f,this.upDirectionWorld).normalize(),h.isZero()&&h.set(1,0,0)):(h.set(1,0,0),f.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((l=ha)[0]=p.animationDelay.getValue(r),l[1]=p.animationDuration.getValue(r),l[2]=p.cycles.getValue(r));var d=aa;e.start3DRotation?d.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?d.set(0,0,e.startRotation.getValue(r)):d.set(0,0,0),s.setRotation(d.x,d.y,d.z);var m=e.startColor.getValue(r);3===m.length&&(m[3]=1);var v=oa;if(e.start3DSize)v.x=e.startSizeX.getValue(r),v.y=e.startSizeY.getValue(r);else{var y=e.startSize.getValue(r),x=e.sizeAspect.getValue(r);v.x=y,v.y=0===x?0:y/x}var g=u.clone();if(g.multiply(n),!e.particleFollowParent){var T=new Vt;this.transform.assignWorldTRS(void 0,void 0,T),v.x*=T.x,v.y*=T.y}return s.setScale(v.x,v.y,1),{size:v,vel:g,color:m,delay:e.startDelay.getValue(r),lifetime:e.startLifetime.getValue(r),uv:da(this.uvs,!0),gravity:e.gravity,sprite:l,dirY:f,dirX:h,transform:s}},t.prototype.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&e instanceof Array){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},t.prototype.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},t.prototype.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},t}(),na=new Vt,oa=new Pt,aa=new kt,sa=new Vt,ua=new Vt,ca=new Vt,la=new kt,ha=[0,0,0],fa=new Dt;function pa(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=t instanceof Array,i=r?t[0]:t.index,n=e[i];n||(n=e[i]=[]),r?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function da(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var ma=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.destroyed=!1,t}return o(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return P.particle},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){this.particle=t.content,this.composition&&(this._content=new ia(this.particle,this.composition.getRendererOptions(),this))},r.prototype.onLifetimeBegin=function(t,e){var r=this;return e&&(e.name=this.name,e.start(),e.onDestroy=function(){r.destroyed=!0}),e},r.prototype.onItemUpdate=function(t,e){var r;if(this.content){var i=!this.visible,n=this.parentId&&(null===(r=this.composition)||void 0===r?void 0:r.getItemByID(this.parentId));if(!i&&n){var o=n.getRenderData();o&&(o.visible||(i=!1))}i?this.content.setVisible(!1):(this.content.setVisible(!0),this.content.onUpdate(t))}},r.prototype.onItemRemoved=function(e,r){r&&(e.destroyTextures(r.getTextures()),r.meshes.forEach((function(e){return e.dispose({material:{textures:t.DestroyOptions.keep}})})))},r.prototype.setColor=function(t,e,r,i){this.content.setColor(t,e,r,i)},r.prototype.setOpacity=function(t){this.content.setOpacity(t)},r.prototype.stopParticleEmission=function(){this.content&&(this.content.emissionStopped=!0)},r.prototype.resumeParticleEmission=function(){this.content&&(this.content.emissionStopped=!1)},r.prototype.doCreateContent=function(t){return this.content?this.content:new ia(this.particle,t.getRendererOptions(),this)},r.prototype.isEnded=function(t){return e.prototype.isEnded.call(this,t)&&this.destroyed},r.prototype.getBoundingBox=function(){var e=this.content;if(e){var r=e.getParticleBoxes();return{type:t.HitTestType.sphere,area:r}}},r.prototype.getHitTestParams=function(e){var r,i=this,n=null===(r=this.content)||void 0===r?void 0:r.interaction;if(e||n)return{type:t.HitTestType.custom,collect:function(t){var e;return null===(e=i.content)||void 0===e?void 0:e.raycast({radius:(null==n?void 0:n.radius)||.4,multiple:!!(null==n?void 0:n.multiple),removeParticle:(null==n?void 0:n.behavior)===pt.removeParticle,ray:t})}}},r}(fr),va={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"},ya=function(){function e(e,r){var i,n,o,a;this.particleCount=0;var s,u,c=r.composition.getEngine(),l=(null!==(i=c.renderer)&&void 0!==i?i:{}).env,h=e.speedOverLifetime,f=e.colorOverLifetime,p=e.linearVelOverLifetime,d=e.orbitalVelOverLifetime,m=e.sizeOverLifetime,v=e.rotationOverLifetime,g=e.sprite,T=e.gravityModifier,E=e.maxCount,S=e.duration,b=e.textureFlip,R=e.useSprite,_=e.name,A=e.filter,C=e.gravity,w=e.forceTarget,O=e.side,M=e.occlusion,L=e.anchor,I=e.blending,P=e.maskMode,V=e.mask,F=e.transparentOcclusion,N=e.listIndex,z=e.meshSlots,D=e.renderMode,U=void 0===D?0:D,B=e.diffuse,G=void 0===B?Kr.createWithData(c):B,X=c.gpuCapability.detail,H=X.halfFloatTexture,Y=X.maxVertexUniforms,j=[["RENDER_MODE",+U],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",l===y]],W=c.gpuCapability.level,Z={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},q={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},Q=Y>0,K={},J=0,tt=0;if(this.useSprite=R,Q&&j.push(["ENABLE_VERTEX_TEXTURE",!0]),h&&(j.push(["SPEED_OVER_LIFETIME",!0]),tt|=2,K.uSpeedLifetimeValue=h.toUniform(Z)),(null==g?void 0:g.animate)&&(j.push(["USE_SPRITE",!0]),tt|=4,K.uFSprite=K.uSprite=new Float32Array([g.col,g.row,g.total,g.blend?1:0]),this.useSprite=!0),A&&A.name!==x){j.push(["USE_FILTER",!0]),tt|=8;var et=k(A,r.composition);if(!et.particle)throw new Error("particle filter ".concat(A.name," not implement"));s=et.particle,Object.keys(null!==(n=s.uniforms)&&void 0!==n?n:{}).forEach((function(t){var e,r=null===(e=s.uniforms)||void 0===e?void 0:e[t];if(K[t])throw new Error("conflict uniform name:"+t);K[t]=null==r?void 0:r.toUniform(Z)})),Object.keys(null!==(o=s.uniformValues)&&void 0!==o?o:{}).forEach((function(t){var e,r=null===(e=s.uniformValues)||void 0===e?void 0:e[t];if(K[t])throw new Error("conflict uniform name:"+t);K[t]=r}))}(null==f?void 0:f.color)&&(j.push(["COLOR_OVER_LIFETIME",!0]),tt|=16,K.uColorOverLifetime=f.color instanceof Kr?f.color:Kr.createWithData(c,$(f.color))),(null==f?void 0:f.opacity)?K.uOpacityOverLifetimeValue=f.opacity.toUniform(Z):K.uOpacityOverLifetimeValue=ke(1).toUniform(Z),["x","y","z"].forEach((function(t,e){var r=0,i=0;(null==p?void 0:p[t])&&(K["uLinear".concat(t.toUpperCase(),"ByLifetimeValue")]=p[t].toUniform(Z),r=1,tt|=1<<7+e,p.enabled=!0),j.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]),(null==d?void 0:d[t])&&(K["uOrb".concat(t.toUpperCase(),"ByLifetimeValue")]=d[t].toUniform(Z),i=1,tt|=1<<10+e,u=!0,d.enabled=!0),j.push(["ORB_VEL_".concat(t.toUpperCase()),i])})),(null==p?void 0:p.asMovement)&&(j.push(["AS_LINEAR_MOVEMENT",!0]),tt|=32),u&&((null==d?void 0:d.asRotation)&&(j.push(["AS_ORBITAL_MOVEMENT",!0]),tt|=64),K.uOrbCenter=new Float32Array((null==d?void 0:d.center)||[0,0,0])),K.uSizeByLifetimeValue=null==m?void 0:m.x.toUniform(Z),(null==m?void 0:m.separateAxes)&&(j.push(["SIZE_Y_BY_LIFE",1]),tt|=16384,K.uSizeYByLifetimeValue=null===(a=null==m?void 0:m.y)||void 0===a?void 0:a.toUniform(Z)),(null==v?void 0:v.z)&&(K.uRZByLifeTimeValue=v.z.toUniform(Z),tt|=32768,j.push(["ROT_Z_LIFETIME",1])),(null==v?void 0:v.x)&&(K.uRXByLifeTimeValue=v.x.toUniform(Z),tt|=65536,j.push(["ROT_X_LIFETIME",1])),(null==v?void 0:v.y)&&(K.uRYByLifeTimeValue=v.y.toUniform(Z),tt|=1<<17,j.push(["ROT_Y_LIFETIME",1])),(null==v?void 0:v.asRotation)&&(j.push(["ROT_LIFETIME_AS_MOVEMENT",1]),tt|=1<<18),K.uGravityModifierValue=T.toUniform(Z),w&&(j.push(["FINAL_TARGET",!0]),tt|=1<<19,K.uFinalTarget=new Float32Array(w.target||[0,0,0]),K.uForceCurve=w.curve.toUniform(Z)),H&&q.max?(tt|=1<<20,K.uFCurveValueTexture=Jr(c,Me.getAllData(q,!0),q.index,1)):K.uFCurveValues=Me.getAllData(q);var rt=Z.max+Z.curves.length-32>Y;if(2===W&&(Z.max=-1,Z.index=z?z[0]:ga(Z.index),q.index>0&&(q.max=-1,q.index=z?z[1]:ga(q.index))),rt&&H&&Q){var it=Jr(c,Me.getAllData(Z,!0),Z.index,1);K.uVCurveValueTexture=it,J=1}else K.uVCurveValues=Me.getAllData(Z);var nt=["-p:",U,tt,Z.index,Z.max,q.index,q.max].join("+");j.push(["VERT_CURVE_VALUE_COUNT",Z.index],["FRAG_CURVE_VALUE_COUNT",q.index],["VERT_MAX_KEY_FRAME_COUNT",Z.max],["FRAG_MAX_KEY_FRAME_COUNT",q.max]);var ot=A?ki.replace(/#pragma\s+FILTER_FRAG/,s.fragment):ki,at="#define LOOKUP_TEXTURE_CURVE ".concat(J,"\n").concat(Gi),st=A?at.replace(/#pragma\s+FILTER_VERT/,s.vertex||"void filterMain(float t){}\n"):at,ut={fragment:Dr(j,ot,t.ShaderType.fragment,W),vertex:Dr(j,st,t.ShaderType.vertex,W),glslVersion:1===W?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:nt,marcos:j,name:"particle#".concat(_)};A&&(ut.cacheId+=A.name);var ct={shader:ut,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},lt=Vr(I);K.uTexOffset=new Float32Array(G?[1/G.getWidth(),1/G.getHeight()]:[0,0]),K.uMaskTex=G,K.uColorParams=new Float32Array([G?1:0,+lt,0,+(!!M&&!F)]),K.uParams=[0,S,0,0],K.uAcceleration=[(null==C?void 0:C[0])||0,(null==C?void 0:C[1])||0,(null==C?void 0:C[2])||0,0];var ht=ci.create(c,ct);ht.blending=!0,ht.depthTest=!0,ht.depthMask=!!M,ht.stencilRef=V?[V,V]:void 0,kr(ht,P),Ur(ht,I),Br(ht,O),Object.keys(K).map((function(t){var e=K[t];if(e instanceof Kr)ht.setTexture(t,e);else{var r=[];switch(va[t]){case"vec4":ht.setVector4(t,Gt.fromArray(e));break;case"vec3":ht.setVector3(t,Vt.fromArray(e));break;case"vec2":ht.setVector2(t,Pt.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new Gt(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}ht.setVector4Array(t,r),r.length=0;break;default:console.warn("uniform ".concat(t,"'s type not in typeMap"))}}})),ht.setVector3("emissionColor",new Vt(0,0,0)),ht.setFloat("emissionIntensity",0);var ft=bi.create(c,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,o={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)}};e&&(o.aSprite={size:3,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*E,this.useSprite,"particle#".concat(_))),pt=Ii.create(c,{name:"MParticle_".concat(_),priority:N,material:ht,geometry:ft});this.anchor=L,this.mesh=pt,this.geometry=pt.firstGeometry(),this.forceTarget=w,this.sizeOverLifetime=m,this.speedOverLifetime=h,this.linearVelOverLifetime=p,this.orbitalVelOverLifetime=d,this.orbitalVelOverLifetime=d,this.gravityModifier=T,this.maxCount=E,this.duration=S,this.textureOffsets=b?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0]}return Object.defineProperty(e.prototype,"time",{get:function(){return this.mesh.material.getVector4("uParams").x},set:function(t){this.mesh.material.setVector4("uParams",new Gt(+t,this.duration,0,0))},enumerable:!1,configurable:!0}),e.prototype.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=32*t+4;return[e[r],e[r+1],e[r+2],e[r+3]]},e.prototype.getPointPosition=function(t){var e=this.geometry,r=48*t,i=e.getAttributeData("aPos"),n=e.getAttributeData("aOffset"),o=this.time-n[16*t+2],a=n[16*t+3],s=this.mesh.material,u=s.getVector4("uAcceleration").toVector3(),c=Vt.fromArray(i,r),l=Vt.fromArray(i,r+3),h=re(new Vt,this,u,o,a,c,l);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),p=this.forceTarget.curve.getValue(o/a),d=1-p;h.x=h.x*d+f.x*p,h.y=h.y*d+f.y*p,h.z=h.z*d+f.z*p}return h},e.prototype.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.prototype.resetGeometryData=function(t){for(var e=t.getAttributeNames(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new r.constructor(0))},e.prototype.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.prototype.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.prototype.setPoint=function(t,e){var r=this.maxCount;if(e<r){var i=e+1,n=4*i,o=this.geometry,a=i>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},c=this.useSprite;c&&(u.aSprite=new Float32Array(12));var l=new Vt,h=new Ft,f=new Vt(1,1,1);t.transform.assignWorldTRS(l,h,f);var p=hr.getRotation(h,new kt),d=l.toArray(),m=p.toArray(),v=this.textureOffsets,y=[0,0,t.delay,t.lifetime],x=[0,0,1,1],g=t.vel,T=t.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],S=Math.random(),b=void 0;c&&(b=t.sprite);for(var R=0;R<4;R++){var _=2*R,A=3*R,C=4*R,w=12*R,O=8*R;u.aPos.set(d,w),g.fill(u.aPos,w+3),u.aRot.set(m,O),u.aRot[O+3]=S,u.aRot.set(T,O+4),c&&u.aSprite.set(b,A);var M=t.uv||x;if(M){var L=c?1-v[_+1]:v[_+1];y[0]=M[0]+v[_]*M[2],y[1]=M[1]+L*M[3]}u.aOffset.set(y,C);for(var I=R+R,P=(E[I]-this.anchor.x)*f.x,V=(E[I+1]-this.anchor.y)*f.y,F=0;F<3;F++)u.aPos[w+6+F]=t.dirX.getElement(F)*P,u.aPos[w+9+F]=t.dirY.getElement(F)*V}var N=new Uint16Array([0,1,2,2,1,3].map((function(t){return t+4*e})));if(a){var z=Y(o.getIndexData(),6*i,s,6*r);z.set(N,6*e),o.setIndexData(z),this.maxParticleBufferCount=z.length/6}else o.setIndexSubData(6*e,N);Object.keys(u).forEach((function(t){var i=u[t],c=o.getAttributeStride(t)/Float32Array.BYTES_PER_ELEMENT;if(a){var l=Y(o.getAttributeData(t),n*c,s,4*r*c);l.set(i,i.length*e),o.setAttributeData(t,l)}else o.setAttributeSubData(t,i.length*e,i)})),this.particleCount=Math.max(i,this.particleCount),o.setDrawCount(6*this.particleCount)}},e}(),xa=[10,32,64,160];function ga(t){for(var e=0;e<xa.length;e++){var r=xa[e];if(r>t)return r}return t||xa[0]}function Ta(t,e,r){var i,n,o,a,s;void 0===e&&(e="");var u=t.content,c=+((null===(i=u.renderer)||void 0===i?void 0:i.renderMode)||0),l=[["RENDER_MODE",c],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",e===y]],h=r.level,f=r.detail,p={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},d={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},m=f.maxVertexUniforms>0,v=(null!==(n=u.positionOverLifetime)&&void 0!==n?n:{}).speedOverLifetime,g=0,T=0;m&&l.push(["ENABLE_VERTEX_TEXTURE",!0]),v&&(l.push(["SPEED_OVER_LIFETIME",!0]),T|=2,He(p,v));var E=u.textureSheetAnimation;E&&E.animate&&(l.push(["USE_SPRITE",!0]),T|=4);var S=void 0;if(u.filter&&u.filter.name!==x){l.push(["USE_FILTER",!0]),T|=8;var b=B(u.filter).find((function(t){return t.isParticle}));if(!b)throw Error("particle filter ".concat(u.filter.name," not implement"));S=b,null===(o=b.uniforms)||void 0===o||o.forEach((function(t){return He(p,t)}))}var R=u.colorOverLifetime;R&&R.color&&(l.push(["COLOR_OVER_LIFETIME",!0]),T|=16);var _=R&&R.opacity;_&&He(p,_);var A,C=u.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==C?void 0:C[i])&&(He(p,C[i]),r=1,T|=1<<7+e),l.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]);var o=0;(null==C?void 0:C[n])&&(He(p,C[n]),o=1,T|=1<<10+e,A=!0),l.push(["ORB_VEL_".concat(t.toUpperCase()),o])})),(null==C?void 0:C.asMovement)&&(l.push(["AS_LINEAR_MOVEMENT",!0]),T|=32),A&&(null==C?void 0:C.asRotation)&&(l.push(["AS_ORBITAL_MOVEMENT",!0]),T|=64),u.sizeOverLifetime){var w=u.sizeOverLifetime;w.separateAxes?(He(p,w.x),l.push(["SIZE_Y_BY_LIFE",1]),T|=16384,He(p,w.y)):He(p,w.size)}if(u.rotationOverLifetime){var O=u.rotationOverLifetime;O.z&&(He(p,null==O?void 0:O.z),T|=32768,l.push(["ROT_Z_LIFETIME",1])),O.separateAxes&&(O.x&&(He(p,O.x),T|=65536,l.push(["ROT_X_LIFETIME",1])),O.y&&(He(p,O.y),T|=1<<17,l.push(["ROT_Y_LIFETIME",1]))),(null==O?void 0:O.asRotation)&&(l.push(["ROT_LIFETIME_AS_MOVEMENT",1]),T|=1<<18)}He(p,null==C?void 0:C.gravityOverLifetime),(null==C?void 0:C.forceTarget)&&(l.push(["FINAL_TARGET",!0]),T|=1<<19,He(p,C.forceCurve));var M=f.halfFloatTexture;M&&d.max&&(T|=1<<20);var L=f.maxVertexUniforms,I=p.max+p.curves.length-32>L;wi(_i)&&(I=!0),2===h&&(p.max=-1,d.index>0&&(d.max=-1)),I&&M&&m&&(g=1);var P=["-p:",c,T,p.index,p.max,d.index,d.max].join("+"),V={fragment:ki,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(g,"\n").concat(Gi),shared:!0,cacheId:P,marcos:l,name:"particle#".concat(t.name)};return S&&(V.fragment=V.fragment.replace(/#pragma\s+FILTER_FRAG/,null!==(a=S.fragment)&&void 0!==a?a:""),V.vertex=V.vertex.replace(/#pragma\s+FILTER_VERT/,S.vertex||"void filterMain(float t){}\n"),V.cacheId+="+"+(null===(s=u.filter)||void 0===s?void 0:s.name)),l.push(["VERT_CURVE_VALUE_COUNT",p.index],["FRAG_CURVE_VALUE_COUNT",d.index],["VERT_MAX_KEY_FRAME_COUNT",p.max],["FRAG_MAX_KEY_FRAME_COUNT",d.max]),{shader:V,vertex:p.index,fragment:d.index}}function Ea(t,e,r){var i,n=null===(i=t.cacheId)||void 0===i?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.marcos)for(var o=0;o<t.marcos.length;o++){var a=t.marcos[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}var Sa,ba=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.meshes=[],t}return o(r,e),r.precompile=function(e,r,i){var n=r.engine.gpuCapability,o=n.level,a=(null!=i?i:{}).env,s=r.getShaderLibrary(),u=[],c=[],l=0,h=0;return e.forEach((function(e){e.items.forEach((function(e){t.Item.isParticle(e)&&u.push(e)}))})),u.forEach((function(e){var r,i,u=Ta(e,a,n),f=u.shader,p=u.fragment,d=u.vertex;if(c.push(f),l=Math.max(l,p),h=Math.max(h,d),e.content.trails){var m=function(t,e,r,i,n){void 0===i&&(i="");var o=0,a=wi(_i)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===y]],u={curves:[],index:0,max:0,lineSegCount:0,curveCount:0};return t.colorOverLifetime&&(s.push(["COLOR_OVER_LIFETIME",!0]),o|=1),t.colorOverTrail&&(s.push(["COLOR_OVER_TRAIL",!0]),o|=4),e>64&&(s.push(["ATTR_TRAIL_START",1]),o|=8),He(u,t.opacityOverLifetime),He(u,t.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",u.index],["VERT_MAX_KEY_FRAME_COUNT",u.max]),{vertex:Xi,fragment:ki,marcos:s,shared:!0,name:"trail#"+r,cacheId:"-t:+".concat(o,"+").concat(u.index,"+").concat(u.max)}}(e.content.trails,e.content.options.maxCount,e.name,a,n);m.vertex=Dr(null!==(r=m.marcos)&&void 0!==r?r:[],m.vertex,t.ShaderType.vertex,o),m.fragment=Dr(null!==(i=m.marcos)&&void 0!==i?i:[],m.fragment,t.ShaderType.fragment,o),m.glslVersion=2===o?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,s.addShader(m)}})),c.forEach((function(e){var r,i;2===o?(Ea(e,h,l),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=Dr(null!==(r=e.marcos)&&void 0!==r?r:[],e.vertex,t.ShaderType.vertex,o),e.fragment=Dr(null!==(i=e.marcos)&&void 0!==i?i:[],e.fragment,t.ShaderType.fragment,o),s.addShader(e)})),2===o&&u.forEach((function(t){t.content.options.meshSlots=[h,l]})),Promise.resolve()},r.prototype.onCompositionItemLifeBegin=function(t,e){e instanceof ma&&this.add(e.content)},r.prototype.onCompositionItemRemoved=function(t,e){e instanceof ma&&e.content&&this.remove(e.content,t.renderFrame)},r.prototype.prepareRenderFrame=function(t,e){return this.meshes.forEach((function(t){return e.addMeshToDefaultRenderPass(t)})),this.meshes.length=0,!1},r.prototype.add=function(t){var e=this;t.meshes.forEach((function(t){return G(e.meshes,t)}))},r.prototype.remove=function(t,e){var r=this;t.meshes.forEach((function(t){X(r.meshes,t),e.removeMeshFromDefaultRenderPass(t)}))},r}(Er),Ra=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(Er),_a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._v_priority=1,e.childrenVisible=!0,e}return o(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return P.null},enumerable:!1,configurable:!0}),e.prototype.onConstructed=function(t){this.cal=t.content,this.relative=t.relative},e.prototype.onLifetimeBegin=function(t,e){e.active=!0},e.prototype.onItemRemoved=function(t,e){},e.prototype.onItemUpdate=function(t,e){this.content&&(this.content.updateTime(this.time),this.renderData=this.content.getRenderData(this.content.time))},e.prototype.setScale=function(t,e,r){this.content.startSize=new Vt(t,e,r)},e.prototype.scale=function(t,e,r){var i=this.content.startSize.clone();this.content.startSize=new Vt(t*i.x,e*i.y,r*i.z)},e.prototype.getHitTestParams=function(t){},e.prototype.getRenderData=function(){return this.renderData},e.prototype.getChildrenVisible=function(){return this.childrenVisible},e.prototype.setChildrenVisible=function(t){this.childrenVisible!==t&&(this.childrenVisible=!!t,this.handleVisibleChanged(this.visible))},e.prototype.doCreateContent=function(t){var e=new jn(this.cal,this);return e.renderData=e.getRenderData(0,!0),e},e.prototype.handleVisibleChanged=function(t){this.content&&(this.content.visible=t||this.childrenVisible)},e}(fr),Aa=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.getItemGeometryData=function(t,e){var r=t,i=r.splits,n=r.renderer,o=r.textureSheetAnimation,a=r.startSize;r.textLayout;var s=a.x,u=a.y;if(n.shape){for(var c=n.shape,l=c.index,h=c.aPoint,f=new Float32Array(h),p=0;p<f.length;p+=6)f[p]*=s,f[p+1]*=u;return{index:l,aPoint:Array.from(f)}}var d=.5,m=.5,v=[-d,m,-d,-m,d,m,d,-m],y=[],x=[],g=2,T=2;1===i.length&&(g=1,T=1);for(var E=0;E<g;E++)for(var S=0;S<T;S++){var b=4*(2*S+E),R=o?[0,0,1,1,i[0][4]]:i[2*S+E],_=R[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],A=((E+E+1)/g-1)/2,C=((S+S+1)/T-1)/2,w=R[0],O=R[1],M=R[4]?R[3]:R[2],L=R[4]?R[2]:R[3],I=[v[0]/g+A,v[1]/T+C,v[2]/g+A,v[3]/T+C,v[4]/g+A,v[5]/T+C,v[6]/g+A,v[7]/T+C];y.push(I[0]*s,I[1]*u,_[0]*M+w,_[1]*L+O,e,0,I[2]*s,I[3]*u,_[2]*M+w,_[3]*L+O,e,0,I[4]*s,I[5]*u,_[4]*M+w,_[5]*L+O,e,0,I[6]*s,I[7]*u,_[6]*M+w,_[7]*L+O,e,0),this.lineMode?x.push(b,1+b,1+b,3+b,3+b,2+b,2+b,b):x.push(b,1+b,2+b,2+b,1+b,3+b)}return{index:x,aPoint:y}},e}(Pn),Ca=function(t){var e,r,i,n,o,a;this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var s=t.textColor,u=void 0===s?[1,1,1,1]:s,c=t.fontSize,l=void 0===c?40:c,h=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,x=void 0===y?"sans-serif":y;this.textColor=u,this.textWeight=d,this.fontStyle=v,this.fontFamily=x,this.fontSize=l,h&&(this.isOutlined=!0,this.outlineColor=null!==(e=h.outlineColor)&&void 0!==e?e:[1,1,1,1],this.outlineWidth=null!==(r=h.outlineWidth)&&void 0!==r?r:1,this.fontOffset+=this.outlineWidth),f&&(this.hasShadow=!0,this.shadowBlur=null!==(i=f.shadowBlur)&&void 0!==i?i:2,this.shadowColor=null!==(n=f.shadowColor)&&void 0!==n?n:[0,0,0,1],this.shadowOffsetX=null!==(o=f.shadowOffsetX)&&void 0!==o?o:0,this.shadowOffsetY=null!==(a=f.shadowOffsetY)&&void 0!==a?a:0),this.fontStyle!==bt.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},wa=function(){function t(){}return t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var r={ascent:0,descent:0,fontSize:0},i=t._canvas,n=i.getContext("2d",{willReadFrequently:!0});n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,a=Math.ceil(n.measureText(o).width),s=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),u=Math.ceil(t.HEIGHT_MULTIPLIER*s);s=s*t.BASELINE_MULTIPLIER|0,i.width=a,i.height=u,n.fillStyle="#f00",n.fillRect(0,0,a,u),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,s);var c=n.getImageData(0,0,a,u).data,l=c.length,h=4*a,f=0,p=0,d=!1;for(f=0;f<s;++f){for(var m=0;m<h;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p+=h}for(r.ascent=s-f,p=l-h,d=!1,f=u;f>s;--f){for(m=0;m<h;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p-=h}return r.descent=f-s,r.fontSize=r.ascent+r.descent,t._fonts[e]=r,r},Object.defineProperty(t,"_canvas",{get:function(){var e;return wi(Ai)?(e=window._createOffscreenCanvas(10,10),t.__canvas=e):t.__canvas||((e=document.createElement("canvas")).width=e.height=10,t.__canvas=e),t.__canvas},enumerable:!1,configurable:!0}),t._fonts={},t.METRICS_STRING="|ÉqÅ",t.BASELINE_SYMBOL="M",t.BASELINE_MULTIPLIER=1.4,t.HEIGHT_MULTIPLIER=2,t}(),Oa=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];t.QTextWrapMode=void 0,(Sa=t.QTextWrapMode||(t.QTextWrapMode={}))[Sa.Default=0]="Default",Sa[Sa.Clip=1]="Clip",Sa[Sa.Ellipsis=2]="Ellipsis";var Ma=function(){function e(e,r){var i,n,o,a,s,u,c,l,h,f;this.left=0,this.top=0,this.fontSize=48,this.fontFamily="Arial",this.color="black",this.letterSpacing=0,this.maxLineWidth=0,this.wrap=t.QTextWrapMode.Clip,this.scaleX=1,this.scaleY=1,this.angle=0,this.active=!0,this.padding=0,this.borderColor="#ffffffff",this.borderWidth=1,this.fontProperties={ascent:0,descent:0,fontSize:0},this.fontVariant="normal",this.originX="left",this.originY="top",this.ellipsis="…",this.text=e,this.left=null!==(i=r.left)&&void 0!==i?i:0,this.top=null!==(n=r.top)&&void 0!==n?n:0,this.maxLineWidth=null!==(o=r.maxWidth)&&void 0!==o?o:0,this.letterSpacing=null!==(a=r.letterSpacing)&&void 0!==a?a:0,this.originX="left",this.originY="top",this.color=null!==(s=r.color)&&void 0!==s?s:"black",this.fontFamily=null!==(u=r.fontFamily)&&void 0!==u?u:"Arial",this.fontSize=null!==(c=r.fontSize)&&void 0!==c?c:48,this.wrap=null!==(l=r.wrap)&&void 0!==l?l:t.QTextWrapMode.Clip,this.fontStyle=null!==(h=r.fontStyle)&&void 0!==h?h:"normal",this.textAlign="left",this.textBaseline="alphabetic",this.fontWeight="normal",this.angle=null!==(f=r.angle)&&void 0!==f?f:0,this.name=r.name||""}return e.prototype.update=function(){this.updateDimension()},e.prototype.render=function(){if(void 0!==this.viewer){var t=this.viewer.renderContext;void 0!==t&&(t.save(),this.setRenderTransform(t),this.renderText(t),this.active&&this.drawBorders(t),t.restore())}},e.prototype.init=function(t){this.viewer=t,this.updateDimension()},e.prototype.getLayout=function(){var t=this.viewer.scaleX,e=this.viewer.scaleY;return{x:this.left*t,y:this.top*e,width:this.width*t,height:this.height*e}},e.prototype.updateDimension=function(){var t=this.viewer.renderContext;this.configTextStyle(t),this.configTextLayout(t);var e=this.getFontDesc();this.fontProperties=wa.measureFont(e),0===this.fontProperties.fontSize&&(this.fontProperties.fontSize=this.fontSize,this.fontProperties.ascent=this.fontSize);var r=this.createCharsFromText(t,this.text),i=0;if(r.length>0){var n=r[r.length-1];i=n.left+n.width}this.chars=r,this.maxLineWidth=i,void 0===this.height&&(this.height=this.fontProperties.fontSize),void 0===this.width&&(this.width=this.maxLineWidth)},e.prototype.configTextStyle=function(t){t.font=this.getFontDesc(),t.fillStyle=this.color},e.prototype.getFontDesc=function(){for(var t="number"==typeof this.fontSize?"".concat(this.fontSize,"px"):this.fontSize,e=this.fontFamily.split(","),r=e.length-1;r>=0;r--){var i=e[r].trim();/([\"\'])[^\'\"]+\1/.test(i)||Oa.includes(i)||(i='"'.concat(i,'"')),e[r]=i}return e.push("Arial, Helvetica, sans-serif"),"".concat(this.fontStyle," ").concat(this.fontVariant," ").concat(this.fontWeight," ").concat(t," ").concat(e.join(","))},e.prototype.configTextLayout=function(t){t.textBaseline=this.textBaseline,t.textAlign=this.textAlign},e.prototype.setRenderTransform=function(t){t.scale(this.scaleX,this.scaleY),t.translate(this.left,this.top)},e.prototype.renderText=function(t){this.drawCharsInTextBox(t,{min:[0,0],max:[0+this.width,0+this.height]})},e.prototype.drawCharsInTextBox=function(e,r){var i=this.chars,n=0;if(i.length>0){var o=i[i.length-1];n=o.left+o.width}var a=r.max[0]-r.min[0],s=0;"left"===this.textAlign?s=0:"center"===this.textAlign?s=.5*(a-n):"right"===this.textAlign&&(s=a-n),this.addOffsetToChars(i,s);var u=this.cloneChars(this.clipCharsWithTextBox(i,r)),c=u;this.wrap===t.QTextWrapMode.Ellipsis&&0===(c=this.replaceCharWithEllipsis(e,u,r)).length&&0!==i.length&&this.addEllipsisToChars(e,c,r),this.drawCharsFromLeft(e,c)},e.prototype.addEllipsisToChars=function(t,e,r){var i,n,o,a=t.measureText(this.ellipsis).width;if("left"===this.textAlign)e.push({char:this.ellipsis,left:r.min[0],top:0,width:a,heigh:null!==(i=this.height)&&void 0!==i?i:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else if("right"===this.textAlign)e.push({char:this.ellipsis,left:r.max[0]-a,top:0,width:a,heigh:null!==(n=this.height)&&void 0!==n?n:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else{var s=.5*(r.max[0]+r.min[0]);e.push({char:this.ellipsis,left:s-.5*a,top:0,width:a,heigh:null!==(o=this.height)&&void 0!==o?o:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0})}},e.prototype.createCharsFromText=function(t,e){var r=e.split(""),i=0,n=0;"top"===this.textBaseline?n=0:"middle"===this.textBaseline?n+=.5*this.fontProperties.ascent:"alphabetic"===this.textBaseline&&(n+=this.fontProperties.ascent);for(var o=[],a=0;a<r.length;++a){var s=r[a],u=Math.floor(t.measureText(s).width),c={left:i,top:n,width:u,heigh:this.fontSize,char:s,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!1,scale:1,index:a};o.push(c),i+=u+this.letterSpacing}return o},e.prototype.addOffsetToChars=function(t,e){return t.forEach((function(t){t.left+=e})),t},e.prototype.clipCharsWithTextBox=function(t,e){for(var r=[],i=0;i<t.length;++i){var n=t[i];n.left>=e.min[0]&&n.left+n.width<e.max[0]+.5&&r.push(n)}return r},e.prototype.cloneChars=function(t){return t.map((function(t){return a({},t)}))},e.prototype.replaceCharWithEllipsis=function(t,e,r){var i=t.measureText(this.ellipsis).width;if(e.length>0){if(0!==e[0].index)(n=a({},e[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,e=this.findEllipsisPositionAndReplaceCharsFromLeft(e,n,r);var n,o=e.length-1,s=this.chars.length;if(e[o].index!==s-1)(n=a({},e[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,e=this.findEllipsisPositionAndReplaceCharsFromRight(e,n,r)}return e},e.prototype.findEllipsisPositionAndReplaceCharsFromLeft=function(t,e,r){for(var i=0,n=0;n<t.length;++n){var o=t[n];if(i=n,o.left+o.width-e.width>=r.min[0])break}var a=t[i];e.left=a.left+a.width-e.width;for(n=0;n<i+1;++n)t.shift();return[e].concat(t)},e.prototype.findEllipsisPositionAndReplaceCharsFromRight=function(t,e,r){for(var i=t.length-1,n=i;n>=0;--n){if(i=n,t[n].left+e.width<=r.max[0])break}e.left=t[i].left;for(n=t.length-1;n>=i;--n)t.pop();return t.concat([e])},e.prototype.drawCharsFromLeft=function(t,e){var r=t.textAlign||"left";t.textAlign="left";for(var i=0;i<e.length;++i){var n=e[i];t.fillText(n.char,n.left,n.top)}t.textAlign=r},e.prototype.drawBorders=function(t){this.padding;var e=this.borderWidth;t.strokeStyle=this.borderColor,t.lineWidth=e;var r=this.width,i=this.height,n=0,o=0;"center"===this.originX?n-=this.width/2:"right"===this.originX&&(n-=this.width),"center"===this.originY?o-=this.height/2:"bottom"===this.originY&&(o-=this.height),t.strokeRect(n+e/2,o+e/2,r-e,i-e)},e}(),La=function(){function t(t,e,r,i,n,o){var a;this.textList=[],a="string"==typeof t?document.getElementById(t):t,this.scaleX=null!=i?i:1,this.scaleY=null!=n?n:1,this.flipY=null!=o&&o,this.width=e,this.height=r,a.style.width="".concat(e*this.scaleX,"px"),a.style.height="".concat(r*this.scaleY,"px");this.devicePixelRatio=1,a.width=1*e*this.scaleX,a.height=1*r*this.scaleY,a.className="lower-canvas",this.renderCanvas=a,this.renderContext=this.renderCanvas.getContext("2d"),this.renderContext.scale(1*this.scaleX,1*this.scaleY)}return t.prototype.initDimension=function(t,e,r,i){this.width=t,this.height=e,this.scaleX=null!=r?r:1,this.scaleY=null!=i?i:1,this.renderCanvas.style.width="".concat(t*this.scaleX,"px"),this.renderCanvas.style.height="".concat(e*this.scaleY,"px");var n=this.devicePixelRatio;this.renderCanvas.width=n*t*this.scaleX,this.renderCanvas.height=n*e*this.scaleY,this.flipY&&(this.renderContext.translate(0,this.height),this.renderContext.scale(1,-1)),this.renderContext.scale(n*this.scaleX,n*this.scaleY)},t.prototype.clearText=function(){this.textList=[]},t.prototype.clearCanvasWithContext=function(t){t.clearRect(0,0,this.width,this.height)},t.prototype.clearCanvas=function(){this.clearCanvasWithContext(this.renderContext)},t.prototype.addObject=function(t){t.init(this),this.textList.push(t)},t.prototype.render=function(){this.clearCanvasWithContext(this.renderContext),this.renderContext.fillStyle="rgba(255, 255, 255, 0.0039)",this.renderContext.fillRect(0,0,this.width,this.height);var t=this.background;t&&void 0!==t.width&&void 0!==t.height&&this.renderContext.drawImage(t,0,0,t.width,t.height,0,0,this.width,this.height);for(var e=0;e<this.textList.length;++e){this.renderContext.save();var r=this.textList[e];r.update(),r.render(),this.renderContext.restore()}},t}();function Ia(t,e){return e=e||{},new Promise((function(r,i){var n=new XMLHttpRequest;n.responseType=(null==e?void 0:e.responseType)||"json",n.addEventListener("load",(function(){return r(n.response)})),n.addEventListener("error",(function(){return i(Error("load ".concat(t," fail")))})),n.open((null==e?void 0:e.method)||"get",t),n.send(null==e?void 0:e.data)}))}function Pa(t,e,r,i,n){return s(this,void 0,void 0,(function(){var o,a,s,c,l,h,f,p,d,m;return u(this,(function(u){switch(u.label){case 0:return o={},a=[],i=i||{},r=r||{},e.asImage?(s=e.content.replace(/\$/g,""),c=r[s]||e.variables[s],l=function(t){var r=(null==i?void 0:i.canvas)||document.createElement("canvas"),o=r.width=e.backgroundWidth,a=r.height=e.backgroundHeight,s=r.getContext("2d");return null==s||s.clearRect(0,0,o,a),n&&(null==s||s.translate(0,a),null==s||s.scale(1,-1)),null==s||s.drawImage(t,0,0,t.width,t.height,0,0,o,a),r},c?[2,Yr(c).then(l)]:[2,Va(t).then(l)]):(h=i.templateScale||1,Object.keys(e.variables).forEach((function(t){var i=e.variables[t];if(r.hasOwnProperty(t)&&(i=r[t]),/^image_/.test(t)){var n=i instanceof Array,s=n?i[0]:i;a.push(function(t,e){return r(t,(function(i){return e?r(e,(function(){return t})):t}));function r(t,e){return/^(https?:)?\/\//.test(t)?Ia(t,{responseType:"blob"}).then(Fa,e):Promise.resolve(t)}}(s,n&&i[1]).then((function(e){return o[t]=e})))}else o[t]=i})),[4,Promise.all(a)]);case 1:return u.sent(),[4,Yr(t)];case 2:return f=u.sent(),p=e.content.replace(/\$([\w_]+)\$/g,(function(t,e){return o[e]})).replace('width="'.concat(e.width,'px"'),'width="'.concat(e.width*h,'px"')).replace('height="'.concat(e.height,'px"'),'height="'.concat(e.height*h,'px"')),[4,Yr("data:image/svg+xml,".concat(encodeURIComponent(p)))];case 3:return d=u.sent(),(m=(null==i?void 0:i.canvas)||document.createElement("canvas")).width=f.width*h,m.height=f.height*h,[2,new Promise((function(t,r){var i=m.getContext("2d");i.clearRect(0,0,m.width,m.height),n&&(i.translate(0,m.height),i.scale(1,-1)),i.drawImage(f,0,0,f.width,f.height,0,0,m.width,m.height),i.drawImage(d,0,0,d.width,d.height,(e.x||0)*h,(e.y||0)*h,e.width*h/e.backgroundWidth*f.width,e.height*h/e.backgroundHeight*f.height),t(m)}))]}}))}))}function Va(t){return rr(t)?Yr(t):Promise.resolve(t)}function Fa(t){return new Promise((function(e,r){var i=new FileReader;i.readAsDataURL(t),i.onload=function(){e(i.result)},i.onerror=r}))}var Na=["serif","sans-serif","monospace","courier"],za=800,Da=600,Ua=new Map,Ba=new(function(){function t(){this.elements=[]}return t.prototype.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements=[]},t.prototype.getCanvas=function(){if(this.elements.length)return this.elements.shift();if(wi(Ai))return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},t.prototype.saveCanvas=function(t){t.width=t.height=1,this.elements.length<3?G(this.elements,t):t.remove()},t}());function ka(t,e){var r,i,n;if(null===(r=null==t?void 0:t.background)||void 0===r?void 0:r.name){var o=t.background.name;e&&e[o]?n=e[o]:(null===(i=t.background)||void 0===i?void 0:i.url)&&(n=t.background.url)}return n}function Ga(t,e){return s(this,void 0,void 0,(function(){return u(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)]}}))}))}function Xa(e,r,i,n,o){var c;return s(this,void 0,void 0,(function(){var s,l,h,f,p,d,m,v,y,x,g;return u(this,(function(u){switch(u.label){case 0:if(!r)throw Error("image not provided");return s=(null==o?void 0:o.templateScale)||1,l=s,h=s,f=r,p=r.width,d=r.height,i?(p=i.width,d=i.height,r.width===p&&r.height===d||(l*=r.width/i.width,h*=r.height/i.height),(m=ka(i,n))&&m!==r.src?rr(m)?[4,Yr(m)]:[3,2]:[3,4]):[3,5];case 1:return v=u.sent(),[3,3];case 2:v=m,u.label=3;case 3:f=v,u.label=4;case 4:(y=i.content)&&(x=function(e,r,i){var n=e.fonts,o=[];return e.texts.forEach((function(a){var s,u=a.t,c=a.x,l=a.y,h={weight:400,family:"serif",size:48,style:bt.normal};void 0!==a.f&&(h=n[a.f]);var f=a.n;f&&r&&r.hasOwnProperty(f)&&(u="".concat(r[f]));var p=new Ma(u,{left:c,top:l,fontSize:h.size,fontFamily:h.family,fontWeight:"".concat(h.weight),fontStyle:"normal",name:f});if(void 0!==a.r&&(p.angle=a.r*Math.PI/180),p.active=null!==(s=null==i?void 0:i.debug)&&void 0!==s&&s,void 0!==a.w&&(p.width=a.w),void 0!==h.letterSpace&&(p.letterSpacing=h.letterSpace),a.of===gt.display?p.wrap=t.QTextWrapMode.Default:a.of===gt.clip?p.wrap=t.QTextWrapMode.Clip:a.of===gt.ellipsis&&(p.wrap=t.QTextWrapMode.Ellipsis),void 0!==a.c){var d=e.colors[a.c][1],m=1;void 0!==d[3]&&(m=d[3]/255),p.color="rgba(".concat(d[0],", ").concat(d[1],", ").concat(d[2],", ").concat(m,")")}a.a===Et.left?p.textAlign="left":a.a===Et.middle?p.textAlign="center":a.a===Et.right&&(p.textAlign="right"),h.style===bt.normal?p.fontStyle="normal":h.style===bt.italic?p.fontStyle="italic":h.style===bt.oblique&&(p.fontStyle="oblique"),void 0!==h.weight&&(p.fontWeight=String(h.weight)),(null==i?void 0:i.borderColor)&&(p.borderColor=i.borderColor),void 0!==(null==i?void 0:i.borderWidth)&&(p.borderWidth=i.borderWidth),o.push(p)})),o}(y,n,a(a({},o),{scaleX:l,scaleY:h})),x.forEach((function(t){e.addObject(t)}))),u.label=5;case 5:return e.flipY=null!==(c=null==o?void 0:o.flipY)&&void 0!==c&&c,e.initDimension(p,d,l,h),e.background=f,e.render(),(g=null==o?void 0:o.textLayouts)&&(g.length=0,e.textList.forEach((function(t){var e=t.getLayout(),r={x:e.x,y:e.y,width:e.width,height:e.height};g.push(r)}))),[2]}}))}))}function Ha(t){return s(this,void 0,void 0,(function(){var e,r,i;return u(this,(function(n){switch(n.label){case 0:if(!t.content||!t.content.fonts)return[3,4];e=t.content.fonts,r=function(t){var r,i,n,o,a;return u(this,(function(s){switch(s.label){case 0:return r=e[t].family,i=e[t].url,n=!1,Na.includes(r)?n=!0:void 0!==document.fonts&&document.fonts.forEach((function(t){t.family===r&&(n=!0)})),n||void 0===i||""===i?[3,2]:(o="url(".concat(i,")"),void 0===document.fonts?[3,2]:[4,(a=new FontFace("".concat(r),o)).load()]);case 1:s.sent(),document.fonts.add(a),s.label=2;case 2:return[2]}}))},i=0,n.label=1;case 1:return i<e.length?[5,r(i)]:[3,4];case 2:n.sent(),n.label=3;case 3:return++i,[3,1];case 4:return[2]}}))}))}function Ya(t,e,r,i,n){return s(this,void 0,void 0,(function(){var o,s,c;return u(this,(function(u){switch(u.label){case 0:return o=a(a({},i),{flipY:n}),s=function(t,e,r){var i,n=(null==r?void 0:r.templateScale)||1,o=(null==r?void 0:r.flipY)||!1;if(null==r?void 0:r.canvas){if(!(i=Ua.get(r.canvas))){var a=new La(r.canvas,t,e,n,n,o);Ua.set(r.canvas,a),i=a}}else{var s=Ba.getCanvas();i=new La(s,za,Da,n,n,o)}return i}(za,za,o),void 0===e?[3,2]:[4,Ha(e)];case 1:u.sent(),u.label=2;case 2:return s.clearText(),"string"!=typeof t?[3,5]:[4,Yr(t)];case 3:return c=u.sent(),[4,Xa(s,c,e,r,o)];case 4:return u.sent(),[2,s.renderCanvas];case 5:return[4,Xa(s,t,e,r,o)];case 6:return u.sent(),[2,s.renderCanvas]}}))}))}function ja(t,e,r,i,n){return s(this,void 0,void 0,(function(){return u(this,(function(o){return 2===e.v?[2,Ya(t,e,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,Pa(t,e,r,i,n)]}))}))}var Wa=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=void 0===e?100:e,i=t.textWidth,n=void 0===i?100:i,o=t.textOverflow,a=void 0===o?gt.display:o,s=t.textBaseline,u=void 0===s?Tt.top:s,c=t.textAlign,l=void 0===c?Et.left:c,h=t.text,f=t.letterSpace,p=void 0===f?0:f,d=t.autoWidth,m=void 0!==d&&d,v=t.fontSize,y=t.lineHeight,x=void 0===y?v:y,g=v+p;this.autoWidth=m,this.maxTextWidth=h.length*g,this.width=n,this.height=r,this.letterSpace=p,this.overFlow=a,this.textBaseline=u,this.textAlign=l,this.lineHeight=x}return t.prototype.getOffsetY=function(t,e,r,i){var n=0,o=t.outlineWidth,a=t.fontScale,s=(r-i)/3,u=i+o*a,c=r*(e-1);switch(this.textBaseline){case Tt.top:n=u+s;break;case Tt.middle:n=(this.height*a-c+u)/2;break;case Tt.bottom:n=this.height*a-c-s}return n},t.prototype.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case Et.left:r=t.outlineWidth*t.fontScale;break;case Et.middle:r=(this.width*t.fontScale-e)/2;break;case Et.right:r=this.width*t.fontScale-e}return r},t.prototype.setSize=function(t,e){this.width=t,this.height=e},t}(),Za=function(t){function e(e,r,i){var n=t.call(this,e,r,i)||this;n.isDirty=!0,n.lineCount=0;var o=e.options;return n.canvas=Ba.getCanvas(),Ba.saveCanvas(n.canvas),n.context=n.canvas.getContext("2d",{willReadFrequently:!0}),n.engine=i.composition.getEngine(),n.textStyle=new Ca(o),n.textLayout=new Wa(o),n.text=o.text.toString(),n.lineCount=n.getLineCount(o.text,!0),n.mesh=new Aa(n.engine,n.renderInfo,i.composition),n}return o(e,t),e.prototype.getLineCount=function(t,e){for(var r,i,n=this.context,o=this.textLayout.letterSpace,a=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,s=this.textLayout.width+this.textStyle.fontOffset,u=1,c=0,l=0;l<t.length;l++){var h=t[l],f=(null!==(i=null===(r=null==n?void 0:n.measureText(h))||void 0===r?void 0:r.width)&&void 0!==i?i:0)*a;((c+=o)+f>s&&l>0||"\n"===h)&&(u++,c=0),"\n"!==h&&(c+=f)}return u},e.prototype.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.prototype.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.prototype.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.prototype.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.prototype.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.prototype.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.prototype.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.prototype.setFontFamily=function(t){this.textStyle.fontFamily!==t||ot(t)?(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("The font is either the current font or an risky font family.")},e.prototype.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.prototype.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.prototype.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.prototype.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.prototype.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.prototype.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.prototype.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.prototype.updateTexture=function(){var t;if(this.isDirty&&this.context&&this.canvas){var e=this.context,r=this.textStyle,i=this.textLayout,n=r.fontScale,o=(i.width+r.fontOffset)*n,a=i.height*n,s=r.fontSize*n,u=i.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=o,this.canvas.height=a,e.clearRect(0,0,o,this.canvas.height),e.fillStyle="rgba(255, 255, 255, 0.0039)",e.fillRect(0,0,o,this.canvas.height),r.fontDesc=this.getFontDesc(),e.font=r.fontDesc,r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),e.fillStyle="rgba(".concat(r.textColor[0],", ").concat(r.textColor[1],", ").concat(r.textColor[2],", ").concat(r.textColor[3],")");for(var c=[],l=0,h=i.getOffsetY(r,this.lineCount,u,s),f=[],p=[],d=0;d<this.char.length;d++){var m=this.char[d],v=e.measureText(m);((l+=i.letterSpace*n)+v.width>o&&d>0||"\n"===m)&&(c.push({y:h,width:l,chars:f,charOffsetX:p}),l=0,h+=u,f=[],p=[]),"\n"!==m&&(f.push(m),p.push(l),l+=v.width)}c.push({y:h,width:l,chars:f,charOffsetX:p}),c.forEach((function(t){var n=i.getOffsetX(r,t.width);t.chars.forEach((function(i,o){r.isOutlined&&e.strokeText(i,n+t.charOffsetX[o],t.y),e.fillText(i,n+t.charOffsetX[o],t.y)}))})),r.hasShadow&&(e.shadowColor="transparent");var y=e.getImageData(0,0,this.canvas.width,this.canvas.height);null===(t=this.mesh)||void 0===t||t.mesh.material.setTexture("uSampler0",Kr.createWithData(this.engine,{data:new Uint8Array(y.data),width:y.width,height:y.height},{flipY:!0,magFilter:E.LINEAR,minFilter:E.LINEAR,wrapS:E.CLAMP_TO_EDGE,wrapT:E.CLAMP_TO_EDGE})),this.isDirty=!1}},e.prototype.getFontDesc=function(){var t=this.textStyle,e="".concat((t.fontSize*t.fontScale).toString(),"px ");return Na.includes(t.fontFamily)?e+=t.fontFamily:e+='"'.concat(t.fontFamily,'"'),t.textWeight!==St.normal&&(e="".concat(t.textWeight," ").concat(e)),t.fontStyle!==bt.normal&&(e="".concat(t.fontStyle," ").concat(e)),e},e.prototype.setupOutline=function(){var t=this.context,e=this.textStyle;t.strokeStyle="rgba(".concat(255*e.outlineColor[0],", ").concat(255*e.outlineColor[1],", ").concat(255*e.outlineColor[2],", ").concat(e.outlineColor[3],")"),t.lineWidth=2*e.outlineWidth},e.prototype.setupShadow=function(){var t=this.context,e=this.textStyle;t.shadowColor="rgba(".concat(255*e.shadowColor[0],", ").concat(255*e.shadowColor[1],", ").concat(255*e.shadowColor[2],", ").concat(e.shadowColor[3],")"),t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=-e.shadowOffsetY},e}(qn),qa=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return o(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return P.text},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){this.textContext=t.content},r.prototype.onLifetimeBegin=function(t,e){var r,i;e.active=!0,null===(i=null===(r=this.content)||void 0===r?void 0:r.mesh)||void 0===i||i.setItems([this.content]),this.content.updateTexture()},r.prototype.onItemRemoved=function(t,e){e&&(delete e.mesh,t.destroyTextures(e.getTextures()))},r.prototype.onItemUpdate=function(t,e){var r;this.content&&(null===(r=this.content)||void 0===r||r.updateTime(this.time))},r.prototype.getCurrentPosition=function(){var t=new Vt;return this.transform.assignWorldTRS(t),t},r.prototype.getBoundingBox=function(){var e=this.content;if(e&&this.transform){var r=this.transform.getWorldMatrix(),i=e.startSize,n=fe(Vt.ZERO,i.x/2,i.y/2);return n.forEach((function(t){r.transformPoint(t.p0),r.transformPoint(t.p1),r.transformPoint(t.p2)})),{type:t.HitTestType.triangle,area:n}}},r.prototype.getHitTestParams=function(t){var e,r,i=this.content,n=i&&i.interaction;if((t||n)&&(null===(e=i.mesh)||void 0===e?void 0:e.mesh)&&i){var o=this.getBoundingBox();if(o)return{behavior:(null===(r=i.interaction)||void 0===r?void 0:r.behavior)||0,type:o.type,triangles:o.area,backfaceCulling:i.renderer.side===C.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(t){var e=t.getRendererOptions().emptyTexture;return new Za(this.textContext,{emptyTexture:e},this)},r.prototype.createWireframeMesh=function(t,e){var r=new Aa(this.composition.getEngine(),a({wireframe:!0},t.renderInfo),this.composition);return r.mesh.setVisible(!0),r.setItems([t]),r.mesh.material.setVector3("uFrameColor",Vt.fromArray(e)),r.mesh.priority=999,r},r}(fr),Qa=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="text",t.addItems=[],t.removeItems=[],t.meshes=[],t}return o(r,e),r.prototype.onCompositionDestroyed=function(e){e.reusable?this.addItems.forEach((function(e){var r;null===(r=e.content.mesh)||void 0===r||r.mesh.dispose({material:{textures:t.DestroyOptions.keep}})})):this.addItems.forEach((function(t){var e;null===(e=t.content.mesh)||void 0===e||e.mesh.dispose()}))},r.prototype.onCompositionUpdate=function(t,e){this.addItems.forEach((function(t){var e=t.content.mesh;t.contentVisible?(null==e||e.mesh.setVisible(!0),t.content.updateTexture(),t.content.ended||!e||e.mesh.isDestroyed||(e.updateItem(t.content),e.applyChange())):null==e||e.mesh.setVisible(!1)}))},r.prototype.onCompositionItemLifeBegin=function(t,e){var r;e instanceof qa&&e.content&&(this.addItems.includes(e)||(G(this.addItems,e),!e.content.ended&&e.content.mesh&&e.content.mesh.updateItem(e.content),null===(r=e.content.mesh)||void 0===r||r.applyChange()))},r.prototype.onCompositionReset=function(t,e){},r.prototype.onCompositionItemRemoved=function(e,r){var i;r instanceof qa&&r&&(G(this.removeItems,r),this.addItems.includes(r)&&(null===(i=r.content)||void 0===i?void 0:i.mesh)&&(X(this.addItems,r),r.content.mesh.mesh.dispose({material:{textures:t.DestroyOptions.keep}}),r.dispose()))},r.prototype.prepareRenderFrame=function(e,r){var i=this;return this.removeItems.map((function(e){var n,o;(null===(n=e.content)||void 0===n?void 0:n.mesh)&&(r.removeMeshFromDefaultRenderPass(null===(o=e.content.mesh)||void 0===o?void 0:o.mesh),X(i.addItems,e),e.content.mesh.mesh.dispose({material:{textures:t.DestroyOptions.keep}}),e.dispose())})),this.addItems.forEach((function(t){var e;t.content.mesh&&r.addMeshToDefaultRenderPass(null===(e=t.content.mesh)||void 0===e?void 0:e.mesh)})),this.removeItems.length=0,!1},r}(Er);function Ka(t,e,r){return function(t,e,r){var i=a(a({},e.material.props),{shader:r}),n=e.material.clone(i);return n.blending=!1,n.depthTest=!1,n.culling=!1,Ii.create(t,{geometry:e.geometry,material:n})}(t,e,Fn(t.gpuCapability.level,{fragment:r.fragment},{ignoreBlend:!0}))}var Ja=function(e){function r(t,r,i,n,o,a){var s=e.call(this,t,a)||this;return s.uTexStep=i,s.pluginSystem=n,s.fragShader=o,s.type=r,s}return o(r,e),r.prototype.configure=function(e){if(this.prePassTexture=e.getFrameBuffer().getColorTextures()[0]?e.getFrameBuffer().getColorTextures()[0]:e.renderingData.currentFrame.transparentTexture,"H"===this.type&&(this.preDefaultPassAttachment.texture=this.prePassTexture),this.preDefaultPassTexture=this.preDefaultPassAttachment.texture,!this.mframeBuffer){var r=Kr.create(e.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:E.LINEAR,magFilter:E.LINEAR,name:this.type,internalFormat:E.RGBA,format:E.RGBA,type:E.UNSIGNED_BYTE});this.mframeBuffer=Rn.create({name:this.type,storeAction:{},viewport:this.viewport,viewportScale:1,isCustomViewport:!0,attachments:[r],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},e)}e.setFrameBuffer(this.mframeBuffer)},r.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",pn(this.preDefaultPassTexture)),this.meshes[1].material.setVector2("uTexStep",this.uTexStep),this.meshes[1].material.setTexture("uBlurSource",this.uBlurSource?this.uBlurSource:this.prePassTexture),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",pn(this.prePassTexture));var e=[this.meshes[0],Ka(t.engine,this.meshes[1],{fragment:this.fragShader})];t.renderMeshes(e)},r.prototype.dispose=function(t){e.prototype.dispose.call(this,t);var r=this.mframeBuffer;r&&r.dispose(t)},r}(zi),$a=function(t){function e(e,r,i){var n=t.call(this,e,r)||this;return i&&(n.preDefaultPassAttachment=i),n}return o(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],this.preDefaultPassAttachment||(this.preDefaultPassAttachment=new Fi(t.engine,{}),this.preDefaultPassAttachment.texture=this.prePassTexture),t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassAttachment.texture),this.meshes[0].material.setVector2("uFilterSourceSize",pn(this.preDefaultPassAttachment.texture)),this.meshes[1].material.setTexture("uFrameSource",this.prePassTexture),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uFilterSourceSize",pn(this.prePassTexture));var e=[this.meshes[0],this.meshes[1]];t.renderMeshes(e)},e}(zi);function ts(t){for(var e=t.radius<=3?1:2,r=t.radius/e,i=t.maxStep||4;r>10&&e<i;)e*=2,r=t.radius/e;for(var n=1+t.radius%e/e/e,o=function(t){for(var e=(t+1)/3.329,r=[],i=-t;i<=t;i++)r.push(es(i,e));return r}(r=Math.floor(r)),a=[],s=-r;s<=r;s++){var u=o[s+r];a.push("color += texture2D(uBlurSource,getTexCoord(".concat(s.toFixed(1),")) * ").concat(u,";"))}return{shader:"\n uniform sampler2D uBlurSource;\n uniform vec2 uTexSize;\n uniform vec2 uTexStep;\n #define getTexCoord(i) coord + uTexStep/uTexSize * i\n vec4 filterMain(vec2 coord,sampler2D tex){\n vec4 color = vec4(0.);\n vec2 texCoord;\n ".concat(a.join("\n"),"\n\n return color;\n }\n "),step:n,downSample:e,radius:r}}function es(t,e){return Math.exp(-t*t/(2*e*e))/Math.sqrt(2*Math.PI)/e}var rs=function(t){function e(e,r){return t.call(this,e,r)||this}return o(e,t),e.prototype.configure=function(t){var e=t.getFrameBuffer();this.preDefaultPassAttachment.texture=e?e.getColorTextures()[0]:t.renderingData.currentFrame.transparentTexture,t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uTexSize",pn(this.preDefaultPassAttachment.texture));var e=[Ka(t.engine,this.meshes[1],{fragment:this.fragShader})];t.renderMeshes(e)},e}(zi),is=function(t){function e(e,r,i,n,o,a,s){var u=t.call(this,e,a)||this;return u.uTexStep=i,u.pluginSystem=n,u.fragShader=o,u.type=r,s&&(u.uBlurSource=s),u}return o(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],this.preDefaultPassTexture=this.preDefaultPassAttachment.texture,t.setFrameBuffer(this.frameBuffer),this.uBlurSource||(this.uBlurSource=this.prePassTexture)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[1].material.setVector2("uTexStep",this.uTexStep),this.meshes[1].material.setTexture("uBlurSource",this.uBlurSource),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",pn(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",pn(this.uBlurSource));var e=[Ka(t.engine,this.meshes[1],{fragment:this.fragShader})];t.renderMeshes(e)},e}(zi),ns=function(t){function e(e,r,i){var n=t.call(this,e,r)||this;return n.preDefaultPassAttachment=i,n}return o(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassAttachment.texture),this.meshes[0].material.setVector2("uFilterSourceSize",pn(this.preDefaultPassAttachment.texture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uFilterSourceSize",pn(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",pn(this.preDefaultPassAttachment.texture));var e=[this.meshes[0],this.meshes[1]];t.renderMeshes(e)},e}(zi),os=function(t){function e(e,r){return t.call(this,e,r)||this}return o(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",pn(this.prePassTexture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.prePassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",pn(this.prePassTexture));var e=[this.meshes[0],this.meshes[1]];t.renderMeshes(e)},e}(zi);function as(t,e,r){for(var i=ke(e||1),n=e?256:1,o=new Uint8Array(n),a=0;a<n;a++){var s=a/(n-1);o[a]=Math.round(255*i.getValue(r?1-s:s))}return Kr.createWithData(t,{width:n,height:1,data:o},{format:E.LUMINANCE})}var ss=new Vt(1,1,1),us=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=Dt.fromIdentity(),this.projectionMatrix=Dt.fromIdentity(),this.viewProjectionMatrix=Dt.fromIdentity(),this.inverseViewMatrix=Dt.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,o=void 0===n?20:n,a=e.fov,s=void 0===a?60:a,u=e.aspect,c=void 0===u?1:u,l=e.clipMode,h=void 0===l?at.portrait:l,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d;this.options={near:i,far:o,fov:s,aspect:c,clipMode:h,position:Vt.fromArray(p),rotation:kt.fromArray(m)},this.dirty=!0,this.updateMatrix()}return Object.defineProperty(t.prototype,"near",{get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"far",{get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fov",{get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspect",{get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipMode",{get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.options.rotation.clone()},set:function(t){this.options.rotation.equals(t)||(this.options.rotation.copyFrom(t),this.dirty=!0,this.options.quat=void 0)},enumerable:!1,configurable:!0}),t.prototype.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},t.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},t.prototype.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},t.prototype.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null===(t=this.inverseProjectionMatrix)||void 0===t?void 0:t.clone()},t.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},t.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},t.prototype.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},t.prototype.getInverseVPRatio=function(t){var e=new Vt(this.position.x,this.position.y,t),r=this.getViewProjectionMatrix(),i=this.getInverseViewProjectionMatrix(),n=r.projectPoint(e).z,o=i.projectPoint(new Vt(1,1,n)),a=o.x,s=o.y,u=i.projectPoint(new Vt(-1,-1,n)),c=u.x,l=u.y;return new Vt((a-c)/2,(s-l)/2,0)},t.prototype.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0),this.dirty&&this.setRotationByQuat(t)},t.prototype.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new Ft;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},t.prototype.getOptions=function(){return this.options},t.prototype.copy=function(t){var e=t.near,r=t.far,i=t.fov,n=t.clipMode,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=r,this.fov=i,this.clipMode=n,this.aspect=o,this.position=a,this.rotation=s,this.updateMatrix()},t.prototype.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,r=t.aspect,i=t.near,n=t.far,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*At,r,i,n,o===at.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),ss),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},t.prototype.setRotationByQuat=function(t){hr.getRotation(t,this.options.rotation)},t}();var cs,ls,hs,fs,ps,ds,ms,vs,ys,xs,gs,Ts={lum:[function(e,r){var i=r.renderer,n=2===i.engine.gpuCapability.level?E.LINEAR:E.NEAREST,o=new $a(i,{name:"lumCopyPass",attachments:[{texture:{format:E.RGBA,minFilter:n,magFilter:n}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{mesh:{fragment:li,uniformValues:{uFilterParams:[1,0,0,0]},materialStates:{blending:!1,depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:E.RGBA}}]},prePasses:[o],renderPassDelegate:{}}},function(){return[{fragment:li}]}],alphaFrame:[function(e,r){var i=e,n=i.colorRange,o=void 0===n?[.5,1]:n,a=i.alphaRange,s=void 0===a?[0,.5]:a,u=[s[0],s[1]-s[0],o[0],o[1]-o[0]],c=r.renderer,l=2===c.engine.gpuCapability.level?E.LINEAR:E.NEAREST,h=new $a(c,{name:"alphaFrameCopyPass",attachments:[{texture:{format:E.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{particle:{fragment:Hi,uniformValues:{uTexRange:u}},mesh:{fragment:Hi,shaderCacheId:"alpha-frame",materialStates:{blending:!1},uniformValues:{uTexRange:u}},passSplitOptions:{attachments:[{texture:{format:E.RGBA}}],prePasses:[h]}}},function(){return[{fragment:Hi,shaderCacheId:"alpha-frame"},{fragment:Hi,isParticle:!0}]}],cameraMove:[function(e,r){var i=e.position,n=void 0===i?[0,0,0]:i,o=n;Number.isFinite(n[0])&&Number.isFinite(n[1])&&(o=[ct.CONSTANT_VEC3,n]);var a=ke(o),s=new us("camera_move"),u=new Vt,c=r.renderer,l=2===c.engine.gpuCapability.level?E.LINEAR:E.NEAREST,h=new $a(c,{name:"cameraCopyPass",attachments:[{texture:{format:E.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{mesh:{vertex:ji,fragment:li,shaderCacheId:"camera-move",materialStates:{blending:!1,depthTest:!1,culling:!1},variables:{uMoveCameraViewPro:function(t){s.copy(r.camera);var e=a.getValue(t);return u.addVectors(r.camera.position,new Vt(-e[0],-e[1],-e[2])),s.position=u,s.getViewProjectionMatrix().toArray()}}},passSplitOptions:{attachments:[{texture:{format:E.RGBA}}],prePasses:[h]}}},function(){return[{vertex:ji,fragment:li,shaderCacheId:"camera-move"}]}],alphaMask:[function(e,r){var i=e,n=i.xOpacity,o=i.yOpacity,a=r.renderer.engine,s=r.renderer,u=as(a,n),c=as(a,o,!0),l=2===a.gpuCapability.level?E.LINEAR:E.NEAREST,h=new $a(s,{name:"alphaMaskCopyPass",attachments:[{texture:{format:E.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{mesh:{fragment:Yi,shaderCacheId:"alpha-mask",materialStates:{blending:!1,depthTest:!1,culling:!1},uniformValues:{uAlphaXSample:u,uAlphaYSample:c}},passSplitOptions:{attachments:[{texture:{format:E.RGBA}}],prePasses:[h]}}},function(){return[{fragment:Yi,shaderCacheId:"alpha-mask"}]}],distortion:[function(e,r){var i=e,n=i.center,o=void 0===n?[.5,.5]:n,a=i.direction,s=void 0===a?[1,0]:a,u=i.period,c=i.waveMovement,l=i.strength,h=ae(s),f=[o[0],o[1],h[0],h[1]],p=ke(u),d=ke(c),m=ke(l),v=2*Math.PI,y=r.renderer,x=2===y.engine.gpuCapability.level?E.LINEAR:E.NEAREST,g=new $a(y,{name:"distortionCopyPass",attachments:[{texture:{format:E.RGBA,minFilter:x,magFilter:x}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{particle:{fragment:Zi,vertex:qi,uniforms:{uPeriodValue:p,uMovementValue:d,uStrengthValue:m},uniformValues:{uWaveParams:f}},mesh:{shaderCacheId:"distortion",fragment:Zi,materialStates:{blending:!1,culling:!1},variables:{vWaveParams:function(t){return[p.getValue(t)*v,d.getValue(t)*v,m.getValue(t),0]}},uniformValues:{uWaveParams:f}},passSplitOptions:{attachments:[{texture:{format:E.RGBA}}],prePasses:[g]}}},function(t){var e=t,r=e.period,i=e.waveMovement,n=e.strength;return[{fragment:Zi,shaderCacheId:"distortion"},{fragment:Zi,vertex:qi,isParticle:!0,uniforms:[r,i,n]}]}],bloom:[function(e,r){var i=e,n=i.radius,o=void 0===n?30:n,a=i.bloomAddon,s=void 0===a?.4:a,u=i.colorAddon,c=void 0===u?1:u,l=i.colorThreshold,h=void 0===l?[255,255,255]:l,f=r.getEngine().gpuCapability.level,p=ts({radius:o}),d=r.renderer.engine,m=r.renderer,v=Math.round(r.width/p.downSample),y=Math.round(r.width/p.downSample);1===f&&(v=le(v),y=le(y));var x=[0,0,v,y],g=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:E.RGBA,magFilter:E.LINEAR,minFilter:E.LINEAR,name:"gaussianV",width:v,height:y}),T=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:E.RGBA,magFilter:E.LINEAR,minFilter:E.LINEAR,name:"gaussianH",width:v,height:y}),S=ke(s),b=ke(c),R=new Fi(d),_=new rs(m,{name:"threshold",attachments:[{texture:g}],viewport:x,clearAction:{colorAction:t.TextureLoadAction.clear}});_.pluginSystem=r.pluginSystem,_.fragShader=Ki,_.preDefaultPassAttachment=R;var A=new is(m,"H",new Pt(p.step,0),r.pluginSystem,p.shader,{name:"gaussianH",viewport:x,attachments:[{texture:T}],clearAction:{colorAction:t.TextureLoadAction.clear}},g);A.preDefaultPassAttachment=R;var C=new is(m,"V",new Pt(0,p.step),r.pluginSystem,p.shader,{name:"gaussianV",viewport:x,attachments:[{texture:g}]},T);C.preDefaultPassAttachment=R;var w=2===f?E.LINEAR:E.NEAREST,O=new ns(m,{name:"bloomCopyPass",attachments:[{texture:{format:E.RGBA,minFilter:w,magFilter:w}}],clearAction:{colorAction:t.TextureLoadAction.clear}},R);return{mesh:{name:"bloom-".concat(p.step),fragment:Qi,shaderCacheId:"bloom-".concat(p.step),variables:{uBloomParams:function(t){return[S.getValue(t),b.getValue(t),0,1]}},uniformValues:{uColorThreshold:[h[0]/255||1.1,h[1]/255||1.1,h[2]/255||1.1,0],uBloomBlur:g},materialStates:{blending:!1,culling:!1}},onItemRemoved:function(){g.dispose(),T.dispose()},passSplitOptions:{attachments:[{texture:{format:E.RGBA}}],prePasses:[_,A,C,O]}}},function(t){var e=t.radius,r=ts({radius:void 0===e?30:e});return[{fragment:Qi,shaderCacheId:"bloom-".concat(r.step)},{fragment:Ki,ignoreBlend:!0},{fragment:r.shader,ignoreBlend:!0}]}],gaussian:[function(e,r){var i=e.radius,n=r.getEngine().gpuCapability.level,o=r.renderer.engine,a=r.renderer,s=ts({radius:i}),u=s.downSample,c=s.step,l=s.shader,h=Math.round(r.width/u),f=Math.round(r.height/u);1===n&&(f=le(f),h=le(h));var p=[0,0,h,f],d=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:E.LINEAR,magFilter:E.LINEAR,name:"gaussianV",width:h,height:f}),m=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:E.LINEAR,magFilter:E.LINEAR,name:"gaussianH",width:h,height:f}),v=new Fi(o,{}),y=new Ja(a,"H",new Pt(0,c),r.pluginSystem,l,{name:"gaussianH",viewport:p,attachments:[{texture:m}],clearAction:{colorAction:t.TextureLoadAction.clear}});y.preDefaultPassAttachment=v;var x=new Ja(a,"V",new Pt(c,0),r.pluginSystem,l,{name:"gaussianV",viewport:p,attachments:[{texture:d}],clearAction:{colorAction:t.TextureLoadAction.clear}});x.preDefaultPassAttachment=v;var g=2===n?E.LINEAR:E.NEAREST,T=new $a(a,{name:"gaussianCopyPass",attachments:[{texture:{format:E.RGBA,minFilter:g,magFilter:g}}],clearAction:{colorAction:t.TextureLoadAction.clear}},v);return T.preDefaultPassAttachment=v,{mesh:{fragment:li,shaderCacheId:"gaussian-".concat(c),uniformValues:{uTexSize:[h,f]},materialStates:{blending:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:E.RGBA}}],prePasses:[y,x,T]}}},function(t){var e=ts({radius:t.radius});return[{fragment:li,shaderCacheId:"gaussian-".concat(e.step)},{fragment:e.shader,ignoreBlend:!0}]}],delay:[function(e,r){var i=r.renderer,n=Kr.create(i.engine,{sourceType:t.TextureSourceType.framebuffer}),o=[0,.96,0,0],a=2===i.engine.gpuCapability.level?E.LINEAR:E.NEAREST,s=new os(i,{name:"delayCopyPass",attachments:[{texture:{format:E.RGBA,minFilter:a,magFilter:a}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{mesh:{fragment:Wi,shaderCacheId:"delay",uniformValues:{uLastSource:n},variables:{uParams:function(){return o}},materialStates:{blending:!0,blendFunction:[E.SRC_ALPHA,E.ONE_MINUS_SRC_ALPHA,E.SRC_ALPHA,E.ONE_MINUS_SRC_ALPHA],depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:E.RGBA}}],prePasses:[s]},onItemRemoved:function(){n.dispose()},renderPassDelegate:{didEndRenderPass:function(t){i.extension.copyTexture(t.attachments[0].texture,n),o[0]=2}}}},function(){return[{fragment:Wi,shaderCacheId:"delay"}]}]};
|
|
15
|
-
/*!
|
|
16
|
-
* Name: @galacean/effects-specification
|
|
17
|
-
* Description: Galacean Effects JSON Specification
|
|
18
|
-
* Author: Ant Group CO., Ltd.
|
|
19
|
-
* Version: v1.3.0
|
|
20
|
-
*/!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(cs||(cs={})),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"}(ls||(ls={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(hs||(hs={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(fs||(fs={})),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"}(ps||(ps={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(ds||(ds={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(ms||(ms={})),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"}(vs||(vs={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.filter="8",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox"}(ys||(ys={})),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"}(xs||(xs={})),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"}(gs||(gs={}));var Es,Ss,bs,Rs,_s,As,Cs,ws,Os,Ms,Ls,Is,Ps,Vs,Fs,Ns,zs,Ds,Us=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=Us]="landscape"}(Es||(Es={})),function(t){t[t.destroy=0]="destroy",t[t.pause=1]="pause",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.pause_destroy=3]="pause_destroy"}(Ss||(Ss={})),function(t){t.video="video",t.image="image"}(bs||(bs={})),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"}(Rs||(Rs={})),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"}(_s||(_s={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(As||(As={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Cs||(Cs={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(ws||(ws={})),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"}(Os||(Os={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Ms||(Ms={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Ls||(Ls={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Is||(Is={})),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"}(Ps||(Ps={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(Vs||(Vs={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Fs||(Fs={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Ns||(Ns={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(zs||(zs={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Ds||(Ds={}));var Bs=function(){return Bs=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},Bs.apply(this,arguments)};function ks(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gs(t,e){if(!t.includes(e))return t.push(e),!0}function Xs(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function Hs(t){if(Number.isFinite(t))return[Rs.CONSTANT,t];if(t){var e=t[0],r=t[1];if(Array.isArray(e))return;if("static"===e||e===Rs.CONSTANT)return[Rs.CONSTANT,t[1]];if("lines"===e)return[Rs.LINE,t[1]];if(e===Rs.LINE){var i=r.map((function(t){return[_s.LINE,t]}));return[Rs.BEZIER_CURVE,i]}return"curve"===e||e===Rs.CURVE?[Rs.BEZIER_CURVE,au(r)]:t}}function Ys(t,e){return Array.isArray(t)&&"random"===t[0]?[Rs.CONSTANT,t[1][e]]:Hs(t)}function js(t){return t&&"color"===t[0]?Qs(t[1],!0):[1,1,1,1]}function Ws(t,e){if(t)return"colors"===t[0]?[Rs.COLORS,t[1].map((function(t){return Qs(t,e)}))]:"gradient"===t[0]?qs(t[1],e):"color"===t[0]?[Rs.RGBA_COLOR,Qs(t[1],e)]:t}function Zs(t){return t&&"random"===t[0]?[Rs.RANDOM,t[1]]:Hs(t)}function qs(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),o=Qs(t[i],e);r.push([n,o[0],o[1],o[2],o[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[Rs.GRADIENT_COLOR,r]}}function Qs(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else t instanceof Array&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=function(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}(r)),r}function Ks(t,e){return Array.isArray(t)?t[0]===Rs.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&qs(t[1],e):qs(t,e)}function Js(t){if(t){if(3===t.length)return[Rs.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Rs.BEZIER_PATH||e===Rs.LINEAR_PATH){var r=t[1],i=r[0],n=r[1],o=r[2],a=au(i);if(!o){o=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s?o.push(u):s<n.length-1?(o.push(u),o.push(u)):o.push(u)}}return[Rs.BEZIER_CURVE_PATH,[a,n,o]]}return t}}function $s(t){var e,r;try{for(var i=ks(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;t[o]=Number(t[o])}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}function tu(t){var e,r;try{for(var i=ks(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;void 0===t[o]&&delete t[o]}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}"function"==typeof SuppressedError&&SuppressedError;var eu=Math.cos,ru=Math.sin,iu=Math.PI/180,nu=180/Math.PI;function ou(t,e,r,i){var n=r[0],o=r[1],a=i[0],s=a-n;return[[n+(a-n)/3,o+(t*=s)/3],[a-(a-n)/3,i[1]-(e*=s)/3]]}function au(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]);var n=[[t[0][0],t[0][1]]];for(i=0;i<t.length-1;i++){var o=t[i][3]*(e-r),a=t[i+1][2]*(e-r),s=[t[i][0],t[i][1]],u=[t[i+1][0],t[i+1][1]];if(s[0]!=u[0]){var c=ou(o,a,s,u),l=c[0],h=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[1]),n.push([h[0],h[1],u[0],u[1]])}else n[n.length-1].push(u[0]),n[n.length-1].push(u[1])}return n.map((function(t,e){return 0===e?[_s.EASE_OUT,t]:e===n.length-1?[_s.EASE_IN,t]:[_s.EASE,t]}))}function su(t){var e,r=t.options,i=t.transform,n={type:ps.NONE};if(t.shape){var o=null===(e=t.shape.shape)||void 0===e?void 0:e.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(n=Bs(Bs({},t.shape),{type:ps[o]}),t.shape.upDirection){var a=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}(t.shape.upDirection,3),s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=Zs(r.turbulenceX),n.turbulenceY=Zs(r.turbulenceY),n.turbulenceZ=Zs(r.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return $s(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return $s(t)}))),l.rateOverTime&&(l.rateOverTime=Zs(l.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:l,options:{startLifetime:Zs(r.startLifetime),start3DSize:!!r.start3DSize,startSize:Zs(r.startSize),startSizeX:Zs(r.startSizeX),startSizeY:Zs(r.startSizeY),sizeAspect:Zs(r.sizeAspect),maxCount:r.maxCount,startDelay:Zs(r.startDelay),startColor:Ws(r.startColor,!0),startRotationZ:Zs(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=Zs(r.startRotationX),h.options.startRotationY=Zs(r.startRotationY)),t.filter){var f={};Xs(t.filter,(function(t,e){var r;f[e]=(r=t,Array.isArray(r)&&"string"==typeof r[0]&&(Zs(r)||Js(r)||Ws(r))||r)})),h.filter=f}i&&i.path&&(h.emitterTransform={path:Js(i.path)});var p=t.sizeOverLifetime;p&&(p.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:Zs(p.x),y:Zs(p.y)}:h.sizeOverLifetime={size:Zs(p.size)});var d=t.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?Hs(m):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:Hs(r.gravityModifier),startSpeed:Zs(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:Zs(d.linearX),linearY:Zs(d.linearY),linearZ:Zs(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Zs(d.orbitalX),orbitalY:Zs(d.orbitalY),orbitalZ:Zs(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Hs(d.forceCurve)},tu(h.positionOverLifetime);var v=t.rotationOverLifetime;v&&(h.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:Zs(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(h.rotationOverLifetime.y=Hs(v.y),h.rotationOverLifetime.x=Hs(v.x)));var y=t.colorOverLifetime;if(y){var x=h.colorOverLifetime={opacity:Hs(y.opacity)};y.color&&(x.color=Ks(y.color))}var g=t.textureSheetAnimation;g&&(h.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Hs(g.cycles),animationDelay:Ys(g.animationDelay,0),animationDuration:Ys(g.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:Zs(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:Hs(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&Ks(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&Ks(T.colorOverLifetime,!1),inheritParticleColor:T.inheritParticleColor,occlusion:T.occlusion,transparentOcclusion:T.transparentOcclusion,orderOffset:T.orderOffset,sizeAffectsLifetime:T.sizeAffectsLifetime,sizeAffectsWidth:T.sizeAffectsWidth,texture:T.texture,parentAffectsPosition:T.parentAffectsPosition,opacityOverLifetime:Zs(T.opacityOverLifetime)}),h.trails&&tu(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}function uu(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:Js(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:Hs(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:Hs(n.linearX),linearY:Hs(n.linearY),linearZ:Hs(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Hs(n.orbitalX),orbitalY:Hs(n.orbitalY),orbitalZ:Hs(n.orbitalZ),speedOverLifetime:Hs(n.speedOverLifetime)};tu(o);var a={options:{startColor:js(i.startColor)},positionOverLifetime:o};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var s=t.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=Hs(s.x),u.y=Hs(s.y),u.z=Hs(s.z)):u.z=Hs(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var l=a.colorOverLifetime={opacity:Hs(c.opacity)};c.color&&(l.color=Ks(c.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:Hs(h.size),x:Hs(h.x),y:Hs(h.y),z:Hs(h.z)}),a}function cu(t,e){var r=uu(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}var lu=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],hu=["path","position"];function fu(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===ys.null&&t.endBehavior===As.destroy&&(t.endBehavior=As.freeze)}))})),t.version="2.1",t}function pu(t){var e,r;if(t)try{for(var i=ks(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value,a=t[o],s=Array.isArray(a);s&&2===a.length&&Array.isArray(a[1])?t[o]="path"===o?Js(a):Hs(a):s||"object"!=typeof a||pu(a)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}var du=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,mu=/^(\d+)\.(\d+)$/,vu=!1;function yu(t){var e;if(!t||"object"!=typeof t)throw Error("expect a json object");if(function(t){var e,r=null===(e=t.version)||void 0===e?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==ys.mesh&&t.type!==ys.light||(t.endBehavior=1===t.endBehavior?As.destroy:t.endBehavior)}))}))}(t),du.test(t.version))return vu="0"===(null===(e=/^(\d+)/.exec(t.version))||void 0===e?void 0:e[0]),fu(function(t){var e,r;xu="1.0";var i=t.plugins||[];(null===(e=t.bins)||void 0===e?void 0:e.length)&&(xu="1.3");var n=(t.requires||[]).slice(),o=t.images.map((function(e,r){return gu(e,r,t.imageTags||[])})),a=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),s={plugins:i,shapes:t.shapes||[],type:"ge",version:xu,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return Tu(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()};t._textures&&(s._textures=t._textures);return s}(t));var r=mu.exec(t.version)||[],i=Number(r[1]),n=Number(r[2]);if(i)return(i<2||2===i&&n<4)&&function(t){t.compositions.map((function(t){var e,r;try{for(var i=ks(t.items),n=i.next();!n.done;n=i.next())pu(n.value.content)}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}))}(t),i<2?fu(t):t;throw Error("invalid json version "+t.version)}var xu="1.0";function gu(t,e,r){var i=r[e],n=t.oriY;if("string"==typeof t)return{renderLevel:i,url:t,oriY:n};if(t.template)return{url:t.url,template:t.template,webp:t.webp,renderLevel:i,oriY:n};if(t.compressed)return{url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{url:t.url,webp:t.webp,renderLevel:i,oriY:n};if(t&&t.sourceType)return t;throw Error("invalid image type")}function Tu(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Object.assign({clipMode:Us},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Ru(t,e)})),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var o=null===(r=t.meta)||void 0===r?void 0:r.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(i.previewSize=o),i}var Eu,Su=[0,0,0,1],bu=.5;function Ru(t,e){var r,i,n;void 0===e&&(e={});var o,a,s,u,c,l,h=ys.base,f=t.endBehavior,p=NaN;if(t.content?(h=t.type||ys.plugin,l=t.pn,c=t.pluginName,s=t.content,a=t.content,isNaN(l)&&!c&&(c=s.options.type),t.duration&&(p=t.duration),o=t.transform||y(a.transform),h===ys.filter&&(xu<"1.1"&&(xu="1.1"),(s=cu(a,o)).filter=function(t){var e={};return Xs(t,(function(t,r){lu.includes(r)?e[r]=Hs(t):hu.includes(r)?e[r]=Js(t):e[r]=t})),e}(a.filter))):t.particle?(h=ys.particle,o=y((a=t.particle).transform,vu,!0),s=su(a)):t.sprite?(h=ys.sprite,s=cu(a=t.sprite,o=y(a.transform,!1,!0))):t.cal?(h=ys.null,s=uu(a=t.cal,o=y(a.transform,!1,!0))):t.ui?(h=ys.interact,o=y((a=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:ms.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&js(r.previewColor),behavior:r.behavior||vs.NOTIFY};break;case"drag":e={type:ms.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:ms.MESSAGE}}return{options:e}}(a),o.scale=[a.options.width||1,a.options.height||1,1]):t.model&&(a=t.model,1===t.model.options.type&&(h=ys.camera,o=y(a.transform),s=function(t){var e,r,i=t.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=t.velocityOverLifetime;if(o||(null===(e=t.transform)||void 0===e?void 0:e.path)){var a={path:Js(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:Hs(null==o?void 0:o.translateX),linearY:Hs(null==o?void 0:o.translateY),linearZ:Hs(null==o?void 0:o.translateZ)};tu(a),n.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:Hs(null==s?void 0:s.rotateX),y:Hs(null==s?void 0:s.rotateY),z:s.separateAxes?Hs(null==s?void 0:s.rotateZ):Hs(s.rotation)};tu(u),n.rotationOverLifetime=u}return n}(a))),null===(r=s.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==bu&&d[1]==bu?delete s.renderer.anchor:e.requires&&Gs(e.requires,"anchor")}if(a){var m=null===(i=a.options)||void 0===i?void 0:i.looping;f=m?Array.isArray(m)?m[1]?As.loop:As.destroy:As.loop:f||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||As.destroy,a.options.renderLevel&&(u=a.options.renderLevel),isNaN(p)&&(p=a.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:o,endBehavior:f,renderLevel:u,content:s};return c?e.plugins?(Gs(e.plugins,c),v.pn=e.plugins.indexOf(c)):v.pluginName=c:Number.isInteger(l)&&(v.pn=l),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 o=(a=Su,s=i.rotation[0],u=i.rotation[1],c=i.rotation[2],l=eu(s*iu/2),h=eu(u*iu/2),f=eu(c*iu/2),p=ru(s*iu/2),d=ru(u*iu/2),m=ru(c*iu/2),a[0]=p*h*f+l*d*m,a[1]=l*d*f-p*h*m,a[2]=l*h*m+p*d*f,a[3]=l*h*f-p*d*m,a);i.rotation=function(t,e){var r,i,n,o=e[0],a=e[1],s=e[2],u=e[3],c=o+o,l=a+a,h=s+s,f=o*c,p=a*c,d=a*l,m=s*h,v=u*h,y=1-d-m,x=p-v,g=p+v,T=1-f-m,E=s*c-u*l,S=s*l+u*c,b=1-f-d;return t[1]=Math.asin((i=-1,(r=-E)>(n=1)?n:r<i?i:r))*nu,Math.abs(E)<.9999999?(t[0]=Math.atan2(S,b)*nu,t[2]=Math.atan2(g,y)*nu):(t[0]=0,t[2]=Math.atan2(-x,T)*nu),t}([],o)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}var a,s,u,c,l,h,f,p,d,m;return{}}}var _u=((Eu={})[_.S]=[_.S,_.BPlus,_.APlus],Eu[_.A]=[_.A,_.BPlus,_.APlus],Eu[_.B]=[_.B,_.BPlus],Eu);function Au(t,e){if(!t||!e)return!0;var r=_u[e];return!!r&&r.includes(t)}var Cu=0,wu=function(){function t(t,e){var r,i;this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0;var n=t.jsonScene,o=t.renderLevel,a=t.textureOptions,s=t.pluginSystem,u=t.totalTime,l=n.compositions,h=n.imgUsage,f=n.compositionId;if(!a)throw new Error("scene.textures expected");var p=a.map((function(t){return t&&(t instanceof Kr?t:Kr.create(e,t))}));t.textureOptions=p,null==p||p.forEach((function(t){return null==t?void 0:t.initialize()}));try{for(var d=c(l),m=d.next();!m.done;m=d.next()){var v=m.value;v.id===f?this.composition=v:this.refCompositions.set(v.id,v)}}catch(t){r={error:t}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}if(!this.composition)throw new Error("Invalid composition id: "+f);this.jsonScene=n,this.renderLevel=o,this.pluginSystem=s,this.totalTime=null!=u?u:0,this.imgUsage=null!=h?h:{},this.textures=p,Cu=0,this.textureOptions=a,this.sourceContent=this.getContent(this.composition)}return t.prototype.getContent=function(t){var e=t.id,r=t.duration,i=t.name,n=t.endBehavior,o=t.camera,a=t.globalVolume,s=t.startTime,u=void 0===s?0:s,c=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:c,camera:o,startTime:u,globalVolume:a}},t.prototype.assembleItems=function(t){var e=this,r=[];return t.items.forEach((function(t){var i,n={},o=t.visible,s=t.renderLevel,u=t.type;if(!1!==o){var c=a({},t.content);if(c&&(n.content=a({},c),Au(s,e.renderLevel))){var l=n.content;if(n.type=u,l.renderer){l.renderer=e.changeTex(l.renderer),e.processMask(l.renderer);var h=l.splits&&!l.textureSheetAnimation&&l.splits[0];Number.isInteger(l.renderer.shape)?l.renderer.shape=jo(null===(i=e.jsonScene)||void 0===i?void 0:i.shapes[l.renderer.shape],h):l.renderer.shape&&or(l.renderer.shape)&&(l.renderer.shape=jo(l.renderer.shape,h))}else n.content.renderer={order:0};l.trails&&(l.trails=e.changeTex(l.trails)),l.filter&&(l.filter=a({},l.filter));var f=t.name,p=t.delay,d=void 0===p?0:p,m=t.id,v=t.parentId,y=t.duration,x=t.endBehavior,g=t.pluginName,T=t.pn,E=t.transform,S=t.refCount,b=e.jsonScene.plugins,R=void 0===b?[]:b;if(n.name=f,n.delay=d,n.id=m,v&&(n.parentId=v),n.refCount=S,n.duration=y,n.listIndex=Cu++,n.endBehavior=x,g?n.pluginName=g:void 0!==T&&Number.isInteger(T)&&(n.pluginName=R[T]),E&&(n.transform=E),n.type===P.composition){e.mask++;var _=t.content.options.refId;if(!e.refCompositions.get(_))throw new Error("Invalid Ref Composition id: "+_);var A=e.getContent(e.refCompositions.get(_));e.refCompositionProps.has(_)||e.refCompositionProps.set(_,A),A.items.forEach((function(t){e.processMask(t.content)})),n.items=A.items}r.push(n)}}})),r},t.prototype.changeTex=function(t){var e=t.texture,r=a({},t);return void 0!==e&&(r.texture=this.addTextureUsage(e)||e),r},t.prototype.addTextureUsage=function(t){var e,r;if(Number.isInteger(t)){var i=null===(e=this.textures)||void 0===e?void 0:e[t],n=null==i?void 0:i.id,o=null!==(r=this.imgUsage)&&void 0!==r?r:{};if(n&&o)return o.hasOwnProperty(n)||(o[n]=0),o[n]++,i}},t.prototype.processMask=function(t){if(t.maskMode!==w.NONE&&!t.mask){var e=t.maskMode;e===w.MASK?t.mask=++this.mask:e!==w.OBSCURED&&e!==w.REVERSE_OBSCURED||(t.mask=this.mask)}},t.prototype.dispose=function(){this.textureOptions=[],this.textures=[],this.composition=void 0,this.jsonScene=void 0,this.totalTime=0,this.pluginSystem=void 0,this.sourceContent=void 0,this.refCompositions.clear(),this.refCompositionProps.clear()},t}();function Ou(t){return or(t)&&"jsonScene"in t}var Mu=1,Lu=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new Gr),this.options=t,this.downloader=e,this.assets={},this.id=Mu++,this.timers=[],this.updateOptions(t)}return e.prototype.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},e.prototype.updateSceneData=function(t){var e=this.options.variables;return!e||Object.keys(e).length<=0||t.forEach((function(t){t.items.forEach((function(t){if(t.type===P.text){var r=e[t.name];r&&(t.content.options.text=r)}}))})),t},e.prototype.loadScene=function(t,e,r){var i,n,o;return s(this,void 0,void 0,(function(){var c,h,f,p,d,m,v,y,x,g,T,E,S,b=this;return u(this,(function(R){return h=rr(t)?t:this.id,f=performance.now(),p=[],d=null==e?void 0:e.engine.gpuCapability,m=null!==(n=null===(i=null==d?void 0:d.detail)||void 0===i?void 0:i.asyncShaderCompile)&&void 0!==n&&n,v=null!==(o=null==d?void 0:d.detail.compressedTexture)&&void 0!==o?o:0,y={},g=!1,T=new Promise((function(t,e){x=window.setTimeout((function(){g=!0,b.removeTimer(x);var t=performance.now()-f;e("Load time out: totalTime: ".concat(t.toFixed(4),"ms ").concat(p.join(" "),", url: ").concat(h))}),1e3*b.timeout),b.timers.push(x)})),E=function(t,e){return s(b,void 0,void 0,(function(){var r,i,n,o;return u(this,(function(a){switch(a.label){case 0:if(g)return[3,4];r=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return i=a.sent(),n=performance.now()-r,p.push("[".concat(t,": ").concat(n.toFixed(2),"]")),y[t]=n,[2,i];case 3:throw o=a.sent(),new Error("load error in ".concat(t,", ").concat(o));case 4:throw new Error("load canceled.")}}))}))},S=function(){return s(b,void 0,void 0,(function(){var i,n,o,s,d,g,T,S,b,R,_,A,C,w,O,M,L,I,P,V=this;return u(this,(function(u){switch(u.label){case 0:return or(t)?(c=t,this.baseUrl=location.href,[3,3]):[3,1];case 1:return t=new URL(t,location.href).href,this.baseUrl=t,[4,E("loadJSON",(function(){return V.loadJSON(t)}))];case 2:c=u.sent(),u.label=3;case 3:if(!Ou(c))return[3,6];if(i=a({},c),!this.options||!this.options.variables||0===Object.keys(this.options.variables).length)return[3,5];for(n=c.jsonScene.images,o=i.images,d=0;d<n.length;d++)o[d]instanceof HTMLCanvasElement&&(o[d]=n[d]);return s=i,[4,E("processImages",(function(){return V.processImages(o,i.usedImages,v)}))];case 4:for(s.images=u.sent(),d=0;d<i.images.length;d++)i.textureOptions[d].image=i.images[d];i.jsonScene.compositions=this.updateSceneData(i.jsonScene.compositions),u.label=5;case 5:return[3,12];case 6:return[4,E("processJSON",(function(){return V.processJSON(c)}))];case 7:return g=u.sent(),T=g.usedImages,S=g.jsonScene,b=g.pluginSystem,R=S.bins,_=void 0===R?[]:R,A=S.images,C=S.compositions,w=S.fonts,[4,Promise.all([E("processBins",(function(){return V.processBins(_)})),E("processImages",(function(){return V.processImages(A,T,v)})),E("".concat(m?"async":"sync","Compile"),(function(){return V.precompile(C,b,e,r)}))])];case 8:return O=l.apply(void 0,[u.sent(),2]),M=O[0],L=O[1],[4,E("processFontURL",(function(){return V.processFontURL(w)}))];case 9:return u.sent(),[4,E("processTextures",(function(){return V.processTextures(L,M,S)}))];case 10:return I=u.sent(),S.compositions=this.updateSceneData(S.compositions),i={timeInfos:y,url:t,renderLevel:this.options.renderLevel,storage:{},pluginSystem:b,jsonScene:S,usedImages:T,images:L,textureOptions:I,bins:M},[4,E("processPlugins",(function(){return b.loadResources(i,V.options)}))];case 11:u.sent(),u.label=12;case 12:return P=performance.now()-f,tr.info("Load asset: totalTime: ".concat(P.toFixed(4),"ms ").concat(p.join(" "),", url: ").concat(h)),window.clearTimeout(x),this.removeTimer(x),i.totalTime=P,i.startTime=f,i.timeInfos=y,[2,i]}}))}))},[2,Promise.race([T,S()])]}))}))},e.prototype.precompile=function(t,e,r,i){return s(this,void 0,void 0,(function(){var n;return u(this,(function(o){switch(o.label){case 0:return r&&r.getShaderLibrary()?(n=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,i)]):[2];case 1:return o.sent(),[4,new Promise((function(t){n.compileAllShaders((function(){t(null)}))}))];case 2:return o.sent(),[2]}}))}))},e.prototype.processJSON=function(t){return s(this,void 0,void 0,(function(){var e,r,i,n,o,a,s,c,l;return u(this,(function(u){switch(u.label){case 0:return e=yu(t),t.compositions.forEach((function(t,r){t.globalVolume&&(e.compositions[r].globalVolume=t.globalVolume)})),r=e.plugins,i=void 0===r?[]:r,n=e.compositions,o=e.imgUsage,a=e.images,[4,(s=new xr(i)).processRawJSON(e,this.options)];case 1:return u.sent(),c=this.options.renderLevel,l={},o?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var a=r[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];Au(i[u].renderLevel,n)&&(t[u]=!0)}}}(l,n,o,a,c):null==a||a.forEach((function(t,e){l[e]=!0})),[2,{usedImages:l,jsonScene:e,pluginSystem:s}]}}))}))},e.prototype.processBins=function(t){return s(this,void 0,void 0,(function(){var e,r,i,n=this;return u(this,(function(o){return e=this.options.renderLevel,r=this.baseUrl,i=t.map((function(i){if(i instanceof ArrayBuffer)return i;if(Au(i.renderLevel,e))return n.loadBins(new URL(i.url,r).href);throw new Error("Invalid bins source: ".concat(JSON.stringify(t)))})),[2,Promise.all(i)]}))}))},e.prototype.processFontURL=function(t){return s(this,void 0,void 0,(function(){var r,i=this;return u(this,(function(n){return t?(r=t.map((function(t){return s(i,void 0,void 0,(function(){var r,i,n;return u(this,(function(o){switch(o.label){case 0:if(!t.fontURL||e.fonts.has(t.fontFamily))return[3,4];ot(t.fontFamily)||console.warn("Risky font family: ".concat(t.fontFamily)),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,this.baseUrl).href,[4,(i=new FontFace(null!==(n=t.fontFamily)&&void 0!==n?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(i),e.fonts.add(t.fontFamily),[3,4];case 3:return o.sent(),tr.warn("Invalid font family or font source: ".concat(JSON.stringify(t.fontURL))),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},e.prototype.processImages=function(e,r,i){return s(this,void 0,void 0,(function(){var n,o,a,c,l,h=this;return u(this,(function(f){return n=this.options,o=n.useCompressedTexture,a=n.variables,c=this.baseUrl,l=e.map((function(e,n){return s(h,void 0,void 0,(function(){var s,l,h,f,p,d,m,v,y,x,g,T,E,S,b,R,_,A;return u(this,(function(u){switch(u.label){case 0:if(!r[n])return[2,void 0];if(s=e.url,l=e.webp,h=new URL(s,c).href,f=l&&new URL(l,c).href,!("template"in e))return[3,13];if(p=e.template,d="v"in p&&2===p.v&&p.background,m=d?p.background:void 0,!d||!m)return[3,8];v=ka(p,a),y=m.type===ut.video,x=m&&y?Wr:Yr,u.label=1;case 1:return u.trys.push([1,6,,7]),[4,Ga(v,x)];case 2:return(T=u.sent())instanceof HTMLVideoElement?[2,T]:[3,3];case 3:return m&&Array.isArray(v)&&a&&(a[m.name]=T.src),[4,ja(T,p,a,this.options,-1===e.oriY)];case 4:return[2,u.sent()];case 5:return[3,7];case 6:throw g=u.sent(),new Error("Failed to load. Check the template or if the URL is ".concat(y?"video":"image"," type, URL: ").concat(v,", Error: ").concat(g.message));case 7:return[3,12];case 8:return u.trys.push([8,11,,12]),[4,Hr(h,f)];case 9:return[4,ja((T=u.sent()).image,p,a,this.options,-1===e.oriY)];case 10:return[2,u.sent()];case 11:throw u.sent(),new Error("Failed to load. Check the template, URL: ".concat(h,"."));case 12:return[3,14];case 13:if("type"in e&&"video"===e.type)return console.warn("The video element is deprecated. Use template BackgroundType.video instead."),[2,Wr(e.url)];if("compressed"in e&&o&&i){if(E=e.compressed,S=void 0,i===Sn.ASTC?S=E.astc:i===Sn.PVRTC&&(S=E.pvrtc),S)return b=new URL(S,c).href,this.assets[n]={url:b,type:t.TextureSourceType.compressed},[2,this.loadBins(b)]}else{if("sourceType"in e)return[2,e];if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof Kr)return[2,e]}u.label=14;case 14:return[4,Hr(h,f)];case 15:return R=u.sent(),_=R.url,A=R.image,this.assets[n]={url:_,type:t.TextureSourceType.image},[2,A]}}))}))})),[2,Promise.all(l)]}))}))},e.prototype.processTextures=function(e,r,i){var n;return s(this,void 0,void 0,(function(){var o,s,c=this;return u(this,(function(u){return o=null!==(n=i.textures)&&void 0!==n?n:e.map((function(t,e){return{source:e}})),s=o.map((function(n,o){if(n instanceof Kr)return n;if("mipmaps"in n)try{return Zr(n,r,i.bins)}catch(t){throw new Error("load texture ".concat(o," fails, error message: ").concat(t))}var s=n.source,u=e[s];if(u){var l=function(e,r){if(e instanceof Kr)return e.source;if(e instanceof HTMLImageElement||function(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null===(e=t.tagName)||void 0===e?void 0:e.toUpperCase())}(e))return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:E.LINEAR,magFilter:E.LINEAR};if(e instanceof HTMLVideoElement)return{sourceType:t.TextureSourceType.video,video:e,minFilter:E.LINEAR,magFilter:E.LINEAR};if(e instanceof ArrayBuffer)return a(a({},ti(e)),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:E.CLAMP_TO_EDGE,wrapT:E.CLAMP_TO_EDGE,minFilter:E.NEAREST,magFilter:E.NEAREST};throw new Error("Invalid texture options")}(u,c.assets[o]);return l.sourceType===t.TextureSourceType.compressed?l:a(a({},l),n)}throw new Error("Invalid texture source: ".concat(s))})),[2,Promise.all(s)]}))}))},e.prototype.loadJSON=function(t){return s(this,void 0,void 0,(function(){var e=this;return u(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.loadBins=function(t){return s(this,void 0,void 0,(function(){var e=this;return u(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},e.prototype.dispose=function(){var t;for(var e in this.timers.length&&this.timers.map((function(t){return window.clearTimeout(t)})),this.assets){var r=this.assets[e];null===(t=null==r?void 0:r.dispose)||void 0===t||t.call(r)}this.assets={},this.timers=[]},e.fonts=new Set,e}();var Iu,Pu,Vu,Fu,Nu=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t.itemTree=[],t.itemCacheMap=new Map,t.itemsToRemove=[],t.tempQueue=[],t}return o(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return P.composition},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){var e=t.items,r=void 0===e?[]:e,i=t.startTime,n=void 0===i?0:i,o=t.content,a=t.refId;this.refId=a,this.itemProps=r,this.contentProps=o;var s=this.endBehavior;5!==s&&1!==s&&3!==s||(this.freezeOnEnd=!0),this.startTime=n,this.startTimeInms=Math.round(1e3*this.startTime)},r.prototype.createContent=function(){if(!this.items.length&&this.composition)for(var e=0;e<this.itemProps.length;e++){var i=void 0,n=this.itemProps[e];if(t.Item.isComposition(n)){var o=n.content.options.refId;(i=new r(a({refId:o},n),this.composition)).contentProps=n.content,i.transform.parentTransform=this.transform,this.composition.refContent.push(i),5===i.endBehavior&&(this.composition.autoRefTex=!1),i.createContent()}else(i=pr(this.itemProps[e],this.composition)).transform.parentTransform=fr.isCamera(i)?new hr:this.transform;fr.isExtraCamera(i)&&(this.extraCamera=i),this.items.push(i),this.tempQueue.push(i)}!this.content&&this.contentProps&&(this._content=this.doCreateContent())},r.prototype.doCreateContent=function(){var t=new jn(this.contentProps,this);return t.renderData=t.getRenderData(0,!0),t},r.prototype.onLifetimeBegin=function(){var t;null===(t=this.items)||void 0===t||t.forEach((function(t){t.start(),t.createContent()})),this.buildItemTree()},r.prototype.doStop=function(){this.items&&this.items.forEach((function(t){return t.stop()}))},r.prototype.onItemUpdate=function(t,e){var r,i,n=this;if(this.content&&(this.content.updateTime(this.time),this.content.getRenderData(this.content.time)),this.items){null===(r=this.composition)||void 0===r||r.updatePluginLoaders(t);var o=[];this.itemsToRemove.length&&(this.itemsToRemove.forEach((function(t){var e,r,i=n.itemCacheMap.get(t.id);if(i){var o=i.children;if(i.parentId){var a=n.itemCacheMap.get(i.parentId);a?(a.children.splice(a.children.indexOf(i),1),o.forEach((function(t){return n.setItemParent(t.item,a.item)}))):(o.forEach((function(t){return n.setItemParent(t.item,void 0)})),(e=n.itemTree).push.apply(e,h([],l(o),!1)))}else(r=n.itemTree).splice.apply(r,h([n.itemTree.indexOf(i),1],l(o),!1)),o.forEach((function(t){return n.setItemParent(t.item,void 0)}));n.itemCacheMap.delete(t.id),n.items.splice(n.items.indexOf(t),1)}})),this.itemsToRemove.length=0);for(var a=0;a<this.itemTree.length;a++){if((u=this.itemTree[a])&&u.item){var s=u.item;fr.isComposition(s)&&s.ended&&5===s.endBehavior?s.restart():s.onUpdate(t),o.push.apply(o,h([],l(u.children),!1))}}for(;o.length;){var u;if((u=o.shift())&&u.item)(s=u.item).onUpdate(t),o.push.apply(o,h([],l(u.children),!1)),s.composition||G(this.itemsToRemove,s)}null===(i=this.extraCamera)||void 0===i||i.onUpdate(t)}},r.prototype.onItemRemoved=function(t){this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0,this.itemTree.length=0,this.itemCacheMap.clear())},r.prototype.reset=function(){e.prototype.reset.call(this),this.itemTree=[],this.itemCacheMap.clear(),this.tempQueue.length=0,this.itemsToRemove.length=0},r.prototype.handleVisibleChanged=function(t){this.items.forEach((function(e){return e.setVisible(t)}))},r.prototype.setScale=function(t,e,r){this.content&&(this.content.startSize=new Vt(t,e,r))},r.prototype.scale=function(t,e,r){if(this.content){var i=this.content.startSize.clone();this.content.startSize=new Vt(t*i.x,e*i.y,r*i.z)}},r.prototype.getUpdateTime=function(t){var e=this.startTimeInms,r=this.timeInms;if(t<0&&r+t<e)return e-r;if(this.freezeOnEnd){var i=this.durInms-r;if(i<t)return i}return t},r.prototype.removeItem=function(t){var e,r=this;if(this.items.indexOf(t)>-1){if(G(this.itemsToRemove,t),fr.isTree(t)||fr.isNull(t)){var i=6===t.endBehavior,n=fr.isNull(t)&&!!this.itemCacheMap.get(t.id);((null===(e=this.itemCacheMap.get(t.id))||void 0===e?void 0:e.children)||[]).forEach((function(t){n||r.setItemParent(t.item,void 0),i&&r.removeItem(t.item)}))}return!0}return this.items.forEach((function(e){if(fr.isComposition(e)&&e.items.indexOf(t)>-1)return e.removeItem(t),!0})),!1},r.prototype.setItemParent=function(t,e){var r=this.itemCacheMap.get(t.id);if(r)if(e){var i=this.itemCacheMap.get(e.id);if(r.parentId){var n=this.itemCacheMap.get(r.parentId);n.children.splice(n.children.indexOf(r),1)}t.parent=e,r.parentId=e.id,i.children.push(r),t.transform.parentTransform=e.transform}else r.parentId=void 0,t.parent=void 0,t.transform.parentTransform=fr.isExtraCamera(t)?new hr:this.transform;else console.error("item has been remove, please set item's parent in valid lifetime")},r.prototype.getItemCurrentParent=function(t){var e=t.id,r=this.itemCacheMap.get(e);if(r){var i=r.parentId;if(i){var n=this.itemCacheMap.get(i);return i&&n?n.item:void 0}}},r.prototype.getItemByName=function(t){var e,r,i=[];try{for(var n=c(this.items),o=n.next();!o.done;o=n.next()){var a=o.value;a.name===t?i.push(a):fr.isComposition(a)&&i.push.apply(i,h([],l(a.getItemByName(t)),!1))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},r.prototype.hitTest=function(e,r,i,n,o,a){for(var s=[],u=(null==a?void 0:a.stop)||er,c=(null==a?void 0:a.skip)||er,l=(null==a?void 0:a.maxCount)||this.items.length,h=0;h<this.items.length&&n.length<l;h++){var f=this.items[h];if(f.lifetime>=0&&f.lifetime<=1&&!fr.isComposition(f)&&!c(f)){var p=f.getHitTestParams(o);if(p){var d=!1,m=new Vt;if(p.type===t.HitTestType.triangle)for(var v=p.triangles,y=p.backfaceCulling,x=0;x<v.length;x++){var g=v[x];if(e.intersectTriangle(g,m,y)){d=!0,s.push(m);break}}else if(p.type===t.HitTestType.box){var T=p.center,E=p.size,S=T.clone().addScaledVector(E,.5),b=T.clone().addScaledVector(E,-.5);e.intersectBox({min:S,max:b},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.sphere){T=p.center;var R=p.radius;e.intersectSphere({center:T,radius:R},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.custom){var _=p.collect(e,new Pt(r,i));_&&_.length>0&&(_.forEach((function(t){s.push(t)})),d=!0)}if(d){var A={compContent:this,id:f.id,name:f.name,position:s[s.length-1],parentId:f.parentId,hitPositions:s,behavior:p.behavior};if(n.push(A),u(A))return n}}}}return n},r.prototype.isEnded=function(t){return t>=this.durInms},r.prototype.buildItemTree=function(){if(!this.itemTree.length&&this.composition){this.itemTree=[];for(var t=this.itemCacheMap,e=this.tempQueue,r=function(){var r=e.shift();if(void 0===r.parentId){var n={id:r.id,item:r,children:[]};i.itemTree.push(n),t.set(r.id,n)}else{var o=i.getParentIdWithoutSuffix(r.parentId),a=t.get(o);if(a){n={id:r.id,parentId:o,item:r,children:[]};r.parent=a.item,r.transform.parentTransform=a.item.getNodeTransform(r.parentId),a.children.push(n),t.set(r.id,n)}else{if(-1===i.items.findIndex((function(t){return t.id===o})))throw Error("元素引用了不存在的元素,请检查数据");e.push(r)}}},i=this;e.length;)r()}},r.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},r.prototype.restart=function(){this.reset(),this.createContent(),this.start()},r}(fr),zu=1,Du=function(){function e(t,e){var r,i;this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.assigned=!1,this.destroyed=!1,this.paused=!1,this.lastVideoUpdateTime=0,this.postLoaders=[];var n=t.reusable,o=void 0!==n&&n,s=t.speed,u=void 0===s?1:s,c=t.baseRenderOrder,l=void 0===c?0:c,h=t.renderer,f=t.onPlayerPause,p=t.onMessageItem,d=t.onEnd,m=t.event,v=t.width,y=t.height;this.compositionSourceManager=new wu(e,h.engine),e.jsonScene.imgUsage=void 0,o&&(this.keepResource=!0,e.textures=void 0,e.consumed=!0);var x=this.compositionSourceManager,g=x.sourceContent,T=x.pluginSystem,E=x.imgUsage,S=x.totalTime,b=x.renderLevel,R=x.refCompositionProps;nt(g),this.refCompositionProps=R;var _=new Nu(g,this),A=!o&&E;this.transform=new hr({name:this.name}),_.transform=this.transform,this.globalVolume=g.globalVolume,this.width=v,this.height=y,this.renderOrder=l,this.id=zu++,this.renderer=h,this.texInfo=null!=A?A:{},this.event=m,this.statistic={loadTime:null!=S?S:0,loadStart:null!==(r=e.startTime)&&void 0!==r?r:0,firstFrameTime:0,precompileTime:null!==(i=e.timeInfos.asyncCompile)&&void 0!==i?i:e.timeInfos.syncCompile},this.reusable=o,this.speed=u,this.renderLevel=b,this.autoRefTex=!this.keepResource&&A&&5!==_.endBehavior,this.content=_,this.name=_.name,this.pluginSystem=T,this.pluginSystem.initializeComposition(this,e),this.camera=new us(this.name,a(a({},null==g?void 0:g.camera),{aspect:v/y})),this.url=e.url,this.assigned=!0,this.interactive=!0,this.onPlayerPause=f,this.onMessageItem=p,this.onEnd=d,this.createRenderFrame(),this.reset()}return Object.defineProperty(e.prototype,"handleEnd",{set:function(t){console.warn("The handleEnd property is deprecated. Use onEnd instead."),this.onEnd=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this.compositionSourceManager.textures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this.content.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){var t;return null!==(t=this.content.startTime)&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this.content.timeInms/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getDuration=function(){return this.content.duration},e.prototype.restart=function(){this.content.reset(),this.prepareRender(),this.reset(),this.transform.setValid(!0),this.content.start(),this.forwardTime(this.startTime),this.content.onUpdate(0),this.loaderData.spriteGroup.onUpdate(0)},e.prototype.setIndex=function(t){this.renderOrder=t},e.prototype.getIndex=function(){return this.renderOrder},e.prototype.setSpeed=function(t){this.speed=t},e.prototype.getSpeed=function(){return this.speed},e.prototype.play=function(){this.content.ended&&this.reusable&&this.restart(),this.content.started?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},e.prototype.pause=function(){this.paused=!0},e.prototype.resume=function(){this.paused=!1},e.prototype.gotoAndPlay=function(t){this.resume(),this.content.started||this.content.start(),this.forwardTime(t+this.startTime)},e.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},e.prototype.createRenderFrame=function(){this.renderFrame=new fn({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},e.prototype.setTime=function(t){var e=this.paused;e&&this.resume(),this.content.started||this.content.start(),this.forwardTime(t+this.startTime,!0),e&&this.pause()},e.prototype.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*t-this.content.timeInms,i=r<0,n=Math.abs(r),o=i?-15:15;n>15;n-=15)this.update(o,e);this.update(i?-n:n,e)},e.prototype.reset=function(){var t=this;this.rendererOptions=null,this.pluginSystem.plugins.forEach((function(e){return e.onCompositionWillReset(t,t.renderFrame)})),this.content.createContent(),this.content.onEnd=function(){window.setTimeout((function(){var e;null===(e=t.onEnd)||void 0===e||e.call(t,t)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)},e.prototype.prepareRender=function(){var t=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)}))},e.prototype.shouldRestart=function(){var t=this.content,e=t.ended,r=t.endBehavior;return e&&5===r},e.prototype.shouldDispose=function(){if(this.reusable)return!1;var t=this.content,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},e.prototype.update=function(t,e){if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var r=this.content.getUpdateTime(t*this.speed);this.updateVideo(),this.content.onUpdate(r),this.loaderData.spriteGroup.onUpdate(r),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},e.prototype.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!==(t=this.textures)&&void 0!==t?t:[]).forEach((function(t){return null==t?void 0:t.uploadCurrentVideoFrame()})),this.lastVideoUpdateTime=e)},e.prototype.updateCamera=function(){this.camera.updateMatrix()},e.prototype.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},e.prototype.getItemByName=function(t,e){if(this.content&&this.content.items)return this.content.getItemByName(t)[0]},e.prototype.getItemByID=function(t){return this.content&&this.content.items&&this.content.itemCacheMap.has(t)?this.content.itemCacheMap.get(t).item:null},e.prototype.getItemCurrentParent=function(t){return this.content.getItemCurrentParent(t)},e.prototype.itemLifetimeEvent=function(t,e){var r=this,i=e?function(e){return e.onCompositionItemLifeBegin(r,t)}:function(e){return e.onCompositionItemLifeEnd(r,t)};this.pluginSystem.plugins.forEach(i)},e.prototype.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return he((t-r.z)/i,(e-r.w)/n,this.camera)},e.prototype.getEngine=function(){var t;return null===(t=this.renderer)||void 0===t?void 0:t.engine},e.prototype.hitTest=function(t,e,r,i){if(this.isDestroyed||!this.interactive)return[];var n=[],o=this.getHitTestRay(t,e);return this.content.hitTest(o,t,e,n,r,i),this.refContent.forEach((function(a){a.hitTest(o,t,e,n,r,i)})),n},e.prototype.addInteractiveItem=function(t,e){var r;if(e===L.MESSAGE)return null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.id},e.prototype.removeInteractiveItem=function(t,e){var r;e===L.MESSAGE&&(null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},e.prototype.destroyTextures=function(e){for(var r,i=0;i<e.length;i++){var n=e[i];if(n)if(n.sourceType!==t.TextureSourceType.data||this.texInfo[n.id]){if(this.autoRefTex)--this.texInfo[n.id]||n.dispose()}else n!==(null===(r=this.rendererOptions)||void 0===r?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n.dispose()}},e.prototype.destroyItem=function(t){var e=this;t.type==P.composition?4!==t.endBehavior&&t.items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(this.content.removeItem(t),this.refContent.forEach((function(e){return e.removeItem(t)})),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},e.prototype.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},e.prototype.dispose=function(){var 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=er)})):n.forEach((function(t){return t&&t.dispose()}))),this.content.dispose(),this.renderFrame.dispose(),null===(t=this.rendererOptions)||void 0===t||t.emptyTexture.dispose(),null===(e=this.pluginSystem)||void 0===e||e.destroyComposition(this),this.update=function(){tr.error("Update disposed composition: ".concat(r.name,"."))},this.onPlayerPause=er,this.dispose=er,n&&this.keepResource&&n.forEach((function(t){return t.dispose=i[t.id]})),this.compositionSourceManager.dispose(),this.refCompositionProps.clear()}},e.prototype.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},e.prototype.translateByPixel=function(t,e){this.renderer?this.content.translateByPixel(t,e):console.warn("Can not translate position when container not assigned")},e.prototype.translate=function(t,e,r){this.content.translate(t,e,r)},e.prototype.setPosition=function(t,e,r){this.content.setPosition(t,e,r)},e.prototype.rotate=function(t,e,r){this.content.rotate(t,e,r)},e.prototype.setRotation=function(t,e,r){this.content.setRotation(t,e,r)},e.prototype.scale=function(t,e,r){this.content.scale(t,e,r)},e.prototype.setScale=function(t,e,r){this.content.setScale(t,e,r)},e.prototype.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},e.prototype.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},e.prototype.reloadTexture=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return this.textureOffloaded?[4,Promise.all(this.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:t.sent(),this.textureOffloaded=!1,t.label=2;case 2:return[2]}}))}))},e}(),Uu=function(){function t(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderErrors=new Set}return t.prototype.addTexture=function(t){this.destroyed||G(this.textures,t)},t.prototype.removeTexture=function(t){this.destroyed||X(this.textures,t)},t.prototype.addMaterial=function(t){this.destroyed||G(this.materials,t)},t.prototype.removeMaterial=function(t){this.destroyed||X(this.materials,t)},t.prototype.addGeometry=function(t){this.destroyed||G(this.geometries,t)},t.prototype.removeGeometry=function(t){this.destroyed||X(this.geometries,t)},t.prototype.addMesh=function(t){this.destroyed||G(this.meshes,t)},t.prototype.removeMesh=function(t){this.destroyed||X(this.meshes,t)},t.prototype.addRenderPass=function(t){this.destroyed||G(this.renderPasses,t)},t.prototype.removeRenderPass=function(t){this.destroyed||X(this.renderPasses,t)},Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},t.prototype.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass ".concat(this.renderPasses.length)),this.meshes.length>0&&t.push("Mesh ".concat(this.meshes.length)),this.geometries.length>0&&t.push("Geom ".concat(this.geometries.length)),this.textures.length>0&&t.push("Tex ".concat(this.textures.length)),t.length>0&&tr.warn("Release GPU memory: ".concat(t.join(", "))),this.renderPasses.forEach((function(t){t.dispose()})),this.meshes.forEach((function(t){t.dispose()})),this.geometries.forEach((function(t){t.dispose()})),this.materials.forEach((function(t){t.dispose()})),this.textures.forEach((function(t){t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},t}(),Bu=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.setFPS(t),this.tickers=[]}return t.prototype.getFPS=function(){return this.targetFPS},t.prototype.setFPS=function(t){this.targetFPS=Lt(t,1,120),this.interval=Math.floor(1e3/t)-2},t.prototype.getPaused=function(){return this.paused},t.prototype.start=function(){var t=this;if(this.paused=!1,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},r=function(){t.intervalId=e(r),t.paused||t.tick()};r()}},t.prototype.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.tickers=[]},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.tick=function(){if(!this.paused){var t=performance.now(),e=t-this.lastTime;if(e>=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++){(0,this.tickers[r])(e)}}}},t.prototype.add=function(t){if("function"!=typeof t)throw new Error("Ticker: The tick object must implement the tick method.");this.tickers.push(t)},t}();yr("camera",br,Rr,!0),yr("sprite",Xn,Qn,!0),yr("particle",ba,ma,!0),yr("cal",Ra,_a,!0),yr("interact",Mn,wn,!0),yr("filter",Xn,Jn,!0),yr("text",Qa,qa,!0),U(Ts);var ku=((Iu={})[E.ONE]=i.OneFactor,Iu[E.ZERO]=i.ZeroFactor,Iu[E.SRC_COLOR]=i.SrcColorFactor,Iu[E.SRC_ALPHA]=i.SrcAlphaFactor,Iu[E.ONE_MINUS_SRC_COLOR]=i.OneMinusSrcColorFactor,Iu[E.ONE_MINUS_SRC_ALPHA]=i.OneMinusSrcAlphaFactor,Iu[E.DST_COLOR]=i.DstColorFactor,Iu[E.DST_ALPHA]=i.DstAlphaFactor,Iu[E.ONE_MINUS_DST_COLOR]=i.OneMinusDstColorFactor,Iu[E.ONE_MINUS_DST_ALPHA]=i.OneMinusDstAlphaFactor,Iu),Gu=((Pu={})[E.NEVER]=i.NeverStencilFunc,Pu[E.EQUAL]=i.EqualStencilFunc,Pu[E.LESS]=i.LessStencilFunc,Pu[E.LEQUAL]=i.LessEqualStencilFunc,Pu[E.ALWAYS]=i.AlwaysStencilFunc,Pu[E.NOTEQUAL]=i.NotEqualStencilFunc,Pu[E.GREATER]=i.GreaterStencilFunc,Pu[E.GEQUAL]=i.GreaterEqualStencilFunc,Pu),Xu=((Vu={})[E.KEEP]=i.KeepStencilOp,Vu[E.ZERO]=i.ZeroStencilOp,Vu[E.REPLACE]=i.ReplaceStencilOp,Vu[E.INCR]=i.IncrementStencilOp,Vu[E.DECR]=i.DecrementStencilOp,Vu[E.INCR_WRAP]=i.IncrementWrapStencilOp,Vu[E.DECR_WRAP]=i.IncrementWrapStencilOp,Vu[E.INVERT]=i.InvertStencilOp,Vu),Hu=((Fu={})[E.NEVER]=i.NeverDepth,Fu[E.ALWAYS]=i.AlwaysDepth,Fu[E.EQUAL]=i.EqualDepth,Fu[E.LESS]=i.LessDepth,Fu[E.LEQUAL]=i.LessEqualDepth,Fu[E.GREATER]=i.GreaterDepth,Fu[E.GEQUAL]=i.GreaterEqualDepth,Fu[E.NOTEQUAL]=i.NotEqualDepth,Fu);function Yu(t,e,r){t[e]?t[e].value=r:t[e]=new i.Uniform(r)}var ju=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],Wu=function(e){function r(r,n){var o=e.call(this,n)||this;o.textures={},o.material=new i.RawShaderMaterial,o.uniforms={};for(var a=n.shader,s=r.gpuCapability.level,u=0;u<t.maxSpriteMeshItemCount;u++)o.uniforms["uSampler".concat(u)]=new i.Uniform(null);return o.uniforms.uEditorTransform=new i.Uniform([1,1,0,0]),o.uniforms.effects_ObjectToWorld=new i.Uniform((new i.Matrix4).identity()),o.uniforms.effects_MatrixInvV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.uniforms.effects_MatrixVP=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),o.uniforms.effects_MatrixV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.material=new i.RawShaderMaterial({vertexShader:a.vertex,fragmentShader:a.fragment,alphaToCoverage:!1,depthFunc:i.LessDepth,polygonOffsetFactor:i.ZeroFactor,polygonOffsetUnits:i.ZeroFactor,polygonOffset:!1,uniforms:o.uniforms}),o.material.glslVersion=1===s?i.GLSL1:i.GLSL3,o}return o(r,e),r.prototype.onSetUniformValue=function(t,e){var r;ju.includes(t)&&(r=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=r||e:this.material.uniforms[t]=new i.Uniform(r||e)},r.prototype.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},Object.defineProperty(r.prototype,"blending",{get:function(){return this.material.blending!==i.NoBlending},set:function(t){this.material.blending=t?i.CustomBlending:i.NoBlending},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendFunction",{get:function(){var t=this.material,e=t.blendSrc,r=t.blendDst;return[e,r,t.blendSrcAlpha||e,t.blendDstAlpha||r]},set:function(t){if(t){var e=l(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.material.blendSrc=ku[r],this.material.blendDst=ku[i],this.material.blendSrcAlpha=ku[n],this.material.blendDstAlpha=ku[o]}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendEquation",{get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=l(t,2),r=e[0],i=e[1];this.material.blendEquation=r,this.material.blendEquationAlpha=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=Hu[t])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffsetFill",{get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=l(t,2),r=e[0],i=e[1];this.material.polygonOffsetFactor=r,this.material.polygonOffsetUnits=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sampleAlphaToCoverage",{get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilTest",{get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilMask",{get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilRef",{get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilFunc",{get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=Gu[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpFail",{get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=Xu[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZFail",{get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=Xu[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZPass",{get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=Xu[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return this.material.side!==i.DoubleSide},set:function(t){this.material.side=t?i.FrontSide:i.DoubleSide},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{get:function(){return this.material.side},set:function(t){t===C.FRONT?this.material.side=i.FrontSide:t===C.BACK&&(this.material.side=i.BackSide)},enumerable:!1,configurable:!0}),r.prototype.getTexture=function(t){return this.textures[t]},r.prototype.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.prototype.getVector4Array=function(t){return this.uniforms[t].value},r.prototype.setVector4Array=function(t,e){var r,i,n=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s.toArray())}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(t,n)},r.prototype.getMatrixArray=function(t){return this.uniforms[t].value},r.prototype.setMatrixArray=function(t,e){var r,i,n=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s.elements)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(t,n)},r.prototype.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.prototype.getMatrix=function(t){return this.uniforms[t].value},r.prototype.setMatrix=function(t,e){this.setUniform(t,e)},r.prototype.setMatrix3=function(t,e){this.setUniform(t,e)},r.prototype.getVector2=function(t){return this.uniforms[t].value},r.prototype.setVector2=function(t,e){this.setUniform(t,e)},r.prototype.getVector3=function(t){return this.uniforms[t].value},r.prototype.setVector3=function(t,e){this.setUniform(t,e)},r.prototype.getVector4=function(t){return this.uniforms[t].value},r.prototype.setVector4=function(t,e){this.setUniform(t,e)},r.prototype.getQuaternion=function(t){return this.uniforms[t].value},r.prototype.setQuaternion=function(t,e){this.setUniform(t,e)},r.prototype.getFloat=function(t){return this.uniforms[t].value},r.prototype.setFloat=function(t,e){this.setUniform(t,e)},r.prototype.getFloats=function(t){return this.uniforms[t].value},r.prototype.setFloats=function(t,e){this.setUniform(t,e)},r.prototype.getInt=function(t){return this.uniforms[t].value},r.prototype.setInt=function(t,e){this.setUniform(t,e)},r.prototype.hasUniform=function(t){return!!this.uniforms[t]},r.prototype.setUniform=function(t,e){var r=new i.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=r},r.prototype.enableKeyword=function(t){throw new Error("Method not implemented.")},r.prototype.disableKeyword=function(t){throw new Error("Method not implemented.")},r.prototype.isKeywordEnabled=function(t){throw new Error("Method not implemented.")},r.prototype.clone=function(t){throw new Error("Method not implemented.")},r.prototype.cloneUniforms=function(t){throw new Error("Method not implemented.")},r.prototype.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},r}(ci),Zu=function(t){function e(e){var r=t.call(this,e)||this;return r.semantics.setSemantic(p),r.semantics.setSemantic(d),r.semantics.setSemantic(m),r.semantics.setSemantic(v),r}return o(e,t),e.prototype.setRenderPasses=function(t){this._renderPasses=tt(t.slice())},e.prototype.addRenderPass=function(t){et(this._renderPasses,t)},e.prototype.createResource=function(){this.resource={}},e.prototype.createCopyMesh=function(t){},e.prototype.addMeshToDefaultRenderPass=function(t){var e,r=t.material.material,n=r.uniforms,o=t.material.uniformSemantics;if(this.threeCamera){var a=this.threeCamera,s=(new i.Matrix4).multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse);e={effects_ObjectToWorld:t.mesh.matrixWorld,effects_MatrixV:a.matrixWorldInverse,effects_MatrixVP:s,effects_MatrixInvV:a.matrixWorld}}else{a=this.camera;e={effects_ObjectToWorld:t.worldMatrix.toArray(),effects_MatrixV:a.getViewMatrix().toArray(),effects_MatrixVP:a.getViewProjectionMatrix().toArray(),effects_MatrixInvV:a.getInverseViewMatrix().toArray()}}Object.keys(o).forEach((function(t){e[t]&&Yu(n,t,e[t])})),r.uniformsNeedUpdate=!0,this.group.add(t.mesh)},e.prototype.removeMeshFromDefaultRenderPass=function(t){this.group.remove(t.mesh)},e.prototype.updateMatrix=function(){var t=this.group,e=this.threeCamera;e&&t.children.forEach((function(t){var r=t.material,n=r.uniforms,o=(new i.Matrix4).multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);Yu(n,"effects_ObjectToWorld",t.matrixWorld),Yu(n,"effects_MatrixVP",o),r.uniformsNeedUpdate=!0}))},e.prototype.updateUniform=function(){var t=this.group,e=this.camera;t.children.forEach((function(t){var r=t.material;Yu(r.uniforms,"effects_MatrixInvV",e.getInverseViewMatrix().toArray()),Yu(r.uniforms,"effects_MatrixVP",e.getViewProjectionMatrix().toArray()),Yu(r.uniforms,"effects_MatrixV",e.getViewMatrix().toArray()),r.uniformsNeedUpdate=!0}))},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.group&&this.group.clear()},e}(fn),qu=function(e){function r(r,i){void 0===i&&(i={});var n=e.call(this)||this;if(r){var o=r.width,s=void 0===o?1:o,u=r.height,c=void 0===u?1:u;n.texture=n.createTextureByType(a(a({},i),{sourceType:t.TextureSourceType.data,data:r})),n.width=s,n.height=c}else n.texture=n.createTextureByType(i);return n.texture.needsUpdate=!0,n}return o(r,e),r.toThreeJsTextureFilter=function(t){return t===E.LINEAR?i.LinearFilter:i.NearestFilter},r.toThreeJsTextureWrap=function(t){switch(t){case E.MIRRORED_REPEAT:return i.MirroredRepeatWrapping;case E.REPEAT:return i.RepeatWrapping;default:return i.ClampToEdgeWrapping}},r.prototype.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.prototype.startVideo=function(){return s(this,void 0,void 0,(function(){var e;return u(this,(function(r){switch(r.label){case 0:return this.sourceType!==t.TextureSourceType.video?[3,2]:(e=this.texture.source.data).paused?[4,e.play()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r.prototype.assembleOptions=function(e){var n=e.target,o=void 0===n?E.TEXTURE_2D:n;return e.sourceType||(e.sourceType="image"in e?t.TextureSourceType.image:"data"in e?t.TextureSourceType.data:"video"in e?t.TextureSourceType.video:t.TextureSourceType.none),a(a({target:o,format:i.RGBAFormat,type:i.UnsignedByteType},e),{minFilter:r.toThreeJsTextureFilter(e.minFilter),magFilter:r.toThreeJsTextureFilter(e.magFilter),wrapS:r.toThreeJsTextureWrap(e.wrapS),wrapT:r.toThreeJsTextureWrap(e.wrapT)})},r.prototype.dispose=function(){this.texture.dispose()},r.prototype.createTextureByType=function(e){var r,n,o=this.assembleOptions(e),a=o.flipY,s=o.type,u=o.wrapS,c=o.wrapT,l=o.minFilter,h=o.magFilter,f=o.sourceType,p=i.UVMapping,d=o.format,m=void 0;if(this.sourceType=f,f===t.TextureSourceType.data){var v=e.data;m=new i.DataTexture(v.data,v.width,v.height,d,s,p,u,c,h,l),this.width=v.width,this.height=v.height}else if(f===t.TextureSourceType.image){var y=e.image;m=new i.Texture(y,p,u,c,h,l,d,s),this.width=y.width,this.height=y.height}else if(f===t.TextureSourceType.compressed){var x=0,g=0,T=e.mipmaps.map((function(t){var e=t.data,r=t.width,i=t.height;return x=x<r?r:x,g=g<i?i:g,{data:e,width:r,height:i,colorSpace:"srgb"}}));d=i.RGBA_ASTC_4x4_Format,m=new i.CompressedTexture(T,x,g,d,s,p,u,c,h,l),this.width=x,this.height=g}else if(f===t.TextureSourceType.video)m=new i.VideoTexture(e.video,p,u,c,h,l,d,s);else if(f===t.TextureSourceType.framebuffer){if(v=e.data){var E=null!==(r=v.width)&&void 0!==r?r:0,S=null!==(n=v.height)&&void 0!==n?n:0;m=new i.FramebufferTexture(E,S,d),this.width=E,this.height=S}}else f===t.TextureSourceType.none&&((m=new i.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=i.MirroredRepeatWrapping,m.wrapT=i.MirroredRepeatWrapping,this.width=this.height=1);if(m)return m.flipY=!!a,m;throw new Error("使用未知的数据类型创建纹理")},r}(Kr),Qu=function(t){function e(r,i){var n,o=t.call(this,r,i)||this;return null===(n=o.compositionSourceManager.sourceContent)||void 0===n||n.items.forEach((function(t){var r=t.content.renderer.shape;r&&Object.keys(r).forEach((function(t){var i=r[t];e.shape[t]||(e.shape[t]=0),e.shape[t]+=i.length}))})),o.content.start(),o}return o(e,t),e.prototype.createRenderFrame=function(){this.renderFrame=new Zu({camera:this.camera,keepColorBuffer:this.keepColorBuffer,renderer:this.renderer})},e.prototype.updateVideo=function(){this.textures.map((function(t){return t.startVideo()}))},e.prototype.updateCamera=function(){var t=this.renderFrame;t.threeCamera?t.updateMatrix():t.updateUniform()},e.prototype.getRendererOptions=function(){var t=qu.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return t.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:t,cachePrefix:"-"}),this.rendererOptions},e.shape={},e}(Du),Ku=1,Ju=function(t){function e(e,r){var n=this,o=r.drawStart,a=void 0===o?0:o,s=r.drawCount,u=r.indices,c=r.mode,l=r.name,h=void 0===l?"effectsGeometry:".concat(Ku++):l;(n=t.call(this,h)||this).attributes={},n.destroyed=!1,n.attributesName=[],n.mode=null!=c?c:E.TRIANGLES;var f=[],p={},d=new i.BufferGeometry;return Object.keys(r.attributes).forEach((function(t){var e=r.attributes[t];if("dataSource"in e){var o=e.dataSource;if(o){void 0===p[o]&&n.setAttributeType(o,e,d,p,r.maxVertex);var a=e.size,s=e.offset,u=e.normalize,c=p[o],l=c.buffer,h=c.dataLength,m=new i.InterleavedBufferAttribute(l,a,(null!=s?s:0)/h,u);d.setAttribute(t,m),p[t]={buffer:l,attribute:m,type:c.type,dataLength:h}}}else n.setAttributeType(t,e,d,p,r.maxVertex);f.push(t)})),u&&u.data&&d.setIndex(new i.BufferAttribute(u.data,1)),n.geometry=d,n.attributes=p,n.attributesName=f,n.drawStart=a,n.drawCount=null!=s?s:0,n}return o(e,t),Object.defineProperty(e.prototype,"drawCount",{get:function(){return this.geometry.drawRange.count},set:function(t){this.geometry.drawRange.count=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawStart",{get:function(){return this.geometry.drawRange.start},set:function(t){this.geometry.drawRange.start=t},enumerable:!1,configurable:!0}),e.prototype.getAttributeData=function(t){if(null!=this.attributes[t])return this.attributes[t].buffer.array},e.prototype.setAttributeData=function(t,e){if(null!=this.attributes[t]){var r=this.attributes[t].buffer;r.updateRange.count=e.length,r.updateRange.offset=0,r.set(e,0),this.geometry.attributes[t].needsUpdate=!0}},e.prototype.setAttributeSubData=function(t,e,r){null!=this.attributes[t]&&(this.attributes[t].buffer.set(r,e),this.geometry.attributes[t].needsUpdate=!0)},e.prototype.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*Si[e.type]},e.prototype.getAttributeNames=function(){return this.attributesName},e.prototype.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},e.prototype.setIndexData=function(t){t&&(this.geometry.setIndex(new i.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},e.prototype.setIndexSubData=function(t,e){var r=this.geometry.getIndex();if(null!==r){var i=t,n=t+e.length;if(r.count<n){var o=new e.constructor(end);o.set(r.array),r.array=o}r.array.set(e,i),this.geometry.index.needsUpdate=!0}},e.prototype.setDrawStart=function(t){this.drawStart=t},e.prototype.getDrawStart=function(){return this.drawStart},e.prototype.setDrawCount=function(t){this.drawCount=t},e.prototype.getDrawCount=function(){return this.drawCount},e.prototype.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},e.prototype.setAttributeType=function(t,e,r,n,o){var a,s=e,u=s.size,c=s.offset,l=s.normalize,h=s.type,f=void 0===h?E.FLOAT:h,p=e,d=p.stride,m=p.data;if(f&&!m&&(m=Ri(f)),m){d="aSprite"===t?12:null!=d?d:0;var v=m instanceof Float32Array?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,y=d/v;if(o){var x=o*d+(null!==(a=Qu.shape[t])&&void 0!==a?a:0);0===m.length&&(m=m instanceof Float32Array?new Float32Array(x):new Uint16Array(x))}var g=new i.InterleavedBuffer(m,y),T=new i.InterleavedBufferAttribute(g,u,(null!=c?c:0)/v,l);r.setAttribute(t,T),n[t]={buffer:g,attribute:T,type:f,dataLength:v}}},e}(bi),$u=function(e){function r(t,r){var n=this,o=r.material,a=r.geometry,s=r.priority,u=void 0===s?0:s;return(n=e.call(this,t,r)||this).geometry=a,n.material=o,a.mode===E.LINES?n.mesh=new i.LineSegments(a.geometry,o.material):n.mesh=new i.Mesh(a.geometry,o.material),n.worldMatrix=n.mesh.matrixWorld,n.priority=u,n}return o(r,e),Object.defineProperty(r.prototype,"priority",{get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)},enumerable:!1,configurable:!0}),r.prototype.setVisible=function(t){this.mesh.visible=t},r.prototype.getVisible=function(){return this.mesh.visible},r.prototype.firstGeometry=function(){return this.geometry},r.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e,this.mesh.material=e.material},r.prototype.restore=function(){},r.prototype.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},r}(Ii),tc=function(t){function e(e){var r=t.call(this)||this;return r.gpuCapability=new xn(e),r}return o(e,t),e}(Uu),ec=function(t){function e(e){var r=t.call(this)||this;return r.engine=new tc(e),r}return o(e,t),e}(_n),rc=function(t){function e(e,r){var i=t.call(this)||this,n=r.width,o=r.height,a=r.camera;return i.renderer=new ec(e),i.width=n,i.height=o,i.camera=a,i}return o(e,t),Object.defineProperty(e.prototype,"currentComposition",{get:function(){return this.compositions[0]},enumerable:!1,configurable:!0}),e.prototype.loadScene=function(t,e){return s(this,void 0,void 0,(function(){var e,r;return u(this,(function(i){switch(i.label){case 0:return[4,new Lu({}).loadScene(t)];case 1:return e=i.sent(),(r=new Qu({renderer:this.renderer,width:this.width,height:this.height},e)).renderFrame.group=this,r.renderFrame.threeCamera=this.camera,this.compositions=[r],[2]}}))}))},e.prototype.update=function(t){this.compositions.forEach((function(e){e.update(t)}))},e}(i.Group);Dn(8),Kr.create=function(t,e){return new qu(void 0,e)},Kr.createWithData=function(t,e,r){return new qu(e,r)},ci.create=function(t,e){return new Wu(t,e)},bi.create=function(t,e){return new Ju(t,e)},Ii.create=function(t,e){return new $u(t,e)};var ic="0.0.0-experimental-downgrade628-20240904";tr.info("THREEJS plugin version: "+ic),t.AbstractPlugin=Er,t.AssetManager=Lu,t.BYTES_TYPE_MAP=Si,t.BezierCurve=De,t.BezierCurvePath=Ue,t.COMPRESSED_TEXTURE=Sn,t.CONSTANT_MAP_BLEND=ku,t.CONSTANT_MAP_DEPTH=Hu,t.CONSTANT_MAP_STENCIL_FUNC=Gu,t.CONSTANT_MAP_STENCIL_OP=Xu,t.COPY_FRAGMENT_SHADER=mi,t.COPY_MESH_SHADER_ID=pi,t.COPY_VERTEX_SHADER=di,t.CalculateItem=jn,t.CalculateLoader=Ra,t.CalculateVFXItem=_a,t.Camera=us,t.CameraController=Sr,t.CameraVFXItem=Rr,t.CameraVFXItemLoader=br,t.Composition=Du,t.CompositionSourceManager=wu,t.DEFAULT_FONTS=Na,t.Downloader=Gr,t.EFFECTS_COPY_MESH_NAME=fi,t.EVENT_TYPE_CLICK=Cr,t.EVENT_TYPE_TOUCH_END=Mr,t.EVENT_TYPE_TOUCH_MOVE=Or,t.EVENT_TYPE_TOUCH_START=wr,t.Engine=Uu,t.EventSystem=Ir,t.FILTER_NAME_NONE=x,t.FilterSpriteVFXItem=Jn,t.Float16ArrayWrapper=Jt,t.FrameBuffer=Rn,t.GPUCapability=xn,t.Geometry=bi,t.GlobalUniforms=mn,t.GradientValue=Ne,t.HELP_LINK=g,t.InteractBehavior=Lr,t.InteractItem=Ln,t.InteractLoader=Mn,t.InteractMesh=Cn,t.InteractVFXItem=wn,t.KTXTexture=$r,t.LineSegments=ze,t.LinearValue=Fe,t.Material=ci,t.MaterialDataBlock=ni,t.Mesh=Ii,t.PLAYER_OPTIONS_ENV_EDITOR=y,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleLoader=ba,t.ParticleMesh=ya,t.ParticleSystem=ia,t.ParticleVFXItem=ma,t.PassTextureCache=Ti,t.PluginSystem=xr,t.QCanvasViewer=La,t.QText=Ma,t.RENDER_PASS_NAME_PREFIX=ln,t.RENDER_PREFER_LOOKUP_TEXTURE=_i,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=Ie,t.RandomValue=Pe,t.RandomVectorValue=Ve,t.RenderBuffer=vn,t.RenderFrame=fn,t.RenderPass=zi,t.RenderPassPriorityNormal=Pi,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=Fi,t.Renderer=_n,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0=m,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0=v,t.SEMANTIC_PRE_COLOR_ATTACHMENT_0=p,t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0=d,t.SPRITE_VERTEX_STRIDE=f,t.SemanticMap=Ei,t.Shader=hi,t.SpriteItem=qn,t.SpriteLoader=Xn,t.SpriteMesh=Pn,t.SpriteVFXItem=Qn,t.StaticValue=Le,t.TEMPLATE_USE_OFFSCREEN_CANVAS=Ai,t.TEXTURE_UNIFORM_MAP=ju,t.TextItem=Za,t.TextLoader=Qa,t.TextMesh=Aa,t.TextVFXItem=qa,t.Texture=Kr,t.TextureFactory=ri,t.ThreeComposition=Qu,t.ThreeDisplayObject=rc,t.ThreeMaterial=Wu,t.ThreeTexture=qu,t.Ticker=Bu,t.TimelineComponent=Qe,t.Transform=hr,t.VFXItem=fr,t.ValueGetter=Me,t.addByOrder=et,t.addItem=G,t.addItemWithOrder=H,t.alphaFrameFrag=Hi,t.alphaMaskFrag=Yi,t.assertExist=nt,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",t.bloomMixVert=Qi,t.bloomThresholdVert=Ki,t.calculateTranslation=re,t.cameraMoveFrag="uniform vec2 uMoveTexSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uMoveTexSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uMoveTexSize,(coordMin+vec2(1.))/uMoveTexSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 cB=mix(cLB,cRB,pp.x);vec4 cT=mix(cLT,cRT,pp.x);return mix(cB,cT,pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}",t.cameraMoveVert=ji,t.canvasPool=Ba,t.colorGradingFrag=$i,t.colorStopsFromGradient=Z,t.colorToArr=j,t.combineImageTemplate=ja,t.combineImageTemplate1=Pa,t.combineImageTemplate1Async=function(t,e,r,i,n){return s(this,void 0,void 0,(function(){return u(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,Pa(t,e,r,i,n)]}))}))},t.combineImageTemplate2=Ya,t.combineImageTemplate2Async=function(t,e,r,i,n){return s(this,void 0,void 0,(function(){return u(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,Ya(t,e,r,i,n)]}))}))},t.combineImageTemplateAsync=function(t,e,r,i,n){return s(this,void 0,void 0,(function(){return u(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,ja(t,e,r,i,n)]}))}))},t.compatibleFrag="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n",t.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",t.convertAnchor=ce,t.copyFrag=li,t.createCopyShader=vi,t.createFilter=k,t.createFilterShaders=B,t.createGLContext=function(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"===e&&((i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i},t.createKeyFrameMeta=Ye,t.createShaderWithMarcos=Dr,t.createShape=yo,t.createVFXItem=pr,t.createValueGetter=ke,t.decimalEqual=pe,t.deepClone=function t(e){if(ir(e))return e.map(t);if(e&&"object"==typeof e){if(ArrayBuffer.isView(e))return e.slice();for(var r={},i=Object.keys(e),n=0;n<i.length;n++){var o=i[n];r[o]=t(e[o])}return r}return e},t.defaultGlobalVolume=cn,t.defaultPlugins=mr,t.delayFrag=Wi,t.deserializeMipmapTexture=Zr,t.distortionFrag=Zi,t.distortionVert=qi,t.earcut=Bo,t.enlargeBuffer=Y,t.ensureVec3=ie,t.filters=Ts,t.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=tn,t.gaussianDownVFrag=en,t.gaussianUpFrag=rn,t.generateEmptyTypedArray=Ri,t.generateHalfFloatTexture=Jr,t.getBackgroundImage=ka,t.getColorFromGradientStops=W,t.getConfig=wi,t.getDefaultTemplateCanvasPool=function(){return Ba},t.getDefaultTextureFactory=function(){return ei||(ei=new ri),ei},t.getGeometryByShape=jo,t.getGeometryTriangles=Yo,t.getImageItemRenderInfo=Vn,t.getKTXTextureOptions=ti,t.getKeyFrameMetaByRawValue=He,t.getParticleMeshShader=Ta,t.getPixelRatio=function(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0),e=screen.width/t;return Math.min(2*e,2)}return 1},t.getPreMultiAlpha=Vr,t.getStandardComposition=Tu,t.getStandardImage=gu,t.getStandardItem=Ru,t.getStandardJSON=yu,t.getTextureSize=pn,t.glContext=E,t.gpuTimer=function(t){var e=this,r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=t.createQuery(),n=function(){return s(e,void 0,void 0,(function(){return u(this,(function(e){return[2,new Promise((function(e,o){if(i){var a=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(r.GPU_DISJOINT_EXT);if(a&&!s){var u=t.getQueryParameter(i,t.QUERY_RESULT);e(u/1e3/1e3)}(a||s)&&(t.deleteQuery(i),i=null),null!==a&&i&&window.setTimeout((function(){n().then(e).catch}),1)}}))]}))}))};if(!i)return;return{begin:function(){i&&t.beginQuery(r.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(r.TIME_ELAPSED_EXT)},getTime:n}}},t.imageDataFromColor=function(t){rr(t)&&(t=j(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r},t.imageDataFromGradient=$,t.initErrors=T,t.initGLContext=S,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=q,t.isAlipayMiniApp=function(){return"undefined"!=typeof my&&"web"===(null===my||void 0===my?void 0:my.renderTarget)},t.isAndroid=K,t.isArray=ir,t.isFunction=nr,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=or,t.isScene=Ou,t.isSimulatorCellPhone=J,t.isString=rr,t.isUniformStruct=oi,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&oi(t[0])},t.isValidFontFamily=ot,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.itemFrag=Bi,t.itemFrameFrag=Di,t.itemVert=Ui,t.loadBinary=jr,t.loadBlob=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,new Promise((function(e,r){(new Gr).downloadBlob(t,e,(function(e,i){r("Couldn't load blob ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))},t.loadImage=Yr,t.loadMedia=Ga,t.loadVideo=Wr,t.loadWebPOptional=Hr,t.logger=tr,t.math=Qt,t.modifyMaxKeyframeShader=Ea,t.nearestPowerOfTwo=le,t.noop=er,t.numberToFix=de,t.parsePercent=Q,t.particleFrag=ki,t.particleOriginTranslateMap=ue,t.particleUniformTypeMap=va,t.particleVert=Gi,t.pluginLoaderMap=dr,t.pointOnLine=function(t,e,r,i,n,o){var a=t*i+e*n+r*o-n*i-o*t-r*e;return a>-.001&&a<.001},t.random=ar,t.registerFilter=D,t.registerFilters=U,t.registerPlugin=yr,t.removeItem=X,t.requestAsync=Ia,t.rotateVec2=Wo,t.screenMeshVert=Ji,t.setBlendMode=Ur,t.setConfig=function(t,e){return Ci[t]=e},t.setDefaultTextureFactory=function(t){ei=t},t.setMaskMode=kr,t.setMaxSpriteMeshItemCount=Dn,t.setRayFromCamera=he,t.setSideMode=Br,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=function(e){return t.maxSpriteTextureCount=Math.min(e.maxFragmentTextures,16),e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void(t.maxSpriteTextureCount=8)},t.setUniformValue=Yu,t.sortByOrder=tt,t.spec=Rt,t.spriteMeshShaderFromFilter=Fn,t.spriteMeshShaderFromRenderInfo=zn,t.spriteMeshShaderIdFromRenderInfo=Nn,t.thresholdFrag=nn,t.throwDestroyedError=sr,t.trailVert=Xi,t.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},t.trianglesFromRect=fe,t.unregisterPlugin=function(t){delete vr[t],delete dr[t],X(mr,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecAssign=oe,t.vecFill=ne,t.vecMulCombine=se,t.vecNormalize=ae,t.version=ic,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
6
|
+
* Version: v0.0.0-experimental-20250807
|
|
7
|
+
*/function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,function(t,e){"use strict";var i,r,n,a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,O,I,M,R,P,N,V,L,F,D,k,z,U,B,G,j,X,W,H,Y,Z,q,Q,K,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,th,tl,tc,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tC,tS,tA,tw,tO,tI,tM,tR,tP,tN,tV,tL,tF,tD,tk,tz,tU,tB,tG,tj,tX,tW,tH,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,ea,eo,es,eu,eh,el,ec,ef,ed,ep,em,ev,ey,eg,ex,eb,eT,eE,e_,eC=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}(e);function eS(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function eA(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var a=t.apply(e,i);function o(t){eS(a,r,n,o,s,"next",t)}function s(t){eS(a,r,n,o,s,"throw",t)}o(void 0)})}}function ew(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function eO(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return ew(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);if("Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return ew(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function eI(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):eI(t,e)}function eM(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function eR(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o}function eP(t,e){var i,r,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(i)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var eN=new Uint8Array(16),eV=[],eL=0;eL<256;++eL)eV.push((eL+256).toString(16).slice(1));var eF={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function eD(t,e){return t.includes(e)||t.push(e),t}function ek(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function ez(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(a);return o.set(t),o}return t}function eU(t,e){var i=[0,0,0,0];if(e8(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eI(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function eB(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.stop<=e&&e<=o.stop){r=ej(a.color,o.color,(e-a.stop)/(o.stop-a.stop));break}}return r||(r=t[t.length-1].color),i?r.map(function(t){return t/255}):r}return[0,0,0,0]}function eG(t){var e=[];if(eI(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4];e.push({stop:eX(i),color:[r,n,a,o]})}):Object.keys(t).forEach(function(i){var r=eU(t[i]);e.push({stop:eX(i),color:r})}),(e=e.sort(function(t,e){return t.stop-e.stop})).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var i=e[e.length-1];1!==i.stop&&e.push({stop:1,color:i.color.slice()})}return e}function ej(t,e,i,r){var n=[],a=1-i;if(r)for(var o=0;o<4;o++)n[o]=t[o]*a+e[o]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*a+e[s]*e[s]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function eX(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}var eW="undefined"!=typeof window;function eH(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function eY(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eZ(){return/\bOpenHarmony\b/.test(navigator.userAgent)}function eq(){return eY()||eZ()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eQ(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eK(){return"miniprogram"===window.__wxjs_environment}function eJ(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=eG(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var a=n/128,o=void 0,s=void 0,u=0;u<r.length&&(o=r[u],s=r[u+1],!(o.stop<=a)||!(s.stop>a));u++);var h=ej(o.color,s.color,(a-o.stop)/(s.stop-o.stop));i.set(h,4*n)}i.set(r[r.length-1].color,508)}return e}function e$(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(!(i<=30))return function t(e,i,r,n){if(void 0===r&&(r=0),void 0===n&&(n=e.length-1),r>=n)return e;for(var a,o,s=e[r],u=r,h=n;u<h;){if(2===i){for(;e[h].priority>s.priority&&h>=u;)h--;for(;e[u].priority<=s.priority&&u<h;)u++}else{for(;e[h].priority<s.priority&&h>=u;)h--;for(;e[u].priority>=s.priority&&u<h;)u++}a=[e[h],e[u]],e[u]=a[0],e[h]=a[1]}return o=[e[u],e[r]],e[r]=o[0],e[u]=o[1],t(e,i,r,u-1),t(e,i,h+1,n),e}(t,e);for(var r=1;r<i;r++)e1(t,r,e);return t}function e0(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&e1(t,t.length-1,i)),t}function e1(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function e2(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function e3(t){return/^[^\d.][\w-]*$/.test(t)}function e4(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(i=t.OrderType||(t.OrderType={}))[i.none=1]="none",i[i.ascending=2]="ascending",i[i.descending=3]="descending";var e5={error:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).error.apply(e,[].concat(e4(t),[r])),null==tA||tA("error",t,r)},info:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(e4(t))),null==tA||tA("info",t,r)},warn:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(e4(t))),null==tA||tA("warn",t,r)},register:function(t){t&&e7(t)&&(tA=t)}};function e6(){}function e8(t){return"string"==typeof t}t.DestroyOptions=void 0,(r=t.DestroyOptions||(t.DestroyOptions={}))[r.destroy=0]="destroy",r[r.keep=1]="keep",r[r.force=0]="force";var e9=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function e7(t){return"[object Function]"===Object.prototype.toString.call(t)}function it(t){return"[object Object]"===Object.prototype.toString.call(t)}function ie(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function ii(t,e){return t+Math.random()*(e-t)}function ir(){throw Error("Destroyed item cannot be used again.")}function ia(){return(function(t,e,i){if(eF.randomUUID&&!t)return eF.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tS&&!(tS="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tS(eN)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),eV[n[r+0]]+eV[n[r+1]]+eV[n[r+2]]+eV[n[r+3]]+"-"+eV[n[r+4]]+eV[n[r+5]]+"-"+eV[n[r+6]]+eV[n[r+7]]+"-"+eV[n[r+8]]+eV[n[r+9]]+"-"+eV[n[r+10]]+eV[n[r+11]]+eV[n[r+12]]+eV[n[r+13]]+eV[n[r+14]]+eV[n[r+15]]})().replace(/-/g,"")}function io(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],a=0;a<r.length;a+=512){for(var o=r.slice(a,a+512),s=Array(o.length),u=0;u<o.length;u++)s[u]=o.charCodeAt(u);var h=new Uint8Array(s);n.push(h)}return new File([new Blob(n,{type:i})],e,{type:i})}function is(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}var iu={},ih=[],il={};function ic(t,e,i){il[t]&&e5.error("Duplicate registration for plugin "+t+"."),il[t]=i,iu[t]=e,eD(ih,t)}var id=function(){function t(t){var e={},i=[];ih.forEach(function(t){var r=iu[t];i.includes(r)||(i.push(r),e[t]=r)});for(var r,n=eO(t);!(r=n()).done;){var a=r.value;if(!iu[a])throw Error("The plugin '"+a+"' not found."+function(t){var e=ip[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+"'":""}(a))}this.plugins=Object.keys(e).map(function(t){var e=new iu[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(i){return i.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(i){return i.onCompositionReset(t,e)})},e.processRawJSON=function(t,e){var i=this;return eA(function(){return eP(this,function(r){return[2,i.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var i=this;return eA(function(){return eP(this,function(r){return[2,i.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e){for(var i,r=eO(this.plugins);!(i=r()).done;)i.value.precompile(t,e)},e.loadResources=function(t,e){var i=this;return eA(function(){return eP(this,function(r){return[2,i.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n=this;return eA(function(){var e,r,a,o,s,u;return eP(this,function(h){for(a=0,e=[],r=n.plugins;a<r.length;a++)t in(o=iu[r[a].name])&&e.push(Promise.resolve(null==(u=o[t])?void 0:(s=u).call.apply(s,[].concat([o],i))));return[2,Promise.all(e)]})})()},t}(),ip={"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"},im=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 iv(t,e){return(iv=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function iy(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&iv(t,e)}(n=tw||(tw={}))["1_0"]="1.0",n["1_1"]="1.1",n["1_2"]="1.2",n["1_3"]="1.3",n["1_5"]="1.5",n["1_8"]="1.8",n["2_0"]="2.0",n["2_1"]="2.1",n["2_2"]="2.2",n["2_3"]="2.3",n["2_4"]="2.4",n["3_0"]="3.0",n["3_1"]="3.1",n["3_2"]="3.2",n["3_3"]="3.3",n["3_4"]="3.4",n.LATEST="3.4",(a=tO||(tO={})).S="S",a.APlus="A+",a.A="A",a.BPlus="B+",a.B="B",(o=tI||(tI={}))[o.ALPHA=0]="ALPHA",o[o.ADD=1]="ADD",o[o.MULTIPLY=2]="MULTIPLY",o[o.BRIGHTNESS=3]="BRIGHTNESS",o[o.SUBTRACTION=4]="SUBTRACTION",o[o.STRONG_LIGHT=5]="STRONG_LIGHT",o[o.WEAK_LIGHT=6]="WEAK_LIGHT",o[o.SUPERPOSITION=7]="SUPERPOSITION",(s=tM||(tM={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tR||(tR={}))[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(h=tP||(tP={}))[h.NONE=0]="NONE",h[h.SPHERE=1]="SPHERE",h[h.CONE=2]="CONE",h[h.HEMISPHERE=3]="HEMISPHERE",h[h.CIRCLE=4]="CIRCLE",h[h.DONUT=5]="DONUT",h[h.RECTANGLE=6]="RECTANGLE",h[h.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",h[h.EDGE=8]="EDGE",h[h.TEXTURE=9]="TEXTURE",(l=tN||(tN={}))[l.GYROSCOPE=0]="GYROSCOPE",l[l.SPINE=1]="SPINE",(c=tV||(tV={}))[c.CLICK=0]="CLICK",c[c.MESSAGE=1]="MESSAGE",c[c.DRAG=2]="DRAG",(f=tL||(tL={}))[f.NONE=0]="NONE",f[f.NOTIFY=1]="NOTIFY",f[f.RESUME_PLAYER=2]="RESUME_PLAYER",f[f.REMOVE=3]="REMOVE",f[f.PAUSE=4]="PAUSE",(d=tF||(tF={})).base="0",d.sprite="1",d.particle="2",d.null="3",d.interact="4",d.plugin="5",d.camera="6",d.composition="7",d.spine="spine",d.mesh="mesh",d.tree="tree",d.text="text",d.light="light",d.skybox="skybox",d.effect="effect",d.shape="shape",d.postProcessVolume="postProcessVolume",d.node="node",d.video="video",d.audio="audio",d.richtext="richtext",(p=tD||(tD={}))[p.BILLBOARD=0]="BILLBOARD",p[p.MESH=1]="MESH",p[p.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",p[p.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(m=tk||(tk={}))[m.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",m[m.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",m[m.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",m[m.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",m[m.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",m[m.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",m[m.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",m[m.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",m[m.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(v=tz||(tz={})).Opaque="Opaque",v.Transparent="Transparent",(y=tU||(tU={})).Both="Both",y.Back="Back",y.Front="Front",(g=tB||(tB={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=tG||(tG={}))[x.CONSTANT=0]="CONSTANT",x[x.CONSTANT_VEC2=1]="CONSTANT_VEC2",x[x.CONSTANT_VEC3=2]="CONSTANT_VEC3",x[x.CONSTANT_VEC4=3]="CONSTANT_VEC4",x[x.RANDOM=4]="RANDOM",x[x.LINE=5]="LINE",x[x.CURVE=6]="CURVE",x[x.BEZIER_PATH=7]="BEZIER_PATH",x[x.RGBA_COLOR=8]="RGBA_COLOR",x[x.GRADIENT_COLOR=9]="GRADIENT_COLOR",x[x.SHAPE_POINTS=10]="SHAPE_POINTS",x[x.SHAPE_SPLITS=11]="SHAPE_SPLITS",x[x.LINEAR_PATH=12]="LINEAR_PATH",x[x.COLORS=13]="COLORS",x[x.BINARY=20]="BINARY",x[x.BEZIER_CURVE=21]="BEZIER_CURVE",x[x.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",x[x.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",x[x.COLOR_CURVE=24]="COLOR_CURVE",x[x.VECTOR4_CURVE=25]="VECTOR4_CURVE",x[x.VECTOR2_CURVE=26]="VECTOR2_CURVE",x[x.VECTOR3_CURVE=27]="VECTOR3_CURVE",(b=tj||(tj={}))[b.AUTO=0]="AUTO",b[b.EASE=1]="EASE",b[b.EASE_IN=2]="EASE_IN",b[b.EASE_OUT=3]="EASE_OUT",b[b.LINE=4]="LINE",b[b.HOLD=5]="HOLD",b[b.LINE_OUT=6]="LINE_OUT",(T=tX||(tX={}))[T.destroy=0]="destroy",T[T.restart=5]="restart",T[T.forward=2]="forward",T[T.freeze=4]="freeze",(E=tW||(tW={}))[E.none=0]="none",E[E.removeParticle=1]="removeParticle",(_=tH||(tH={}))[_.RANDOM=0]="RANDOM",_[_.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",_[_.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",_[_.UNIFORM_BURST=3]="UNIFORM_BURST",(C=tY||(tY={})).point="point",C.spot="spot",C.directional="directional",C.ambient="ambient",(S=tZ||(tZ={}))[S.box=2]="box",S[S.sphere=3]="sphere",(A=tq||(tq={})).orthographic="orthographic",A.perspective="perspective",(w=tQ||(tQ={})).unlit="unlit",w.pbr="pbr",w.hair="hair",(O=tK||(tK={}))[O.opaque=100]="opaque",O[O.masked=101]="masked",O[O.translucent=102]="translucent",O[O.additive=103]="additive",(I=tJ||(tJ={})).none="none",I.uv="uv",I.normal="normal",I.basecolor="basecolor",I.alpha="alpha",I.metallic="metallic",I.roughness="roughness",I.ao="ao",I.emissive="emissive",I.diffuse="diffuse",(M=t$||(t$={}))[M.display=0]="display",M[M.clip=1]="clip",M[M.ellipsis=2]="ellipsis",(R=t0||(t0={}))[R.top=0]="top",R[R.middle=1]="middle",R[R.bottom=2]="bottom",(P=t1||(t1={}))[P.left=0]="left",P[P.middle=1]="middle",P[P.right=2]="right",(N=t2||(t2={})).normal="normal",N.bold="bold",N.lighter="lighter",(V=t3||(t3={})).normal="normal",V.italic="italic",V.oblique="oblique";var ig={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(L=t4||(t4={}))[L.Custom=0]="Custom",L[L.Rectangle=1]="Rectangle",L[L.Ellipse=2]="Ellipse",L[L.Polygon=3]="Polygon",L[L.Star=4]="Star",(F=t5||(t5={}))[F.Butt=0]="Butt",F[F.Round=1]="Round",F[F.Square=2]="Square",(D=t6||(t6={}))[D.Round=0]="Round",D[D.Bevel=1]="Bevel",D[D.Miter=2]="Miter",(k=t8||(t8={})).AnimationClipNodeData="AnimationClipNodeData",k.BlendNodeData="BlendNodeData",k.ApplyAdditiveNodeData="ApplyAdditiveNodeData",k.LayerBlendNodeData="LayerBlendNodeData",k.StateMachineNodeData="StateMachineNodeData",k.TransitionNodeData="TransitionNodeData",k.StateNodeData="StateNodeData",k.ConstFloatNodeData="ConstFloatNodeData",k.ConstBoolNodeData="ConstBoolNodeData",k.ControlParameterBoolNodeData="ControlParameterBoolNodeData",k.ControlParameterFloatNodeData="ControlParameterFloatNodeData",k.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",k.NotNodeData="NotNodeData",k.AndNodeData="AndNodeData",k.OrNodeData="OrNodeData",k.EqualNodeData="EqualNodeData",k.GreaterNodeData="GreaterNodeData",k.LessNodeData="LessNodeData",(z=t9||(t9={})).video="video",z.image="image",(U=t7||(t7={})).video="video",U.audio="audio",(B=et||(et={})).VFXItemData="VFXItemData",B.Material="Material",B.Shader="Shader",B.Geometry="Geometry",B.Texture="Texture",B.Image="Image",B.AnimationClip="AnimationClip",B.BinaryAsset="BinaryAsset",B.TrackAsset="TrackAsset",B.TimelineAsset="TimelineAsset",B.ObjectBindingTrack="ObjectBindingTrack",B.TransformTrack="TransformTrack",B.SpriteColorTrack="SpriteColorTrack",B.ActivationTrack="ActivationTrack",B.SubCompositionTrack="SubCompositionTrack",B.FloatPropertyTrack="FloatPropertyTrack",B.ColorPropertyTrack="ColorPropertyTrack",B.Vector2PropertyTrack="Vector2PropertyTrack",B.Vector4PropertyTrack="Vector4PropertyTrack",B.TransformPlayableAsset="TransformPlayableAsset",B.SpriteColorPlayableAsset="SpriteColorPlayableAsset",B.ActivationPlayableAsset="ActivationPlayableAsset",B.SubCompositionPlayableAsset="SubCompositionPlayableAsset",B.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",B.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",B.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",B.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",B.MeshComponent="MeshComponent",B.SkyboxComponent="SkyboxComponent",B.LightComponent="LightComponent",B.CameraComponent="CameraComponent",B.ModelPluginComponent="ModelPluginComponent",B.TreeComponent="TreeComponent",B.AnimationComponent="AnimationComponent",B.SpineComponent="SpineComponent",B.VideoComponent="VideoComponent",B.AudioComponent="AudioComponent",B.RichTextComponent="RichTextComponent",B.OrientationComponent="OrientationComponent",B.ShapeComponent="ShapeComponent",B.SpriteComponent="SpriteComponent",B.ParticleSystem="ParticleSystem",B.InteractComponent="InteractComponent",B.CameraController="CameraController",B.PostProcessVolume="PostProcessVolume",B.EffectComponent="EffectComponent",B.TextComponent="TextComponent",B.AnimationGraphAsset="AnimationGraphAsset",B.Animator="Animator",B.TimelineClip="TimelineClip",(G=ee||(ee={}))[G.POINTS=0]="POINTS",G[G.LINES=1]="LINES",G[G.LINE_LOOP=2]="LINE_LOOP",G[G.LINE_STRIP=3]="LINE_STRIP",G[G.TRIANGLES=4]="TRIANGLES",G[G.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",G[G.TRIANGLE_FAN=6]="TRIANGLE_FAN",(j=ei||(ei={}))[j.Float16=0]="Float16",j[j.Float32=1]="Float32",j[j.Int8=2]="Int8",j[j.Int16=3]="Int16",j[j.Int32=4]="Int32",j[j.UInt8=5]="UInt8",j[j.UInt16=6]="UInt16",j[j.UInt32=7]="UInt32",(X=er||(er={}))[X.None=-1]="None",X[X.UInt8=0]="UInt8",X[X.UInt16=1]="UInt16",X[X.UInt32=2]="UInt32",(W=en||(en={})).Position="POSITION",W.Uv="TEXCOORD0",W.Uv2="TEXCOORD1",W.Normal="NORMAL",W.Tangent="TANGENT",W.Color="COLOR",W.Joints="JOINTS",W.Weights="WEIGHTS",W.PositionBS0="POSITION_BS0",W.PositionBS1="POSITION_BS1",W.PositionBS2="POSITION_BS2",W.PositionBS3="POSITION_BS3",W.PositionBS4="POSITION_BS4",W.PositionBS5="POSITION_BS5",W.PositionBS6="POSITION_BS6",W.PositionBS7="POSITION_BS7",W.NormalBS0="NORMAL_BS0",W.NormalBS1="NORMAL_BS1",W.NormalBS2="NORMAL_BS2",W.NormalBS3="NORMAL_BS3",W.TangentBS0="TANGENT_BS0",W.TangentBS1="TANGENT_BS1",W.TangentBS2="TANGENT_BS2",W.TangentBS3="TANGENT_BS3";var ix=Object.freeze({__proto__:null,LATEST_VERSION:tw.LATEST,get RenderLevel(){return tO},get BlendingMode(){return tI},get SideMode(){return tM},get ObscuredMode(){return tR},get ParticleEmitterShapeType(){return tP},get PluginType(){return tN},get InteractType(){return tV},get InteractBehavior(){return tL},get ItemType(){return tF},get RenderMode(){return tD},get ParticleOrigin(){return tk},get RenderType(){return tz},get RenderFace(){return tU},get CameraClipMode(){return tB},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:0,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return tG},get BezierKeyframeType(){return tj},get JSONSceneVersion(){return tw},get EndBehavior(){return tX},get ParticleInteractionBehavior(){return tW},get ShapeArcMode(){return tH},get LightType(){return tY},get ModelBoundingType(){return tZ},get CameraType(){return tq},get MaterialType(){return tQ},get MaterialBlending(){return tK},get RenderMode3D(){return tJ},get TextOverflow(){return t$},get TextBaseline(){return t0},get TextAlignment(){return t1},get TextWeight(){return t2},get FontStyle(){return t3},BuiltinObjectGUID:ig,get ShapePrimitiveType(){return t4},get LineCap(){return t5},get LineJoin(){return t6},get NodeDataType(){return t8},get BackgroundType(){return t9},get MultimediaType(){return t7},get DataType(){return et},get GeometryType(){return ee},get VertexFormatType(){return ei},get IndexFormatType(){return er},get VertexBufferSemantic(){return en}}),ib=new Map,iT=new Map,iE={};function i_(t){return function(e,i){iE[t]&&console.warn("Class "+t+" is already registered."),iE[t]=e}}function iC(t){var e=t.constructor;if(iT.get(e))return iT.get(e);var i={};iT.set(e,i);for(var r=t,n=e;n;){var a=ib.get(n);for(var o in a)i[o]=a[o];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function iS(t,e){return function(i,r){var n,a=(n=i.constructor,ib.get(n)||ib.set(n,{}),ib.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var iA=function(){function t(t){this.engine=t,this.guid=ia(),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 eI(e,t)&&"guid"in e},t}(),iw=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),iO={};function iI(t){return function(e,i){iO[t]&&console.warn("NodeData Class "+t+" is already registered."),iO[t]=e}}var iM=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw Error("Node still initialized!");this.lastUpdateID=-1},t}(),iR=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i},t}(),iP=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.previousTime=0,e.currentTime=0,e}iy(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(iM),iN=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.setValue=function(t){},e}(iM),iV=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(iN),iL=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(iN);t.AnimationGraphAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.nodeDatas=[],e.graphDataSet=new iw,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=-1,e}return iy(e,t),e.prototype.fromData=function(t){var i=t.nodeDatas;this.rootNodeIndex=t.rootNodeIndex,this.controlParameterIDs=t.controlParameterIDs;for(var r=t.controlParameterIDs.length,n=0;n<r;n++)this.parameterLookupMap.set(t.controlParameterIDs[n],n);this.nodeDatas=[];for(var a=0;a<i.length;a++)this.nodeDatas[a]=e.createNodeData(i[a].type),this.nodeDatas[a].load(i[a]);this.graphDataSet=new iw,this.graphDataSet.resources=[];for(var o,s=eO(t.graphDataSet.resources);!(o=s()).done;){var u=o.value,h=this.engine.findObject(u);this.graphDataSet.resources.push(h)}},e.createNodeData=function(t){var e=iO[t];if(e)return new e;throw Error("Unknown node type: "+t+".")},e}(iA),t.AnimationGraphAsset=eR([i_("AnimationGraphAsset")],t.AnimationGraphAsset),(H=ea||(ea={}))[H.Active=0]="Active",H[H.Inactive=1]="Inactive";var iF=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),iD=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t].asset=this.nodeDatas[t],this.nodes[t]):null},t}();function ik(){return(ik=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}var iz=Math.PI/180,iU=180/Math.PI;function iB(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var iG=function(t,e,i){return(1-i)*t+i*e};function ij(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i;return Math.min(Math.max(t,Math.min(r,n)),Math.max(r,n))}t.AnimationClipNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(iX,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=ik({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(iR),t.AnimationClipNodeData=eR([iI(t8.AnimationClipNodeData)],t.AnimationClipNodeData);var iX=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.animation=null,e.animatable=null,e}iy(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=ij(this.currentTime,0,1);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new iW(e.skeleton,this.animation))},e}(iP);(Y=eo||(eo={}))[Y.Position=0]="Position",Y[Y.Scale=1]="Scale",Y[Y.Rotation=2]="Rotation",Y[Y.Euler=3]="Euler";var iW=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=eO(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,o=eO(e.scaleCurves);!(a=o()).done;){var s=a.value;this.addTransformCurveInfo(s,1)}for(var u,h=eO(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=eO(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=eO(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=eO(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=ij(t,0,this.animationClip.duration),n=eO(this.transformCurveInfos);!(i=n()).done;){var a=i.value,o=a.curve.keyFrames.getValue(r),s=e.parentSpaceTransforms[a.boneIndex];switch(a.type){case 0:s.position.copyFrom(o);break;case 1:s.scale.copyFrom(o);break;case 2:s.rotation.copyFrom(o);break;case 3:s.euler.copyFrom(o)}}for(var u,h=eO(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=eO(this.colorCurveInfos);!(f=d()).done;){var p=f.value,m=p.curve.keyFrames.getValue(r);e.colorPropertyValues[p.animatedObjectIndex]=m}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),iH=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):eI(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):eI(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):eI(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):eI(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=this.x,e=this.y;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iH.ONE=new iH(1,1),iH.ZERO=new iH(0,0);var iY=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):eI(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):eI(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):eI(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):eI(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=this.x,e=this.y,i=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new iH(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iY.X=new iY(1,0,0),iY.Y=new iY(0,1,0),iY.Z=new iY(0,0,1),iY.ONE=new iY(1,1,1),iY.ZERO=new iY(0,0,0);var iZ=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],o=e[5],s=e[9],u=e[2],h=e[6],l=e[10],c=i+o+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-s)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>o&&i>l){var d=2*Math.sqrt(1+i-o-l);this.w=(h-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>l){var p=2*Math.sqrt(1+o-i-l);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(s+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-o);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(s+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x),this.w=i,this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(ij(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=e.x,s=e.y,u=e.z,h=e.w;return this.x=i*h+a*o+r*u-n*s,this.y=r*h+a*s+n*o-i*u,this.z=n*h+a*u+i*s-r*o,this.w=a*h-i*o-r*s-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this.x,r=this.y,n=this.z,a=this.w,o=a*t.w+i*t.x+r*t.y+n*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=a,this.x=i,this.y=r,this.z=n,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-e;return this.w=u*a+e*this.w,this.x=u*i+e*this.x,this.y=u*r+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var h=Math.sqrt(s),l=Math.atan2(h,o),c=Math.sin((1-e)*l)/h,f=Math.sin(e*l)/h;return this.w=a*c+this.w*f,this.x=i*c+this.x*f,this.y=r*c+this.y*f,this.z=n*c+this.z*f,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this.x,r=this.y,n=this.z,a=this.w,o=t.x,s=t.y,u=t.z,h=a*o+r*u-n*s,l=a*s+n*o-i*u,c=a*u+i*s-r*o,f=-i*o-r*s-n*u,d=null!=e?e:t;return d.x=h*a+-(f*i)+-(l*n)- -(c*r),d.y=l*a+-(f*r)+-(c*i)- -(h*n),d.z=c*a+-(f*n)+-(h*r)- -(l*i),d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(iY.ZERO,this,iY.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,i){return new t().setFromAxisAngle(e,i)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return new t().setFromUnitVectors(e,i)},t}();iZ.tempVec0=new iY;var iq=new iZ,iQ=function(){},iK=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(iQ),iJ=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=iq.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(iQ),i$=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var a=0;a<t.parentSpaceTransforms.length;a++){var o=t.parentSpaceTransforms[a],s=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=o.position,l=s.position,c=u.position;n.blendVector3(h,l,i,c);var f=o.rotation,d=s.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=o.scale,v=s.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=o.euler,x=s.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var C=0;C<t.colorPropertyValues.length;C++){var S=t.colorPropertyValues[C],A=e.colorPropertyValues[C],w=r.colorPropertyValues[C];n.blendColor(S,A,i,w)}},t}();i$.normalBlendFunction=new iK,i$.additiveBlendFunction=new iJ;var i0=function(){function t(t){this.position=new iY,this.rotation=new iZ,this.scale=new iY,this.euler=new iY,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),i1=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=eO(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push(new i0().copyFrom(r))}for(var n,a=eO(t.defaultFloatPropertyValues);!(n=a()).done;){var o=n.value;this.floatPropertyValues.push(o)}for(var s,u=eO(t.defaultColorPropertyValues);!(s=u()).done;){var h=s.value;this.colorPropertyValues.push(h)}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),i2=function(t){this.pose=new i1(t)};t.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(i3,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(iR),t.ApplyAdditiveNodeData=eR([iI(t8.ApplyAdditiveNodeData)],t.ApplyAdditiveNodeData);var i3=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}iy(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new i2(e.skeleton),this.additiveNodeResult=new i2(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){i$.additiveBlend(t,e,i,r)},e}(iP);t.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(i4,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(iR),t.BlendNodeData=eR([iI(t8.BlendNodeData)],t.BlendNodeData);var i4=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.source0=null,e.source1=null,e.inputParameterValueNode=null,e}iy(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new i2(e.skeleton),this.source1Result=new i2(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){i$.localBlend(t,e,i,r)},e}(iP);t.AndNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(i5,t),r=eO(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(iR),t.AndNodeData=eR([iI(t8.AndNodeData)],t.AndNodeData);var i5=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}iy(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=eO(this.conditionNodes);!(e=i()).done;)if(!e.value.getValue(t)){this.result=!1;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=eO(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=eO(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(iL);t.OrNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(i6,t),r=eO(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(iR),t.OrNodeData=eR([iI(t8.OrNodeData)],t.OrNodeData);var i6=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}iy(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=eO(this.conditionNodes);!(e=i()).done;)if(e.value.getValue(t)){this.result=!0;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=eO(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=eO(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(iL);t.NotNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(i8,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(iR),t.NotNodeData=eR([iI(t8.NotNodeData)],t.NotNodeData);var i8=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.result=!1,e}iy(e,t);var i=e.prototype;return i.getValue=function(t){return!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}(iL);t.ConstFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(i9,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iR),t.ConstFloatNodeData=eR([iI(t8.ConstFloatNodeData)],t.ConstFloatNodeData);var i9=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}return iy(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(iV);t.ConstBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(i7,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iR),t.ConstBoolNodeData=eR([iI(t8.ConstBoolNodeData)],t.ConstBoolNodeData);var i7=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}return iy(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(iL);t.ControlParameterFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rt,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iR),t.ControlParameterFloatNodeData=eR([iI(t8.ControlParameterFloatNodeData)],t.ControlParameterFloatNodeData);var rt=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iy(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(iV);t.ControlParameterBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(re,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iR),t.ControlParameterBoolNodeData=eR([iI(t8.ControlParameterBoolNodeData)],t.ControlParameterBoolNodeData);var re=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iy(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(iL);t.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ri,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(iR),t.ControlParameterTriggerNodeData=eR([iI(t8.ControlParameterTriggerNodeData)],t.ControlParameterTriggerNodeData);var ri=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iy(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(iL);t.LayerBlendNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNodeIndex=-1,e.layerDatas=[],e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rr,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=eO(this.layerDatas);!(i=r()).done;){var n=i.value;e.layers.push({inputNode:t.getNode(n.inputNodeIndex),weightValueNode:t.getNode(n.weightValueNodeIndex),weight:0})}},i.load=function(e){if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:-1,e.layerDatas)for(var i,r,n=eO(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(ik({inputNodeIndex:-1,weightValueNodeIndex:-1},a))}},e}(iR),t.LayerBlendNodeData=eR([iI(t8.LayerBlendNodeData)],t.LayerBlendNodeData);var rr=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseLayerNode=null,e.layers=[],e}iy(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new i2(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var i,r,n=eO(this.layers);!(r=n()).done;){var a,o,s=r.value;null==(a=s.inputNode)||a.initialize(e),null==(o=s.weightValueNode)||o.initialize(e)}},i.shutdownInternal=function(e){null==(i=this.baseLayerNode)||i.shutdown(e);for(var i,r,n=eO(this.layers);!(r=n()).done;){var a,o,s=r.value;null==(a=s.inputNode)||a.shutdown(e),null==(o=s.weightValueNode)||o.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()&&(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e)),e},i.updateLayers=function(t,e){for(var i,r=eO(this.layers);!(i=r()).done;){var n=i.value;if(n.inputNode&&n.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),n.inputNode.evaluate(t,this.layerNodeResult);var a=n.weightValueNode.getValue(t);i$.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(iP);t.EqualNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rn,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(iR),t.EqualNodeData=eR([iI(t8.EqualNodeData)],t.EqualNodeData);var rn=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}iy(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}(iL),ra=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}return iy(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(iR);(Z=es||(es={}))[Z.GreaterThan=0]="GreaterThan",Z[Z.LessThan=1]="LessThan";var ro=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}iy(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}(iL);t.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.instantiate=function(t){var e=this.createNode(ro,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(ra),t.GreaterNodeData=eR([iI(t8.GreaterNodeData)],t.GreaterNodeData),t.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.instantiate=function(t){var e=this.createNode(ro,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(ra),t.LessNodeData=eR([iI(t8.LessNodeData)],t.LessNodeData),t.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rs,t);e.defaultStateIndex=this.defaultStateIndex;for(var i,r=eO(this.stateDatas);!(i=r()).done;){var n=i.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};e.states.push(a);for(var o,s=eO(n.transitionDatas);!(o=s()).done;){var u=o.value,h={transitionNode:t.getNode(u.transitionNodeIndex),conditionNode:t.getNode(u.conditionNodeIndex),targetStateIndex:u.targetStateIndex};a.transitions.push(h)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex},e}(iR),t.StateMachineNodeData=eR([iI(t8.StateMachineNodeData)],t.StateMachineNodeData);var rs=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.states=[],e.defaultStateIndex=-1,e.activeTransition=null,e.activeStateIndex=-1,e}iy(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===ea.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=-1,n=i.transitions.length,a=0;a<n;a++){var o=i.transitions[a];if(-1===o.targetStateIndex)throw Error("Invalid target state index.");if(!this.states[o.targetStateIndex].stateNode.isTransitioning()){var s=!1;if(o.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>o.transitionNode.exitTime&&(s=!0)}else null!==o.conditionNode&&o.conditionNode.getValue(t)&&(s=!0);if(s){r=a;break}}}if(-1!==r){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=-1,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=eO(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=eO(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(iP);t.TransitionState=void 0,(q=t.TransitionState||(t.TransitionState={}))[q.None=0]="None",q[q.TransitioningIn=1]="TransitioningIn",q[q.TransitioningOut=2]="TransitioningOut",t.StateNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNodeIndex=-1,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ru,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex},e}(iR),t.StateNodeData=eR([iI(t8.StateNodeData)],t.StateNodeData);var ru=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}iy(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(iP);t.SourceType=void 0,(Q=t.SourceType||(t.SourceType={}))[Q.State=0]="State",Q[Q.Transition=1]="Transition",Q[Q.CachedPose=2]="CachedPose",t.TransitionNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=-1,e}iy(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rh,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(iR),t.TransitionNodeData=eR([iI(t8.TransitionNodeData)],t.TransitionNodeData);var rh=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.hasExitTime=!1,t.exitTime=.75,t.transitionLength=0,t.transitionProgress=0,t.blendWeight=0,t.sourceNode=null,t.sourceType=0,t.blendedDuration=0,t}iy(i,e);var r=i.prototype;return r.evaluate=function(t,e){e2(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=ij(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=ea.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult);if(this.registerPoseTasksAndUpdateRootMotion(i,n,e),this.blendedDuration=iG(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var a=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+a)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),e},r.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},r.getProgressPercentage=function(){return this.transitionProgress},r.getSourceType=function(){return this.sourceType},r.isSourceATransition=function(){return 1===this.sourceType},r.isSourceAState=function(){return 0===this.sourceType},r.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.getSourceStateNode=function(){return this.sourceNode},r.getSourceTransitionNode=function(){return this.sourceNode},r.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},r.initializeInternal=function(t){e.prototype.initializeInternal.call(this,t),this.sourceNodeResult=new i2(t.skeleton),this.targetNodeResult=new i2(t.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},r.shutdownInternal=function(i){this.targetNode.setTransitioningState(t.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(i),this.sourceNode.shutdown(i),this.sourceNode=null),e.prototype.shutdownInternal.call(this,i)},r.endSourceTransition=function(e){var i,r=this.getSourceTransitionNode().targetNode;null==(i=this.sourceNode)||i.shutdown(e),this.sourceNode=r,this.sourceType=0,this.getSourceStateNode().setTransitioningState(t.TransitionState.TransitioningOut)},r.initializeTargetStateAndUpdateTransition=function(t,e,i){this.markNodeActive(t);var r=this.targetNodeResult;return 0===this.sourceType&&this.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),r=this.targetNode.evaluate(t,r),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,r,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=iG(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},r.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=ij(this.blendWeight,0,1))},r.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;i$.localBlend(t.pose,e.pose,r,i.pose)},i}(iP);(K=eu||(eu={}))[K.Float=0]="Float",K[K.Color=1]="Color";var rl=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=eO(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,o=eO(e.rotation);!(a=o()).done;){var s=a.value;this.addReferenceTransform(s)}for(var u,h=eO(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=eO(e.euler);!(c=f()).done;){var d=c.value;this.addReferenceTransform(d),this.useEuler=!0}for(var p=0;p<e.floats.length;p++){var m=e.floats[p];this.addRecordedProperty(m.path,m.className,m.property,0)}for(var v=0;v<e.colors.length;v++){var y=e.colors[v];this.addRecordedProperty(y.path,y.className,y.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new i0(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n,a=t+e+i;if(void 0===this.pathToObjectIndex.get(a)){var o=this.findTarget(t);if(o){(n="VFXItem"===e?o:o.getComponent(iE[e]))||console.error("The "+e+" Component was not found.");for(var s=i.split("."),u=s[s.length-1],h=n,l=0;l<s.length-1;l++){var c=h[s[l]];void 0===c&&console.error("The "+s[l]+" property of "+h+" was not found."),h=c}var f={target:h,property:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(a,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push(h[u]),this.pathToObjectIndex.set(a,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=eO(i);!(e=n()).done;){var a=e.value,o=r.find(a);if(!o)return null;r=o}return r},t}(),rc=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.context=new iF;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=eO(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var o,s=eO(a.positionCurves);!(o=s()).done;){var u=o.value;r.position.push(u.path)}for(var h,l=eO(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=eO(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=eO(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=eO(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,E=eO(a.colorCurves);!(T=E()).done;){var _=T.value;r.colors.push(_)}}}this.skeleton=new rl(e,r),this.result=new i2(this.skeleton),this.context.skeleton=this.skeleton;var C=new iD;C.nodes=this.nodes,C.nodeDatas=t.nodeDatas,C.dataSet=t.graphDataSet;for(var S=0;S<t.nodeDatas.length;S++)C.nodes[S]||t.nodeDatas[S].instantiate(C);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];eI(i,ri)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),-1)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);-1!==i&&this.nodes[i].setValue(e)},t}();function rf(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rd(t,e,i){return e&&rf(t.prototype,e),i&&rf(t,i),t}var rp=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}iy(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&ek(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},rd(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}(iA);eR([iS(void 0,void 0)],rp.prototype,"item",void 0),eR([iS(void 0,void 0)],rp.prototype,"_enabled",void 0);var rm=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(rp);t.Animator=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.graph=null,e.graphAsset=null,e}iy(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graph&&this.graph.setBool(t,e)},i.setFloat=function(t,e){this.graph&&this.graph.setFloat(t,e)},i.setTrigger=function(t){this.graph&&this.graph.setTrigger(t)},i.resetTrigger=function(t){this.graph&&this.graph.resetTrigger(t)},i.onStart=function(){this.graphAsset&&(this.graph=new rc(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graph){for(var e=this.graph.evaluateGraph(t/1e3),i=this.graph.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,a=e.pose.parentSpaceTransforms[r].rotation,o=e.pose.parentSpaceTransforms[r].scale,s=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(o.x,o.y,o.z),this.graph.skeleton.useEuler?i[r].setRotation(s.x,s.y,s.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graph.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.property;l.target[c]=e.pose.floatPropertyValues[h]}for(var f=this.graph.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.property;p.target[m]=e.pose.colorPropertyValues[d]}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(rp),t.Animator=eR([i_("Animator")],t.Animator);var rv=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}iy(e,t);var i=e.prototype;return i.render=function(t){},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},rd(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}(rp);eR([iS(void 0,void 0)],rv.prototype,"materials",void 0),eR([iS(void 0,void 0)],rv.prototype,"_priority",void 0);var ry=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):eI(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):eI(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):eI(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):eI(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=this.x,e=this.y,i=this.z,r=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new iY(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();ry.ONE=new ry(1,1,1,1),ry.ZERO=new ry(0,0,0,0);var rg=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.meshCollider=new oA,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}iy(e,t);var i=e.prototype;return i.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)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(rv);eR([iS(void 0,void 0)],rg.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}iy(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new ry;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(rg),t.EffectComponent=eR([i_(et.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return iy(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(rp),eR([iS(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),eR([iS(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),eR([iS(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),eR([iS(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=eR([i_(et.PostProcessVolume)],t.PostProcessVolume);var rx=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,o=n*(1-Math.abs(a%2-1)),s=0,u=0,h=0;a>=0&&a<=1?(s=n,u=o):a>=1&&a<=2?(s=o,u=n):a>=2&&a<=3?(u=n,h=o):a>=3&&a<=4?(u=o,h=n):a>=4&&a<=5?(s=o,h=n):a>=5&&a<=6&&(s=n,h=o);var l=i-n;return this.set(s+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):eI(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):eI(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):eI(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):eI(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return .3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new ry(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,a=Math.max(e,i,r),o=Math.min(e,i,r),s=a-o,u=0,h=0;return 0!==a&&(h=s/a),a!=o&&(a==e?(u=(i-r)/s,i<r&&(u+=6)):a==i?u=(r-e)/s+2:a==r&&(u=(e-i)/s+4),u*=60),new t(u,h,a,n)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),new t().setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();rx.BLACK=new rx(0,0,0,1),rx.BLUE=new rx(0,0,1,1),rx.CLEAR=new rx(0,0,0,0),rx.CYAN=new rx(0,1,1,1),rx.GRAY=new rx(.5,.5,.5,1),rx.GREEN=new rx(0,1,0,1),rx.MAGENTA=new rx(1,0,1,1),rx.RED=new rx(1,0,0,1),rx.WHITE=new rx(1,1,1,1),rx.YELLOW=new rx(1,.92,.016,1);var rb=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=a,v[6]=o,v[7]=s,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=a,v[9]=o,v[13]=s,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),a=Math.sin(i),o=1-n,s=r.x,u=r.y,h=r.z,l=o*s,c=o*u;return this.set(l*s+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*s,0,l*h+a*u,c*h-a*s,o*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(iY.ZERO,t,iY.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),o.normalize(),n.crossVectors(r,o),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[1]=a.x,s[2]=o.x,s[3]=0,s[4]=n.y,s[5]=a.y,s[6]=o.y,s[7]=0,s[8]=n.z,s[9]=a.z,s[10]=o.z,s[11]=0,s[12]=-n.dot(e),s[13]=-a.dot(e),s[14]=-o.dot(e),s[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<16;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[4],s=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],_=r[8],C=r[12],S=r[1],A=r[5],w=r[9],O=r[13],I=r[2],M=r[6],R=r[10],P=r[14],N=r[3],V=r[7],L=r[11],F=r[15];return n[0]=a*T+o*S+s*I+u*N,n[4]=a*E+o*A+s*M+u*V,n[8]=a*_+o*w+s*R+u*L,n[12]=a*C+o*O+s*P+u*F,n[1]=h*T+l*S+c*I+f*N,n[5]=h*E+l*A+c*M+f*V,n[9]=h*_+l*w+c*R+f*L,n[13]=h*C+l*O+c*P+f*F,n[2]=d*T+p*S+m*I+v*N,n[6]=d*E+p*A+m*M+v*V,n[10]=d*_+p*w+m*R+v*L,n[14]=d*C+p*O+m*P+v*F,n[3]=y*T+g*S+x*I+b*N,n[7]=y*E+g*A+x*M+b*V,n[11]=y*_+g*w+x*R+b*L,n[15]=y*C+g*O+x*P+b*F,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],a=t[1],o=t[5],s=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*s*l-r*u*l-n*o*c+i*u*c+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*c+n*a*c-r*a*f+r*u*h-n*s*h)+t[11]*(+e*u*l-e*o*f-n*a*l+i*a*f+n*o*h-i*u*h)+t[15]*(-r*o*h-e*s*l+e*o*c+r*a*l-i*a*c+i*s*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],o=t[5],s=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*s*f-o*m*f-l*s*v+o*c*v,g=d*c*u-h*m*u-d*s*f+a*m*f+h*s*v-a*c*v,x=h*p*u-d*l*u+d*o*f-a*p*f-h*o*v+a*l*v,b=d*l*s-h*p*s-d*o*c+a*p*c+h*o*m-a*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*E,t[3]=(l*s*n-o*c*n-l*r*u+i*c*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*E,t[7]=(a*c*n-h*s*n+h*r*u-e*c*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*E,t[11]=(h*o*n-a*l*n-h*i*u+e*l*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*E,t[15]=(a*l*r-h*o*r+h*i*s-e*l*s-a*i*c+e*o*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=iY.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=o+o,p=s+s,m=a*f,v=a*d,y=a*p,g=o*d,x=o*p,b=s*p,T=u*f,E=u*d,_=u*p,C=i.x,S=i.y,A=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+b))*S,n[6]=(x+T)*S,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,o=n.set(a[0],a[1],a[2]).length(),s=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();0>this.determinant()&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14];var h=t.tempMat0;h.copyFrom(this);var l=1/o,c=1/s,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=o,r.y=s,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new iY,e=new iZ,i=new iY;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var o=1/(e-t),s=1/(i-r),u=1/(a-n),h=-(e+t)*o,l=-(i+r)*s,c=-(a+n)*u;o*=2,s*=2,u*=-2;var f=this.elements;return f[0]=o,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),o=1/(i-r),s=this.elements;return s[0]=n?a:a/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?a*e:a,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*o,s[15]=0,(null===r||r===1/0)&&(s[10]=-1,s[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14];var s=a[3]*i+a[7]*r+a[11]*n+a[15];return o.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14],o},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n,o.y=a[1]*i+a[5]*r+a[9]*n,o.z=a[2]*i+a[6]*r+a[10]*n,o.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12]*a,s.y=o[1]*i+o[5]*r+o[9]*n+o[13]*a,s.z=o[2]*i+o[6]*r+o[10]*n+o[14]*a,s.w=o[3]*i+o[7]*r+o[11]*n+o[15]*a,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!iB(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return new t().lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return new t().perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return new t().setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromScale=function(e,i,r){return new t().setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return new t().setFromTranslation(e,i,r)},t.fromRotationX=function(e){return new t().setFromRotationX(e)},t.fromRotationY=function(e){return new t().setFromRotationY(e)},t.fromRotationZ=function(e){return new t().setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return new t().setFromRotationAxis(e,i)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,i,r){return new t().setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return new t().setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,o,l,p,r,s,c,m,n,u,f,v)},t}();rb.IDENTITY=new rb(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),rb.ZERO=new rb(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),rb.tempVec0=new iY,rb.tempVec1=new iY,rb.tempVec2=new iY,rb.tempMat0=new rb;var rT=[],rE={},r_="WebGL Constants not in global, please check your environment";function rC(){"function"==typeof WebGL2RenderingContext?rS(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(rS(WebGLRenderingContext),rS(WebGLRenderingContext.prototype)):eW?rT.push(eH()?"iOS16 lockdown mode, WebGL Constants not in global":r_):rT.push(r_),rT.length||"HALF_FLOAT"in rE||(rE.HALF_FLOAT=5131)}function rS(t){for(var e in t)/^[A-Z_]/.test(e)&&(rE[e]=t[e])}function rA(t){switch(t){case tI.ALPHA:case tI.ADD:case tI.SUBTRACTION:case tI.STRONG_LIGHT:case tI.WEAK_LIGHT:return 1;case tI.SUPERPOSITION:return 2;case tI.BRIGHTNESS:return 3;case tI.MULTIPLY:return 0;default:return 1}}function rw(t,e){switch(e){case void 0:case tI.ALPHA:t.blendFunction=[rE.ONE,rE.ONE_MINUS_SRC_ALPHA,rE.ONE,rE.ONE_MINUS_SRC_ALPHA];break;case tI.ADD:t.blendFunction=[rE.ONE,rE.ONE,rE.ONE,rE.ONE];break;case tI.SUBTRACTION:t.blendFunction=[rE.ONE,rE.ONE,rE.ZERO,rE.ONE],t.blendEquation=[rE.FUNC_REVERSE_SUBTRACT,rE.FUNC_REVERSE_SUBTRACT];break;case tI.SUPERPOSITION:t.blendFunction=[rE.ONE,rE.ONE,rE.ONE,rE.ONE];break;case tI.MULTIPLY:t.blendFunction=[rE.DST_COLOR,rE.ONE_MINUS_SRC_ALPHA,rE.DST_COLOR,rE.ONE_MINUS_SRC_ALPHA];break;case tI.BRIGHTNESS:t.blendFunction=[rE.ONE,rE.ONE_MINUS_SRC_ALPHA,rE.ONE,rE.ONE_MINUS_SRC_ALPHA];break;case tI.STRONG_LIGHT:t.blendFunction=[rE.DST_COLOR,rE.DST_ALPHA,rE.ZERO,rE.ONE];break;case tI.WEAK_LIGHT:t.blendFunction=[rE.DST_COLOR,rE.ZERO,rE.ZERO,rE.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function rO(t,e){e===tM.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=rE.CW,t.cullFace=e===tM.BACK?rE.BACK:rE.FRONT)}function rI(e,i){switch(i){case void 0:e.stencilTest=!1;break;case t.MaskMode.MASK:e.stencilTest=!0,e.stencilFunc=[rE.ALWAYS,rE.ALWAYS],e.stencilOpZPass=[rE.REPLACE,rE.REPLACE];break;case t.MaskMode.OBSCURED:e.stencilTest=!0,e.stencilFunc=[rE.EQUAL,rE.EQUAL];break;case t.MaskMode.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[rE.NOTEQUAL,rE.NOTEQUAL];break;case t.MaskMode.NONE:e.stencilTest=!1;break;default:console.warn("MaskMode "+i+" not in specification, please set stencil params seperately.")}}rT.length||rC(),t.ShaderType=void 0,(J=t.ShaderType||(t.ShaderType={}))[J.vertex=0]="vertex",J[J.fragment=1]="fragment",t.MaskMode=void 0,($=t.MaskMode||(t.MaskMode={}))[$.NONE=0]="NONE",$[$.MASK=1]="MASK",$[$.OBSCURED=2]="OBSCURED",$[$.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",t.TextureLoadAction=void 0,(tt=t.TextureLoadAction||(t.TextureLoadAction={}))[tt.whatever=0]="whatever",tt[tt.clear=2]="clear",t.TextureSourceType=void 0,(te=t.TextureSourceType||(t.TextureSourceType={}))[te.none=0]="none",te[te.data=1]="data",te[te.image=2]="image",te[te.compressed=3]="compressed",te[te.video=4]="video",te[te.canvas=5]="canvas",te[te.framebuffer=6]="framebuffer",te[te.mipmaps=7]="mipmaps";var rM=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.download=function(e,i,r,n){var a=this;if(void 0===i&&(i="json"),!this.start(e,r,n)){var o=new XMLHttpRequest,s=function(){a.finish(e,o.status,o.response)};o.responseType=i,o.addEventListener("load",function(){200==o.status||0==o.status&&t.trustXHRStatusZero?a.finish(e,200,o.response):s()}),o.addEventListener("error",s),o.open("GET",e,!0),o.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(e,i,r){var n=this.callbacks[e];delete this.callbacks[e];for(var a=200==i||0==i&&t.trustXHRStatusZero?[r]:[i,r],o=a.length-1,s=n.length;o<s;o+=2)n[o].apply(null,a)},t}();rM.trustXHRStatusZero=!1;var rR=!1,rP=!1;function rN(t,e){return rV.apply(this,arguments)}function rV(){return(rV=eA(function(t,e){return eP(this,function(i){switch(i.label){case 0:if(!(rR||!e))return[3,2];return[4,rD(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rD(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rR=!0,[4,rD(t)];case 6:return[2]}})})).apply(this,arguments)}function rL(t,e){return rF.apply(this,arguments)}function rF(){return(rF=eA(function(t,e){return eP(this,function(i){switch(i.label){case 0:if(!(rP||!e))return[3,2];return[4,rD(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rD(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rP=!0,[4,rD(t)];case 6:return[2]}})})).apply(this,arguments)}function rD(t){return rk.apply(this,arguments)}function rk(){return(rk=eA(function(t){var e,i;return eP(this,function(r){if(e="",eI(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else eI(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function rz(t){return rU.apply(this,arguments)}function rU(){return(rU=eA(function(t){return eP(this,function(e){return[2,new Promise(function(e,i){new rM().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function rB(){return(rB=eA(function(t){return eP(this,function(e){return[2,new Promise(function(e,i){new rM().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function rG(t){return rj.apply(this,arguments)}function rj(){return(rj=eA(function(t){var e;return eP(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eY()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=e.play().catch(function(t){i(t)});r?r.then(function(){return t(e)}):e.addEventListener("loadeddata",function i(){t(e),e.removeEventListener("loadeddata",i)},!0),e.addEventListener("error",function(t){i("Load video fail.")})})]})})).apply(this,arguments)}function rX(t,e){return rW.apply(this,arguments)}function rW(){return(rW=eA(function(t,e){return eP(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function rH(t,e,i){return rY.apply(this,arguments)}function rY(){return(rY=eA(function(e,i,r,n){var a,o,s,u,h,l,c;return eP(this,function(f){switch(f.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return a=e.mipmaps,o=e.target,[4,Promise.all(a.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:rZ(t,i)}))}))];case 1:return s=f.sent(),[2,ik({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,h=e.target,[4,Promise.all(u.map(function(t){return rZ(t,i)}))];case 3:return l=f.sent(),c=n[u[0][1][0]].url,[2,ik({keepImageSource:!1},e,{mipmaps:l,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:h,bin:c,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function rZ(t,e){return rq.apply(this,arguments)}function rq(){return(rq=eA(function(t,e){var i,r,n,a,o;return eP(this,function(s){if(r=(i=t[1])[0],n=i[1],a=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,rD(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var rQ=1,rK=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+rQ++,i}iy(i,e);var r=i.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(e){var i=e.target,r=void 0===i?rE.TEXTURE_2D:i,n=e.format,a=void 0===n?rE.RGBA:n;return e.sourceType||("image"in e?e.sourceType=t.TextureSourceType.image:"data"in e?e.sourceType=t.TextureSourceType.data:"video"in e?e.sourceType=t.TextureSourceType.video:e.sourceType=0),ik({minFilter:rE.NEAREST,magFilter:rE.NEAREST,wrapS:rE.CLAMP_TO_EDGE,wrapT:rE.CLAMP_TO_EDGE,target:r,format:rE.RGBA,internalFormat:a,type:rE.UNSIGNED_BYTE},e)},i.fromImage=function(e,r,n){return eA(function(){var a,o;return eP(this,function(s){switch(s.label){case 0:return[4,rD(e)];case 1:return a=s.sent(),(o=i.create(r,ik({sourceType:t.TextureSourceType.image,image:a,target:rE.TEXTURE_2D,id:ia(),flipY:!0},n))).initialize(),[2,o]}})})()},i.fromVideo=function(e,r,n){return eA(function(){var a,o;return eP(this,function(s){switch(s.label){case 0:return[4,rG(e)];case 1:return a=s.sent(),(o=i.create(r,ik({sourceType:t.TextureSourceType.video,video:a,id:ia(),flipY:!0},n))).initialize(),[2,o]}})})()},rd(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(iA);function rJ(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?rE.RGBA:3===o?rE.RGB:2===o?rE.LUMINANCE_ALPHA:rE.LUMINANCE,rK.createWithData(t,{data:e,width:i,height:r},{type:rE.HALF_FLOAT,format:n,internalFormat:a,wrapS:rE.CLAMP_TO_EDGE,wrapT:rE.CLAMP_TO_EDGE})}var r$={type:rE.UNSIGNED_BYTE,format:rE.RGBA,internalFormat:rE.RGBA,wrapS:rE.MIRRORED_REPEAT,wrapT:rE.MIRRORED_REPEAT,minFilter:rE.NEAREST,magFilter:rE.NEAREST};function r0(e){return rK.create(e,ik({id:ig.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},r$))}function r1(e){return rK.create(e,ik({id:ig.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},r$))}var r2=function(){function t(t,e,i){void 0===i&&(i=0),this.arrayBuffer=t,this.baseOffset=i;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])throw Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),o=67305985===a.getUint32(0,!0);if(this.glType=a.getUint32(1*n,o),this.glTypeSize=a.getUint32(2*n,o),this.glFormat=a.getUint32(3*n,o),this.glInternalFormat=a.getUint32(4*n,o),this.glBaseInternalFormat=a.getUint32(5*n,o),this.pixelWidth=a.getUint32(6*n,o),this.pixelHeight=a.getUint32(7*n,o),this.pixelDepth=a.getUint32(8*n,o),this.numberOfArrayElements=a.getUint32(9*n,o),this.numberOfFaces=a.getUint32(10*n,o),this.numberOfMipmapLevels=a.getUint32(11*n,o),this.bytesOfKeyValueData=a.getUint32(12*n,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){e5.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){e5.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){e5.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+".");return}0===this.glType?this.loadType=0:this.loadType=2}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,o=0;o<a;o++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,s);e.push({data:h,width:r,height:n}),i+=s+4+(3-(s+3)%4)}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function r3(e){var i=new r2(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,a=i.pixelHeight,o=i.glType,s=i.numberOfFaces,u=i.glInternalFormat,h=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:o,target:6===s?rE.TEXTURE_CUBE_MAP:rE.TEXTURE_2D,internalFormat:u,format:h,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,a))+1))}}var r4=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return eA(function(){var i,r;return eP(this,function(n){switch(n.label){case 0:if(i=t.id,e.reloadPending[i])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},i.canOffloadTexture=function(e){if(e){var i=e.type;if(i===t.TextureSourceType.compressed||i===t.TextureSourceType.image){var r=e.target,n=e.map,a=e.url;return r===rE.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:e8(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,h=e.maps,l=e.urls;return o?s.length>0:u===rE.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):l.every(function(t){return e8(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return eA(function(){var n,a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T;return eP(this,function(E){switch(E.label){case 0:if(n=e.type,a=e.target,o=e.map,s=e.url,u=e.bin,h=e.mipmaps,l=e.urls,c=e.maps,!(a===rE.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(o)];case 1:return f=E.sent(),[2,ik({},i,{cube:f,target:rE.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:ik({},o),target:rE.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,rD(s)];case 3:return d=E.sent(),[2,ik({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:rE.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,rG(s)];case 5:return p=E.sent(),[2,ik({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,rz(s)];case 7:return m=E.sent(),[2,ik({},r3(m),i,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(n!==t.TextureSourceType.mipmaps)return[3,17];if(!u)return[3,13];return[4,rz(u)];case 9:if(v=E.sent(),g=(y=null!=a?a:rE.TEXTURE_2D)===rE.TEXTURE_2D?h.slice():h.map(function(t){return t.slice()}),a!==rE.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(h.map(function(t){return r.loadMipmapImages(t,v)}))];case 10:return x=E.sent(),[3,12];case 11:x=r.loadMipmapImages(h,v),E.label=12;case 12:return[2,ik({},i,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(a===rE.TEXTURE_2D||!a))return[3,15];return[4,Promise.all(l.map(function(t){return rD(t)}))];case 14:return b=E.sent(),[2,ik({},i,{mipmaps:b,target:rE.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:l.slice(),target:rE.TEXTURE_2D}})];case 15:if(a!==rE.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(c.map(function(t){return r.loadCubeMap(t)}))];case 16:return T=E.sent(),[2,ik({},i,{mipmaps:T,target:rE.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:c.map(function(t){return ik({},t)}),target:rE.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return eA(function(){return eP(this,function(i){return[2,Promise.all(t.map(function(t){return rD(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return eA(function(){return eP(this,function(e){return[2,Promise.all(t.map(function(t){return rD(t)}))]})})()},e}(),r5=function(){function t(t){this.destroyed=!1;var e=t.name;this.name=void 0===e?"defaultDataBlock":e}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach(function(i){e.setUniformValue(i,t[i])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function r6(t){return"object"==typeof t&&t&&void 0===t.length&&eI(t,rK)}t.MaterialRenderType=void 0,(ti=t.MaterialRenderType||(t.MaterialRenderType={}))[ti.normal=0]="normal",ti[ti.transformFeedback=1]="transformFeedback";var r8=1,r9=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,a=void 0===n?"Material"+r8++:n,o=i.renderType,s=i.shader,u=i.uniformSemantics;r.name=a,r.renderType=void 0===o?0:o,r.shaderSource=s,r.props=i,r.uniformSemantics=ik({},u)}else r.name="Material"+r8++,r.renderType=0;return r}iy(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},rd(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}(iA),r7=function(){function e(e){this.engine=e,this.alphaMaskEnabled=!1,this.maskMode=t.MaskMode.NONE,this.maskable=null,this.stencilClearAction={stencilAction:t.TextureLoadAction.clear}}var i=e.prototype;return i.getRefValue=function(){return 1},i.setMaskOptions=function(e){var i=e.isMask,r=e.inverted,n=e.reference,a=e.alphaMaskEnabled;this.alphaMaskEnabled=void 0!==a&&a,void 0!==i&&i?this.maskMode=t.MaskMode.MASK:(this.maskMode=void 0!==r&&r?t.MaskMode.REVERSE_OBSCURED:t.MaskMode.OBSCURED,this.maskable=this.engine.findObject(n))},i.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},e}();t.ShaderCompileResultStatus=void 0,(tr=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[tr.noShader=0]="noShader",tr[tr.success=1]="success",tr[tr.fail=2]="fail",tr[tr.compiling=3]="compiling",t.GLSLVersion=void 0,(tn=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",tn.GLSL3="300 es";var nt=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return iy(e,t),e}(iA);t.Shader=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=eO(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(iA),t.Shader=eR([i_(et.Shader)],t.Shader);var ne="effects-internal-copy",ni="effects-internal-copy-mesh",nr="\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}",nn="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 na(e,i){return{name:ne,vertex:nr,fragment:nn,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:ni+ +i}}var no={format:rE.RGBA,type:rE.UNSIGNED_BYTE,minFilter:rE.LINEAR,magFilter:rE.LINEAR,wrapS:rE.CLAMP_TO_EDGE,wrapT:rE.CLAMP_TO_EDGE},ns=Symbol("dispose"),nu=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var i=e.prototype;return i.requestColorAttachmentTexture=function(e){var i=this,r=e.width,n=e.height,a=e.name,o={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:a},s=[a];Object.getOwnPropertyNames(no).forEach(function(t){var i,r=null!=(i=e[t])?i:no[t];o[t]=r,s.push(t,r)});var u=s.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var l=this.engine;e2(l),h=rK.create(l,o),this.textureCache[u]=h,this.textureRef[u]=1,h[ns]=h.dispose,h.dispose=function(){return i.removeTexture(u)}}return h},i.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[ns](),i.dispose=i[ns]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},i.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var i=t.textureCache[e];i[ns](),i.dispose=i[ns]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),nh=function(){function t(t){void 0===t&&(t={}),this.semantics=ik({},t)}var e=t.prototype;return e.toObject=function(){return ik({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var i=this.semantics[t];return e7(i)?i(e):i},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach(function(e){delete t.semantics[e]})},t}(),nl=((el={})[rE.FLOAT]=Float32Array.BYTES_PER_ELEMENT,el[rE.INT]=Int32Array.BYTES_PER_ELEMENT,el[rE.SHORT]=Int16Array.BYTES_PER_ELEMENT,el[rE.BYTE]=Int8Array.BYTES_PER_ELEMENT,el),nc=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="",e.subMeshes=[],e}iy(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(iA);function nf(t){return t===rE.INT?new Int32Array(0):t===rE.SHORT?new Int16Array(0):new Float32Array(0)}(ta=ec||(ec={}))[ta.XYZ=0]="XYZ",ta[ta.XZY=1]="XZY",ta[ta.YXZ=2]="YXZ",ta[ta.YZX=3]="YZX",ta[ta.ZXY=4]="ZXY",ta[ta.ZYX=5]="ZYX";var nd=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],s=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case ec.XYZ:this.y=Math.asin(ij(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,s),this.z=0);break;case ec.YXZ:this.x=Math.asin(-ij(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,c),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case ec.ZXY:this.x=Math.asin(ij(l,-1,1)),.9999999>Math.abs(l)?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case ec.ZYX:this.y=Math.asin(-ij(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(l,c),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case ec.YZX:this.z=Math.asin(ij(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case ec.XZY:this.z=Math.asin(-ij(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(l,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=iU,this.y*=iU,this.z*=iU,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,o;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(a=t[e+2])?a:0,this.order=null!=(o=t[e+3])?o:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new iZ;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this.x,i=this.y,r=this.z,n=this.order,a=Math.cos(e*iz*.5),o=Math.cos(i*iz*.5),s=Math.cos(r*iz*.5),u=Math.sin(e*iz*.5),h=Math.sin(i*iz*.5),l=Math.sin(r*iz*.5);switch(n){case ec.XYZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case ec.YXZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case ec.ZXY:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case ec.ZYX:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case ec.YZX:t.set(u*o*s+a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s-u*h*l);break;case ec.XZY:t.set(u*o*s-a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s+u*h*l);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,i=this.x,r=this.y,n=this.z,a=this.order,o=Math.cos(i*iz),s=Math.sin(i*iz),u=Math.cos(r*iz),h=Math.sin(r*iz),l=Math.cos(n*iz),c=Math.sin(n*iz);if(a===ec.XYZ){var f=o*l,d=o*c,p=s*l,m=s*c;e[0]=u*l,e[4]=-u*c,e[8]=h,e[1]=d+p*h,e[5]=f-m*h,e[9]=-s*u,e[2]=m-f*h,e[6]=p+d*h,e[10]=o*u}else if(a===ec.YXZ){var v=u*l,y=u*c,g=h*l,x=h*c;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*h,e[1]=o*c,e[5]=o*l,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===ec.ZXY){var b=u*l,T=u*c,E=h*l,_=h*c;e[0]=b-_*s,e[4]=-o*c,e[8]=E+T*s,e[1]=T+E*s,e[5]=o*l,e[9]=_-b*s,e[2]=-o*h,e[6]=s,e[10]=o*u}else if(a===ec.ZYX){var C=o*l,S=o*c,A=s*l,w=s*c;e[0]=u*l,e[4]=A*h-S,e[8]=C*h+w,e[1]=u*c,e[5]=w*h+C,e[9]=S*h-A,e[2]=-h,e[6]=s*u,e[10]=o*u}else if(a===ec.YZX){var O=o*u,I=o*h,M=s*u,R=s*h;e[0]=u*l,e[4]=R-O*c,e[8]=M*c+I,e[1]=c,e[5]=o*l,e[9]=-s*l,e[2]=-h*l,e[6]=I*c+M,e[10]=O-R*c}else if(a===ec.XZY){var P=o*u,N=o*h,V=s*u,L=s*h;e[0]=u*l,e[4]=-c,e[8]=h*l,e[1]=P*c+L,e[5]=o*l,e[9]=N*c-V,e[2]=V*c-N,e[6]=s*l,e[10]=L*c+P}else console.error("toMatrix4: Invalid order "+a);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromArray(e,i,r)},t}();nd.DEFAULT_ORDER=ec.ZYX,nd.tempQuat0=new iZ,nd.tempMat0=new rb;var np=function(){function t(t,e,i,r,n,a,o,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,o,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=o,h[1]=e,h[4]=n,h[7]=s,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=o,h[5]=s,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,o=i+i,s=r+r,u=e*a,h=e*o,l=e*s,c=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],a=r[3],o=r[6],s=r[1],u=r[4],h=r[7];return r[0]=e*n+i*s,r[3]=e*a+i*u,r[6]=e*o+i*h,r[1]=-i*n+e*s,r[4]=-i*a+e*u,r[7]=-i*o+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<9;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[3],s=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8];return e*(a*h-u*o)+n*(u*r-i*h)+s*(i*o-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8],l=h*a-u*o,c=u*r-h*i,f=o*i-a*r,d=e*l+n*c+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(s*o-h*n)*p,t[2]=(u*n-s*a)*p,t[3]=c*p,t[4]=(h*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-o*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[3]*r+a[6]*n,o.y=a[1]*i+a[4]*r+a[7]*n,o.z=a[2]*i+a[5]*r+a[8]*n,o},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!iB(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return new t().setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h){return new t(e,n,s,i,a,u,r,o,h)},t}(),nm=function(){function t(t,e){void 0===t&&(t=iY.ZERO),void 0===e&&(e=iY.X),this.origin=new iY,this.direction=new iY,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new iY;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,o,s,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,_=b.z,C=1/d,S=1/p,A=1/m;if(C>=0?(i=(y-h)*C,r=(T-h)*C):(i=(T-h)*C,r=(y-h)*C),S>=0?(n=(g-l)*S,a=(E-l)*S):(n=(E-l)*S,a=(g-l)*S),!(i>a)&&!(n>r)&&((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),A>=0?(o=(x-c)*A,s=(_-c)*A):(o=(_-c)*A,s=(x-c)*A),!(i>s)&&!(o>r))&&((o>i||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),!(r<0)))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new iY).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,o=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(o,a),h=t.tempVec1.subtractVectors(s,a),l=t.tempVec2.subtractVectors(this.origin,a),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();nm.tempVec0=new iY,nm.tempVec1=new iY,nm.tempVec2=new iY,nm.tempVec3=new iY;var nv=function(){function t(t,e){void 0===t&&(t=new iY(1/0,1/0,1/0)),void 0===e&&(e=new iY(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var h=t[s],l=t[s+1],c=t[s+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>o&&(o=c)}return this.min.set(e,i,r),this.max.set(n,a,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new iY),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 iY),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,o=n.length;a<o;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new iY),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 iY;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 iY),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 iY),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new iY),this.isEmpty())return[];var i=[];return i[0]=new iY(this.min.x,this.min.y,this.min.z),i[1]=new iY(this.min.x,this.min.y,this.max.z),i[2]=new iY(this.min.x,this.max.y,this.min.z),i[3]=new iY(this.min.x,this.max.y,this.max.z),i[4]=new iY(this.max.x,this.min.y,this.min.z),i[5]=new iY(this.max.x,this.min.y,this.max.z),i[6]=new iY(this.max.x,this.max.y,this.min.z),i[7]=new iY(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new iY;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}(),ny=function(){function t(t,e){void 0===t&&(t=iY.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=new nv().setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new iY),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return(void 0===t&&(t=new nv),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return this.center.applyMatrix(t),this.radius=this.radius*Math.sqrt(Math.max(i,r,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new iY().subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=(r-this.radius)*.5;this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new iY,i=new iY;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=new iY().subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),ng=Object.freeze({__proto__:null,get EulerOrder(){return ec},Euler:nd,Quaternion:iZ,Vector2:iH,Vector3:iY,Vector4:ry,Matrix3:np,Matrix4:rb,Ray:nm,PI2:2*Math.PI,DEG2RAD:iz,RAD2DEG:iU,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:iB,damp:function(t,e,i,r){return iG(t,e,1-Math.exp(-i*r))},lerp:iG,degToRad:function(t){return t*iz},radToDeg:function(t){return t*iU},clamp:ij,Color:rx,Box3:nv,Sphere:ny}),nx=1,nb=function(e){function i(t,i){var r;if((r=e.call(this,t)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,o=i.name,s=i.priority,u=i.worldMatrix,h=void 0===u?rb.fromIdentity():u;r.id="Mesh"+nx++,r.name=void 0===o?"<unnamed>":o,r.geometry=a,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=h}else r.id="Mesh"+nx++,r.name="<unnamed>",r.worldMatrix=rb.fromIdentity(),r._priority=0;return r}iy(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.restore=function(){},r.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var i=null==e?void 0:e.material;i!==t.DestroyOptions.keep&&this.material.dispose(i),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},rd(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(rv);t.RenderPassAttachmentStorageType=void 0,(to=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[to.none=0]="none",to[to.color=1]="color",to[to.stencil_8_opaque=2]="stencil_8_opaque",to[to.depth_16_opaque=3]="depth_16_opaque",to[to.depth_stencil_opaque=4]="depth_stencil_opaque",to[to.depth_16_texture=5]="depth_16_texture",to[to.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(ts=t.TextureStoreAction||(t.TextureStoreAction={}))[ts.store=0]="store",ts[ts.clear=2]="clear";var nT=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(eI(r,rK))this.texture=r,this.externalTexture=!0;else if(r){var a=r.wrapT,o=r.wrapS,s=r.minFilter,u=r.magFilter,h=r.internalFormat,l=r.format,c=void 0===l?rE.RGBA:l,f=r.type,d=void 0===f?rE.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:c,type:d,internalFormat:h||c,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:i.name},this.texture=rK.create(e,ik({},this.textureOptions,{sourceType:t.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},rd(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),e}();t.RenderPassDestroyAttachmentType=void 0,(tu=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tu.force=0]="force",tu[tu.keep=1]="keep",tu[tu.keepExternal=2]="keepExternal",tu[tu.destroy=0]="destroy";var nE=1,n_=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+nE++:r,a=i.clearAction,o=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,h=i.priority,l=i.meshOrder,c=void 0===l?t.OrderType.ascending:l,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===h?0:h,this.meshOrder=c,this.meshes=e$((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=ik({},a),this.storeAction=ik({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new nh(o),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){e0(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){ek(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),e$(this.meshes,this.meshOrder),this.meshes},i.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},i.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],a=e[3];t.setViewport(i,r,n,a)}},i.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},i.frameCleanup=function(t){},i.resetColorAttachments=function(e){var i=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var r=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new nT(i.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=r,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(e.map(function(t){return t})))}else this.resetAttachments({attachments:e.map(function(t){return{texture:t}})})},i.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},i.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},i._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var a=this.viewportScale,o=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*a,r.getHeight()*a],s=[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 r;return new nT(i.renderer.engine,ik({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=h;var l=nK.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}},r);l.bind(),l.unbind(),this.framebuffer=l}else this.attachments.length=0},i.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var i=this.renderer,r=this.viewportScale;return i?[0,0,i.getWidth()*r,i.getHeight()*r]:[0,0,0,0]},i.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},i.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},i.getDepthTexture=function(t,e){if(!this.depthTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.depthTexture=n),n}return this.depthTexture},i.getStencilTexture=function(t,e){if(!this.stencilTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},i.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},i.dispose=function(e){if(!this.destroyed){var i,r,n=(null==e?void 0:e.meshes)||void 0;n!==t.DestroyOptions.keep&&this.meshes.forEach(function(t){t.dispose(n)}),this.meshes.length=0;var a=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===a||1===a||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var o=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:o}),s.externalStorage&&2===o||1===o||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=ir}},rd(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),e}(),nC="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}",nS="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;}",nA="#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",nw="#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}}",nO="#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}",nI="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",nM="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);}",nR="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);}",nP="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);}",nN="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);}",nV="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);}",nL={},nF=function(){function e(){}return e.registerInclude=function(t,e){nL[t]&&e5.warn('The "'+t+'" shader include already exist.'),nL[t]=e},e.unRegisterInclude=function(t){delete nL[t]},e.unRegisterAllIncludes=function(){Object.keys(nL).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,a=i.shader,o=i.macros,s=i.removeVersion,u=e.genMacroString(r,o),h=e.genShaderVersion(r),l=e.parseIncludes(a),c=e.isVersion300(l);return(l=e.removeWebGLVersion(l),2!==r||c||(l=e.convertTo300(l,n===t.ShaderType.fragment)),s)?u+l:h+u+l},e.convertTo300=function(t,i){if(t=(t=(t=t.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(t=(t=(t=t.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!e.has300Output(t)){if(/\bgl_FragData\[.+?\]/g.test(t)){var r=(t=t.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(t=e.replaceMRTShader(t,r))}else t=(t=t.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}}else t=t.replace(/\battribute\b/g,"in");return t},e.parseIncludes=function(t,e){for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var i,r=i[1],n=nL[r];if(void 0===n)throw Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},e.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return(r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach(function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)}),r.length)?r.join("\n")+"\n":""},e.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},e.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},e.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},e.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},e.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach(function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"}),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},e}(),nD=function(e){function i(i,r){var n,a=(n=e.call(this,i,r)||this).renderer.engine,o=nc.create(a,{mode:rE.TRIANGLE_STRIP,attributes:{aPos:{type:rE.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=r9.create(a,{shader:{vertex:nI,fragment:nV,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=nb.create(a,{geometry:o,material:s,priority:0}),n.priority=5e3,n}iy(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var i,r,n,a=null!=(n=null==(r=e.renderingData.currentFrame.globalVolume)?void 0:null==(i=r.bloom)?void 0:i.threshold)?n:1;this.screenMesh.material.setFloat("_Threshold",a),e.renderMeshes([this.screenMesh])},i}(n_),nk=function(e){function i(i,r,n){(a=e.call(this,i,n)||this).type=r;var a,o=a.renderer.engine,s="PostProcess",u=nc.create(o,{name:s,mode:rE.TRIANGLE_STRIP,attributes:{aPos:{type:rE.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),h={vertex:nI,fragment:"H"===r?nR:nP,glslVersion:t.GLSLVersion.GLSL1},l=r9.create(o,{name:s,shader:h});return l.blending=!1,l.depthTest=!1,l.culling=!1,a.screenMesh=nb.create(o,{name:s,geometry:u,material:l,priority:0}),a.priority=5e3,a}iy(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",nX(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(n_),nz=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",a=r.renderer.engine,o=nc.create(a,{name:n,mode:rE.TRIANGLE_STRIP,attributes:{aPos:{type:rE.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=r9.create(a,{name:n,shader:{vertex:nI,fragment:nN}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=nb.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r}iy(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",nX(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(n_),nU=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,a="PostProcess",o=n.renderer.engine;n.sceneTextureHandle=r||new nT(o);var s=nc.create(o,{name:a,mode:rE.TRIANGLE_STRIP,attributes:{aPos:{type:rE.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=r9.create(o,{name:a,shader:{vertex:nI,fragment:nM,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=nb.create(o,{name:a,geometry:s,material:u,priority:0}),n.priority=5e3,n}iy(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var i=e.renderingData.currentFrame.globalVolume,r=ik({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=ik({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),a=ik({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),o=ik({active:!1},null==i?void 0:i.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,a.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*a.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*a.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),n.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",n.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",n.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",n.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new iH(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new iY(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),e.renderMeshes([this.screenMesh])},i}(n_),nB="_effects_default_",nG=1,nj=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,a=e.keepColorBuffer,o=e.renderer,s=e.editorTransform,u=e.globalVolume,h=e.postProcessingEnabled,l=void 0!==h&&h,c=e.clearAction,f=void 0===c?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:c,d=o.engine;u&&(this.globalVolume=u),this.globalUniforms=new nH;var p=[],m={};if(this.renderer=o,l){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");var v=rE.HALF_FLOAT;p=[{texture:{format:rE.RGBA,type:v,magFilter:rE.LINEAR,minFilter:rE.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}this.drawObjectPass=new n_(o,{name:nB,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),l){var g=new nT(d),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=Array(7),T=rE.HALF_FLOAT,E=new nD(o,{name:"BloomThresholdPass",attachments:[{texture:{format:rE.RGBA,type:T,minFilter:rE.LINEAR,magFilter:rE.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new nT(d);var C=new nk(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:rE.RGBA,type:T,minFilter:rE.LINEAR,magFilter:rE.LINEAR}}]}),S=new nk(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:rE.RGBA,type:T,minFilter:rE.LINEAR,magFilter:rE.LINEAR}}]});S.gaussianResult=b[_],this.addRenderPass(C),this.addRenderPass(S),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var w=new nz(o,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:rE.RGBA,type:T,minFilter:rE.LINEAR,magFilter:rE.LINEAR}}]});w.gaussianDownSampleResult=b[5-A],this.addRenderPass(w),x[2]*=2,x[3]*=2}var O=new nU(o,g);this.addRenderPass(O)}this.semantics=new nh(e.semantics),this.clearAction=f,this.name="RenderFrame"+nG++;var I=y[0];this.emptyTexture=r0(d),this.transparentTexture=r1(d),this.camera=n,this.keepColorBuffer=a,this.renderPassInfoMap.set(I,{listStart:0,listEnd:0,renderPass:I,intermedia:!1}),this.editorTransform=ry.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new nu(d);var M=d.gpuCapability,R=M.detail,P=na(M.level,R.readableDepthStencilTextures&&R.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(P)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},i.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},i.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var i,r,n=(null==e?void 0:e.passes)?e.passes:void 0;n!==t.DestroyOptions.keep&&this._renderPasses.forEach(function(t){t.dispose(n)}),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(i=r.texture)||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},i.resetRenderPassDefaultAttachment=function(t,e){for(var i=this.resource,r=i.color_a,n=i.color_b,a=e;a<t.length;a++){var o,s,u,h=t[a],l=null==(s=h.attachments[0])?void 0:s.texture;if(l&&o===l){var c=l===r?n:r;h.resetColorAttachments([c])}(l=null==(u=h.attachments[0])?void 0:u.texture)&&(o=l)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(nB)&&i.meshes.includes(t))||(e=r,!1)}),e},i.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},i.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var i,r=t[0],n=r.texture,a=r.persistent,o=n.format,s=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(o===rE.RGBA&&!a){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[0].texture===u?this.resource.color_b:u}]}}return t},i.resetClearActions=function(){var e=this.renderPasses.length>1?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;this.clearAction.stencilAction=e,this.clearAction.depthAction=e,this.clearAction.colorAction=e,this.keepColorBuffer&&(this.clearAction.colorAction=t.TextureLoadAction.whatever)},i.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},i.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},i.createResource=function(){var e=this.renderer.engine;if(!this.resource){var i,r=e.gpuCapability,n=r.detail,a=r.level,o=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===a?rE.LINEAR:rE.NEAREST,h=rK.create(e,{sourceType:t.TextureSourceType.framebuffer,format:rE.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=rK.create(e,{sourceType:t.TextureSourceType.framebuffer,format:rE.RGBA,data:{width:o,height:s},minFilter:u,magFilter:u,name:"frame_b"}),c=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new n_(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:h}]}).initialize(this.renderer),d=new nW(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,colorAction:t.TextureLoadAction.clear},meshOrder:t.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(i=f.getDepthAttachment())?void 0:i.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:l,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=nc.create(i,{name:ne,mode:rE.TRIANGLE_STRIP,attributes:{aPos:{type:rE.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=na(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var a=r9.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:ne,shader:n});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[rE.SRC_ALPHA,rE.ONE_MINUS_SRC_ALPHA,rE.SRC_ALPHA,rE.ONE_MINUS_SRC_ALPHA]),nb.create(i,{name:ne,geometry:r,material:a,priority:0})},i.removeRenderPass=function(t){ek(this._renderPasses,t)},rd(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function nX(t){return t?new iH(t.getWidth(),t.getHeight()):new iH}var nW=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",nX(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(n_),nH=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},nY=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return rd(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),nZ="function"==typeof WebGL2RenderingContext,nq=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=nZ&&eI(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),s=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),r&&!o&&(o=nQ(t,t.HALF_FLOAT)),r&&!s&&(s=nQ(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=r||t.getExtension("OES_texture_float")?t.FLOAT:0,h=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,l={floatTexture:u,halfFloatTexture:h,maxSample:r?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0,halfFloatLinear:o,floatLinear:s,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!a,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=l,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw Error("Draw multiple color buffers not available.");var o=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];o?t.framebufferTexture2D(e,o,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function nQ(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}t.COMPRESSED_TEXTURE=void 0,(th=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[th.NONE=0]="NONE",th[th.PVRTC=1]="PVRTC",th[th.ASTC=2]="ASTC",t.FilterMode=void 0,(tl=t.FilterMode||(t.FilterMode={}))[tl.Nearest=0]="Nearest",tl[tl.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tc=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tc.RGBA32=0]="RGBA32",tc[tc.RGBAHalf=1]="RGBAHalf";var nK=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},rd(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),nJ=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,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i){},e.getTemporaryRT=function(t,e,i,r,n,a){return null},e.dispose=function(t){},t}(),n$=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=n0(this.arc,this.arcMode,t)*iz,i=new iY(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*iz),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(ii(0,1)),direction:n.normalize()}},t}();function n0(t,e,i){if(e===tH.RANDOM)t=ii(0,t);else if(e===tH.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tH.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===tH.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var n1=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=n0(this.arc,this.arcMode,t)*iz,i=new iY(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),n2=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=ii(-this._d,this._d),i=ii(-this._h,this._h);return{direction:new iY(0,0,1),position:new iY(e,i,0)}},t}(),n3=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=n0(this.arc,this.arcMode,t)*iz,i=new iY(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new iY;return e<a?s.set(r,r*o,0):e>=a&&e<Math.PI-a?s.set(n/o,n,0):e<Math.PI+a?s.set(-r,-r*o,0):e<2*Math.PI-a?s.set(-n/o,-n,0):s.set(r,r*o,0),{direction:i,position:s}},t}(),n4=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tH.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):ii(0,1);return{direction:new iY(0,1,0),position:new iY(this._d*(e-.5),0,0)}},t}(),n5=new rb,n6=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=ii(0,2*Math.PI),n=n0(this.arc,this.arcMode,t)*iz,a=n5.setFromRotationZ(n),o=new iY(Math.cos(r),Math.sin(r),0),s=new iY(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),n8=new rb,n9=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return ii(-90,90)},e.generate=function(t){var e=n0(this.arc,this.arcMode,t)*iz,i=this.getHorizontalAngle()*iz,r=this.radius,n=new iY(Math.cos(i),0,Math.sin(i)),a=n8.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),n7=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.getHorizontalAngle=function(){return ii(0,90)},e}(n9),at=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=ij(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(n0(e.length/2-1,this.arcMode,t)),r=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new iY(r,n,0);return{position:new iY(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),ae=function(){function t(){}return t.prototype.generate=function(){return{position:new iY,direction:new iY}},t}(),ai=((ef={})[tP.NONE]=ae,ef[tP.CONE]=n$,ef[tP.SPHERE]=n9,ef[tP.HEMISPHERE]=n7,ef[tP.CIRCLE]=n1,ef[tP.DONUT]=n6,ef[tP.RECTANGLE]=n2,ef[tP.EDGE]=n4,ef[tP.RECTANGLE_EDGE]=n3,ef[tP.TEXTURE]=at,ef);function ar(t){if(!t)return new ae;var e=ik({radius:1,arc:360,angle:0,arcMode:tH.RANDOM},t),i=t.type,r=ai[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tP.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=iY.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function an(t,e,i,r,n){var a,o;if(n===function(t,e,i,r){for(var n=0,a=e,o=i-r;a<i;a+=r)n+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)o=av(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=av(a,t[a],t[a+1],o);return o&&al(o,o.next)&&(ay(o),o=o.next),o}function aa(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(al(r,r.next)||0===ah(r.prev,r,r.next))){if(ay(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function ao(t,e){return t.x-e.x}function as(t,e,i,r,n){return(t=((t=((t=((t=((t=32767*(t-i)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-r)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function au(t,e,i,r,n,a,o,s){return(n-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function ah(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function al(t,e){return t.x===e.x&&t.y===e.y}function ac(t,e,i,r){var n=ad(ah(t,e,i)),a=ad(ah(t,e,r)),o=ad(ah(i,r,t)),s=ad(ah(i,r,e));return!!(n!==a&&o!==s||0===n&&af(t,i,e)||0===a&&af(t,r,e)||0===o&&af(i,t,r)||0===s&&af(i,e,r))}function af(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function ad(t){return t>0?1:t<0?-1:0}function ap(t,e){return 0>ah(t.prev,t,t.next)?ah(t,e,t.next)>=0&&ah(t,t.prev,e)>=0:0>ah(t,e,t.prev)||0>ah(t,t.next,e)}function am(t,e){var i=new ag(t.i,t.x,t.y),r=new ag(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function av(t,e,i,r){var n=new ag(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ay(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 ag(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ax=0;function ab(t,e,i,r){i=i||2,ax=r||0;var n,a,o,s,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=an(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,o,s,u,h=[];for(n=0,a=e.length;n<a;n++)o=e[n]*r,s=n<a-1?e[n+1]*r:t.length,(u=an(t,o,s,r,!1))===u.next&&(u.steiner=!0),h.push(function(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(u));for(h.sort(ao),n=0;n<h.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,a=e,o=t.x,s=t.y,u=-1/0;do{if(s<=a.y&&s>=a.next.y&&a.next.y!==a.y){var h=a.x+(s-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(h<=o&&h>u){if(u=h,h===o){if(s===a.y)return a;if(s===a.next.y)return a.next}n=a.x<a.next.x?a:a.next}}a=a.next}while(a!==e);if(!n)return null;if(o===u)return n;var l,c=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&au(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(l=Math.abs(s-a.y)/(o-a.x),ap(a,t)&&(l<p||l===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>ah(i.prev,i,r.prev)&&0>ah(r.next,i,i.next))))&&(n=a,p=l)),a=a.next;while(a!==c);return n}(t,e)){var i=am(e,t);aa(e,e.next),aa(i,i.next)}})(h[n],i),i=aa(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],a=s=t[1];for(var m=i;m<f;m+=i)u=t[m],h=t[m+1],u<n&&(n=u),h<a&&(a=h),u>o&&(o=u),h>s&&(s=h);l=0!==(l=Math.max(o-n,s-a))?1/l:0}return function t(e,i,r,n,a,o,s){if(e){!s&&o&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=as(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,o,s,u,h=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e<h&&(s++,r=r.nextZ);e++);for(u=h;s>0||u>0&&r;)0!==s&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(o>1)}(n)}(e,n,a,o);for(var u,h,l=e;e.prev!==e.next;){if(u=e.prev,h=e.next,o?function(t,e,i,r){var n=t.prev,a=t.next;if(ah(n,t,a)>=0)return!1;for(var o=n.x<t.x?n.x<a.x?n.x:a.x:t.x<a.x?t.x:a.x,s=n.y<t.y?n.y<a.y?n.y:a.y:t.y<a.y?t.y:a.y,u=n.x>t.x?n.x>a.x?n.x:a.x:t.x>a.x?t.x:a.x,h=n.y>t.y?n.y>a.y?n.y:a.y:t.y>a.y?t.y:a.y,l=as(o,s,e,i,r),c=as(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=l&&d&&d.z<=c;){if(f!==t.prev&&f!==t.next&&au(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ah(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&au(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ah(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&au(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ah(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&au(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ah(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,a,o):function(t){var e=t.prev,i=t.next;if(ah(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(au(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&ah(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+ax),i.push(e.i/r+ax),i.push(h.i/r+ax),ay(e),e=h.next,l=h.next;continue}if((e=h)===l){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!al(n,a)&&ac(n,r,r.next,a)&&ap(n,a)&&ap(a,n)&&(e.push(n.i/i+ax),e.push(r.i/i+ax),e.push(a.i/i+ax),ay(r),ay(r.next),r=t=a),r=r.next}while(r!==t);return aa(r)}(aa(e),i,r),i,r,n,a,o,2):2===s&&function(e,i,r,n,a,o){var s=e;do{for(var u,h,l=s.next.next;l!==s.prev;){if(s.i!==l.i&&(u=s,h=l,u.next.i!==h.i&&u.prev.i!==h.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ac(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(ap(u,h)&&ap(h,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,h)&&(ah(u.prev,u,h.prev)||ah(u,h.prev,h))||al(u,h)&&ah(u.prev,u,u.next)>0&&ah(h.prev,h,h.next)>0))){var c=am(s,l);s=aa(s,s.next),c=aa(c,c.next),t(s,i,r,n,a,o),t(c,i,r,n,a,o);return}l=l.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(aa(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,l),p}var aT="editor",aE={"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"};function a_(t,e){for(var i,r,n=t.s,a=t.p,o=n[1],s=a[1],u=0,h=0;h<o.length;h++)u+=o[h].length-1;var l,c=new Float32Array(6*u),f=e.indexBase,d=e.uvTransform,p=0,m=0,v=0,y=1,g=1;d&&(m=d[0],v=d[1],y=(l=d[4])?d[3]:d[2],g=l?d[2]:d[3]);for(var x=[0,0],b=0===l?0:-Math.PI/2,T=0;T<o.length;T++)for(var E=o[T],_=s[T],C=s[T+1]||s[0],S=[0,0],A=0;A<E.length-1;A++)(function(t,e,i,r,n,a,o,s){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;t[0]=h*i[0]+l*n+c*o+f*r[0],t[1]=h*i[1]+l*a+c*s+f*r[1]})(S,E[A],_,C,_[4],_[5],C[2],C[3]),i=S[0],r=S[1],c[p++]=i/2,c[p++]=r/2,d?(x[0]=i,x[1]=r,aS(x,x,b),c[p++]=m+(x[0]+1)/2*y,c[p++]=v+(x[1]+1)/2*g):(c[p++]=(i+1)/2,c[p++]=(r+1)/2),p+=2;var w=ab(Array.from(c),null,6,void 0===f?0:f);return{aPoint:c,index:new Uint16Array(w)}}function aC(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tG.SHAPE_POINTS,t.p],s:[tG.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tG.SHAPE_POINTS,t.g.p],s:[tG.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var h=a_(n[u],{indexBase:a,uvTransform:e});a+=h.aPoint.length/5,r.push(h),o+=h.aPoint.length,s+=h.index.length}if(1===r.length)return r[0];for(var l=new Float32Array(o),c=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];l.set(m.aPoint,d),d+=m.aPoint.length,c.set(m.index,p),p+=m.index.length}return{aPoint:l,index:c}}function aS(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],o=e[1];return t[0]=r*a+n*o,t[1]=-n*a+r*o,t}var aA=[[0,0,1,1,0]],aw=function(e){function i(t){(i=e.call(this,t)||this).visible=!0,i.splits=aA,i.meshCollider=new oA,i._color=new rx(1,1,1,1),i.getHitTestParams=function(t){var e=rb.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.meshCollider.setGeometry(i.geometry,e);var n,a=i.meshCollider.getBoundingBoxData();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===tM.FRONT}}},i.renderer={renderMode:tD.MESH,blending:tI.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:tM.DOUBLE,mask:0},i.defaultGeometry=nc.create(i.engine,{attributes:{aPos:{type:rE.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:rE.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:rE.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var i,r=r9.create(i.engine,{shader:{fragment:nS,vertex:nC,shared:!0}});return i.material=r,i.material.setColor("_Color",new rx(1,1,1,1)),i.maskManager=new r7(t),i}iy(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){eI(t,rx)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},r.setTexture=function(t){var e=this;return eA(function(){var i;return eP(this,function(r){switch(r.label){case 0:if("string"!=typeof t)return[3,2];return[4,rK.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}})})()},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,i=this.textureSheetAnimation,r=this.defaultGeometry;if(t.shape){for(var n=t.shape,a=n.index,o=n.aPoint,s=void 0===o?[]:o,u=new Float32Array(s),h=[],l=[],c=0;c<u.length;c+=6)u[c]*=1,u[c+1]*=1,l.push(s[c+2],s[c+3]),h.push(u[c],u[c+1],0);return r.setAttributeData("aPos",new Float32Array(h)),{index:void 0===a?[]:a,aUV:l}}var f=[],d=[],p=[];if(1===e.length){var m=i?[0,0,1,1,e[0][4]]:e[0],v=m[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],y=m[0],g=m[1],x=m[4]?m[3]:m[2],b=m[4]?m[2]:m[3];f.push(v[0]*x+y,v[1]*b+g,v[2]*x+y,v[3]*b+g,v[4]*x+y,v[5]*b+g,v[6]*x+y,v[7]*b+g),p.push(-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0),d.push(0,1,2,2,1,3)}else for(var T=0;T<2;T++)for(var E=0;E<2;E++){var _=(2*E+T)*4,C=i?[0,0,1,1,e[0][4]]:e[2*E+T],S=C[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],A=((T+T+1)/2-1)/2,w=((E+E+1)/2-1)/2,O=C[0],I=C[1],M=C[4]?C[3]:C[2],R=C[4]?C[2]:C[3],P=[-.25+A,.25+w,-.25+A,-.25+w,.25+A,.25+w,.25+A,-.25+w];f.push(S[0]*M+O,S[1]*R+I,S[2]*M+O,S[3]*R+I,S[4]*M+O,S[5]*R+I,S[6]*M+O,S[7]*R+I),p.push(1*P[0],1*P[1],0,1*P[2],1*P[3],0,1*P[4],1*P[5],0,1*P[6],1*P[7],0),d.push(_,1+_,2+_,2+_,1+_,3+_)}return r.setAttributeData("aPos",new Float32Array(p)),{index:d,aUV:f}},r.configureDefaultGeometry=function(t){var e=this.getItemGeometryData(t),i=e.index,r=e.aUV,n=this.defaultGeometry;return n.setIndexData(new Uint16Array(i)),n.setAttributeData("aUV",new Float32Array(r)),n.setDrawCount(i.length),n},r.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.mask,a=t.texture,o=this.maskManager.maskMode,s=this.material;s.blending=!0,s.depthTest=!0,s.depthMask=i,s.stencilRef=void 0!==n?[n,n]:void 0,rw(s,r),rI(s,o),rO(s,e),s.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',s.setVector4("_TexOffset",new ry(0,0,1,1)),s.setTexture("_MainTex",a);var u=rA(r),h=new ry;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=o,s.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?s.enableMacro("ALPHA_CLIP"):s.disableMacro("ALPHA_CLIP"),s},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 i=this.materials[e];i.setVector2("_Size",this.transform.size),(this.renderer.renderMode===tD.BILLBOARD||this.renderer.renderMode===tD.VERTICAL_BILLBOARD||this.renderer.renderMode===tD.HORIZONTAL_BILLBOARD)&&i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,i,e)}},r.fromData=function(i){e.prototype.fromData.call(this,i);var r=null!=(O=i.renderer)?O:{},n=i.splits,a=i.textureSheetAnimation,o=i.mask;o&&this.maskManager.setMaskOptions(o);var s=r.shape,u=n&&!a?n[0]:void 0,h=void 0;if(null==s||"aPoint"in s&&"index"in s||(h=aC(s,u)),this.splits=n||aA,this.textureSheetAnimation=a,this.renderer={renderMode:null!=(I=r.renderMode)?I:tD.MESH,blending:null!=(M=r.blending)?M:tI.ALPHA,texture:r.texture?this.engine.findObject(r.texture):this.engine.emptyTexture,occlusion:!!r.occlusion,transparentOcclusion:!!r.transparentOcclusion||this.maskManager.maskMode===t.MaskMode.MASK,side:null!=(R=r.side)?R:tM.DOUBLE,mask:this.maskManager.getRefValue(),shape:h},this.configureMaterial(this.renderer),i.geometry){var l=this.engine.findObject(i.geometry),c=i.splits&&!i.textureSheetAnimation?i.splits[0]:aA[0],f=c[0],d=c[1],p=!!c[4],m=p?c[3]:c[2],v=p?c[2]:c[3],y=p?-Math.PI/2:0,g=l.getAttributeData("aUV"),x=l.getAttributeData("aPos"),b=l.getIndexData(),T=[0,0];if(g&&x&&b){for(var E=g.length/2,_=0;_<E;_++){var C=3*_,S=2*_,A=x[C],w=x[C+1];T[0]=A,T[1]=w,aS(T,T,y),g[S]=(T[0]+.5)*m+f,g[S+1]=(T[1]+.5)*v+d}this.geometry.setAttributeData("aPos",x.slice()),this.geometry.setAttributeData("aUV",g.slice()),this.geometry.setIndexData(b.slice()),this.geometry.setDrawCount(b.length)}this.geometry.subMeshes.length=0;for(var O,I,M,R,P,N=eO(l.subMeshes);!(P=N()).done;){var V=P.value;this.geometry.subMeshes.push({offset:V.offset,indexCount:V.indexCount,vertexCount:V.vertexCount})}}else this.geometry=this.defaultGeometry,this.configureDefaultGeometry(this.renderer)},rd(i,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),i}(rv);t.ShapeComponent=function(e){function i(i){(r=e.call(this,i)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new s9,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 r,n={shader:{vertex:r.vert,fragment:r.frag,glslVersion:t.GLSLVersion.GLSL1}},a=r9.create(i,n),o=r9.create(i,n);return a.color=new rx(1,1,1,1),a.depthMask=!1,a.depthTest=!0,a.blending=!0,r.material=a,o.color=new rx(.25,.25,.25,1),o.depthMask=!1,o.depthTest=!0,o.blending=!0,r.materials[1]=o,r.strokeAttributes={width:1,alignment:.5,cap:t5.Butt,join:t6.Miter,miterLimit:10,color:new rx(1,1,1,1)},r.fillAttribute={color:new rx(1,1,1,1)},r.shapeAttribute={type:t4.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}iy(i,e);var r=i.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,i=[],r=[];if(this.hasFill)for(var n,a=eO(e);!(n=a()).done;){var o=n.value.shape,s=[],u=r.length,h=i.length/2;o.build(s),o.triangulate(s,i,h,r,u)}var l=r.length;if(this.hasStroke)for(var c,f=eO(e);!(c=f()).done;){var d=c.value.shape,p=[];r.length;var m=i.length/2,v=this.strokeAttributes,y=!0;this.shapeAttribute.type===t4.Custom&&(y=d.closePath),d.build(p),sQ(p,v,!1,y,i,2,m,r)}var g=r.length-l,x=i.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<r.length)&&(E=new Uint16Array(r.length));for(var _=0;_<x;_++){var C=3*_,S=2*_,A=2*_;b[C]=i[S],b[C+1]=i[S+1],b[C+2]=0,T[A]=b[C],T[A+1]=b[C+1]}E.set(r),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(r.length);var w=this.geometry.subMeshes[0],O=this.geometry.subMeshes[1];w.indexCount=l,O.offset=2*l,O.indexCount=g},r.buildPath=function(e){switch(this.graphicsPath.clear(),e.type){case t4.Custom:for(var i,r=this.shapeAttribute,n=r.points,a=r.easingIns,o=r.easingOuts,s=eO(r.shapes);!(i=s()).done;){var u=i.value,h=u.indexes,l=n[h[0].point];this.graphicsPath.moveTo(l.x,l.y);for(var c=1;c<h.length;c++){var f=h[c],d=h[c-1],p=n[f.point],m=n[d.point],v=o[d.easingOut],y=a[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+p.x,y.y+p.y,p.x,p.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=n[g.point],T=n[x.point],E=o[x.easingOut],_=a[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 t4.Ellipse:this.graphicsPath.ellipse(0,0,e.xRadius,e.yRadius);break;case t4.Rectangle:this.graphicsPath.rect(-e.width/2,-e.height/2,e.width,e.height,e.roundness);break;case t4.Star:this.graphicsPath.polyStar(e.pointCount,e.outerRadius,e.innerRadius,e.outerRoundness,e.innerRoundness,t.StarType.Star);break;case t4.Polygon:this.graphicsPath.polyStar(e.pointCount,e.radius,e.radius,e.roundness,e.roundness,t.StarType.Polygon)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.shapeDirty=!0;var i=t.stroke;i&&(this.hasStroke=!0,this.strokeAttributes.width=i.width,this.strokeAttributes.color.copyFrom(i.color),this.strokeAttributes.cap=i.cap,this.strokeAttributes.join=i.join);var r=t.fill;switch(r&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(r.color)),t.type){case t4.Custom:for(var n,a={type:t4.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:t.fill},o=eO(t.points);!(n=o()).done;){var s=n.value;a.points.push(new iH(s.x,s.y))}for(var u,h=eO(t.easingIns);!(u=h()).done;){var l=u.value;a.easingIns.push(new iH(l.x,l.y))}for(var c,f=eO(t.easingOuts);!(c=f()).done;){var d=c.value;a.easingOuts.push(new iH(d.x,d.y))}a.shapes=t.shapes,this.shapeAttribute=a;break;case t4.Ellipse:var p={type:t4.Ellipse,xRadius:t.xRadius,yRadius:t.yRadius,fill:t.fill};this.shapeAttribute=p;break;case t4.Rectangle:var m={type:t4.Rectangle,width:t.width,height:t.height,roundness:t.roundness,fill:t.fill};this.shapeAttribute=m;break;case t4.Star:var v={type:t4.Star,pointCount:t.pointCount,innerRadius:t.innerRadius,outerRadius:t.outerRadius,innerRoundness:t.innerRoundness,outerRoundness:t.outerRoundness,fill:t.fill};this.shapeAttribute=v;break;case t4.Polygon:var y={type:t4.Polygon,pointCount:t.pointCount,radius:t.radius,roundness:t.roundness,fill:t.fill};this.shapeAttribute=y}t.mask&&this.maskManager.setMaskOptions(t.mask);var g=this.maskManager.getRefValue();this.material.stencilRef=void 0!==g?[g,g]:void 0,rI(this.material,this.maskManager.maskMode)},rd(i,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),i}(aw),t.ShapeComponent=eR([i_("ShapeComponent")],t.ShapeComponent),t.Fake3DComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.loop=!1,t.amountOfMotion=1,t.animationLength=2,t.mode=1,t.startPositionX=0,t.startPositionY=0,t.startPositionZ=0,t.endPositionX=0,t.endPositionY=0,t.endPositionZ=0,t.amplitudeX=0,t.amplitudeY=0,t.amplitudeZ=0,t.phaseX=0,t.phaseY=0,t.phaseZ=0,t}iy(i,e);var r=i.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(t.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var o=this.effectComponent.material;o.setFloat("_PosX",e*this.amountOfMotion),o.setFloat("_PosY",i*this.amountOfMotion),o.setFloat("_PosZ",r*this.amountOfMotion)}},i}(rp),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),eR([iS(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=eR([i_("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(tf=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[tf.Circular=0]="Circular",tf[tf.Linear=1]="Linear",t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}iy(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(rp),t.CameraController=eR([i_(et.CameraController)],t.CameraController);var aO=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(im);t.HitTestType=void 0,(td=t.HitTestType||(t.HitTestType={}))[td.triangle=1]="triangle",td[td.box=2]="box",td[td.sphere=3]="sphere",td[td.custom=4]="custom";var aI="click",aM="touchstart",aR="touchmove",aP="touchend",aN=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var e=t.prototype;return e.bindListeners=function(){var t,e,i,r,n,a,o=this;n=function(t){return t};var s="mousedown",u="mousemove",h="mouseup",l="mouseleave",c=function(t,e,i,n,a){void 0===n&&(n=0),void 0===a&&(a=0);var s=0,u=0,h=performance.now();if(!o.target)return e5.warn("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:a,ts:h,width:0,height:0,origin:t};var l=o.target,c=l.width,f=l.height;if(r){var d=h-r.ts;s=(n-r.dx)/d||0,u=(a-r.dy)/d||0,r={dx:n,dy:a,ts:h}}return{x:e,y:i,vx:s,vy:u,dx:n,dy:a,ts:h,width:c,height:f,origin:t}};eq()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",h="touchend",l="touchcancel"),this.nativeHandlers=((a={})[s]=function(a){if(o.enabled){var s=n(a),u=aV(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},o.dispatchEvent(aM,c(a,t,e))}},a[u]=function(r){if(i&&o.enabled){var a=aV(n(r));t=a.x,e=a.y,o.dispatchEvent(aR,c(r,t,e,t-i.x,e-i.y))}},a[h]=function(r){if(i&&o.enabled){!o.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var a=n(r),s=aV(a),u=Math.abs(i.clientX-a.clientX)+Math.abs(i.clientY-a.clientY);t=s.x,e=s.y,u<4&&o.dispatchEvent(aI,c(r,t,e)),o.dispatchEvent(aP,c(r,t,e,t-i.x,e-i.y))}i=0},a),this.nativeHandlers[l]=this.nativeHandlers[h],Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=o.target)||e.addEventListener(String(t),o.nativeHandlers[t])})},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),eD(i,e),function(){ek(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&ek(i,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function aV(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,o=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-o)/n.height*2}}var aL=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(im),aF=(tm=new Int32Array((tp=new Float32Array(1)).buffer),function(t){tp[0]=t;var e=tm[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?(r|=2048,i|=(r>>114-n)+(r>>113-n&1)):(i|=n-112<<10|r>>1,i+=1&r)}),aD=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=aF(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=aF(t[i])},t}(),ak=new nd,az=new rb;function aU(t,e,i,r,n,a,o){var s=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,l);var c=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new iY;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),m=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?m?e.getValue(s):e.getIntegrateValue(0,r,n):0});ak.setFromArray(v).negate(),az.setFromEuler(ak);var y=az.transformPoint(p);t.addVectors(d,y)}if(c.enabled){var g=c.asMovement,x=c.x,b=c.y,T=c.z;if(x){var E=g?x.getValue(s):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(b){var _=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.y=t.y+_}if(T){var C=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.z=t.z+C}}return t}function aB(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function aG(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function aj(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var o=0;o<i.length;o++)t[o]=i[o];return t}var aX=((ed={})[tk.PARTICLE_ORIGIN_CENTER]=[0,0],ed[tk.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],ed[tk.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],ed[tk.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],ed[tk.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],ed[tk.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],ed[tk.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],ed[tk.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],ed[tk.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],ed);function aW(t,e,i){var r=i.position,n=new iY(t,e,0),a=new iY;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new nm(r,a)}function aH(t,e,i){var r=t.x,n=t.y,a=t.z,o=new iY(r-e,n+i,a),s=new iY(r-e,n-i,a),u=new iY(r+e,n-i,a),h=new iY(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function aY(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function aZ(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var aq={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex;return new iH(e[r],e[n])},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===tj.LINE?0:i===tj.EASE_OUT?0:i===tj.EASE_IN?2:i===tj.EASE?2:i===tj.HOLD&&r===tj.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tj.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tj.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tj.EASE,tj.EASE_IN,tj.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tj.EASE,tj.EASE_OUT,tj.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tj.HOLD&&[tj.HOLD,tj.LINE_OUT,tj.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tj.HOLD&&[tj.HOLD,tj.LINE,tj.EASE_IN].includes(i)}},aQ=function(t,e){this.points=t,this.totalLength=e},aK={},aJ={};function a$(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function a0(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var a1=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=aZ(e.x-t.x,3)+"_"+aZ(e.y-t.y,3)+"_"+aZ(e.z-t.z,3)+"&"+(aZ(i.x-t.x,3)+"_"+aZ(i.y-t.y,3))+"_"+aZ(i.z-t.z,3)+"&"+(aZ(r.x-t.x,3)+"_"+aZ(r.y-t.y,3))+"_"+aZ(r.z-t.z,3);if(aJ[n])return{data:aJ[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var l=new iY,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==o&&(u+=Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2)+Math.pow(l.z-o.z,2)),o=l,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new aQ(a,s);return aJ[n]=f,{data:f,interval:new iY(t.x,t.y,t.z)}}(t,e,i,r),a=n.data,o=n.interval;this.lengthData=a,this.interval=o,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(aY(1-t,0))return e.points[299].point.clone().add(this.interval);if(aY(e.totalLength,0))return this.p1.clone();var i=new iY,r=aZ(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(aY(n,r))return e.points[a].point.clone().add(this.interval);var o=!0,s=1;for(r<n&&(s=-1);o;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}s>0&&a<299?(a+=s,n+=aZ(e.points[a].partialLength,5)):s<0&&a>0?(n-=aZ(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),a2=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new iZ,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):aY(1-t,0)?this.temp.copyFrom(this.p2):(a6.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),a3=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new iH,this.control2=new iH,this.weighted=!1,this.isConstant=!1,this.mSampleValues=Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),a$(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var a=1-n,o=a*a,s=n*n;return o*a*t+e*o*n*3+i*a*s*3+s*n*r},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=a$(.1*t,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=.1;var n=i+(t-e[--r])/(e[r+1]-e[r])*.1,a=a0(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=a0(e,i,r);if(0===a)break;var o=a$(e,i,r)-t;e-=o/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=a$(o=e+(i-e)/2,r,n)-t)>0?i=o:e=o;while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+.1,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,(this.control1.x!==this.control1.y||this.control2.x!==this.control2.y)&&this.calcSampleValues()},t}();function a4(t,e){var i,r,n,a=a5(t,e,!0),o=a.p0,s=a.p1,u=a.p2,h=a.p3;e2(u),e2(h);var l=h.x-o.x,c=h.y-o.y,f=aZ((s.x-o.x)/l,5),d=aZ((u.x-o.x)/l,5);aY(c,0)?i=r=NaN:(i=aZ((s.y-o.y)/c,5),r=aZ((u.y-o.y)/c,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",o,s,u,h),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",o,s,u,h),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",o,s,u,h),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",o,s,u,h),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return aK[p]?n=aK[p]:(n=aY(c,0)?new a3:new a3(f,i,d,r),aK[p]=n),{points:[o,s,u,h],timeInterval:l,valueInterval:c,curve:n}}function a5(t,e,i){var r=t[1],n=aq.isHoldOutKeyframe(t),a=aq.isHoldInKeyframe(e),o=!a&&aq.isRightSideEase(t),s=!n&&aq.isLeftSideEase(e);if(o&&!s&&!a){var u=new iH(r[r.length-4],r[r.length-3]),h=new iH(r[r.length-2],r[r.length-1]),l=aq.getPointInCurve(e),c=new iH(l.x,l.y),f=new iH(c.x-(c.x-u.x)/10,c.y);return{type:"ease",p0:u,p1:h,p2:f,p3:c}}if(!o&&s&&!n){var d=e[1],p=aq.getPointInCurve(t),m=new iH(p.x,p.y),v=new iH(d[0],d[1]),y=new iH(d[2],d[3]),g=new iH(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(o&&s){var x=e[1];return{type:"ease",p0:new iH(r[r.length-4],r[r.length-3]),p1:new iH(r[r.length-2],r[r.length-1]),p2:new iH(x[0],x[1]),p3:new iH(x[2],x[3])}}var b=aq.getPointInCurve(t),T=aq.getPointInCurve(e);if(n?T.y=b.y:a&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a};var E=new iH((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new iH((T.x-b.x)/3*2+b.x,(T.y-b.y)/3*2+b.y);return{type:"ease",p0:b,p1:E,p2:_,p3:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var a6=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,o=e.z,s=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r){t.x=n,t.y=a,t.z=o,t.w=s;return}if(1===r){t.x=u,t.y=h,t.z=l,t.w=c;return}if(s!==c||n!==u||a!==h||o!==l){var f=1-r,d=n*u+a*h+o*l+s*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,o=o*f+l*g,s=s*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+o*o+s*s);n*=x,a*=x,o*=x,s*=x}}t.x=n,t.y=a,t.z=o,t.w=s},t}(),a8="not_implement",a9=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(a8)},e.getIntegrateValue=function(t,e,i){throw Error(a8)},e.getIntegrateByTime=function(t,e){throw Error(a8)},e.getValue=function(t){throw Error(a8)},e.getMaxTime=function(){throw Error(a8)},e.toUniform=function(t){throw Error(a8)},e.map=function(t){throw Error(a8)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(a8)},t.getAllData=function(t,e){for(var i=new(e?aD:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var o=a[r].toData();i.set(o,n),n+=o.length}return e?i.data:i},t}(),a7=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(a9),ot=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(a9),oe=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){return this.min+(null!=e?e:Math.random())*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){return(this.min+(null!=i?i:1)*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(a9),oi=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(a9),or=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return ol(e,0,this.xCoord,this.min,this.max)-ol(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(a9),on=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=eG(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.stop<=t&&a.stop>t){var o=(t-n.stop)/(a.stop-n.stop);return ej(n.color,a.color,o,!0)}}return e[i].color.slice()},e}(a9),oa=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],o=n[0],s=a[0];if(t>=o&&t<=s){var u=(t-o)/(s-o),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?ol:oh,o=0;o<n;o++){var s=i[o],u=i[o+1],h=s[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,s[1],u[1]);r+=a(l,h,l,s[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=Math.ceil(this.keys.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(a9),oo=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var o=a[1]-n[1],s=void 0;return s=0===o?(t-n[0])/(a[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,o=(t-e[0])/r,s=o*o,u=s*o;return(2*u-3*s+1)*e[1]+(u-2*s+o)*n+(u-s)*a+(-2*u+3*s)*i[1]}(t,n,a)-n[1])/o,this.calculateVec(r,s)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(a9),os=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=new iY(i[n][0],i[n][1],i[n][2]),u=new iY(i[n+1][0],i[n+1][1],i[n+1][2]),h=new iY(r[2*n][0],r[2*n][1],r[2*n][2]),l=new iY(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=a4(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new a1(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=aZ(t,5),i=0,r=new iY,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,o=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=this.curveSegments[n[s]].timeStart,h=this.curveSegments[n[s]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=aZ((e-r.x)/n,4);return ij(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(a9),ou=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=iZ.fromArray(i[n]),u=iZ.fromArray(i[n+1]),h=iZ.fromArray(r[2*n]),l=iZ.fromArray(r[2*n+1]),c=a4(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new a2(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=aZ(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<r.length;o++){var s=r[o].split("&"),u=s[0],h=s[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=aZ((e-r.x)/n,4);return ij(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(a9);function oh(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function ol(t,e,i,r,n){var a=t*t,o=e*e;return(a*t*2*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function oc(t,e){if(e){var i=e[0],r=e[1];if(i===tG.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===tG.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var o=Math.ceil(a/2);t.lineSegCount+=o,t.curves.push(r),t.index+=o,t.max=Math.max(t.max,o)}else if(i===tG.BEZIER_CURVE){var s=r.length-1;t.index+=2*s,t.curves.push(r),t.max=Math.max(t.max,2*s),t.curveCount+=2*s}}}function of(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function od(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(od=function(){return!!t})()}function op(t,e,i){return(op=od()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&iv(n,i.prototype),n}).apply(null,arguments)}var om=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new ry,e}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oT(t[0]),this.yCurve=oT(t[1]),this.zCurve=oT(t[2]),this.wCurve=oT(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(a9),ov=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iY,e}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oT(t[0]),this.yCurve=oT(t[1]),this.zCurve=oT(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(a9),oy=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iH,e}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oT(t[0]),this.yCurve=oT(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(a9);t.TangentMode=void 0,(tv=t.TangentMode||(t.TangentMode={}))[tv.Cubic=0]="Cubic",tv[tv.Linear=1]="Linear",tv[tv.Constant=2]="Constant",t.WeightedMode=void 0,(ty=t.WeightedMode||(t.WeightedMode={}))[ty.None=0]="None",ty[ty.In=1]="In",ty[ty.Out=2]="Out",ty[ty.Both=3]="Both";var og=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=t;var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=function(t,e){var i,r,n,a=new iH(t.time,t.value),o=new iH,s=new iH,u=new iH,h=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,l=2===t.tangentMode,c=(h?t.outWeight:1)*(e.time-t.time)/3;o.x=t.time+c,o.y=t.value+c*(l?0:t.outSlope);var f=(h?e.inWeight:1)*(e.time-t.time)/3;s.x=e.time-f,s.y=e.value-f*(l?0:e.inSlope),u.x=e.time,u.y=l?t.value:e.value,e2(s),e2(u);var d=u.x-a.x,p=u.y-a.y,m=aZ((o.x-a.x)/d,5),v=aZ((s.x-a.x)/d,5);aY(p,0)?i=r=NaN:(i=aZ((o.y-a.y)/p,5),r=aZ((s.y-a.y)/p,5)),m<0&&(console.error("Invalid bezier points, x1 < 0",a,o,s,u),m=0),v<0&&(console.error("Invalid bezier points, x2 < 0",a,o,s,u),v=0),m>1&&(console.error("Invalid bezier points, x1 >= 1",a,o,s,u),m=1),v>1&&(console.error("Invalid bezier points, x2 >= 1",a,o,s,u),v=1);var y=("bez_"+m+"_"+i+"_"+v+"_"+r).replace(/\./g,"p");return aK[y]?n=aK[y]:(n=aY(p,0)?new a3:h?new a3(m,i,v,r):new a3(i,r),aK[y]=n),{points:[a,o,s,u],timeInterval:d,valueInterval:p,curve:n}}(e[i],e[i+1]),n=r.points,a=r.curve,o=r.timeInterval,s=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:o,valueInterval:s,curve:a,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var o=this.curveInfos[r],s=o.points[0],u=o.timeInterval,h=o.valueInterval,l=(t-s.x)/u,c=o.curve.getValue(l);e=s.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var o=0;o<a.length;o++){var s=this.curveMap[a[o]].timeStart,u=this.curveMap[a[o]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[o],Number(u))),r>=Number(s)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[o],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=0,s=(e-r.x)/20,u=0;u<=20;u++){var h=u*s/n,l=r.y+a*i.curve.getValue(h);0===u||20===u?o+=l:u%2==1?o+=4*l:o+=2*l}return s/3*o},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(a9);function ox(t){for(var e=[],i=[],r={x:0,y:0},n=0;n<t.length-1;n++){var a=t[n],o=t[n+1],s=a5(a,o,!0),u=s.p0,h=s.p1,l=s.p2,c=s.p3;e2(l),e2(c);var f={leftControl:r,value:u,rightControl:h,tangentMode:0};if(a[0]===tj.HOLD&&(f.tangentMode=2),i.push(f),r=l,n===t.length-2){var d=a5(o,o,!0);e2(d.p3),i.push({leftControl:l,value:d.p3,rightControl:{x:0,y:0},tangentMode:o[0]===tj.HOLD?2:0})}}for(var p=function(t,e){return(e.y-t.y)/(e.x-t.x+1e-6)},m=0;m<i.length;m++){var v=i[m].leftControl,y=i[m].value,g=i[m].rightControl,x=p(y,g),b=p(v,y),T={time:y.x,value:y.y,inSlope:b,outSlope:x,inWeight:0,outWeight:0,tangentMode:i[m].tangentMode,weightedMode:3};e.push(T),m>0&&(T.inWeight=(y.x-v.x)/((y.x-i[m-1].value.x)/3)),m+1<i.length&&(T.outWeight=(g.x-y.x)/((i[m+1].value.x-y.x)/3))}return e}var ob=((ep={})[tG.RANDOM]=function(t){return eI(t[0],Array)?new oi(t):new oe(t)},ep[tG.CONSTANT]=function(t){return new a7(t)},ep[tG.CONSTANT_VEC2]=function(t){return new a7(t)},ep[tG.CONSTANT_VEC3]=function(t){return new a7(t)},ep[tG.CONSTANT_VEC4]=function(t){return new a7(t)},ep[tG.RGBA_COLOR]=function(t){return new a7(t)},ep[tG.COLORS]=function(t){return new ot(t.map(function(t){return eU(t,!1)}))},ep[tG.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new or([t[0][1],t[1][1]]):new oa(t)},ep[tG.GRADIENT_COLOR]=function(t){return new on(t)},ep[tG.LINEAR_PATH]=function(t){return new oo(t)},ep[tG.BEZIER_CURVE]=function(t){return 1===t.length?new a7(t[0][1][1]):new og(ox(t))},ep[tG.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new a7(op(iY,[].concat(t[1][0]))):new os(t)},ep[tG.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new a7(op(iZ,[].concat(t[1][0]))):new ou(t)},ep[tG.COLOR_CURVE]=function(t){return new oE(t)},ep[tG.VECTOR4_CURVE]=function(t){return new om(t)},ep[tG.VECTOR2_CURVE]=function(t){return new oy(t)},ep[27]=function(t){return new ov(t)},ep);function oT(t){if(!t||!isNaN(+t))return new a7(t||0);if(eI(t,a9))return t;if(e7(ob[t[0]]))return ob[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+aE["ValueType: 21/22 is not supported"]+".")}var oE=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new rx,e}iy(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=oT(t[0]),this.gCurve=oT(t[1]),this.bCurve=oT(t[2]),this.aCurve=oT(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(a9),o_=1,oC=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),a=this.createGeometry();this.mesh=this.createMesh(a,n),this.updateMesh()}var i=e.prototype;return i.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new iY,n=new iZ,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},i.createMaterial=function(e){var i,r=[["ENV_EDITOR",(null==(i=this.engine.renderer)?void 0:i.env)===aT]],n=oT(this.color).getValue(0),a={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:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},o=r9.create(this.engine,a);return o.blending=!0,o.depthTest=!1,o.setVector4("uPos",new ry(0,0,0,0)),o.setVector2("uSize",new iH(1,1)),o.setVector4("uColor",new ry(n[0]/255,n[1]/255,n[2]/255,n[3])),o.setQuaternion("uQuat",new iZ(0,0,0,0)),o},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return nc.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:rE.LINES,maxVertex:4})},i.createMesh=function(t,e){return nb.create(this.engine,{name:"Interact_preview"+o_++,priority:0,worldMatrix:rb.fromIdentity(),geometry:t,material:e})},e}();function oS(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.speed=25,t.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},t.invalidBorderRange=0,t.invalidByBorderRange=!1,t.duringPlay=!1,t._interactive=!0,t.lastTime=-1,t.getHitTestParams=function(e){if(t.clickable){var i=t.item.props.content.options.behavior,r=t.getBoundingBox();if(r)return{type:r.type,triangles:r.area,behavior:i}}},t}iy(i,e);var r=i.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.engine.renderer.env,e=this.item.composition,i=this.interactData.options,r=i.type,n=i.showPreview;if(r===tV.CLICK&&(this.clickable=!0,n&&t===aT)){var a=null==e?void 0:e.getRendererOptions();void 0!==a&&(this.previewContent=new oC(this.item.props.content,a,this.transform,this.engine))}this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){e.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){e.prototype.onEnable.call(this);var t=this.interactData.options.type,i=this.item.engine.renderer.env;if(t===tV.CLICK)this.clickable=!0;else if(t===tV.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==aT||n){var a,o=(null!=(a=this.item.composition)?a:{}).event;o&&this.beginDragTarget(r,o)}}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,oS(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,a=n.position,o=n.fov,s=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(o*Math.PI/180/2)*Math.abs(h),c=this.dragRange,f=c.dxRange,d=c.dyRange,p=a[0]-this.dragRatio[0]*(u*l),m=a[1]-this.dragRatio[1]*(s*l),v=f[0],y=f[1],g=d[0],x=d[1];p=ij(p,v,y),m=ij(m,g,x),p!==v&&p!==y&&v!==y&&(null==(i=e.origin)||i.preventDefault()),m!==g&&m!==x&&g!==x&&(null==(r=e.origin)||r.preventDefault()),this.item.composition.camera.position=new iY(p,m,h)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var a={touchstart:function(t){if(n.canInteract()&&(n.invalidByBorderRange=n.checkInvalidBorderRange({x:t.x,y:t.y}),!n.invalidByBorderRange)){n.dragEvent=null,n.bouncingArg=null;var e,i=null==(e=n.item.composition)?void 0:e.camera;r={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){n.invalidByBorderRange||(n.handleDragMove(r,t),n.bouncingArg=t)},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!oS(e,3)&&e&&(e.vx*=n.speed,e.vy*=n.speed,n.dragEvent=ik({},r)),r=null}}};Object.keys(a).forEach(function(t){e.addEventListener(t,a[t])}),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=aH(iY.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.interactData=t,t.options.type===tV.DRAG){var i=t.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},r.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i,r,n,a,o=0,s=0,u=0,h=0;if("number"==typeof e?(o=e,s=e,u=e,h=e):e9(e)&&(o=void 0===(i=e[0])?0:i,s=void 0===(r=e[1])?0:r,u=void 0===(n=e[2])?0:n,h=void 0===(a=e[3])?0:a),t.x<h-1||t.x>1-s||t.y<o-1||t.y>1-u)return!0}return!1},rd(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(rv),t.InteractComponent=eR([i_(et.InteractComponent)],t.InteractComponent);var oA=function(){function e(){this.triangles=[],this.worldMatrix=new rb,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var o=3*e[a],s=3*e[a+1],u=3*e[a+2],h={x:t[o],y:t[o+1],z:t[o+2]},l={x:t[s],y:t[s+1],z:t[s+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var i=e.prototype;return i.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},i.getBoundingBox=function(){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,a=Number.MAX_VALUE,o=eO(this.boundingBoxData.area);!(e=o()).done;){var s=e.value;i=Math.max(s.p0.x,s.p1.x,s.p2.x,i),r=Math.max(s.p0.y,s.p1.y,s.p2.y,r),n=Math.min(s.p0.x,s.p1.x,s.p2.x,n),a=Math.min(s.p0.y,s.p1.y,s.p2.y,a)}var u=[],h=new iY(n,r,0),l=new iY(i,r,0),c=new iY(i,a,0),f=new iY(n,a,0);return u.push({p0:h,p1:l,p2:c}),u.push({p0:h,p1:c,p2:f}),this.applyWorldMatrix(u),{type:t.HitTestType.triangle,area:u}},i.setGeometry=function(e,i){this.triangles=this.geometryToTriangles(e);for(var r,n=[],a=eO(this.triangles);!(r=a()).done;){var o=r.value;n.push({p0:o.p0,p1:o.p1,p2:o.p2})}i&&this.worldMatrix.copyFrom(i),this.boundingBoxData={type:t.HitTestType.triangle,area:n}},i.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,a=eO(t.subMeshes);!(n=a()).done;){var o=n.value;if(void 0!==o.indexCount){var s=e.BYTES_PER_ELEMENT,u=o.offset/s,h=u+o.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},i.applyWorldMatrix=function(t){var e=this;return t.forEach(function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new iY),t.p1=e.worldMatrix.transformPoint(t.p1,new iY),t.p2=e.worldMatrix.transformPoint(t.p2,new iY)}),t},e}(),ow=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="sprite",e}return iy(e,t),e}(im),oO=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=eO(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,n=eO(this.playableOutputs);!(r=n()).done;){var a=r.value;this.prepareFrameWithRoot(a)}for(var o,s=eO(this.playableOutputs);!(o=s()).done;){var u=o.value;this.processFrameWithRoot(u)}},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}(),oI=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(){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}(),oM=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}(),oR=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(iA);function oP(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(tg=em||(em={}))[tg.Playing=0]="Playing",tg[tg.Paused=1]="Paused";var oN=new iZ,oV=1,oL=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new iY(0,0,0),this.quat=new iZ(0,0,0,1),this.rotation=new nd(0,0,0),this.scale=new iY(1,1,1),this.anchor=new iY(0,0,0),this.size=new iH(1,1),this.children=[],this.worldMatrix=rb.fromIdentity(),this.localMatrix=rb.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new iY(0,0,0),quat:new iZ(0,0,0,1),scale:new iY(1,1,1)},this.name="transform_"+oV++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,a=t.size,o=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(eI(i,iY)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)eI(o,iZ)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(r){var h=e?-1:1;eI(r,nd)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(eI(n,iY)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(eI(u,iH)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){eD(this.children,t)},e.removeChild=function(t){ek(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new nd)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;return this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1),this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new nd)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=new iY().copyFrom(t.position),t.quat?e.quat=new iZ(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new nd(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=new iY().copyFrom(t.scale),t.size&&(e.size=new iH().copyFrom(t.size)),t.anchor&&(e.anchor=new iH().copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.parentMatrixDirty=!0})},t.getRotation=function(t,e){var i=oN.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},rd(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}(),oF=new iY(1,1,1),oD=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new oL,this.viewportMatrix=rb.fromIdentity(),this.viewMatrix=rb.fromIdentity(),this.projectionMatrix=rb.fromIdentity(),this.viewProjectionMatrix=rb.fromIdentity(),this.inverseViewMatrix=rb.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?tB.portrait:o,u=e.position,h=void 0===u?[0,0,8]:u,l=e.rotation,c=void 0===l?[0,0,0]:l,f=new nd(c[0],c[1],c[2]),d=new iZ().setFromEuler(f);this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===a?1:a,clipMode:s},this.transform.setPosition(h[0],h[1],h[2]),this.transform.setQuaternion(d.x,d.y,d.z,d.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new iY(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,o=r.projectPoint(new iY(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new iY(-1,-1,a));return new iY((s-h.x)/2,(u-h.y)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return ik({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,o=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=o,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,o=e.clipMode;this.projectionMatrix.perspective(i*iz,r,n,a,o===tB.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),oF),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:rb.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},rd(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}(),ok=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=eI(r,a9)?r:oT(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),oz=function(t){this.content=t},oU=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new oz(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(0>=this.sort(i.content,e.content)))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new oz(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(0>=this.sort(e.content,i.content)))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do t.call(e||this,i.content,r++);while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do t.call(e||this,i.content,r--);while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),oB="lookup_texture",oG="offscreen_canvas",oj={},oX=new iY,oW=new iY,oH=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,a=i.colorOverTrail,o=i.maxTrailCount,s=i.opacityOverLifetime,u=void 0===s?oT(1):s,h=i.widthOverTrail,l=i.name,c=i.occlusion,f=i.blending,d=i.maskMode,p=i.mask,m=i.textureMap,v=i.texture,y=i.transparentOcclusion,g=i.minimumVertexDistance,x=i.lifetime,b=i.matrix,T=e.gpuCapability,E=T.detail,_=T.level,C=Math.max(i.pointCountPerTrail,2),S=of(),A=E.maxVertexTextures>0,w=(null!=(r=e.renderer)?r:{}).env,O={},I=[["ENABLE_VERTEX_TEXTURE",A],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===aT]],M=o>64,R=0;n&&(I.push(["COLOR_OVER_LIFETIME",!0]),R|=1,O.uColorOverLifetime=rK.createWithData(e,eJ(n))),a&&(I.push(["COLOR_OVER_TRAIL",!0]),R|=4,O.uColorOverTrail=rK.createWithData(e,eJ(a))),M?(I.push(["ATTR_TRAIL_START",1]),R|=8):O.uTrailStart=new Float32Array(o),O.uOpacityOverLifetimeValue=u.toUniform(S);var P=h.toUniform(S);I.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),O.uVCurveValues=a9.getAllData(S);var N={shader:{vertex:nO,fragment:nA,macros:I,glslVersion:1===_?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+l,cacheId:"-t:+"+R+"+"+S.index+"+"+S.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},V=C*o*2,L=(C-1)*o,F=Float32Array.BYTES_PER_ELEMENT,D=12*F,k={attributes:{aColor:{size:4,stride:D,data:new Float32Array(12*V)},aSeed:{size:1,stride:D,offset:4*F,dataSource:"aColor"},aInfo:{size:3,stride:D,offset:5*F,dataSource:"aColor"},aPos:{size:4,stride:D,offset:8*F,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(V)},aDir:{size:3,data:new Float32Array(3*V)}},indices:{data:new Uint16Array(6*V)},drawCount:6*L,name:"trail#"+l,bufferUsage:rE.DYNAMIC_DRAW};if(M)k.attributes.aTrailStart={size:1,data:new Float32Array(V)};else{var z=new Float32Array(V);k.attributes.aTrailStartIndex={size:1,data:z};for(var U=0;U<o;U++)for(var B=2*C,G=U*B,j=0;j<B;j++)z[G+j]=U}var X=rA(f),W=r9.create(e,N);W.blending=!0,W.depthMask=c,W.depthTest=!0,W.stencilRef=p?[p,p]:void 0,rI(W,d),rw(W,f);var H=this.mesh=nb.create(e,{name:"MTrail_"+l,material:W,geometry:nc.create(e,k)}),Y=null!=v?v:rK.createWithData(e);Object.keys(O).map(function(t){var e=O[t];if(eI(e,rK))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new ry(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i)}else W.setVector4(t,ry.fromArray(e))}),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",ry.fromArray(P)),W.setVector2("uTexOffset",new iH(0,0)),W.setVector4("uTextureMap",ry.fromArray(void 0===m?[0,0,1,1]:m)),W.setVector4("uParams",new ry(0,C-1,0,0)),W.setTexture("uMaskTex",Y),W.setVector4("uColorParams",new ry(v?1:0,+X,0,+(c&&!y))),this.maxTrailCount=o,this.pointCountPerTrail=C,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=M,this.lifetime=x,b&&(this.mesh.worldMatrix=b),this.geometry=H.firstGeometry(),this.trailCursors=new Uint16Array(o)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,o=n-1,s=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,oX);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+s,f=oQ(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),a.setAttributeSubData("aDir",6*c,v),a.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var y=i.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(p,4),g[7]=0,g.set(x,8),g[11]=.5*m,g.set(y,12),g.set(p,16),g[19]=1,g.set(x,20),g[23]=-.5*m,a.setAttributeSubData("aColor",24*c,g),u>=0){var b=new Float32Array(oQ(this.getTrailPosition(t,h,oW),l,e)),T=(t*n+u)*6;a.setAttributeSubData("aDir",T,b),a.setAttributeSubData("aDir",T+3,b);var E=t*n*2,_=new Uint16Array([2*u+E,2*u+1+E,2*s+E,2*s+E,2*u+1+E,2*s+1+E]),C=(t*o+(r-1)%o)*6;a.setIndexSubData(C,_)}r=++this.trailCursors[t];var S=this.mesh.material,A=S.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var O=2*n,I=new Float32Array(O),M=0;M<O;M++)I[M]=w;a.setAttributeSubData("aTrailStart",t*I.length,I)}else{var R=S.getFloats("uTrailStart");void 0!=R&&(R[t]=w,S.setFloats("uTrailStart",R))}A&&(A.y=Math.max(A.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",A))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,a=this.geometry.getAttributeData("aColor");return e2(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();e2(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},i.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");e2(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},i.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,i=this.geometry.getIndexData();e2(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},i.getPointStartPos=function(t){return this.pointStart[t]},i.setPointStartPos=function(t,e){this.pointStart[t]=e},i.onUpdate=function(t){},rd(e,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),e}(),oY=new iY,oZ=new iY,oq=new iY;function oQ(t,e,i){return t||i?(t?i?(oZ.subtractVectors(e,t).normalize(),oZ.subtractVectors(i,e),oq.copyFrom(oZ).normalize(),oY.addVectors(oZ,oq)):oY.subtractVectors(e,t):oY.subtractVectors(i,e),oY.normalize().toArray()):[0,0,0]}var oK=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}iy(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&eI(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;e&&(this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),e.update(this.time-e.time)),this.lastTime=this.time},i}(oI),oJ=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createPlayable=function(t){return new oK(t)},e}(oR),o$={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"},o0=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new iY,this.cachedRotationMatrix=new np,this.cachedLinearMove=new iY,this.tempMatrix3=new np,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,a,o,s,u,h,l,c,f=(null!=(h=e.renderer)?h:{}).env,d=i.speedOverLifetime,p=i.colorOverLifetime,m=i.linearVelOverLifetime,v=i.orbitalVelOverLifetime,y=i.sizeOverLifetime,g=i.rotationOverLifetime,x=i.sprite,b=i.gravityModifier,T=i.maxCount,E=i.textureFlip,_=i.useSprite,C=i.name,S=i.gravity,A=i.forceTarget,w=i.side,O=i.occlusion,I=i.anchor,M=i.blending,R=i.maskMode,P=i.mask,N=i.transparentOcclusion,V=i.meshSlots,L=i.renderMode,F=void 0===L?0:L,D=i.diffuse,k=void 0===D?rK.createWithData(e):D,z=e.gpuCapability.detail,U=z.halfFloatTexture,B=z.maxVertexUniforms,G=[["RENDER_MODE",+F],["ENV_EDITOR",f===aT]],j=e.gpuCapability.level,X=of(),W=of(),H=B>0,Y={},Z=0,q=0;this.useSprite=_,H&&G.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(G.push(["SPEED_OVER_LIFETIME",!0]),q|=2,Y.uSpeedLifetimeValue=d.toUniform(X)),(null==x?void 0:x.animate)&&(G.push(["USE_SPRITE",!0]),q|=4,Y.uFSprite=Y.uSprite=new Float32Array([x.col,x.row,x.total,x.blend?1:0]),this.useSprite=!0),(null==p?void 0:p.color)&&(G.push(["COLOR_OVER_LIFETIME",!0]),q|=16,Y.uColorOverLifetime=eI(p.color,rK)?p.color:rK.createWithData(e,eJ(p.color))),(null==p?void 0:p.opacity)?Y.uOpacityOverLifetimeValue=p.opacity.toUniform(X):Y.uOpacityOverLifetimeValue=oT(1).toUniform(X),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==m?void 0:m[t])&&(Y["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=m[t].toUniform(X),i=1,q|=1<<7+e,m.enabled=!0),G.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==v?void 0:v[t])&&(Y["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(X),r=1,q|=1<<10+e,l=!0,v.enabled=!0),G.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==m?void 0:m.asMovement)&&(G.push(["AS_LINEAR_MOVEMENT",!0]),q|=32),l&&((null==v?void 0:v.asRotation)&&(G.push(["AS_ORBITAL_MOVEMENT",!0]),q|=64),Y.uOrbCenter=new Float32Array((null==v?void 0:v.center)||[0,0,0])),Y.uSizeByLifetimeValue=null==y?void 0:y.x.toUniform(X),(null==y?void 0:y.separateAxes)&&(G.push(["SIZE_Y_BY_LIFE",1]),q|=16384,Y.uSizeYByLifetimeValue=null==y?void 0:null==(c=y.y)?void 0:c.toUniform(X)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(X),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(X),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(X),q|=131072,G.push(["ROT_Y_LIFETIME",1])),(null==g?void 0:g.asRotation)&&(G.push(["ROT_LIFETIME_AS_MOVEMENT",1]),q|=262144),Y.uGravityModifierValue=b.toUniform(X),A&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(A.target||[0,0,0]),Y.uForceCurve=A.curve.toUniform(X)),U&&W.max?(q|=1048576,Y.uFCurveValueTexture=rJ(e,a9.getAllData(W,!0),W.index,1)):Y.uFCurveValues=a9.getAllData(W);var Q=X.max+X.curves.length-32>B;if(2===j&&(X.max=-1,X.index=V?V[0]:o2(X.index),W.index>0&&(W.max=-1,W.index=V?V[1]:o2(W.index))),Q&&U&&H){var K=rJ(e,a9.getAllData(X,!0),X.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=a9.getAllData(X);var J=["-p:",F,q,X.index,X.max,W.index,W.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",X.index],["FRAG_CURVE_VALUE_COUNT",W.index],["VERT_MAX_KEY_FRAME_COUNT",X.max],["FRAG_MAX_KEY_FRAME_COUNT",W.max]),this.VERT_MAX_KEY_FRAME_COUNT=X.max;var $={fragment:nA,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+nw,glslVersion:1===j?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+C},tt=rA(M);Y.uTexOffset=new Float32Array(k?[1/k.getWidth(),1/k.getHeight()]:[0,0]),Y.uMaskTex=k,Y.uColorParams=new Float32Array([k?1:0,+tt,0,+(!!O&&!N)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(null==S?void 0:S[0])||0,(null==S?void 0:S[1])||0,(null==S?void 0:S[2])||0,0];var te=r9.create(e,{shader:$,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});te.blending=!0,te.depthTest=!0,te.depthMask=!!O,te.stencilRef=P?[P,P]:void 0,rI(te,R),rw(te,M),rO(te,w),Object.keys(Y).map(function(t){var e=Y[t];if(eI(e,rK)){te.setTexture(t,e);return}var i=[];switch(o$[t]){case"vec4":te.setVector4(t,ry.fromArray(e));break;case"vec3":te.setVector3(t,iY.fromArray(e));break;case"vec2":te.setVector2(t,iH.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new ry(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}te.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),te.setVector3("emissionColor",new iY(0,0,0)),te.setFloat("emissionIntensity",0);var ti=nc.create(e,(r=4*T,n=this.useSprite,a="particle#"+C,u={aPos:{size:3,offset:0,stride:s=12*(o=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*o,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*o,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*o,stride:s,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*o,data:new Float32Array(0)},aSeed:{size:1,offset:3*o,stride:8*o,dataSource:"aRot"},aColor:{size:4,offset:4*o,stride:8*o,dataSource:"aRot"},aOffset:{size:4,stride:4*o,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*o,data:new Float32Array(0)},aRotation1:{size:3,offset:3*o,stride:9*o,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*o,stride:9*o,dataSource:"aRotation0"}},n&&(u.aSprite={size:3,stride:3*o,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:a,maxVertex:r})),tr=nb.create(e,{name:"MParticle_"+C,material:te,geometry:ti});this.anchor=I,this.mesh=tr,this.geometry=tr.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=y,this.speedOverLifetime=d,this.linearVelOverLifetime=m,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=b,this.rotationOverLifetime=g,this.maxCount=T,this.textureOffsets=E?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var i=e.prototype;return i.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return e2(e),[e[i],e[i+1],e[i+2],e[i+3]]},i.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},i.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.constructor(0))}t.setIndexData(new i.constructor(0))},i.onUpdate=function(t){var e=Math.ceil(this.geometry.getAttributeData("aPos").length/12);this.applyTranslation(e,t),this.applyRotation(e,t),this.applyLinearMove(e,t)},i.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},i.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},i.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r,n=t+1,a=4*n,o=this.geometry,s=n>this.maxParticleBufferCount,u=1;this.particleCount>300?u=(this.particleCount+100)/this.particleCount:this.particleCount>100?u=1.4:this.particleCount>0&&(u=2);var h={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},l=this.useSprite;l&&(h.aSprite=new Float32Array(12));var c=new iY,f=new iZ,d=new iY(1,1,1);e.transform.assignWorldTRS(c,f,d);var p=oL.getRotation(f,new nd),m=c.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();l&&(r=e.sprite);for(var C=0;C<4;C++){var S=2*C,A=3*C,w=4*C,O=12*C,I=8*C;h.aPos.set(m,O),b.fill(h.aPos,O+3),h.aRot.set(v,I),h.aRot[I+3]=_,h.aRot.set(T,I+4),l&&h.aSprite.set(r,A);var M=e.uv||x;if(M){var R=l?1-y[S+1]:y[S+1];g[0]=M[0]+y[S]*M[2],g[1]=M[1]+R*M[3]}h.aOffset.set(g,w);for(var P=C+C,N=(E[P]-this.anchor.x)*d.x,V=(E[P+1]-this.anchor.y)*d.y,L=0;L<3;L++)h.aPos[O+6+L]=e.dirX.getElement(L)*N,h.aPos[O+9+L]=e.dirY.getElement(L)*V}var F=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var D=ez(o.getIndexData(),6*n,6*i,u);D.set(F,6*t),o.setIndexData(D),this.maxParticleBufferCount=D.length/6}else o.setIndexSubData(6*t,F);Object.keys(h).forEach(function(e){var r=h[e],n=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=o.getAttributeData(e);e2(l);var c=ez(l,a*n,4*i*n,u);c.set(r,r.length*t),o.setAttributeData(e,c)}else o.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),o.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);o=o*x+v,s=s*x+y,u=u*x+g}else o+=v,s+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=e/1e3*o,E=e/1e3*s,_=e/1e3*u;r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},i.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),o=this.time,s=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=ij((o-r[4*u+2])/r[4*u+3],0,1),l=8*u,c=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),f=a[8*u+3];this.rotationOverLifetime?(this.rotationOverLifetime.x&&(eI(this.rotationOverLifetime.x,oe)?c.x+=this.rotationOverLifetime.x.getValue(h,f):c.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(eI(this.rotationOverLifetime.y,oe)?c.y+=this.rotationOverLifetime.y.getValue(h,f):c.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(eI(this.rotationOverLifetime.z,oe)?c.z+=this.rotationOverLifetime.z.getValue(h,f):c.z+=this.rotationOverLifetime.z.getValue(h))):s.setZero(),0===c.dot(c)&&s.identity();var d=Math.PI/180,p=c.x*d,m=c.y*d,v=c.z*d,y=Math.sin(p),g=Math.sin(m),x=Math.sin(v),b=Math.cos(p),T=Math.cos(m),E=Math.cos(v);s.set(E,-x,0,x,E,0,0,0,1),s.multiply(this.tempMatrix3.set(T,0,g,0,1,0,-g,0,T)),s.multiply(this.tempMatrix3.set(1,0,0,0,b,-y,0,y,b));var _=9*u,C=s.elements;i.set(C,_),u+4<=t&&(i.set(C,_+9),i.set(C,_+18),i.set(C,_+27))}this.geometry.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var s=0;s<t;s+=4){var u=a-r[4*s+2],h=r[4*s+3],l=u/h,c=n[8*s+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(eI(this.linearVelOverLifetime.x,oe)?o.x=this.linearVelOverLifetime.x.getValue(l,c):o.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(eI(this.linearVelOverLifetime.y,oe)?o.y=this.linearVelOverLifetime.y.getValue(l,c):o.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(eI(this.linearVelOverLifetime.z,oe)?o.z=this.linearVelOverLifetime.z.getValue(l,c):o.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(eI(this.linearVelOverLifetime.x,oe)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(eI(this.linearVelOverLifetime.y,oe)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(eI(this.linearVelOverLifetime.z,oe)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*s;i[f]=o.x,i[f+1]=o.y,i[f+2]=o.z,i[f+3]=o.x,i[f+4]=o.y,i[f+5]=o.z,i[f+6]=o.x,i[f+7]=o.y,i[f+8]=o.z,i[f+9]=o.x,i[f+10]=o.y,i[f+11]=o.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),o1=[10,32,64,160];function o2(t){for(var e=0;e<o1.length;e++){var i=o1[e];if(i>t)return i}return t||o1[0]}var o3=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new o0(e,i)),r&&(n.trailMesh=new oH(e,r));var n,a=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(a.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=a,n}iy(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=eO(this.meshes);!(t=e()).done;)t.value.onStart()},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new ry;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t);for(var e,i=eO(this.meshes);!(e=i()).done;)e.value.render(t)},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(rv);t.ParticleSystem=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).destroyed=!1,n.getHitTestParams=function(e){var i=n.interaction;if(e||i)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==i?void 0:i.radius)||.4,multiple:!!(null==i?void 0:i.multiple),removeParticle:(null==i?void 0:i.behavior)===tW.removeParticle,ray:t})}}},n.maskManager=new r7(i),r&&n.fromData(r),n}iy(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===tG.CONSTANT_VEC3?e.add(r[1]):t=oT(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new oU(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.onStart=function(){this.startEmit(),this.initEmitterTransform()},r.onUpdate=function(t){this.update(t)},r.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,o.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,a,n)}))};if(this.ended){if(this.item.endBehavior!==tX.restart&&tX.destroy===this.item.endBehavior){var c=o.last;c&&c.content[0]<this.time&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/a.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=p/m,y=r.maxCount;this.updateEmitterTransform(u);for(var g=function(){var t=o.first;return e.emissionStopped||o.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var b=this.createPoint(d);b.delay+=i+x*v,this.addParticle(b,y),this.lastEmitTime=u}for(var T=a.bursts,E=(null==T?void 0:T.length)-1,_=0;E>=0&&_<y&&!g();E--){var C=T[E],S=!C.disabled&&C.getGeneratorOptions(u,d);if(S){var A=[0,0,0],w=a.burstOffsets[E],O=w&&w[S.cycleIndex]||A;C.once&&this.removeBurst(E);for(var I=0;I<S.count&&_<y&&!g();I++){var M,R=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:I,burstCount:S.count}));R.delay+=i,_++,(M=R.transform).translate.apply(M,[].concat(O)),this.addParticle(R,y)}}}}else this.item.endBehavior===tX.restart?(l(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.time-=f,a.bursts.forEach(function(t){return t.reset()}),this.particleLink.forEach(function(t){t[0]-=f,t[2]-=f,t[3].delay-=f}),this.renderer.minusTimeForLoop(f)):(this.ended=!0,this.item.endBehavior===tX.freeze&&(this.frozen=!0))}l()}},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],i=0;i<this.renderer.meshes.length;i++){var r=this.renderer.meshes[i].material;e.push(r.colorMask),r.colorMask=!1}for(var n,a=eO(this.renderer.meshes);!(n=a()).done;)n.value.render(t);for(var o=0;o<this.renderer.meshes.length;o++)this.renderer.meshes[o].material.colorMask=e[o]}},r.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach(function(e){return e.dispose({material:{textures:t.DestroyOptions.keep}})})},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var a=t.last,o=!1;!o;){var s=a.content[0],u=a.content[3];if(s>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.pre:o=!0}++n>r&&(o=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new iY,o=!1;if(r&&r.content)do{var s=r.content,u=s[0],h=s[1];s[2];var l=s[3];if(u>this.timePassed){var c=this.getPointPosition(l),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:c,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(c),t.multiple||(o=!0))}}while((r=r.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,o=this.getPointPosition(i),s=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&o.subtract(c)}n.addTrailPoint(t,o,{color:s,lifetime:l,size:h,time:r})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=this.options.forceTarget,s=this.time-n,u=new iY,h=iY.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var l=aU(new iY,this.options,h,s,r,u,i);if(o){var c=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;l.x=l.x*d+c[0]*f,l.y=l.y*d+c[1]*f,l.z=l.z*d+c[2]*f}return l},r.initPoint=function(t){var e,i,r,n,a=this.options,o=this.lifetime,s=this.shape,u=a.startSpeed.getValue(o),h=a.particleFollowParent?rb.IDENTITY:this.transform.getWorldMatrix(),l=t.position,c=new oL({position:h.transformPoint(l,new iY),valid:!0}),f=t.direction;if(f=h.transformNormal(f,o4).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)o7.setElement(d,a.turbulence[d].getValue(o));st.setFromVector3(o7.negate()),si.setFromEuler(st).transformNormal(f).normalize()}s.alignSpeedDirection?(o9.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=iY.Z.clone(),h.transformNormal(this.upDirectionWorld)),o8.crossVectors(o9,this.upDirectionWorld).normalize(),o8.isZero()&&o8.set(1,0,0)):(o8.set(1,0,0),o9.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=se)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?o6.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?o6.set(0,0,a.startRotation.getValue(o)):o6.set(0,0,0),c.setRotation(o6.x,o6.y,o6.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)o5.x=a.startSizeX.getValue(o),o5.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);o5.x=v,o5.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new iY;this.transform.assignWorldTRS(void 0,void 0,x),o5.x*=x.x,o5.y*=x.y}return c.setScale(o5.x,o5.y,1),{size:o5,vel:g,color:m,delay:a.startDelay.getValue(o),lifetime:a.startLifetime.getValue(o),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:a.gravity,sprite:n,dirY:o9,dirX:o8,transform:c}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&eI(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,r,n,a,o,s,u,h,l,c,f,d,p,m=t.options,v=t.positionOverLifetime,y=void 0===v?{}:v,g=t.shape,x=null==y?void 0:y.gravityOverLifetime,b=aB(null==y?void 0:y.gravity),T=t.textureSheetAnimation,E=T?{animationDelay:oT(T.animationDelay||0),animationDuration:oT(T.animationDuration||1),cycles:oT(T.cycles||1),animate:T.animate,col:T.col,row:T.row,total:T.total||T.col*T.row}:void 0,_=!!(g&&g.turbulenceX||(null==g?void 0:g.turbulenceY)||(null==g?void 0:g.turbulenceZ));_&&(n=[oT(null!=(a=g.turbulenceX)?a:0),oT(null!=(o=g.turbulenceY)?o:0),oT(null!=(s=g.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=ar(g),this.emission={rateOverTime:oT(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=eI(t,Array),i=e?t[0]:t.index,n=r[i];n||(n=r[i]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),r),bursts:(t.emission.bursts||[]).map(function(t){return new ok(t)})},this.textureSheetAnimation=E;var C=t.renderer||{},S=t.rotationOverLifetime;S&&((h={}).asRotation=!!S.asRotation,h.z=S.z?oT(S.z):oT(0),S.separateAxes&&(h.x=S.x&&oT(S.x),h.y=S.y&&oT(S.y))),(null==y?void 0:y.forceTarget)&&(l={target:y.target||[0,0,0],curve:oT(y.forceCurve||[tG.LINE,[[0,0],[1,1]]])});var A={x:y.linearX&&oT(y.linearX||0),y:y.linearY&&oT(y.linearY||0),z:y.linearZ&&oT(y.linearZ||0),asMovement:y.asMovement},w={x:y.orbitalX&&oT(y.orbitalX),y:y.orbitalY&&oT(y.orbitalY),z:y.orbitalZ&&oT(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},O=t.sizeOverLifetime||{},I=t.colorOverLifetime,M=(null==O?void 0:O.separateAxes)?{separateAxes:!0,x:oT(O.x),y:oT(O.y)}:{separateAxes:!1,x:oT(("size"in O?O.size:O.x)||1)};C.anchor=C.anchor||[0,0];var R=iH.fromArray(C.anchor);this.options={particleFollowParent:!!m.particleFollowParent,startLifetime:oT(m.startLifetime),startDelay:oT(m.startDelay||0),startSpeed:oT(y.startSpeed||0),startColor:oT(m.startColor),looping:!1,maxCount:null!=(c=m.maxCount)?c:0,gravityModifier:oT(x||0),gravity:b,start3DSize:!!m.start3DSize,startTurbulence:_,turbulence:n,speedOverLifetime:y.speedOverLifetime&&oT(y.speedOverLifetime),linearVelOverLifetime:A,orbitalVelOverLifetime:w,forceTarget:l},m.startRotationZ&&(this.options.startRotation=oT(m.startRotationZ||0)),(m.startRotationX||m.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=oT(m.startRotationX||0),this.options.startRotationY=oT(m.startRotationY||0),this.options.startRotationZ=oT(m.startRotationZ||0)),m.start3DSize?(this.options.startSizeX=oT(m.startSizeX),this.options.startSizeY=oT(m.startSizeY)):(this.options.startSize=oT(m.startSize),this.options.sizeAspect=oT(m.sizeAspect||1)),t.mask&&this.maskManager.setMaskOptions(t.mask);var P={meshSlots:m.meshSlots,name:this.name,matrix:rb.IDENTITY,shaderCachePrefix:"",renderMode:C.renderMode||tD.BILLBOARD,side:C.side||tM.DOUBLE,gravity:b,blending:C.blending||tI.ALPHA,rotationOverLifetime:h,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:E,occlusion:!!C.occlusion,transparentOcclusion:!!C.transparentOcclusion,maxCount:m.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:l,diffuse:C.texture?this.engine.findObject(C.texture):void 0,sizeOverLifetime:M,anchor:R};if(I){var N=I.color,V=I.opacity;P.colorOverLifetime={},V&&(P.colorOverLifetime.opacity=oT(I.opacity)),N&&(N[0]===tG.GRADIENT_COLOR?P.colorOverLifetime.color=I.color[1]:N[0]===tG.RGBA_COLOR?P.colorOverLifetime.color=rK.createWithData(this.engine,{data:new Uint8Array(N[1]),width:1,height:1}):eI(N,rK)&&(P.colorOverLifetime.color=N))}var L=[],F=[0,0,1,1];if(t.splits){var D=t.splits[0];F=(f=D[4])?[D[0],D[1],D[3],D[2]]:[D[0],D[1],D[2],D[3]]}if(E&&!E.animate)for(var k=f?E.row:E.col,z=f?E.col:E.row,U=E.total||k*z,B=0,G=0;G<k;G++)for(var j=0;j<z&&B<U;j++,B++)L.push([G*F[2]/k+F[0],j*F[3]/z+F[1],F[2]/k,F[3]/z]);else L.push(F);this.uvs=L,P.textureFlip=f;var X=t.trails;X&&(this.trails={lifetime:oT(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},X.mask&&this.maskManager.setMaskOptions(X.mask),d={name:"Trail",matrix:rb.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:m.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture?this.engine.findObject(X.texture):void 0,opacityOverLifetime:oT(X.opacityOverLifetime||1),widthOverTrail:oT(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===tG.GRADIENT_COLOR&&(d.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===tG.GRADIENT_COLOR&&(d.colorOverTrail=X.colorOverTrail[1])),this.renderer=new o3(this.engine,P,d),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var W=t.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(p=W.radius)?p:.4,behavior:W.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},rd(i,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),i}(rp),t.ParticleSystem=eR([i_(et.ParticleSystem)],t.ParticleSystem);var o4=new iY,o5=new iH,o6=new nd,o8=new iY,o9=new iY,o7=new iY,st=new nd,se=[0,0,0],si=new rb,sr=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clipPlayables=[],e.clipWeights=[],e}iy(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=eO(this.clipPlayables);!(e=i()).done;)e.value.processFrame(t);this.evaluate(t)},i.setClipWeight=function(t,e){if(eI(t,oI)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t){this.clipWeights[i]=e;return}}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(oI),sn=function(e){function i(){return e.apply(this,arguments)}return iy(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(eI(i,t.VFXItem)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},i}(sr),sa=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(oI),so=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return iy(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){var i=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var a=this.getClipPlayable(r);if(!eI(a,sa)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var o=a.value;this.addWeightedValue(o,n),i=!0}}i&&(e[this.propertyName]=this.propertyValue)}}},e}(sr),ss=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(so),su=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(so),sh=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.evaluate=function(t){},e}(sr),sl=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.evaluate=function(t){},e}(sr),sc=function(e){function i(){return e.apply(this,arguments)}return iy(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eI(i,t.CompositionComponent)&&(i.time=this.getTime())},i}(oI),sf=function(e){function i(){return e.apply(this,arguments)}return iy(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(eI(i,t.CompositionComponent)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},i}(sr),sd=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.evaluate=function(t){},e}(sr),sp=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(so),sm=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(so),sv=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===tX.restart?e%=i:this.endBehavior===tX.freeze&&(e=Math.min(i,e))),e},t}();t.TrackAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}iy(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new sr(t)},i.createOutput=function(){return new oM},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=eO(this.clips);!(i=n()).done;){var a=i.value;r.push(a)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),a=eO(e);!(r=a()).done;){var o=r.value,s=this.createClipPlayable(t,o);s.setDuration(o.duration);var u=new sy(o,s,n,this);i.push(u),n.clipPlayables.push(s),n.setClipWeight(s,0)}return n},i.createPlayable=function(t){return new oI(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new sv;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=eO(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=eO(this.children);!(i=r()).done;)i.value.parent=this},e}(oR),eR([iS(sv,void 0)],t.TrackAsset.prototype,"clips",void 0),eR([iS(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=eR([i_(et.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tx=t.TrackType||(t.TrackType={}))[tx.MasterTrack=0]="MasterTrack",tx[tx.ObjectTrack=1]="ObjectTrack";var sy=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,eI(this.track.boundObject,t.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,a=!1,o=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tX.destroy?eI(o,t.VFXItem)&&t.VFXItem.isParticle(o)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,a=!0):e<i.start&&(r=0),a&&this.playable.getPlayState()!==em.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var s=i.toLocalTime(e);this.playable.setTime(s),n&&this.playable.getPlayState()===em.Playing&&this.playable.pause()},rd(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),e}();t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createTrackMixer=function(t){return new sn(t)},e}(t.TrackAsset),t.ActivationTrack=eR([i_(et.ActivationTrack)],t.ActivationTrack);var sg=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}iy(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(t.TrackAsset);eR([iS(void 0,void 0)],sg.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new su(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},e}(sg),t.FloatPropertyTrack=eR([i_(et.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createTrackMixer=function(t){return new sl(t)},e}(t.TrackAsset),t.SpriteColorTrack=eR([i_(et.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}iy(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!eI(this.parent.boundObject,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(t.CompositionComponent)},r.createTrackMixer=function(t){return new sf(t)},i}(t.TrackAsset),t.SubCompositionTrack=eR([i_(et.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createTrackMixer=function(t){return new sd(t)},e}(t.TrackAsset),t.TransformTrack=eR([i_(et.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.updateAnimatedObject=function(){eI(this.parent.boundObject,rv)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(t.TrackAsset),eR([iS(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=eR([i_("MaterialTrack")],t.MaterialTrack);var sx=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createTrackMixer=function(t){return new sh(t)},e}(t.TrackAsset);t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createTrackMixer=function(t){var e=new sp(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sg),t.Vector4PropertyTrack=eR([i_(et.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createTrackMixer=function(t){var e=new sm(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sg),t.Vector2PropertyTrack=eR([i_("Vector2PropertyTrack")],t.Vector2PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createTrackMixer=function(t){var e=new ss(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sg),t.ColorPropertyTrack=eR([i_(et.ColorPropertyTrack)],t.ColorPropertyTrack),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createPlayable=function(t){var e=new sa(t);return e.curve=oT(this.curveData),e.value=e.curve.getValue(0),e},e}(oR),eR([iS(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=eR([i_(et.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createPlayable=function(t){var e=new sa(t);return e.curve=oT(this.curveData),e.value=e.curve.getValue(0),e},e}(oR),eR([iS(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=eR([i_(et.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createPlayable=function(t){return new sc(t)},e}(oR),t.SubCompositionPlayableAsset=eR([i_(et.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset),t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}iy(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){},r.create=function(e){if(eI(this.boundObject,t.VFXItem)){for(var i,r=this.boundObject,n=!1,a=eO(this.getChildTracks());!(i=a()).done;)if(eI(i.value,t.ActivationTrack)){n=!0;break}if(n){if(r.getComponent(t.ParticleSystem)){var o=e.createTrack(sx,this,"ParticleTrack");o.boundObject=this.boundObject;var s=o.createClip(oJ);s.start=r.start,s.duration=r.duration,s.endBehavior=r.endBehavior}if(r.getComponent(t.SpriteComponent)){var u=e.createTrack(sN,this,"ComponentTimeTrack");u.boundObject=this.boundObject.getComponent(t.SpriteComponent);var h=u.createClip(sV);h.start=r.start,h.duration=r.duration,h.endBehavior=r.endBehavior}if(r.getComponent(t.EffectComponent)){var l=e.createTrack(sN,this,"ComponentTimeTrack");l.boundObject=this.boundObject.getComponent(t.EffectComponent);var c=l.createClip(sV);c.start=r.start,c.duration=r.duration,c.endBehavior=r.endBehavior}}}},i}(t.TrackAsset),t.ObjectBindingTrack=eR([i_(et.ObjectBindingTrack)],t.ObjectBindingTrack);var sb=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i}return t.prototype.addChild=function(t){this.children.push(t)},t}();t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t.cacheFlattenedTracks=null,t}iy(i,e);var r=i.prototype;return r.createPlayable=function(e){for(var i,r=new sT(e),n=eO(this.tracks);!(i=n()).done;){var a=i.value;eI(a,t.ObjectBindingTrack)&&a.create(this)}return this.sortTracks(this.tracks),r.compileTracks(e,this.flattenedTracks),r},r.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},r.invalidate=function(){this.cacheFlattenedTracks=null},r.addSubTracksRecursive=function(t,e){for(var i,r=eO(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=eO(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},r.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new sE(t[i],i));e.sort(s_),t.length=0;for(var r,n=eO(e);!(r=n()).done;){var a=r.value;t.push(a.track)}},r.fromData=function(t){},rd(i,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=eO(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),i}(oR),eR([iS(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=eR([i_(et.TimelineAsset)],t.TimelineAsset);var sT=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.masterTrackInstances=[],e}iy(e,t);var i=e.prototype;return i.prepareFrame=function(t){},i.evaluate=function(){for(var t,e=this.getTime(),i=eO(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){for(var i,r={},n=eO(e);!(i=n()).done;){var a=i.value,o=a.createPlayableGraph(t,this.clips),s=a.createOutput();s.setUserData(a.boundObject),t.addOutput(s),s.setSourcePlayable(o);var u=new sb(a,o,s);r[a.getInstanceId()]=u,a.parent||this.masterTrackInstances.push(u)}for(var h,l=eO(e);!(h=l()).done;)for(var c,f=h.value,d=r[f.getInstanceId()],p=eO(f.getChildTracks());!(c=p()).done;){var m=r[c.value.getInstanceId()];d.addChild(m)}},e}(oI),sE=function(t,e){this.track=t,this.originalIndex=e};function s_(e,i){var r=e.track.boundObject,n=i.track.boundObject;return eI(r,t.VFXItem)&&eI(n,t.VFXItem)?t.VFXItem.isAncestor(r,n)?-1:t.VFXItem.isAncestor(n,r)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}t.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createPlayable=function(t){var e=new sa(t);return e.curve=oT(this.curveData),e.value=e.curve.getValue(0),e},e}(oR),eR([iS(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=eR([i_(et.Vector4PropertyPlayableAsset)],t.Vector4PropertyPlayableAsset),t.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createPlayable=function(t){var e=new sa(t);return e.curve=oT(this.curveData),e.value=e.curve.getValue(0),e},e}(oR),eR([iS(void 0,void 0)],t.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector2PropertyPlayableAsset=eR([i_(et.Vector2PropertyPlayableAsset)],t.Vector2PropertyPlayableAsset),t.CompositionComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.items=[],t.state=em.Playing,t.reusable=!1,t.sceneBindings=[],t.graph=new oO,t}iy(i,e);var r=i.prototype;return r.onStart=function(){var e;this.timelineAsset||(this.timelineAsset=new t.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tX.destroy&&this.setReusable(!0),null==(e=this.item.composition)||e.refContent.push(this.item)},r.setReusable=function(e){for(var r,n=eO(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value.boundObject;if(eI(a,t.VFXItem)){var o=a.getComponent(i);o&&o.setReusable(e)}}},r.getReusable=function(){return this.reusable},r.pause=function(){this.state=em.Paused},r.resume=function(){this.state=em.Playing},r.onUpdate=function(t){if(this.state!==em.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=eO(this.items);!(t=e()).done;)t.value.setActive(!0)},r.onDisable=function(){for(var t,e=eO(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(e,i,r,n,a,o){for(var s,u=[],h=(null==o?void 0:o.stop)||e6,l=(null==o?void 0:o.skip)||e6,c=(null==o?void 0:o.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<c;f++){var d=(s=this,function(o){var c=s.items[o];if(c.isActive&&c.transform.getValid()&&!t.VFXItem.isComposition(c)&&!l(c)){var f=c.getHitTestParams(a);if(f){var d=!1,p=new iY;if(f.type===t.HitTestType.triangle)for(var m=f.triangles,v=f.backfaceCulling,y=0;y<m.length;y++){var g=m[y];if(e.intersectTriangle(g,p,v)){d=!0,u.push(p);break}}else if(f.type===t.HitTestType.box){var x=f.center,b=f.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);e.intersectBox({min:T,max:E},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,C=f.radius;e.intersectSphere({center:_,radius:C},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.custom){var S=f.collect(e,new iH(i,r));S&&S.length>0&&(S.forEach(function(t){u.push(t)}),d=!0)}if(d){var A={compContent:s.item,id:c.id,name:c.name,position:u[u.length-1],parentId:c.parentId,hitPositions:u,behavior:f.behavior};if(c.emit("click",A),n.push(A),h(A))return{v:n}}}}}(f));if("object"===eM(d))return d.v}return n},r.setChildrenRenderOrder=function(t){for(var e,r=eO(this.items);!(e=r()).done;){var n=e.value;n.renderOrder=t++;var a=n.getComponent(i);a&&(t=a.setChildrenRenderOrder(t))}return t},r.fromData=function(t){e.prototype.fromData.call(this,t)},r.resolveBindings=function(){for(var t,e=eO(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=eO(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value;this.updateTrackAnimatedObject(a)}},r.updateTrackAnimatedObject=function(t){for(var e,i=eO(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},i}(rp),eR([iS(void 0,void 0)],t.CompositionComponent.prototype,"items",void 0),eR([iS(void 0,void 0)],t.CompositionComponent.prototype,"sceneBindings",void 0),eR([iS(void 0,void 0)],t.CompositionComponent.prototype,"timelineAsset",void 0),t.CompositionComponent=eR([i_("CompositionComponent")],t.CompositionComponent);var sC=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter(function(t){return t.listener!==i}))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i,r=arguments.length,n=Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,a=i.options;r.apply(void 0,[].concat(n)),(null==a?void 0:a.once)&&e.off(t,r)})},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map(function(t){return t.listener}))||[]}},sS=function(){function t(){this.update=new sw,this.lateUpdate=new sO}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==rp.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==rp.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==rp.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==rp.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),sA=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),sw=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=eO(t);!(i=r()).done;)i.value.onUpdate(e)},e}(sA),sO=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=eO(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(sA),sI=function(e){function i(r,n){(y=e.call(this)||this).sceneTicking=new sS,y.speed=1,y.isEnded=!1,y.loaderData={},y.refContent=[],y.startTime=0,y.postProcessingEnabled=!1,y.destroyed=!1,y.postLoaders=[],y.paused=!1,y.isEndCalled=!1,y._textures=[];var a,o,s,u=r.reusable,h=void 0!==u&&u,l=r.speed,c=r.baseRenderOrder,f=r.renderer,d=r.event,p=r.width,m=r.height,v=r.handleItemMessage;y.renderer=f,y._textures=n.textures,y.postProcessingEnabled=null!=(x=null==(g=n.jsonScene.renderSettings)?void 0:g.postProcessingEnabled)&&x,y.getEngine().renderLevel=n.renderLevel,h&&(y.keepResource=!0,n.consumed=!0);for(var y,g,x,b,T=n.jsonScene.compositions[0],E=eO(n.jsonScene.compositions);!(b=E()).done;){var _=b.value;_.id===n.jsonScene.compositionId&&(T=_)}e2(T),y.rootItem=new t.VFXItem(y.getEngine()),y.rootItem.name="rootItem",y.rootItem.duration=T.duration,y.rootItem.endBehavior=T.endBehavior,y.rootItem.composition=oP(y);for(var C,S=T.components,A=eO(S);!(C=A()).done;){var w=C.value,O=y.getEngine().findObject(w);y.rootItem.components.push(O),O.item=y.rootItem}return y.rootComposition=y.rootItem.getComponent(t.CompositionComponent),y.width=p,y.height=m,y.renderOrder=void 0===c?0:c,y.id=T.id,y.startTime=null!=(a=T.startTime)?a:0,y.renderer=f,y.event=d,y.statistic={loadStart:null!=(o=n.startTime)?o:0,loadTime:null!=(s=n.totalTime)?s:0,compileTime:0,firstFrameTime:0},y.reusable=h,y.speed=void 0===l?1:l,y.name=T.name,y.pluginSystem=n.pluginSystem,y.pluginSystem.initializeComposition(oP(y),n),y.camera=new oD(y.name,ik({},null==T?void 0:T.camera,{aspect:p/m})),y.url=n.url,y.interactive=!0,y.handleItemMessage=v,y.createRenderFrame(),y.rendererOptions=null,i.buildItemTree(y.rootItem),y.rootComposition.setChildrenRenderOrder(0),y.pluginSystem.resetComposition(oP(y),y.renderFrame),y}iy(i,e);var r=i.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,this.emit("pause")},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1},r.gotoAndPlay=function(t){this.setTime(t),this.resume(),this.emit("play",{time:t})},r.gotoAndStop=function(t){this.setTime(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new nj({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,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0),this.emit("goto",{time:t})},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.getComponent=function(t){return this.rootItem.getComponent(t)},r.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},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(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},r.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=(this.time-e)*1e3;this.updatePluginLoaders(i),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},r.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===tX.destroy&&!this.reusable},r.callAwake=function(t){for(var e,i=eO(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,a=eO(t.children);!(n=a()).done;){var o=n.value;this.callAwake(o)}},r.updateCamera=function(){this.camera.updateMatrix()},r.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},r.updateCompositionTime=function(t){if(this.rootComposition.state!==em.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e-i>.001)switch(n=!0,r){case tX.restart:e%=i,this.restart();break;case tX.freeze:e=Math.min(i,e);case tX.forward:case tX.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 i=this.renderFrame.editorTransform,r=i.x,n=i.y;return aW((t-i.z)/r,(e-i.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(e,i,r,n){if(this.isDestroyed||!this.interactive)return[];var a=[],o=this.getHitTestRay(e,i);return this.refContent.forEach(function(s){var u;null==(u=s.getComponent(t.CompositionComponent))||u.hitTest(o,e,i,a,r,n)}),a},r.addInteractiveItem=function(t,e){if(e===tV.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===tV.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(e){var i=this;e.type==tF.composition?e.endBehavior!==tX.freeze&&e.getComponent(t.CompositionComponent).items.forEach(function(t){return i.pluginSystem.plugins.forEach(function(e){return e.onCompositionItemRemoved(i,t)})}):(ek(this.items,e),this.pluginSystem.plugins.forEach(function(t){return t.onCompositionItemRemoved(i,e)}))},r.lost=function(t){this.videoState=this.textures.map(function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime}),this.textures.map(function(t){return t.dispose()}),this.dispose()},r.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},a=this.textures;a&&this.keepResource&&a.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=e6)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){e5.error("Update disposed composition: "+r.name+".")},this.dispose=e6,a&&this.keepResource&&a.forEach(function(t){t.dispose=n[t.id],t.dispose()}),this.renderer.env!==aT&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},r.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},r.translate=function(t,e,i){this.rootItem.translate(t,e,i)},r.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},r.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},r.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},r.scale=function(t,e,i){this.rootItem.scale(t,e,i)},r.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},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 eA(function(){return eP(this,function(e){switch(e.label){case 0:if(!t.textureOffloaded)return[3,2];return[4,Promise.all(t.textures.map(function(t){return null==t?void 0:t.reloadData()}))];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}})})()},i.buildItemTree=function(e){for(var i,r=new Map,n=e.getComponent(t.CompositionComponent).items,a=eO(n);!(i=a()).done;){var o=i.value;r.set(o.id,o)}for(var s,u=eO(n);!(s=u()).done;){var h=s.value;if(void 0===h.parentId)h.setParent(e);else{var l=r.get(h.parentId);if(l)h.setParent(l);else throw Error("The element references a non-existent element, please check the data.")}}},rd(i,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{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)}}]),i}(sC);t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new oL,r.time=-1,r.duration=0,r.start=0,r.endBehavior=tX.forward,r.type=tF.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new sC,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}iy(i,e);var r=i.prototype;return r.on=function(t,e,i){this.eventProcessor.on(t,e,i)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=this.eventProcessor).emit.apply(e,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.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,i,r=eO(this.components);!(i=r()).done;){var n=i.value;if(eI(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=eO(this.components);!(e=r()).done;){var n=e.value;eI(n,t)&&i.push(n)}return i},r.setParent=function(t){(t!==this||t)&&(this.parent&&ek(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,i,r){},r.setOpacity=function(t){},r.setActive=function(t){!!t!==this.active&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,i=eO(this.components);!(e=i()).done;)e.value.enabled=t;this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new oL({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new nd(t,e,i),n=iZ.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},r.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,o=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/o-1)*n,(1-2*e/s)*a,i)}},r.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},r.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},r.setScale=function(t,e,i){this.transform.setScale(t,e,i)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new iY;return this.transform.assignWorldTRS(t),t},r.find=function(t){if(this.name===t)return this;var e=[];e.push.apply(e,[].concat(this.children));for(var i=0;i<e.length;){var r=e[i];if(i++,r.name===t)return r;e.push.apply(e,[].concat(r.children))}},r.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.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=eO(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=eO(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=eO(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=eO(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},r.fromData=function(r){e.prototype.fromData.call(this,r);var n=r.id,a=r.name,o=r.delay,s=r.parentId,u=r.endBehavior,h=r.transform,l=r.duration,c=void 0===l?0:l;if(this.props=r,this.type=r.type,this.id=n.toString(),this.name=a,this.start=o||this.start,h&&this.transform.fromData(h),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=s,this.duration=c,this.endBehavior=u,r.content||(r.content={options:{}}),c<0)throw Error("Item duration can't be less than 0, see "+aE["Item duration can't be less than 0"]+".");if(r.components){this.components.length=0;for(var f,d=eO(r.components);!(f=d()).done;){var p=f.value,m=this.engine.findObject(p);this.components.push(m),eI(m,t.ParticleSystem)&&!this.components.includes(m.renderer)&&this.components.push(m.renderer)}}i.isComposition(this)&&this.instantiatePreComposition()},r.toData=function(){if(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=et.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.defination.parentId=null==(i=this.parent)?void 0:i.guid),!this.defination.components){this.defination.components=[];for(var e,i,r,n=eO(this.components);!(r=n()).done;){var a=r.value;eI(a,t.EffectComponent)&&this.defination.components.push(a)}}this.defination.content={}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(a),s=o.x,u=o.y;this.transform.translate(2*t*s/r,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=eO(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e,i=eO(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&ek(null==(t=this.parent)?void 0:t.children,this)},r.instantiatePreComposition=function(){var e=this.props.content.options.refId,i=this.engine.findEffectsObjectData(e);if(!i)throw Error("Referenced precomposition with Id: "+e+" does not exist.");for(var r,n=i.components,a=eO(n);!(r=a()).done;){var o=r.value,s=this.engine.findObject(o);if(s.item=this,this.components.push(s),s.setInstanceId(ia()),eI(s,t.CompositionComponent))for(var u,h=eO(s.items);!(u=h()).done;){var l=u.value;l.setInstanceId(ia());for(var c,f=eO(l.components);!(c=f()).done;)c.value.setInstanceId(ia())}}sI.buildItemTree(this)},r.resetGUID=function(t){var e=null!=(i=null==t?void 0:t.get(this))?i:ia();this.setInstanceId(e);for(var i,r,n=eO(this.components);!(r=n()).done;){var a,o=r.value,s=null!=(a=null==t?void 0:t.get(o))?a:ia();o.setInstanceId(s)}for(var u,h=eO(this.children);!(u=h()).done;)u.value.resetGUID(t)},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=eO(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=eO(this.children);!(n=a()).done;)n.value.gatherPreviousObjectID(t)},i.isComposition=function(t){return t.type===tF.composition},i.isSprite=function(t){return t.type===tF.sprite},i.isParticle=function(t){return t.type===tF.particle},i.isNull=function(t){return t.type===tF.null},i.isTree=function(t){return t.type===tF.tree},i.isCamera=function(t){return t.type===tF.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},rd(i,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=eO(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=eO(this.components);!(e=i()).done;){var r=e.value;eI(r,rv)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),i}(iA),t.VFXItem=eR([i_(et.VFXItemData)],t.VFXItem),t.Item=void 0,(tb=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tb.isComposition=function(t){return t.type===tF.composition},tb.isParticle=function(t){return t.type===tF.particle},tb.isNull=function(t){return t.type===tF.null};var sM=[1,1,1,1],sR=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}iy(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,a=e.output.getUserData();if(eI(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(o=this.activeComponent)?void 0:o.material;var o,s,u=null==(s=this.activeMaterial)?void 0:s.getColor("_Color");u&&(this.startColor=u.toArray())}var h=aG(sM,1),l=this.time/a.duration,c=this.opacityOverLifetime,f=this.colorOverLifetime;f&&(h=eB(f,l,!0),i=!0),c&&(h[3]*=c.getValue(l),i=!0),i&&(aj(this.renderColor,h,this.startColor),null==(n=this.activeMaterial)||null==(r=n.getColor("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=oT(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tG.GRADIENT_COLOR&&(this.colorOverLifetime=eG(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(aw)},i}(oI),sP=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new sR(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(oR),t.SpriteColorPlayableAsset=eR([i_(et.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset);var sN=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createTrackMixer=function(t){return new sr(t)},e}(t.TrackAsset),sV=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createPlayable=function(t){return new sL(t)},e}(oR),sL=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(oI);function sF(e){t.maxSpriteMeshItemCount=e}t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).time=0,r.duration=0,r.frameAnimationLoop=!0,r.name="MSprite"+sP++,i&&r.fromData(i),r}iy(i,e);var r=i.prototype;return r.onUpdate=function(t){var e=this,i=this.time,r=this.duration;i>r&&this.frameAnimationLoop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),a=this.textureSheetAnimation,o=this.renderer.texture.source.video;if(o&&(0===i?o.pause():o.play().catch(function(t){e.engine.renderErrors.add(t)}),this.renderer.texture.uploadCurrentVideoFrame()),a){var s,u,h,l,c,f=a.total||a.row*a.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/a.row*m,l=1/a.col*v):(h=1/a.col*m,l=1/a.row*v),a.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/a.col),b=g-x*a.col;c=u?[h*x,l*(a.col-b)]:[h*b,l*(1+x)]}else c=[0,l];null==(s=this.material.getVector4("_TexOffset"))||s.setFromArray([d+c[0],v+p-c[1],h,l])}this.time=i+t/1e3},r.onDisable=function(){e.prototype.onDisable.call(this),this.time=0},r.onDestroy=function(){var e=this.renderer.texture.source;e.sourceType===t.TextureSourceType.video&&(null==e?void 0:e.video)&&(e.video.pause(),e.video.src="",e.video.load())},r.fromData=function(t){e.prototype.fromData.call(this,t);var i,r=t.interaction,n=t.options;this.interaction=r;var a=n.startColor||[1,1,1,1];this.material.setColor("_Color",new rx().setFromArray(a)),this.duration=null!=(i=t.duration)?i:this.item.duration},i}(aw),t.SpriteComponent=eR([i_(et.SpriteComponent)],t.SpriteComponent),t.maxSpriteMeshItemCount=8;var sD=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(im),sk=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(im),sz=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,i){return this.findCurveValue(t,e)?this.curveValues[t+e].value=i:this.curveValues[t+e]={componentType:t,propertyName:e,value:i},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),sU=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new sz(oP(i)),i}return iy(e,t),e}(oI),sB=new nd,sG=new iY(1,1,1),sj=new iY,sX=function(e){function i(){return e.apply(this,arguments)}iy(i,e);var r=i.prototype;return r.start=function(){var t,e=this.boundObject,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new iY(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=oT(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&oT(r.linearX),y:r.linearY&&oT(r.linearY),z:r.linearZ&&oT(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&oT(r.orbitalX),y:r.orbitalY&&oT(r.orbitalY),z:r.orbitalZ&&oT(r.orbitalZ),center:aB(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&oT(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=oT(a.x||1),this.sizeYOverLifetime=oT(a.y||1),this.sizeZOverLifetime=oT(a.z||1)):this.sizeXOverLifetime=oT(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:oT(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=oT(n.x||0),u.y=oT(n.y||0)}this.gravity=iY.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=oT(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?iY.fromArray(r.direction).normalize():new iY,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(e){if(!this.boundObject){var i=e.output.getUserData();eI(i,t.VFXItem)&&(this.boundObject=i,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.boundObject,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){sG.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(sG.y=this.sizeYOverLifetime.getValue(r),sG.z=this.sizeZOverLifetime.getValue(r)):sG.z=sG.y=sG.x;var n=this.originalTransform.scale;e.transform.setScale(sG.x*n.x,sG.y*n.y,sG.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},o=a(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;sB.x=s?a(this.rotationOverLifetime.x):0,sB.y=s?a(this.rotationOverLifetime.y):0,sB.z=o;var u=sB.addEulers(this.originalTransform.rotation,sB);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(aU(sj,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&sj.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(sj.x,sj.y,sj.z))},i}(sU);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new sX(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(oR),t.TransformPlayableAsset=eR([i_(et.TransformPlayableAsset)],t.TransformPlayableAsset);var sW=function(e){function i(){return e.apply(this,arguments)}return iy(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eI(i,t.VFXItem)&&(i.time=this.time)},i}(oI);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e.prototype.createPlayable=function(t){return new sW(t)},e}(oR),t.ActivationPlayableAsset=eR([i_(et.ActivationPlayableAsset)],t.ActivationPlayableAsset),t.AnimationClip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e}iy(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=ij(e,0,this.duration),n=eO(this.positionCurves);!(i=n()).done;){var a=i.value,o=a.keyFrames.getValue(r),s=this.findTarget(t,a.path);null==s||s.transform.setPosition(o.x,o.y,o.z)}for(var u,h=eO(this.rotationCurves);!(u=h()).done;){var l=u.value,c=l.keyFrames.getValue(r),f=this.findTarget(t,l.path);null==f||f.transform.setQuaternion(c.x,c.y,c.z,c.w)}for(var d,p=eO(this.eulerCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(r),y=this.findTarget(t,m.path);null==y||y.transform.setRotation(v.x,v.y,v.z)}for(var g,x=eO(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),E=this.findTarget(t,b.path);null==E||E.transform.setScale(T.x,T.y,T.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=eO(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:oT(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var o,s=eO(t.rotationCurves);!(o=s()).done;){var u=o.value,h={path:u.path,keyFrames:oT(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=eO(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:oT(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=eO(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:oT(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=eO(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:oT(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var E,_=eO(t.colorCurves);!(E=_()).done;){var C=E.value,S={path:C.path,keyFrames:oT(C.keyFrames),property:C.property,className:C.className};e=Math.max(e,S.keyFrames.getMaxTime()),this.colorCurves.push(S)}void 0!==t.duration?this.duration=t.duration:this.duration=e},i.findTarget=function(t,e){for(var i,r=t,n=e.split("."),a=eO(n);!(i=a()).done;){for(var o,s=i.value,u=!1,h=eO(r.children);!(o=h()).done;){var l=o.value;if(l.name===s){r=l,u=!0;break}}if(!u)return}return r},e}(iA),t.AnimationClip=eR([i_(et.AnimationClip)],t.AnimationClip);var sH=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},rd(t,null,[{key:"shared",get:function(){return sY.x=0,sY.y=0,sY}}]),t}(),sY=new sH;function sZ(t,e,i,r,n,a,o,s){o?(u=r,h=-i):(u=-r,h=i);var u,h,l=t-i*n+u,c=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return s.push(l,c),s.push(f,d),2}function sq(t,e,i,r,n,a,o,s){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);s&&l<c?l+=2*Math.PI:!s&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.sqrt(u*u+h*h),m=(15*Math.abs(d)*Math.sqrt(p)/Math.PI>>0)+1,v=d/m;if(f+=v,s){o.push(t,e),o.push(i,r);for(var y=1,g=f;y<m;y++,g+=v)o.push(t,e),o.push(t+Math.sin(g)*p,e+Math.cos(g)*p);o.push(t,e),o.push(n,a)}else{o.push(i,r),o.push(t,e);for(var x=1,b=f;x<m;x++,b+=v)o.push(t+Math.sin(b)*p,e+Math.cos(b)*p),o.push(t,e);o.push(n,a),o.push(t,e)}return 2*m}function sQ(t,e,i,r,n,a,o,s,u){if(0!==t.length){var h=e.alignment;if(.5!==e.alignment){var l=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],a=t[e-1];r<e;r+=2){var o=t[r],s=t[r+1];i+=(o-n)*(s+a),n=o,a=s}return i<0?-1:1}(t);i&&(l*=-1),h=(h-.5)*l+.5}var c=new sH(t[0],t[1]),f=new sH(t[t.length-2],t[t.length-1]),d=1e-4>Math.abs(c.x-f.x)&&1e-4>Math.abs(c.y-f.y);if(r){t=t.slice(),d&&(t.pop(),t.pop(),f.set(t[t.length-2],t[t.length-1]));var p=(c.x+f.x)*.5,m=(f.y+c.y)*.5;t.unshift(p,m),t.push(p,m)}var v=t.length/2,y=t.length,g=n.length/2,x=e.width/2,b=x*x,T=e.miterLimit*e.miterLimit,E=t[0],_=t[1],C=t[2],S=t[3],A=0,w=0,O=-(_-S),I=E-C,M=0,R=0,P=Math.sqrt(O*O+I*I)+1e-6;O/=P,I/=P,O*=x,I*=x;var N=h,V=(1-N)*2,L=2*N;r||(e.cap===t5.Round?y+=sq(E-O*(V-L)*.5,_-I*(V-L)*.5,E-O*V,_-I*V,E+O*L,_+I*L,n,!0)+2:e.cap===t5.Square&&(y+=sZ(E,_,O,I,V,L,!0,n))),n.push(E-O*V,_-I*V),n.push(E+O*L,_+I*L);for(var F=1;F<v-1;++F){E=t[(F-1)*2],_=t[(F-1)*2+1],C=t[2*F],S=t[2*F+1],A=t[(F+1)*2],w=t[(F+1)*2+1],P=Math.sqrt((O=-(_-S))*O+(I=E-C)*I)+1e-6,O/=P,I/=P,O*=x,I*=x,P=Math.sqrt((M=-(S-w))*M+(R=C-A)*R)+1e-6,M/=P,R/=P,M*=x,R*=x;var D=C-E,k=_-S,z=C-A,U=w-S,B=D*z+k*U,G=k*z-U*D,j=G<0;if(Math.abs(G)<.001*Math.abs(B)){n.push(C-O*V,S-I*V),n.push(C+O*L,S+I*L),B>=0&&(e.join===t6.Round?y+=sq(C,S,C-O*V,S-I*V,C-M*V,S-R*V,n,!1)+4:y+=2,n.push(C-M*L,S-R*L),n.push(C+M*V,S+R*V));continue}var X=(-O+E)*(-I+S)-(-O+C)*(-I+_),W=(-M+A)*(-R+S)-(-M+C)*(-R+w),H=(D*W-z*X)/G,Y=(U*X-k*W)/G,Z=(H-C)*(H-C)+(Y-S)*(Y-S),q=C+(H-C)*V,Q=S+(Y-S)*V,K=C-(H-C)*L,J=S-(Y-S)*L,$=j?V:L;Z<=Math.min(D*D+k*k,z*z+U*U)+$*$*b?e.join===t6.Bevel||Z/b>T?(j?(n.push(q,Q),n.push(C+O*L,S+I*L),n.push(q,Q),n.push(C+M*L,S+R*L)):(n.push(C-O*V,S-I*V),n.push(K,J),n.push(C-M*V,S-R*V),n.push(K,J)),y+=2):e.join===t6.Round?j?(n.push(q,Q),n.push(C+O*L,S+I*L),y+=sq(C,S,C+O*L,S+I*L,C+M*L,S+R*L,n,!0)+4,n.push(q,Q),n.push(C+M*L,S+R*L)):(n.push(C-O*V,S-I*V),n.push(K,J),y+=sq(C,S,C-O*V,S-I*V,C-M*V,S-R*V,n,!1)+4,n.push(C-M*V,S-R*V),n.push(K,J)):(n.push(q,Q),n.push(K,J)):(n.push(C-O*V,S-I*V),n.push(C+O*L,S+I*L),e.join===t6.Round?j?y+=sq(C,S,C+O*L,S+I*L,C+M*L,S+R*L,n,!0)+2:y+=sq(C,S,C-O*V,S-I*V,C-M*V,S-R*V,n,!1)+2:e.join===t6.Miter&&Z/b<=T&&(j?(n.push(K,J),n.push(K,J)):(n.push(q,Q),n.push(q,Q)),y+=2),n.push(C-M*V,S-R*V),n.push(C+M*L,S+R*L),y+=2)}E=t[(v-2)*2],_=t[(v-2)*2+1],C=t[(v-1)*2],P=Math.sqrt((O=-(_-(S=t[(v-1)*2+1])))*O+(I=E-C)*I)+1e-6,O/=P,I/=P,O*=x,I*=x,n.push(C-O*V,S-I*V),n.push(C+O*L,S+I*L),r||(e.cap===t5.Round?y+=sq(C-O*(V-L)*.5,S-I*(V-L)*.5,C-O*V,S-I*V,C+O*L,S+I*L,n,!1)+2:e.cap===t5.Square&&(y+=sZ(C,S,O,I,V,L,!1,n)));for(var tt=g;tt<y+g-2;++tt)E=n[2*tt],_=n[2*tt+1],C=n[(tt+1)*2],S=n[(tt+1)*2+1],A=n[(tt+2)*2],1e-8>Math.abs(E*(S-(w=n[(tt+2)*2+1]))+C*(w-_)+A*(_-S))||s.push(tt,tt+1,tt+2)}}var sK=function(){},sJ="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s$={exports:{}};!function(t){function e(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function r(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function s(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function u(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function h(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function l(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,x(e.a,t.a)),e.d!==t.d&&(i=!0,b(e.d,t.d)),m(e,t),r||(v(e,t.a),t.a.c=t),i||(y(e,t.d),t.d.a=t))}function c(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,b(t.d,t.b.d)),t.c===t?x(t.a,null):(t.b.d.a=Q(t),t.a.c=t.c,m(t,Q(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=Q(e),e.a.c=e.c,m(e,Q(e))),g(t)}function f(t){var e=p(t),i=e.b;return m(e,t.e),e.a=t.b.a,v(i,e.a),e.d=i.d=t.d,e=e.b,m(t.b,Q(t.b)),m(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function d(t,e){var i=!1,r=p(t),n=r.b;return e.d!==t.d&&(i=!0,b(e.d,t.d)),m(r,t.e),m(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||y(r,t.d),r}function p(t){var e=new q,i=new q,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function m(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function v(t,e){var i=e.f,r=new J(e,i);i.e=r,e.f=r,i=r.c=t;do i.a=r,i=i.c;while(i!==t)}function y(t,e){var i=e.d,r=new Z(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do i.d=r,i=i.e;while(i!==t)}function g(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function x(t,e){var i=t.c,r=i;do r.a=e,r=r.c;while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function b(t,e){var i=t.a,r=i;do r.d=e,r=r.e;while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function T(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var E,_=4*1e150;function C(t,e){t.f+=e.f,t.b.f+=e.b.f}function S(t,e,a){return(t=t.a,e=e.a,a=a.a,e.b.a===t)?a.b.a===t?i(e.a,a.a)?0>=n(a.b.a,e.a,a.a):0<=n(e.b.a,a.a,e.a):0>=n(a.b.a,t,a.a):a.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(a.b.a,t,a.a))}function A(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function w(t,e){c(t.a),t.c=!1,t.a=e,e.i=t}function O(t){var e=t.a.a;do t=tl(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),w(t,e),t=tl(t)),t}function I(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function M(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function R(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,A(t)}function P(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=th(t),n=r.a;if(n.a!==e.a){if(!r.c){R(t);break}w(r,n=d(e.c.b,n.b))}e.c!==n&&(l(Q(n),n),l(e,n)),R(t),e=r.a,t=r}return e}function N(t,e,i,r,n,a){var o=!0;do I(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=th(e).a.b.c);(i=(r=th(e)).a.b).a===n.a;)i.c!==n&&(l(Q(i),i),l(Q(n),i)),r.f=e.f-i.f,r.d=M(t,r.f),e.b=!0,!o&&D(t,e)&&(C(i,n),A(e),c(n)),o=!1,e=r,n=i;e.b=!0,a&&z(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(Y(t,100156),t.n=!0):e.d=i[0])}function L(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),l(e,i)}function F(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function D(t,r){var a=th(r),o=r.a,s=a.a;if(i(o.a,s.a)){if(0<n(s.b.a,o.a,s.a))return!1;if(e(o.a,s.a)){if(o.a!==s.a){var a=t.e,u=o.a.h;if(0<=u){var a=a.b,h=a.d,c=a.e,d=a.c,p=d[u];h[p]=h[a.a],d[h[p]]=p,p<=--a.a&&(1>=p?to(a,p):i(c[h[p>>1]],c[h[p]])?to(a,p):ts(a,p)),c[u]=null,d[u]=a.b,a.b=u}else for(a.c[-(u+1)]=null;0<a.a&&null===a.c[a.d[a.a-1]];)--a.a;L(t,Q(s),o)}}else f(s.b),l(o,Q(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;tl(r).b=r.b=!0,f(o.b),l(Q(s),o)}return!0}function k(t,h){var c=th(h),d=h.a,p=c.a,m=d.a,v=p.a,y=d.b.a,g=p.b.a,x=new J;if(n(y,t.a,m),n(g,t.a,v),m===v||Math.min(m.a,y.a)>Math.max(v.a,g.a))return!1;if(i(m,v)){if(0<n(g,m,v))return!1}else if(0>n(y,v,m))return!1;var b,T,E=y,_=m,C=g,S=v;if(i(E,_)||(b=E,E=_,_=b),i(C,S)||(b=C,C=S,S=b),i(E,C)||(b=E,E=C,C=b,b=_,_=S,S=b),i(C,_)?i(_,S)?(0>(b=r(E,C,_))+(T=r(C,_,S))&&(b=-b,T=-T),x.b=u(b,C.b,T,_.b)):(0>(b=n(E,C,_))+(T=-n(E,S,_))&&(b=-b,T=-T),x.b=u(b,C.b,T,S.b)):x.b=(C.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(C,S)||(b=C,C=S,S=b),a(E,C)||(b=E,E=C,C=b,b=_,_=S,S=b),a(C,_)?a(_,S)?(0>(b=o(E,C,_))+(T=o(C,_,S))&&(b=-b,T=-T),x.a=u(b,C.a,T,_.a)):(0>(b=s(E,C,_))+(T=-s(E,S,_))&&(b=-b,T=-T),x.a=u(b,C.a,T,S.a)):x.a=(C.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(m,v)?m:v,i(E,x)&&(x.b=E.b,x.a=E.a),e(x,m)||e(x,v))return D(t,h),!1;if(!e(y,t.a)&&0<=n(y,t.a,x)||!e(g,t.a)&&0>=n(g,t.a,x)){if(g===t.a)return f(d.b),l(p.b,d),d=th(h=O(h)).a,P(t,th(h),c),N(t,h,Q(d),d,d,!0),!0;if(y===t.a){f(p.b),l(d.e,Q(p)),v=(m=c=h).a.b.a;do m=tl(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,c.a=Q(p),p=P(t,c,null),N(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tl(h).b=h.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(h.b=c.b=!0,f(p.b),p.a.b=t.a.b,p.a.a=t.a.a),!1}return f(d.b),f(p.b),l(Q(p),d),d.a.b=x.b,d.a.a=x.a,d.a.h=tt(t.e,d.a),d=d.a,p=[0,0,0,0],x=[m.d,y.d,v.d,g.d],d.g[0]=d.g[1]=d.g[2]=0,F(d,m,y,p,0),F(d,v,g,p,2),V(t,d,x,p,!0),tl(h).b=h.b=c.b=!0,!1}function z(t,e){for(var r=th(e);;){for(;r.b;)e=r,r=th(r);if(!e.b&&(r=e,null===(e=tl(e))||!e.b))break;e.b=!1;var a,o=e.a,s=r.a;if(a=o.b.a!==s.b.a)t:{var u=th(a=e),h=a.a,d=u.a,p=void 0;if(i(h.b.a,d.b.a)){if(0>n(h.b.a,d.b.a,h.a)){a=!1;break t}tl(a).b=a.b=!0,p=f(h),l(d.b,p),p.d.c=a.d}else{if(0<n(d.b.a,h.b.a,d.a)){a=!1;break t}a.b=u.b=!0,p=f(d),l(h.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(A(r),c(s),s=(r=th(e)).a):e.c&&(A(e),c(o),o=(e=tl(r)).a)),o.a!==s.a){if(o.b.a===s.b.a||e.c||r.c||o.b.a!==t.a&&s.b.a!==t.a)D(t,e);else if(k(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(C(s,o),A(e),c(o),e=tl(r))}}function U(t,e){var i=new tu,r=h(t.b);r.a.b=_,r.a.a=e,r.b.a.b=-_,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=G(r=t.f,r.a,i),i.e=r}function B(t){this.a=new j,this.b=t,this.c=S}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new j(i,e.a,e),e.a.c=t,e.a=t}function j(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function X(){this.d=W,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 W=0;function H(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case W:Y(t,100151),t.u(null);break;case 1:Y(t,100152),t.t()}else switch(t.d){case 2:Y(t,100154),t.v();break;case 1:Y(t,100153),t.w()}}function Y(t,e){t.p&&t.p(e,t.c)}function Z(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function q(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function Q(t){return t.b.e}function K(){this.c=new J,this.a=new Z,this.b=new q,this.d=new q,this.b.b=this.d,this.d.b=this.b}function J(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function $(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ti}function tt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=tr(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&ts(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ta(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ta(t.b);do--t.a;while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ti(){this.d=tr([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function tr(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function tn(t){return t.e[t.d[1]]}function ta(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&to(t,1)),a}function to(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[s],n[h])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function ts(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o>>1,h=r[u];if(0===u||i(n[h],n[s])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function th(t){return t.e.c.b}function tl(t){return t.e.a.b}(E=X.prototype).x=function(){H(this,W)},E.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:this.s=e;return}break;case 100141:this.m=!!e;return;default:Y(this,100900);return}Y(this,100901)},E.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Y(this,100900)}return!1},E.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},E.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:Y(this,100900)}},E.C=function(t,e){var i=!1,r=[0,0,0];H(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&Y(this,100155),null===(i=this.q)?l(i=h(this.b),i.b):(f(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},E.u=function(t){H(this,W),this.d=1,this.b=new K,this.c=t},E.t=function(){H(this,1),this.d=2,this.q=null},E.v=function(){H(this,2),this.d=1},E.w=function(){H(this,1),this.d=W;var t,r,a=this.j[0],o=this.j[1],s=this.j[2],u=!1,h=[a,o,s];if(0===a&&0===o&&0===s){for(var o=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],s=[],v=[],u=this.b.c,a=u.e;a!==u;a=a.e)for(var y=0;3>y;++y){var b=a.g[y];b<p[y]&&(p[y]=b,v[y]=a),b>o[y]&&(o[y]=b,s[y]=a)}if(a=0,o[1]-p[1]>o[0]-p[0]&&(a=1),o[2]-p[2]>o[a]-p[a]&&(a=2),p[a]>=o[a])h[0]=0,h[1]=0,h[2]=1;else{for(o=0,p=v[a],s=s[a],v=[0,0,0],p=[p.g[0]-s.g[0],p.g[1]-s.g[1],p.g[2]-s.g[2]],y=[0,0,0],a=u.e;a!==u;a=a.e)y[0]=a.g[0]-s.g[0],y[1]=a.g[1]-s.g[1],y[2]=a.g[2]-s.g[2],v[0]=p[1]*y[2]-p[2]*y[1],v[1]=p[2]*y[0]-p[0]*y[2],v[2]=p[0]*y[1]-p[1]*y[0],(b=v[0]*v[0]+v[1]*v[1]+v[2]*v[2])>o&&(o=b,h[0]=v[0],h[1]=v[1],h[2]=v[2]);0>=o&&(h[0]=h[1]=h[2]=0,h[T(p)]=1)}u=!0}for(v=T(h),a=this.b.c,o=(v+1)%3,s=(v+2)%3,v=0<h[v]?1:-1,h=a.e;h!==a;h=h.e)h.b=h.g[o],h.a=v*h.g[s];if(u){for(h=0,a=(u=this.b.a).b;a!==u;a=a.b)if(!(0>=(o=a.a).f))do h+=(o.a.b-o.b.a.b)*(o.a.a+o.b.a.a),o=o.e;while(o!==a.a);if(0>h)for(u=(h=this.b.c).e;u!==h;u=u.e)u.a=-u.a}for(this.n=!1,a=(h=this.b.b).h;a!==h;a=u)u=a.h,o=a.e,e(a.a,a.b.a)&&a.e.e!==a&&(L(this,o,a),c(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),c(o)),(a===u||a===u.b)&&(u=u.h),c(a));for(this.e=h=new $,a=(u=this.b.c).e;a!==u;a=a.e)a.h=tt(h,a);for(function(t){t.d=[];for(var e,r=0;r<t.a;r++)t.d[r]=r;t.d.sort((e=t.c,function(t,r){return i(e[t],e[r])?1:-1})),t.e=!0,function(t){for(var e=t.a;1<=e;--e)to(t,e);t.h=!0}(t.b)}(h),this.f=new B(this),U(this,-_),U(this,_);null!==(h=te(this.e));){for(;;){t:if(0===(a=this.e).a)u=tn(a.b);else if(u=a.c[a.d[a.a-1]],0!==a.b.a&&i(a=tn(a.b),u)){u=a;break t}if(null===u||!e(u,h))break;u=te(this.e),L(this,h.c,u.c)}!function t(r,a){r.a=a;for(var o=a.c;null===o.i;)if((o=o.c)===a.c){var o=r,s=a,u=new tu;u.a=s.c.b;var h=o.f,p=h.a;do p=p.a;while(null!==p.b&&!h.c(h.b,u,p.b));var h=p.b,m=th(h),u=h.a,p=m.a;if(0===n(u.b.a,s,u.a))e((u=h.a).a,s)||e(u.b.a,s)||(f(u.b),h.c&&(c(u.c),h.c=!1),l(s.c,u),t(o,s));else{var v=i(p.b.a,u.b.a)?h:m,m=void 0;h.d||v.c?(m=v===h?d(s.c.b,u.e):d(p.b.c.b,s.c).b,v.c?w(v,m):(u=o,(h=I(o,h,m)).f=tl(h).f+h.a.f,h.d=M(u,h.f)),t(o,s)):N(o,h,s.c,s.c,null,!0)}return}if(h=(u=th(o=O(o.i))).a,(u=P(r,u,null)).c===h){var h=u,u=h.c,p=th(o),m=o.a,v=p.a,y=!1;m.b.a!==v.b.a&&k(r,o),e(m.a,r.a)&&(l(Q(u),m),u=th(o=O(o)).a,P(r,th(o),p),y=!0),e(v.a,r.a)&&(l(h,Q(v)),h=P(r,p,null),y=!0),y?N(r,o,h.c,u,u,!0):(s=i(v.a,m.a)?Q(v):m,N(r,o,s=d(h.c.b,s),s.c,s.c,!1),s.b.i.c=!0,z(r,o))}else N(r,o,u.c,h,h,!0)}(this,h)}for(h=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++h,A(u);for(this.f=null,(h=this.e).b=null,h.d=null,this.e=h.c=null,a=(h=this.b).a.b;a!==h.a;a=u)u=a.b,(a=a.a).e.e===a&&(C(a.c,a),c(a));if(!this.n){if(h=this.b,this.m)for(a=h.b.h;a!==h.b;a=u)u=a.h,a.b.d.c!==a.d.c?a.f=a.d.c?1:-1:c(a);else for(a=h.a.b;a!==h.a;a=u)if(u=a.b,a.c){for(a=a.a;i(a.b.a,a.a);a=a.c.b);for(;i(a.a,a.b.a);a=a.e);for(o=a.c.b,s=void 0;a.e!==o;)if(i(a.b.a,o.a)){for(;o.e!==a&&(i((t=o.e).b.a,t.a)||0>=n(o.a,o.b.a,o.e.b.a));)o=(s=d(o.e,o)).b;o=o.c.b}else{for(;o.e!==a&&(i((r=a.c.b).a,r.b.a)||0<=n(a.b.a,a.a,a.c.b.a));)a=(s=d(a,a.c.b)).b;a=a.e}for(;o.e.e!==a;)o=(s=d(o.e,o)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(h=this.b).a.b;u!==h.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),a=u.a;do this.k&&this.k(a.a.d,this.c),a=a.e;while(a!==u.a);this.i&&this.i(this.c)}}else{for(h=this.b,u=!!this.l,a=!1,o=-1,s=h.a.d;s!==h.a;s=s.d)if(s.c){a||(this.h&&this.h(4,this.c),a=!0),v=s.a;do u&&o!==(p=v.b.d.c?0:1)&&(o=p,this.l&&this.l(!!o,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==s.a)}a&&this.i&&this.i(this.c)}}if(this.r){for(a=(h=this.b).a.b;a!==h.a;a=u)if(u=a.b,!a.c){s=(o=a.a).e,v=void 0;do s=(v=s).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,Q(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,Q(p))),g(v));while(v!==o);o=a.d,(a=a.b).d=o,o.b=a}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},sJ.libtess={GluTesselator:X,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}},X.prototype.gluDeleteTess=X.prototype.x,X.prototype.gluTessProperty=X.prototype.B,X.prototype.gluGetTessProperty=X.prototype.y,X.prototype.gluTessNormal=X.prototype.A,X.prototype.gluTessCallback=X.prototype.z,X.prototype.gluTessVertex=X.prototype.C,X.prototype.gluTessBeginPolygon=X.prototype.u,X.prototype.gluTessBeginContour=X.prototype.t,X.prototype.gluTessEndContour=X.prototype.v,X.prototype.gluTessEndPolygon=X.prototype.w,t.exports=sJ.libtess}(s$);var s0=((tT=new s$.exports.GluTesselator).gluTessCallback(s$.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tT.gluTessCallback(s$.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==s$.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tT.gluTessCallback(s$.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tT.gluTessCallback(s$.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tT.gluTessCallback(s$.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tT);function s1(t){s0.gluTessNormal(0,0,1);var e=[];s0.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){s0.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];s0.gluTessVertex(a,a)}s0.gluTessEndContour()}return s0.gluTessEndPolygon(),e}var s2=function(t){function e(){for(var e,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];(e=t.call(this)||this).points=[],e.closePath=!1;var a=Array.isArray(r[0])?r[0]:r;if("number"!=typeof a[0]){for(var o=[],s=0,u=a.length;s<u;s++)o.push(a[s].x,a[s].y);a=o}return e.points=a,e.closePath=!0,e}iy(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var o=this.points[2*n],s=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];s>e!=h>e&&t<(e-s)/(h-s)*(u-o)+o&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){var a=s1([t]),o=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw Error("Invalid points array");if(2===t.length){e.push(t[0],t[1],t[0],t[1],t[0],t[1]);return}var i=t[2]-t[0],r=t[3]-t[1],n=t[0],a=t[1],o=t[0],s=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,a=l),h>o&&(o=h,s=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>s&&(o=f,s=d)}e.push(n,a,o,s,o,s)},rd(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(sK);function s3(t,e,i,r,n,a,o,s,u,h){var l=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function t(e,i,r,n,a,o,s,u,h,l,c){if(!(c>8)){var f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+o)/2,v=(a+s)/2,y=(o+u)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(m+y)/2,E=(g+b)/2,_=(x+T)/2;if(c>0){var C=s-e,S=u-i,A=Math.abs((r-s)*S-(n-u)*C),w=Math.abs((a-s)*S-(o-u)*C);if(A>11920929e-14&&w>11920929e-14){if((A+w)*(A+w)<=l*(C*C+S*S)){h.push(E,_);return}}else if(A>11920929e-14){if(A*A<=l*(C*C+S*S)){h.push(E,_);return}}else if(w>11920929e-14){if(w*w<=l*(C*C+S*S)){h.push(E,_);return}}else if((C=E-(e+s)/2)*C+(S=_-(i+u)/2)*S<=l){h.push(E,_);return}}t(e,i,f,d,g,x,E,_,h,l,c+1),t(E,_,b,T,v,y,s,u,h,l,c+1)}}(e,i,r,n,a,o,s,u,t,l*=l,0),t.push(s,u),t}var s4=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}iy(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var a=i/2,o=r-a,s=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(o*o)+c*c/(s*s)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var a=Math.ceil(5*Math.sqrt(r+n)),o=8*a+0+0;if(0===o)return t;if(0===a)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var s=0,u=4*a+0+2,h=u,l=o,c=0+r,f=0,d=e+c,p=e-c,m=i+0;t[s++]=d,t[s++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<a;v++){var y=Math.PI/2*(v/a),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[s++]=b,t[s++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--l]=_,t[--l]=b}c=0,f=0+n,d=e+c,p=e-c,m=i+f;var C=i-f;return t[s++]=d,t[s++]=m,t[--l]=C,t[--l]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(sK);t.StarType=void 0,(tE=t.StarType||(t.StarType={}))[tE.Star=0]="Star",tE[tE.Polygon=1]="Polygon";var s5=function(t){function e(e,i,r,n,a,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(s=t.call(this)||this).pointCount=e,s.outerRadius=i,s.innerRadius=r,s.outerRoundness=n,s.innerRoundness=a,s.starType=o,s.v=[],s.in=[],s.out=[],s}iy(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)s3(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 i=this.v.length-1;s3(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var a=s1([t]),o=e.length/2,s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),a=2*Math.PI/n,o=!0,s=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*s/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){e=o?s:u,i=o?h:l,r=o?c:f;var p=e*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,o=!o,d+=1*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),o=-(.5*Math.PI);for(t=0;t<e;t++){var s=r*Math.cos(o),u=r*Math.sin(o),h=0===s&&0===u?0:u/Math.sqrt(s*s+u*u),l=0===s&&0===u?0:-s/Math.sqrt(s*s+u*u),c=2*t;this.v[c]=s,this.v[c+1]=u,this.in[c]=s+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=s-h*a*n*1,this.out[c+1]=u-l*a*n*1,o+=1*i}},e}(sK),s6=function(t){function e(e,i,r,n,a){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(o=t.call(this)||this).x=e,o.y=i,o.width=r,o.height=n,o.roundness=a,o}iy(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e,i=this.width/2,r=this.height/2,n=this.x+i,a=this.y+r,o=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(i,r)),s=i-o,u=r-e;if(o>=0&&e>=0&&s>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(o+e)),l=8*h+(s?4:0)+(u?4:0);if(0!==l){if(0===h){t[0]=t[6]=n+s,t[1]=t[3]=a+u,t[2]=t[4]=n-s,t[5]=t[7]=a-u;return}var c=0,f=4*h+(s?2:0)+2,d=f,p=l,m=s+o,v=u,y=n+m,g=n-m,x=a+v;if(t[c++]=y,t[c++]=x,t[--f]=x,t[--f]=g,u){var b=a-v;t[d++]=g,t[d++]=b,t[--p]=b,t[--p]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=s+Math.cos(E)*o,C=u+Math.sin(E)*e,S=n+_,A=n-_,w=a+C,O=a-C;t[c++]=S,t[c++]=w,t[--f]=w,t[--f]=A,t[d++]=A,t[d++]=O,t[--p]=O,t[--p]=S}m=s,v=u+e,y=n+m,g=n-m,x=a+v;var I=a-v;t[c++]=y,t[c++]=x,t[--p]=I,t[--p]=y,s&&(t[c++]=g,t[c++]=x,t[--p]=I,t[--p]=g)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(sK),s8=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=this.graphicsPath,i=eO(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,a=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"moveTo":this.moveTo(a[0],a[1]);break;case"ellipse":this.ellipse(a[0],a[1],a[2],a[3],a[4]);break;case"polyStar":this.polyStar(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"rect":this.rect(a[0],a[1],a[2],a[3],a[4]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,o){this.ensurePoly();var s=this.currentPoly;return s3(s.points,s.lastX,s.lastY,t,e,i,r,n,a,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,i,r,n){return this.drawShape(new s4(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new s5(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new s6(t,e,i,r,n),a),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new s2).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new s2,this.currentPoly.points.push(0,0))},t}(),s9=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,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,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,o){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},rd(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new s8(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function s7(t,e){return e&&("object"===eM(e)||"function"==typeof e)?e:oP(t)}var ut=new(function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach(function(t){return t.remove()}),this.elements.length=0},e.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return e2(t),t}if(oj[oG])return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?eD(this.elements,t):t.remove()},t}()),ue=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?t$.clip:r,a=t.textBaseline,o=void 0===a?t0.top:a,s=t.textAlign,u=void 0===s?t1.left:s,h=t.text,l=t.letterSpace,c=void 0===l?0:l,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=(void 0===h?" ":h).length*(d+c),this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.letterSpace=c,this.overflow=n,this.textBaseline=o,this.textAlign=u,this.lineHeight=void 0===p?d:p}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,a=t.fontScale,o=(i-r)/3,s=r+n*a,u=i*(e-1),h=0;switch(this.textBaseline){case t0.top:h=s+o;break;case t0.middle:h=(this.height*a-u+s)/2;break;case t0.bottom:h=this.height*a-u-o}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case t1.left:i=t.outlineWidth*t.fontScale;break;case t1.middle:i=(this.width*t.fontScale-e)/2;break;case t1.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),ui=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,a,o,s=t.textColor,u=t.fontSize,h=t.outline,l=t.shadow,c=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,this.textWeight=void 0===c?"normal":c,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===d?"sans-serif":d,this.fontSize=void 0===u?40:u,h&&(this.isOutlined=!0,this.outlineColor=null!=(e=h.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=h.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),l&&(this.hasShadow=!0,this.shadowBlur=null!=(r=l.shadowBlur)?r:2,this.shadowColor=null!=(n=l.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=l.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(o=l.shadowOffsetY)?o:0),this.fontStyle!==t3.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},ur=["serif","sans-serif","monospace","courier"],un=0;t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.maxLineWidth=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+un++,i&&r.fromData(i),r.canvas=ut.getCanvas(),ut.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return s7(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}iy(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new rx(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(aw),t.TextComponent=eR([i_(et.TextComponent)],t.TextComponent);var ua=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new ui(t),this.textLayout=new ue(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var i=this.context,r=this.textLayout,n=r.letterSpace,a=r.overflow,o=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,s=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,l=0;l<t.length;l++){var c,f,d=t[l],p=(null!=(f=null==i?void 0:null==(c=i.measureText(d))?void 0:c.width)?f:0)*o;h+=n,a===t$.display?"\n"===d?(u++,h=0):(h+=p,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+p>s&&l>0||"\n"===d)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==d&&(h+=p))}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){if(this.textStyle.fontFamily===t&&!e3(t)){console.warn("The font is either the current font or an risky font family.");return}this.textStyle.fontFamily=t,this.isDirty=!0},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.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,i=this.textStyle,r=this.textLayout,n=i.fontScale,a=(r.width+i.fontOffset)*n,o=r.lineHeight*this.lineCount,s=i.fontSize*n,u=r.lineHeight*n;i.fontDesc=this.getFontDesc(s),this.char=(this.text||"").split(""),this.canvas.width=a,r.autoWidth?(this.canvas.height=o*n,this.item.transform.size.set(1,o/r.height)):this.canvas.height=r.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>a&&r.overflow===t$.display?e.font=this.getFontDesc(s*a/this.maxLineWidth):e.font=i.fontDesc,e.clearRect(0,0,a,h),i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var l=[],c=0,f=r.getOffsetY(i,this.lineCount,u,s),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((c+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(l.push({y:f,width:c,chars:d,charOffsetX:p}),c=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(c),c+=y.width)}l.push({y:f,width:c,chars:d,charOffsetX:p}),l.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,a){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[a],t.y),e.fillText(r,n+t.charOffsetX[a],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=rK.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:rE.LINEAR,minFilter:rE.LINEAR,wrapS:rE.CLAMP_TO_EDGE,wrapT:rE.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontScale,n=e.fontFamily,a=e.textWeight,o=e.fontStyle,s=""+(t||i*r).toString()+"px ";return ur.includes(n)?s+=n:s+='"'+n+'"',a!==t2.normal&&(s=a+" "+s),o!==t3.normal&&(s=o+" "+s),s},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],a=i[1],o=i[2],s=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*a+", "+255*o+", "+s+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,o=i[0],s=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*o+", "+255*s+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-a)},t}();is(t.TextComponent,[ua]);var uo=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(im),us=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(iA);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return iy(e,t),e}(iA),eR([iS(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=eR([i_(et.BinaryAsset)],t.BinaryAsset);var uu=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=iC(e);if(r)for(var n,a=eO(Object.keys(r));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[o]=s:e9(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):iA.is(s)?i[o]={id:s.getInstanceId()}:it(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,h=eO(Object.keys(e.defination));!(u=h()).done;){var l=u.value,c=e.defination[l];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(c)?i[l]=c:e9(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):iA.is(c)?i[l]={id:c.getInstanceId()}:it(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=iC(i),n=i.engine;if(r)for(var a,o=eO(Object.keys(r));!(a=o()).done;){var s=a.value,u=e[s];if(void 0!==u){var h=r[s].type;i[s]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return eI(t,Int8Array)||eI(t,Uint8Array)||eI(t,Uint8ClampedArray)||eI(t,Int16Array)||eI(t,Uint16Array)||eI(t,Int32Array)||eI(t,Uint32Array)||eI(t,Float32Array)||eI(t,Float64Array)||eI(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(it(t)&&1===Object.keys(t).length&&"id"in t&&e8(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return it(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return ie(t)||eI(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(e9(e)){for(var o,s=[],u=eO(e);!(o=u()).done;){var h=o.value;s.push(t.deserializeProperty(h,i,r+1,n,a))}return s}if(t.checkDataPath(e)){var l=i.findObject(e);return a?l:e}if(!it(e)||e.constructor!==Object)return e;c=n?new n:{};for(var c,f,d=eO(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c},t.serializeObjectProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i={});for(var n,a=eO(Object.keys(e));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[o]=s:e9(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):iA.is(s)?i[o]={id:s.getInstanceId()}:it(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:e9(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):iA.is(a)?i[n]={id:a.getInstanceId()}:it(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),uh=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(!r){console.error("Object data with uuid: "+i+" not found.");return}switch(r.dataType){case et.Material:e=r9.create(this.engine);break;case et.Geometry:e=nc.create(this.engine);break;case et.Texture:e=rK.create(this.engine);break;default:var n=iE[r.dataType];n&&(e=new n(this.engine))}if(!e){console.error("Constructor for DataType: "+r.dataType+" not found.");return}return e.setInstanceId(r.id),this.engine.addInstance(e),uu.deserialize(r,e),e},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),ul=function(){function t(){}return t.prototype.loadGUID=function(t){return eA(function(){return eP(this,function(t){return[2,void 0]})})()},t}();function uc(t,e){if(!t.includes(e))return t.push(e),!0}function uf(t){if(Number.isFinite(t))return[tG.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tG.CONSTANT)return[tG.CONSTANT,t[1]];if("lines"===e)return[tG.LINE,t[1]];if(e===tG.LINE){var r=i.map(function(t){return[tj.LINE,t]});return[tG.BEZIER_CURVE,r]}return"curve"===e||e===tG.CURVE?[tG.BEZIER_CURVE,uI(i)]:t}}function ud(t,e){return Array.isArray(t)&&"random"===t[0]?[tG.CONSTANT,t[1][e]]:uf(t)}function up(t){return t&&"color"===t[0]?uy(t[1],!0):[1,1,1,1]}function um(t){return t&&"random"===t[0]?[tG.RANDOM,t[1]]:uf(t)}function uv(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,a=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,o=uy(t[r],e);i.push([a,o[0],o[1],o[2],o[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tG.GRADIENT_COLOR,i]}}function uy(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eI(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=ug(i)),i}function ug(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function ux(t,e){return Array.isArray(t)?t[0]===tG.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&uv(t[1],e):uv(t,e)}function ub(t){if(t){if(3===t.length)return[tG.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tG.BEZIER_PATH||e===tG.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=uI(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&a.push(u),a.push(u)}}return[tG.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function uT(t){for(var e,i=eO(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function uE(t){for(var e,i=eO(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var u_=Math.cos,uC=Math.sin,uS=Math.PI/180,uA=180/Math.PI;function uw(t,e){return t?[t[0]-.5,.5-t[1]]:e?uO[e]:[0,0]}var uO=((ev={})[tk.PARTICLE_ORIGIN_CENTER]=[0,0],ev[tk.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],ev[tk.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],ev[tk.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],ev[tk.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],ev[tk.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],ev[tk.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],ev[tk.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],ev[tk.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],ev);function uI(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var o=t[a][3]*(e-i),s=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=function(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=r[1],u=o-n;return[[n+(o-n)/3,a+(t*=u)/3],[o-(o-n)/3,s-(e*=u)/3]]}(o,s,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map(function(t,e){return 0===e?[tj.EASE_OUT,t]:e===n.length-1?[tj.EASE_IN,t]:[tj.EASE,t]})}function uM(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tF.null&&t.endBehavior===tX.destroy&&(t.endBehavior=tX.freeze)})}),t.version=tw["2_1"],t}var uR=new Map,uP=new Map;function uN(t){for(var e,i=eO(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===et.ShapeComponent&&r.type===t4.Custom){(null==(n=r.shapes)?void 0:n.length)>0&&r.shapes[0].fill&&(r.fill=r.shapes[0].fill);for(var n,a,o=Array(r.easingIns.length),s=Array(r.easingOuts.length).fill(!1),u=eO(r.shapes);!(a=u()).done;)for(var h,l=a.value,c=eO(l.indexes);!(h=c()).done;){var f=h.value,d=r.points[f.point],p=r.easingIns[f.easingIn],m=r.easingOuts[f.easingOut];o[f.easingIn]||(p.x-=d.x,p.y-=d.y,o[f.easingIn]=!0),s[f.easingOut]||(m.x-=d.x,m.y-=d.y,s[f.easingOut]=!0)}}}return t.version=tw["3_2"],t}function uV(e){uR.clear(),uP.clear();for(var i,r=e.compositions,n=e.items,a=e.components,o=eO(a);!(i=o()).done;){var s=i.value;uR.set(s.id,s)}for(var u,h=eO(n);!(u=h()).done;){var l=u.value;uP.set(l.id,l)}for(var c,f=eO(r);!(c=f()).done;)!function(e){for(var i,r=eO(e.items);!(i=r()).done;){var n=i.value,a=uP.get(n.id);if(!a)return;if(a.type===tF.sprite||a.type===tF.particle||a.type===tF.spine||a.type===tF.text||a.type===tF.richtext||a.type===tF.video||a.type===tF.shape){var o=uR.get(a.components[0].id);o&&function(e){var i=e.renderer,r=null==i?void 0:i.maskMode;r&&r!==t.MaskMode.NONE&&(r===t.MaskMode.MASK?(e.mask={isMask:!0},ey=e.id):(r===tR.OBSCURED||r===tR.REVERSE_OBSCURED)&&(e.mask={inverted:r===tR.REVERSE_OBSCURED,reference:{id:ey}}))}(o)}}}(c.value);return e.version=tw["3_3"],e}function uL(t){null==(e=t.plugins)||e.forEach(function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")});for(var e,i,r=eO(t.items);!(i=r()).done;){var n=i.value;if(n.type===tF.sprite){var a=uR.get(n.components[0].id);if(a){var o=a.renderer.shape,s=void 0;s=Number.isInteger(o)?t.shapes[o]:o,a.renderer.shape=s}}}for(var u,h=t.compositionId,l={},c=eO(t.compositions);!(u=c()).done;){var f=u.value,d=ia();l[f.id]=d,f.id===h&&(t.compositionId=d),f.id=d;var p={id:ia(),dataType:"CompositionComponent",items:f.items,timelineAsset:f.timelineAsset,sceneBindings:f.sceneBindings};f.timelineAsset=void 0,f.sceneBindings=void 0,f.components=[{id:p.id}],t.components.push(p)}for(var m,v=eO(t.items);!(m=v()).done;){var y=m.value;if(y.content){var g=y.content.options;g&&void 0!==g.refId&&(g.refId=l[g.refId])}}return t.version=tw["3_4"],t}function uF(t){for(var e,i=ik({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=eO(i.images);!(e=r()).done;)e.value.id=ia();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=ia(),t.dataType=et.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:ia(),dataType:et.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(a=t.bins,i.bins=a.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:ia()}}));for(var a,o,s={},u={},h=eO(t.compositions);!(o=h()).done;)!function(){var t=o.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tX.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tF.particle&&t.content.filter&&delete t.content.filter});for(var e,r=eO(t.items);!(e=r()).done;){var n=e.value;s[n.id]=ia(),n.oldId=n.id,n.id=s[n.id],u[n.id]=n}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],a=e.parentId.split("^")[1];e.parentId=s[n]+"^"+a}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var a=ik({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(a),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:ia(),dataType:"TimelineAsset"},u=eO(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:ia(),dataType:"ActivationPlayableAsset"};o.push(c);var f={id:ia(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:c.id}}]};if(l.push({id:f.id}),a.push(f),h.type!==tF.particle){var d={id:ia(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};o.push(d);var p={id:ia(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};l.push({id:p.id}),a.push(p)}if(h.type===tF.sprite||h.type===tF.text){var m={id:ia(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};o.push(m);var v={id:ia(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};l.push({id:v.id}),a.push(v)}if(h.type===tF.composition){var y={id:ia(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:ia(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),a.push(g)}var x={id:ia(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=eO(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var C,S=eO(a);!(C=S()).done;){var A=C.value;i.miscs.push(A)}for(var w,O=eO(o);!(w=O()).done;){var I=w.value;i.miscs.push(I)}}(a,u,i)}();for(var l,c=eO(i.items);!(l=c()).done;){var f=l.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var d=f.content.renderer.texture;f.content.renderer.texture={id:i.textures[d].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var p=f.content.trails.texture;f.content.trails.texture={id:i.textures[p].id}}}if(f.transform){var m=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(b=f.transform.scale)?b:[1,1,1]);if(Object.assign(f,{transform:{position:{x:m[0],y:m[1],z:m[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tF.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tF.sprite){var g,x,b,T,E,_,C,S=f.content;S.renderer||(S.renderer={});var A=S.renderer,w=uw(A.anchor,A.particleOrigin),O=f.transform.size;A.anchor||void 0===A.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(T=null==O?void 0:O.x)?T:1),f.transform.position.y+=-w[1]*(null!=(E=null==O?void 0:O.y)?E:1)),f.transform.anchor={x:w[0]*(null!=(_=null==O?void 0:O.x)?_:1),y:w[1]*(null!=(C=null==O?void 0:O.y)?C:1)}}}if(f.type===tF.particle){var I=f.content;I.renderer||(I.renderer={});var M=I.renderer;I.renderer.anchor=uw(M.anchor,M.particleOrigin)}if(f.type===tF.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var R=f.pn,P=t.plugins,N=void 0===P?[]:P;void 0!==R&&Number.isInteger(R)&&(f.pluginName=N[R])}switch("editor-gizmo"===f.pluginName&&(f.type="editor-gizmo"),"orientation-transformer"===f.pluginName&&(f.type="orientation-transformer"),f.content.options.target&&"editor-gizmo"===f.pluginName&&(f.content.options.target=s[f.content.options.target]),f.type===tF.spine&&t.spines&&0!==t.spines.length&&function(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}(t.spines[f.content.options.spine],f.content,i),(f.type===tF.sprite||f.type===tF.particle||f.type===tF.mesh||f.type===tF.skybox||f.type===tF.light||"camera"===f.type||f.type===tF.tree||f.type===tF.interact||f.type===tF.camera||f.type===tF.text||f.type===tF.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=ia(),f.content.item={id:f.id},f.dataType=et.VFXItemData,f.components.push({id:f.content.id})),(f.type===tF.null||f.type===tF.composition)&&(f.components=[],f.dataType=et.VFXItemData),f.type){case tF.sprite:f.content.dataType=et.SpriteComponent;break;case tF.particle:f.content.dataType=et.ParticleSystem;break;case tF.mesh:f.content.dataType=et.MeshComponent;break;case tF.skybox:f.content.dataType=et.SkyboxComponent;break;case tF.light:f.content.dataType=et.LightComponent;break;case"camera":f.content.dataType=et.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tF.tree:f.content.dataType=et.TreeComponent;break;case tF.interact:f.content.dataType=et.InteractComponent;break;case tF.camera:f.content.dataType=et.CameraController;break;case tF.text:f.content.dataType=et.TextComponent;break;case tF.spine:f.content.dataType=et.SpineComponent}}return i.version=tw["3_0"],i}function uD(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:ub(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:uf(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:uf(n.linearX),linearY:uf(n.linearY),linearZ:uf(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:uf(n.orbitalX),orbitalY:uf(n.orbitalY),orbitalZ:uf(n.orbitalZ),speedOverLifetime:uf(n.speedOverLifetime)};uE(a);var o={options:{startColor:up(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var s=t.rotationOverLifetime;if(s){var u=o.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=uf(s.x),u.y=uf(s.y),u.z=uf(s.z)):u.z=uf(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=o.colorOverLifetime={opacity:uf(h.opacity)};h.color&&(l.color=ux(h.color))}var c=t.sizeOverLifetime;return c&&(o.sizeOverLifetime={separateAxes:c.separateAxes,size:uf(c.size),x:uf(c.x),y:uf(c.y),z:uf(c.z)}),o}var uk="0.0.0-experimental-20250807",uz=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,uU=/^(\d+)\.(\d+)$/,uB=!1;function uG(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(function(t){var e=(t.playerVersion||{}).web,i=void 0===e?"":e;if(i){var r,n,a=null!=(r=uz.exec(i))?r:[],o=null!=(n=uz.exec(uk))?n:[],s=a[1],u=a[2],h=o[1],l=o[2];return Number(h)<Number(s)||Number(h)===Number(s)&&Number(l)<Number(u)}return!1}(t)&&console.warn("The JSON need higher than "+(null==(d=t.playerVersion)?void 0:d.web)+" runtime version(current: "+uk+"). Some features may not work as expected."),!(f=null==(c=(l=t).version)?void 0:c.split("."))||Number(f[0])>2||2===Number(f[0])&&Number(f[1])>=2||l.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tF.mesh||t.type===tF.light)&&(t.endBehavior=1===t.endBehavior?tX.destroy:t.endBehavior)})}),uz.test(t.version)){var e,i,r,n,a,o,s,u;return uB=(null==(p=/^(\d+)/.exec(t.version))?void 0:p[0])==="0",uL(uV(uN(uF(uM((e=t,uj=tw["1_0"],n=e.plugins||[],(null==(i=e.bins)?void 0:i.length)&&(uj=tw["1_3"]),a=(e.requires||[]).slice(),o=e.images.map(function(t,i){return uX(t,i,e.imageTags||[])}),s=e.textures||o.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:uj,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return uW(t,{plugins:n,requires:a})}),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:s,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u))))))}uB=!1;var h,l,c,f,d,p,m=uU.exec(t.version)||[],v=Number(m[1]),y=Number(m[2]);if(v)return(v<2||2===v&&y<4)&&((h=t).compositions.map(function(t){for(var e,i=eO(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=eO(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=Array.isArray(a);o&&2===a.length&&Array.isArray(a[1])?"path"===n?e[n]=ub(a):e[n]=uf(a):o||"object"!=typeof a||t(a)}})(e.value.content)}),t=h),v<3&&(t=uF(uM(t))),v=Number((m=uU.exec(t.version)||[])[1]),y=Number(m[2]),v<4&&(y<2&&(t=uN(t)),y<3&&(t=uV(t)),y<4&&(t=uL(t))),t;throw Error("Invalid JSON version: "+t.version+".")}var uj=tw["1_0"];function uX(t,e,i){var r=i[e];if("string"==typeof t)return{id:ia(),renderLevel:r,url:t};if(t.template)return{id:ia(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:ia(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:ia(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function uW(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:ik({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return uY(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var uH=[0,0,0,1];function uY(t,e){void 0===e&&(e={});var i=tF.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tF.plugin,m=t.pn,p=t.pluginName,f=t.content,c=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),l=t.transform||b(c.transform)):t.particle?(i=tF.particle,l=b((c=t.particle).transform,uB,!0),f=function(t){var e=t.options,i=t.transform,r={type:tP.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=ik({},t.shape,{type:tP[a]}),t.shape.upDirection){var o=t.shape.upDirection,s=o[0],u=o[1],h=o[2];0===s&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=um(e.turbulenceX),r.turbulenceY=um(e.turbulenceY),r.turbulenceZ=um(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map(function(t){return uT(t)})),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map(function(t){return uT(t)})),l.rateOverTime&&(l.rateOverTime=um(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:um(e.startLifetime),start3DSize:!!e.start3DSize,startSize:um(e.startSize),startSizeX:um(e.startSizeX),startSizeY:um(e.startSizeY),sizeAspect:um(e.sizeAspect),maxCount:e.maxCount,startDelay:um(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tG.COLORS,t[1].map(function(t){return uy(t,e)})]:"gradient"===t[0]?uv(t[1],e):"color"===t[0]?[tG.RGBA_COLOR,uy(t[1],e)]:t}(e.startColor,!0),startRotationZ:um(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=um(e.startRotationX),c.options.startRotationY=um(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:ub(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:um(f.x),y:um(f.y)}:c.sizeOverLifetime={size:um(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?uf(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:uf(e.gravityModifier),startSpeed:um(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:um(d.linearX),linearY:um(d.linearY),linearZ:um(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:um(d.orbitalX),orbitalY:um(d.orbitalY),orbitalZ:um(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:uf(d.forceCurve)},uE(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:um(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=uf(m.y),c.rotationOverLifetime.x=uf(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:uf(v.opacity)};v.color&&(y.color=ux(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:uf(g.cycles),animationDelay:ud(g.animationDelay,0),animationDuration:ud(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:um(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:uf(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&ux(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&ux(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:um(x.opacityOverLifetime)}),c.trails&&uE(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(c)):t.sprite?(i=tF.sprite,l=b((c=t.sprite).transform,!1,!0),s=uD(o=c,l),(u=o.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=o.renderer,o.splits&&(s.splits=o.splits),o.interaction&&(s.interaction=o.interaction),f=s):t.cal?(i=tF.null,l=b((c=t.cal).transform,!1,!0),f=uD(c,l)):t.ui?(i=tF.interact,l=b((c=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tV.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&up(i.previewColor),behavior:i.behavior||tL.NOTIFY};break;case"drag":e={type:tV.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tV.MESSAGE}}return{options:e}}(c),l.scale=[c.options.width||1,c.options.height||1,1]):t.model&&(c=t.model,1===t.model.options.type&&(i=tF.camera,l=b(c.transform),f=function(t){var e=t.options,i={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},r=t.velocityOverLifetime;if(r||(null==(n=t.transform)?void 0:n.path)){var n,a,o={path:ub(null==(a=t.transform)?void 0:a.path),linearX:uf(null==r?void 0:r.translateX),linearY:uf(null==r?void 0:r.translateY),linearZ:uf(null==r?void 0:r.translateZ)};uE(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:uf(null==s?void 0:s.rotateX),y:uf(null==s?void 0:s.rotateY),z:s.separateAxes?uf(null==s?void 0:s.rotateZ):uf(s.rotation)};uE(u),i.rotationOverLifetime=u}return i}(c))),null==(h=f.renderer)?void 0:h.anchor){var a=new Float32Array(f.renderer.anchor);.5==a[0]&&.5==a[1]?delete f.renderer.anchor:e.requires&&uc(e.requires,"anchor")}if(c){var o,s,u,h,l,c,f,d,p,m,v,y,g=null==(v=c.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tX.restart:tX.destroy:tX.restart:r||(null==c?void 0:null==(y=c.options)?void 0:y.endBehavior)||tX.destroy,c.options.renderLevel&&(d=c.options.renderLevel),isNaN(n)&&(n=c.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:l,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(uc(e.plugins,p),x.pn=e.plugins.indexOf(p)):x.pluginName=p:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function b(t,e,i){if(t){var r={},n=t.rotation;if(n&&(e?r.rotation=[-n[0],-n[1],-n[2]]:r.rotation=[n[0],n[1],n[2]],i)){var a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,O,I=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=u_(a*uS/2),h=u_(o*uS/2),l=u_(s*uS/2),c=uC(a*uS/2),f=uC(o*uS/2),d=uC(s*uS/2),uH[0]=c*h*l+u*f*d,uH[1]=u*f*l-c*h*d,uH[2]=u*h*d+c*f*l,uH[3]=u*h*l-c*f*d,uH);r.rotation=(p=[],m=I[0],v=I[1],y=I[2],g=I[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,C=v*b,S=y*T,A=g*T,w=y*x-g*b,p[1]=Math.asin((O=-w)>1?1:O<-1?-1:O)*uA,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*b+g*x,1-E-C)*uA,p[2]=Math.atan2(_+A,1-C-S)*uA):(p[0]=0,p[2]=Math.atan2(-(_-A),1-E-S)*uA),p)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}var uZ=((eg={})[tO.S]=[tO.S,tO.BPlus,tO.APlus],eg[tO.A]=[tO.A,tO.BPlus,tO.APlus],eg[tO.B]=[tO.B,tO.BPlus],eg);function uq(t,e){if(!t||!e)return!0;var i=uZ[e];return!!i&&i.includes(t)}function uQ(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,o=n.url;return a&&(e&&e[a]?i=e[a]:o&&(i=o)),i}function uK(t,e,i){return uJ.apply(this,arguments)}function uJ(){return(uJ=eA(function(t,e,i){var r,n;return eP(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,rD(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=uQ(e,i)){if(e8(n)&&n!==r.src)return[2,rD(n)];if(eI(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(t_=t.Scene||(t.Scene={})).isJSONObject=function(t){return it(t)&&"jsonScene"in t},t_.isURL=function(t){return it(t)&&"url"in t},t_.isWithOptions=function(t){return it(t)&&"options"in t};var u$=1,u0=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new rM),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=u$++,this.timers=[],this.updateOptions(t)}var i=e.prototype;return i.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout;this.timeout=void 0===e?10:e},i.loadScene=function(e,i,r){var n=this;return eA(function(){var a,o,s,u,h,l,c,f,d,p,m,v;return eP(this,function(y){return o=e8(e)?e:n.id,s=performance.now(),u=[],c=null!=(l=null==(h=null==i?void 0:i.engine.gpuCapability)?void 0:h.detail.compressedTexture)?l:t.COMPRESSED_TEXTURE.NONE,f={},p=!1,m=new Promise(function(t,e){d=window.setTimeout(function(){p=!0,n.removeTimer(d),e(Error("Load time out: totalTime: "+(performance.now()-s).toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."))},1e3*n.timeout),n.timers.push(d)}),v=eA(function(t,e){var i,r,n;return eP(this,function(a){switch(a.label){case 0:if(p)return[3,4];i=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return r=a.sent(),n=performance.now()-i,u.push("["+t+": "+n.toFixed(2)+"]"),f[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([m,eA(function(){var i,h,l,p,m,y,g,x,b,T,E,_,C,S;return eP(this,function(A){switch(A.label){case 0:if(!e8(e))return[3,2];return h=new URL(e,location.href).href,n.baseUrl=h,[4,v("loadJSON",function(){return n.loadJSON(h)})];case 1:return a=A.sent(),[3,3];case 2:a=e,n.baseUrl=location.href,A.label=3;case 3:if(!t.Scene.isJSONObject(a))return[3,4];return i=ik({},a),[3,9];case 4:return[4,v("processJSON",function(){return n.processJSON(a)})];case 5:return p=(l=A.sent()).jsonScene,m=l.pluginSystem,g=void 0===(y=p.bins)?[]:y,x=p.images,b=p.fonts,[4,Promise.all([v("processBins",function(){return n.processBins(g)}),v("processImages",function(){return n.processImages(x,c)}),v("plugin:processAssets",function(){return n.processPluginAssets(p,m,r)}),v("processFontURL",function(){return n.processFontURL(b)})])];case 6:return E=(T=A.sent())[0],_=T[1],[4,v("processTextures",function(){return n.processTextures(_,E,p)})];case 7:return C=A.sent(),i={timeInfos:f,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:m,jsonScene:p,bins:E,textureOptions:C,textures:[],images:_,assets:n.assets},[4,v("plugin:prepareResource",function(){return m.loadResources(i,n.options)})];case 8:A.sent(),A.label=9;case 9:return S=performance.now()-s,e5.info("Load asset: totalTime: "+S.toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."),window.clearTimeout(d),n.removeTimer(d),i.totalTime=S,i.startTime=s,i.timeInfos=f,[2,i]}})})()])]})})()},i.getAssets=function(){return this.assets},i.processJSON=function(t){var e=this;return eA(function(){var i,r,n;return eP(this,function(a){switch(a.label){case 0:return[4,(n=new id(void 0===(r=(i=uG(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},i.processBins=function(t){var e=this;return eA(function(){var i,r;return eP(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(eI(n,ArrayBuffer))return n;if(uq(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},i.processFontURL=function(t){var i=this;return eA(function(){return eP(this,function(r){return t?[2,Promise.all(t.map(eA(function(t){var r,n,a;return eP(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];e3(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,i.baseUrl).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),e5.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},i.processImages=function(e,i){void 0===i&&(i=0);var r=this;return eA(function(){var n,a,o,s,u,h,l;return eP(this,function(c){switch(c.label){case 0:return a=(n=r.options).useCompressedTexture,o=n.variables,s=n.disableWebP,u=n.disableAVIF,h=r.baseUrl,[4,Promise.all(e.map(eA(function(e,n){var l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,O,I,M;return eP(this,function(n){switch(n.label){case 0:if(l=e.url,c=e.webp,f=e.avif,d=new URL(l,h).href,p=!s&&c?new URL(c,h).href:void 0,m=!u&&f?new URL(f,h).href:void 0,v=e.id,!("template"in e))return[3,8];if(!(g=(y=e.template).background))return[3,7];x=uQ(y,o),b=g.type===t9.video,T=g&&b?rG:rD,n.label=1;case 1:return n.trys.push([1,6,,7]),[4,rX(x,T)];case 2:if(!eI(E=n.sent(),HTMLVideoElement))return[3,3];return r.sourceFrom[v]={url:E.src,type:t.TextureSourceType.video},[2,E];case 3:return g&&Array.isArray(x)&&o&&(o[g.name]=E.src),r.sourceFrom[v]={url:E.src,type:t.TextureSourceType.image},[4,uK(E,y,o)];case 4:return[2,n.sent()];case 5:return[3,7];case 6:throw _=n.sent(),Error("Failed to load. Check the template or if the URL is "+(b?"video":"image")+" type, URL: "+x+", Error: "+(_.message||_)+".");case 7:return[3,9];case 8:if("compressed"in e&&a&&i){if(C=e.compressed,i===t.COMPRESSED_TEXTURE.ASTC?S=C.astc:i===t.COMPRESSED_TEXTURE.PVRTC&&(S=C.pvrtc),S)return A=new URL(S,h).href,r.sourceFrom[v]={url:A,type:t.TextureSourceType.compressed},[2,r.loadBins(A)]}else if(eI(e,HTMLImageElement)||eI(e,HTMLCanvasElement)||eI(e,HTMLVideoElement)||eI(e,rK))return[2,e];n.label=9;case 9:if(!m)return[3,11];return[4,rL(d,m)];case 10:return M=n.sent(),[3,13];case 11:return[4,rN(d,p)];case 12:M=n.sent(),n.label=13;case 13:return O=(w=M).url,I=w.image,r.sourceFrom[v]={url:O,type:t.TextureSourceType.image},[2,I]}})})))];case 1:return l=c.sent(),r.assignImagesToAssets(e,l),[2,l]}})})()},i.processPluginAssets=function(t,e,i){var r=this;return eA(function(){var n,a,o,s;return eP(this,function(u){switch(u.label){case 0:return[4,e.processAssets(t,i)];case 1:for(a=(n=u.sent().reduce(function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t},{assets:[],loadedAssets:[]})).assets,o=n.loadedAssets,s=0;s<a.length;s++)r.assets[a[s].id]=o[s];return[2]}})})()},i.processTextures=function(e,i,r){var n=this;return eA(function(){var a;return eP(this,function(o){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(eA(function(e,a){var o,s,u,h,l;return eP(this,function(c){switch(c.label){case 0:if(eI(e,rK))return[2,e];if(!("mipmaps"in e))return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,rH(e,i,n.assets,r.bins)];case 2:return[2,c.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+c.sent()+".");case 4:if(o=e.source,s=e.id,h="",!it(o))return[3,5];return u=n.assets[o.id],h=o.id,[3,7];case 5:if("string"!=typeof o)return[3,7];return[4,rD(io(o))];case 6:u=c.sent(),c.label=7;case 7:if(u)return[2,(l=function(e,i,r){var n={id:r,dataType:et.Texture};if(eI(e,rK))return ik({},e.source,n);if(eI(e,HTMLImageElement)||ie(e))return ik({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:rE.LINEAR,magFilter:rE.LINEAR},n);if(eI(e,HTMLVideoElement))return ik({sourceType:t.TextureSourceType.video,video:e,minFilter:rE.LINEAR,magFilter:rE.LINEAR},n);if(eI(e,ArrayBuffer))return ik({},r3(e),{sourceFrom:i},n);if("width"in e&&"height"in e&&"data"in e)return ik({sourceType:t.TextureSourceType.data,data:e,wrapS:rE.CLAMP_TO_EDGE,wrapT:rE.CLAMP_TO_EDGE,minFilter:rE.NEAREST,magFilter:rE.NEAREST},n);throw Error("Invalid texture options.")}(u,n.sourceFrom[h],s)).sourceType===t.TextureSourceType.compressed?l:ik({},l,e)];throw Error("Invalid texture source: "+o+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return eA(function(){return eP(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},i.loadBins=function(t){var e=this;return eA(function(){return eP(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();u0.fontCache=new Set;var u1=function(){function e(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(r0(t))}var i=e.prototype;return i.assembleSceneLoadOptions=function(e,i){void 0===i&&(i={});var r=e;return t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(r=e.url),t.Scene.isWithOptions(e)&&(i=ik({},i,e.options))),{source:r,options:i}},i.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach(function(t){if(t.type===tF.text||t.type===tF.richtext){var r=e[t.name];r&&t.components.forEach(function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);((null==n?void 0:n.dataType)===et.TextComponent||(null==n?void 0:n.dataType)===et.RichTextComponent)&&(n.options.text=r)})}})},i.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()},i.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=eO(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=new us(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var s,u=eO(this.builtinObjects);!(s=u()).done;){var h=s.value;this.engine.addInstance(h)}},i.createShaderVariant=function(){for(var t,e=eO(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];eI(r,r9)&&r.createShaderVariant()}},i.destroyBuiltinObjects=function(){for(var t,e=eO(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},i.dispose=function(){this.destroyBuiltinObjects()},e}(),u2=new Int32Array(2),u3=new Float32Array(u2.buffer),u4=new Float64Array(u2.buffer),u5=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tC=ex||(ex={}))[tC.UTF8_BYTES=1]="UTF8_BYTES",tC[tC.UTF16_STRING=2]="UTF16_STRING";var u6=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return u2[0]=this.readInt32(t),u3[0]},e.readFloat64=function(t){return u2[u5?0:1]=this.readInt32(t),u2[u5?1:0]=this.readInt32(t+4),u4[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){u3[0]=e,this.writeInt32(t,u2[0])},e.writeFloat64=function(t,e){u4[0]=e,this.writeInt32(t,u2[u5?0:1]),this.writeInt32(t+4,u2[u5?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===ex.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),u8=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=u6.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=~(this.bb.capacity()-this.space+i)+1&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*2;this.addInt16(r);var n=0,a=this.space;e:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(o)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(a+s)!=this.bb.readInt16(o+s))continue e;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){if(this.prep(this.minalign,8+r),4!=e.length)throw TypeError("FlatBuffers: file identifier must be length 4");for(var n=3;n>=0;n--)this.writeInt8(e.charCodeAt(n))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){var e;return null==t?0:(eI(t,Uint8Array)?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null!==r)e.push(this.createObjectOffset(r));else throw TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=u6.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),u9=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 u7(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),u7=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=u9.createDataVector(t,this.data);return u9.createFBEffectsObjectData(t,e,i)},t}(),ht=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new u9).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new he(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),he=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=ht.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return ht.createFBEffectsPackageData(t,e)},t}(),hi=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 hr(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),hr=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return hi.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),hn=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 ha(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,o){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),ha=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return hn.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),ho=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new hn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new hs(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),hs=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=ho.createChannelsVector(t,t.createObjectOffsetList(this.channels));return ho.createFBVertexData(t,this.vertexCount,e)},t}(),hu=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 ho).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new hi).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new hh(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),hh=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=[]),void 0===o&&(o=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=o,this.buffer=s,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=hu.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=hu.createBinaryDataVector(t,this.binaryData),s=hu.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=hu.createInverseBindMatricesVector(t,this.inverseBindMatrices);return hu.startFBGeometryData(t),hu.addId(t,e),hu.addName(t,i),hu.addVertexData(t,r),hu.addIndexFormat(t,this.indexFormat),hu.addIndexOffset(t,this.indexOffset),hu.addSubMeshes(t,n),hu.addMode(t,this.mode),hu.addBuffer(t,a),hu.addBinaryData(t,o),hu.addBoneNames(t,s),hu.addRootBoneName(t,u),hu.addInverseBindMatrices(t,h),hu.endFBGeometryData(t)},t}(),hl=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 u8(1),i=new he,r=[],n=eO(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===et.Geometry&&(o=new u7("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,ht.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new u6(t),i=ht.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),o=n.dataType();if(a){var s=void 0;o===et.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new u8(1),i=new hh,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,h=t.rootBoneName,l=t.inverseBindMatrices,c=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===h?"":h,i.inverseBindMatrices=void 0===l?[]:l,i.binaryData=void 0===c?[]:c;var f=new hs;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=eO(s.channels);!(d=p()).done;){var m=d.value,v=new ha(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=eO(t.subMeshes);!(y=x()).done;){var b=y.value,T=new hr(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,ht.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new u6(t),o=hu.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var l,c=u.channels(h);if(c){var f={semantic:null!=(l=c.semantic())?l:"",offset:c.offset(),format:c.format(),dimension:c.dimension(),normalize:c.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<o.subMeshesLength();p++){var m=o.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<o.boneNamesLength();g++){var x=o.boneNames(g);y.push(x)}var b=o.inverseBindMatricesArray();return{vertexData:s,indexFormat:o.indexFormat(),indexOffset:o.indexOffset(),subMeshes:d,mode:o.mode(),buffer:null!=(e=o.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=o.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=o.binaryDataArray())?r:void 0,id:null!=(n=o.id())?n:"",dataType:et.Geometry}},t}(),hc=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 uh(this),this.emptyTexture=r0(this),this.transparentTexture=r1(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 it(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,i=t.jsonScene,r=t.textureOptions,n=i.items,a=i.materials,o=i.shaders,s=i.geometries,u=i.components,h=i.animations,l=i.bins,c=void 0===l?[]:l,f=i.miscs,d=i.compositions,p=eO(d);!(e=p()).done;){var m=e.value;this.addEffectsObjectData(m)}for(var v,y=eO(void 0===n?[]:n);!(v=y()).done;){var g=v.value;uq(g.renderLevel,t.renderLevel)||(g.components=[],g.type=tF.null),this.addEffectsObjectData(g)}for(var x,b=eO(void 0===a?[]:a);!(x=b()).done;){var T=x.value;this.addEffectsObjectData(T)}for(var E,_=eO(void 0===o?[]:o);!(E=_()).done;){var C=E.value;this.addEffectsObjectData(C)}for(var S,A=eO(void 0===s?[]:s);!(S=A()).done;){var w=S.value;this.addEffectsObjectData(w)}for(var O,I=eO(void 0===u?[]:u);!(O=I()).done;){var M=O.value;this.addEffectsObjectData(M)}for(var R,P=eO(void 0===h?[]:h);!(R=P()).done;){var N=R.value;this.addEffectsObjectData(N)}for(var V,L=eO(void 0===f?[]:f);!(V=L()).done;){var F=V.value;this.addEffectsObjectData(F)}for(var D=0;D<c.length;D++){var k=c[D],z=t.bins[D];if(k.dataType===et.BinaryAsset)k.buffer=z,k.id&&this.addEffectsObjectData(k);else{var U=new hl;U.deserializeFromBinary(new Uint8Array(z));for(var B,G=eO(U.exportObjectDatas);!(B=G()).done;){var j=B.value;this.addEffectsObjectData(j)}}}for(var X,W=eO(void 0===r?[]:r);!(X=W()).done;){var H=X.value;this.addEffectsObjectData(H)}},e.createVFXItems=function(t){var e=this;return eA(function(){var i,r,n,a;return eP(this,function(o){for(i=eO(t.jsonScene.items);!(r=i()).done;)("ECS"===(a=(n=r.value).type)||"camera"===a||a===tF.sprite||a===tF.particle||a===tF.mesh||a===tF.skybox||a===tF.light||a===tF.tree||a===tF.interact||a===tF.camera)&&e.database&&e.assetLoader.loadGUID(n);return[2]})})()},e.addTexture=function(t){this.destroyed||eD(this.textures,t)},e.removeTexture=function(t){this.destroyed||ek(this.textures,t)},e.addMaterial=function(t){this.destroyed||eD(this.materials,t)},e.removeMaterial=function(t){this.destroyed||ek(this.materials,t)},e.addGeometry=function(t){this.destroyed||eD(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||ek(this.geometries,t)},e.addMesh=function(t){this.destroyed||eD(this.meshes,t)},e.removeMesh=function(t){this.destroyed||ek(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||eD(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||ek(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&&e5.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}},rd(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),hf=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=ij(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e=0,i=this.tickers.length;e<i;e++)(0,this.tickers[e])(this.dt)}}},e.add=function(t){if("function"!=typeof t)throw Error("The tick object must implement the tick method.");this.tickers.push(t)},rd(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();ic("camera",aO,t.VFXItem),ic("text",uo,t.VFXItem),ic("sprite",ow,t.VFXItem),ic("particle",sD,t.VFXItem),ic("cal",sk,t.VFXItem),ic("interact",aL,t.VFXItem),e5.info("Core version: 0.0.0-experimental-20250807.");var hd=((eb={})[rE.ONE]=eC.OneFactor,eb[rE.ZERO]=eC.ZeroFactor,eb[rE.SRC_COLOR]=eC.SrcColorFactor,eb[rE.SRC_ALPHA]=eC.SrcAlphaFactor,eb[rE.ONE_MINUS_SRC_COLOR]=eC.OneMinusSrcColorFactor,eb[rE.ONE_MINUS_SRC_ALPHA]=eC.OneMinusSrcAlphaFactor,eb[rE.DST_COLOR]=eC.DstColorFactor,eb[rE.DST_ALPHA]=eC.DstAlphaFactor,eb[rE.ONE_MINUS_DST_COLOR]=eC.OneMinusDstColorFactor,eb[rE.ONE_MINUS_DST_ALPHA]=eC.OneMinusDstAlphaFactor,eb),hp=((eT={})[rE.NEVER]=eC.NeverStencilFunc,eT[rE.EQUAL]=eC.EqualStencilFunc,eT[rE.LESS]=eC.LessStencilFunc,eT[rE.LEQUAL]=eC.LessEqualStencilFunc,eT[rE.ALWAYS]=eC.AlwaysStencilFunc,eT[rE.NOTEQUAL]=eC.NotEqualStencilFunc,eT[rE.GREATER]=eC.GreaterStencilFunc,eT[rE.GEQUAL]=eC.GreaterEqualStencilFunc,eT),hm=((eE={})[rE.KEEP]=eC.KeepStencilOp,eE[rE.ZERO]=eC.ZeroStencilOp,eE[rE.REPLACE]=eC.ReplaceStencilOp,eE[rE.INCR]=eC.IncrementStencilOp,eE[rE.DECR]=eC.DecrementStencilOp,eE[rE.INCR_WRAP]=eC.IncrementWrapStencilOp,eE[rE.DECR_WRAP]=eC.IncrementWrapStencilOp,eE[rE.INVERT]=eC.InvertStencilOp,eE),hv=((e_={})[rE.NEVER]=eC.NeverDepth,e_[rE.ALWAYS]=eC.AlwaysDepth,e_[rE.EQUAL]=eC.EqualDepth,e_[rE.LESS]=eC.LessDepth,e_[rE.LEQUAL]=eC.LessEqualDepth,e_[rE.GREATER]=eC.GreaterDepth,e_[rE.GEQUAL]=eC.GreaterEqualDepth,e_[rE.NOTEQUAL]=eC.NotEqualDepth,e_),hy=["uMaskTex","_MainTex","uColorOverLifetime","uColorOverTrail"],hg=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new eC.RawShaderMaterial,n.uniforms={},n.macrosDirty=!0;var n,a,o,s,u,h=null==r?void 0:r.shader,l=i.gpuCapability.level;return n.shader=new t.Shader(i),n.shader.shaderData=ik({},h,{id:ia(),dataType:et.Shader,vertex:null!=(a=null==h?void 0:h.vertex)?a:"",fragment:null!=(o=null==h?void 0:h.fragment)?o:""}),n.uniforms._MainTex=new eC.Uniform(null),n.uniforms.uEditorTransform=new eC.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new eC.Uniform(new eC.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new eC.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new eC.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new eC.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new eC.RawShaderMaterial({vertexShader:nF.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:null!=(s=null==h?void 0:h.vertex)?s:"",macros:null==h?void 0:h.macros,removeVersion:!0}),fragmentShader:nF.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:null!=(u=null==h?void 0:h.fragment)?u:"",macros:null==h?void 0:h.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:eC.LessDepth,polygonOffsetFactor:eC.ZeroFactor,polygonOffsetUnits:eC.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===l?n.material.glslVersion=eC.GLSL1:n.material.glslVersion=eC.GLSL3,n}iy(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;hy.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new eC.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var a=new eC.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",a)}else{var o=r.camera;this.setMatrix("effects_MatrixVP",o.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",o.getViewMatrix())}},r.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.getVector4Array=function(t){return this.uniforms[t].value},r.setVector4Array=function(t,e){for(var i,r=[],n=eO(e);!(i=n()).done;){var a=i.value;r=r.concat(a.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.uniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=eO(e);!(i=n()).done;){var a=i.value;r=r.concat(a.elements)}this.setUniform(t,r)},r.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.getMatrix=function(t){return this.uniforms[t].value},r.setMatrix=function(t,e){this.setUniform(t,e)},r.setMatrix3=function(t,e){this.setUniform(t,e)},r.getVector2=function(t){return this.uniforms[t].value},r.setVector2=function(t,e){this.setUniform(t,e)},r.getVector3=function(t){return this.uniforms[t].value},r.setVector3=function(t,e){this.setUniform(t,e)},r.getVector4=function(t){return this.uniforms[t].value},r.setVector4=function(t,e){this.setUniform(t,e)},r.getColor=function(t){var e=this.uniforms[t].value;return new rx(e.x,e.y,e.z,e.w)},r.setColor=function(t,e){this.setUniform(t,new eC.Vector4(e.r,e.g,e.b,e.a))},r.getQuaternion=function(t){return this.uniforms[t].value},r.setQuaternion=function(t,e){this.setUniform(t,e)},r.getFloat=function(t){return this.uniforms[t].value},r.setFloat=function(t,e){this.setUniform(t,e)},r.getFloats=function(t){return this.uniforms[t].value},r.setFloats=function(t,e){this.setUniform(t,e)},r.getInt=function(t){return this.uniforms[t].value},r.setInt=function(t,e){this.setUniform(t,e)},r.hasUniform=function(t){return!!this.uniforms[t]},r.setUniform=function(t,e){var i=new eC.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=i},r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.clone=function(t){throw Error("Method not implemented.")},r.cloneUniforms=function(t){throw Error("Method not implemented.")},r.fromData=function(t){throw Error("Method not implemented.")},r.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},rd(i,[{key:"blending",get:function(){return this.material.blending!==eC.NoBlending},set:function(t){this.material.blending=t?eC.CustomBlending:eC.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,i=t.blendDst;return[e,i,t.blendSrcAlpha||e,t.blendDstAlpha||i]},set:function(t){if(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.material.blendSrc=hd[e],this.material.blendDst=hd[i],this.material.blendSrcAlpha=hd[r],this.material.blendDstAlpha=hd[n]}}},{key:"blendEquation",get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=t[0],i=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=i}}},{key:"depthTest",get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t}},{key:"depthMask",get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t}},{key:"depthFunc",get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=hv[t])}},{key:"polygonOffsetFill",get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t}},{key:"polygonOffset",get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=t[0],i=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=i}}},{key:"sampleAlphaToCoverage",get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t}},{key:"stencilTest",get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t}},{key:"stencilMask",get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])}},{key:"stencilRef",get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])}},{key:"stencilFunc",get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=hp[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=hm[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=hm[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=hm[t[0]])}},{key:"culling",get:function(){return this.material.side!==eC.DoubleSide},set:function(t){this.material.side=t?eC.FrontSide:eC.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tM.FRONT?this.material.side=eC.FrontSide:t===tM.BACK&&(this.material.side=eC.BackSide)}},{key:"colorMask",get:function(){return this.material.colorWrite},set:function(t){this.material.colorWrite=t}}]),i}(r9),hx=1,hb=function(t){function e(e,i){if((r=t.call(this,e)||this).attributes={},r.destroyed=!1,r.attributesName=[],!i)return s7(r);var r,n=i.drawStart,a=i.drawCount,o=i.indices,s=i.mode,u=i.name,h=void 0===u?"effectsGeometry:"+hx++:u;r.name=h,r.mode=null!=s?s:rE.TRIANGLES;var l=[],c={},f=new eC.BufferGeometry;return Object.keys(i.attributes).forEach(function(t){var e=i.attributes[t];if("dataSource"in e){var n=e.dataSource;if(n){void 0===c[n]&&r.setAttributeType(n,e,f,c,i.maxVertex);var a=e.size,o=e.offset,s=e.normalize,u=c[n],h=u.buffer,d=u.dataLength,p=new eC.InterleavedBufferAttribute(h,a,(null!=o?o:0)/d,s);f.setAttribute(t,p),c[t]={buffer:h,attribute:p,type:u.type,dataLength:d}}}else r.setAttributeType(t,e,f,c,i.maxVertex);l.push(t)}),o&&o.data&&f.setIndex(new eC.BufferAttribute(o.data,1)),r.geometry=f,r.attributes=c,r.attributesName=l,r.drawStart=void 0===n?0:n,r.drawCount=null!=a?a:0,r}iy(e,t);var i=e.prototype;return i.getAttributeData=function(t){if(void 0!=this.attributes[t])return this.attributes[t].buffer.array},i.setAttributeData=function(t,e){if(void 0!=this.attributes[t]){var i=this.attributes[t].buffer;if(e.length>i.array.length){var r=new eC.InterleavedBuffer(e,i.stride);i=this.attributes[t].attribute.data=r,this.attributes[t].buffer=r,this.geometry.setAttribute(t,this.attributes[t].attribute)}else i.set(e,0),i.updateRange.count=e.length,i.updateRange.offset=0;this.geometry.attributes[t].needsUpdate=!0}},i.setAttributeSubData=function(t,e,i){void 0!=this.attributes[t]&&(this.attributes[t].buffer.set(i,e),this.geometry.attributes[t].needsUpdate=!0)},i.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*nl[e.type]},i.getAttributeNames=function(){return this.attributesName},i.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},i.setIndexData=function(t){t&&(this.geometry.setIndex(new eC.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},i.setIndexSubData=function(t,e){var i=this.geometry.getIndex();if(null!==i){var r=t+e.length;if(i.count<r){var n=new e.constructor(end);n.set(i.array),i.array=n}i.array.set(e,t),this.geometry.index.needsUpdate=!0}},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return{}},i.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},i.setAttributeType=function(t,e,i,r,n){var a=e.stride,o=e.size,s=e.offset,u=e.normalize,h=e.type,l=void 0===h?rE.FLOAT:h,c=e.data;if(l&&!c&&(c=nf(l)),c){var f=eI(c,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,d=(void 0===a?0:a)/f,p=(n=(null!=n?n:0)*d)||o*f;p&&0===c.length&&(c=eI(c,Float32Array)?new Float32Array(p):new Uint16Array(p));var m=new eC.InterleavedBuffer(c,d),v=new eC.InterleavedBufferAttribute(m,o,(null!=s?s:0)/f,u);i.setAttribute(t,v),r[t]={buffer:m,attribute:v,type:l,dataLength:f}}},rd(e,[{key:"drawCount",get:function(){return this.geometry.drawRange.count},set:function(t){this.geometry.drawRange.count=t}},{key:"drawStart",get:function(){return this.geometry.drawRange.start},set:function(t){this.geometry.drawRange.start=t}}]),e}(nc),hT=function(e){function i(t,i){if(!i)return s7(r);var r,n=i.material,a=i.geometry,o=i.priority;return(r=e.call(this,t,i)||this).geometry=a,r.material=n,a.mode===rE.LINES?r.mesh=new eC.LineSegments(a.geometry,n.material):r.mesh=new eC.Mesh(a.geometry,n.material),r.priority=void 0===o?0:o,r}iy(i,e);var r=i.prototype;return r.setVisible=function(t){this.mesh.visible=t},r.getVisible=function(){return this.mesh.visible},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e,this.mesh.material=e.material},r.onStart=function(){e.prototype.onStart.call(this),this.engine.threeGroup.add(this.mesh)},r.restore=function(){},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},r.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},rd(i,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),i}(nb),hE=function(e){function i(i,r,n){if(void 0===n&&(n={}),a=e.call(this,i)||this,r){var a,o=r.width,s=r.height;a.texture=a.createTextureByType(ik({},n,{sourceType:t.TextureSourceType.data,data:r})),a.width=void 0===o?1:o,a.height=void 0===s?1:s}else a.texture=a.createTextureByType(n);return a.texture.needsUpdate=!0,a.source={},a}iy(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.assembleOptions=function(e){var r=e.target,n=void 0===r?rE.TEXTURE_2D:r;return e.sourceType||("image"in e?e.sourceType=t.TextureSourceType.image:"data"in e?e.sourceType=t.TextureSourceType.data:"video"in e?e.sourceType=t.TextureSourceType.video:e.sourceType=t.TextureSourceType.none),ik({},e,{target:n,format:eC.RGBAFormat,type:eC.UnsignedByteType,minFilter:i.toThreeJsTextureFilter(e.minFilter),magFilter:i.toThreeJsTextureFilter(e.magFilter),wrapS:i.toThreeJsTextureWrap(e.wrapS),wrapT:i.toThreeJsTextureWrap(e.wrapT)})},r.dispose=function(){this.texture.dispose()},r.fromData=function(t){e.prototype.fromData.call(this,t),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.createTextureByType=function(e){var i=this.assembleOptions(e),r=i.flipY,n=i.type,a=i.wrapS,o=i.wrapT,s=i.minFilter,u=i.magFilter,h=i.sourceType,l=eC.UVMapping,c=i.format,f=void 0;if(this.sourceType=h,h===t.TextureSourceType.data){var d=e.data;f=new eC.DataTexture(d.data,d.width,d.height,c,n,l,a,o,u,s),this.width=d.width,this.height=d.height}else if(h===t.TextureSourceType.image){var p=e.image;f=new eC.Texture(p,l,a,o,u,s,c,n),this.width=p.width,this.height=p.height}else if(h===t.TextureSourceType.compressed){var m=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,i=t.width,r=t.height;return m=m<i?i:m,v=v<r?r:v,{data:e,width:i,height:r,colorSpace:"srgb"}});c=eC.RGBA_ASTC_4x4_Format,f=new eC.CompressedTexture(y,m,v,c,n,l,a,o,u,s),this.width=m,this.height=v}else if(h===t.TextureSourceType.video)f=new eC.VideoTexture(e.video,l,a,o,u,s,c,n);else if(h===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,b,T=null!=(x=g.width)?x:0,E=null!=(b=g.height)?b:0;f=new eC.FramebufferTexture(T,E,c),this.width=T,this.height=E}}else h===t.TextureSourceType.none&&((f=new eC.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=eC.MirroredRepeatWrapping,f.wrapT=eC.MirroredRepeatWrapping,this.width=this.height=1);if(this.source=e,f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===rE.LINEAR?eC.LinearFilter:eC.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case rE.MIRRORED_REPEAT:return eC.MirroredRepeatWrapping;case rE.REPEAT:return eC.RepeatWrapping;default:return eC.ClampToEdgeWrapping}},i}(rK),h_=function(e){function i(t,i){return e.call(this,t,i)}iy(i,e);var r=i.prototype;return r.prepareRender=function(){var e=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var i,r=eO(this.rootComposition.items);!(i=r()).done;)for(var n,a=i.value.getComponents(rv),o=eO(a);!(n=o()).done;){var s=n.value;s.isActiveAndEnabled&&s.render(e)}for(var u,h=eO(this.refContent);!(u=h()).done;)for(var l,c=u.value,f=eO(c.getComponent(t.CompositionComponent).items);!(l=f()).done;)for(var d,p=l.value.getComponents(rv),m=eO(p);!(d=m()).done;){var v=d.value;v.isActiveAndEnabled&&v.render(e)}},r.getRendererOptions=function(){var t=hE.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return t.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:t,cachePrefix:"-"}),this.rendererOptions},i}(sI);h_.shape={};var hC=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new nq(e),i}return iy(e,t),e.prototype.setOptions=function(t){var e=t.threeCamera,i=t.threeGroup,r=t.composition;this.threeCamera=e,this.threeGroup=i,this.composition=r},e}(hc),hS=function(t){function e(e){var i;return(i=t.call(this)||this).engine=new hC(e),i.engine.renderer=oP(i),i.env="",i.renderingData={currentFrame:{}},i}return iy(e,t),e}(nJ),hA=function(t){function e(e,i){(r=t.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,a=i.height,o=i.camera;return r.renderer=new hS(e),r.assetService=new u1(r.renderer.engine),r.width=n,r.height=a,r.camera=o,r}iy(e,t);var i=e.prototype;return i.loadScene=function(t,e){var i=this;return eA(function(){var r,n,a,o,s,u,h,l,c,f,d,p;return eP(this,function(m){switch(m.label){case 0:return e2(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),r=performance.now(),n=[],a=[],s=null==(o=null==e?void 0:e.autoplay)||o,u=i.baseCompositionIndex,e9(t)?(h=n).push.apply(h,[].concat(t)):n.push(t),[4,Promise.all(n.map(eA(function(t,r){var n,o,h,l,c,f;return eP(this,function(d){switch(d.label){case 0:return o=(n=i.assetService.assembleSceneLoadOptions(t,ik({autoplay:s},e))).source,[4,(l=new u0(h=n.options)).loadScene(o,i.renderer,{env:i.env})];case 1:return c=d.sent(),i.assetService.prepareAssets(c,l.getAssets()),i.assetService.updateTextVariables(c,l.options.variables),i.assetService.initializeTexture(c),c.pluginSystem.precompile(c.jsonScene.compositions,i.renderer),f=i.createComposition(c,h),i.baseCompositionIndex+=1,f.setIndex(u+r),a[r]=f,[2]}})})))];case 1:for(m.sent(),l=0;l<a.length;l++)s?a[l].play():a[l].pause();for(c=a.map(function(t){return t.name}),f=performance.now()-r,d=eO(a);!(p=d()).done;)p.value.statistic.firstFrameTime=f;return e5.info("First frame ["+c+"]: "+f.toFixed(4)+"ms."),[2,e9(t)?a:a[0]]}})})()},i.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=new h_(ik({},e,{width:this.width,height:this.height,renderer:this.renderer,handleItemMessage:function(t){i.dispatchEvent({type:"message",message:t})}}),t);return r.on("end",function(){i.dispatchEvent({type:"end",composition:r})}),this.renderer.engine.setOptions({threeCamera:this.camera,threeGroup:this,composition:r}),this.compositions.push(r),r},i.pause=function(){this.dispatchEvent({type:"pause"}),this.compositions.forEach(function(t){t.pause()})},i.resume=function(){this.dispatchEvent({type:"resume"}),this.compositions.forEach(function(t){t.resume()})},i.update=function(t){this.compositions.forEach(function(e){e.update(t)})},rd(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(eC.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}iy(e,t);var i=e.prototype;return i.setVisible=function(t){this.threeMesh.visible=t},i.getVisible=function(){return this.threeMesh.visible},i.dispose=function(){t.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},i.fromData=function(e){t.prototype.fromData.call(this,e),this.threeMesh||(this.geometry.mode===rE.LINES?this.threeMesh=new eC.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new eC.Mesh(this.geometry.geometry,this.material.material))},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.threeMesh)},i.render=function(t){this.isActiveAndEnabled&&(this.material.setVector2("_Size",this.transform.size),this.material.setMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.onDestroy=function(){this.threeMesh.clear()},rd(e,[{key:"priority",get:function(){return this.threeMesh.renderOrder},set:function(t){this.threeMesh&&(this.threeMesh.renderOrder=t)}},{key:"enabled",get:function(){return this.threeMesh.visible},set:function(t){this.threeMesh.visible=t,t&&this.onEnable()}}]),e}(t.SpriteComponent),t.ThreeSpriteComponent=eR([i_(et.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=ut.getCanvas(),ut.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return s7(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}iy(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture(),this.material.setColor("_Color",new rx(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=eR([i_(et.TextComponent)],t.ThreeTextComponent),is(t.ThreeTextComponent,[ua]),sF(8),rK.create=function(t,e){return new hE(t,void 0,e)},rK.createWithData=function(t,e,i){return new hE(t,e,i)},r9.create=function(t,e){return new hg(t,e)},nc.create=function(t,e){return new hb(t,e)},nb.create=function(t,e){return new hT(t,e)};var hw="0.0.0-experimental-20250807";e5.info("THREEJS plugin version: "+hw+"."),t.AbstractPlugin=im,t.ActivationPlayable=sW,t.AndNode=i5,t.Animatable=iW,t.AnimationClipNode=iX,t.ApplyAdditiveNode=i3,t.Asset=us,t.AssetLoader=uh,t.AssetManager=u0,t.AssetService=u1,t.BYTES_TYPE_MAP=nl,t.BaseRenderComponent=aw,t.Behaviour=rm,t.BezierCurve=og,t.BezierCurvePath=os,t.BezierCurveQuat=ou,t.BlendNode=i4,t.BoolValueNode=iL,t.CONSTANT_MAP_BLEND=hd,t.CONSTANT_MAP_DEPTH=hv,t.CONSTANT_MAP_STENCIL_FUNC=hp,t.CONSTANT_MAP_STENCIL_OP=hm,t.COPY_FRAGMENT_SHADER=nn,t.COPY_MESH_SHADER_ID=ni,t.COPY_VERTEX_SHADER=nr,t.CalculateLoader=sk,t.Camera=oD,t.CameraVFXItemLoader=aO,t.ColorCurve=oE,t.Component=rp,t.ComponentTimePlayable=sL,t.ComponentTimePlayableAsset=sV,t.ComponentTimeTrack=sN,t.Composition=sI,t.ConstBoolNode=i7,t.ConstFloatNode=i9,t.ControlParameterBoolNode=re,t.ControlParameterFloatNode=rt,t.ControlParameterTriggerNode=ri,t.DEFAULT_FONTS=ur,t.DEFAULT_FPS=60,t.Database=ul,t.Deferred=function(){var t=this;this.promise=new Promise(function(e,i){t.resolve=e,t.reject=i})},t.Downloader=rM,t.EFFECTS_COPY_MESH_NAME=ne,t.EVENT_TYPE_CLICK=aI,t.EVENT_TYPE_TOUCH_END=aP,t.EVENT_TYPE_TOUCH_MOVE=aR,t.EVENT_TYPE_TOUCH_START=aM,t.EffectsObject=iA,t.EffectsPackage=hl,t.Ellipse=s4,t.Engine=hc,t.EventEmitter=sC,t.EventSystem=aN,t.Float16ArrayWrapper=aD,t.FloatComparisonNode=ro,t.FloatComparisonNodeData=ra,t.FloatValueNode=iV,t.Framebuffer=nK,t.GPUCapability=nq,t.Geometry=nc,t.GlobalUniforms=nH,t.GradientValue=on,t.GraphInstance=rc,t.GraphNode=iM,t.GraphNodeData=iR,t.GraphicsPath=s9,t.HELP_LINK=aE,t.InteractLoader=aL,t.InteractMesh=oC,t.InvalidIndex=-1,t.KTXTexture=r2,t.LayerBlendNode=rr,t.LineSegments=oa,t.LinearValue=or,t.MaskProcessor=r7,t.Material=r9,t.MaterialDataBlock=r5,t.Mesh=nb,t.MeshCollider=oA,t.NodeTransform=i0,t.NotNode=i8,t.OrNode=i6,t.PLAYER_OPTIONS_ENV_EDITOR=aT,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=oK,t.ParticleBehaviourPlayableAsset=oJ,t.ParticleLoader=sD,t.ParticleMesh=o0,t.ParticleSystemRenderer=o3,t.ParticleTrack=sx,t.PassTextureCache=nu,t.PathSegments=oo,t.PluginSystem=id,t.PolyStar=s5,t.Polygon=s2,t.Pose=i1,t.PoseNode=iP,t.PropertyTrack=sg,t.RENDER_PASS_NAME_PREFIX=nB,t.RENDER_PREFER_LOOKUP_TEXTURE=oB,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=ot,t.RandomValue=oe,t.RandomVectorValue=oi,t.RenderFrame=nj,t.RenderPass=n_,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=nT,t.Renderbuffer=nY,t.Renderer=nJ,t.RendererComponent=rv,t.RuntimeClip=sy,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",t.SPRITE_VERTEX_STRIDE=6,t.SemanticMap=nh,t.SerializationHelper=uu,t.ShaderFactory=nF,t.ShaderVariant=nt,t.ShapePath=s8,t.SpriteLoader=ow,t.StateMachineNode=rs,t.StateNode=ru,t.StaticValue=a7,t.TEMPLATE_USE_OFFSCREEN_CANVAS=oG,t.TEXTURE_UNIFORM_MAP=hy,t.TextComponentBase=ua,t.TextLayout=ue,t.TextLoader=uo,t.TextStyle=ui,t.Texture=rK,t.TextureFactory=r4,t.ThreeComposition=h_,t.ThreeDisplayObject=hA,t.ThreeEngine=hC,t.ThreeMaterial=hg,t.ThreeTexture=hE,t.Ticker=hf,t.TimelineClip=sv,t.TimelinePlayable=sT,t.TrackSortWrapper=sE,t.Transform=oL,t.TransformAnimationPlayable=sX,t.TransitionNode=rh,t.ValueGetter=a9,t.ValueNode=iN,t.Vector2Curve=oy,t.Vector3Curve=ov,t.Vector4Curve=om,t.addByOrder=e0,t.addItem=eD,t.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}},t.applyMixins=is,t.assertExist=e2,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=io,t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",t.buildLine=sQ,t.calculateTranslation=aU,t.canUseBOM=eW,t.canvasPool=ut,t.closePointEps=1e-4,t.colorGradingFrag=nM,t.colorStopsFromGradient=eG,t.colorToArr=eU,t.combineImageTemplate=uK,t.createCopyShader=na,t.createGLContext=function(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"!==e||(r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r},t.createKeyFrameMeta=of,t.createShape=ar,t.createValueGetter=oT,t.curveEps=1e-4,t.decimalEqual=aY,t.defaultPlugins=ih,t.deserializeMipmapTexture=rH,t.earcut=ab,t.effectsClass=i_,t.effectsClassStore=iE,t.enlargeBuffer=ez,t.ensureFixedNumber=uf,t.ensureVec3=aB,t.findPreviousRenderPass=function(t,e){var i=t.indexOf(e);return t[i-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=nR,t.gaussianDownVFrag=nP,t.gaussianUpFrag=nN,t.generateEmptyTypedArray=nf,t.generateGUID=ia,t.generateHalfFloatTexture=rJ,t.generateTransparentTexture=r1,t.generateWhiteTexture=r0,t.getBackgroundImage=uQ,t.getClass=function(t){return iE[t]},t.getColorFromGradientStops=eB,t.getConfig=function(t){return oj[t]},t.getDefaultTextureFactory=function(){return eh||(eh=new r4),eh},t.getGeometryByShape=aC,t.getGeometryTriangles=a_,t.getKTXTextureOptions=r3,t.getKeyFrameMetaByRawValue=oc,t.getMergedStore=iC,t.getNodeDataClass=function(t){return iO[t]},t.getParticleMeshShader=function(t,e,i){void 0===i&&(i="");var r,n,a,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===aT]],h=e.level,l=e.detail,c=of(),f=of(),d=l.maxVertexUniforms>0,p=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,oc(c,p));var y=o.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=o.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&oc(c,x);var b=o.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(oc(c,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(oc(c,b[n]),o=1,v|=1<<10+e,a=!0),u.push(["ORB_VEL_"+t.toUpperCase(),o])}),(null==b?void 0:b.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),a&&(null==b?void 0:b.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),o.sizeOverLifetime){var T=o.sizeOverLifetime;T.separateAxes?(oc(c,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,oc(c,T.y)):oc(c,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(oc(c,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(oc(c,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(oc(c,E.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144)}oc(c,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,oc(c,b.forceCurve));var _=l.halfFloatTexture;_&&f.max&&(v|=1048576);var C=l.maxVertexUniforms,S=c.max+c.curves.length-32>C;oj[oB]&&(S=!0),2===h&&(c.max=-1,f.index>0&&(f.max=-1)),S&&_&&d&&(m=1);var A={fragment:nA,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+nw,shared:!0,cacheId:["-p:",s,v,c.index,c.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:A,vertex:c.index,fragment:f.index}},t.getPixelRatio=function(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);return Math.min(screen.width/t*2,2)}return 1},t.getPreMultiAlpha=rA,t.getStandardComposition=uW,t.getStandardImage=uX,t.getStandardItem=uY,t.getStandardJSON=uG,t.getTextureSize=nX,t.glContext=rE,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return ei.Float32;case WebGLRenderingContext.SHORT:return ei.Int16;case WebGLRenderingContext.BYTE:return ei.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return ei.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return ei.UInt8;default:return ei.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=eA(function(){return eP(this,function(n){return[2,new Promise(function(n,a){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(i),i=null),null!==o&&i&&window.setTimeout(function(){r().then(n).catch},1)}})]})});if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:r}}},t.imageDataFromColor=function(t){e8(t)&&(t=eU(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i},t.imageDataFromGradient=eJ,t.initErrors=rT,t.initGLContext=rC,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=ej,t.isAlipayMiniApp=eQ,t.isAndroid=eY,t.isArray=e9,t.isCanvas=ie,t.isFunction=e7,t.isIOS=eH,t.isIOSByUA=function(){var t=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},t.isMiniProgram=function(){return eQ()||eK()},t.isObject=it,t.isOpenHarmony=eZ,t.isSimulatorCellPhone=eq,t.isString=e8,t.isUniformStruct=r6,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&r6(t[0])},t.isValidFontFamily=e3,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=eK,t.itemFrag=nS,t.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);}",t.itemVert=nC,t.loadAVIFOptional=rL,t.loadBinary=rz,t.loadBlob=function(t){return rB.apply(this,arguments)},t.loadImage=rD,t.loadMedia=rX,t.loadVideo=rG,t.loadWebPOptional=rN,t.logger=e5,t.math=ng,t.modifyMaxKeyframeShader=function(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var o=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=i;break}}},t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.nodeDataClass=iI,t.noop=e6,t.normalizeColor=ug,t.numberToFix=aZ,t.oldBezierKeyFramesToNew=ox,t.parsePercent=eX,t.particleFrag=nA,t.particleOriginTranslateMap=aX,t.particleUniformTypeMap=o$,t.particleVert=nw,t.passRenderLevel=uq,t.pluginLoaderMap=iu,t.randomInRange=ii,t.registerPlugin=ic,t.removeItem=ek,t.rotateVec2=aS,t.screenMeshVert=nI,t.serialize=function(t,e){return iS(t,e)},t.setBlendMode=rw,t.setConfig=function(t,e){return oj[t]=e},t.setDefaultTextureFactory=function(t){eh=t},t.setMaskMode=rI,t.setMaxSpriteMeshItemCount=sF,t.setRayFromCamera=aW,t.setSideMode=rO,t.setSpriteMeshMaxItemCountByGPU=function(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0},t.setUniformValue=function(t,e,i){t[e]?t[e].value=i:t[e]=new eC.Uniform(i)},t.sortByOrder=e$,t.spec=ix,t.thresholdFrag=nV,t.throwDestroyedError=ir,t.trailVert=nO,t.translatePoint=function(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i},t.trianglesFromRect=aH,t.unregisterPlugin=function(t){delete il[t],delete iu[t],ek(ih,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecFill=aG,t.vecMulCombine=aj,t.version=hw,t.vertexFormatType2GLType=function(t){switch(t){case ei.Float32:return WebGLRenderingContext.FLOAT;case ei.Int16:return WebGLRenderingContext.SHORT;case ei.Int8:return WebGLRenderingContext.BYTE;case ei.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case ei.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
|
|
21
8
|
//# sourceMappingURL=index.min.js.map
|