@tsparticles/stencil 4.3.1 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BEJx8swj.js');
3
+ var index = require('./index-aKxqzbzz.js');
4
4
 
5
5
  class BaseRange {
6
6
  position;
@@ -271,6 +271,9 @@ exports.PixelMode = void 0;
271
271
  PixelMode["percent"] = "percent";
272
272
  })(exports.PixelMode || (exports.PixelMode = {}));
273
273
 
274
+ function isForbiddenKey(key) {
275
+ return key === "__proto__" || key === "constructor" || key === "prototype";
276
+ }
274
277
  function hasMatchMedia() {
275
278
  return typeof matchMedia !== "undefined";
276
279
  }
@@ -319,7 +322,7 @@ function deepExtend(destination, ...sources) {
319
322
  if (!hasNested) {
320
323
  const sourceDict = source, destDict = destination;
321
324
  for (const key of sourceKeys) {
322
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
325
+ if (isForbiddenKey(key)) {
323
326
  continue;
324
327
  }
325
328
  const v = sourceDict[key];
@@ -330,7 +333,7 @@ function deepExtend(destination, ...sources) {
330
333
  continue;
331
334
  }
332
335
  for (const key of sourceKeys) {
333
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
336
+ if (isForbiddenKey(key)) {
334
337
  continue;
335
338
  }
336
339
  const sourceDict = source, destDict = destination, value = sourceDict[key];
@@ -746,7 +749,7 @@ class Engine {
746
749
  return this.#domArray;
747
750
  }
748
751
  get version() {
749
- return "4.3.1";
752
+ return "4.3.2";
750
753
  }
751
754
  addEventListener(type, listener) {
752
755
  this.#eventDispatcher.addEventListener(type, listener);
@@ -781,7 +784,7 @@ class Engine {
781
784
  if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
782
785
  domSourceElement = params.element;
783
786
  }
784
- const { Container } = await Promise.resolve().then(function () { return require('./Container-DwRv_rua.js'); }), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
787
+ const { Container } = await Promise.resolve().then(function () { return require('./Container-4Q9Bw76q.js'); }), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
785
788
  dispatchCallback: (eventType, args) => {
786
789
  this.dispatchEvent(eventType, args);
787
790
  },
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BEJx8swj.js');
3
+ var index = require('./index-aKxqzbzz.js');
4
4
 
5
5
 
6
6
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BjS63OiI.js');
4
- var index$1 = require('./index-BEJx8swj.js');
4
+ var index$1 = require('./index-aKxqzbzz.js');
5
5
 
6
6
  const StencilParticles = class {
7
7
  constructor(hostRef) {
@@ -1,4 +1,4 @@
1
- import { R as RangeType, c as checkDistance, s as squareExp, a as isNull, b as setRangeValue, h as hMin, d as hMax, l as lMin, e as lMax, f as sMin, g as sMax, j as isString, k as isArray, m as deepExtend, P as PixelMode, O as OutMode, M as MoveDirection, n as isNumber, o as isObject, L as LimitMode, p as executeOnSingleOrMultiple, q as isBoolean, r as itemFromArray, u as defaultOpacity, v as randomColorValue, A as AlterType, w as lFactor, x as half, y as double, z as hPhase, B as rgbMax, C as getRandomInRange, D as identity, E as defaultRgbMin, F as maxNits, G as sextuple, H as triple, I as phaseNumerator, J as sNormalizedOffset, K as originPoint, N as DrawLayer, Q as minimumSize, S as defaultCompositeValue, T as minStrokeWidth, U as defaultZoom, V as getLogger, W as zIndexFactorOffset, X as defaultTransformValue, Y as safeMutationObserver, Z as generatedAttribute, _ as cloneStyle, $ as safeMatchMedia, a0 as getFullScreenStyle, a1 as safeDocument, a2 as millisecondsToSeconds, a3 as manageListener, a4 as visibilityChangeEvent, a5 as resizeEvent, a6 as Vector3d, a7 as EventType, a8 as defaultAngle, a9 as defaultTransform, aa as defaultRetryCount, ab as tryCountIncrement, ac as getParticleBaseVelocity, ad as randomInRangeValue, ae as getRandom, af as OutModeDirection, ag as clamp, ah as minZ, ai as getPosition, aj as getParticleDirectionAngle, ak as ParticleOutType, al as Vector, am as calcExactPositionOrRandomFromSize, an as getRangeValue, ao as itemFromSingleOrMultiple, ap as isInArray, aq as doublePI, ar as degToRad, as as spatialHashGridCellSize, at as minLimit, au as minCount, av as minIndex, aw as defaultRemoveQuantity, ax as defaultDensityFactor, ay as deleteCount, az as countOffset, aA as one, aB as defaultRatio, aC as defaultReduceFactor, aD as animate, aE as defaultFpsLimit, aF as minFpsLimit, aG as cancelAnimation, aH as defaultFps } from './index-uBrXcY8m.js';
1
+ import { R as RangeType, c as checkDistance, s as squareExp, a as isNull, b as setRangeValue, h as hMin, d as hMax, l as lMin, e as lMax, f as sMin, g as sMax, j as isString, k as isArray, m as deepExtend, P as PixelMode, O as OutMode, M as MoveDirection, n as isNumber, o as isObject, L as LimitMode, p as executeOnSingleOrMultiple, q as isBoolean, r as itemFromArray, u as defaultOpacity, v as randomColorValue, A as AlterType, w as lFactor, x as half, y as double, z as hPhase, B as rgbMax, C as getRandomInRange, D as identity, E as defaultRgbMin, F as maxNits, G as sextuple, H as triple, I as phaseNumerator, J as sNormalizedOffset, K as originPoint, N as DrawLayer, Q as minimumSize, S as defaultCompositeValue, T as minStrokeWidth, U as defaultZoom, V as getLogger, W as zIndexFactorOffset, X as defaultTransformValue, Y as safeMutationObserver, Z as generatedAttribute, _ as cloneStyle, $ as safeMatchMedia, a0 as getFullScreenStyle, a1 as safeDocument, a2 as millisecondsToSeconds, a3 as manageListener, a4 as visibilityChangeEvent, a5 as resizeEvent, a6 as Vector3d, a7 as EventType, a8 as defaultAngle, a9 as defaultTransform, aa as defaultRetryCount, ab as tryCountIncrement, ac as getParticleBaseVelocity, ad as randomInRangeValue, ae as getRandom, af as OutModeDirection, ag as clamp, ah as minZ, ai as getPosition, aj as getParticleDirectionAngle, ak as ParticleOutType, al as Vector, am as calcExactPositionOrRandomFromSize, an as getRangeValue, ao as itemFromSingleOrMultiple, ap as isInArray, aq as doublePI, ar as degToRad, as as spatialHashGridCellSize, at as minLimit, au as minCount, av as minIndex, aw as defaultRemoveQuantity, ax as defaultDensityFactor, ay as deleteCount, az as countOffset, aA as one, aB as defaultRatio, aC as defaultReduceFactor, aD as animate, aE as defaultFpsLimit, aF as minFpsLimit, aG as cancelAnimation, aH as defaultFps } from './index-DUTlKNT-.js';
2
2
 
3
3
  class BaseRange {
4
4
  position;
@@ -269,6 +269,9 @@ var PixelMode;
269
269
  PixelMode["percent"] = "percent";
270
270
  })(PixelMode || (PixelMode = {}));
271
271
 
272
+ function isForbiddenKey(key) {
273
+ return key === "__proto__" || key === "constructor" || key === "prototype";
274
+ }
272
275
  function hasMatchMedia() {
273
276
  return typeof matchMedia !== "undefined";
274
277
  }
@@ -317,7 +320,7 @@ function deepExtend(destination, ...sources) {
317
320
  if (!hasNested) {
318
321
  const sourceDict = source, destDict = destination;
319
322
  for (const key of sourceKeys) {
320
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
323
+ if (isForbiddenKey(key)) {
321
324
  continue;
322
325
  }
323
326
  const v = sourceDict[key];
@@ -328,7 +331,7 @@ function deepExtend(destination, ...sources) {
328
331
  continue;
329
332
  }
330
333
  for (const key of sourceKeys) {
331
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
334
+ if (isForbiddenKey(key)) {
332
335
  continue;
333
336
  }
334
337
  const sourceDict = source, destDict = destination, value = sourceDict[key];
@@ -744,7 +747,7 @@ class Engine {
744
747
  return this.#domArray;
745
748
  }
746
749
  get version() {
747
- return "4.3.1";
750
+ return "4.3.2";
748
751
  }
749
752
  addEventListener(type, listener) {
750
753
  this.#eventDispatcher.addEventListener(type, listener);
@@ -779,7 +782,7 @@ class Engine {
779
782
  if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
780
783
  domSourceElement = params.element;
781
784
  }
782
- const { Container } = await import('./Container-COqetWkt.js'), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
785
+ const { Container } = await import('./Container-W8jYPrtn.js'), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
783
786
  dispatchCallback: (eventType, args) => {
784
787
  this.dispatchEvent(eventType, args);
785
788
  },
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export { i as initParticlesEngine, aI as isParticlesEngineInitialized, aJ as waitForParticlesEngineInitialization } from './index-uBrXcY8m.js';
1
+ export { i as initParticlesEngine, aI as isParticlesEngineInitialized, aJ as waitForParticlesEngineInitialization } from './index-DUTlKNT-.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-PhwiK2_P.js';
2
- import { i as initParticlesEngine, t as tsParticles } from './index-uBrXcY8m.js';
2
+ import { i as initParticlesEngine, t as tsParticles } from './index-DUTlKNT-.js';
3
3
 
4
4
  const StencilParticles = class {
5
5
  constructor(hostRef) {
@@ -1 +1 @@
1
- export{i as initParticlesEngine,aI as isParticlesEngineInitialized,aJ as waitForParticlesEngineInitialization}from"./p-Buaac_o7.js";
1
+ export{i as initParticlesEngine,aI as isParticlesEngineInitialized,aJ as waitForParticlesEngineInitialization}from"./p-CtlWkxPP.js";
@@ -1 +1 @@
1
- import{R as t,c as s,s as i,a as e,b as h,h as o,d as n,l as a,e as r,f as c,g as l,j as d,k as f,m as u,P as p,O as v,M as w,n as g,o as y,L as m,p as b,q as M,r as x,u as P,v as k,A as C,w as L,x as z,y as S,z as O,B as R,C as D,D as $,E as T,F as E,G as B,H as I,I as F,J as H,K as A,N as U,Q as V,S as q,T as j,U as W,V as X,W as Y,X as _,Y as N,Z,_ as G,$ as K,a0 as Q,a1 as J,a2 as tt,a3 as st,a4 as it,a5 as et,a6 as ht,a7 as ot,a8 as nt,a9 as at,aa as rt,ab as ct,ac as lt,ad as dt,ae as ft,af as ut,ag as pt,ah as vt,ai as wt,aj as gt,ak as yt,al as mt,am as bt,an as Mt,ao as xt,ap as Pt,aq as kt,ar as Ct,as as Lt,at as zt,au as St,av as Ot,aw as Rt,ax as Dt,ay as $t,az as Tt,aA as Et,aB as Bt,aC as It,aD as Ft,aE as Ht,aF as At,aG as Ut,aH as Vt}from"./p-Buaac_o7.js";class qt{position;type;constructor(t,s,i){this.position={x:t,y:s},this.type=i}_resetPosition(t,s){this.position.x=t,this.position.y=s}}class jt extends qt{radius;constructor(s,i,e){super(s,i,t.circle),this.radius=e}contains(t){return s(t,this.position,this.radius)}intersects(s){const e=this.position,h=s.position,o=this.radius,n=Math.abs(h.x-e.x),a=Math.abs(h.y-e.y);if(s instanceof jt||s.type===t.circle)return o+s.radius>Math.hypot(n,a);if(s instanceof Wt||s.type===t.rectangle){const t=s,{width:e,height:h}=t.size;return Math.pow(n-e,i)+Math.pow(a-h,i)<=o**i||n<=o+e&&a<=o+h||n<=e||a<=h}return!1}reset(t,s,i){return this._resetPosition(t,s),this.radius=i,this}}class Wt extends qt{size;constructor(s,i,e,h){super(s,i,t.rectangle),this.size={height:h,width:e}}contains(t){const s=this.position;return t.x>=s.x&&t.x<=s.x+this.size.width&&t.y>=s.y&&t.y<=s.y+this.size.height}intersects(t){if(t instanceof jt)return t.intersects(this);if(!(t instanceof Wt))return!1;const s=this.position,i=t.position,e=t.size;return i.x<s.x+this.size.width&&i.x+e.width>s.x&&i.y<s.y+this.size.height&&i.y+e.height>s.y}reset(t,s,i,e){return this._resetPosition(t,s),this.size.width=i,this.size.height=e,this}}class Xt{load(t){e(t)||this.doLoad(t)}}function Yt(t,...s){for(const i of s)t.load(i)}function _t(t,s,i){void 0!==i&&(t[s]=i)}function Nt(t,s,i){void 0!==i&&(t[s]=h(i))}function Zt(t,s,i,e){if(void 0!==i){const h=t;h[s]??=e(),h[s].load(i)}}class Gt extends Xt{count=0;decay=0;delay=0;enable=!1;speed=1;sync=!1;doLoad(t){Nt(this,"count",t.count),_t(this,"enable",t.enable),Nt(this,"speed",t.speed),Nt(this,"decay",t.decay),Nt(this,"delay",t.delay),_t(this,"sync",t.sync)}}class Kt extends Gt{max;min;offset=0;sync=!0;constructor(t,s){super(),this.min=t,this.max=s}doLoad(t){super.doLoad(t),_t(this,"max",t.max),_t(this,"min",t.min),Nt(this,"offset",t.offset)}}class Qt extends Xt{h=new Kt(o,n);l=new Kt(a,r);s=new Kt(c,l);doLoad(t){this.h.load(t.h),this.s.load(t.s),this.l.load(t.l)}}class Jt extends Xt{value="";static create(t,s){const i=new Jt;return i.load(t),void 0!==s&&(d(s)||f(s)?i.load({value:s}):i.load(s)),i}doLoad(t){e(t.value)||(this.value=t.value)}}class ts extends Jt{animation=new Qt;static create(t,s){const i=new ts;return i.load(t),void 0!==s&&(d(s)||f(s)?i.load({value:s}):i.load(s)),i}doLoad(t){super.doLoad(t);const s=t.animation;void 0!==s&&(void 0===s.enable?this.animation.load(t.animation):this.animation.h.load(s))}}class ss extends Xt{color;draw;element;image="";opacity=1;position="";repeat="";size="";constructor(){super(),this.color=new Jt,this.color.value=""}doLoad(t){void 0!==t.color&&(this.color=Jt.create(this.color,t.color)),_t(this,"element",t.element),_t(this,"draw",t.draw),_t(this,"image",t.image),_t(this,"position",t.position),_t(this,"repeat",t.repeat),_t(this,"size",t.size),_t(this,"opacity",t.opacity)}}class is extends Xt{enable=!0;zIndex=0;doLoad(t){_t(this,"enable",t.enable),_t(this,"zIndex",t.zIndex)}}class es extends Xt{delay=.5;enable=!0;doLoad(t){_t(this,"delay",t.delay),_t(this,"enable",t.enable)}}class hs extends Xt{close=!0;options={};type=[];doLoad(t){const s=t.options;if(void 0!==s)for(const t in s){const i=s[t];i&&(this.options[t]=u(this.options[t]??{},i))}_t(this,"close",t.close),_t(this,"type",t.type)}}class os extends Xt{color;enable=!0;opacity=1;doLoad(t){void 0!==t.color&&(this.color=ts.create(this.color,t.color)),_t(this,"enable",t.enable),Nt(this,"opacity",t.opacity)}}class ns extends Xt{offset=0;value=90;doLoad(t){Nt(this,"offset",t.offset),Nt(this,"value",t.value)}}class as extends Xt{mode=p.percent;radius=0;x=50;y=50;doLoad(t){_t(this,"x",t.x),_t(this,"y",t.y),_t(this,"mode",t.mode),_t(this,"radius",t.radius)}}class rs extends Xt{acceleration=9.81;enable=!1;inverse=!1;maxSpeed=50;doLoad(t){Nt(this,"acceleration",t.acceleration),_t(this,"enable",t.enable),_t(this,"inverse",t.inverse),Nt(this,"maxSpeed",t.maxSpeed)}}class cs extends Xt{value=0;doLoad(t){e(t.value)||(this.value=h(t.value))}}class ls extends Xt{clamp=!0;delay=new cs;enable=!1;generator;options={};doLoad(t){_t(this,"clamp",t.clamp),this.delay.load(t.delay),_t(this,"enable",t.enable),this.generator=t.generator,t.options&&(this.options=u(this.options,t.options))}}class ds extends Xt{bottom;default=v.out;left;right;top;doLoad(t){void 0!==t.default&&(this.default=t.default),this.bottom=t.bottom??t.default,this.left=t.left??t.default,this.right=t.right??t.default,this.top=t.top??t.default}}class fs extends Xt{acceleration=0;enable=!1;position;doLoad(t){Nt(this,"acceleration",t.acceleration),_t(this,"enable",t.enable),t.position&&(this.position=u({},t.position))}}class us extends Xt{angle=new ns;center=new as;decay=0;direction=w.none;distance={};drift=0;enable=!1;gravity=new rs;outModes=new ds;path=new ls;random=!1;size=!1;speed=2;spin=new fs;straight=!1;vibrate=!1;warp=!1;doLoad(t){this.angle.load(g(t.angle)?{value:t.angle}:t.angle),this.center.load(t.center),Nt(this,"decay",t.decay),_t(this,"direction",t.direction),void 0!==t.distance&&(this.distance=g(t.distance)?{horizontal:t.distance,vertical:t.distance}:{...t.distance}),Nt(this,"drift",t.drift),_t(this,"enable",t.enable),this.gravity.load(t.gravity);const s=t.outModes;void 0!==s&&(y(s)?this.outModes.load(s):this.outModes.load({default:s})),this.path.load(t.path),_t(this,"random",t.random),_t(this,"size",t.size),Nt(this,"speed",t.speed),this.spin.load(t.spin),_t(this,"straight",t.straight),_t(this,"vibrate",t.vibrate),_t(this,"warp",t.warp)}}class ps extends Xt{color;opacity;width=0;doLoad(t){void 0!==t.color&&(this.color=ts.create(this.color,t.color)),Nt(this,"width",t.width),Nt(this,"opacity",t.opacity)}}class vs extends Xt{color;fill;stroke;doLoad(t){void 0!==t.color&&(this.color=ts.create(this.color,t.color)),Zt(this,"fill",t.fill,(()=>new os)),Zt(this,"stroke",t.stroke,(()=>new ps))}}class ws extends cs{value=1}class gs extends Xt{horizontal=new ws;vertical=new ws;doLoad(t){this.horizontal.load(t.horizontal),this.vertical.load(t.vertical)}}class ys extends Xt{enable=!1;height=1080;width=1920;doLoad(t){_t(this,"enable",t.enable),_t(this,"width",t.width),_t(this,"height",t.height)}}class ms extends Xt{mode=m.delete;value=0;doLoad(t){_t(this,"mode",t.mode),_t(this,"value",t.value)}}class bs extends Xt{density=new ys;limit=new ms;value=0;doLoad(t){this.density.load(t.density),this.limit.load(t.limit),_t(this,"value",t.value)}}class Ms extends Xt{close=!0;options={};type="circle";doLoad(t){const s=t.options;if(void 0!==s)for(const t in s){const i=s[t];i&&(this.options[t]=u(this.options[t]??{},i))}_t(this,"close",t.close),_t(this,"type",t.type)}}class xs extends cs{opacityRate=1;sizeRate=1;velocityRate=1;doLoad(t){super.doLoad(t),_t(this,"opacityRate",t.opacityRate),_t(this,"sizeRate",t.sizeRate),_t(this,"velocityRate",t.velocityRate)}}class Ps extends Xt{bounce=new gs;effect=new hs;groups={};move=new us;number=new bs;paint;palette;reduceDuplicates=!1;shape=new Ms;zIndex=new xs;#t;#s;constructor(t,s){super(),this.#s=t,this.#t=s,this.paint=new vs,this.paint.color=new ts,this.paint.color.value="#fff",this.paint.fill=new os,this.paint.fill.enable=!0}doLoad(t){if(t.palette&&(this.palette=t.palette,this.#i(this.palette)),void 0!==t.groups)for(const s of Object.keys(t.groups)){if(!(s in t.groups))continue;const i=t.groups[s];void 0!==i&&(this.groups[s]=u(this.groups[s]??{},i))}void 0!==t.reduceDuplicates&&(this.reduceDuplicates=t.reduceDuplicates),this.bounce.load(t.bounce),this.effect.load(t.effect),this.move.load(t.move),this.number.load(t.number);const s=t.paint;if(s&&(f(s)?this.paint=b(s,(t=>{const s=new vs;return s.load(t),s})):f(this.paint)?(this.paint=new vs,this.paint.load(s)):this.paint.load(s)),this.shape.load(t.shape),this.zIndex.load(t.zIndex),this.#t){for(const s of this.#s.plugins)s.loadParticlesOptions&&s.loadParticlesOptions(this.#t,this,t);const s=this.#s.updaters.get(this.#t);if(s)for(const i of s)i.loadOptions&&i.loadOptions(this,t)}}#i(t){const s=this.#s.getPalette(t);if(!s)return;const i=s.colors,e=(f(i)?i:[i]).flatMap((t=>{const s=t.fill,i=t.stroke,e=s?{color:{value:s.value},enable:s.enable,opacity:s.opacity}:void 0;return i?[{fill:e,stroke:{color:{value:i.value},opacity:i.opacity,width:i.width||0}}]:[{fill:e}]}));this.load({paint:e.length>1?e:e[0]??{},blend:{enable:!0,mode:s.blendMode}})}}function ks(t,s,...i){const e=new Ps(t,s);return Yt(e,...i),e}class Cs extends Xt{autoPlay=!0;background;clear=!0;defaultThemes={};delay=0;detectRetina=!0;duration=0;fpsLimit=120;fullScreen;hdr=!0;key;name;palette;particles;pauseOnBlur=!0;pauseOnOutsideViewport=!0;preset;resize;smooth=!1;style={};zLayers=100;#t;#s;constructor(t,s){super(),this.#s=t,this.#t=s,this.background=new ss,this.fullScreen=new is,this.particles=ks(this.#s,this.#t),this.resize=new es}doLoad(t){void 0!==t.preset&&(this.preset=t.preset,b(this.preset,(t=>{this.#e(t)}))),void 0!==t.palette&&(this.palette=t.palette,this.#i(this.palette)),_t(this,"autoPlay",t.autoPlay),_t(this,"clear",t.clear),_t(this,"key",t.key),_t(this,"name",t.name),Nt(this,"delay",t.delay),_t(this,"detectRetina",t.detectRetina),Nt(this,"duration",t.duration),_t(this,"fpsLimit",t.fpsLimit),_t(this,"hdr",t.hdr),_t(this,"pauseOnBlur",t.pauseOnBlur),_t(this,"pauseOnOutsideViewport",t.pauseOnOutsideViewport),_t(this,"zLayers",t.zLayers),this.background.load(t.background);const s=t.fullScreen;M(s)?this.fullScreen.enable=s:this.fullScreen.load(s),this.particles.load(t.particles),this.resize.load(t.resize),this.style=u(this.style,t.style),_t(this,"smooth",t.smooth),this.#s.plugins.forEach((s=>{s.loadOptions(this.#t,this,t)}))}#i(t){const s=this.#s.getPalette(t);s&&this.load({background:{color:s.background},blend:{enable:!0,mode:s.blendMode},particles:{palette:t}})}#e(t){this.load(this.#s.getPreset(t))}}const Ls=new Map;function zs(t,s){let i=Ls.get(t);return i||(i=s(),Ls.size>2e3&&Ls.clear(),Ls.set(t,i)),i}function Ss(t,s,i,e=!0){if(!s)return;const h=d(s)?{value:s}:s;if(d(h.value))return Os(t,h.value,i,e);if(f(h.value)){const s=x(h.value,i,e);if(!s)return;return Ss(t,{value:s})}for(const s of t.colorManagers.values()){const t=s.handleRangeColor(h);if(t)return t}}function Os(t,s,i,e=!0){if(!s)return;const h=d(s)?{value:s}:s;if(d(h.value))return h.value===k?function(){const t=T,s=R+$,i=()=>Math.floor(D(t,s));return{b:i(),g:i(),r:i()}}():function(t,s){return function(t,s){if(s)for(const i of t.colorManagers.values())if(i.accepts(s))return i.parseString(s)}(t,s)}(t,h.value);if(f(h.value)){const s=x(h.value,i,e);if(!s)return;return Os(t,{value:s})}for(const s of t.colorManagers.values()){const t=s.handleColor(h);if(t)return t}}function Rs(t,s,i,e=!0){const h=Ss(t,s,i,e);return h?function(t){const s=t.r/R,i=t.g/R,e=t.b/R,h=Math.max(s,i,e),a=Math.min(s,i,e),d={h:o,l:(h+a)*z,s:c};return h!==a&&(d.s=d.l<z?(h-a)/(h+a):(h-a)/(S-h-a),d.h=s===h?(i-e)/(h-a):i===h?S+(e-s)/(h-a):S*S+(s-i)/(h-a)),d.l*=r,d.s*=l,d.h*=O,d.h<o&&(d.h+=n),d.h>=n&&(d.h-=n),d}(h):void 0}function Ds(t,s,i){return i<0&&i++,i>1&&i--,i*B<1?t+(s-t)*B*i:i*S<1?s:i*I<1*S?t+(s-t)*(S/I-i)*B:t}function $s(t,s,i){const e=s?4:2,h=i??P;return zs(`rgb-${t.r.toFixed(e)}-${t.g.toFixed(e)}-${t.b.toFixed(e)}-${s?"hdr":"sdr"}-${h.toString()}`,(()=>s?function(t,s,i=E){const e=i/203;return`color(display-p3 ${(t.r/R*e).toString()} ${(t.g/R*e).toString()} ${(t.b/R*e).toString()} / ${(s??P).toString()})`}(t,i):function(t,s){return`rgba(${t.r.toString()}, ${t.g.toString()}, ${t.b.toString()}, ${(s??P).toString()})`}(t,i)))}function Ts(t,s,i){const e=s?4:2,h=i??P;return zs(`hsl-${t.h.toFixed(e)}-${t.s.toFixed(e)}-${t.l.toFixed(e)}-${s?"hdr":"sdr"}-${h.toString()}`,(()=>s?$s(function(t){const s=(t.h%n+n)%n,i=Math.max(c,Math.min(l,t.s)),e=Math.max(a,Math.min(r,t.l)),h=s/n,o=i/l,d=e/r;if(i===c){const t=d*R;return{r:t,g:t,b:t}}const f=d<z?d*(H+o):d+o-d*o,u=S*d-f,p=F/I;return{r:Math.min(R,R*Ds(u,f,h+p)),g:Math.min(R,R*Ds(u,f,h)),b:Math.min(R,R*Ds(u,f,h-p))}}(t),!0,i):`hsla(${t.h.toString()}, ${t.s.toString()}%, ${t.l.toString()}%, ${h.toString()})`))}function Es(t){return void 0===t?void 0:{h:t.h.value,s:t.s.value,l:t.l.value}}function Bs(t,s,i){const e=s[i];void 0!==e&&(t[i]=(t[i]??_)*e)}class Is{#h;#o;#n;#a;#r;#t;#c;#l;#d;#f;#u;#p;#s;#v;#w;#g={};#y=[void 0,void 0];#m={};constructor(t,s,i){this.#s=t,this.#t=s,this.#a=i,this.#c=null,this.#h=null,this.#o=new Set,this.#w=[],this.#v=[],this.#n=[],this.#r=[],this.#d=[],this.#f=[],this.#u=[],this.#p={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[]}}get settings(){return this.#l}canvasClear(){this.#t.actualOptions.clear&&this.draw((t=>{t.clearRect(A.x,A.y,this.#a.size.width,this.#a.size.height)}))}clear(){for(const t of this.#n)if(t.canvasClear?.())return;for(const t of Object.values(U))if("number"==typeof t)for(const s of this.#b(t))if(s.canvasClear?.())return;this.canvasClear()}destroy(){this.stop(),this.#h=null,this.#o.clear(),this.#w=[],this.#v=[],this.#n=[],this.#r=[],this.#d=[],this.#f=[],this.#u=[];for(const t of Object.values(U))"number"==typeof t&&(this.#p[t]=[])}draw(t){const s=this.#c;if(s)return t(s)}drawParticle(t,s){if(t.spawning||t.destroyed)return;const i=t.getRadius();if(i<=V)return;const e=t.getFillColor(),h=t.getStrokeColor();let[o,n]=this.#M(t);if(o??=e,n??=h,!o&&!n)return;const a=this.#t,r=t.options.zIndex,c=Y-t.zIndexFactor,{fillOpacity:l,opacity:d,strokeOpacity:f}=t.getOpacity(),u=this.#m,p=this.#g,v=o?Ts(o,a.hdr,l*d):void 0,w=n?Ts(n,a.hdr,f*d):v;u.a=u.b=u.c=u.d=void 0,p.fill=v,p.stroke=w,this.draw((e=>{for(const i of this.#u)i.drawParticleSetup?.(e,t,s);this.#x(e,t,i,d,p,u),this.#P({container:a,context:e,particle:t,delta:s,colorStyles:p,radius:i*c**r.sizeRate,opacity:d,transform:u}),this.#k(t);for(const i of this.#f)i.drawParticleCleanup?.(e,t,s)}))}drawParticlePlugins(t,s){this.draw((i=>{for(const e of this.#d)this.#C(i,e,t,s)}))}drawParticles(t){const{particles:s,actualOptions:i}=this.#t;this.clear(),s.update(t),this.draw((e=>{const h=this.#a.size.width,o=this.#a.size.height;if(this.#h)try{e.drawImage(this.#h,A.x,A.y,h,o)}catch{this.#L("background-element-draw-error","Error drawing background element onto canvas")}const n=i.background;if(n.draw)try{n.draw(e,t)}catch{this.#L("background-draw-error","Error in background.draw callback")}for(const t of this.#b(U.BackgroundMask))t.canvasPaint?.();for(const s of this.#b(U.CanvasSetup))s.drawSettingsSetup?.(e,t);for(const s of this.#b(U.PluginContent))s.draw?.(e,t);s.drawParticles(t);for(const s of this.#b(U.CanvasCleanup))s.clearDraw?.(e,t),s.drawSettingsCleanup?.(e,t)}))}init(){this.initUpdaters(),this.initPlugins(),this.#z(),this.paint()}initPlugins(){this.#n=[],this.#r=[],this.#d=[],this.#u=[],this.#f=[];for(const t of Object.values(U))"number"==typeof t&&(this.#p[t]=[]);for(const t of this.#t.plugins)(t.particleFillColor??t.particleStrokeColor)&&this.#r.push(t),t.drawParticle&&this.#d.push(t),t.drawParticleSetup&&this.#u.push(t),t.drawParticleCleanup&&this.#f.push(t),t.canvasClear&&this.#n.push(t),t.canvasPaint&&this.#b(U.BackgroundMask).push(t),t.drawSettingsSetup&&this.#b(U.CanvasSetup).push(t),t.draw&&this.#b(U.PluginContent).push(t),(t.clearDraw??t.drawSettingsCleanup)&&this.#b(U.CanvasCleanup).push(t)}initUpdaters(){this.#w=[],this.#v=[];for(const t of this.#t.particleUpdaters)t.afterDraw&&this.#v.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this.#w.push(t)}paint(){let t=!1;for(const s of this.#b(U.BackgroundMask))if(t=s.canvasPaint?.()??!1,t)break;t||this.paintBase()}paintBase(t){this.draw((s=>{s.fillStyle=t??"rgba(0,0,0,0)",s.fillRect(A.x,A.y,this.#a.size.width,this.#a.size.height)}))}paintImage(t,s){this.draw((i=>{if(!t)return;const e=i.globalAlpha;i.globalAlpha=s,i.drawImage(t,A.x,A.y,this.#a.size.width,this.#a.size.height),i.globalAlpha=e}))}setContext(t){this.#c=t,this.#c&&(this.#c.globalCompositeOperation=q)}setContextSettings(t){this.#l=t}stop(){this.draw((t=>{t.clearRect(A.x,A.y,this.#a.size.width,this.#a.size.height)}))}#k(t){for(const s of this.#v)s.afterDraw?.(t)}#x(t,s,i,e,h,o){for(const n of this.#w){if(n.getColorStyles){const{fill:o,stroke:a}=n.getColorStyles(s,t,i,e);o&&(h.fill=o),a&&(h.stroke=a)}if(n.getTransformValues){const t=n.getTransformValues(s);for(const s in t)Bs(o,t,s)}n.beforeDraw?.(s)}}#S(t,s){if(!t?.drawAfter)return;const{particle:i}=s;i.effect&&t.drawAfter(s)}#O(t,s){if(!t?.drawBefore)return;const{particle:i}=s;i.effect&&t.drawBefore(s)}#P(t){const{container:s,context:i,particle:e,delta:h,colorStyles:o,radius:n,opacity:a,transform:r}=t,{effectDrawers:c,shapeDrawers:l}=s,d=e.getPosition(),f=e.getTransformData(r),u=W,p={x:d.x,y:d.y};i.setTransform(f.a,f.b,f.c,f.d,d.x,d.y),o.fill&&(i.fillStyle=o.fill);const v=!!e.fillEnabled,w=e.strokeWidth??j;i.lineWidth=w,o.stroke&&(i.strokeStyle=o.stroke);const g={context:i,particle:e,radius:n,drawRadius:n*u,opacity:a,delta:h,pixelRatio:s.retina.pixelRatio,fill:v,stroke:w>j,transformData:f,position:{...d},drawPosition:p,drawScale:u};for(const t of s.plugins)t.drawParticleTransform?.(g);const y=e.effect?c.get(e.effect):void 0,m=e.shape?l.get(e.shape):void 0;this.#O(y,g),this.#R(m,g),this.#D(m,g),this.#$(m,g),this.#S(y,g),i.resetTransform()}#C(t,s,i,e){s.drawParticle&&s.drawParticle(t,i,e)}#D(t,s){if(!t)return;const{context:i,fill:e,particle:h,stroke:o}=s;h.shape&&(i.beginPath(),t.draw(s),h.shapeClose&&i.closePath(),e&&i.fill(),o&&i.stroke())}#$(t,s){if(!t?.afterDraw)return;const{particle:i}=s;i.shape&&t.afterDraw(s)}#R(t,s){if(!t?.beforeDraw)return;const{particle:i}=s;i.shape&&t.beforeDraw(s)}#b(t){return this.#p[t]}#M(t){let s,i;for(const e of this.#r)if(!s&&e.particleFillColor&&(s=Rs(this.#s,e.particleFillColor(t))),!i&&e.particleStrokeColor&&(i=Rs(this.#s,e.particleStrokeColor(t))),s&&i)break;return this.#y[0]=s,this.#y[1]=i,this.#y}#z(){const t=this.#t.actualOptions.background;if(this.#h=null,t.element)if("string"==typeof t.element){if("undefined"!=typeof document){const s=document.querySelector(t.element);s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof HTMLImageElement?this.#h=s:s?this.#L("background-element-not-supported",`Background element "${t.element}" is not a supported drawable element (canvas, video, or img)`):this.#L("background-element-not-found",`Background element selector "${t.element}" not found`)}}else(t.element instanceof HTMLCanvasElement||t.element instanceof OffscreenCanvas||t.element instanceof HTMLVideoElement||t.element instanceof HTMLImageElement)&&(this.#h=t.element)}#L(t,s){this.#o.has(t)||(this.#o.add(t),X().warning(s))}}const Fs=new WeakMap;function Hs(t,s,i=!1){if(!s)return;const e=t.style,h=new Set;for(let t=0;t<e.length;t++){const s=e.item(t);s&&h.add(s)}for(let t=0;t<s.length;t++){const i=s.item(t);i&&h.add(i)}for(const t of h){const h=s.getPropertyValue(t);h?e.setProperty(t,h,i?"important":""):e.removeProperty(t)}}class As{domElement;render;renderCanvas;size;zoom=W;#t;#T;#E;#B;#s;#I;#F;#H;#A;constructor(t,s){this.#s=t,this.#t=s,this.render=new Is(t,s,this),this.#H={height:0,width:0};const i=s.retina.pixelRatio,e=this.#H;this.size={height:e.height*i,width:e.width*i},this.#T=!1,this.#F=[],this.#I="none"}get#U(){return this.#t.actualOptions.fullScreen.enable}destroy(){if(this.stop(),this.#T){const t=this.domElement;t?.remove(),this.domElement=void 0,this.renderCanvas=void 0}else this.#V();this.render.destroy(),this.#F=[]}getZoomCenter(){const t=this.#t.retina.pixelRatio,{width:s,height:i}=this.size;return this.#A?this.#A:{x:s*z/t,y:i*z/t}}init(){this.#q((t=>{t.disconnect()})),this.#E=N((t=>{for(const s of t)"attributes"===s.type&&"style"===s.attributeName&&this.#j()})),this.resize(),this.#W(),this.initBackground(),this.#q((t=>{const s=this.domElement;s&&s instanceof Node&&t.observe(s,{attributes:!0})})),this.initPlugins(),this.#X(),this.render.init()}initBackground(){const t=this.#t,s=t.actualOptions.background,i=this.domElement;if(!i)return;const e=i.style,h=Ss(this.#s,s.color);e.backgroundColor=h?$s(h,t.actualOptions.hdr,s.opacity):"",e.backgroundImage=s.image||"",e.backgroundPosition=s.position||"",e.backgroundRepeat=s.repeat||"",e.backgroundSize=s.size||""}initPlugins(){this.#F=[];for(const t of this.#t.plugins)t.resize&&this.#F.push(t)}loadCanvas(t){this.#T&&this.domElement&&this.domElement.remove();const s=(t=>"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement)(t)?t:void 0;this.domElement=s,this.#T=!!s&&"true"===s.dataset[Z],this.renderCanvas=s?(t=>{const s=Fs.get(t);if(s)return s;if("function"!=typeof t.transferControlToOffscreen)throw new TypeError("OffscreenCanvas is required but not supported by this browser");try{const s=t.transferControlToOffscreen();return Fs.set(t,s),s}catch{throw new TypeError("OffscreenCanvas transfer failed")}})(s):t;const i=this.domElement;i&&(i.ariaHidden="true",this.#B=G(i.style));const e=this.#H,h=this.renderCanvas;i?(e.height=i.offsetHeight,e.width=i.offsetWidth):(e.height=h.height,e.width=h.width);const o=this.#t.retina.pixelRatio,n=this.size;h.height=n.height=e.height*o,h.width=n.width=e.width*o}resize(){const t=this.domElement;if(!t)return!1;const s=this.#t,i=this.renderCanvas;if(void 0===i)return!1;const e=s.canvas.#H,h={width:t.offsetWidth,height:t.offsetHeight},o=s.retina.pixelRatio,n={width:h.width*o,height:h.height*o};if(h.height===e.height&&h.width===e.width&&n.height===i.height&&n.width===i.width)return!1;const a={...e};e.height=h.height,e.width=h.width;const r=this.size;return i.width=r.width=n.width,i.height=r.height=n.height,this.#t.started&&s.particles.setResizeFactor({width:e.width/a.width,height:e.height/a.height}),!0}setPointerEvents(t){this.domElement&&(this.#I=t,this.#j())}setZoom(t,s){this.zoom=t,this.#A=s}stop(){this.#q((t=>{t.disconnect()})),this.#E=void 0,this.render.stop()}async windowResize(){if(!this.domElement||!this.resize())return;const t=this.#t,s=t.updateActualOptions();t.particles.setDensity(),this.#Y(),s&&await t.refresh()}#Y(){for(const t of this.#F)t.resize?.()}#X(){const t=this.#t.actualOptions.hdr&&K("(color-gamut: p3)")?.matches&&K("(dynamic-range: high)")?.matches;this.render.setContextSettings({alpha:!0,desynchronized:!0,willReadFrequently:!1,...t?{colorSpace:"display-p3",colorType:"float16"}:{colorSpace:"srgb"}});const s=this.renderCanvas;s&&this.render.setContext(s.getContext("2d",this.render.settings))}#W(){const t=this.domElement,s=this.#t.actualOptions;if(t){this.#U?this.#_():this.#V();for(const i in s.style){if(!i||!(i in s.style))continue;const e=s.style[i];e&&t.style.setProperty(i,e,"important")}}}#j(){const t=this.domElement;if(!t)return;this.#q((t=>{t.disconnect()})),this.#W(),this.initBackground();const s=this.#I;t.style.pointerEvents=s,t.style.setProperty("pointer-events",s),this.#q((s=>{t instanceof Node&&s.observe(t,{attributes:!0})}))}#V(){const t=this.domElement,s=this.#B;t&&s&&Hs(t,s,!0)}#q(t){this.#E&&t(this.#E)}#_(){const t=this.domElement;t&&Hs(t,Q(this.#t.actualOptions.fullScreen.zIndex),!0)}}class Us{#t;#N;#Z;#G;constructor(t){this.#t=t,this.#N={visibilityChange:()=>{this.#K()},resize:()=>{this.#Q()}}}addListeners(){this.#J(!0)}removeListeners(){this.#J(!1)}#K(){const t=this.#t;t.actualOptions.pauseOnBlur&&(J().hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))}#Q(){this.#G&&(clearTimeout(this.#G),this.#G=void 0);const t=async()=>{const t=this.#t.canvas;await t.windowResize()};this.#G=setTimeout((()=>{t()}),this.#t.actualOptions.resize.delay*tt)}#J(t){const s=this.#N;this.#tt(t),st(document,it,s.visibilityChange,t,!1)}#tt(t){const s=this.#N,i=this.#t;if(!i.actualOptions.resize.enable)return;if("undefined"==typeof ResizeObserver)return void st(globalThis,et,s.resize,t);const e=i.canvas.domElement;this.#Z&&!t?(e&&this.#Z.unobserve(e),this.#Z.disconnect(),this.#Z=void 0):!this.#Z&&t&&e&&(this.#Z=new ResizeObserver((t=>{t.find((t=>t.target===e))&&this.#Q()})),this.#Z.observe(e))}}function Vs(t){if(!Pt(t.outMode,t.checkModes))return;const s=t.radius*S;t.coord>t.maxCoord-s?t.setCb(-t.radius):t.coord<s&&t.setCb(t.radius)}function qs(t,s){const i=t%s;return i<nt?i+s:i}class js{backColor;destroyed;direction;effect;effectClose;effectData;fillColor;fillEnabled;fillOpacity;group;id;ignoresResizeRatio;initialPosition;initialVelocity;isRotating;justWarped;lastPathTime;misplaced;moveCenter;offset;opacity;options;outType;pathRotation;position;randomIndexData;retina;roll;rotation;shape;shapeClose;shapeData;sides;size;spawning;strokeColor;strokeOpacity;strokeWidth;unbreakable;velocity;zIndexFactor;#st={fillOpacity:P,opacity:P,strokeOpacity:P};#it=ht.origin;#et={sin:0,cos:0};#ht={a:1,b:0,c:0,d:1};#t;#ot=[];#s;constructor(t,s){this.#s=t,this.#t=s}addModifier(t){this.#ot.push(t),this.#ot.sort(((t,s)=>t.priority-s.priority))}clearModifiers(){this.#ot.length=0}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.clearModifiers();const s=this.#t,i=this.shape?s.shapeDrawers.get(this.shape):void 0;i?.particleDestroy?.(this);for(const i of s.particleDestroyedPlugins)i.particleDestroyed?.(this,t);for(const i of s.particleUpdaters)i.particleDestroyed?.(this,t);this.#t.dispatchEvent(ot.particleDestroyed,{particle:this})}draw(t){const s=this.#t.canvas.render;s.drawParticlePlugins(this,t),s.drawParticle(this,t)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:nt)}getFillColor(){return this.#nt(this.#at(Es(this.fillColor),(t=>t.fillColor)))}getMass(){return this.getRadius()**i*Math.PI*z}getModifier(t){return this.#ot.find((s=>s.id===t))}getOpacity(){const t=(Y-this.zIndexFactor)**this.options.zIndex.opacityRate,s=Mt(this.opacity?.value??P),i=this.#at(void 0,(t=>t.opacity))??s,e=this.strokeOpacity??P;return this.#st.fillOpacity=i*(this.fillOpacity??P)*t,this.#st.opacity=i*t,this.#st.strokeOpacity=i*e*t,this.#st}getPosition(){return this.#it.x=this.position.x+this.offset.x,this.#it.y=this.position.y+this.offset.y,this.#it.z=this.position.z,this.#it}getRadius(){return this.#at(this.size.value,(t=>t.radius))}getRotateData(){const t=this.getAngle();return this.#et.sin=Math.sin(t),this.#et.cos=Math.cos(t),this.#et}getStrokeColor(){return this.#nt(this.#at(Es(this.strokeColor),(t=>t.strokeColor)))}getTransformData(t){const s=this.getRotateData(),i=this.isRotating;return this.#ht.a=s.cos*(t.a??at.a),this.#ht.b=i?s.sin*(t.b??$):t.b??at.b,this.#ht.c=i?-s.sin*(t.c??$):t.c??at.c,this.#ht.d=s.cos*(t.d??at.d),this.#ht}init(t,s,i,e){const h=this.#t;!function(t,s,i){t.id=s,t.group=i,t.justWarped=!1,t.effectClose=!0,t.shapeClose=!0,t.pathRotation=!1,t.lastPathTime=0,t.destroyed=!1,t.unbreakable=!1,t.isRotating=!1,t.rotation=0,t.misplaced=!1,t.retina={maxDistance:{},maxSpeed:0,moveDrift:0,moveSpeed:0,sizeAnimationSpeed:0},t.size={value:1,max:1,min:1,enable:!1},t.outType=yt.normal,t.ignoresResizeRatio=!0}(this,t,e),this.options=function(t,s,i,e){const h=ks(i,s,s.actualOptions.particles),o=h.reduceDuplicates;t.effect=xt(h.effect.type,t.id,o),t.shape=xt(h.shape.type,t.id,o);const n=h.effect,a=h.shape;if(e){if(e.effect){const s=e.effect.type;if(s&&s!==t.effect){const i=xt(s,t.id,o);i&&(t.effect=i)}n.load(e.effect)}if(e.shape){const s=e.shape.type;if(s&&s!==t.shape){const i=xt(s,t.id,o);i&&(t.shape=i)}a.load(e.shape)}}if(t.effect===k){const i=[...s.effectDrawers.keys()];t.effect=i[Math.floor(ft()*i.length)]}if(t.shape===k){const i=[...s.shapeDrawers.keys()];t.shape=i[Math.floor(ft()*i.length)]}t.effectData=t.effect?function(t,s,i,e){return u({close:s.close},xt(s.options[t],i,e))}(t.effect,n,t.id,o):void 0,t.shapeData=t.shape?function(t,s,i,e){return u({close:s.close},xt(s.options[t],i,e))}(t.shape,a,t.id,o):void 0,h.load(e);const r=t.effectData,c=t.shapeData;return r&&h.load(r.particles),c&&h.load(c.particles),t.effectClose=r?.close??h.effect.close,t.shapeClose=c?.close??h.shape.close,h}(this,h,this.#s,i),h.retina.initParticle(this),function(t,s){for(const i of t)i.preInit?.(s)}(h.particleUpdaters,this),this.#rt(s),this.initialVelocity=this.#ct(),this.velocity=this.initialVelocity.copy(),this.zIndexFactor=this.position.z/h.zLayers,this.sides=24,function(t,s){let i,e;t.effect&&(i=s.effectDrawers.get(t.effect)),i?.loadEffect&&i.loadEffect(t),t.shape&&(e=s.shapeDrawers.get(t.shape)),e?.loadShape&&e.loadShape(t);const h=e?.getSidesCount;h&&(t.sides=h(t))}(this,h),this.spawning=!1,function(t,s){for(const i of t)i.init(s)}(h.particleUpdaters,this),function(t,s){const i=s.shape?t.shapeDrawers.get(s.shape):void 0,e=s.effect?t.effectDrawers.get(s.effect):void 0;e?.particleInit?.(t,s),i?.particleInit?.(t,s)}(h,this),function(t,s){for(const i of t.particleCreatedPlugins)i.particleCreated?.(s)}(h,this)}isInsideCanvas(t){return this.#lt({direction:t}).inside}isInsideCanvasForOutMode(t,s){return this.#lt({direction:s,outMode:t}).inside}isShowingBack(){if(!this.roll)return!1;const t=this.roll.angle;if(this.roll.horizontal&&this.roll.vertical){const s=qs(t,kt);return s>=Math.PI*z&&s<Math.PI*I*z}if(this.roll.horizontal){const s=qs(t+Math.PI*z,kt);return s>=Math.PI&&s<Math.PI*S}if(this.roll.vertical){const s=qs(t,kt);return s>=Math.PI&&s<Math.PI*S}return!1}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}removeModifier(t){const s=this.#ot.findIndex((s=>s.id===t));s>=nt&&this.#ot.splice(s,$)}reset(){for(const t of this.#t.particleUpdaters)t.reset?.(this)}#at(t,s){let i=t;for(const t of this.#ot)if(t.enabled){const e=s(t);void 0!==e&&(i=e)}return i}#dt(t,s){let i=rt,e=t?ht.create(t.x,t.y,s):void 0;const h=this.#t,o=h.particlePositionPlugins,n=this.options.move.outModes,a=this.getRadius(),r=h.canvas.size;for(;;){for(const t of o){const i=t.particlePosition?.(e,this);if(i)return ht.create(i.x,i.y,s)}const t=bt({size:r,position:e}),c=ht.create(t.x,t.y,s);this.#ft(c,a,n.left??n.default),this.#ft(c,a,n.right??n.default),this.#ut(c,a,n.top??n.default),this.#ut(c,a,n.bottom??n.default);let l=!0;for(const t of h.particles.checkParticlePositionPlugins)if(l=t.checkParticlePosition?.(this,c,i)??!0,!l)break;if(l)return c;i+=ct,e=void 0}}#ct(){const t=this.options.move,s=lt(this.direction).copy();if(t.direction===w.inside||t.direction===w.outside)return s;const i=Ct(Mt(t.angle.value)),e=Ct(Mt(t.angle.offset)),o={left:e-i*z,right:e+i*z};return t.straight||(s.angle+=dt(h(o.left,o.right))),t.random&&"number"==typeof t.speed&&(s.length*=ft()),s}#ft(t,s,i){Vs({outMode:i,checkModes:[v.bounce],coord:t.x,maxCoord:this.#t.canvas.size.width,setCb:s=>t.x+=s,radius:s})}#ut(t,s,i){Vs({outMode:i,checkModes:[v.bounce],coord:t.y,maxCoord:this.#t.canvas.size.height,setCb:s=>t.y+=s,radius:s})}#pt(t,s){const i=this.getRadius(),e=this.#t.canvas.size,h=this.position,o=s===v.bounce;return t===ut.bottom?{inside:o?h.y+i<e.height:h.y-i<e.height,reason:"default"}:t===ut.left?{inside:o?h.x-i>nt:h.x+i>nt,reason:"default"}:t===ut.right?{inside:o?h.x+i<e.width:h.x-i<e.width,reason:"default"}:t===ut.top?{inside:o?h.y-i>nt:h.y+i>nt,reason:"default"}:{inside:h.x>=-i&&h.y>=-i&&h.y<=e.height+i&&h.x<=e.width+i,reason:"default"}}#vt(t,s){return{canvasSize:this.#t.canvas.size,direction:t,outMode:s,particle:this,radius:this.getRadius()}}#lt(t){const s=this.#pt(t.direction,t.outMode),i=this.#t,e=this.shape?i.shapeDrawers.get(this.shape):void 0,h=this.effect?i.effectDrawers.get(this.effect):void 0,o=e?.isInsideCanvas,n=h?.isInsideCanvas;if(!o&&!n)return s;const a=this.#vt(t.direction,t.outMode),r=o?this.#wt(o(a),"shape"):void 0,c=n?this.#wt(n(a),"effect"):void 0;if(r&&c){const t=Math.max(r.margin??nt,c.margin??nt);return{inside:r.inside&&c.inside,margin:t>nt?t:void 0,reason:"combined"}}return r??c??s}#nt(t){return t&&this.roll&&(this.backColor||this.roll.alter)&&this.isShowingBack()?this.backColor?this.backColor:this.roll.alter?function(t,s,i){return{h:t.h,s:t.s,l:t.l+(s===C.darken?-L:L)*i}}(t,this.roll.alter.type,this.roll.alter.value):t:t}#rt(t){const s=this.#t,i=Math.floor(Mt(this.options.zIndex.value)),e=this.#dt(t,pt(i,vt,s.zLayers));if(!e)throw new Error("a valid position cannot be found for particle");switch(this.position=e,this.initialPosition=this.position.copy(),this.moveCenter={...wt(this.options.move.center,s.canvas.size),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=gt(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case w.inside:this.outType=yt.inside;break;case w.outside:this.outType=yt.outside}this.offset=mt.origin}#wt(t,s){return"boolean"==typeof t?{inside:t,reason:s}:{inside:t.inside,margin:t.margin,reason:t.reason??s}}}class Ws{#gt;#yt=new Map;#mt=[];#bt;#Mt;#xt=[];#Pt;constructor(t){this.#gt=t,this.#bt=0,this.#Pt=0}clear(){this.#yt.clear();const t=this.#Mt;t&&(this.#gt=t),this.#Mt=void 0}insert(t){const{x:s,y:i}=t.getPosition(),e=this.#kt(s,i);this.#yt.has(e)||this.#yt.set(e,[]),this.#yt.get(e)?.push(t)}query(t,s,i=[]){const e=this.#Ct(t);if(!e)return i;const h=Math.floor(e.minX/this.#gt),o=Math.floor(e.maxX/this.#gt),n=Math.floor(e.minY/this.#gt),a=Math.floor(e.maxY/this.#gt);for(let e=h;e<=o;e++)for(let h=n;h<=a;h++){const o=this.#yt.get(`${e}_${h}`);if(o)for(const e of o)s&&!s(e)||t.contains(e.getPosition())&&i.push(e)}return i}queryCircle(t,s,i,e=[]){const h=this.#Lt(t.x,t.y,s),o=this.query(h,i,e);return this.#zt(),o}queryRectangle(t,s,i,e=[]){const h=this.#St(t.x,t.y,s.width,s.height),o=this.query(h,i,e);return this.#zt(),o}setCellSize(t){this.#Mt=t}#Lt(t,s,i){return(this.#mt[this.#bt++]??=new jt(t,s,i)).reset(t,s,i)}#St(t,s,i,e){return(this.#xt[this.#Pt++]??=new Wt(t,s,i,e)).reset(t,s,i,e)}#kt(t,s){return`${Math.floor(t/this.#gt)}_${Math.floor(s/this.#gt)}`}#Ct(t){if(t instanceof jt){const s=t.radius,{x:i,y:e}=t.position;return{minX:i-s,maxX:i+s,minY:e-s,maxY:e+s}}if(t instanceof Wt){const{x:s,y:i}=t.position,{width:e,height:h}=t.size;return{minX:s,maxX:s+e,minY:i,maxY:i+h}}return null}#zt(){this.#bt=0,this.#Pt=0}}class Xs{checkParticlePositionPlugins;grid;#Ot;#t;#Rt;#Dt;#$t;#Tt;#Et;#Bt;#s;#It;#Ft;#Ht;#At;#Ut;#Vt;constructor(t,s){this.#s=t,this.#t=s,this.#$t=0,this.#Ot=[],this.#It=[],this.#Dt=0,this.#Rt=new Map,this.#Tt=new Map,this.#Vt=this.#qt(this.#t.zLayers),this.grid=new Ws(Lt),this.checkParticlePositionPlugins=[],this.#Et=[],this.#Bt=[],this.#Ht=[],this.#Ft=[],this.#Ut=[]}get count(){return this.#Ot.length}addParticle(t,s,i,e){const h=this.#t.actualOptions.particles.number.limit.mode,o=void 0===i?this.#Dt:this.#Rt.get(i)??this.#Dt,n=this.count;if(o>zt)switch(h){case m.delete:{const t=n+Tt-o;t>St&&this.removeQuantity(t);break}case m.wait:if(n>=o)return}try{const h=this.#It.pop()??new js(this.#s,this.#t);h.init(this.#$t,t,s,i);let o=!0;return e&&(o=e(h)),o?(this.#Ot.push(h),this.#jt(h),this.#$t++,this.#t.dispatchEvent(ot.particleAdded,{particle:h}),h):void this.#It.push(h)}catch(t){X().warning(`error adding particle: ${t}`)}}clear(){this.#Ot=[],this.#Tt.clear(),this.#Wt(this.#t.zLayers)}destroy(){this.#Ot=[],this.#It.length=0,this.#Tt.clear(),this.#Vt=[],this.checkParticlePositionPlugins=[],this.#Et=[],this.#Bt=[],this.#Ht=[],this.#Ft=[],this.#Ut=[]}drawParticles(t){for(let s=this.#Vt.length-Et;s>=Ot;s--){const i=this.#Vt[s];if(i)for(const s of i)s.draw(t)}}filter(t){return this.#Ot.filter(t)}find(t){return this.#Ot.find(t)}get(t){return this.#Ot[t]}async init(){const t=this.#t,s=t.actualOptions;this.checkParticlePositionPlugins=[],this.#Ut=[],this.#Bt=[],this.#Ht=[],this.#Et=[],this.#Ft=[],this.#Tt.clear(),this.#Wt(t.zLayers),this.grid=new Ws(Lt*t.retina.pixelRatio);for(const s of t.plugins)s.redrawInit&&await s.redrawInit(),s.checkParticlePosition&&this.checkParticlePositionPlugins.push(s),s.update&&this.#Ut.push(s),s.particleUpdate&&this.#Bt.push(s),s.postUpdate&&this.#Ht.push(s),s.particleReset&&this.#Et.push(s),s.postParticleUpdate&&this.#Ft.push(s);await this.#t.initDrawersAndUpdaters();for(const s of this.#t.effectDrawers.values())await(s.init?.(t));for(const s of this.#t.shapeDrawers.values())await(s.init?.(t));let i=!1;for(const s of t.plugins)if(i=s.particlesInitialization?.()??i,i)break;if(!i){const t=s.particles,i=t.groups;for(const s in i){const e=i[s];if(e)for(let i=this.count,h=0;h<e.number.value&&i<t.number.value;i++,h++)this.addParticle(void 0,e,s)}for(let s=this.count;s<t.number.value;s++)this.addParticle()}}push(t,s,i,e){for(let h=0;h<t;h++)this.addParticle(s,i,e)}async redraw(){this.clear(),await this.init(),this.#t.canvas.render.drawParticles({value:0,factor:0})}remove(t,s,i){this.removeAt(this.#Ot.indexOf(t),void 0,s,i)}removeAt(t,s=Rt,i,e){if(t<Ot||t>this.count)return;let h=0;for(let o=t;h<s&&o<this.count;o++)this.#Xt(o,i,e)&&(o--,h++)}removeQuantity(t,s){this.removeAt(Ot,t,s)}setDensity(){const t=this.#t.actualOptions,s=t.particles.groups;let i=0;for(const t of this.#t.plugins)t.particlesDensityCount&&(i+=t.particlesDensityCount());for(const t in s){const e=s[t];if(!e)continue;const h=ks(this.#s,this.#t,e);this.#Yt(h,i,t)}this.#Yt(t.particles,i)}setResizeFactor(t){this.#At=t}update(t){this.grid.clear();for(const s of this.#Ut)s.update?.(t);const s=this.#_t(t);for(const s of this.#Ht)s.postUpdate?.(t);if(this.#Nt(t,s),s.size)for(const t of s)this.remove(t);this.#At=void 0}#Zt(...t){this.#It.push(...t)}#Yt(t,s,i,e){const h=t.number;if(!h.density.enable)return void(void 0===i?this.#Dt=h.limit.value:(e?.number.limit.value??h.limit.value)&&this.#Rt.set(i,e?.number.limit.value??h.limit.value));const o=this.#Gt(h.density),n=h.value,a=Math.min(n,h.limit.value>zt?h.limit.value:n)*o+s,r=Math.min(this.count,this.filter((t=>t.group===i)).length);void 0===i?this.#Dt=h.limit.value*o:this.#Rt.set(i,h.limit.value*o),r<a?this.push(Math.abs(a-r),void 0,t,i):r>a&&this.removeQuantity(r-a,i)}#qt(t){const s=Math.max(Math.floor(t),Et);return Array.from({length:s},(()=>[]))}#Kt(t){const s=this.#Vt.length-Et;return s<=Ot?Ot:Math.min(Math.max(Math.floor(t),Ot),s)}#Gt(t){const s=this.#t;if(!t.enable)return Dt;const e=s.canvas.size;return e.width&&e.height?e.width*e.height/(t.height*t.width*s.retina.pixelRatio**i):Dt}#jt(t){const s=this.#Kt(t.position.z),i=this.#Vt[s];i&&(i.push(t),this.#Tt.set(t.id,s))}#Xt(t,s,i){const e=this.#Ot[t];return!!e&&e.group===s&&(this.#Ot.splice(t,$t),this.#Qt(e),e.destroy(i),this.#t.dispatchEvent(ot.particleRemoved,{particle:e}),this.#Zt(e),!0)}#Qt(t){const s=this.#Tt.get(t.id)??this.#Kt(t.position.z),i=this.#Vt[s];if(!i)return void this.#Tt.delete(t.id);const e=i.findIndex((s=>s.id===t.id));e>=Ot&&i.splice(e,$t),this.#Tt.delete(t.id)}#Wt(t){const s=Math.max(Math.floor(t),Et);if(this.#Vt.length===s)for(const t of this.#Vt)t.length=Ot;else this.#Vt=this.#qt(s)}#Jt(t){const s=this.#Kt(t.position.z),i=this.#Tt.get(t.id);if(void 0===i)return void this.#jt(t);if(i===s)return;const e=this.#Vt[i];if(e){const s=e.findIndex((s=>s.id===t.id));s>=Ot&&e.splice(s,$t)}const h=this.#Vt[s];if(h){if(h.push(t),h.length>=S){const s=h[h.length-S];s&&t.id<s.id&&h.sort(((t,s)=>t.id-s.id))}this.#Tt.set(t.id,s)}else this.#Tt.set(t.id,s)}#_t(t){const s=new Set,i=this.#At;for(const e of this.#Ot){i&&!e.ignoresResizeRatio&&(e.position.x*=i.width,e.position.y*=i.height,e.initialPosition.x*=i.width,e.initialPosition.y*=i.height),e.ignoresResizeRatio=!1;for(const t of this.#Et)t.particleReset?.(e);for(const s of this.#Bt){if(e.destroyed)break;s.particleUpdate?.(e,t)}e.destroyed?s.add(e):this.grid.insert(e)}return s}#Nt(t,s){for(const i of this.#Ot)if(i.destroyed)s.add(i);else{for(const s of this.#t.particleUpdaters)s.update(i,t);if(!i.spawning)for(const s of this.#Ft)s.postParticleUpdate?.(i,t);this.#Jt(i)}}}class Ys{pixelRatio;reduceFactor;#t;constructor(t){this.#t=t,this.pixelRatio=Bt,this.reduceFactor=It}init(){const t=this.#t;this.pixelRatio=t.actualOptions.detectRetina?devicePixelRatio:Bt,this.reduceFactor=It;const s=this.pixelRatio,i=t.canvas,e=i.domElement;e&&(i.size.width=e.offsetWidth*s,i.size.height=e.offsetHeight*s)}initParticle(t){const s=this.pixelRatio,i=t.options.move,e=i.distance,h=t.retina;h.maxSpeed=Mt(i.gravity.maxSpeed)*s,h.moveDrift=Mt(i.drift)*s,h.moveSpeed=Mt(i.speed)*s;const o=h.maxDistance;o.horizontal=void 0===e.horizontal?void 0:e.horizontal*s,o.vertical=void 0===e.vertical?void 0:e.vertical*s}}function _s(t){return!t.destroyed}function Ns(t,s,...i){const e=new Cs(t,s);return Yt(e,...i),e}class Zs{actualOptions;canvas;destroyed;effectDrawers;fpsLimit;hdr;id;pageHidden;particleCreatedPlugins;particleDestroyedPlugins;particlePositionPlugins;particleUpdaters;particles;plugins;retina;shapeDrawers;started;zLayers;#ts;#ss;#is={value:0,factor:0};#es;#hs;#os;#ns;#as;#rs;#cs;#ls;#ds;#fs;#us;#s;#ps;#vs;constructor(t){const{dispatchCallback:s,pluginManager:i,id:e,onDestroy:h,sourceOptions:o}=t;this.#s=i,this.#es=s,this.#ds=h,this.id=Symbol(e),this.fpsLimit=120,this.hdr=!1,this.#ps=!1,this.#ts=0,this.#os=0,this.#ls=0,this.#as=!0,this.started=!1,this.destroyed=!1,this.#us=!0,this.#cs=0,this.zLayers=100,this.pageHidden=!1,this.#vs=o,this.#rs=o,this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.retina=new Ys(this),this.canvas=new As(this.#s,this),this.particles=new Xs(this.#s,this),this.plugins=[],this.particleDestroyedPlugins=[],this.particleCreatedPlugins=[],this.particlePositionPlugins=[],this.#fs=Ns(this.#s,this),this.actualOptions=Ns(this.#s,this),this.#ns=new Us(this),this.dispatchEvent(ot.containerBuilt)}get animationStatus(){return!this.#us&&!this.pageHidden&&_s(this)}get options(){return this.#fs}get sourceOptions(){return this.#vs}addLifeTime(t){this.#ls+=t}alive(){return!this.#os||this.#ls<=this.#os}destroy(t=!0){if(_s(this)){this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.effectDrawers)t.destroy?.(this);for(const[,t]of this.shapeDrawers)t.destroy?.(this);for(const t of this.plugins)t.destroy?.();this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.plugins.length=0,this.#s.clearPlugins(this),this.destroyed=!0,this.#ds(t),this.dispatchEvent(ot.containerDestroyed)}}dispatchEvent(t,s){this.#es(t,{container:this,data:s})}draw(t){if(!_s(this))return;let s=t;this.#hs=Ft((t=>{s&&(this.#cs=void 0,s=!1),this.#ws(t)}))}async export(t,s={}){for(const i of this.plugins){if(!i.export)continue;const e=await i.export(t,s);if(e.supported)return e.blob}X().error(`Export plugin with type ${t} not found`)}async init(){if(!_s(this))return;const t=new Map;for(const s of this.#s.plugins){const i=await s.getPlugin(this);i.preInit&&await i.preInit(),t.set(s,i)}await this.initDrawersAndUpdaters(),this.#fs=Ns(this.#s,this,this.#rs,this.sourceOptions),this.actualOptions=Ns(this.#s,this,this.#fs),this.plugins.length=0,this.particleDestroyedPlugins.length=0,this.particleCreatedPlugins.length=0,this.particlePositionPlugins.length=0;for(const[s,i]of t)s.needsPlugin(this.actualOptions)&&(this.plugins.push(i),i.particleCreated&&this.particleCreatedPlugins.push(i),i.particleDestroyed&&this.particleDestroyedPlugins.push(i),i.particlePosition&&this.particlePositionPlugins.push(i));this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();const{delay:s,duration:i,fpsLimit:e,hdr:h,smooth:o,zLayers:n}=this.actualOptions;this.hdr=h,this.zLayers=n,this.#os=Mt(i)*tt,this.#ts=Mt(s)*tt,this.#ls=0,this.fpsLimit=e>At?e:Ht,this.#ps=o;for(const t of this.plugins)await(t.init?.());await this.particles.init(),this.dispatchEvent(ot.containerInit),this.particles.setDensity();for(const t of this.plugins)t.particlesSetup?.();this.dispatchEvent(ot.particlesSetup)}async initDrawersAndUpdaters(){const t=this.#s;this.effectDrawers=await t.getEffectDrawers(this,!0),this.shapeDrawers=await t.getShapeDrawers(this,!0),this.particleUpdaters=await t.getUpdaters(this,!0)}pause(){if(_s(this)&&(void 0!==this.#hs&&(Ut(this.#hs),this.#hs=void 0),!this.#us)){for(const t of this.plugins)t.pause?.();this.pageHidden||(this.#us=!0),this.dispatchEvent(ot.containerPaused)}}play(t){if(!_s(this))return;const s=this.#us||t;if(!this.#as||this.actualOptions.autoPlay){if(this.#us&&(this.#us=!1),s)for(const t of this.plugins)t.play&&t.play();this.dispatchEvent(ot.containerPlay),this.draw(s??!1)}else this.#as=!1}async refresh(){if(_s(this))return this.stop(),this.start()}async reset(t){if(_s(this))return this.#rs=t,this.#vs=t,this.#fs=Ns(this.#s,this,this.#rs,this.sourceOptions),this.actualOptions=Ns(this.#s,this,this.#fs),this.refresh()}async start(){_s(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{const s=async()=>{this.#ns.addListeners();for(const t of this.plugins)await(t.start?.());this.dispatchEvent(ot.containerStarted),this.play(),t()};this.#ss=setTimeout((()=>{s()}),this.#ts)})))}stop(){if(_s(this)&&this.started){this.#ss&&(clearTimeout(this.#ss),this.#ss=void 0),this.#as=!0,this.started=!1,this.#ns.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop();for(const t of this.plugins)t.stop?.();this.particleCreatedPlugins.length=0,this.particleDestroyedPlugins.length=0,this.particlePositionPlugins.length=0,this.#vs=this.#fs,this.dispatchEvent(ot.containerStopped)}}updateActualOptions(){let t=!1;for(const s of this.plugins)s.updateActualOptions&&(t=s.updateActualOptions()||t);return t}#ws(t){try{if(!this.#ps&&void 0!==this.#cs&&t<this.#cs+tt/this.fpsLimit)return void this.draw(!1);if(this.#cs??=t,function(t,s,i=Vt,e=!1){t.value=s,t.factor=e?Vt/i:Vt*s/tt}(this.#is,t-this.#cs,this.fpsLimit,this.#ps),this.addLifeTime(this.#is.value),this.#cs=t,this.#is.value>tt)return void this.draw(!1);if(this.canvas.render.drawParticles(this.#is),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){X().error("error in animation loop",t)}}}export{Zs as Container}
1
+ import{R as t,c as s,s as i,a as e,b as h,h as o,d as n,l as a,e as r,f as c,g as l,j as d,k as f,m as u,P as p,O as v,M as w,n as g,o as y,L as m,p as b,q as M,r as x,u as P,v as k,A as C,w as L,x as z,y as S,z as O,B as R,C as D,D as $,E as T,F as E,G as B,H as I,I as F,J as H,K as A,N as U,Q as V,S as q,T as j,U as W,V as X,W as Y,X as _,Y as N,Z,_ as G,$ as K,a0 as Q,a1 as J,a2 as tt,a3 as st,a4 as it,a5 as et,a6 as ht,a7 as ot,a8 as nt,a9 as at,aa as rt,ab as ct,ac as lt,ad as dt,ae as ft,af as ut,ag as pt,ah as vt,ai as wt,aj as gt,ak as yt,al as mt,am as bt,an as Mt,ao as xt,ap as Pt,aq as kt,ar as Ct,as as Lt,at as zt,au as St,av as Ot,aw as Rt,ax as Dt,ay as $t,az as Tt,aA as Et,aB as Bt,aC as It,aD as Ft,aE as Ht,aF as At,aG as Ut,aH as Vt}from"./p-CtlWkxPP.js";class qt{position;type;constructor(t,s,i){this.position={x:t,y:s},this.type=i}_resetPosition(t,s){this.position.x=t,this.position.y=s}}class jt extends qt{radius;constructor(s,i,e){super(s,i,t.circle),this.radius=e}contains(t){return s(t,this.position,this.radius)}intersects(s){const e=this.position,h=s.position,o=this.radius,n=Math.abs(h.x-e.x),a=Math.abs(h.y-e.y);if(s instanceof jt||s.type===t.circle)return o+s.radius>Math.hypot(n,a);if(s instanceof Wt||s.type===t.rectangle){const t=s,{width:e,height:h}=t.size;return Math.pow(n-e,i)+Math.pow(a-h,i)<=o**i||n<=o+e&&a<=o+h||n<=e||a<=h}return!1}reset(t,s,i){return this._resetPosition(t,s),this.radius=i,this}}class Wt extends qt{size;constructor(s,i,e,h){super(s,i,t.rectangle),this.size={height:h,width:e}}contains(t){const s=this.position;return t.x>=s.x&&t.x<=s.x+this.size.width&&t.y>=s.y&&t.y<=s.y+this.size.height}intersects(t){if(t instanceof jt)return t.intersects(this);if(!(t instanceof Wt))return!1;const s=this.position,i=t.position,e=t.size;return i.x<s.x+this.size.width&&i.x+e.width>s.x&&i.y<s.y+this.size.height&&i.y+e.height>s.y}reset(t,s,i,e){return this._resetPosition(t,s),this.size.width=i,this.size.height=e,this}}class Xt{load(t){e(t)||this.doLoad(t)}}function Yt(t,...s){for(const i of s)t.load(i)}function _t(t,s,i){void 0!==i&&(t[s]=i)}function Nt(t,s,i){void 0!==i&&(t[s]=h(i))}function Zt(t,s,i,e){if(void 0!==i){const h=t;h[s]??=e(),h[s].load(i)}}class Gt extends Xt{count=0;decay=0;delay=0;enable=!1;speed=1;sync=!1;doLoad(t){Nt(this,"count",t.count),_t(this,"enable",t.enable),Nt(this,"speed",t.speed),Nt(this,"decay",t.decay),Nt(this,"delay",t.delay),_t(this,"sync",t.sync)}}class Kt extends Gt{max;min;offset=0;sync=!0;constructor(t,s){super(),this.min=t,this.max=s}doLoad(t){super.doLoad(t),_t(this,"max",t.max),_t(this,"min",t.min),Nt(this,"offset",t.offset)}}class Qt extends Xt{h=new Kt(o,n);l=new Kt(a,r);s=new Kt(c,l);doLoad(t){this.h.load(t.h),this.s.load(t.s),this.l.load(t.l)}}class Jt extends Xt{value="";static create(t,s){const i=new Jt;return i.load(t),void 0!==s&&(d(s)||f(s)?i.load({value:s}):i.load(s)),i}doLoad(t){e(t.value)||(this.value=t.value)}}class ts extends Jt{animation=new Qt;static create(t,s){const i=new ts;return i.load(t),void 0!==s&&(d(s)||f(s)?i.load({value:s}):i.load(s)),i}doLoad(t){super.doLoad(t);const s=t.animation;void 0!==s&&(void 0===s.enable?this.animation.load(t.animation):this.animation.h.load(s))}}class ss extends Xt{color;draw;element;image="";opacity=1;position="";repeat="";size="";constructor(){super(),this.color=new Jt,this.color.value=""}doLoad(t){void 0!==t.color&&(this.color=Jt.create(this.color,t.color)),_t(this,"element",t.element),_t(this,"draw",t.draw),_t(this,"image",t.image),_t(this,"position",t.position),_t(this,"repeat",t.repeat),_t(this,"size",t.size),_t(this,"opacity",t.opacity)}}class is extends Xt{enable=!0;zIndex=0;doLoad(t){_t(this,"enable",t.enable),_t(this,"zIndex",t.zIndex)}}class es extends Xt{delay=.5;enable=!0;doLoad(t){_t(this,"delay",t.delay),_t(this,"enable",t.enable)}}class hs extends Xt{close=!0;options={};type=[];doLoad(t){const s=t.options;if(void 0!==s)for(const t in s){const i=s[t];i&&(this.options[t]=u(this.options[t]??{},i))}_t(this,"close",t.close),_t(this,"type",t.type)}}class os extends Xt{color;enable=!0;opacity=1;doLoad(t){void 0!==t.color&&(this.color=ts.create(this.color,t.color)),_t(this,"enable",t.enable),Nt(this,"opacity",t.opacity)}}class ns extends Xt{offset=0;value=90;doLoad(t){Nt(this,"offset",t.offset),Nt(this,"value",t.value)}}class as extends Xt{mode=p.percent;radius=0;x=50;y=50;doLoad(t){_t(this,"x",t.x),_t(this,"y",t.y),_t(this,"mode",t.mode),_t(this,"radius",t.radius)}}class rs extends Xt{acceleration=9.81;enable=!1;inverse=!1;maxSpeed=50;doLoad(t){Nt(this,"acceleration",t.acceleration),_t(this,"enable",t.enable),_t(this,"inverse",t.inverse),Nt(this,"maxSpeed",t.maxSpeed)}}class cs extends Xt{value=0;doLoad(t){e(t.value)||(this.value=h(t.value))}}class ls extends Xt{clamp=!0;delay=new cs;enable=!1;generator;options={};doLoad(t){_t(this,"clamp",t.clamp),this.delay.load(t.delay),_t(this,"enable",t.enable),this.generator=t.generator,t.options&&(this.options=u(this.options,t.options))}}class ds extends Xt{bottom;default=v.out;left;right;top;doLoad(t){void 0!==t.default&&(this.default=t.default),this.bottom=t.bottom??t.default,this.left=t.left??t.default,this.right=t.right??t.default,this.top=t.top??t.default}}class fs extends Xt{acceleration=0;enable=!1;position;doLoad(t){Nt(this,"acceleration",t.acceleration),_t(this,"enable",t.enable),t.position&&(this.position=u({},t.position))}}class us extends Xt{angle=new ns;center=new as;decay=0;direction=w.none;distance={};drift=0;enable=!1;gravity=new rs;outModes=new ds;path=new ls;random=!1;size=!1;speed=2;spin=new fs;straight=!1;vibrate=!1;warp=!1;doLoad(t){this.angle.load(g(t.angle)?{value:t.angle}:t.angle),this.center.load(t.center),Nt(this,"decay",t.decay),_t(this,"direction",t.direction),void 0!==t.distance&&(this.distance=g(t.distance)?{horizontal:t.distance,vertical:t.distance}:{...t.distance}),Nt(this,"drift",t.drift),_t(this,"enable",t.enable),this.gravity.load(t.gravity);const s=t.outModes;void 0!==s&&(y(s)?this.outModes.load(s):this.outModes.load({default:s})),this.path.load(t.path),_t(this,"random",t.random),_t(this,"size",t.size),Nt(this,"speed",t.speed),this.spin.load(t.spin),_t(this,"straight",t.straight),_t(this,"vibrate",t.vibrate),_t(this,"warp",t.warp)}}class ps extends Xt{color;opacity;width=0;doLoad(t){void 0!==t.color&&(this.color=ts.create(this.color,t.color)),Nt(this,"width",t.width),Nt(this,"opacity",t.opacity)}}class vs extends Xt{color;fill;stroke;doLoad(t){void 0!==t.color&&(this.color=ts.create(this.color,t.color)),Zt(this,"fill",t.fill,(()=>new os)),Zt(this,"stroke",t.stroke,(()=>new ps))}}class ws extends cs{value=1}class gs extends Xt{horizontal=new ws;vertical=new ws;doLoad(t){this.horizontal.load(t.horizontal),this.vertical.load(t.vertical)}}class ys extends Xt{enable=!1;height=1080;width=1920;doLoad(t){_t(this,"enable",t.enable),_t(this,"width",t.width),_t(this,"height",t.height)}}class ms extends Xt{mode=m.delete;value=0;doLoad(t){_t(this,"mode",t.mode),_t(this,"value",t.value)}}class bs extends Xt{density=new ys;limit=new ms;value=0;doLoad(t){this.density.load(t.density),this.limit.load(t.limit),_t(this,"value",t.value)}}class Ms extends Xt{close=!0;options={};type="circle";doLoad(t){const s=t.options;if(void 0!==s)for(const t in s){const i=s[t];i&&(this.options[t]=u(this.options[t]??{},i))}_t(this,"close",t.close),_t(this,"type",t.type)}}class xs extends cs{opacityRate=1;sizeRate=1;velocityRate=1;doLoad(t){super.doLoad(t),_t(this,"opacityRate",t.opacityRate),_t(this,"sizeRate",t.sizeRate),_t(this,"velocityRate",t.velocityRate)}}class Ps extends Xt{bounce=new gs;effect=new hs;groups={};move=new us;number=new bs;paint;palette;reduceDuplicates=!1;shape=new Ms;zIndex=new xs;#t;#s;constructor(t,s){super(),this.#s=t,this.#t=s,this.paint=new vs,this.paint.color=new ts,this.paint.color.value="#fff",this.paint.fill=new os,this.paint.fill.enable=!0}doLoad(t){if(t.palette&&(this.palette=t.palette,this.#i(this.palette)),void 0!==t.groups)for(const s of Object.keys(t.groups)){if(!(s in t.groups))continue;const i=t.groups[s];void 0!==i&&(this.groups[s]=u(this.groups[s]??{},i))}void 0!==t.reduceDuplicates&&(this.reduceDuplicates=t.reduceDuplicates),this.bounce.load(t.bounce),this.effect.load(t.effect),this.move.load(t.move),this.number.load(t.number);const s=t.paint;if(s&&(f(s)?this.paint=b(s,(t=>{const s=new vs;return s.load(t),s})):f(this.paint)?(this.paint=new vs,this.paint.load(s)):this.paint.load(s)),this.shape.load(t.shape),this.zIndex.load(t.zIndex),this.#t){for(const s of this.#s.plugins)s.loadParticlesOptions&&s.loadParticlesOptions(this.#t,this,t);const s=this.#s.updaters.get(this.#t);if(s)for(const i of s)i.loadOptions&&i.loadOptions(this,t)}}#i(t){const s=this.#s.getPalette(t);if(!s)return;const i=s.colors,e=(f(i)?i:[i]).flatMap((t=>{const s=t.fill,i=t.stroke,e=s?{color:{value:s.value},enable:s.enable,opacity:s.opacity}:void 0;return i?[{fill:e,stroke:{color:{value:i.value},opacity:i.opacity,width:i.width||0}}]:[{fill:e}]}));this.load({paint:e.length>1?e:e[0]??{},blend:{enable:!0,mode:s.blendMode}})}}function ks(t,s,...i){const e=new Ps(t,s);return Yt(e,...i),e}class Cs extends Xt{autoPlay=!0;background;clear=!0;defaultThemes={};delay=0;detectRetina=!0;duration=0;fpsLimit=120;fullScreen;hdr=!0;key;name;palette;particles;pauseOnBlur=!0;pauseOnOutsideViewport=!0;preset;resize;smooth=!1;style={};zLayers=100;#t;#s;constructor(t,s){super(),this.#s=t,this.#t=s,this.background=new ss,this.fullScreen=new is,this.particles=ks(this.#s,this.#t),this.resize=new es}doLoad(t){void 0!==t.preset&&(this.preset=t.preset,b(this.preset,(t=>{this.#e(t)}))),void 0!==t.palette&&(this.palette=t.palette,this.#i(this.palette)),_t(this,"autoPlay",t.autoPlay),_t(this,"clear",t.clear),_t(this,"key",t.key),_t(this,"name",t.name),Nt(this,"delay",t.delay),_t(this,"detectRetina",t.detectRetina),Nt(this,"duration",t.duration),_t(this,"fpsLimit",t.fpsLimit),_t(this,"hdr",t.hdr),_t(this,"pauseOnBlur",t.pauseOnBlur),_t(this,"pauseOnOutsideViewport",t.pauseOnOutsideViewport),_t(this,"zLayers",t.zLayers),this.background.load(t.background);const s=t.fullScreen;M(s)?this.fullScreen.enable=s:this.fullScreen.load(s),this.particles.load(t.particles),this.resize.load(t.resize),this.style=u(this.style,t.style),_t(this,"smooth",t.smooth),this.#s.plugins.forEach((s=>{s.loadOptions(this.#t,this,t)}))}#i(t){const s=this.#s.getPalette(t);s&&this.load({background:{color:s.background},blend:{enable:!0,mode:s.blendMode},particles:{palette:t}})}#e(t){this.load(this.#s.getPreset(t))}}const Ls=new Map;function zs(t,s){let i=Ls.get(t);return i||(i=s(),Ls.size>2e3&&Ls.clear(),Ls.set(t,i)),i}function Ss(t,s,i,e=!0){if(!s)return;const h=d(s)?{value:s}:s;if(d(h.value))return Os(t,h.value,i,e);if(f(h.value)){const s=x(h.value,i,e);if(!s)return;return Ss(t,{value:s})}for(const s of t.colorManagers.values()){const t=s.handleRangeColor(h);if(t)return t}}function Os(t,s,i,e=!0){if(!s)return;const h=d(s)?{value:s}:s;if(d(h.value))return h.value===k?function(){const t=T,s=R+$,i=()=>Math.floor(D(t,s));return{b:i(),g:i(),r:i()}}():function(t,s){return function(t,s){if(s)for(const i of t.colorManagers.values())if(i.accepts(s))return i.parseString(s)}(t,s)}(t,h.value);if(f(h.value)){const s=x(h.value,i,e);if(!s)return;return Os(t,{value:s})}for(const s of t.colorManagers.values()){const t=s.handleColor(h);if(t)return t}}function Rs(t,s,i,e=!0){const h=Ss(t,s,i,e);return h?function(t){const s=t.r/R,i=t.g/R,e=t.b/R,h=Math.max(s,i,e),a=Math.min(s,i,e),d={h:o,l:(h+a)*z,s:c};return h!==a&&(d.s=d.l<z?(h-a)/(h+a):(h-a)/(S-h-a),d.h=s===h?(i-e)/(h-a):i===h?S+(e-s)/(h-a):S*S+(s-i)/(h-a)),d.l*=r,d.s*=l,d.h*=O,d.h<o&&(d.h+=n),d.h>=n&&(d.h-=n),d}(h):void 0}function Ds(t,s,i){return i<0&&i++,i>1&&i--,i*B<1?t+(s-t)*B*i:i*S<1?s:i*I<1*S?t+(s-t)*(S/I-i)*B:t}function $s(t,s,i){const e=s?4:2,h=i??P;return zs(`rgb-${t.r.toFixed(e)}-${t.g.toFixed(e)}-${t.b.toFixed(e)}-${s?"hdr":"sdr"}-${h.toString()}`,(()=>s?function(t,s,i=E){const e=i/203;return`color(display-p3 ${(t.r/R*e).toString()} ${(t.g/R*e).toString()} ${(t.b/R*e).toString()} / ${(s??P).toString()})`}(t,i):function(t,s){return`rgba(${t.r.toString()}, ${t.g.toString()}, ${t.b.toString()}, ${(s??P).toString()})`}(t,i)))}function Ts(t,s,i){const e=s?4:2,h=i??P;return zs(`hsl-${t.h.toFixed(e)}-${t.s.toFixed(e)}-${t.l.toFixed(e)}-${s?"hdr":"sdr"}-${h.toString()}`,(()=>s?$s(function(t){const s=(t.h%n+n)%n,i=Math.max(c,Math.min(l,t.s)),e=Math.max(a,Math.min(r,t.l)),h=s/n,o=i/l,d=e/r;if(i===c){const t=d*R;return{r:t,g:t,b:t}}const f=d<z?d*(H+o):d+o-d*o,u=S*d-f,p=F/I;return{r:Math.min(R,R*Ds(u,f,h+p)),g:Math.min(R,R*Ds(u,f,h)),b:Math.min(R,R*Ds(u,f,h-p))}}(t),!0,i):`hsla(${t.h.toString()}, ${t.s.toString()}%, ${t.l.toString()}%, ${h.toString()})`))}function Es(t){return void 0===t?void 0:{h:t.h.value,s:t.s.value,l:t.l.value}}function Bs(t,s,i){const e=s[i];void 0!==e&&(t[i]=(t[i]??_)*e)}class Is{#h;#o;#n;#a;#r;#t;#c;#l;#d;#f;#u;#p;#s;#v;#w;#g={};#y=[void 0,void 0];#m={};constructor(t,s,i){this.#s=t,this.#t=s,this.#a=i,this.#c=null,this.#h=null,this.#o=new Set,this.#w=[],this.#v=[],this.#n=[],this.#r=[],this.#d=[],this.#f=[],this.#u=[],this.#p={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[]}}get settings(){return this.#l}canvasClear(){this.#t.actualOptions.clear&&this.draw((t=>{t.clearRect(A.x,A.y,this.#a.size.width,this.#a.size.height)}))}clear(){for(const t of this.#n)if(t.canvasClear?.())return;for(const t of Object.values(U))if("number"==typeof t)for(const s of this.#b(t))if(s.canvasClear?.())return;this.canvasClear()}destroy(){this.stop(),this.#h=null,this.#o.clear(),this.#w=[],this.#v=[],this.#n=[],this.#r=[],this.#d=[],this.#f=[],this.#u=[];for(const t of Object.values(U))"number"==typeof t&&(this.#p[t]=[])}draw(t){const s=this.#c;if(s)return t(s)}drawParticle(t,s){if(t.spawning||t.destroyed)return;const i=t.getRadius();if(i<=V)return;const e=t.getFillColor(),h=t.getStrokeColor();let[o,n]=this.#M(t);if(o??=e,n??=h,!o&&!n)return;const a=this.#t,r=t.options.zIndex,c=Y-t.zIndexFactor,{fillOpacity:l,opacity:d,strokeOpacity:f}=t.getOpacity(),u=this.#m,p=this.#g,v=o?Ts(o,a.hdr,l*d):void 0,w=n?Ts(n,a.hdr,f*d):v;u.a=u.b=u.c=u.d=void 0,p.fill=v,p.stroke=w,this.draw((e=>{for(const i of this.#u)i.drawParticleSetup?.(e,t,s);this.#x(e,t,i,d,p,u),this.#P({container:a,context:e,particle:t,delta:s,colorStyles:p,radius:i*c**r.sizeRate,opacity:d,transform:u}),this.#k(t);for(const i of this.#f)i.drawParticleCleanup?.(e,t,s)}))}drawParticlePlugins(t,s){this.draw((i=>{for(const e of this.#d)this.#C(i,e,t,s)}))}drawParticles(t){const{particles:s,actualOptions:i}=this.#t;this.clear(),s.update(t),this.draw((e=>{const h=this.#a.size.width,o=this.#a.size.height;if(this.#h)try{e.drawImage(this.#h,A.x,A.y,h,o)}catch{this.#L("background-element-draw-error","Error drawing background element onto canvas")}const n=i.background;if(n.draw)try{n.draw(e,t)}catch{this.#L("background-draw-error","Error in background.draw callback")}for(const t of this.#b(U.BackgroundMask))t.canvasPaint?.();for(const s of this.#b(U.CanvasSetup))s.drawSettingsSetup?.(e,t);for(const s of this.#b(U.PluginContent))s.draw?.(e,t);s.drawParticles(t);for(const s of this.#b(U.CanvasCleanup))s.clearDraw?.(e,t),s.drawSettingsCleanup?.(e,t)}))}init(){this.initUpdaters(),this.initPlugins(),this.#z(),this.paint()}initPlugins(){this.#n=[],this.#r=[],this.#d=[],this.#u=[],this.#f=[];for(const t of Object.values(U))"number"==typeof t&&(this.#p[t]=[]);for(const t of this.#t.plugins)(t.particleFillColor??t.particleStrokeColor)&&this.#r.push(t),t.drawParticle&&this.#d.push(t),t.drawParticleSetup&&this.#u.push(t),t.drawParticleCleanup&&this.#f.push(t),t.canvasClear&&this.#n.push(t),t.canvasPaint&&this.#b(U.BackgroundMask).push(t),t.drawSettingsSetup&&this.#b(U.CanvasSetup).push(t),t.draw&&this.#b(U.PluginContent).push(t),(t.clearDraw??t.drawSettingsCleanup)&&this.#b(U.CanvasCleanup).push(t)}initUpdaters(){this.#w=[],this.#v=[];for(const t of this.#t.particleUpdaters)t.afterDraw&&this.#v.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this.#w.push(t)}paint(){let t=!1;for(const s of this.#b(U.BackgroundMask))if(t=s.canvasPaint?.()??!1,t)break;t||this.paintBase()}paintBase(t){this.draw((s=>{s.fillStyle=t??"rgba(0,0,0,0)",s.fillRect(A.x,A.y,this.#a.size.width,this.#a.size.height)}))}paintImage(t,s){this.draw((i=>{if(!t)return;const e=i.globalAlpha;i.globalAlpha=s,i.drawImage(t,A.x,A.y,this.#a.size.width,this.#a.size.height),i.globalAlpha=e}))}setContext(t){this.#c=t,this.#c&&(this.#c.globalCompositeOperation=q)}setContextSettings(t){this.#l=t}stop(){this.draw((t=>{t.clearRect(A.x,A.y,this.#a.size.width,this.#a.size.height)}))}#k(t){for(const s of this.#v)s.afterDraw?.(t)}#x(t,s,i,e,h,o){for(const n of this.#w){if(n.getColorStyles){const{fill:o,stroke:a}=n.getColorStyles(s,t,i,e);o&&(h.fill=o),a&&(h.stroke=a)}if(n.getTransformValues){const t=n.getTransformValues(s);for(const s in t)Bs(o,t,s)}n.beforeDraw?.(s)}}#S(t,s){if(!t?.drawAfter)return;const{particle:i}=s;i.effect&&t.drawAfter(s)}#O(t,s){if(!t?.drawBefore)return;const{particle:i}=s;i.effect&&t.drawBefore(s)}#P(t){const{container:s,context:i,particle:e,delta:h,colorStyles:o,radius:n,opacity:a,transform:r}=t,{effectDrawers:c,shapeDrawers:l}=s,d=e.getPosition(),f=e.getTransformData(r),u=W,p={x:d.x,y:d.y};i.setTransform(f.a,f.b,f.c,f.d,d.x,d.y),o.fill&&(i.fillStyle=o.fill);const v=!!e.fillEnabled,w=e.strokeWidth??j;i.lineWidth=w,o.stroke&&(i.strokeStyle=o.stroke);const g={context:i,particle:e,radius:n,drawRadius:n*u,opacity:a,delta:h,pixelRatio:s.retina.pixelRatio,fill:v,stroke:w>j,transformData:f,position:{...d},drawPosition:p,drawScale:u};for(const t of s.plugins)t.drawParticleTransform?.(g);const y=e.effect?c.get(e.effect):void 0,m=e.shape?l.get(e.shape):void 0;this.#O(y,g),this.#R(m,g),this.#D(m,g),this.#$(m,g),this.#S(y,g),i.resetTransform()}#C(t,s,i,e){s.drawParticle&&s.drawParticle(t,i,e)}#D(t,s){if(!t)return;const{context:i,fill:e,particle:h,stroke:o}=s;h.shape&&(i.beginPath(),t.draw(s),h.shapeClose&&i.closePath(),e&&i.fill(),o&&i.stroke())}#$(t,s){if(!t?.afterDraw)return;const{particle:i}=s;i.shape&&t.afterDraw(s)}#R(t,s){if(!t?.beforeDraw)return;const{particle:i}=s;i.shape&&t.beforeDraw(s)}#b(t){return this.#p[t]}#M(t){let s,i;for(const e of this.#r)if(!s&&e.particleFillColor&&(s=Rs(this.#s,e.particleFillColor(t))),!i&&e.particleStrokeColor&&(i=Rs(this.#s,e.particleStrokeColor(t))),s&&i)break;return this.#y[0]=s,this.#y[1]=i,this.#y}#z(){const t=this.#t.actualOptions.background;if(this.#h=null,t.element)if("string"==typeof t.element){if("undefined"!=typeof document){const s=document.querySelector(t.element);s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof HTMLImageElement?this.#h=s:s?this.#L("background-element-not-supported",`Background element "${t.element}" is not a supported drawable element (canvas, video, or img)`):this.#L("background-element-not-found",`Background element selector "${t.element}" not found`)}}else(t.element instanceof HTMLCanvasElement||t.element instanceof OffscreenCanvas||t.element instanceof HTMLVideoElement||t.element instanceof HTMLImageElement)&&(this.#h=t.element)}#L(t,s){this.#o.has(t)||(this.#o.add(t),X().warning(s))}}const Fs=new WeakMap;function Hs(t,s,i=!1){if(!s)return;const e=t.style,h=new Set;for(let t=0;t<e.length;t++){const s=e.item(t);s&&h.add(s)}for(let t=0;t<s.length;t++){const i=s.item(t);i&&h.add(i)}for(const t of h){const h=s.getPropertyValue(t);h?e.setProperty(t,h,i?"important":""):e.removeProperty(t)}}class As{domElement;render;renderCanvas;size;zoom=W;#t;#T;#E;#B;#s;#I;#F;#H;#A;constructor(t,s){this.#s=t,this.#t=s,this.render=new Is(t,s,this),this.#H={height:0,width:0};const i=s.retina.pixelRatio,e=this.#H;this.size={height:e.height*i,width:e.width*i},this.#T=!1,this.#F=[],this.#I="none"}get#U(){return this.#t.actualOptions.fullScreen.enable}destroy(){if(this.stop(),this.#T){const t=this.domElement;t?.remove(),this.domElement=void 0,this.renderCanvas=void 0}else this.#V();this.render.destroy(),this.#F=[]}getZoomCenter(){const t=this.#t.retina.pixelRatio,{width:s,height:i}=this.size;return this.#A?this.#A:{x:s*z/t,y:i*z/t}}init(){this.#q((t=>{t.disconnect()})),this.#E=N((t=>{for(const s of t)"attributes"===s.type&&"style"===s.attributeName&&this.#j()})),this.resize(),this.#W(),this.initBackground(),this.#q((t=>{const s=this.domElement;s&&s instanceof Node&&t.observe(s,{attributes:!0})})),this.initPlugins(),this.#X(),this.render.init()}initBackground(){const t=this.#t,s=t.actualOptions.background,i=this.domElement;if(!i)return;const e=i.style,h=Ss(this.#s,s.color);e.backgroundColor=h?$s(h,t.actualOptions.hdr,s.opacity):"",e.backgroundImage=s.image||"",e.backgroundPosition=s.position||"",e.backgroundRepeat=s.repeat||"",e.backgroundSize=s.size||""}initPlugins(){this.#F=[];for(const t of this.#t.plugins)t.resize&&this.#F.push(t)}loadCanvas(t){this.#T&&this.domElement&&this.domElement.remove();const s=(t=>"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement)(t)?t:void 0;this.domElement=s,this.#T=!!s&&"true"===s.dataset[Z],this.renderCanvas=s?(t=>{const s=Fs.get(t);if(s)return s;if("function"!=typeof t.transferControlToOffscreen)throw new TypeError("OffscreenCanvas is required but not supported by this browser");try{const s=t.transferControlToOffscreen();return Fs.set(t,s),s}catch{throw new TypeError("OffscreenCanvas transfer failed")}})(s):t;const i=this.domElement;i&&(i.ariaHidden="true",this.#B=G(i.style));const e=this.#H,h=this.renderCanvas;i?(e.height=i.offsetHeight,e.width=i.offsetWidth):(e.height=h.height,e.width=h.width);const o=this.#t.retina.pixelRatio,n=this.size;h.height=n.height=e.height*o,h.width=n.width=e.width*o}resize(){const t=this.domElement;if(!t)return!1;const s=this.#t,i=this.renderCanvas;if(void 0===i)return!1;const e=s.canvas.#H,h={width:t.offsetWidth,height:t.offsetHeight},o=s.retina.pixelRatio,n={width:h.width*o,height:h.height*o};if(h.height===e.height&&h.width===e.width&&n.height===i.height&&n.width===i.width)return!1;const a={...e};e.height=h.height,e.width=h.width;const r=this.size;return i.width=r.width=n.width,i.height=r.height=n.height,this.#t.started&&s.particles.setResizeFactor({width:e.width/a.width,height:e.height/a.height}),!0}setPointerEvents(t){this.domElement&&(this.#I=t,this.#j())}setZoom(t,s){this.zoom=t,this.#A=s}stop(){this.#q((t=>{t.disconnect()})),this.#E=void 0,this.render.stop()}async windowResize(){if(!this.domElement||!this.resize())return;const t=this.#t,s=t.updateActualOptions();t.particles.setDensity(),this.#Y(),s&&await t.refresh()}#Y(){for(const t of this.#F)t.resize?.()}#X(){const t=this.#t.actualOptions.hdr&&K("(color-gamut: p3)")?.matches&&K("(dynamic-range: high)")?.matches;this.render.setContextSettings({alpha:!0,desynchronized:!0,willReadFrequently:!1,...t?{colorSpace:"display-p3",colorType:"float16"}:{colorSpace:"srgb"}});const s=this.renderCanvas;s&&this.render.setContext(s.getContext("2d",this.render.settings))}#W(){const t=this.domElement,s=this.#t.actualOptions;if(t){this.#U?this.#_():this.#V();for(const i in s.style){if(!i||!(i in s.style))continue;const e=s.style[i];e&&t.style.setProperty(i,e,"important")}}}#j(){const t=this.domElement;if(!t)return;this.#q((t=>{t.disconnect()})),this.#W(),this.initBackground();const s=this.#I;t.style.pointerEvents=s,t.style.setProperty("pointer-events",s),this.#q((s=>{t instanceof Node&&s.observe(t,{attributes:!0})}))}#V(){const t=this.domElement,s=this.#B;t&&s&&Hs(t,s,!0)}#q(t){this.#E&&t(this.#E)}#_(){const t=this.domElement;t&&Hs(t,Q(this.#t.actualOptions.fullScreen.zIndex),!0)}}class Us{#t;#N;#Z;#G;constructor(t){this.#t=t,this.#N={visibilityChange:()=>{this.#K()},resize:()=>{this.#Q()}}}addListeners(){this.#J(!0)}removeListeners(){this.#J(!1)}#K(){const t=this.#t;t.actualOptions.pauseOnBlur&&(J().hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))}#Q(){this.#G&&(clearTimeout(this.#G),this.#G=void 0);const t=async()=>{const t=this.#t.canvas;await t.windowResize()};this.#G=setTimeout((()=>{t()}),this.#t.actualOptions.resize.delay*tt)}#J(t){const s=this.#N;this.#tt(t),st(document,it,s.visibilityChange,t,!1)}#tt(t){const s=this.#N,i=this.#t;if(!i.actualOptions.resize.enable)return;if("undefined"==typeof ResizeObserver)return void st(globalThis,et,s.resize,t);const e=i.canvas.domElement;this.#Z&&!t?(e&&this.#Z.unobserve(e),this.#Z.disconnect(),this.#Z=void 0):!this.#Z&&t&&e&&(this.#Z=new ResizeObserver((t=>{t.find((t=>t.target===e))&&this.#Q()})),this.#Z.observe(e))}}function Vs(t){if(!Pt(t.outMode,t.checkModes))return;const s=t.radius*S;t.coord>t.maxCoord-s?t.setCb(-t.radius):t.coord<s&&t.setCb(t.radius)}function qs(t,s){const i=t%s;return i<nt?i+s:i}class js{backColor;destroyed;direction;effect;effectClose;effectData;fillColor;fillEnabled;fillOpacity;group;id;ignoresResizeRatio;initialPosition;initialVelocity;isRotating;justWarped;lastPathTime;misplaced;moveCenter;offset;opacity;options;outType;pathRotation;position;randomIndexData;retina;roll;rotation;shape;shapeClose;shapeData;sides;size;spawning;strokeColor;strokeOpacity;strokeWidth;unbreakable;velocity;zIndexFactor;#st={fillOpacity:P,opacity:P,strokeOpacity:P};#it=ht.origin;#et={sin:0,cos:0};#ht={a:1,b:0,c:0,d:1};#t;#ot=[];#s;constructor(t,s){this.#s=t,this.#t=s}addModifier(t){this.#ot.push(t),this.#ot.sort(((t,s)=>t.priority-s.priority))}clearModifiers(){this.#ot.length=0}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.clearModifiers();const s=this.#t,i=this.shape?s.shapeDrawers.get(this.shape):void 0;i?.particleDestroy?.(this);for(const i of s.particleDestroyedPlugins)i.particleDestroyed?.(this,t);for(const i of s.particleUpdaters)i.particleDestroyed?.(this,t);this.#t.dispatchEvent(ot.particleDestroyed,{particle:this})}draw(t){const s=this.#t.canvas.render;s.drawParticlePlugins(this,t),s.drawParticle(this,t)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:nt)}getFillColor(){return this.#nt(this.#at(Es(this.fillColor),(t=>t.fillColor)))}getMass(){return this.getRadius()**i*Math.PI*z}getModifier(t){return this.#ot.find((s=>s.id===t))}getOpacity(){const t=(Y-this.zIndexFactor)**this.options.zIndex.opacityRate,s=Mt(this.opacity?.value??P),i=this.#at(void 0,(t=>t.opacity))??s,e=this.strokeOpacity??P;return this.#st.fillOpacity=i*(this.fillOpacity??P)*t,this.#st.opacity=i*t,this.#st.strokeOpacity=i*e*t,this.#st}getPosition(){return this.#it.x=this.position.x+this.offset.x,this.#it.y=this.position.y+this.offset.y,this.#it.z=this.position.z,this.#it}getRadius(){return this.#at(this.size.value,(t=>t.radius))}getRotateData(){const t=this.getAngle();return this.#et.sin=Math.sin(t),this.#et.cos=Math.cos(t),this.#et}getStrokeColor(){return this.#nt(this.#at(Es(this.strokeColor),(t=>t.strokeColor)))}getTransformData(t){const s=this.getRotateData(),i=this.isRotating;return this.#ht.a=s.cos*(t.a??at.a),this.#ht.b=i?s.sin*(t.b??$):t.b??at.b,this.#ht.c=i?-s.sin*(t.c??$):t.c??at.c,this.#ht.d=s.cos*(t.d??at.d),this.#ht}init(t,s,i,e){const h=this.#t;!function(t,s,i){t.id=s,t.group=i,t.justWarped=!1,t.effectClose=!0,t.shapeClose=!0,t.pathRotation=!1,t.lastPathTime=0,t.destroyed=!1,t.unbreakable=!1,t.isRotating=!1,t.rotation=0,t.misplaced=!1,t.retina={maxDistance:{},maxSpeed:0,moveDrift:0,moveSpeed:0,sizeAnimationSpeed:0},t.size={value:1,max:1,min:1,enable:!1},t.outType=yt.normal,t.ignoresResizeRatio=!0}(this,t,e),this.options=function(t,s,i,e){const h=ks(i,s,s.actualOptions.particles),o=h.reduceDuplicates;t.effect=xt(h.effect.type,t.id,o),t.shape=xt(h.shape.type,t.id,o);const n=h.effect,a=h.shape;if(e){if(e.effect){const s=e.effect.type;if(s&&s!==t.effect){const i=xt(s,t.id,o);i&&(t.effect=i)}n.load(e.effect)}if(e.shape){const s=e.shape.type;if(s&&s!==t.shape){const i=xt(s,t.id,o);i&&(t.shape=i)}a.load(e.shape)}}if(t.effect===k){const i=[...s.effectDrawers.keys()];t.effect=i[Math.floor(ft()*i.length)]}if(t.shape===k){const i=[...s.shapeDrawers.keys()];t.shape=i[Math.floor(ft()*i.length)]}t.effectData=t.effect?function(t,s,i,e){return u({close:s.close},xt(s.options[t],i,e))}(t.effect,n,t.id,o):void 0,t.shapeData=t.shape?function(t,s,i,e){return u({close:s.close},xt(s.options[t],i,e))}(t.shape,a,t.id,o):void 0,h.load(e);const r=t.effectData,c=t.shapeData;return r&&h.load(r.particles),c&&h.load(c.particles),t.effectClose=r?.close??h.effect.close,t.shapeClose=c?.close??h.shape.close,h}(this,h,this.#s,i),h.retina.initParticle(this),function(t,s){for(const i of t)i.preInit?.(s)}(h.particleUpdaters,this),this.#rt(s),this.initialVelocity=this.#ct(),this.velocity=this.initialVelocity.copy(),this.zIndexFactor=this.position.z/h.zLayers,this.sides=24,function(t,s){let i,e;t.effect&&(i=s.effectDrawers.get(t.effect)),i?.loadEffect&&i.loadEffect(t),t.shape&&(e=s.shapeDrawers.get(t.shape)),e?.loadShape&&e.loadShape(t);const h=e?.getSidesCount;h&&(t.sides=h(t))}(this,h),this.spawning=!1,function(t,s){for(const i of t)i.init(s)}(h.particleUpdaters,this),function(t,s){const i=s.shape?t.shapeDrawers.get(s.shape):void 0,e=s.effect?t.effectDrawers.get(s.effect):void 0;e?.particleInit?.(t,s),i?.particleInit?.(t,s)}(h,this),function(t,s){for(const i of t.particleCreatedPlugins)i.particleCreated?.(s)}(h,this)}isInsideCanvas(t){return this.#lt({direction:t}).inside}isInsideCanvasForOutMode(t,s){return this.#lt({direction:s,outMode:t}).inside}isShowingBack(){if(!this.roll)return!1;const t=this.roll.angle;if(this.roll.horizontal&&this.roll.vertical){const s=qs(t,kt);return s>=Math.PI*z&&s<Math.PI*I*z}if(this.roll.horizontal){const s=qs(t+Math.PI*z,kt);return s>=Math.PI&&s<Math.PI*S}if(this.roll.vertical){const s=qs(t,kt);return s>=Math.PI&&s<Math.PI*S}return!1}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}removeModifier(t){const s=this.#ot.findIndex((s=>s.id===t));s>=nt&&this.#ot.splice(s,$)}reset(){for(const t of this.#t.particleUpdaters)t.reset?.(this)}#at(t,s){let i=t;for(const t of this.#ot)if(t.enabled){const e=s(t);void 0!==e&&(i=e)}return i}#dt(t,s){let i=rt,e=t?ht.create(t.x,t.y,s):void 0;const h=this.#t,o=h.particlePositionPlugins,n=this.options.move.outModes,a=this.getRadius(),r=h.canvas.size;for(;;){for(const t of o){const i=t.particlePosition?.(e,this);if(i)return ht.create(i.x,i.y,s)}const t=bt({size:r,position:e}),c=ht.create(t.x,t.y,s);this.#ft(c,a,n.left??n.default),this.#ft(c,a,n.right??n.default),this.#ut(c,a,n.top??n.default),this.#ut(c,a,n.bottom??n.default);let l=!0;for(const t of h.particles.checkParticlePositionPlugins)if(l=t.checkParticlePosition?.(this,c,i)??!0,!l)break;if(l)return c;i+=ct,e=void 0}}#ct(){const t=this.options.move,s=lt(this.direction).copy();if(t.direction===w.inside||t.direction===w.outside)return s;const i=Ct(Mt(t.angle.value)),e=Ct(Mt(t.angle.offset)),o={left:e-i*z,right:e+i*z};return t.straight||(s.angle+=dt(h(o.left,o.right))),t.random&&"number"==typeof t.speed&&(s.length*=ft()),s}#ft(t,s,i){Vs({outMode:i,checkModes:[v.bounce],coord:t.x,maxCoord:this.#t.canvas.size.width,setCb:s=>t.x+=s,radius:s})}#ut(t,s,i){Vs({outMode:i,checkModes:[v.bounce],coord:t.y,maxCoord:this.#t.canvas.size.height,setCb:s=>t.y+=s,radius:s})}#pt(t,s){const i=this.getRadius(),e=this.#t.canvas.size,h=this.position,o=s===v.bounce;return t===ut.bottom?{inside:o?h.y+i<e.height:h.y-i<e.height,reason:"default"}:t===ut.left?{inside:o?h.x-i>nt:h.x+i>nt,reason:"default"}:t===ut.right?{inside:o?h.x+i<e.width:h.x-i<e.width,reason:"default"}:t===ut.top?{inside:o?h.y-i>nt:h.y+i>nt,reason:"default"}:{inside:h.x>=-i&&h.y>=-i&&h.y<=e.height+i&&h.x<=e.width+i,reason:"default"}}#vt(t,s){return{canvasSize:this.#t.canvas.size,direction:t,outMode:s,particle:this,radius:this.getRadius()}}#lt(t){const s=this.#pt(t.direction,t.outMode),i=this.#t,e=this.shape?i.shapeDrawers.get(this.shape):void 0,h=this.effect?i.effectDrawers.get(this.effect):void 0,o=e?.isInsideCanvas,n=h?.isInsideCanvas;if(!o&&!n)return s;const a=this.#vt(t.direction,t.outMode),r=o?this.#wt(o(a),"shape"):void 0,c=n?this.#wt(n(a),"effect"):void 0;if(r&&c){const t=Math.max(r.margin??nt,c.margin??nt);return{inside:r.inside&&c.inside,margin:t>nt?t:void 0,reason:"combined"}}return r??c??s}#nt(t){return t&&this.roll&&(this.backColor||this.roll.alter)&&this.isShowingBack()?this.backColor?this.backColor:this.roll.alter?function(t,s,i){return{h:t.h,s:t.s,l:t.l+(s===C.darken?-L:L)*i}}(t,this.roll.alter.type,this.roll.alter.value):t:t}#rt(t){const s=this.#t,i=Math.floor(Mt(this.options.zIndex.value)),e=this.#dt(t,pt(i,vt,s.zLayers));if(!e)throw new Error("a valid position cannot be found for particle");switch(this.position=e,this.initialPosition=this.position.copy(),this.moveCenter={...wt(this.options.move.center,s.canvas.size),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=gt(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case w.inside:this.outType=yt.inside;break;case w.outside:this.outType=yt.outside}this.offset=mt.origin}#wt(t,s){return"boolean"==typeof t?{inside:t,reason:s}:{inside:t.inside,margin:t.margin,reason:t.reason??s}}}class Ws{#gt;#yt=new Map;#mt=[];#bt;#Mt;#xt=[];#Pt;constructor(t){this.#gt=t,this.#bt=0,this.#Pt=0}clear(){this.#yt.clear();const t=this.#Mt;t&&(this.#gt=t),this.#Mt=void 0}insert(t){const{x:s,y:i}=t.getPosition(),e=this.#kt(s,i);this.#yt.has(e)||this.#yt.set(e,[]),this.#yt.get(e)?.push(t)}query(t,s,i=[]){const e=this.#Ct(t);if(!e)return i;const h=Math.floor(e.minX/this.#gt),o=Math.floor(e.maxX/this.#gt),n=Math.floor(e.minY/this.#gt),a=Math.floor(e.maxY/this.#gt);for(let e=h;e<=o;e++)for(let h=n;h<=a;h++){const o=this.#yt.get(`${e}_${h}`);if(o)for(const e of o)s&&!s(e)||t.contains(e.getPosition())&&i.push(e)}return i}queryCircle(t,s,i,e=[]){const h=this.#Lt(t.x,t.y,s),o=this.query(h,i,e);return this.#zt(),o}queryRectangle(t,s,i,e=[]){const h=this.#St(t.x,t.y,s.width,s.height),o=this.query(h,i,e);return this.#zt(),o}setCellSize(t){this.#Mt=t}#Lt(t,s,i){return(this.#mt[this.#bt++]??=new jt(t,s,i)).reset(t,s,i)}#St(t,s,i,e){return(this.#xt[this.#Pt++]??=new Wt(t,s,i,e)).reset(t,s,i,e)}#kt(t,s){return`${Math.floor(t/this.#gt)}_${Math.floor(s/this.#gt)}`}#Ct(t){if(t instanceof jt){const s=t.radius,{x:i,y:e}=t.position;return{minX:i-s,maxX:i+s,minY:e-s,maxY:e+s}}if(t instanceof Wt){const{x:s,y:i}=t.position,{width:e,height:h}=t.size;return{minX:s,maxX:s+e,minY:i,maxY:i+h}}return null}#zt(){this.#bt=0,this.#Pt=0}}class Xs{checkParticlePositionPlugins;grid;#Ot;#t;#Rt;#Dt;#$t;#Tt;#Et;#Bt;#s;#It;#Ft;#Ht;#At;#Ut;#Vt;constructor(t,s){this.#s=t,this.#t=s,this.#$t=0,this.#Ot=[],this.#It=[],this.#Dt=0,this.#Rt=new Map,this.#Tt=new Map,this.#Vt=this.#qt(this.#t.zLayers),this.grid=new Ws(Lt),this.checkParticlePositionPlugins=[],this.#Et=[],this.#Bt=[],this.#Ht=[],this.#Ft=[],this.#Ut=[]}get count(){return this.#Ot.length}addParticle(t,s,i,e){const h=this.#t.actualOptions.particles.number.limit.mode,o=void 0===i?this.#Dt:this.#Rt.get(i)??this.#Dt,n=this.count;if(o>zt)switch(h){case m.delete:{const t=n+Tt-o;t>St&&this.removeQuantity(t);break}case m.wait:if(n>=o)return}try{const h=this.#It.pop()??new js(this.#s,this.#t);h.init(this.#$t,t,s,i);let o=!0;return e&&(o=e(h)),o?(this.#Ot.push(h),this.#jt(h),this.#$t++,this.#t.dispatchEvent(ot.particleAdded,{particle:h}),h):void this.#It.push(h)}catch(t){X().warning(`error adding particle: ${t}`)}}clear(){this.#Ot=[],this.#Tt.clear(),this.#Wt(this.#t.zLayers)}destroy(){this.#Ot=[],this.#It.length=0,this.#Tt.clear(),this.#Vt=[],this.checkParticlePositionPlugins=[],this.#Et=[],this.#Bt=[],this.#Ht=[],this.#Ft=[],this.#Ut=[]}drawParticles(t){for(let s=this.#Vt.length-Et;s>=Ot;s--){const i=this.#Vt[s];if(i)for(const s of i)s.draw(t)}}filter(t){return this.#Ot.filter(t)}find(t){return this.#Ot.find(t)}get(t){return this.#Ot[t]}async init(){const t=this.#t,s=t.actualOptions;this.checkParticlePositionPlugins=[],this.#Ut=[],this.#Bt=[],this.#Ht=[],this.#Et=[],this.#Ft=[],this.#Tt.clear(),this.#Wt(t.zLayers),this.grid=new Ws(Lt*t.retina.pixelRatio);for(const s of t.plugins)s.redrawInit&&await s.redrawInit(),s.checkParticlePosition&&this.checkParticlePositionPlugins.push(s),s.update&&this.#Ut.push(s),s.particleUpdate&&this.#Bt.push(s),s.postUpdate&&this.#Ht.push(s),s.particleReset&&this.#Et.push(s),s.postParticleUpdate&&this.#Ft.push(s);await this.#t.initDrawersAndUpdaters();for(const s of this.#t.effectDrawers.values())await(s.init?.(t));for(const s of this.#t.shapeDrawers.values())await(s.init?.(t));let i=!1;for(const s of t.plugins)if(i=s.particlesInitialization?.()??i,i)break;if(!i){const t=s.particles,i=t.groups;for(const s in i){const e=i[s];if(e)for(let i=this.count,h=0;h<e.number.value&&i<t.number.value;i++,h++)this.addParticle(void 0,e,s)}for(let s=this.count;s<t.number.value;s++)this.addParticle()}}push(t,s,i,e){for(let h=0;h<t;h++)this.addParticle(s,i,e)}async redraw(){this.clear(),await this.init(),this.#t.canvas.render.drawParticles({value:0,factor:0})}remove(t,s,i){this.removeAt(this.#Ot.indexOf(t),void 0,s,i)}removeAt(t,s=Rt,i,e){if(t<Ot||t>this.count)return;let h=0;for(let o=t;h<s&&o<this.count;o++)this.#Xt(o,i,e)&&(o--,h++)}removeQuantity(t,s){this.removeAt(Ot,t,s)}setDensity(){const t=this.#t.actualOptions,s=t.particles.groups;let i=0;for(const t of this.#t.plugins)t.particlesDensityCount&&(i+=t.particlesDensityCount());for(const t in s){const e=s[t];if(!e)continue;const h=ks(this.#s,this.#t,e);this.#Yt(h,i,t)}this.#Yt(t.particles,i)}setResizeFactor(t){this.#At=t}update(t){this.grid.clear();for(const s of this.#Ut)s.update?.(t);const s=this.#_t(t);for(const s of this.#Ht)s.postUpdate?.(t);if(this.#Nt(t,s),s.size)for(const t of s)this.remove(t);this.#At=void 0}#Zt(...t){this.#It.push(...t)}#Yt(t,s,i,e){const h=t.number;if(!h.density.enable)return void(void 0===i?this.#Dt=h.limit.value:(e?.number.limit.value??h.limit.value)&&this.#Rt.set(i,e?.number.limit.value??h.limit.value));const o=this.#Gt(h.density),n=h.value,a=Math.min(n,h.limit.value>zt?h.limit.value:n)*o+s,r=Math.min(this.count,this.filter((t=>t.group===i)).length);void 0===i?this.#Dt=h.limit.value*o:this.#Rt.set(i,h.limit.value*o),r<a?this.push(Math.abs(a-r),void 0,t,i):r>a&&this.removeQuantity(r-a,i)}#qt(t){const s=Math.max(Math.floor(t),Et);return Array.from({length:s},(()=>[]))}#Kt(t){const s=this.#Vt.length-Et;return s<=Ot?Ot:Math.min(Math.max(Math.floor(t),Ot),s)}#Gt(t){const s=this.#t;if(!t.enable)return Dt;const e=s.canvas.size;return e.width&&e.height?e.width*e.height/(t.height*t.width*s.retina.pixelRatio**i):Dt}#jt(t){const s=this.#Kt(t.position.z),i=this.#Vt[s];i&&(i.push(t),this.#Tt.set(t.id,s))}#Xt(t,s,i){const e=this.#Ot[t];return!!e&&e.group===s&&(this.#Ot.splice(t,$t),this.#Qt(e),e.destroy(i),this.#t.dispatchEvent(ot.particleRemoved,{particle:e}),this.#Zt(e),!0)}#Qt(t){const s=this.#Tt.get(t.id)??this.#Kt(t.position.z),i=this.#Vt[s];if(!i)return void this.#Tt.delete(t.id);const e=i.findIndex((s=>s.id===t.id));e>=Ot&&i.splice(e,$t),this.#Tt.delete(t.id)}#Wt(t){const s=Math.max(Math.floor(t),Et);if(this.#Vt.length===s)for(const t of this.#Vt)t.length=Ot;else this.#Vt=this.#qt(s)}#Jt(t){const s=this.#Kt(t.position.z),i=this.#Tt.get(t.id);if(void 0===i)return void this.#jt(t);if(i===s)return;const e=this.#Vt[i];if(e){const s=e.findIndex((s=>s.id===t.id));s>=Ot&&e.splice(s,$t)}const h=this.#Vt[s];if(h){if(h.push(t),h.length>=S){const s=h[h.length-S];s&&t.id<s.id&&h.sort(((t,s)=>t.id-s.id))}this.#Tt.set(t.id,s)}else this.#Tt.set(t.id,s)}#_t(t){const s=new Set,i=this.#At;for(const e of this.#Ot){i&&!e.ignoresResizeRatio&&(e.position.x*=i.width,e.position.y*=i.height,e.initialPosition.x*=i.width,e.initialPosition.y*=i.height),e.ignoresResizeRatio=!1;for(const t of this.#Et)t.particleReset?.(e);for(const s of this.#Bt){if(e.destroyed)break;s.particleUpdate?.(e,t)}e.destroyed?s.add(e):this.grid.insert(e)}return s}#Nt(t,s){for(const i of this.#Ot)if(i.destroyed)s.add(i);else{for(const s of this.#t.particleUpdaters)s.update(i,t);if(!i.spawning)for(const s of this.#Ft)s.postParticleUpdate?.(i,t);this.#Jt(i)}}}class Ys{pixelRatio;reduceFactor;#t;constructor(t){this.#t=t,this.pixelRatio=Bt,this.reduceFactor=It}init(){const t=this.#t;this.pixelRatio=t.actualOptions.detectRetina?devicePixelRatio:Bt,this.reduceFactor=It;const s=this.pixelRatio,i=t.canvas,e=i.domElement;e&&(i.size.width=e.offsetWidth*s,i.size.height=e.offsetHeight*s)}initParticle(t){const s=this.pixelRatio,i=t.options.move,e=i.distance,h=t.retina;h.maxSpeed=Mt(i.gravity.maxSpeed)*s,h.moveDrift=Mt(i.drift)*s,h.moveSpeed=Mt(i.speed)*s;const o=h.maxDistance;o.horizontal=void 0===e.horizontal?void 0:e.horizontal*s,o.vertical=void 0===e.vertical?void 0:e.vertical*s}}function _s(t){return!t.destroyed}function Ns(t,s,...i){const e=new Cs(t,s);return Yt(e,...i),e}class Zs{actualOptions;canvas;destroyed;effectDrawers;fpsLimit;hdr;id;pageHidden;particleCreatedPlugins;particleDestroyedPlugins;particlePositionPlugins;particleUpdaters;particles;plugins;retina;shapeDrawers;started;zLayers;#ts;#ss;#is={value:0,factor:0};#es;#hs;#os;#ns;#as;#rs;#cs;#ls;#ds;#fs;#us;#s;#ps;#vs;constructor(t){const{dispatchCallback:s,pluginManager:i,id:e,onDestroy:h,sourceOptions:o}=t;this.#s=i,this.#es=s,this.#ds=h,this.id=Symbol(e),this.fpsLimit=120,this.hdr=!1,this.#ps=!1,this.#ts=0,this.#os=0,this.#ls=0,this.#as=!0,this.started=!1,this.destroyed=!1,this.#us=!0,this.#cs=0,this.zLayers=100,this.pageHidden=!1,this.#vs=o,this.#rs=o,this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.retina=new Ys(this),this.canvas=new As(this.#s,this),this.particles=new Xs(this.#s,this),this.plugins=[],this.particleDestroyedPlugins=[],this.particleCreatedPlugins=[],this.particlePositionPlugins=[],this.#fs=Ns(this.#s,this),this.actualOptions=Ns(this.#s,this),this.#ns=new Us(this),this.dispatchEvent(ot.containerBuilt)}get animationStatus(){return!this.#us&&!this.pageHidden&&_s(this)}get options(){return this.#fs}get sourceOptions(){return this.#vs}addLifeTime(t){this.#ls+=t}alive(){return!this.#os||this.#ls<=this.#os}destroy(t=!0){if(_s(this)){this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.effectDrawers)t.destroy?.(this);for(const[,t]of this.shapeDrawers)t.destroy?.(this);for(const t of this.plugins)t.destroy?.();this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.plugins.length=0,this.#s.clearPlugins(this),this.destroyed=!0,this.#ds(t),this.dispatchEvent(ot.containerDestroyed)}}dispatchEvent(t,s){this.#es(t,{container:this,data:s})}draw(t){if(!_s(this))return;let s=t;this.#hs=Ft((t=>{s&&(this.#cs=void 0,s=!1),this.#ws(t)}))}async export(t,s={}){for(const i of this.plugins){if(!i.export)continue;const e=await i.export(t,s);if(e.supported)return e.blob}X().error(`Export plugin with type ${t} not found`)}async init(){if(!_s(this))return;const t=new Map;for(const s of this.#s.plugins){const i=await s.getPlugin(this);i.preInit&&await i.preInit(),t.set(s,i)}await this.initDrawersAndUpdaters(),this.#fs=Ns(this.#s,this,this.#rs,this.sourceOptions),this.actualOptions=Ns(this.#s,this,this.#fs),this.plugins.length=0,this.particleDestroyedPlugins.length=0,this.particleCreatedPlugins.length=0,this.particlePositionPlugins.length=0;for(const[s,i]of t)s.needsPlugin(this.actualOptions)&&(this.plugins.push(i),i.particleCreated&&this.particleCreatedPlugins.push(i),i.particleDestroyed&&this.particleDestroyedPlugins.push(i),i.particlePosition&&this.particlePositionPlugins.push(i));this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();const{delay:s,duration:i,fpsLimit:e,hdr:h,smooth:o,zLayers:n}=this.actualOptions;this.hdr=h,this.zLayers=n,this.#os=Mt(i)*tt,this.#ts=Mt(s)*tt,this.#ls=0,this.fpsLimit=e>At?e:Ht,this.#ps=o;for(const t of this.plugins)await(t.init?.());await this.particles.init(),this.dispatchEvent(ot.containerInit),this.particles.setDensity();for(const t of this.plugins)t.particlesSetup?.();this.dispatchEvent(ot.particlesSetup)}async initDrawersAndUpdaters(){const t=this.#s;this.effectDrawers=await t.getEffectDrawers(this,!0),this.shapeDrawers=await t.getShapeDrawers(this,!0),this.particleUpdaters=await t.getUpdaters(this,!0)}pause(){if(_s(this)&&(void 0!==this.#hs&&(Ut(this.#hs),this.#hs=void 0),!this.#us)){for(const t of this.plugins)t.pause?.();this.pageHidden||(this.#us=!0),this.dispatchEvent(ot.containerPaused)}}play(t){if(!_s(this))return;const s=this.#us||t;if(!this.#as||this.actualOptions.autoPlay){if(this.#us&&(this.#us=!1),s)for(const t of this.plugins)t.play&&t.play();this.dispatchEvent(ot.containerPlay),this.draw(s??!1)}else this.#as=!1}async refresh(){if(_s(this))return this.stop(),this.start()}async reset(t){if(_s(this))return this.#rs=t,this.#vs=t,this.#fs=Ns(this.#s,this,this.#rs,this.sourceOptions),this.actualOptions=Ns(this.#s,this,this.#fs),this.refresh()}async start(){_s(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{const s=async()=>{this.#ns.addListeners();for(const t of this.plugins)await(t.start?.());this.dispatchEvent(ot.containerStarted),this.play(),t()};this.#ss=setTimeout((()=>{s()}),this.#ts)})))}stop(){if(_s(this)&&this.started){this.#ss&&(clearTimeout(this.#ss),this.#ss=void 0),this.#as=!0,this.started=!1,this.#ns.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop();for(const t of this.plugins)t.stop?.();this.particleCreatedPlugins.length=0,this.particleDestroyedPlugins.length=0,this.particlePositionPlugins.length=0,this.#vs=this.#fs,this.dispatchEvent(ot.containerStopped)}}updateActualOptions(){let t=!1;for(const s of this.plugins)s.updateActualOptions&&(t=s.updateActualOptions()||t);return t}#ws(t){try{if(!this.#ps&&void 0!==this.#cs&&t<this.#cs+tt/this.fpsLimit)return void this.draw(!1);if(this.#cs??=t,function(t,s,i=Vt,e=!1){t.value=s,t.factor=e?Vt/i:Vt*s/tt}(this.#is,t-this.#cs,this.fpsLimit,this.#ps),this.addLifeTime(this.#is.value),this.#cs=t,this.#is.value>tt)return void this.draw(!1);if(this.canvas.render.drawParticles(this.#is),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){X().error("error in animation loop",t)}}}export{Zs as Container}
@@ -0,0 +1 @@
1
+ const t="generated",n="source-over",e="resize",s="visibilitychange",i=100,a=.5,r=1e3,o={x:0,y:0,z:0},c={a:1,b:0,c:0,d:1},u="random",h=2,f=2*Math.PI,l=60,d="true",p="false",g="canvas",w=0,m=2,v=100,M=1,y=1,b=1,E=255,P=360,x=100,A=100,S=0,k=0,L=60,z=1,C=0,D=1,O=1,T=120,F=0,B=1,j=1,$=0,H=0,_=1,q=0,I=0,R=1,U=1,V=0,G=1,J=0,N=1,W=0,K=400,Q=3,X=6,Y=1,Z=1,tt=0,nt=1;var et;function st(t){return"z"in t?t.z:o.z}!function(t){t.bottom="bottom",t.bottomLeft="bottom-left",t.bottomRight="bottom-right",t.left="left",t.none="none",t.right="right",t.top="top",t.topLeft="top-left",t.topRight="top-right",t.outside="outside",t.inside="inside"}(et||(et={}));class it{x;y;z;constructor(t=o.x,n=o.y,e=o.z){this.x=t,this.y=n,this.z=e}static get origin(){return it.create(o.x,o.y,o.z)}get angle(){return Math.atan2(this.y,this.x)}set angle(t){this.#t(t,this.length)}get length(){return Math.sqrt(this.getLengthSq())}set length(t){this.#t(this.angle,t)}static clone(t){return it.create(t.x,t.y,st(t))}static create(t,n,e){return"number"==typeof t?new it(t,n??o.y,e??o.z):new it(t.x,t.y,st(t))}add(t){return it.create(this.x+t.x,this.y+t.y,this.z+st(t))}addTo(t){this.x+=t.x,this.y+=t.y,this.z+=st(t)}copy(){return it.clone(this)}div(t){return it.create(this.x/t,this.y/t,this.z/t)}getLengthSq(){return this.x**2+this.y**2}mult(t){return it.create(this.x*t,this.y*t,this.z*t)}multTo(t){this.x*=t,this.y*=t,this.z*=t}normalize(){const t=this.length;0!=t&&this.multTo(1/t)}rotate(t){return it.create(this.x*Math.cos(t)-this.y*Math.sin(t),this.x*Math.sin(t)+this.y*Math.cos(t),o.z)}setTo(t){this.x=t.x,this.y=t.y,this.z=st(t)}sub(t){return it.create(this.x-t.x,this.y-t.y,this.z-st(t))}subFrom(t){this.x-=t.x,this.y-=t.y,this.z-=st(t)}#t(t,n){this.x=Math.cos(t)*n,this.y=Math.sin(t)*n}}class at extends it{constructor(t=o.x,n=o.y){super(t,n,o.z)}static get origin(){return at.create(o.x,o.y)}static clone(t){return at.create(t.x,t.y)}static create(t,n){return"number"==typeof t?new at(t,n??o.y):new at(t.x,t.y)}}function rt(t){return"boolean"==typeof t}function ot(t){return"string"==typeof t}function ct(t){return"number"==typeof t}function ut(t){return"object"==typeof t&&null!==t}function ht(t){return Array.isArray(t)}function ft(t){return null==t}const lt=Math.PI/180;let dt=Math.random;function pt(){return vt(dt(),0,1-Number.EPSILON)}function gt(t,n){return pt()*(n-t)+t}function wt(t){return requestAnimationFrame(t)}function mt(t){cancelAnimationFrame(t)}function vt(t,n,e){return Math.min(Math.max(t,n),e)}function Mt(t){const n=Et(t);let e=bt(t);return n===e&&(e=0),gt(e,n)}function yt(t){return ct(t)?t:Mt(t)}function bt(t){return ct(t)?t:t.min}function Et(t){return ct(t)?t:t.max}function Pt(t,n){if(t===n||void 0===n&&ct(t))return t;const e=bt(t),s=Et(t);return void 0!==n?{min:Math.min(e,n),max:Math.max(s,n)}:Pt(e,s)}function xt(t,n,e){return function(t,n){const e=t.x-n.x,s=t.y-n.y;return e*e+s*s}(t,n)<=e*e}function At(t){return t*lt}function St(t,n,e){if(ct(t))return At(t);switch(t){case et.top:return.5*-Math.PI;case et.topRight:return.25*-Math.PI;case et.right:return 0;case et.bottomRight:return.25*Math.PI;case et.bottom:return.5*Math.PI;case et.bottomLeft:return.75*Math.PI;case et.left:return Math.PI;case et.topLeft:return.75*-Math.PI;case et.inside:return Math.atan2(e.y-n.y,e.x-n.x);case et.outside:return Math.atan2(n.y-e.y,n.x-e.x);default:return pt()*f}}function kt(t){const n=at.origin;return n.length=1,n.angle=t,n}function Lt(t){const{position:n,size:e}=t;return{x:n?.x??pt()*e.width,y:n?.y??pt()*e.height}}var zt,Ct;function Dt(t){return"__proto__"===t||"constructor"===t||"prototype"===t}function Ot(){return globalThis.document}function Tt(t){if("undefined"!=typeof matchMedia)return matchMedia(t)}function Ft(t){if("undefined"!=typeof MutationObserver)return new MutationObserver(t)}function Bt(t,n){return t===n||ht(n)&&n.includes(t)}function jt(t,n,e=!0){return t[void 0!==n&&e?n%t.length:Math.floor(pt()*t.length)]}function $t(t,...n){for(const e of n){if(ft(e))continue;if(!ut(e)){t=e;continue}Array.isArray(e)?Array.isArray(t)||(t=[]):ut(t)&&!Array.isArray(t)||(t=Object.create(null));const n=Object.keys(e);if(n.some((t=>{const n=e[t];return ut(n)||Array.isArray(n)})))for(const s of n){if(Dt(s))continue;const n=t,i=e[s];n[s]=Array.isArray(i)?i.map((t=>$t(void 0,t))):$t(n[s],i)}else{const s=e,i=t;for(const t of n){if(Dt(t))continue;const n=s[t];void 0!==n&&(i[t]=n)}}}return t}function Ht(t,n){return ht(t)?t.map(((t,e)=>n(t,e))):n(t,0)}function _t(t,n,e){return ht(t)?jt(t,n,e):t}function qt(t,n){return function(t,n){if(t.mode!==Ct.percent){const{mode:n,...e}=t;return e}return"x"in t?{x:t.x/i*n.width,y:t.y/i*n.height}:{width:t.width/i*n.width,height:t.height/i*n.height}}(t,n)}function It(t){const n=Ot().createElement("div").style;for(const e in t){const s=t[e];if(!(e in t)||ft(s))continue;const i=t.getPropertyValue?.(s);if(!i)continue;const a=t.getPropertyPriority?.(s);a?n.setProperty(s,i,a):n.setProperty(s,i)}return n}let Rt,Ut;function Vt(t){if(Rt!==t||!Ut){Rt=t;const n=Ot().createElement("div").style,e=10,s={width:"100%",height:"100%",margin:"0",padding:"0",borderWidth:"0",position:"fixed",zIndex:t.toString(e),"z-index":t.toString(e),top:"0",left:"0","pointer-events":"none"};for(const t in s){const e=s[t];void 0!==e&&n.setProperty(t,e)}Ut=n}return Ut}function Gt(t,n,e,s,i){if(s){let s={passive:!0};rt(i)?s.capture=i:void 0!==i&&(s=i),t.addEventListener(n,e,s)}else t.removeEventListener(n,e,i)}async function Jt(t,n,e,s=!1){let i=n.get(t);if(!i||s){const s=await Promise.all([...e.entries()].map((([n,e])=>e(t).then((t=>[n,t])))));i=new Map(s),n.set(t,i)}return i}!function(t){t.bottom="bottom",t.left="left",t.right="right",t.top="top"}(zt||(zt={})),function(t){t.precise="precise",t.percent="percent"}(Ct||(Ct={}));class Nt{#n;constructor(){this.#n=new Map}addEventListener(t,n){this.removeEventListener(t,n);let e=this.#n.get(t);e||(e=[],this.#n.set(t,e)),e.push(n)}dispatchEvent(t,n){const e=this.#n.get(t);e?.forEach((t=>{t(n)}))}hasEventListener(t){return!!this.#n.get(t)}removeAllEventListeners(t){t?this.#n.delete(t):this.#n=new Map}removeEventListener(t,n){const e=this.#n.get(t);if(!e)return;const s=e.length,i=e.indexOf(n);i<0||(1===s?this.#n.delete(t):e.splice(i,1))}}var Wt;!function(t){t.configAdded="configAdded",t.containerInit="containerInit",t.particlesSetup="particlesSetup",t.containerStarted="containerStarted",t.containerStopped="containerStopped",t.containerDestroyed="containerDestroyed",t.containerPaused="containerPaused",t.containerPlay="containerPlay",t.containerBuilt="containerBuilt",t.particleAdded="particleAdded",t.particleDestroyed="particleDestroyed",t.particleRemoved="particleRemoved"}(Wt||(Wt={}));class Kt{colorManagers=new Map;easingFunctions=new Map;effectDrawers=new Map;initializers={effects:new Map,shapes:new Map,updaters:new Map};palettes=new Map;plugins=[];presets=new Map;shapeDrawers=new Map;updaters=new Map;#e=new Set;#s=new Map;#i;#a=new Set;#r=!1;#o=!1;#c=new Set;constructor(t){this.#i=t}get configs(){const t={};for(const[n,e]of this.#s)t[n]=e;return t}addColorManager(t,n){this.colorManagers.set(t,n)}addConfig(t){const n=t.key??t.name??"default";this.#s.set(n,t),this.#i.dispatchEvent(Wt.configAdded,{data:{name:n,config:t}})}addEasing(t,n){this.easingFunctions.get(t)||this.easingFunctions.set(t,n)}addEffect(t,n){this.initializers.effects.set(t,n)}addPalette(t,n){this.palettes.set(t,n)}addParticleUpdater(t,n){this.initializers.updaters.set(t,n)}addPlugin(t){this.getPlugin(t.id)||this.plugins.push(t)}addPreset(t,n,e=!1){!e&&this.getPreset(t)||this.presets.set(t,n)}addShape(t,n){for(const e of t)this.initializers.shapes.set(e,n)}clearPlugins(t){this.effectDrawers.delete(t),this.shapeDrawers.delete(t),this.updaters.delete(t)}getEasing(t){return this.easingFunctions.get(t)??(t=>t)}getEffectDrawers(t,n=!1){return Jt(t,this.effectDrawers,this.initializers.effects,n)}getPalette(t){return this.palettes.get(t)}getPlugin(t){return this.plugins.find((n=>n.id===t))}getPreset(t){return this.presets.get(t)}async getShapeDrawers(t,n=!1){return Jt(t,this.shapeDrawers,this.initializers.shapes,n)}async getUpdaters(t,n=!1){return async function(t,n,e,s=!1){let i=n.get(t);return i&&!s||(i=await Promise.all([...e.values()].map((n=>n(t)))),n.set(t,i)),i}(t,this.updaters,this.initializers.updaters,n)}async init(){if(!this.#r&&!this.#o){this.#o=!0,this.#a=new Set,this.#e=new Set(this.#c);try{for(const t of this.#e)await this.#u(t,this.#a,this.#e)}finally{this.#c.clear(),this.#o=!1,this.#r=!0}}}loadParticlesOptions(t,n,...e){const s=this.updaters.get(t);s&&s.forEach((t=>t.loadOptions?.(n,...e)))}async register(...t){if(this.#r)throw new Error("Register plugins can only be done before calling tsParticles.load()");for(const n of t)this.#o?await this.#u(n,this.#a,this.#e):this.#c.add(n)}async#u(t,n,e){n.has(t)||(n.add(t),e.add(t),await t(this.#i))}}const Qt=t=>(...n)=>{t(...n)},Xt={debug:Qt(console.debug),error:(t,...n)=>{console.error(`tsParticles - Error - ${t}`,...n)},info:Qt(console.info),log:Qt(console.log),trace:Qt(console.trace),verbose:Qt(console.log),warning:Qt(console.warn)};function Yt(){return Xt}const Zt="100%";var tn,nn,en,sn,an,rn,on,cn,un,hn,fn,ln;!function(t){t.circle="circle",t.rectangle="rectangle"}(tn||(tn={})),function(t){t.clockwise="clockwise",t.counterClockwise="counter-clockwise",t.random="random"}(nn||(nn={})),function(t){t.auto="auto",t.increase="increase",t.decrease="decrease",t.random="random"}(en||(en={})),function(t){t.delete="delete",t.wait="wait"}(sn||(sn={})),function(t){t.bounce="bounce",t.none="none",t.out="out",t.destroy="destroy",t.split="split"}(an||(an={})),function(t){t.darken="darken",t.enlighten="enlighten"}(rn||(rn={})),function(t){t.none="none",t.max="max",t.min="min"}(on||(on={})),function(t){t.linear="linear",t.radial="radial",t.random="random"}(cn||(cn={})),function(t){t.normal="normal",t.inside="inside",t.outside="outside"}(un||(un={})),function(t){t.max="max",t.min="min",t.random="random"}(hn||(hn={})),function(t){t.increasing="increasing",t.decreasing="decreasing"}(fn||(fn={})),function(t){t[t.BackgroundElement=0]="BackgroundElement",t[t.BackgroundDraw=1]="BackgroundDraw",t[t.BackgroundMask=2]="BackgroundMask",t[t.CanvasSetup=3]="CanvasSetup",t[t.PluginContent=4]="PluginContent",t[t.Particles=5]="Particles",t[t.CanvasCleanup=6]="CanvasCleanup",t[t.Foreground=7]="Foreground"}(ln||(ln={}));const dn=new class{pluginManager=new Kt(this);#h=[];#f=new Nt;#r=!1;get items(){return this.#h}get version(){return"4.3.2"}addEventListener(t,n){this.#f.addEventListener(t,n)}checkVersion(t){if(this.version!==t)throw new Error(`The tsParticles version is different from the loaded plugins version. Engine version: ${this.version}. Plugin version: ${t}`)}dispatchEvent(t,n){this.#f.dispatchEvent(t,n)}async init(){this.#r||(await this.pluginManager.init(),this.#r=!0)}item(t){const n=this.items,e=n[t];if(!e?.destroyed)return e;n.splice(t,1)}async load(n){let e;await this.init(),"undefined"!=typeof HTMLElement&&n.element instanceof HTMLElement&&(e=n.element);const{Container:s}=await import("./p-BkE8bgeV.js"),i=n.id??e?.id??`tsparticles${Math.floor(1e4*pt()).toString()}`,{index:a,url:r}=n,o=r?await async function(t){const n=_t(t.url,t.index);if(!n)return t.fallback;const e=await fetch(n);return e.ok?await e.json():(Yt().error(`${e.status.toString()} while retrieving config file`),t.fallback)}({fallback:n.options,url:r,index:a}):n.options,c=_t(o,a),{items:u}=this,h=u.findIndex((t=>t.id.description===i)),f=new s({dispatchCallback:(t,n)=>{this.dispatchEvent(t,n)},id:i,onDestroy:t=>{if(!t)return;const n=this.items,e=n.indexOf(f);e>=0&&n.splice(e,1)},pluginManager:this.pluginManager,sourceOptions:c});if(h>=0){const t=this.item(h),n=t?1:0;t&&!t.destroyed&&t.destroy(!1),u.splice(h,n,f)}else u.push(f);const l="undefined"!=typeof OffscreenCanvas&&n.element instanceof OffscreenCanvas?n.element:(n=>{const e=Ot();let s;if(n instanceof HTMLCanvasElement||n.tagName.toLowerCase()===g)s=n,s.dataset[t]??=p,s.dataset[t]===d&&(s.style.width||=Zt,s.style.height||=Zt,s.style.pointerEvents="none",s.style.setProperty("pointer-events","none"));else{const i=n.getElementsByTagName(g).item(0);i?(s=i,s.dataset[t]=p):(s=e.createElement(g),s.dataset[t]=d,n.appendChild(s)),s.style.width||=Zt,s.style.height||=Zt,s.style.pointerEvents="none",s.style.setProperty("pointer-events","none")}return s})(((n,e)=>{const s=Ot();let i=e??s.getElementById(n);return i||(i=s.createElement("canvas"),i.id=n,i.dataset[t]=d,s.body.append(i),i)})(i,e));return f.canvas.loadCanvas(l),await f.start(),f}async refresh(t=!0){t&&await Promise.all(this.items.map((t=>t.refresh())))}removeEventListener(t,n){this.#f.removeEventListener(t,n)}};let pn,gn,wn=!1;async function mn(t){if(!wn)if(pn){if(gn!==t)throw new Error("initParticlesEngine callback must be stable across the app lifecycle.");await pn}else gn=t,pn=(async()=>{t&&await t(dn),"function"==typeof dn.init&&await dn.init(),wn=!0})().catch((t=>{throw pn=void 0,gn=void 0,wn=!1,t})),await pn}function vn(){return wn}async function Mn(){await(null!=pn?pn:Promise.resolve())}export{Tt as $,rn as A,E as B,gt as C,G as D,tt as E,K as F,X as G,Q as H,Z as I,Y as J,o as K,sn as L,et as M,ln as N,an as O,Ct as P,C as Q,tn as R,n as S,J as T,nt as U,Yt as V,D as W,z as X,Ft as Y,t as Z,It as _,ft as a,Vt as a0,Ot as a1,r as a2,Gt as a3,s as a4,e as a5,it as a6,Wt as a7,V as a8,c as a9,B as aA,y as aB,b as aC,wt as aD,T as aE,F as aF,mt as aG,l as aH,vn as aI,Mn as aJ,w as aa,j as ab,kt as ac,Mt as ad,pt as ae,zt as af,vt as ag,$ as ah,qt as ai,St as aj,un as ak,at as al,Lt as am,yt as an,_t as ao,Bt as ap,f as aq,At as ar,v as as,H as at,q as au,I as av,M as aw,R as ax,U as ay,_ as az,Pt as b,xt as c,P as d,A as e,k as f,x as g,S as h,mn as i,ot as j,ht as k,W as l,$t as m,ct as n,ut as o,Ht as p,rt as q,jt as r,m as s,dn as t,O as u,u as v,N as w,a as x,h as y,L as z}
@@ -1 +1 @@
1
- import{r as t,c as i,h as s}from"./p-PhwiK2_P.js";import{i as e,t as a}from"./p-Buaac_o7.js";const n=class{constructor(s){t(this,s),this.particlesLoaded=i(this,"particlesLoaded"),this.renderId=0}async componentDidLoad(){await this.loadParticles(++this.renderId)}disconnectedCallback(){var t;this.renderId++,null===(t=this.container)||void 0===t||t.destroy(),this.container=void 0}async onPropsChange(){await this.loadParticles(++this.renderId)}async onThemeChange(){var t,i;this.container&&(null===(i=(t=this.container).loadTheme)||void 0===i||i.call(t,this.theme))}async loadParticles(t){var i,s,n;if(null===(i=this.container)||void 0===i||i.destroy(),!this.containerElement)return void console.warn("[stencil-particles] container element not available yet");let o;try{if(this.init&&await e(this.init),!this.options&&!this.url)return void console.warn("[stencil-particles] neither options nor url provided");const t=Object.assign(Object.assign({element:this.containerElement},this.containerId?{id:this.containerId}:{}),this.options?{options:this.options}:{url:this.url});o=await a.load(t)}catch(t){return void console.error("[stencil-particles] load failed",t)}t===this.renderId?(this.container=o,this.particlesLoaded.emit(o),o&&this.theme&&(null===(n=(s=o).loadTheme)||void 0===n||n.call(s,this.theme))):null==o||o.destroy()}render(){return s("div",{key:"f5fe33d147a1a606a75fe0d1ee385bacaf0e0b7d",id:this.containerId,ref:t=>{this.containerElement=t},style:{width:"100%",height:"100%"}})}static get watchers(){return{options:[{onPropsChange:0}],url:[{onPropsChange:0}],init:[{onPropsChange:0}],containerId:[{onPropsChange:0}],theme:[{onThemeChange:0}]}}};export{n as stencil_particles}
1
+ import{r as t,c as i,h as s}from"./p-PhwiK2_P.js";import{i as e,t as n}from"./p-CtlWkxPP.js";const a=class{constructor(s){t(this,s),this.particlesLoaded=i(this,"particlesLoaded"),this.renderId=0}async componentDidLoad(){await this.loadParticles(++this.renderId)}disconnectedCallback(){var t;this.renderId++,null===(t=this.container)||void 0===t||t.destroy(),this.container=void 0}async onPropsChange(){await this.loadParticles(++this.renderId)}async onThemeChange(){var t,i;this.container&&(null===(i=(t=this.container).loadTheme)||void 0===i||i.call(t,this.theme))}async loadParticles(t){var i,s,a;if(null===(i=this.container)||void 0===i||i.destroy(),!this.containerElement)return void console.warn("[stencil-particles] container element not available yet");let o;try{if(this.init&&await e(this.init),!this.options&&!this.url)return void console.warn("[stencil-particles] neither options nor url provided");const t=Object.assign(Object.assign({element:this.containerElement},this.containerId?{id:this.containerId}:{}),this.options?{options:this.options}:{url:this.url});o=await n.load(t)}catch(t){return void console.error("[stencil-particles] load failed",t)}t===this.renderId?(this.container=o,this.particlesLoaded.emit(o),o&&this.theme&&(null===(a=(s=o).loadTheme)||void 0===a||a.call(s,this.theme))):null==o||o.destroy()}render(){return s("div",{key:"f5fe33d147a1a606a75fe0d1ee385bacaf0e0b7d",id:this.containerId,ref:t=>{this.containerElement=t},style:{width:"100%",height:"100%"}})}static get watchers(){return{options:[{onPropsChange:0}],url:[{onPropsChange:0}],init:[{onPropsChange:0}],containerId:[{onPropsChange:0}],theme:[{onThemeChange:0}]}}};export{a as stencil_particles}
@@ -1 +1 @@
1
- import{p as n,b as o}from"./p-PhwiK2_P.js";export{s as setNonce}from"./p-PhwiK2_P.js";import{g as e}from"./p-DQuL1Twl.js";(()=>{const o=import.meta.url,e={};return""!==o&&(e.resourcesUrl=new URL(".",o).href),n(e)})().then((async n=>(await e(),o([["p-0204e6c5",[[0,"stencil-particles",{options:[16],url:[1],init:[16],containerId:[1,"container-id"],theme:[1]},null,{options:[{onPropsChange:0}],url:[{onPropsChange:0}],init:[{onPropsChange:0}],containerId:[{onPropsChange:0}],theme:[{onThemeChange:0}]}]]]],n))));
1
+ import{p as n,b as o}from"./p-PhwiK2_P.js";export{s as setNonce}from"./p-PhwiK2_P.js";import{g as e}from"./p-DQuL1Twl.js";(()=>{const o=import.meta.url,e={};return""!==o&&(e.resourcesUrl=new URL(".",o).href),n(e)})().then((async n=>(await e(),o([["p-f780159e",[[0,"stencil-particles",{options:[16],url:[1],init:[16],containerId:[1,"container-id"],theme:[1]},null,{options:[{onPropsChange:0}],url:[{onPropsChange:0}],init:[{onPropsChange:0}],containerId:[{onPropsChange:0}],theme:[{onThemeChange:0}]}]]]],n))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/stencil",
3
- "version": "4.3.1",
3
+ "version": "4.3.2",
4
4
  "description": "Official tsParticles Stencil Component - Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website.",
5
5
  "license": "MIT",
6
6
  "author": "Matteo Bruni <matteo.bruni@me.com>",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@stencil/core": "^4.43.5",
44
- "@tsparticles/engine": "4.3.1",
44
+ "@tsparticles/engine": "4.3.2",
45
45
  "typescript": "^6.0.3"
46
46
  },
47
47
  "publishConfig": {
@@ -61,5 +61,5 @@
61
61
  "@stencil/core": "^4",
62
62
  "@tsparticles/engine": "workspace:*"
63
63
  },
64
- "gitHead": "44ad3740249e218b285bd24a7400b77459bbffa2"
64
+ "gitHead": "527bc42f2324fbb9b93262efa3d90a5517532b8b"
65
65
  }
@@ -1 +0,0 @@
1
- const t="generated",n="source-over",e="resize",s="visibilitychange",a=100,i=.5,r=1e3,o={x:0,y:0,z:0},c={a:1,b:0,c:0,d:1},u="random",h=2,f=2*Math.PI,l=60,d="true",p="false",g="canvas",w=0,m=2,M=100,v=1,y=1,b=1,E=255,P=360,x=100,A=100,S=0,L=0,k=60,z=1,C=0,D=1,O=1,T=120,_=0,F=1,B=1,j=0,$=0,H=1,q=0,I=0,R=1,U=1,G=0,J=1,N=0,V=1,W=0,X=400,K=3,Q=6,Y=1,Z=1,tt=0,nt=1;var et;function st(t){return"z"in t?t.z:o.z}!function(t){t.bottom="bottom",t.bottomLeft="bottom-left",t.bottomRight="bottom-right",t.left="left",t.none="none",t.right="right",t.top="top",t.topLeft="top-left",t.topRight="top-right",t.outside="outside",t.inside="inside"}(et||(et={}));class at{x;y;z;constructor(t=o.x,n=o.y,e=o.z){this.x=t,this.y=n,this.z=e}static get origin(){return at.create(o.x,o.y,o.z)}get angle(){return Math.atan2(this.y,this.x)}set angle(t){this.#t(t,this.length)}get length(){return Math.sqrt(this.getLengthSq())}set length(t){this.#t(this.angle,t)}static clone(t){return at.create(t.x,t.y,st(t))}static create(t,n,e){return"number"==typeof t?new at(t,n??o.y,e??o.z):new at(t.x,t.y,st(t))}add(t){return at.create(this.x+t.x,this.y+t.y,this.z+st(t))}addTo(t){this.x+=t.x,this.y+=t.y,this.z+=st(t)}copy(){return at.clone(this)}div(t){return at.create(this.x/t,this.y/t,this.z/t)}getLengthSq(){return this.x**2+this.y**2}mult(t){return at.create(this.x*t,this.y*t,this.z*t)}multTo(t){this.x*=t,this.y*=t,this.z*=t}normalize(){const t=this.length;0!=t&&this.multTo(1/t)}rotate(t){return at.create(this.x*Math.cos(t)-this.y*Math.sin(t),this.x*Math.sin(t)+this.y*Math.cos(t),o.z)}setTo(t){this.x=t.x,this.y=t.y,this.z=st(t)}sub(t){return at.create(this.x-t.x,this.y-t.y,this.z-st(t))}subFrom(t){this.x-=t.x,this.y-=t.y,this.z-=st(t)}#t(t,n){this.x=Math.cos(t)*n,this.y=Math.sin(t)*n}}class it extends at{constructor(t=o.x,n=o.y){super(t,n,o.z)}static get origin(){return it.create(o.x,o.y)}static clone(t){return it.create(t.x,t.y)}static create(t,n){return"number"==typeof t?new it(t,n??o.y):new it(t.x,t.y)}}function rt(t){return"boolean"==typeof t}function ot(t){return"string"==typeof t}function ct(t){return"number"==typeof t}function ut(t){return"object"==typeof t&&null!==t}function ht(t){return Array.isArray(t)}function ft(t){return null==t}const lt=Math.PI/180;let dt=Math.random;function pt(){return Mt(dt(),0,1-Number.EPSILON)}function gt(t,n){return pt()*(n-t)+t}function wt(t){return requestAnimationFrame(t)}function mt(t){cancelAnimationFrame(t)}function Mt(t,n,e){return Math.min(Math.max(t,n),e)}function vt(t){const n=Et(t);let e=bt(t);return n===e&&(e=0),gt(e,n)}function yt(t){return ct(t)?t:vt(t)}function bt(t){return ct(t)?t:t.min}function Et(t){return ct(t)?t:t.max}function Pt(t,n){if(t===n||void 0===n&&ct(t))return t;const e=bt(t),s=Et(t);return void 0!==n?{min:Math.min(e,n),max:Math.max(s,n)}:Pt(e,s)}function xt(t,n,e){return function(t,n){const e=t.x-n.x,s=t.y-n.y;return e*e+s*s}(t,n)<=e*e}function At(t){return t*lt}function St(t,n,e){if(ct(t))return At(t);switch(t){case et.top:return.5*-Math.PI;case et.topRight:return.25*-Math.PI;case et.right:return 0;case et.bottomRight:return.25*Math.PI;case et.bottom:return.5*Math.PI;case et.bottomLeft:return.75*Math.PI;case et.left:return Math.PI;case et.topLeft:return.75*-Math.PI;case et.inside:return Math.atan2(e.y-n.y,e.x-n.x);case et.outside:return Math.atan2(n.y-e.y,n.x-e.x);default:return pt()*f}}function Lt(t){const n=it.origin;return n.length=1,n.angle=t,n}function kt(t){const{position:n,size:e}=t;return{x:n?.x??pt()*e.width,y:n?.y??pt()*e.height}}var zt,Ct;function Dt(){return globalThis.document}function Ot(t){if("undefined"!=typeof matchMedia)return matchMedia(t)}function Tt(t){if("undefined"!=typeof MutationObserver)return new MutationObserver(t)}function _t(t,n){return t===n||ht(n)&&n.includes(t)}function Ft(t,n,e=!0){return t[void 0!==n&&e?n%t.length:Math.floor(pt()*t.length)]}function Bt(t,...n){for(const e of n){if(ft(e))continue;if(!ut(e)){t=e;continue}Array.isArray(e)?Array.isArray(t)||(t=[]):ut(t)&&!Array.isArray(t)||(t=Object.create(null));const n=Object.keys(e);if(n.some((t=>{const n=e[t];return ut(n)||Array.isArray(n)})))for(const s of n){if("__proto__"===s||"constructor"===s||"prototype"===s)continue;const n=t,a=e[s];n[s]=Array.isArray(a)?a.map((t=>Bt(void 0,t))):Bt(n[s],a)}else{const s=e,a=t;for(const t of n){if("__proto__"===t||"constructor"===t||"prototype"===t)continue;const n=s[t];void 0!==n&&(a[t]=n)}}}return t}function jt(t,n){return ht(t)?t.map(((t,e)=>n(t,e))):n(t,0)}function $t(t,n,e){return ht(t)?Ft(t,n,e):t}function Ht(t,n){return function(t,n){if(t.mode!==Ct.percent){const{mode:n,...e}=t;return e}return"x"in t?{x:t.x/a*n.width,y:t.y/a*n.height}:{width:t.width/a*n.width,height:t.height/a*n.height}}(t,n)}function qt(t){const n=Dt().createElement("div").style;for(const e in t){const s=t[e];if(!(e in t)||ft(s))continue;const a=t.getPropertyValue?.(s);if(!a)continue;const i=t.getPropertyPriority?.(s);i?n.setProperty(s,a,i):n.setProperty(s,a)}return n}let It,Rt;function Ut(t){if(It!==t||!Rt){It=t;const n=Dt().createElement("div").style,e=10,s={width:"100%",height:"100%",margin:"0",padding:"0",borderWidth:"0",position:"fixed",zIndex:t.toString(e),"z-index":t.toString(e),top:"0",left:"0","pointer-events":"none"};for(const t in s){const e=s[t];void 0!==e&&n.setProperty(t,e)}Rt=n}return Rt}function Gt(t,n,e,s,a){if(s){let s={passive:!0};rt(a)?s.capture=a:void 0!==a&&(s=a),t.addEventListener(n,e,s)}else t.removeEventListener(n,e,a)}async function Jt(t,n,e,s=!1){let a=n.get(t);if(!a||s){const s=await Promise.all([...e.entries()].map((([n,e])=>e(t).then((t=>[n,t])))));a=new Map(s),n.set(t,a)}return a}!function(t){t.bottom="bottom",t.left="left",t.right="right",t.top="top"}(zt||(zt={})),function(t){t.precise="precise",t.percent="percent"}(Ct||(Ct={}));class Nt{#n;constructor(){this.#n=new Map}addEventListener(t,n){this.removeEventListener(t,n);let e=this.#n.get(t);e||(e=[],this.#n.set(t,e)),e.push(n)}dispatchEvent(t,n){const e=this.#n.get(t);e?.forEach((t=>{t(n)}))}hasEventListener(t){return!!this.#n.get(t)}removeAllEventListeners(t){t?this.#n.delete(t):this.#n=new Map}removeEventListener(t,n){const e=this.#n.get(t);if(!e)return;const s=e.length,a=e.indexOf(n);a<0||(1===s?this.#n.delete(t):e.splice(a,1))}}var Vt;!function(t){t.configAdded="configAdded",t.containerInit="containerInit",t.particlesSetup="particlesSetup",t.containerStarted="containerStarted",t.containerStopped="containerStopped",t.containerDestroyed="containerDestroyed",t.containerPaused="containerPaused",t.containerPlay="containerPlay",t.containerBuilt="containerBuilt",t.particleAdded="particleAdded",t.particleDestroyed="particleDestroyed",t.particleRemoved="particleRemoved"}(Vt||(Vt={}));class Wt{colorManagers=new Map;easingFunctions=new Map;effectDrawers=new Map;initializers={effects:new Map,shapes:new Map,updaters:new Map};palettes=new Map;plugins=[];presets=new Map;shapeDrawers=new Map;updaters=new Map;#e=new Set;#s=new Map;#a;#i=new Set;#r=!1;#o=!1;#c=new Set;constructor(t){this.#a=t}get configs(){const t={};for(const[n,e]of this.#s)t[n]=e;return t}addColorManager(t,n){this.colorManagers.set(t,n)}addConfig(t){const n=t.key??t.name??"default";this.#s.set(n,t),this.#a.dispatchEvent(Vt.configAdded,{data:{name:n,config:t}})}addEasing(t,n){this.easingFunctions.get(t)||this.easingFunctions.set(t,n)}addEffect(t,n){this.initializers.effects.set(t,n)}addPalette(t,n){this.palettes.set(t,n)}addParticleUpdater(t,n){this.initializers.updaters.set(t,n)}addPlugin(t){this.getPlugin(t.id)||this.plugins.push(t)}addPreset(t,n,e=!1){!e&&this.getPreset(t)||this.presets.set(t,n)}addShape(t,n){for(const e of t)this.initializers.shapes.set(e,n)}clearPlugins(t){this.effectDrawers.delete(t),this.shapeDrawers.delete(t),this.updaters.delete(t)}getEasing(t){return this.easingFunctions.get(t)??(t=>t)}getEffectDrawers(t,n=!1){return Jt(t,this.effectDrawers,this.initializers.effects,n)}getPalette(t){return this.palettes.get(t)}getPlugin(t){return this.plugins.find((n=>n.id===t))}getPreset(t){return this.presets.get(t)}async getShapeDrawers(t,n=!1){return Jt(t,this.shapeDrawers,this.initializers.shapes,n)}async getUpdaters(t,n=!1){return async function(t,n,e,s=!1){let a=n.get(t);return a&&!s||(a=await Promise.all([...e.values()].map((n=>n(t)))),n.set(t,a)),a}(t,this.updaters,this.initializers.updaters,n)}async init(){if(!this.#r&&!this.#o){this.#o=!0,this.#i=new Set,this.#e=new Set(this.#c);try{for(const t of this.#e)await this.#u(t,this.#i,this.#e)}finally{this.#c.clear(),this.#o=!1,this.#r=!0}}}loadParticlesOptions(t,n,...e){const s=this.updaters.get(t);s&&s.forEach((t=>t.loadOptions?.(n,...e)))}async register(...t){if(this.#r)throw new Error("Register plugins can only be done before calling tsParticles.load()");for(const n of t)this.#o?await this.#u(n,this.#i,this.#e):this.#c.add(n)}async#u(t,n,e){n.has(t)||(n.add(t),e.add(t),await t(this.#a))}}const Xt=t=>(...n)=>{t(...n)},Kt={debug:Xt(console.debug),error:(t,...n)=>{console.error(`tsParticles - Error - ${t}`,...n)},info:Xt(console.info),log:Xt(console.log),trace:Xt(console.trace),verbose:Xt(console.log),warning:Xt(console.warn)};function Qt(){return Kt}const Yt="100%";var Zt,tn,nn,en,sn,an,rn,on,cn,un,hn,fn;!function(t){t.circle="circle",t.rectangle="rectangle"}(Zt||(Zt={})),function(t){t.clockwise="clockwise",t.counterClockwise="counter-clockwise",t.random="random"}(tn||(tn={})),function(t){t.auto="auto",t.increase="increase",t.decrease="decrease",t.random="random"}(nn||(nn={})),function(t){t.delete="delete",t.wait="wait"}(en||(en={})),function(t){t.bounce="bounce",t.none="none",t.out="out",t.destroy="destroy",t.split="split"}(sn||(sn={})),function(t){t.darken="darken",t.enlighten="enlighten"}(an||(an={})),function(t){t.none="none",t.max="max",t.min="min"}(rn||(rn={})),function(t){t.linear="linear",t.radial="radial",t.random="random"}(on||(on={})),function(t){t.normal="normal",t.inside="inside",t.outside="outside"}(cn||(cn={})),function(t){t.max="max",t.min="min",t.random="random"}(un||(un={})),function(t){t.increasing="increasing",t.decreasing="decreasing"}(hn||(hn={})),function(t){t[t.BackgroundElement=0]="BackgroundElement",t[t.BackgroundDraw=1]="BackgroundDraw",t[t.BackgroundMask=2]="BackgroundMask",t[t.CanvasSetup=3]="CanvasSetup",t[t.PluginContent=4]="PluginContent",t[t.Particles=5]="Particles",t[t.CanvasCleanup=6]="CanvasCleanup",t[t.Foreground=7]="Foreground"}(fn||(fn={}));const ln=new class{pluginManager=new Wt(this);#h=[];#f=new Nt;#r=!1;get items(){return this.#h}get version(){return"4.3.1"}addEventListener(t,n){this.#f.addEventListener(t,n)}checkVersion(t){if(this.version!==t)throw new Error(`The tsParticles version is different from the loaded plugins version. Engine version: ${this.version}. Plugin version: ${t}`)}dispatchEvent(t,n){this.#f.dispatchEvent(t,n)}async init(){this.#r||(await this.pluginManager.init(),this.#r=!0)}item(t){const n=this.items,e=n[t];if(!e?.destroyed)return e;n.splice(t,1)}async load(n){let e;await this.init(),"undefined"!=typeof HTMLElement&&n.element instanceof HTMLElement&&(e=n.element);const{Container:s}=await import("./p-BMflXhxM.js"),a=n.id??e?.id??`tsparticles${Math.floor(1e4*pt()).toString()}`,{index:i,url:r}=n,o=r?await async function(t){const n=$t(t.url,t.index);if(!n)return t.fallback;const e=await fetch(n);return e.ok?await e.json():(Qt().error(`${e.status.toString()} while retrieving config file`),t.fallback)}({fallback:n.options,url:r,index:i}):n.options,c=$t(o,i),{items:u}=this,h=u.findIndex((t=>t.id.description===a)),f=new s({dispatchCallback:(t,n)=>{this.dispatchEvent(t,n)},id:a,onDestroy:t=>{if(!t)return;const n=this.items,e=n.indexOf(f);e>=0&&n.splice(e,1)},pluginManager:this.pluginManager,sourceOptions:c});if(h>=0){const t=this.item(h),n=t?1:0;t&&!t.destroyed&&t.destroy(!1),u.splice(h,n,f)}else u.push(f);const l="undefined"!=typeof OffscreenCanvas&&n.element instanceof OffscreenCanvas?n.element:(n=>{const e=Dt();let s;if(n instanceof HTMLCanvasElement||n.tagName.toLowerCase()===g)s=n,s.dataset[t]??=p,s.dataset[t]===d&&(s.style.width||=Yt,s.style.height||=Yt,s.style.pointerEvents="none",s.style.setProperty("pointer-events","none"));else{const a=n.getElementsByTagName(g).item(0);a?(s=a,s.dataset[t]=p):(s=e.createElement(g),s.dataset[t]=d,n.appendChild(s)),s.style.width||=Yt,s.style.height||=Yt,s.style.pointerEvents="none",s.style.setProperty("pointer-events","none")}return s})(((n,e)=>{const s=Dt();let a=e??s.getElementById(n);return a||(a=s.createElement("canvas"),a.id=n,a.dataset[t]=d,s.body.append(a),a)})(a,e));return f.canvas.loadCanvas(l),await f.start(),f}async refresh(t=!0){t&&await Promise.all(this.items.map((t=>t.refresh())))}removeEventListener(t,n){this.#f.removeEventListener(t,n)}};let dn,pn,gn=!1;async function wn(t){if(!gn)if(dn){if(pn!==t)throw new Error("initParticlesEngine callback must be stable across the app lifecycle.");await dn}else pn=t,dn=(async()=>{t&&await t(ln),"function"==typeof ln.init&&await ln.init(),gn=!0})().catch((t=>{throw dn=void 0,pn=void 0,gn=!1,t})),await dn}function mn(){return gn}async function Mn(){await(null!=dn?dn:Promise.resolve())}export{Ot as $,an as A,E as B,gt as C,J as D,tt as E,X as F,Q as G,K as H,Z as I,Y as J,o as K,en as L,et as M,fn as N,sn as O,Ct as P,C as Q,Zt as R,n as S,N as T,nt as U,Qt as V,D as W,z as X,Tt as Y,t as Z,qt as _,ft as a,Ut as a0,Dt as a1,r as a2,Gt as a3,s as a4,e as a5,at as a6,Vt as a7,G as a8,c as a9,F as aA,y as aB,b as aC,wt as aD,T as aE,_ as aF,mt as aG,l as aH,mn as aI,Mn as aJ,w as aa,B as ab,Lt as ac,vt as ad,pt as ae,zt as af,Mt as ag,j as ah,Ht as ai,St as aj,cn as ak,it as al,kt as am,yt as an,$t as ao,_t as ap,f as aq,At as ar,M as as,$ as at,q as au,I as av,v as aw,R as ax,U as ay,H as az,Pt as b,xt as c,P as d,A as e,L as f,x as g,S as h,wn as i,ot as j,ht as k,W as l,Bt as m,ct as n,ut as o,jt as p,rt as q,Ft as r,m as s,ln as t,O as u,u as v,V as w,i as x,h as y,k as z}