"use strict";(globalThis.webpackChunkwordpress_particles=globalThis.webpackChunkwordpress_particles||[]).push([[3352],{1688:(t,e,i)=>{i.d(e,{$:()=>n});class n{constructor(t){this.container=t,this.type="particles"}}},3352:(t,e,i)=>{i.r(e),i.d(e,{loadInfectionPlugin:()=>u});var n=i(2187);class s{constructor(){this.color=new n.O,this.color.value="#ff0000",this.radius=0,this.rate=1}load(t){void 0!==t&&(void 0!==t.color&&(this.color=n.O.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 o{constructor(){this.cure=!1,this.delay=0,this.enable=!1,this.infections=0,this.stages=[]}load(t){void 0!==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}))))}}var a=i(4684);class c{constructor(t){this._nextInfectionStage=t=>{const e=this._container.actualOptions.infection,{infection:i}=t;if(!e||!i)return;const n=e.stages.length;if(!(n<=0||void 0===i.stage)&&(i.time=0,n<=++i.stage)){if(e.cure)return delete i.stage,void delete i.time;i.stage=0,i.time=0}},this._container=t}startInfection(t,e){const i=this._container.actualOptions.infection,{infection:n}=t;i&&n&&(e>i.stages.length||e<0||(n.delay=0,n.delayStage=e))}updateInfection(t,e){const i=this._container.actualOptions.infection,{infection:n}=t;if(!i||!n)return;const s=i.stages,o=s.length;if(void 0!==n.delay&&void 0!==n.delayStage){const t=n.delayStage;if(t>o||t<0)return;n.delay>=1e3*i.delay?(n.stage=t,n.time=0,delete n.delay,delete n.delayStage):n.delay+=e}else delete n.delay,delete n.delayStage;if(void 0!==n.stage&&void 0!==n.time){const i=s[n.stage];void 0!==i.duration&&i.duration>=0&&n.time>1e3*i.duration?this._nextInfectionStage(t):n.time+=e}else delete n.stage,delete n.time}updateInfectionStage(t,e){const i=this._container.actualOptions,{infection:n}=t;i.infection&&n&&(e>i.infection.stages.length||e<0||void 0!==n.stage&&n.stage>e||(n.stage=e,n.time=0))}}class r{constructor(t){this._container=t,this._container.infecter=new c(this._container)}particleFillColor(t){const e=this._container.actualOptions;if(!t.infection||!e.infection)return;const i=t.infection.stage,n=e.infection.stages;return void 0!==i?n[i].color:void 0}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||(e.infection={}),void 0===e.infection.stage})),e=(0,a.c8)(t);this._container.infecter?.startInfection(e,0)}}}var l=i(1688),d=i(5302);class f extends l.${constructor(t){super(t)}clear(){}init(){}async interact(t,e){const i=this.container.infecter;if(!i)return;if(i.updateInfection(t,e.value),void 0===t.infection?.stage)return;const n=this.container,s=n.actualOptions.infection;if(!s?.enable||s.stages.length<1)return;const o=s.stages[t.infection.stage],a=n.retina.pixelRatio,c=2*t.getRadius()+o.radius*a,r=t.getPosition(),l=o.infectedStage??t.infection.stage,f=n.particles.quadTree.queryCircle(r,c),g=o.rate,u=f.length;for(const e of f){const n=e;if(!(n===t||n.destroyed||n.spawning||void 0!==n.infection?.stage&&n.infection.stage===t.infection.stage||(0,d.sZ)()>=g/u))if(void 0===n.infection?.stage)i.startInfection(n,l);else if(n.infection.stage<t.infection.stage)i.updateInfectionStage(n,l);else if(n.infection.stage>t.infection.stage){const e=s.stages[n.infection.stage],o=e?.infectedStage??n.infection.stage;i.updateInfectionStage(t,o)}}}isEnabled(){return this.container.actualOptions?.infection?.enable??!1}reset(){}}class g{constructor(){this.id="infection"}getPlugin(t){return new r(t)}loadOptions(t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let i=t.infection;void 0===i?.load&&(t.infection=i=new o),i.load(e?.infection)}needsPlugin(t){return t?.infection?.enable??!1}}async function u(t,e=!0){const i=new g;await t.addPlugin(i,e),await t.addInteractor("particlesInfection",(t=>new f(t)),e)}}}]);