"use strict";(self.webpackChunkwordpress_particles=self.webpackChunkwordpress_particles||[]).push([[4456],{4456:function(t,a,i){i.r(a),i.d(a,{Attract:function(){return e},loadExternalAttractInteraction:function(){return r}});var c=i(3563);class e{constructor(){this.distance=200,this.duration=.4,this.easing="ease-out-quad",this.factor=1,this.maxSpeed=50,this.speed=1}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),void 0!==t.duration&&(this.duration=t.duration),void 0!==t.easing&&(this.easing=t.easing),void 0!==t.factor&&(this.factor=t.factor),void 0!==t.maxSpeed&&(this.maxSpeed=t.maxSpeed),void 0!==t.speed&&(this.speed=t.speed))}}class n extends c.L8{constructor(t,a){super(a),this._engine=t,a.attract||(a.attract={particles:[]}),this.handleClickMode=t=>{const i=this.container.actualOptions.interactivity.modes.attract;if(i&&"attract"===t){a.attract||(a.attract={particles:[]}),a.attract.clicking=!0,a.attract.count=0;for(const t of a.attract.particles)this.isEnabled(t)&&t.velocity.setTo(t.initialVelocity);a.attract.particles=[],a.attract.finish=!1,setTimeout((()=>{a.destroyed||(a.attract||(a.attract={particles:[]}),a.attract.clicking=!1)}),1e3*i.duration)}}}clear(){}init(){const t=this.container,a=t.actualOptions.interactivity.modes.attract;a&&(t.retina.attractModeDistance=a.distance*t.retina.pixelRatio)}async interact(){const t=this.container,a=t.actualOptions,i=t.interactivity.status===c.Wt,e=a.interactivity.events,n=e.onHover.enable,r=e.onHover.mode,s=e.onClick.enable,o=e.onClick.mode;i&&n&&(0,c.dB)("attract",r)?this.hoverAttract():s&&(0,c.dB)("attract",o)&&this.clickAttract()}isEnabled(t){var a;const i=this.container,e=i.actualOptions,n=i.interactivity.mouse,r=(null!==(a=null==t?void 0:t.interactivity)&&void 0!==a?a:e.interactivity).events;if(!(n.position&&r.onHover.enable||n.clickPosition&&r.onClick.enable))return!1;const s=r.onHover.mode,o=r.onClick.mode;return(0,c.dB)("attract",s)||(0,c.dB)("attract",o)}loadModeOptions(t){t.attract||(t.attract=new e);for(var a=arguments.length,i=new Array(a>1?a-1:0),c=1;c<a;c++)i[c-1]=arguments[c];for(const a of i)t.attract.load(null==a?void 0:a.attract)}reset(){}clickAttract(){const t=this.container;if(t.attract||(t.attract={particles:[]}),t.attract.finish||(t.attract.count||(t.attract.count=0),t.attract.count++,t.attract.count===t.particles.count&&(t.attract.finish=!0)),t.attract.clicking){const a=t.interactivity.mouse.clickPosition,i=t.retina.attractModeDistance;if(!i||i<0||!a)return;this.processAttract(a,i,new c.Cd(a.x,a.y,i))}else!1===t.attract.clicking&&(t.attract.particles=[])}hoverAttract(){const t=this.container,a=t.interactivity.mouse.position,i=t.retina.attractModeDistance;!i||i<0||!a||this.processAttract(a,i,new c.Cd(a.x,a.y,i))}processAttract(t,a,i){const e=this.container,n=e.actualOptions.interactivity.modes.attract;if(!n)return;const r=e.particles.quadTree.query(i,(t=>this.isEnabled(t)));for(const i of r){const{dx:e,dy:r,distance:s}=(0,c.oW)(i.position,t),o=n.speed*n.factor,d=(0,c.uZ)((0,c._X)(n.easing)(1-s/a)*o,0,n.maxSpeed),l=c.OW.create(0===s?o:e/s*d,0===s?o:r/s*d);i.position.subFrom(l)}}}async function r(t){await t.addInteractor("externalAttract",(a=>new n(t,a)))}}}]);