@newkrok/three-particles 2.7.1 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import*as e from"three";import{Gyroscope as t}from"three/examples/jsm/misc/Gyroscope.js";var r,i,a=Object.create,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,d=(r={"node_modules/easing-functions/index.js"(e,t){var r=e=>e,i={In:e=>e*e,Out:e=>e*(2-e),InOut(e){let t=2*e;return t<1?.5*t*t:(t-=1,-.5*(t*(t-2)-1))}},a={In:e=>e*e*e,Out:e=>--e*e*e+1,InOut(e){let t=2*e;return t<1?.5*t*t*t:(t-=2,.5*(t*t*t+2))}},n={In:e=>e*e*e*e,Out:e=>1- --e*e*e*e,InOut(e){let t=2*e;return t<1?.5*t*t*t*t:(t-=2,-.5*(t*t*t*t-2))}},o={In:e=>e*e*e*e*e,Out:e=>--e*e*e*e*e+1,InOut(e){let t=2*e;return t<1?.5*t*t*t*t*t:(t-=2,.5*(t*t*t*t*t+2))}},s={In:e=>1-Math.cos(e*Math.PI/2),Out:e=>Math.sin(e*Math.PI/2),InOut:e=>.5*(1-Math.cos(Math.PI*e))},l={In:e=>0===e?0:1024**(e-1),Out:e=>1===e?1:1-2**(-10*e),InOut(e){if(0===e)return 0;if(1===e)return 1;const t=2*e;return t<1?.5*1024**(t-1):.5*(2-2**(-10*(t-1)))}},c={In:e=>1-Math.sqrt(1-e*e),Out:e=>Math.sqrt(1- --e*e),InOut(e){let t=2*e;return t<1?-.5*(Math.sqrt(1-t*t)-1):(t-=2,.5*(Math.sqrt(1-t*t)+1))}},d={In(e){let t,r=.1;return 0===e?0:1===e?1:(r<1?(r=1,t=.1):t=.4*Math.asin(1/r)/(2*Math.PI),-r*2**(10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/.4))},Out(e){let t,r=.1;return 0===e?0:1===e?1:(r<1?(r=1,t=.1):t=.4*Math.asin(1/r)/(2*Math.PI),r*2**(-10*e)*Math.sin((e-t)*(2*Math.PI)/.4)+1)},InOut(e){let t=.1;const r=.4;let i;if(0===e)return 0;if(1===e)return 1;t<1?(t=1,i=.1):i=r*Math.asin(1/t)/(2*Math.PI);const a=2*e;if(a<1){const e=a-1;return t*2**(10*e)*Math.sin((e-i)*(2*Math.PI)/r)*-.5}const n=a-1;return t*2**(-10*n)*Math.sin((n-i)*(2*Math.PI)/r)*.5+1}},u={In(e){const t=1.70158;return e*e*((t+1)*e-t)},Out(e){const t=1.70158;return--e*e*((t+1)*e+t)+1},InOut(e){const t=2.5949095;let r=2*e;return r<1?r*r*((t+1)*r-t)*.5:(r-=2,.5*(r*r*((t+1)*r+t)+2))}},m={In:e=>1-m.Out(1-e),Out(e){if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const t=e-1.5/2.75;return 7.5625*t*t+.75}if(e<2.5/2.75){const t=e-2.25/2.75;return 7.5625*t*t+.9375}const t=e-2.625/2.75;return 7.5625*t*t+.984375},InOut:e=>e<.5?.5*m.In(2*e):.5*m.Out(2*e-1)+.5},p={Quadratic:i,Cubic:a,Quartic:n,Quintic:o,Sinusoidal:s,Exponential:l,Circular:c,Elastic:d,Back:u,Bounce:m},f=(e,t,r)=>Object.defineProperty(e,t,{value:r});for(const e of Object.keys(p)){const t=p[e],r=e.toLowerCase();f(p,r,t);for(const i of Object.keys(t)){const a=t[i],n=i.toLowerCase();f(p,`${e}.${i}`,a),f(p,`${r}.${n}`,a),f(t,n,a)}}p.Linear=r,f(p,"linear",r),t.exports=p,"undefined"!=typeof window&&(window.Easing=p)}},function(){return i||(0,r[s(r)[0]])((i={exports:{}}).exports,i),i.exports}),u=[],m=(e,t)=>{let r=1;for(let i=1;i<=t;i++)r*=(e+1-i)/i;return r},p=(e,t)=>{const r=u.find(e=>e.bezierPoints===t);if(r)return r.referencedBy.includes(e)||r.referencedBy.push(e),r.curveFunction;const i={referencedBy:[e],bezierPoints:t,curveFunction:e=>{if(e<0)return t[0].y;if(e>1)return t[t.length-1].y;let r=0,i=t.length-1;t.find((t,a)=>{const n=e<(t.percentage??0);return n?i=a:void 0!==t.percentage&&(r=a),n});const a=i-r,n=(e-(t[r].percentage??0))/((t[i].percentage??1)-(t[r].percentage??0));let o=0;for(let e=0;e<=a;e++){const i=t[r+e];o+=m(a,e)*Math.pow(1-n,a-e)*Math.pow(n,e)*i.y}return o}};return u.push(i),i.curveFunction},f=e=>{for(;;){const t=u.findIndex(t=>t.referencedBy.includes(e));if(-1===t)break;const r=u[t];r.referencedBy=r.referencedBy.filter(t=>t!==e),0===r.referencedBy.length&&u.splice(t,1)}},y=()=>u.length,I=((e,t,r)=>(r=null!=e?a(l(e)):{},((e,t,r,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of s(t))c.call(e,a)||a===r||n(e,a,{get:()=>t[a],enumerable:!(i=o(t,a))||i.enumerable});return e})(n(r,"default",{value:e,enumerable:!0}),e)))(d()),g=(e=>(e.BEZIER="BEZIER",e.LINEAR="LINEAR",e.QUADRATIC_IN="QUADRATIC_IN",e.QUADRATIC_OUT="QUADRATIC_OUT",e.QUADRATIC_IN_OUT="QUADRATIC_IN_OUT",e.CUBIC_IN="CUBIC_IN",e.CUBIC_OUT="CUBIC_OUT",e.CUBIC_IN_OUT="CUBIC_IN_OUT",e.QUARTIC_IN="QUARTIC_IN",e.QUARTIC_OUT="QUARTIC_OUT",e.QUARTIC_IN_OUT="QUARTIC_IN_OUT",e.QUINTIC_IN="QUINTIC_IN",e.QUINTIC_OUT="QUINTIC_OUT",e.QUINTIC_IN_OUT="QUINTIC_IN_OUT",e.SINUSOIDAL_IN="SINUSOIDAL_IN",e.SINUSOIDAL_OUT="SINUSOIDAL_OUT",e.SINUSOIDAL_IN_OUT="SINUSOIDAL_IN_OUT",e.EXPONENTIAL_IN="EXPONENTIAL_IN",e.EXPONENTIAL_OUT="EXPONENTIAL_OUT",e.EXPONENTIAL_IN_OUT="EXPONENTIAL_IN_OUT",e.CIRCULAR_IN="CIRCULAR_IN",e.CIRCULAR_OUT="CIRCULAR_OUT",e.CIRCULAR_IN_OUT="CIRCULAR_IN_OUT",e.ELASTIC_IN="ELASTIC_IN",e.ELASTIC_OUT="ELASTIC_OUT",e.ELASTIC_IN_OUT="ELASTIC_IN_OUT",e.BACK_IN="BACK_IN",e.BACK_OUT="BACK_OUT",e.BACK_IN_OUT="BACK_IN_OUT",e.BOUNCE_IN="BOUNCE_IN",e.BOUNCE_OUT="BOUNCE_OUT",e.BOUNCE_IN_OUT="BOUNCE_IN_OUT",e))(g||{}),h={LINEAR:I.default.Linear.None,QUADRATIC_IN:I.default.Quadratic.In,QUADRATIC_OUT:I.default.Quadratic.Out,QUADRATIC_IN_OUT:I.default.Quadratic.InOut,CUBIC_IN:I.default.Cubic.In,CUBIC_OUT:I.default.Cubic.Out,CUBIC_IN_OUT:I.default.Cubic.InOut,QUARTIC_IN:I.default.Quartic.In,QUARTIC_OUT:I.default.Quartic.Out,QUARTIC_IN_OUT:I.default.Quartic.InOut,QUINTIC_IN:I.default.Quintic.In,QUINTIC_OUT:I.default.Quintic.Out,QUINTIC_IN_OUT:I.default.Quintic.InOut,SINUSOIDAL_IN:I.default.Sinusoidal.In,SINUSOIDAL_OUT:I.default.Sinusoidal.Out,SINUSOIDAL_IN_OUT:I.default.Sinusoidal.InOut,EXPONENTIAL_IN:I.default.Exponential.In,EXPONENTIAL_OUT:I.default.Exponential.Out,EXPONENTIAL_IN_OUT:I.default.Exponential.InOut,CIRCULAR_IN:I.default.Circular.In,CIRCULAR_OUT:I.default.Circular.Out,CIRCULAR_IN_OUT:I.default.Circular.InOut,ELASTIC_IN:I.default.Elastic.In,ELASTIC_OUT:I.default.Elastic.Out,ELASTIC_IN_OUT:I.default.Elastic.InOut,BACK_IN:I.default.Back.In,BACK_OUT:I.default.Back.Out,BACK_IN_OUT:I.default.Back.InOut,BOUNCE_IN:I.default.Bounce.In,BOUNCE_OUT:I.default.Bounce.Out,BOUNCE_IN_OUT:I.default.Bounce.InOut},v=e=>"function"==typeof e?e:h[e],x=(e=>(e.LOCAL="LOCAL",e.WORLD="WORLD",e))(x||{}),O=(e=>(e.SPHERE="SPHERE",e.CONE="CONE",e.BOX="BOX",e.CIRCLE="CIRCLE",e.RECTANGLE="RECTANGLE",e))(O||{}),b=(e=>(e.VOLUME="VOLUME",e.SHELL="SHELL",e.EDGE="EDGE",e))(b||{}),_=(e=>(e.LIFETIME="LIFETIME",e.FPS="FPS",e))(_||{}),C=(e=>(e.BEZIER="BEZIER",e.EASING="EASING",e))(C||{}),A=(e=>(e.BIRTH="BIRTH",e.DEATH="DEATH",e))(A||{}),T=(e,t,r,i,{radius:a,radiusThickness:n,arc:o})=>{const s=Math.random()*(o/360),l=Math.random(),c=Math.random(),d=2*Math.PI*s,u=Math.acos(2*l-1),m=Math.sin(u),p=m*Math.cos(d),f=m*Math.sin(d),y=Math.cos(u),I=1-n;e.x=a*I*p+a*n*c*p,e.y=a*I*f+a*n*c*f,e.z=a*I*y+a*n*c*y,e.applyQuaternion(t);const g=1/e.length();r.set(e.x*g*i,e.y*g*i,e.z*g*i),r.applyQuaternion(t)},U=(t,r,i,a,{radius:n,radiusThickness:o,arc:s,angle:l=90})=>{const c=2*Math.PI*Math.random()*(s/360),d=Math.random(),u=Math.cos(c),m=Math.sin(c),p=1-o;t.x=n*p*u+n*o*d*u,t.y=n*p*m+n*o*d*m,t.z=0,t.applyQuaternion(r);const f=t.length(),y=Math.abs(f/n*e.MathUtils.degToRad(l)),I=Math.sin(y),g=1/f;i.set(t.x*I*g*a,t.y*I*g*a,Math.cos(y)*a),i.applyQuaternion(r)},E=(e,t,r,i,{scale:a,emitFrom:n})=>{const o=a;switch(n){case"VOLUME":e.x=Math.random()*o.x-o.x/2,e.y=Math.random()*o.y-o.y/2,e.z=Math.random()*o.z-o.z/2;break;case"SHELL":const t=Math.floor(6*Math.random()),r=t%3,i=[];i[r]=t>2?1:0,i[(r+1)%3]=Math.random(),i[(r+2)%3]=Math.random(),e.x=i[0]*o.x-o.x/2,e.y=i[1]*o.y-o.y/2,e.z=i[2]*o.z-o.z/2;break;case"EDGE":const a=Math.floor(6*Math.random()),n=a%3,s=Math.floor(4*Math.random()),l=[];l[n]=a>2?1:0,l[(n+1)%3]=s<2?Math.random():s-2,l[(n+2)%3]=s<2?s:Math.random(),e.x=l[0]*o.x-o.x/2,e.y=l[1]*o.y-o.y/2,e.z=l[2]*o.z-o.z/2}e.applyQuaternion(t),r.set(0,0,i),r.applyQuaternion(t)},L=(e,t,r,i,{radius:a,radiusThickness:n,arc:o})=>{const s=2*Math.PI*Math.random()*(o/360),l=Math.random(),c=Math.cos(s),d=Math.sin(s),u=1-n;e.x=a*u*c+a*n*l*c,e.y=a*u*d+a*n*l*d,e.z=0,e.applyQuaternion(t);const m=1/e.length();r.set(e.x*m*i,e.y*m*i,0),r.applyQuaternion(t)},P=(t,r,i,a,{rotation:n,scale:o})=>{const s=o,l=n,c=Math.random()*s.x-s.x/2,d=Math.random()*s.y-s.y/2,u=e.MathUtils.degToRad(l.x),m=e.MathUtils.degToRad(l.y);t.x=c*Math.cos(m),t.y=d*Math.cos(u),t.z=c*Math.sin(m)-d*Math.sin(u),t.applyQuaternion(r),i.set(0,0,a),i.applyQuaternion(r)},S=()=>{try{const t=document.createElement("canvas"),r=64;t.width=r,t.height=r;const i=t.getContext("2d");if(i){const a=r/2,n=r/2,o=r/2-2;i.beginPath(),i.arc(a,n,o,0,2*Math.PI,!1),i.fillStyle="white",i.fill();const s=new e.CanvasTexture(t);return s.needsUpdate=!0,s}return null}catch(e){return null}},N=e=>"number"!=typeof e&&"type"in e,z=(e,t)=>{if("BEZIER"===t.type)return p(e,t.bezierPoints);if("EASING"===t.type)return t.curveFunction;throw new Error(`Unsupported value type: ${t}`)},w=(t,r,i=0)=>{if("number"==typeof r)return r;if("min"in r&&"max"in r)return r.min===r.max?r.min??0:e.MathUtils.randFloat(r.min??0,r.max??1);const a=r;return z(t,a)(i)*(a.scale??1)},M=new e.Vector3(0,0,0),R=new e.Euler,B=({delta:e,generalData:t,normalizedConfig:r,attributes:i,particleLifetimePercentage:a,particleIndex:n})=>{const{particleSystemId:o,startValues:s,lifetimeValues:l,linearVelocityData:c,orbitalVelocityData:d,noise:u}=t,m=3*n,p=i.position.array;if(c){const{speed:t,valueModifiers:r}=c[n],o=r.x?r.x(a):t.x,s=r.y?r.y(a):t.y,l=r.z?r.z(a):t.z;p[m]+=o*e,p[m+1]+=s*e,p[m+2]+=l*e,i.position.needsUpdate=!0}if(d){const{speed:t,positionOffset:r,valueModifiers:o}=d[n];p[m]-=r.x,p[m+1]-=r.y,p[m+2]-=r.z;const s=o.x?o.x(a):t.x,l=o.y?o.y(a):t.y,c=o.z?o.z(a):t.z;R.set(s*e,c*e,l*e),r.applyEuler(R),p[m]+=r.x,p[m+1]+=r.y,p[m+2]+=r.z,i.position.needsUpdate=!0}if(r.sizeOverLifetime.isActive){const e=w(o,r.sizeOverLifetime.lifetimeCurve,a);i.size.array[n]=s.startSize[n]*e,i.size.needsUpdate=!0}if(r.opacityOverLifetime.isActive){const e=w(o,r.opacityOverLifetime.lifetimeCurve,a);i.colorA.array[n]=s.startOpacity[n]*e,i.colorA.needsUpdate=!0}if(r.colorOverLifetime.isActive){const e=w(o,r.colorOverLifetime.r,a),t=w(o,r.colorOverLifetime.g,a),l=w(o,r.colorOverLifetime.b,a);i.colorR.array[n]=s.startColorR[n]*e,i.colorG.array[n]=s.startColorG[n]*t,i.colorB.array[n]=s.startColorB[n]*l,i.colorR.needsUpdate=!0,i.colorG.needsUpdate=!0,i.colorB.needsUpdate=!0}if(l.rotationOverLifetime&&(i.rotation.array[n]+=l.rotationOverLifetime[n]*e*.02,i.rotation.needsUpdate=!0),u.isActive){const{sampler:e,strength:t,noisePower:r,offsets:o,positionAmount:s,rotationAmount:l,sizeAmount:c}=u;let d;const f=10*(a+(o?o[n]:0))*t;M.set(f,0,0),d=e.get3(M),p[m]+=d*r*s,0!==l&&(i.rotation.array[n]+=d*r*l,i.rotation.needsUpdate=!0),0!==c&&(i.size.array[n]+=d*r*c,i.size.needsUpdate=!0),M.set(f,f,0),d=e.get3(M),p[m+1]+=d*r*s,M.set(f,f,f),d=e.get3(M),p[m+2]+=d*r*s,i.position.needsUpdate=!0}},V={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(V,{deepMerge:()=>Q,getObjectDiff:()=>F,patchObject:()=>D});var D=(e,t,r={skippedProperties:[],applyToFirstObject:!1})=>{const i={};return Object.keys(e).forEach(a=>{r.skippedProperties&&r.skippedProperties.includes(a)||("object"==typeof e[a]&&e[a]&&t[a]&&!Array.isArray(e[a])?i[a]=D(e[a],t[a],r):(i[a]=0===t[a]?0:!1!==t[a]&&(t[a]||e[a]),r.applyToFirstObject&&(e[a]=i[a])))}),i},Q=(e,t,r={skippedProperties:[],applyToFirstObject:!1})=>{const i={};return Array.from(new Set([...Object.keys(e||{}),...Object.keys(t||{})])).forEach(a=>{r.skippedProperties&&r.skippedProperties.includes(a)||("object"==typeof e?.[a]&&e?.[a]&&t?.[a]&&!Array.isArray(e[a])?i[a]=Q(e[a],t[a],r):(i[a]=0===t?.[a]?0:!1!==t?.[a]&&(t?.[a]||e?.[a]),r.applyToFirstObject&&(e[a]=i[a])))}),i},F=(e,t,r={skippedProperties:[]})=>{const i={};return Object.keys(e).forEach(a=>{if(!r.skippedProperties||!r.skippedProperties.includes(a))if("object"==typeof e[a]&&e[a]&&t[a]&&!Array.isArray(e[a])){const n=F(e[a],t[a],r);Object.keys(n).length>0&&(i[a]=n)}else{const r=0===t[a]?0:t[a]||e[a];r!==e[a]&&(i[a]=r)}}),i},k=function(){};k.prototype.load=k,k.prototype.parse=k;var j=k;Array.from({length:3},()=>({loader:new j,isUsed:!1})),Array.from({length:3},()=>({loader:new e.TextureLoader,isUsed:!1})),Array.from({length:3},()=>({loader:new e.AudioLoader,isUsed:!1}));var G=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],H=class{constructor(t){const r=[new e.Vector3(1,1,0),new e.Vector3(-1,1,0),new e.Vector3(1,-1,0),new e.Vector3(-1,-1,0),new e.Vector3(1,0,1),new e.Vector3(-1,0,1),new e.Vector3(1,0,-1),new e.Vector3(-1,0,-1),new e.Vector3(0,1,1),new e.Vector3(0,-1,1),new e.Vector3(0,1,-1),new e.Vector3(0,-1,-1)];var i=new Array(512),a=new Array(512);t||(t=1),t*=65536,(t=Math.floor(t))<256&&(t|=t<<8);for(var n=0;n<256;n++){var o;o=1&n?G[n]^255&t:G[n]^t>>8&255,i[n]=i[n+256]=o,a[n]=a[n+256]=r[o%12]}this._seed=t,this._offsetMatrix=[new e.Vector3(0,0,0),new e.Vector3(0,0,1),new e.Vector3(0,1,0),new e.Vector3(0,1,1),new e.Vector3(1,0,0),new e.Vector3(1,0,1),new e.Vector3(1,1,0),new e.Vector3(1,1,1)],this.shaderChunk={defines:"",header:'#define GLSLIFY 1\n// From https://github.com/hughsk/glsl-noise/blob/master/periodic/2d.glsl\n\n//\n// GLSL textureless classic 2D noise "cnoise",\n// with an RSL-style periodic variant "pnoise".\n// Author: Stefan Gustavson (stefan.gustavson@liu.se)\n// Version: 2011-08-22\n//\n// Many thanks to Ian McEwan of Ashima Arts for the\n// ideas for permutation and gradient selection.\n//\n// Copyright (c) 2011 Stefan Gustavson. All rights reserved.\n// Distributed under the MIT license. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\n\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 1.0) * x); }\n\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nvec2 fade(vec2 t) { return t * t * t * (t * (t * 6.0 - 15.0) + 10.0); }\n\nfloat map(float value, float min1, float max1, float min2, float max2) {\n return min2 + (value - min1) * (max2 - min2) / (max1 - min1);\n}\n\n// Classic Perlin noise, periodic variant\nfloat perlin(vec2 P) {\n\n vec2 rep = vec2(255.0, 255.0);\n\n vec4 Pi = floor(P.xyxy) + vec4(0.0, 0.0, 1.0, 1.0);\n vec4 Pf = fract(P.xyxy) - vec4(0.0, 0.0, 1.0, 1.0);\n Pi = mod(Pi, rep.xyxy); // To create noise with explicit period\n Pi = mod289(Pi); // To avoid truncation effects in permutation\n vec4 ix = Pi.xzxz;\n vec4 iy = Pi.yyww;\n vec4 fx = Pf.xzxz;\n vec4 fy = Pf.yyww;\n\n vec4 i = permute(permute(ix) + iy);\n\n vec4 gx = fract(i * (1.0 / 41.0)) * 2.0 - 1.0;\n vec4 gy = abs(gx) - 0.5;\n vec4 tx = floor(gx + 0.5);\n gx = gx - tx;\n\n vec2 g00 = vec2(gx.x, gy.x);\n vec2 g10 = vec2(gx.y, gy.y);\n vec2 g01 = vec2(gx.z, gy.z);\n vec2 g11 = vec2(gx.w, gy.w);\n\n vec4 norm = taylorInvSqrt(\n vec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));\n g00 *= norm.x;\n g01 *= norm.y;\n g10 *= norm.z;\n g11 *= norm.w;\n\n float n00 = dot(g00, vec2(fx.x, fy.x));\n float n10 = dot(g10, vec2(fx.y, fy.y));\n float n01 = dot(g01, vec2(fx.z, fy.z));\n float n11 = dot(g11, vec2(fx.w, fy.w));\n\n vec2 fade_xy = fade(Pf.xy);\n vec2 n_x = mix(vec2(n00, n01), vec2(n10, n11), fade_xy.x);\n float n_xy = mix(n_x.x, n_x.y, fade_xy.y);\n return map(2.3 * n_xy, -1.0, 1.0, 0.0, 1.0);\n}\n\nfloat fbm(vec2 pos, vec4 props) {\n float persistance = props.x;\n float lacunarity = props.y;\n float redistribution = props.z;\n int octaves = int(props.w);\n\n float result = 0.0;\n float amplitude = 1.0;\n float frequency = 1.0;\n float maximum = amplitude;\n\n for (int i = 0; i < 2; i++) {\n\n vec2 p = pos.xy * frequency;\n\n float noiseVal = perlin(p);\n result += noiseVal * amplitude;\n\n frequency *= lacunarity;\n amplitude *= persistance;\n maximum += amplitude;\n }\n\n float redistributed = pow(result, redistribution);\n return redistributed / maximum;\n}\n',main:"",uniforms:[{three_noise_seed:this._seed}]},this.perm=i,this.gradP=a}_fade(e){return e*e*e*(e*(6*e-15)+10)}_lerp(e,t,r){return(1-r)*e+r*t}_gradient(t){return t instanceof e.Vector3?t.x+this.perm[t.y+this.perm[t.z]]:t.x+this.perm[t.y]}static map(e,t,r,i,a){return(e-t)*(a-i)/(r-t)+i}get2(t){void 0!==t.z&&(t=new e.Vector2(t.x,t.y));const r=new e.Vector2(Math.floor(t.x),Math.floor(t.y));t.sub(r),r.x&=255,r.y&=255;const i=[];for(let a=0;a<4;a++){const n=this._offsetMatrix[2*a],o=new e.Vector2(n.x,n.y),s=this.gradP[this._gradient((new e.Vector2).addVectors(r,o))],l=new e.Vector2(s.x,s.y),c=(new e.Vector2).subVectors(t,o);i.push(l.dot(c))}const a=this._fade(t.x),n=this._fade(t.y);return this._lerp(this._lerp(i[0],i[2],a),this._lerp(i[1],i[3],a),n)}get3(t){if(void 0===t.z)throw"Input to Perlin::get3() must be of type THREE.Vector3";const r=new e.Vector3(Math.floor(t.x),Math.floor(t.y),Math.floor(t.z));t.sub(r),r.x&=255,r.y&=255,r.z&=255;const i=[];for(let a=0;a<8;a++){const n=this._offsetMatrix[a],o=this.gradP[this._gradient((new e.Vector3).addVectors(r,n))],s=(new e.Vector3).subVectors(t,n);i.push(o.dot(s))}const a=this._fade(t.x),n=this._fade(t.y),o=this._fade(t.z);return this._lerp(this._lerp(this._lerp(i[0],i[4],a),this._lerp(i[1],i[5],a),o),this._lerp(this._lerp(i[2],i[6],a),this._lerp(i[3],i[7],a),o),n)}},W=class{constructor(e){const{seed:t,scale:r,persistance:i,lacunarity:a,octaves:n,redistribution:o}=e;this._noise=new H(t),this._scale=r||1,this._persistance=i||.5,this._lacunarity=a||2,this._octaves=n||6,this._redistribution=o||1}get2(t){let r=0,i=1,a=1,n=i,o=this._noise.get2.bind(this._noise);for(let s=0;s<this._octaves;s++){r+=o(new e.Vector2(t.x*this._scale*a,t.y*this._scale*a))*i,a*=this._lacunarity,i*=this._persistance,n+=i}return Math.pow(r,this._redistribution)/n}get3(t){let r=0,i=1,a=1,n=i,o=this._noise.get3.bind(this._noise);for(let s=0;s<this._octaves;s++){r+=o(new e.Vector3(t.x*this._scale*a,t.y*this._scale*a,t.z*this._scale*a))*i,a*=this._lacunarity,i*=this._persistance,n+=i}return Math.pow(r,this._redistribution)/n}},X=0,q=[],Z=new e.Vector3,K=new e.Vector3,$={x:0,y:0,z:0},Y={x:0,y:0,z:0},J={delta:0,generalData:null,normalizedConfig:null,attributes:null,particleLifetimePercentage:0,particleIndex:0},ee={"THREE.NoBlending":e.NoBlending,"THREE.NormalBlending":e.NormalBlending,"THREE.AdditiveBlending":e.AdditiveBlending,"THREE.SubtractiveBlending":e.SubtractiveBlending,"THREE.MultiplyBlending":e.MultiplyBlending},te=()=>JSON.parse(JSON.stringify(re)),re={transform:{position:new e.Vector3,rotation:new e.Vector3,scale:new e.Vector3(1,1,1)},duration:5,looping:!0,startDelay:0,startLifetime:5,startSpeed:1,startSize:1,startOpacity:1,startRotation:0,startColor:{min:{r:1,g:1,b:1},max:{r:1,g:1,b:1}},gravity:0,simulationSpace:"LOCAL",maxParticles:100,emission:{rateOverTime:10,rateOverDistance:0,bursts:[]},shape:{shape:"SPHERE",sphere:{radius:1,radiusThickness:1,arc:360},cone:{angle:25,radius:1,radiusThickness:1,arc:360},circle:{radius:1,radiusThickness:1,arc:360},rectangle:{rotation:{x:0,y:0},scale:{x:1,y:1}},box:{scale:{x:1,y:1,z:1},emitFrom:"VOLUME"}},map:void 0,renderer:{blending:e.NormalBlending,discardBackgroundColor:!1,backgroundColorTolerance:1,backgroundColor:{r:1,g:1,b:1},transparent:!0,depthTest:!0,depthWrite:!1},velocityOverLifetime:{isActive:!1,linear:{x:0,y:0,z:0},orbital:{x:0,y:0,z:0}},sizeOverLifetime:{isActive:!1,lifetimeCurve:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:0,percentage:0},{x:1,y:1,percentage:1}]}},colorOverLifetime:{isActive:!1,r:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:1,percentage:0},{x:1,y:1,percentage:1}]},g:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:1,percentage:0},{x:1,y:1,percentage:1}]},b:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:1,percentage:0},{x:1,y:1,percentage:1}]}},opacityOverLifetime:{isActive:!1,lifetimeCurve:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:0,percentage:0},{x:1,y:1,percentage:1}]}},rotationOverLifetime:{isActive:!1,min:0,max:0},noise:{isActive:!1,useRandomOffset:!1,strength:1,frequency:.5,octaves:1,positionAmount:1,rotationAmount:0,sizeAmount:0},textureSheetAnimation:{tiles:new e.Vector2(1,1),timeMode:"LIFETIME",fps:30,startFrame:0}},ie=({geometry:t,propertyName:r,maxParticles:i,factory:a})=>{const n=new Float32Array(i);if("function"==typeof a)for(let e=0;e<i;e++)n[e]=a(void 0,e);else n.fill(a);t.setAttribute(r,new e.BufferAttribute(n,1))},ae=(e,{shape:t,sphere:r,cone:i,circle:a,rectangle:n,box:o},s,l,c)=>{const d=w(e.particleSystemId,s,e.normalizedLifetimePercentage);switch(t){case"SPHERE":T(l,e.wrapperQuaternion,c,d,r);break;case"CONE":U(l,e.wrapperQuaternion,c,d,i);break;case"CIRCLE":L(l,e.wrapperQuaternion,c,d,a);break;case"RECTANGLE":P(l,e.wrapperQuaternion,c,d,n);break;case"BOX":E(l,e.wrapperQuaternion,c,d,o)}},ne=(r=re,i)=>{const a=i||Date.now(),n={particleSystemId:X++,normalizedLifetimePercentage:0,distanceFromLastEmitByDistance:0,lastWorldPosition:new e.Vector3(-99999),currentWorldPosition:new e.Vector3(-99999),worldPositionChange:new e.Vector3,worldQuaternion:new e.Quaternion,wrapperQuaternion:new e.Quaternion,lastWorldQuaternion:new e.Quaternion(-99999),worldEuler:new e.Euler,gravityVelocity:new e.Vector3(0,0,0),startValues:{},linearVelocityData:void 0,orbitalVelocityData:void 0,lifetimeValues:{},creationTimes:[],noise:{isActive:!1,strength:0,noisePower:0,positionAmount:0,rotationAmount:0,sizeAmount:0},isEnabled:!0},o=V.deepMerge(re,r,{applyToFirstObject:!1,skippedProperties:[]});let s=o.map||S();const{transform:l,duration:c,looping:d,startDelay:u,startLifetime:m,startSpeed:p,startSize:y,startRotation:I,startColor:g,startOpacity:h,gravity:v,simulationSpace:x,maxParticles:O,emission:b,shape:_,renderer:C,noise:A,velocityOverLifetime:T,onUpdate:U,onComplete:E,textureSheetAnimation:L,subEmitters:P}=o;"string"==typeof C?.blending&&(C.blending=ee[C.blending]);const M=Array.from({length:O},()=>new e.Vector3),R=Array.from({length:O},()=>new e.Vector3);n.creationTimes=Array.from({length:O},()=>0);const D=Array.from({length:O},(e,t)=>O-1-t);T.isActive&&(n.linearVelocityData=Array.from({length:O},()=>({speed:new e.Vector3(T.linear.x?w(n.particleSystemId,T.linear.x,0):0,T.linear.y?w(n.particleSystemId,T.linear.y,0):0,T.linear.z?w(n.particleSystemId,T.linear.z,0):0),valueModifiers:{x:N(T.linear.x||0)?z(n.particleSystemId,T.linear.x):void 0,y:N(T.linear.y||0)?z(n.particleSystemId,T.linear.y):void 0,z:N(T.linear.z||0)?z(n.particleSystemId,T.linear.z):void 0}})),n.orbitalVelocityData=Array.from({length:O},()=>({speed:new e.Vector3(T.orbital.x?w(n.particleSystemId,T.orbital.x,0):0,T.orbital.y?w(n.particleSystemId,T.orbital.y,0):0,T.orbital.z?w(n.particleSystemId,T.orbital.z,0):0),valueModifiers:{x:N(T.orbital.x||0)?z(n.particleSystemId,T.orbital.x):void 0,y:N(T.orbital.y||0)?z(n.particleSystemId,T.orbital.y):void 0,z:N(T.orbital.z||0)?z(n.particleSystemId,T.orbital.z):void 0},positionOffset:new e.Vector3})));["startSize","startOpacity"].forEach(e=>{n.startValues[e]=Array.from({length:O},()=>w(n.particleSystemId,o[e],0))}),n.startValues.startColorR=Array.from({length:O},()=>0),n.startValues.startColorG=Array.from({length:O},()=>0),n.startValues.startColorB=Array.from({length:O},()=>0);["rotationOverLifetime"].forEach(t=>{const r=o[t];r.isActive&&(n.lifetimeValues[t]=Array.from({length:O},()=>e.MathUtils.randFloat(r.min,r.max)))}),n.noise={isActive:A.isActive,strength:A.strength,noisePower:.15*A.strength,positionAmount:A.positionAmount,rotationAmount:A.rotationAmount,sizeAmount:A.sizeAmount,sampler:A.isActive?new W({seed:Math.random(),scale:A.frequency,octaves:A.octaves}):void 0,offsets:A.useRandomOffset?Array.from({length:O},()=>100*Math.random()):void 0},b.bursts&&b.bursts.length>0&&(n.burstStates=b.bursts.map(()=>({cyclesExecuted:0,lastCycleTime:0,probabilityPassed:!1})));const Q=new e.ShaderMaterial({uniforms:{elapsed:{value:0},map:{value:s},tiles:{value:L.tiles},fps:{value:L.fps},useFPSForFrameIndex:{value:"FPS"===L.timeMode},backgroundColor:{value:C.backgroundColor},discardBackgroundColor:{value:C.discardBackgroundColor},backgroundColorTolerance:{value:C.backgroundColorTolerance}},vertexShader:"\n attribute float size;\n attribute float colorR;\n attribute float colorG;\n attribute float colorB;\n attribute float colorA;\n attribute float lifetime;\n attribute float startLifetime;\n attribute float rotation;\n attribute float startFrame;\n\n varying mat4 vPosition;\n varying vec4 vColor;\n varying float vLifetime;\n varying float vStartLifetime;\n varying float vRotation;\n varying float vStartFrame;\n\n #include <common>\n #include <logdepthbuf_pars_vertex>\n\n void main()\n {\n vColor = vec4(colorR, colorG, colorB, colorA);\n vLifetime = lifetime;\n vStartLifetime = startLifetime;\n vRotation = rotation;\n vStartFrame = startFrame;\n\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_PointSize = size * (100.0 / length(mvPosition.xyz));\n gl_Position = projectionMatrix * mvPosition;\n\n #include <logdepthbuf_vertex>\n }\n",fragmentShader:"\n uniform sampler2D map;\n uniform float elapsed;\n uniform float fps;\n uniform bool useFPSForFrameIndex;\n uniform vec2 tiles;\n uniform bool discardBackgroundColor;\n uniform vec3 backgroundColor;\n uniform float backgroundColorTolerance;\n\n varying vec4 vColor;\n varying float vLifetime;\n varying float vStartLifetime;\n varying float vRotation;\n varying float vStartFrame;\n\n #include <common>\n #include <logdepthbuf_pars_fragment>\n\n void main()\n {\n gl_FragColor = vColor;\n float mid = 0.5;\n\n float frameIndex = round(vStartFrame) + (\n useFPSForFrameIndex == true\n ? fps == 0.0\n ? 0.0\n : max((vLifetime / 1000.0) * fps, 0.0)\n : max(min(floor(min(vLifetime / vStartLifetime, 1.0) * (tiles.x * tiles.y)), tiles.x * tiles.y - 1.0), 0.0)\n );\n \n float spriteXIndex = floor(mod(frameIndex, tiles.x));\n float spriteYIndex = floor(mod(frameIndex / tiles.x, tiles.y));\n\n vec2 frameUV = vec2(\n gl_PointCoord.x / tiles.x + spriteXIndex / tiles.x,\n gl_PointCoord.y / tiles.y + spriteYIndex / tiles.y);\n\n vec2 center = vec2(0.5, 0.5);\n vec2 centeredPoint = gl_PointCoord - center;\n\n mat2 rotation = mat2(\n cos(vRotation), sin(vRotation),\n -sin(vRotation), cos(vRotation)\n );\n\n centeredPoint = rotation * centeredPoint;\n vec2 centeredMiddlePoint = vec2(\n centeredPoint.x + center.x,\n centeredPoint.y + center.y\n );\n\n float dist = distance(centeredMiddlePoint, center);\n if (dist > 0.5) discard;\n\n vec2 uvPoint = vec2(\n centeredMiddlePoint.x / tiles.x + spriteXIndex / tiles.x,\n centeredMiddlePoint.y / tiles.y + spriteYIndex / tiles.y\n );\n\n vec4 rotatedTexture = texture2D(map, uvPoint);\n\n gl_FragColor = gl_FragColor * rotatedTexture;\n\n if (discardBackgroundColor && abs(length(rotatedTexture.rgb - backgroundColor.rgb)) < backgroundColorTolerance) discard;\n \n #include <logdepthbuf_fragment>\n }\n",transparent:C.transparent,blending:C.blending,depthTest:C.depthTest,depthWrite:C.depthWrite}),F=new e.BufferGeometry;for(let e=0;e<O;e++)ae(n,_,p,M[e],R[e]);const k=new Float32Array(3*O);for(let e=0;e<O;e++)k[3*e]=M[e].x,k[3*e+1]=M[e].y,k[3*e+2]=M[e].z;F.setAttribute("position",new e.BufferAttribute(k,3)),ie({geometry:F,propertyName:"isActive",maxParticles:O,factory:0}),ie({geometry:F,propertyName:"lifetime",maxParticles:O,factory:0}),ie({geometry:F,propertyName:"startLifetime",maxParticles:O,factory:()=>1e3*w(n.particleSystemId,m,0)}),ie({geometry:F,propertyName:"startFrame",maxParticles:O,factory:()=>L.startFrame?w(n.particleSystemId,L.startFrame,0):0}),ie({geometry:F,propertyName:"opacity",maxParticles:O,factory:()=>w(n.particleSystemId,h,0)}),ie({geometry:F,propertyName:"rotation",maxParticles:O,factory:()=>w(n.particleSystemId,I,0)}),ie({geometry:F,propertyName:"size",maxParticles:O,factory:(e,t)=>n.startValues.startSize[t]}),ie({geometry:F,propertyName:"rotation",maxParticles:O,factory:0});const j=Math.random();ie({geometry:F,propertyName:"colorR",maxParticles:O,factory:()=>g.min.r+j*(g.max.r-g.min.r)}),ie({geometry:F,propertyName:"colorG",maxParticles:O,factory:()=>g.min.g+j*(g.max.g-g.min.g)}),ie({geometry:F,propertyName:"colorB",maxParticles:O,factory:()=>g.min.b+j*(g.max.b-g.min.b)}),ie({geometry:F,propertyName:"colorA",maxParticles:O,factory:0});const G=P??[],H=G.filter(e=>"DEATH"===(e.trigger??"DEATH")),K=G.filter(e=>"BIRTH"===e.trigger),$=new Map;for(const e of G)$.set(e,[]);const Y=e=>{for(let t=e.length-1;t>=0;t--){const r=e[t],i=r.instance,a=i.geometry?.attributes?.isActive?.array;if(!a){r.dispose(),e.splice(t,1);continue}let n=!1;for(let e=0;e<a.length;e++)if(a[e]){n=!0;break}n||(r.dispose(),e.splice(t,1))}},J=(t,r,i,a)=>{for(const n of t){const t=$.get(n),o=n.maxInstances??32;if(t.length>=o&&(Y(t),t.length>=o))continue;const s=n.inheritVelocity??0,l=ne({...n.config,looping:!1,transform:{...n.config.transform,position:new e.Vector3(r.x,r.y,r.z)},...s>0?{startSpeed:("number"==typeof n.config.startSpeed?n.config.startSpeed:"object"==typeof n.config.startSpeed&&null!==n.config.startSpeed&&"min"in n.config.startSpeed?n.config.startSpeed.min??0:0)+i.length()*s}:{}},a),c=(le||te).parent;c&&c.add(l.instance),t.push(l)}};let te=new e.Points(F,Q);te.position.copy(l.position),te.rotation.x=e.MathUtils.degToRad(l.rotation.x),te.rotation.y=e.MathUtils.degToRad(l.rotation.y),te.rotation.z=e.MathUtils.degToRad(l.rotation.z),te.scale.copy(l.scale);const se=a+1e3*w(n.particleSystemId,u);let le;"WORLD"===o.simulationSpace&&(le=new t,le.add(te));const ce=H.length>0?(e,t,r,i)=>{const a=3*e;Z.set(t[a],t[a+1],t[a+2]),J(H,Z,r,i)}:void 0,de=K.length>0?(e,t,r,i)=>{const a=3*e;Z.set(t[a],t[a+1],t[a+2]),J(K,Z,r,i)}:void 0,ue={particleSystem:te,wrapper:le,elapsedUniform:Q.uniforms.elapsed,generalData:n,onUpdate:U,onComplete:E,creationTime:se,lastEmissionTime:se,duration:c,looping:d,simulationSpace:x,gravity:v,emission:b,normalizedConfig:o,iterationCount:0,velocities:R,freeList:D,deactivateParticle:e=>{F.attributes.isActive.array[e]=0,F.attributes.colorA.array[e]=0,F.attributes.colorA.needsUpdate=!0,D.push(e)},activateParticle:({particleIndex:t,activationTime:r,position:i})=>{F.attributes.isActive.array[t]=1,n.creationTimes[t]=r,n.noise.offsets&&(n.noise.offsets[t]=100*Math.random());const a=Math.random();F.attributes.colorR.array[t]=g.min.r+a*(g.max.r-g.min.r),F.attributes.colorR.needsUpdate=!0,F.attributes.colorG.array[t]=g.min.g+a*(g.max.g-g.min.g),F.attributes.colorG.needsUpdate=!0,F.attributes.colorB.array[t]=g.min.b+a*(g.max.b-g.min.b),F.attributes.colorB.needsUpdate=!0,n.startValues.startColorR[t]=F.attributes.colorR.array[t],n.startValues.startColorG[t]=F.attributes.colorG.array[t],n.startValues.startColorB[t]=F.attributes.colorB.array[t],F.attributes.startFrame.array[t]=L.startFrame?w(n.particleSystemId,L.startFrame,0):0,F.attributes.startFrame.needsUpdate=!0,F.attributes.startLifetime.array[t]=1e3*w(n.particleSystemId,m,n.normalizedLifetimePercentage),F.attributes.startLifetime.needsUpdate=!0,n.startValues.startSize[t]=w(n.particleSystemId,y,n.normalizedLifetimePercentage),F.attributes.size.array[t]=n.startValues.startSize[t],F.attributes.size.needsUpdate=!0,n.startValues.startOpacity[t]=w(n.particleSystemId,h,n.normalizedLifetimePercentage),F.attributes.colorA.array[t]=n.startValues.startOpacity[t],F.attributes.colorA.needsUpdate=!0,F.attributes.rotation.array[t]=w(n.particleSystemId,I,n.normalizedLifetimePercentage),F.attributes.rotation.needsUpdate=!0,o.rotationOverLifetime.isActive&&(n.lifetimeValues.rotationOverLifetime[t]=e.MathUtils.randFloat(o.rotationOverLifetime.min,o.rotationOverLifetime.max)),ae(n,_,p,M[t],R[t]);const s=Math.floor(3*t);F.attributes.position.array[s]=i.x+M[t].x,F.attributes.position.array[s+1]=i.y+M[t].y,F.attributes.position.array[s+2]=i.z+M[t].z,F.attributes.position.needsUpdate=!0,n.linearVelocityData&&n.linearVelocityData[t].speed.set(o.velocityOverLifetime.linear.x?w(n.particleSystemId,o.velocityOverLifetime.linear.x,0):0,o.velocityOverLifetime.linear.y?w(n.particleSystemId,o.velocityOverLifetime.linear.y,0):0,o.velocityOverLifetime.linear.z?w(n.particleSystemId,o.velocityOverLifetime.linear.z,0):0),n.orbitalVelocityData&&(n.orbitalVelocityData[t].speed.set(o.velocityOverLifetime.orbital.x?w(n.particleSystemId,o.velocityOverLifetime.orbital.x,0):0,o.velocityOverLifetime.orbital.y?w(n.particleSystemId,o.velocityOverLifetime.orbital.y,0):0,o.velocityOverLifetime.orbital.z?w(n.particleSystemId,o.velocityOverLifetime.orbital.z,0):0),n.orbitalVelocityData[t].positionOffset.set(M[t].x,M[t].y,M[t].z)),F.attributes.lifetime.array[t]=0,F.attributes.lifetime.needsUpdate=!0,B({delta:0,generalData:n,normalizedConfig:o,attributes:te.geometry.attributes,particleLifetimePercentage:0,particleIndex:t})},onParticleDeath:ce,onParticleBirth:de};q.push(ue);return{instance:le||te,resumeEmitter:()=>n.isEnabled=!0,pauseEmitter:()=>n.isEnabled=!1,dispose:()=>{for(const e of $.values()){for(const t of e)t.dispose();e.length=0}(e=>{q=q.filter(({particleSystem:t,wrapper:r,generalData:{particleSystemId:i}})=>t!==e&&r!==e||(f(i),t.geometry.dispose(),Array.isArray(t.material)?t.material.forEach(e=>e.dispose()):t.material.dispose(),t.parent&&t.parent.remove(t),!1))})(te)},update:e=>oe(ue,e)}},oe=(e,{now:t,delta:r,elapsed:i})=>{const{onUpdate:a,generalData:n,onComplete:o,particleSystem:s,wrapper:l,elapsedUniform:c,creationTime:d,lastEmissionTime:u,duration:m,looping:p,emission:f,normalizedConfig:y,iterationCount:I,velocities:g,freeList:h,deactivateParticle:v,activateParticle:x,simulationSpace:O,gravity:b,onParticleDeath:_,onParticleBirth:C}=e,A=t-d,T=A%(1e3*m);n.normalizedLifetimePercentage=Math.max(Math.min(T/(1e3*m),1),0);const{lastWorldPosition:U,currentWorldPosition:E,worldPositionChange:L,lastWorldQuaternion:P,worldQuaternion:S,worldEuler:N,gravityVelocity:z,isEnabled:M}=n;l?.parent&&n.wrapperQuaternion.copy(l.parent.quaternion),K.copy(U),c.value=i,s.getWorldPosition(E),-99999!==U.x&&L.set(E.x-U.x,E.y-U.y,E.z-U.z),M&&(n.distanceFromLastEmitByDistance+=L.length()),s.getWorldPosition(U),s.getWorldQuaternion(S),-99999!==P.x&&P.x===S.x&&P.y===S.y&&P.z===S.z||(N.setFromQuaternion(S),P.copy(S),z.set(U.x,U.y+b,U.z),s.worldToLocal(z));const R=n.creationTimes,V=s.geometry.attributes,D=V.isActive.array,Q=V.startLifetime.array,F=V.position.array,k=V.lifetime.array,j=R.length;let G=!1,H=!1;J.delta=r,J.generalData=n,J.normalizedConfig=y,J.attributes=V;for(let e=0;e<j;e++)if(D[e]){const i=t-R[e];if(i>Q[e])_&&_(e,F,g[e],t),v(e);else{const t=g[e];if(t.x-=z.x*r,t.y-=z.y*r,t.z-=z.z*r,0!==b||0!==t.x||0!==t.y||0!==t.z||0!==L.x||0!==L.y||0!==L.z){const i=3*e;"WORLD"===O&&(F[i]-=L.x,F[i+1]-=L.y,F[i+2]-=L.z),F[i]+=t.x*r,F[i+1]+=t.y*r,F[i+2]+=t.z*r,G=!0}k[e]=i,H=!0,J.particleLifetimePercentage=i/Q[e],J.particleIndex=e,B(J)}}if(G&&(V.position.needsUpdate=!0),H&&(V.lifetime.needsUpdate=!0),M&&(p||A<1e3*m)){const o=t-u,l=f.rateOverTime?Math.floor(w(n.particleSystemId,f.rateOverTime,n.normalizedLifetimePercentage)*(o/1e3)):0,c=f.rateOverDistance?w(n.particleSystemId,f.rateOverDistance,n.normalizedLifetimePercentage):0,d=c>0&&n.distanceFromLastEmitByDistance>0?Math.floor(n.distanceFromLastEmitByDistance/(1/c)):0,m=d>0;m&&($.x=(E.x-K.x)/d,$.y=(E.y-K.y)/d,$.z=(E.z-K.z)/d);let y=l+d;if(c>0&&d>=1&&(n.distanceFromLastEmitByDistance=0),f.bursts&&n.burstStates){const e=f.bursts,t=n.burstStates,r=T;for(let i=0;i<e.length;i++){const a=e[i],o=t[i],s=1e3*a.time,l=a.cycles??1,c=1e3*(a.interval??0),d=a.probability??1;if(p&&r<s&&o.cyclesExecuted>0&&(o.cyclesExecuted=0,o.lastCycleTime=0,o.probabilityPassed=!1),o.cyclesExecuted>=l)continue;if(r>=s+o.cyclesExecuted*c){if(0===o.cyclesExecuted&&(o.probabilityPassed=Math.random()<d),o.probabilityPassed){y+=Math.floor(w(n.particleSystemId,a.count,n.normalizedLifetimePercentage))}o.cyclesExecuted++,o.lastCycleTime=r}}}if(y>0){let r=0;for(let i=0;i<y&&0!==h.length;i++){const i=h.pop();Y.x=0,Y.y=0,Y.z=0,m&&r<d&&(Y.x=$.x*r,Y.y=$.y*r,Y.z=$.z*r,r++),x({particleIndex:i,activationTime:t,position:Y}),C&&C(i,V.position.array,g[i],t),e.lastEmissionTime=t}}a&&a({particleSystem:s,delta:r,elapsed:i,lifetime:A,normalizedLifetime:T,iterationCount:I+1})}else o&&o({particleSystem:s})},se=e=>{q.forEach(t=>oe(t,e))};export{g as CurveFunctionId,b as EmitFrom,C as LifeTimeCurve,O as Shape,x as SimulationSpace,A as SubEmitterTrigger,_ as TimeMode,B as applyModifiers,ee as blendingMap,E as calculateRandomPositionAndVelocityOnBox,L as calculateRandomPositionAndVelocityOnCircle,U as calculateRandomPositionAndVelocityOnCone,P as calculateRandomPositionAndVelocityOnRectangle,T as calculateRandomPositionAndVelocityOnSphere,w as calculateValue,p as createBezierCurveFunction,S as createDefaultParticleTexture,ne as createParticleSystem,y as getBezierCacheSize,v as getCurveFunction,z as getCurveFunctionFromConfig,te as getDefaultParticleSystemConfig,N as isLifeTimeCurve,f as removeBezierCurveFunction,se as updateParticleSystems};//# sourceMappingURL=three-particles.min.js.map
1
+ import*as e from"three";import{Gyroscope as t}from"three/examples/jsm/misc/Gyroscope.js";var r,i,a=Object.create,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,d=(r={"node_modules/easing-functions/index.js"(e,t){var r=e=>e,i={In:e=>e*e,Out:e=>e*(2-e),InOut(e){let t=2*e;return t<1?.5*t*t:(t-=1,-.5*(t*(t-2)-1))}},a={In:e=>e*e*e,Out:e=>--e*e*e+1,InOut(e){let t=2*e;return t<1?.5*t*t*t:(t-=2,.5*(t*t*t+2))}},n={In:e=>e*e*e*e,Out:e=>1- --e*e*e*e,InOut(e){let t=2*e;return t<1?.5*t*t*t*t:(t-=2,-.5*(t*t*t*t-2))}},o={In:e=>e*e*e*e*e,Out:e=>--e*e*e*e*e+1,InOut(e){let t=2*e;return t<1?.5*t*t*t*t*t:(t-=2,.5*(t*t*t*t*t+2))}},s={In:e=>1-Math.cos(e*Math.PI/2),Out:e=>Math.sin(e*Math.PI/2),InOut:e=>.5*(1-Math.cos(Math.PI*e))},l={In:e=>0===e?0:1024**(e-1),Out:e=>1===e?1:1-2**(-10*e),InOut(e){if(0===e)return 0;if(1===e)return 1;const t=2*e;return t<1?.5*1024**(t-1):.5*(2-2**(-10*(t-1)))}},c={In:e=>1-Math.sqrt(1-e*e),Out:e=>Math.sqrt(1- --e*e),InOut(e){let t=2*e;return t<1?-.5*(Math.sqrt(1-t*t)-1):(t-=2,.5*(Math.sqrt(1-t*t)+1))}},d={In(e){let t,r=.1;return 0===e?0:1===e?1:(r<1?(r=1,t=.1):t=.4*Math.asin(1/r)/(2*Math.PI),-r*2**(10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/.4))},Out(e){let t,r=.1;return 0===e?0:1===e?1:(r<1?(r=1,t=.1):t=.4*Math.asin(1/r)/(2*Math.PI),r*2**(-10*e)*Math.sin((e-t)*(2*Math.PI)/.4)+1)},InOut(e){let t=.1;const r=.4;let i;if(0===e)return 0;if(1===e)return 1;t<1?(t=1,i=.1):i=r*Math.asin(1/t)/(2*Math.PI);const a=2*e;if(a<1){const e=a-1;return t*2**(10*e)*Math.sin((e-i)*(2*Math.PI)/r)*-.5}const n=a-1;return t*2**(-10*n)*Math.sin((n-i)*(2*Math.PI)/r)*.5+1}},u={In(e){const t=1.70158;return e*e*((t+1)*e-t)},Out(e){const t=1.70158;return--e*e*((t+1)*e+t)+1},InOut(e){const t=2.5949095;let r=2*e;return r<1?r*r*((t+1)*r-t)*.5:(r-=2,.5*(r*r*((t+1)*r+t)+2))}},m={In:e=>1-m.Out(1-e),Out(e){if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const t=e-1.5/2.75;return 7.5625*t*t+.75}if(e<2.5/2.75){const t=e-2.25/2.75;return 7.5625*t*t+.9375}const t=e-2.625/2.75;return 7.5625*t*t+.984375},InOut:e=>e<.5?.5*m.In(2*e):.5*m.Out(2*e-1)+.5},p={Quadratic:i,Cubic:a,Quartic:n,Quintic:o,Sinusoidal:s,Exponential:l,Circular:c,Elastic:d,Back:u,Bounce:m},f=(e,t,r)=>Object.defineProperty(e,t,{value:r});for(const e of Object.keys(p)){const t=p[e],r=e.toLowerCase();f(p,r,t);for(const i of Object.keys(t)){const a=t[i],n=i.toLowerCase();f(p,`${e}.${i}`,a),f(p,`${r}.${n}`,a),f(t,n,a)}}p.Linear=r,f(p,"linear",r),t.exports=p,"undefined"!=typeof window&&(window.Easing=p)}},function(){return i||(0,r[s(r)[0]])((i={exports:{}}).exports,i),i.exports}),u=[],m=(e,t)=>{let r=1;for(let i=1;i<=t;i++)r*=(e+1-i)/i;return r},p=(e,t)=>{const r=u.find(e=>e.bezierPoints===t);if(r)return r.referencedBy.includes(e)||r.referencedBy.push(e),r.curveFunction;const i={referencedBy:[e],bezierPoints:t,curveFunction:e=>{if(e<0)return t[0].y;if(e>1)return t[t.length-1].y;let r=0,i=t.length-1;t.find((t,a)=>{const n=e<(t.percentage??0);return n?i=a:void 0!==t.percentage&&(r=a),n});const a=i-r,n=(e-(t[r].percentage??0))/((t[i].percentage??1)-(t[r].percentage??0));let o=0;for(let e=0;e<=a;e++){const i=t[r+e];o+=m(a,e)*Math.pow(1-n,a-e)*Math.pow(n,e)*i.y}return o}};return u.push(i),i.curveFunction},f=e=>{for(;;){const t=u.findIndex(t=>t.referencedBy.includes(e));if(-1===t)break;const r=u[t];r.referencedBy=r.referencedBy.filter(t=>t!==e),0===r.referencedBy.length&&u.splice(t,1)}},y=()=>u.length,I=((e,t,r)=>(r=null!=e?a(l(e)):{},((e,t,r,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of s(t))c.call(e,a)||a===r||n(e,a,{get:()=>t[a],enumerable:!(i=o(t,a))||i.enumerable});return e})(n(r,"default",{value:e,enumerable:!0}),e)))(d()),g=(e=>(e.BEZIER="BEZIER",e.LINEAR="LINEAR",e.QUADRATIC_IN="QUADRATIC_IN",e.QUADRATIC_OUT="QUADRATIC_OUT",e.QUADRATIC_IN_OUT="QUADRATIC_IN_OUT",e.CUBIC_IN="CUBIC_IN",e.CUBIC_OUT="CUBIC_OUT",e.CUBIC_IN_OUT="CUBIC_IN_OUT",e.QUARTIC_IN="QUARTIC_IN",e.QUARTIC_OUT="QUARTIC_OUT",e.QUARTIC_IN_OUT="QUARTIC_IN_OUT",e.QUINTIC_IN="QUINTIC_IN",e.QUINTIC_OUT="QUINTIC_OUT",e.QUINTIC_IN_OUT="QUINTIC_IN_OUT",e.SINUSOIDAL_IN="SINUSOIDAL_IN",e.SINUSOIDAL_OUT="SINUSOIDAL_OUT",e.SINUSOIDAL_IN_OUT="SINUSOIDAL_IN_OUT",e.EXPONENTIAL_IN="EXPONENTIAL_IN",e.EXPONENTIAL_OUT="EXPONENTIAL_OUT",e.EXPONENTIAL_IN_OUT="EXPONENTIAL_IN_OUT",e.CIRCULAR_IN="CIRCULAR_IN",e.CIRCULAR_OUT="CIRCULAR_OUT",e.CIRCULAR_IN_OUT="CIRCULAR_IN_OUT",e.ELASTIC_IN="ELASTIC_IN",e.ELASTIC_OUT="ELASTIC_OUT",e.ELASTIC_IN_OUT="ELASTIC_IN_OUT",e.BACK_IN="BACK_IN",e.BACK_OUT="BACK_OUT",e.BACK_IN_OUT="BACK_IN_OUT",e.BOUNCE_IN="BOUNCE_IN",e.BOUNCE_OUT="BOUNCE_OUT",e.BOUNCE_IN_OUT="BOUNCE_IN_OUT",e))(g||{}),h={LINEAR:I.default.Linear.None,QUADRATIC_IN:I.default.Quadratic.In,QUADRATIC_OUT:I.default.Quadratic.Out,QUADRATIC_IN_OUT:I.default.Quadratic.InOut,CUBIC_IN:I.default.Cubic.In,CUBIC_OUT:I.default.Cubic.Out,CUBIC_IN_OUT:I.default.Cubic.InOut,QUARTIC_IN:I.default.Quartic.In,QUARTIC_OUT:I.default.Quartic.Out,QUARTIC_IN_OUT:I.default.Quartic.InOut,QUINTIC_IN:I.default.Quintic.In,QUINTIC_OUT:I.default.Quintic.Out,QUINTIC_IN_OUT:I.default.Quintic.InOut,SINUSOIDAL_IN:I.default.Sinusoidal.In,SINUSOIDAL_OUT:I.default.Sinusoidal.Out,SINUSOIDAL_IN_OUT:I.default.Sinusoidal.InOut,EXPONENTIAL_IN:I.default.Exponential.In,EXPONENTIAL_OUT:I.default.Exponential.Out,EXPONENTIAL_IN_OUT:I.default.Exponential.InOut,CIRCULAR_IN:I.default.Circular.In,CIRCULAR_OUT:I.default.Circular.Out,CIRCULAR_IN_OUT:I.default.Circular.InOut,ELASTIC_IN:I.default.Elastic.In,ELASTIC_OUT:I.default.Elastic.Out,ELASTIC_IN_OUT:I.default.Elastic.InOut,BACK_IN:I.default.Back.In,BACK_OUT:I.default.Back.Out,BACK_IN_OUT:I.default.Back.InOut,BOUNCE_IN:I.default.Bounce.In,BOUNCE_OUT:I.default.Bounce.Out,BOUNCE_IN_OUT:I.default.Bounce.InOut},v=e=>"function"==typeof e?e:h[e],x=(e=>(e.LOCAL="LOCAL",e.WORLD="WORLD",e))(x||{}),O=(e=>(e.SPHERE="SPHERE",e.CONE="CONE",e.BOX="BOX",e.CIRCLE="CIRCLE",e.RECTANGLE="RECTANGLE",e))(O||{}),b=(e=>(e.VOLUME="VOLUME",e.SHELL="SHELL",e.EDGE="EDGE",e))(b||{}),_=(e=>(e.LIFETIME="LIFETIME",e.FPS="FPS",e))(_||{}),C=(e=>(e.BEZIER="BEZIER",e.EASING="EASING",e))(C||{}),A=(e=>(e.BIRTH="BIRTH",e.DEATH="DEATH",e))(A||{}),T=(e,t,r,i,{radius:a,radiusThickness:n,arc:o})=>{const s=Math.random()*(o/360),l=Math.random(),c=Math.random(),d=2*Math.PI*s,u=Math.acos(2*l-1),m=Math.sin(u),p=m*Math.cos(d),f=m*Math.sin(d),y=Math.cos(u),I=1-n;e.x=a*I*p+a*n*c*p,e.y=a*I*f+a*n*c*f,e.z=a*I*y+a*n*c*y,e.applyQuaternion(t);const g=1/e.length();r.set(e.x*g*i,e.y*g*i,e.z*g*i),r.applyQuaternion(t)},U=(t,r,i,a,{radius:n,radiusThickness:o,arc:s,angle:l=90})=>{const c=2*Math.PI*Math.random()*(s/360),d=Math.random(),u=Math.cos(c),m=Math.sin(c),p=1-o;t.x=n*p*u+n*o*d*u,t.y=n*p*m+n*o*d*m,t.z=0,t.applyQuaternion(r);const f=t.length(),y=Math.abs(f/n*e.MathUtils.degToRad(l)),I=Math.sin(y),g=1/f;i.set(t.x*I*g*a,t.y*I*g*a,Math.cos(y)*a),i.applyQuaternion(r)},E=(e,t,r,i,{scale:a,emitFrom:n})=>{const o=a;switch(n){case"VOLUME":e.x=Math.random()*o.x-o.x/2,e.y=Math.random()*o.y-o.y/2,e.z=Math.random()*o.z-o.z/2;break;case"SHELL":const t=Math.floor(6*Math.random()),r=t%3,i=[];i[r]=t>2?1:0,i[(r+1)%3]=Math.random(),i[(r+2)%3]=Math.random(),e.x=i[0]*o.x-o.x/2,e.y=i[1]*o.y-o.y/2,e.z=i[2]*o.z-o.z/2;break;case"EDGE":const a=Math.floor(6*Math.random()),n=a%3,s=Math.floor(4*Math.random()),l=[];l[n]=a>2?1:0,l[(n+1)%3]=s<2?Math.random():s-2,l[(n+2)%3]=s<2?s:Math.random(),e.x=l[0]*o.x-o.x/2,e.y=l[1]*o.y-o.y/2,e.z=l[2]*o.z-o.z/2}e.applyQuaternion(t),r.set(0,0,i),r.applyQuaternion(t)},L=(e,t,r,i,{radius:a,radiusThickness:n,arc:o})=>{const s=2*Math.PI*Math.random()*(o/360),l=Math.random(),c=Math.cos(s),d=Math.sin(s),u=1-n;e.x=a*u*c+a*n*l*c,e.y=a*u*d+a*n*l*d,e.z=0,e.applyQuaternion(t);const m=1/e.length();r.set(e.x*m*i,e.y*m*i,0),r.applyQuaternion(t)},P=(t,r,i,a,{rotation:n,scale:o})=>{const s=o,l=n,c=Math.random()*s.x-s.x/2,d=Math.random()*s.y-s.y/2,u=e.MathUtils.degToRad(l.x),m=e.MathUtils.degToRad(l.y);t.x=c*Math.cos(m),t.y=d*Math.cos(u),t.z=c*Math.sin(m)-d*Math.sin(u),t.applyQuaternion(r),i.set(0,0,a),i.applyQuaternion(r)},S=()=>{try{const t=document.createElement("canvas"),r=64;t.width=r,t.height=r;const i=t.getContext("2d");if(i){const a=r/2,n=r/2,o=r/2-2;i.beginPath(),i.arc(a,n,o,0,2*Math.PI,!1),i.fillStyle="white",i.fill();const s=new e.CanvasTexture(t);return s.needsUpdate=!0,s}return null}catch(e){return null}},N=e=>"number"!=typeof e&&"type"in e,z=(e,t)=>{if("BEZIER"===t.type)return p(e,t.bezierPoints);if("EASING"===t.type)return t.curveFunction;throw new Error(`Unsupported value type: ${t}`)},w=(t,r,i=0)=>{if("number"==typeof r)return r;if("min"in r&&"max"in r)return r.min===r.max?r.min??0:e.MathUtils.randFloat(r.min??0,r.max??1);const a=r;return z(t,a)(i)*(a.scale??1)},M=new e.Vector3(0,0,0),R=new e.Euler,B=({delta:e,generalData:t,normalizedConfig:r,attributes:i,particleLifetimePercentage:a,particleIndex:n})=>{const{particleSystemId:o,startValues:s,lifetimeValues:l,linearVelocityData:c,orbitalVelocityData:d,noise:u}=t,m=3*n,p=i.position.array;if(c){const{speed:t,valueModifiers:r}=c[n],o=r.x?r.x(a):t.x,s=r.y?r.y(a):t.y,l=r.z?r.z(a):t.z;p[m]+=o*e,p[m+1]+=s*e,p[m+2]+=l*e,i.position.needsUpdate=!0}if(d){const{speed:t,positionOffset:r,valueModifiers:o}=d[n];p[m]-=r.x,p[m+1]-=r.y,p[m+2]-=r.z;const s=o.x?o.x(a):t.x,l=o.y?o.y(a):t.y,c=o.z?o.z(a):t.z;R.set(s*e,c*e,l*e),r.applyEuler(R),p[m]+=r.x,p[m+1]+=r.y,p[m+2]+=r.z,i.position.needsUpdate=!0}if(r.sizeOverLifetime.isActive){const e=w(o,r.sizeOverLifetime.lifetimeCurve,a);i.size.array[n]=s.startSize[n]*e,i.size.needsUpdate=!0}if(r.opacityOverLifetime.isActive){const e=w(o,r.opacityOverLifetime.lifetimeCurve,a);i.colorA.array[n]=s.startOpacity[n]*e,i.colorA.needsUpdate=!0}if(r.colorOverLifetime.isActive){const e=w(o,r.colorOverLifetime.r,a),t=w(o,r.colorOverLifetime.g,a),l=w(o,r.colorOverLifetime.b,a);i.colorR.array[n]=s.startColorR[n]*e,i.colorG.array[n]=s.startColorG[n]*t,i.colorB.array[n]=s.startColorB[n]*l,i.colorR.needsUpdate=!0,i.colorG.needsUpdate=!0,i.colorB.needsUpdate=!0}if(l.rotationOverLifetime&&(i.rotation.array[n]+=l.rotationOverLifetime[n]*e*.02,i.rotation.needsUpdate=!0),u.isActive){const{sampler:e,strength:t,noisePower:r,offsets:o,positionAmount:s,rotationAmount:l,sizeAmount:c}=u;let d;const f=10*(a+(o?o[n]:0))*t;M.set(f,0,0),d=e.get3(M),p[m]+=d*r*s,0!==l&&(i.rotation.array[n]+=d*r*l,i.rotation.needsUpdate=!0),0!==c&&(i.size.array[n]+=d*r*c,i.size.needsUpdate=!0),M.set(f,f,0),d=e.get3(M),p[m+1]+=d*r*s,M.set(f,f,f),d=e.get3(M),p[m+2]+=d*r*s,i.position.needsUpdate=!0}},V={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(V,{deepMerge:()=>Q,getObjectDiff:()=>F,patchObject:()=>D});var D=(e,t,r={skippedProperties:[],applyToFirstObject:!1})=>{const i={};return Object.keys(e).forEach(a=>{r.skippedProperties&&r.skippedProperties.includes(a)||("object"==typeof e[a]&&e[a]&&t[a]&&!Array.isArray(e[a])?i[a]=D(e[a],t[a],r):(i[a]=0===t[a]?0:!1!==t[a]&&(t[a]||e[a]),r.applyToFirstObject&&(e[a]=i[a])))}),i},Q=(e,t,r={skippedProperties:[],applyToFirstObject:!1})=>{const i={};return Array.from(new Set([...Object.keys(e||{}),...Object.keys(t||{})])).forEach(a=>{r.skippedProperties&&r.skippedProperties.includes(a)||("object"==typeof e?.[a]&&e?.[a]&&t?.[a]&&!Array.isArray(e[a])?i[a]=Q(e[a],t[a],r):(i[a]=0===t?.[a]?0:!1!==t?.[a]&&(t?.[a]||e?.[a]),r.applyToFirstObject&&(e[a]=i[a])))}),i},F=(e,t,r={skippedProperties:[]})=>{const i={};return Object.keys(e).forEach(a=>{if(!r.skippedProperties||!r.skippedProperties.includes(a))if("object"==typeof e[a]&&e[a]&&t[a]&&!Array.isArray(e[a])){const n=F(e[a],t[a],r);Object.keys(n).length>0&&(i[a]=n)}else{const r=0===t[a]?0:t[a]||e[a];r!==e[a]&&(i[a]=r)}}),i},k=function(){};k.prototype.load=k,k.prototype.parse=k;var j=k;Array.from({length:3},()=>({loader:new j,isUsed:!1})),Array.from({length:3},()=>({loader:new e.TextureLoader,isUsed:!1})),Array.from({length:3},()=>({loader:new e.AudioLoader,isUsed:!1}));var G=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],H=class{constructor(t){const r=[new e.Vector3(1,1,0),new e.Vector3(-1,1,0),new e.Vector3(1,-1,0),new e.Vector3(-1,-1,0),new e.Vector3(1,0,1),new e.Vector3(-1,0,1),new e.Vector3(1,0,-1),new e.Vector3(-1,0,-1),new e.Vector3(0,1,1),new e.Vector3(0,-1,1),new e.Vector3(0,1,-1),new e.Vector3(0,-1,-1)];var i=new Array(512),a=new Array(512);t||(t=1),t*=65536,(t=Math.floor(t))<256&&(t|=t<<8);for(var n=0;n<256;n++){var o;o=1&n?G[n]^255&t:G[n]^t>>8&255,i[n]=i[n+256]=o,a[n]=a[n+256]=r[o%12]}this._seed=t,this._offsetMatrix=[new e.Vector3(0,0,0),new e.Vector3(0,0,1),new e.Vector3(0,1,0),new e.Vector3(0,1,1),new e.Vector3(1,0,0),new e.Vector3(1,0,1),new e.Vector3(1,1,0),new e.Vector3(1,1,1)],this.shaderChunk={defines:"",header:'#define GLSLIFY 1\n// From https://github.com/hughsk/glsl-noise/blob/master/periodic/2d.glsl\n\n//\n// GLSL textureless classic 2D noise "cnoise",\n// with an RSL-style periodic variant "pnoise".\n// Author: Stefan Gustavson (stefan.gustavson@liu.se)\n// Version: 2011-08-22\n//\n// Many thanks to Ian McEwan of Ashima Arts for the\n// ideas for permutation and gradient selection.\n//\n// Copyright (c) 2011 Stefan Gustavson. All rights reserved.\n// Distributed under the MIT license. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\n\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 1.0) * x); }\n\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nvec2 fade(vec2 t) { return t * t * t * (t * (t * 6.0 - 15.0) + 10.0); }\n\nfloat map(float value, float min1, float max1, float min2, float max2) {\n return min2 + (value - min1) * (max2 - min2) / (max1 - min1);\n}\n\n// Classic Perlin noise, periodic variant\nfloat perlin(vec2 P) {\n\n vec2 rep = vec2(255.0, 255.0);\n\n vec4 Pi = floor(P.xyxy) + vec4(0.0, 0.0, 1.0, 1.0);\n vec4 Pf = fract(P.xyxy) - vec4(0.0, 0.0, 1.0, 1.0);\n Pi = mod(Pi, rep.xyxy); // To create noise with explicit period\n Pi = mod289(Pi); // To avoid truncation effects in permutation\n vec4 ix = Pi.xzxz;\n vec4 iy = Pi.yyww;\n vec4 fx = Pf.xzxz;\n vec4 fy = Pf.yyww;\n\n vec4 i = permute(permute(ix) + iy);\n\n vec4 gx = fract(i * (1.0 / 41.0)) * 2.0 - 1.0;\n vec4 gy = abs(gx) - 0.5;\n vec4 tx = floor(gx + 0.5);\n gx = gx - tx;\n\n vec2 g00 = vec2(gx.x, gy.x);\n vec2 g10 = vec2(gx.y, gy.y);\n vec2 g01 = vec2(gx.z, gy.z);\n vec2 g11 = vec2(gx.w, gy.w);\n\n vec4 norm = taylorInvSqrt(\n vec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));\n g00 *= norm.x;\n g01 *= norm.y;\n g10 *= norm.z;\n g11 *= norm.w;\n\n float n00 = dot(g00, vec2(fx.x, fy.x));\n float n10 = dot(g10, vec2(fx.y, fy.y));\n float n01 = dot(g01, vec2(fx.z, fy.z));\n float n11 = dot(g11, vec2(fx.w, fy.w));\n\n vec2 fade_xy = fade(Pf.xy);\n vec2 n_x = mix(vec2(n00, n01), vec2(n10, n11), fade_xy.x);\n float n_xy = mix(n_x.x, n_x.y, fade_xy.y);\n return map(2.3 * n_xy, -1.0, 1.0, 0.0, 1.0);\n}\n\nfloat fbm(vec2 pos, vec4 props) {\n float persistance = props.x;\n float lacunarity = props.y;\n float redistribution = props.z;\n int octaves = int(props.w);\n\n float result = 0.0;\n float amplitude = 1.0;\n float frequency = 1.0;\n float maximum = amplitude;\n\n for (int i = 0; i < 2; i++) {\n\n vec2 p = pos.xy * frequency;\n\n float noiseVal = perlin(p);\n result += noiseVal * amplitude;\n\n frequency *= lacunarity;\n amplitude *= persistance;\n maximum += amplitude;\n }\n\n float redistributed = pow(result, redistribution);\n return redistributed / maximum;\n}\n',main:"",uniforms:[{three_noise_seed:this._seed}]},this.perm=i,this.gradP=a}_fade(e){return e*e*e*(e*(6*e-15)+10)}_lerp(e,t,r){return(1-r)*e+r*t}_gradient(t){return t instanceof e.Vector3?t.x+this.perm[t.y+this.perm[t.z]]:t.x+this.perm[t.y]}static map(e,t,r,i,a){return(e-t)*(a-i)/(r-t)+i}get2(t){void 0!==t.z&&(t=new e.Vector2(t.x,t.y));const r=new e.Vector2(Math.floor(t.x),Math.floor(t.y));t.sub(r),r.x&=255,r.y&=255;const i=[];for(let a=0;a<4;a++){const n=this._offsetMatrix[2*a],o=new e.Vector2(n.x,n.y),s=this.gradP[this._gradient((new e.Vector2).addVectors(r,o))],l=new e.Vector2(s.x,s.y),c=(new e.Vector2).subVectors(t,o);i.push(l.dot(c))}const a=this._fade(t.x),n=this._fade(t.y);return this._lerp(this._lerp(i[0],i[2],a),this._lerp(i[1],i[3],a),n)}get3(t){if(void 0===t.z)throw"Input to Perlin::get3() must be of type THREE.Vector3";const r=new e.Vector3(Math.floor(t.x),Math.floor(t.y),Math.floor(t.z));t.sub(r),r.x&=255,r.y&=255,r.z&=255;const i=[];for(let a=0;a<8;a++){const n=this._offsetMatrix[a],o=this.gradP[this._gradient((new e.Vector3).addVectors(r,n))],s=(new e.Vector3).subVectors(t,n);i.push(o.dot(s))}const a=this._fade(t.x),n=this._fade(t.y),o=this._fade(t.z);return this._lerp(this._lerp(this._lerp(i[0],i[4],a),this._lerp(i[1],i[5],a),o),this._lerp(this._lerp(i[2],i[6],a),this._lerp(i[3],i[7],a),o),n)}},W=class{constructor(e){const{seed:t,scale:r,persistance:i,lacunarity:a,octaves:n,redistribution:o}=e;this._noise=new H(t),this._scale=r||1,this._persistance=i||.5,this._lacunarity=a||2,this._octaves=n||6,this._redistribution=o||1}get2(t){let r=0,i=1,a=1,n=i,o=this._noise.get2.bind(this._noise);for(let s=0;s<this._octaves;s++){r+=o(new e.Vector2(t.x*this._scale*a,t.y*this._scale*a))*i,a*=this._lacunarity,i*=this._persistance,n+=i}return Math.pow(r,this._redistribution)/n}get3(t){let r=0,i=1,a=1,n=i,o=this._noise.get3.bind(this._noise);for(let s=0;s<this._octaves;s++){r+=o(new e.Vector3(t.x*this._scale*a,t.y*this._scale*a,t.z*this._scale*a))*i,a*=this._lacunarity,i*=this._persistance,n+=i}return Math.pow(r,this._redistribution)/n}},X=0,q=[],Z=new e.Vector3,K=new e.Vector3,$={x:0,y:0,z:0},Y={x:0,y:0,z:0},J={delta:0,generalData:null,normalizedConfig:null,attributes:null,particleLifetimePercentage:0,particleIndex:0},ee={"THREE.NoBlending":e.NoBlending,"THREE.NormalBlending":e.NormalBlending,"THREE.AdditiveBlending":e.AdditiveBlending,"THREE.SubtractiveBlending":e.SubtractiveBlending,"THREE.MultiplyBlending":e.MultiplyBlending},te=()=>JSON.parse(JSON.stringify(re)),re={transform:{position:new e.Vector3,rotation:new e.Vector3,scale:new e.Vector3(1,1,1)},duration:5,looping:!0,startDelay:0,startLifetime:5,startSpeed:1,startSize:1,startOpacity:1,startRotation:0,startColor:{min:{r:1,g:1,b:1},max:{r:1,g:1,b:1}},gravity:0,simulationSpace:"LOCAL",maxParticles:100,emission:{rateOverTime:10,rateOverDistance:0,bursts:[]},shape:{shape:"SPHERE",sphere:{radius:1,radiusThickness:1,arc:360},cone:{angle:25,radius:1,radiusThickness:1,arc:360},circle:{radius:1,radiusThickness:1,arc:360},rectangle:{rotation:{x:0,y:0},scale:{x:1,y:1}},box:{scale:{x:1,y:1,z:1},emitFrom:"VOLUME"}},map:void 0,renderer:{blending:e.NormalBlending,discardBackgroundColor:!1,backgroundColorTolerance:1,backgroundColor:{r:1,g:1,b:1},transparent:!0,depthTest:!0,depthWrite:!1},velocityOverLifetime:{isActive:!1,linear:{x:0,y:0,z:0},orbital:{x:0,y:0,z:0}},sizeOverLifetime:{isActive:!1,lifetimeCurve:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:0,percentage:0},{x:1,y:1,percentage:1}]}},colorOverLifetime:{isActive:!1,r:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:1,percentage:0},{x:1,y:1,percentage:1}]},g:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:1,percentage:0},{x:1,y:1,percentage:1}]},b:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:1,percentage:0},{x:1,y:1,percentage:1}]}},opacityOverLifetime:{isActive:!1,lifetimeCurve:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:0,percentage:0},{x:1,y:1,percentage:1}]}},rotationOverLifetime:{isActive:!1,min:0,max:0},noise:{isActive:!1,useRandomOffset:!1,strength:1,frequency:.5,octaves:1,positionAmount:1,rotationAmount:0,sizeAmount:0},textureSheetAnimation:{tiles:new e.Vector2(1,1),timeMode:"LIFETIME",fps:30,startFrame:0}},ie=({geometry:t,propertyName:r,maxParticles:i,factory:a})=>{const n=new Float32Array(i);if("function"==typeof a)for(let e=0;e<i;e++)n[e]=a(void 0,e);else n.fill(a);t.setAttribute(r,new e.BufferAttribute(n,1))},ae=(e,{shape:t,sphere:r,cone:i,circle:a,rectangle:n,box:o},s,l,c)=>{const d=w(e.particleSystemId,s,e.normalizedLifetimePercentage);switch(t){case"SPHERE":T(l,e.wrapperQuaternion,c,d,r);break;case"CONE":U(l,e.wrapperQuaternion,c,d,i);break;case"CIRCLE":L(l,e.wrapperQuaternion,c,d,a);break;case"RECTANGLE":P(l,e.wrapperQuaternion,c,d,n);break;case"BOX":E(l,e.wrapperQuaternion,c,d,o)}},ne=(r=re,i)=>{const a=i||Date.now(),n={particleSystemId:X++,normalizedLifetimePercentage:0,distanceFromLastEmitByDistance:0,lastWorldPosition:new e.Vector3(-99999),currentWorldPosition:new e.Vector3(-99999),worldPositionChange:new e.Vector3,worldQuaternion:new e.Quaternion,wrapperQuaternion:new e.Quaternion,lastWorldQuaternion:new e.Quaternion(-99999),worldEuler:new e.Euler,gravityVelocity:new e.Vector3(0,0,0),startValues:{},linearVelocityData:void 0,orbitalVelocityData:void 0,lifetimeValues:{},creationTimes:[],noise:{isActive:!1,strength:0,noisePower:0,positionAmount:0,rotationAmount:0,sizeAmount:0},isEnabled:!0},o=V.deepMerge(re,r,{applyToFirstObject:!1,skippedProperties:[]});let s=o.map||S();const{transform:l,duration:c,looping:d,startDelay:u,startLifetime:m,startSpeed:p,startSize:y,startRotation:I,startColor:g,startOpacity:h,gravity:v,simulationSpace:x,maxParticles:O,emission:b,shape:_,renderer:C,noise:A,velocityOverLifetime:T,onUpdate:U,onComplete:E,textureSheetAnimation:L,subEmitters:P}=o;"string"==typeof C?.blending&&(C.blending=ee[C.blending]);const M=Array.from({length:O},()=>new e.Vector3),R=Array.from({length:O},()=>new e.Vector3);n.creationTimes=Array.from({length:O},()=>0);const D=Array.from({length:O},(e,t)=>O-1-t);T.isActive&&(n.linearVelocityData=Array.from({length:O},()=>({speed:new e.Vector3(T.linear.x?w(n.particleSystemId,T.linear.x,0):0,T.linear.y?w(n.particleSystemId,T.linear.y,0):0,T.linear.z?w(n.particleSystemId,T.linear.z,0):0),valueModifiers:{x:N(T.linear.x||0)?z(n.particleSystemId,T.linear.x):void 0,y:N(T.linear.y||0)?z(n.particleSystemId,T.linear.y):void 0,z:N(T.linear.z||0)?z(n.particleSystemId,T.linear.z):void 0}})),n.orbitalVelocityData=Array.from({length:O},()=>({speed:new e.Vector3(T.orbital.x?w(n.particleSystemId,T.orbital.x,0):0,T.orbital.y?w(n.particleSystemId,T.orbital.y,0):0,T.orbital.z?w(n.particleSystemId,T.orbital.z,0):0),valueModifiers:{x:N(T.orbital.x||0)?z(n.particleSystemId,T.orbital.x):void 0,y:N(T.orbital.y||0)?z(n.particleSystemId,T.orbital.y):void 0,z:N(T.orbital.z||0)?z(n.particleSystemId,T.orbital.z):void 0},positionOffset:new e.Vector3})));["startSize","startOpacity"].forEach(e=>{n.startValues[e]=Array.from({length:O},()=>w(n.particleSystemId,o[e],0))}),n.startValues.startColorR=Array.from({length:O},()=>0),n.startValues.startColorG=Array.from({length:O},()=>0),n.startValues.startColorB=Array.from({length:O},()=>0);["rotationOverLifetime"].forEach(t=>{const r=o[t];r.isActive&&(n.lifetimeValues[t]=Array.from({length:O},()=>e.MathUtils.randFloat(r.min,r.max)))}),n.noise={isActive:A.isActive,strength:A.strength,noisePower:.15*A.strength,positionAmount:A.positionAmount,rotationAmount:A.rotationAmount,sizeAmount:A.sizeAmount,sampler:A.isActive?new W({seed:Math.random(),scale:A.frequency,octaves:A.octaves}):void 0,offsets:A.useRandomOffset?Array.from({length:O},()=>100*Math.random()):void 0},b.bursts&&b.bursts.length>0&&(n.burstStates=b.bursts.map(()=>({cyclesExecuted:0,lastCycleTime:0,probabilityPassed:!1})));const Q=new e.ShaderMaterial({uniforms:{elapsed:{value:0},map:{value:s},tiles:{value:L.tiles},fps:{value:L.fps},useFPSForFrameIndex:{value:"FPS"===L.timeMode},backgroundColor:{value:C.backgroundColor},discardBackgroundColor:{value:C.discardBackgroundColor},backgroundColorTolerance:{value:C.backgroundColorTolerance}},vertexShader:"\n attribute float size;\n attribute float colorR;\n attribute float colorG;\n attribute float colorB;\n attribute float colorA;\n attribute float lifetime;\n attribute float startLifetime;\n attribute float rotation;\n attribute float startFrame;\n\n varying mat4 vPosition;\n varying vec4 vColor;\n varying float vLifetime;\n varying float vStartLifetime;\n varying float vRotation;\n varying float vStartFrame;\n\n #include <common>\n #include <logdepthbuf_pars_vertex>\n\n void main()\n {\n vColor = vec4(colorR, colorG, colorB, colorA);\n vLifetime = lifetime;\n vStartLifetime = startLifetime;\n vRotation = rotation;\n vStartFrame = startFrame;\n\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_PointSize = size * (100.0 / length(mvPosition.xyz));\n gl_Position = projectionMatrix * mvPosition;\n\n #include <logdepthbuf_vertex>\n }\n",fragmentShader:"\n uniform sampler2D map;\n uniform float elapsed;\n uniform float fps;\n uniform bool useFPSForFrameIndex;\n uniform vec2 tiles;\n uniform bool discardBackgroundColor;\n uniform vec3 backgroundColor;\n uniform float backgroundColorTolerance;\n\n varying vec4 vColor;\n varying float vLifetime;\n varying float vStartLifetime;\n varying float vRotation;\n varying float vStartFrame;\n\n #include <common>\n #include <logdepthbuf_pars_fragment>\n\n void main()\n {\n gl_FragColor = vColor;\n float mid = 0.5;\n\n float frameIndex = round(vStartFrame) + (\n useFPSForFrameIndex == true\n ? fps == 0.0\n ? 0.0\n : max((vLifetime / 1000.0) * fps, 0.0)\n : max(min(floor(min(vLifetime / vStartLifetime, 1.0) * (tiles.x * tiles.y)), tiles.x * tiles.y - 1.0), 0.0)\n );\n \n float spriteXIndex = floor(mod(frameIndex, tiles.x));\n float spriteYIndex = floor(mod(frameIndex / tiles.x, tiles.y));\n\n vec2 frameUV = vec2(\n gl_PointCoord.x / tiles.x + spriteXIndex / tiles.x,\n gl_PointCoord.y / tiles.y + spriteYIndex / tiles.y);\n\n vec2 center = vec2(0.5, 0.5);\n vec2 centeredPoint = gl_PointCoord - center;\n\n mat2 rotation = mat2(\n cos(vRotation), sin(vRotation),\n -sin(vRotation), cos(vRotation)\n );\n\n centeredPoint = rotation * centeredPoint;\n vec2 centeredMiddlePoint = vec2(\n centeredPoint.x + center.x,\n centeredPoint.y + center.y\n );\n\n float dist = distance(centeredMiddlePoint, center);\n if (dist > 0.5) discard;\n\n vec2 uvPoint = vec2(\n centeredMiddlePoint.x / tiles.x + spriteXIndex / tiles.x,\n centeredMiddlePoint.y / tiles.y + spriteYIndex / tiles.y\n );\n\n vec4 rotatedTexture = texture2D(map, uvPoint);\n\n gl_FragColor = gl_FragColor * rotatedTexture;\n\n if (discardBackgroundColor && abs(length(rotatedTexture.rgb - backgroundColor.rgb)) < backgroundColorTolerance) discard;\n \n #include <logdepthbuf_fragment>\n }\n",transparent:C.transparent,blending:C.blending,depthTest:C.depthTest,depthWrite:C.depthWrite}),F=new e.BufferGeometry;for(let e=0;e<O;e++)ae(n,_,p,M[e],R[e]);const k=new Float32Array(3*O);for(let e=0;e<O;e++)k[3*e]=M[e].x,k[3*e+1]=M[e].y,k[3*e+2]=M[e].z;F.setAttribute("position",new e.BufferAttribute(k,3)),ie({geometry:F,propertyName:"isActive",maxParticles:O,factory:0}),ie({geometry:F,propertyName:"lifetime",maxParticles:O,factory:0}),ie({geometry:F,propertyName:"startLifetime",maxParticles:O,factory:()=>1e3*w(n.particleSystemId,m,0)}),ie({geometry:F,propertyName:"startFrame",maxParticles:O,factory:()=>L.startFrame?w(n.particleSystemId,L.startFrame,0):0}),ie({geometry:F,propertyName:"opacity",maxParticles:O,factory:()=>w(n.particleSystemId,h,0)}),ie({geometry:F,propertyName:"rotation",maxParticles:O,factory:()=>w(n.particleSystemId,I,0)}),ie({geometry:F,propertyName:"size",maxParticles:O,factory:(e,t)=>n.startValues.startSize[t]}),ie({geometry:F,propertyName:"rotation",maxParticles:O,factory:0});const j=Math.random();ie({geometry:F,propertyName:"colorR",maxParticles:O,factory:()=>g.min.r+j*(g.max.r-g.min.r)}),ie({geometry:F,propertyName:"colorG",maxParticles:O,factory:()=>g.min.g+j*(g.max.g-g.min.g)}),ie({geometry:F,propertyName:"colorB",maxParticles:O,factory:()=>g.min.b+j*(g.max.b-g.min.b)}),ie({geometry:F,propertyName:"colorA",maxParticles:O,factory:0});const G=P??[],H=G.filter(e=>"DEATH"===(e.trigger??"DEATH")),K=G.filter(e=>"BIRTH"===e.trigger),$=new Map;for(const e of G)$.set(e,[]);const Y=t=>{for(let r=t.length-1;r>=0;r--){const i=t[r],a=i.instance instanceof e.Points?i.instance:i.instance.children[0],n=a?.geometry?.attributes?.isActive?.array;if(!n){i.dispose(),t.splice(r,1);continue}let o=!1;for(let e=0;e<n.length;e++)if(n[e]){o=!0;break}o||(i.dispose(),t.splice(r,1))}},J=(t,r,i,a)=>{for(const n of t){const t=$.get(n),o=n.maxInstances??32;if(t.length>=o&&(Y(t),t.length>=o))continue;const s=n.inheritVelocity??0,l=ne({...n.config,looping:!1,transform:{...n.config.transform,position:new e.Vector3(r.x,r.y,r.z)},...s>0?{startSpeed:("number"==typeof n.config.startSpeed?n.config.startSpeed:"object"==typeof n.config.startSpeed&&null!==n.config.startSpeed&&"min"in n.config.startSpeed?n.config.startSpeed.min??0:0)+i.length()*s}:{}},a),c=(le||te).parent;c&&c.add(l.instance),t.push(l)}};let te=new e.Points(F,Q);te.position.copy(l.position),te.rotation.x=e.MathUtils.degToRad(l.rotation.x),te.rotation.y=e.MathUtils.degToRad(l.rotation.y),te.rotation.z=e.MathUtils.degToRad(l.rotation.z),te.scale.copy(l.scale);const se=a+1e3*w(n.particleSystemId,u);let le;"WORLD"===o.simulationSpace&&(le=new t,le.add(te));const ce=H.length>0?(e,t,r,i)=>{const a=3*e;Z.set(t[a],t[a+1],t[a+2]),J(H,Z,r,i)}:void 0,de=K.length>0?(e,t,r,i)=>{const a=3*e;Z.set(t[a],t[a+1],t[a+2]),J(K,Z,r,i)}:void 0,ue={particleSystem:te,wrapper:le,elapsedUniform:Q.uniforms.elapsed,generalData:n,onUpdate:U,onComplete:E,creationTime:se,lastEmissionTime:se,duration:c,looping:d,simulationSpace:x,gravity:v,emission:b,normalizedConfig:o,iterationCount:0,velocities:R,freeList:D,deactivateParticle:e=>{F.attributes.isActive.array[e]=0,F.attributes.colorA.array[e]=0,F.attributes.colorA.needsUpdate=!0,D.push(e)},activateParticle:({particleIndex:t,activationTime:r,position:i})=>{F.attributes.isActive.array[t]=1,n.creationTimes[t]=r,n.noise.offsets&&(n.noise.offsets[t]=100*Math.random());const a=Math.random();F.attributes.colorR.array[t]=g.min.r+a*(g.max.r-g.min.r),F.attributes.colorR.needsUpdate=!0,F.attributes.colorG.array[t]=g.min.g+a*(g.max.g-g.min.g),F.attributes.colorG.needsUpdate=!0,F.attributes.colorB.array[t]=g.min.b+a*(g.max.b-g.min.b),F.attributes.colorB.needsUpdate=!0,n.startValues.startColorR[t]=F.attributes.colorR.array[t],n.startValues.startColorG[t]=F.attributes.colorG.array[t],n.startValues.startColorB[t]=F.attributes.colorB.array[t],F.attributes.startFrame.array[t]=L.startFrame?w(n.particleSystemId,L.startFrame,0):0,F.attributes.startFrame.needsUpdate=!0,F.attributes.startLifetime.array[t]=1e3*w(n.particleSystemId,m,n.normalizedLifetimePercentage),F.attributes.startLifetime.needsUpdate=!0,n.startValues.startSize[t]=w(n.particleSystemId,y,n.normalizedLifetimePercentage),F.attributes.size.array[t]=n.startValues.startSize[t],F.attributes.size.needsUpdate=!0,n.startValues.startOpacity[t]=w(n.particleSystemId,h,n.normalizedLifetimePercentage),F.attributes.colorA.array[t]=n.startValues.startOpacity[t],F.attributes.colorA.needsUpdate=!0,F.attributes.rotation.array[t]=w(n.particleSystemId,I,n.normalizedLifetimePercentage),F.attributes.rotation.needsUpdate=!0,o.rotationOverLifetime.isActive&&(n.lifetimeValues.rotationOverLifetime[t]=e.MathUtils.randFloat(o.rotationOverLifetime.min,o.rotationOverLifetime.max)),ae(n,_,p,M[t],R[t]);const s=Math.floor(3*t);F.attributes.position.array[s]=i.x+M[t].x,F.attributes.position.array[s+1]=i.y+M[t].y,F.attributes.position.array[s+2]=i.z+M[t].z,F.attributes.position.needsUpdate=!0,n.linearVelocityData&&n.linearVelocityData[t].speed.set(o.velocityOverLifetime.linear.x?w(n.particleSystemId,o.velocityOverLifetime.linear.x,0):0,o.velocityOverLifetime.linear.y?w(n.particleSystemId,o.velocityOverLifetime.linear.y,0):0,o.velocityOverLifetime.linear.z?w(n.particleSystemId,o.velocityOverLifetime.linear.z,0):0),n.orbitalVelocityData&&(n.orbitalVelocityData[t].speed.set(o.velocityOverLifetime.orbital.x?w(n.particleSystemId,o.velocityOverLifetime.orbital.x,0):0,o.velocityOverLifetime.orbital.y?w(n.particleSystemId,o.velocityOverLifetime.orbital.y,0):0,o.velocityOverLifetime.orbital.z?w(n.particleSystemId,o.velocityOverLifetime.orbital.z,0):0),n.orbitalVelocityData[t].positionOffset.set(M[t].x,M[t].y,M[t].z)),F.attributes.lifetime.array[t]=0,F.attributes.lifetime.needsUpdate=!0,B({delta:0,generalData:n,normalizedConfig:o,attributes:te.geometry.attributes,particleLifetimePercentage:0,particleIndex:t})},onParticleDeath:ce,onParticleBirth:de};q.push(ue);return{instance:le||te,resumeEmitter:()=>n.isEnabled=!0,pauseEmitter:()=>n.isEnabled=!1,dispose:()=>{for(const e of $.values()){for(const t of e)t.dispose();e.length=0}(e=>{q=q.filter(({particleSystem:t,wrapper:r,generalData:{particleSystemId:i}})=>t!==e&&r!==e||(f(i),t.geometry.dispose(),Array.isArray(t.material)?t.material.forEach(e=>e.dispose()):t.material.dispose(),t.parent&&t.parent.remove(t),r?.parent&&r.parent.remove(r),!1))})(te)},update:e=>{oe(ue,e);for(const t of $.values())for(const r of t)r.update(e)}}},oe=(e,{now:t,delta:r,elapsed:i})=>{const{onUpdate:a,generalData:n,onComplete:o,particleSystem:s,wrapper:l,elapsedUniform:c,creationTime:d,lastEmissionTime:u,duration:m,looping:p,emission:f,normalizedConfig:y,iterationCount:I,velocities:g,freeList:h,deactivateParticle:v,activateParticle:x,simulationSpace:O,gravity:b,onParticleDeath:_,onParticleBirth:C}=e,A=t-d,T=A%(1e3*m);n.normalizedLifetimePercentage=Math.max(Math.min(T/(1e3*m),1),0);const{lastWorldPosition:U,currentWorldPosition:E,worldPositionChange:L,lastWorldQuaternion:P,worldQuaternion:S,worldEuler:N,gravityVelocity:z,isEnabled:M}=n;l?.parent&&n.wrapperQuaternion.copy(l.parent.quaternion),K.copy(U),c.value=i,s.getWorldPosition(E),-99999!==U.x&&L.set(E.x-U.x,E.y-U.y,E.z-U.z),M&&(n.distanceFromLastEmitByDistance+=L.length()),s.getWorldPosition(U),s.getWorldQuaternion(S),-99999!==P.x&&P.x===S.x&&P.y===S.y&&P.z===S.z||(N.setFromQuaternion(S),P.copy(S),z.set(U.x,U.y+b,U.z),s.worldToLocal(z));const R=n.creationTimes,V=s.geometry.attributes,D=V.isActive.array,Q=V.startLifetime.array,F=V.position.array,k=V.lifetime.array,j=R.length;let G=!1,H=!1;J.delta=r,J.generalData=n,J.normalizedConfig=y,J.attributes=V;for(let e=0;e<j;e++)if(D[e]){const i=t-R[e];if(i>Q[e])_&&_(e,F,g[e],t),v(e);else{const t=g[e];if(t.x-=z.x*r,t.y-=z.y*r,t.z-=z.z*r,0!==b||0!==t.x||0!==t.y||0!==t.z||0!==L.x||0!==L.y||0!==L.z){const i=3*e;"WORLD"===O&&(F[i]-=L.x,F[i+1]-=L.y,F[i+2]-=L.z),F[i]+=t.x*r,F[i+1]+=t.y*r,F[i+2]+=t.z*r,G=!0}k[e]=i,H=!0,J.particleLifetimePercentage=i/Q[e],J.particleIndex=e,B(J)}}if(G&&(V.position.needsUpdate=!0),H&&(V.lifetime.needsUpdate=!0),M&&(p||A<1e3*m)){const o=t-u,l=f.rateOverTime?Math.floor(w(n.particleSystemId,f.rateOverTime,n.normalizedLifetimePercentage)*(o/1e3)):0,c=f.rateOverDistance?w(n.particleSystemId,f.rateOverDistance,n.normalizedLifetimePercentage):0,d=c>0&&n.distanceFromLastEmitByDistance>0?Math.floor(n.distanceFromLastEmitByDistance/(1/c)):0,m=d>0;m&&($.x=(E.x-K.x)/d,$.y=(E.y-K.y)/d,$.z=(E.z-K.z)/d);let y=l+d;if(c>0&&d>=1&&(n.distanceFromLastEmitByDistance=0),f.bursts&&n.burstStates){const e=f.bursts,t=n.burstStates,r=T;for(let i=0;i<e.length;i++){const a=e[i],o=t[i],s=1e3*a.time,l=a.cycles??1,c=1e3*(a.interval??0),d=a.probability??1;if(p&&r<s&&o.cyclesExecuted>0&&(o.cyclesExecuted=0,o.lastCycleTime=0,o.probabilityPassed=!1),o.cyclesExecuted>=l)continue;if(r>=s+o.cyclesExecuted*c){if(0===o.cyclesExecuted&&(o.probabilityPassed=Math.random()<d),o.probabilityPassed){y+=Math.floor(w(n.particleSystemId,a.count,n.normalizedLifetimePercentage))}o.cyclesExecuted++,o.lastCycleTime=r}}}if(y>0){let r=0;for(let i=0;i<y&&0!==h.length;i++){const i=h.pop();Y.x=0,Y.y=0,Y.z=0,m&&r<d&&(Y.x=$.x*r,Y.y=$.y*r,Y.z=$.z*r,r++),x({particleIndex:i,activationTime:t,position:Y}),C&&C(i,V.position.array,g[i],t),e.lastEmissionTime=t}}a&&a({particleSystem:s,delta:r,elapsed:i,lifetime:A,normalizedLifetime:T,iterationCount:I+1})}else o&&o({particleSystem:s})},se=e=>{q.forEach(t=>oe(t,e))};export{g as CurveFunctionId,b as EmitFrom,C as LifeTimeCurve,O as Shape,x as SimulationSpace,A as SubEmitterTrigger,_ as TimeMode,B as applyModifiers,ee as blendingMap,E as calculateRandomPositionAndVelocityOnBox,L as calculateRandomPositionAndVelocityOnCircle,U as calculateRandomPositionAndVelocityOnCone,P as calculateRandomPositionAndVelocityOnRectangle,T as calculateRandomPositionAndVelocityOnSphere,w as calculateValue,p as createBezierCurveFunction,S as createDefaultParticleTexture,ne as createParticleSystem,y as getBezierCacheSize,v as getCurveFunction,z as getCurveFunctionFromConfig,te as getDefaultParticleSystemConfig,N as isLifeTimeCurve,f as removeBezierCurveFunction,se as updateParticleSystems};//# sourceMappingURL=three-particles.min.js.map