@tsparticles/plugin-infection 4.0.0-beta.15 → 4.0.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { InfectionPlugin } from "./InfectionPlugin.js";
3
3
  import { ParticlesInfecter } from "./ParticlesInfecter.js";
4
4
  export async function loadInfectionPlugin(engine) {
5
- engine.checkVersion("4.0.0-beta.15");
5
+ engine.checkVersion("4.0.0-beta.16");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new InfectionPlugin());
@@ -1,5 +1,5 @@
1
1
  export async function loadInfectionPlugin(engine) {
2
- engine.checkVersion("4.0.0-beta.15");
2
+ engine.checkVersion("4.0.0-beta.16");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
package/cjs/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { InfectionPlugin } from "./InfectionPlugin.js";
3
3
  import { ParticlesInfecter } from "./ParticlesInfecter.js";
4
4
  export async function loadInfectionPlugin(engine) {
5
- engine.checkVersion("4.0.0-beta.15");
5
+ engine.checkVersion("4.0.0-beta.16");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new InfectionPlugin());
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadInfectionPlugin(engine) {
2
- engine.checkVersion("4.0.0-beta.15");
2
+ engine.checkVersion("4.0.0-beta.16");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
package/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { InfectionPlugin } from "./InfectionPlugin.js";
3
3
  import { ParticlesInfecter } from "./ParticlesInfecter.js";
4
4
  export async function loadInfectionPlugin(engine) {
5
- engine.checkVersion("4.0.0-beta.15");
5
+ engine.checkVersion("4.0.0-beta.16");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new InfectionPlugin());
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadInfectionPlugin(engine) {
2
- engine.checkVersion("4.0.0-beta.15");
2
+ engine.checkVersion("4.0.0-beta.16");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-infection",
3
- "version": "4.0.0-beta.15",
3
+ "version": "4.0.0-beta.16",
4
4
  "description": "tsParticles infection plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -106,8 +106,8 @@
106
106
  "./package.json": "./package.json"
107
107
  },
108
108
  "peerDependencies": {
109
- "@tsparticles/engine": "4.0.0-beta.15",
110
- "@tsparticles/plugin-interactivity": "4.0.0-beta.15"
109
+ "@tsparticles/engine": "4.0.0-beta.16",
110
+ "@tsparticles/plugin-interactivity": "4.0.0-beta.16"
111
111
  },
112
112
  "publishConfig": {
113
113
  "access": "public"
@@ -1,5 +1,5 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* Plugin v4.0.0-beta.15 */
2
+ /* Plugin v4.0.0-beta.16 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/plugin-interactivity'), require('@tsparticles/engine')) :
5
5
  typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/plugin-interactivity', '@tsparticles/engine'], factory) :
@@ -163,7 +163,7 @@
163
163
  }
164
164
 
165
165
  async function loadInfectionPlugin(engine) {
166
- engine.checkVersion("4.0.0-beta.15");
166
+ engine.checkVersion("4.0.0-beta.16");
167
167
  await engine.pluginManager.register((e) => {
168
168
  pluginInteractivity.ensureInteractivityPluginLoaded(e);
169
169
  e.pluginManager.addPlugin(new InfectionPlugin());
@@ -1 +1 @@
1
- !function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.infection=t.__tsParticlesInternals.plugins.infection||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,n){"use strict";class s{color;duration;infectedStage;radius;rate;constructor(){this.color=new n.OptionsColor,this.color.value="#ff0000",this.radius=0,this.rate=1}load(t){n.isNull(t)||(void 0!==t.color&&(this.color=n.OptionsColor.create(this.color,t.color)),this.duration=t.duration,this.infectedStage=t.infectedStage,void 0!==t.radius&&(this.radius=t.radius),void 0!==t.rate&&(this.rate=t.rate))}}class i{cure;delay;enable;infections;stages;constructor(){this.cure=!1,this.delay=0,this.enable=!1,this.infections=0,this.stages=[]}load(t){n.isNull(t)||(void 0!==t.cure&&(this.cure=t.cure),void 0!==t.delay&&(this.delay=t.delay),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.infections&&(this.infections=t.infections),void 0!==t.stages&&(this.stages=t.stages.map(t=>{const e=new s;return e.load(t),e})))}}class a{id="infection";async getPlugin(t){const{InfectionPluginInstance:e}=await Promise.resolve().then(function(){return _});return new e(t)}loadOptions(t,e,n){if(!this.needsPlugin(e)&&!this.needsPlugin(n))return;let s=e.infection;void 0===s?.load&&(e.infection=s=new i),s.load(n?.infection)}needsPlugin(t){return t?.infection?.enable??!1}}class r extends e.ParticlesInteractorBase{_maxDistance;constructor(t){super(t),this._maxDistance=0}get maxDistance(){return this._maxDistance}clear(){}init(){}interact(t,e,s){const i=this.container.infecter;if(!i)return;if(i.updateInfection(t,s.value),void 0===t.infection?.stage)return;const a=this.container,r=a.actualOptions.infection;if(!r?.enable||r.stages.length<1)return;const l=r.stages[t.infection.stage];if(!l)return;this._maxDistance=Math.max(this._maxDistance,l.radius);const c=a.retina.pixelRatio,o=t.getRadius()*n.double+l.radius*c,_=t.getPosition(),u=l.infectedStage??t.infection.stage,d=a.particles.grid.queryCircle(_,o),f=l.rate,g=d.length;for(const e of d){const s=e;if(!(s===t||s.destroyed||s.spawning||void 0!==s.infection?.stage&&s.infection.stage===t.infection.stage||n.getRandom()>=f/g))if(void 0===s.infection?.stage)i.startInfection(s,u);else if(s.infection.stage<t.infection.stage)i.updateInfectionStage(s,u);else if(s.infection.stage>t.infection.stage){const e=r.stages[s.infection.stage];if(!e)continue;const n=e.infectedStage??s.infection.stage;i.updateInfectionStage(t,n)}}}isEnabled(){return this.container.actualOptions.infection?.enable??!1}reset(){}}async function l(t){t.checkVersion("4.0.0-beta.15"),await t.pluginManager.register(t=>{e.ensureInteractivityPluginLoaded(t),t.pluginManager.addPlugin(new a),t.pluginManager.addInteractor?.("particlesInfection",t=>Promise.resolve(new r(t)))})}const c=globalThis;c.__tsParticlesInternals=c.__tsParticlesInternals??{},c.loadInfectionPlugin=l;class o{_container;constructor(t){this._container=t}startInfection(t,e){const n=this._container.actualOptions.infection,{infection:s}=t;if(!n||!s)return;e>n.stages.length||e<0||(s.delay=0,s.delayStage=e)}updateInfection(t,e){const s=this._container.actualOptions.infection,{infection:i}=t;if(!s||!i)return;const a=s.stages,r=a.length;if(void 0!==i.delay&&void 0!==i.delayStage){const t=i.delayStage;if(t>r||t<0)return;i.delay>=s.delay*n.millisecondsToSeconds?(i.stage=t,i.time=0,delete i.delay,delete i.delayStage):i.delay+=e}else delete i.delay,delete i.delayStage;if(void 0!==i.stage&&void 0!==i.time){const s=a[i.stage];void 0!==s?.duration&&s.duration>=0&&i.time>s.duration*n.millisecondsToSeconds?this._nextInfectionStage(t):i.time+=e}else delete i.stage,delete i.time}updateInfectionStage(t,e){const n=this._container.actualOptions,{infection:s}=t;if(!n.infection||!s)return;e>n.infection.stages.length||e<0||void 0!==s.stage&&s.stage>e||(s.stage=e,s.time=0)}_nextInfectionStage=t=>{const e=this._container.actualOptions.infection,{infection:n}=t;if(!e||!n)return;const s=e.stages.length;s<=0||void 0===n.stage||(n.time=0,s<=++n.stage&&(e.cure?(delete n.stage,delete n.time):(n.stage=0,n.time=0)))}}var _=Object.freeze({__proto__:null,InfectionPluginInstance:class{_container;constructor(t){this._container=t,this._container.infecter=new o(this._container)}particleFillColor(t){const e=this._container.actualOptions;if(!t.infection||!e.infection)return;const n=t.infection.stage,s=e.infection.stages;return void 0===n?void 0:s[n]?.color}particleStrokeColor(t){return this.particleFillColor(t)}particlesSetup(){const t=this._container.actualOptions;if(t.infection)for(let e=0;e<t.infection.infections;e++){const t=this._container.particles.filter(t=>{const e=t;return e.infection??={},void 0===e.infection.stage}),e=n.itemFromArray(t);e&&this._container.infecter?.startInfection(e,0)}}}});t.loadInfectionPlugin=l}),Object.assign(globalThis.window||globalThis,{loadInfectionPlugin:(globalThis.__tsParticlesInternals.plugins.infection||{}).loadInfectionPlugin}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.infection=t.__tsParticlesInternals.plugins.infection||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,n){"use strict";class s{color;duration;infectedStage;radius;rate;constructor(){this.color=new n.OptionsColor,this.color.value="#ff0000",this.radius=0,this.rate=1}load(t){n.isNull(t)||(void 0!==t.color&&(this.color=n.OptionsColor.create(this.color,t.color)),this.duration=t.duration,this.infectedStage=t.infectedStage,void 0!==t.radius&&(this.radius=t.radius),void 0!==t.rate&&(this.rate=t.rate))}}class i{cure;delay;enable;infections;stages;constructor(){this.cure=!1,this.delay=0,this.enable=!1,this.infections=0,this.stages=[]}load(t){n.isNull(t)||(void 0!==t.cure&&(this.cure=t.cure),void 0!==t.delay&&(this.delay=t.delay),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.infections&&(this.infections=t.infections),void 0!==t.stages&&(this.stages=t.stages.map(t=>{const e=new s;return e.load(t),e})))}}class a{id="infection";async getPlugin(t){const{InfectionPluginInstance:e}=await Promise.resolve().then(function(){return _});return new e(t)}loadOptions(t,e,n){if(!this.needsPlugin(e)&&!this.needsPlugin(n))return;let s=e.infection;void 0===s?.load&&(e.infection=s=new i),s.load(n?.infection)}needsPlugin(t){return t?.infection?.enable??!1}}class r extends e.ParticlesInteractorBase{_maxDistance;constructor(t){super(t),this._maxDistance=0}get maxDistance(){return this._maxDistance}clear(){}init(){}interact(t,e,s){const i=this.container.infecter;if(!i)return;if(i.updateInfection(t,s.value),void 0===t.infection?.stage)return;const a=this.container,r=a.actualOptions.infection;if(!r?.enable||r.stages.length<1)return;const l=r.stages[t.infection.stage];if(!l)return;this._maxDistance=Math.max(this._maxDistance,l.radius);const c=a.retina.pixelRatio,o=t.getRadius()*n.double+l.radius*c,_=t.getPosition(),u=l.infectedStage??t.infection.stage,d=a.particles.grid.queryCircle(_,o),f=l.rate,g=d.length;for(const e of d){const s=e;if(!(s===t||s.destroyed||s.spawning||void 0!==s.infection?.stage&&s.infection.stage===t.infection.stage||n.getRandom()>=f/g))if(void 0===s.infection?.stage)i.startInfection(s,u);else if(s.infection.stage<t.infection.stage)i.updateInfectionStage(s,u);else if(s.infection.stage>t.infection.stage){const e=r.stages[s.infection.stage];if(!e)continue;const n=e.infectedStage??s.infection.stage;i.updateInfectionStage(t,n)}}}isEnabled(){return this.container.actualOptions.infection?.enable??!1}reset(){}}async function l(t){t.checkVersion("4.0.0-beta.16"),await t.pluginManager.register(t=>{e.ensureInteractivityPluginLoaded(t),t.pluginManager.addPlugin(new a),t.pluginManager.addInteractor?.("particlesInfection",t=>Promise.resolve(new r(t)))})}const c=globalThis;c.__tsParticlesInternals=c.__tsParticlesInternals??{},c.loadInfectionPlugin=l;class o{_container;constructor(t){this._container=t}startInfection(t,e){const n=this._container.actualOptions.infection,{infection:s}=t;if(!n||!s)return;e>n.stages.length||e<0||(s.delay=0,s.delayStage=e)}updateInfection(t,e){const s=this._container.actualOptions.infection,{infection:i}=t;if(!s||!i)return;const a=s.stages,r=a.length;if(void 0!==i.delay&&void 0!==i.delayStage){const t=i.delayStage;if(t>r||t<0)return;i.delay>=s.delay*n.millisecondsToSeconds?(i.stage=t,i.time=0,delete i.delay,delete i.delayStage):i.delay+=e}else delete i.delay,delete i.delayStage;if(void 0!==i.stage&&void 0!==i.time){const s=a[i.stage];void 0!==s?.duration&&s.duration>=0&&i.time>s.duration*n.millisecondsToSeconds?this._nextInfectionStage(t):i.time+=e}else delete i.stage,delete i.time}updateInfectionStage(t,e){const n=this._container.actualOptions,{infection:s}=t;if(!n.infection||!s)return;e>n.infection.stages.length||e<0||void 0!==s.stage&&s.stage>e||(s.stage=e,s.time=0)}_nextInfectionStage=t=>{const e=this._container.actualOptions.infection,{infection:n}=t;if(!e||!n)return;const s=e.stages.length;s<=0||void 0===n.stage||(n.time=0,s<=++n.stage&&(e.cure?(delete n.stage,delete n.time):(n.stage=0,n.time=0)))}}var _=Object.freeze({__proto__:null,InfectionPluginInstance:class{_container;constructor(t){this._container=t,this._container.infecter=new o(this._container)}particleFillColor(t){const e=this._container.actualOptions;if(!t.infection||!e.infection)return;const n=t.infection.stage,s=e.infection.stages;return void 0===n?void 0:s[n]?.color}particleStrokeColor(t){return this.particleFillColor(t)}particlesSetup(){const t=this._container.actualOptions;if(t.infection)for(let e=0;e<t.infection.infections;e++){const t=this._container.particles.filter(t=>{const e=t;return e.infection??={},void 0===e.infection.stage}),e=n.itemFromArray(t);e&&this._container.infecter?.startInfection(e,0)}}}});t.loadInfectionPlugin=l}),Object.assign(globalThis.window||globalThis,{loadInfectionPlugin:(globalThis.__tsParticlesInternals.plugins.infection||{}).loadInfectionPlugin}),delete(globalThis.window||globalThis).tsparticlesInternalExports;