"use strict";(globalThis.webpackChunkwordpress_particles=globalThis.webpackChunkwordpress_particles||[]).push([[4977],{4977:(t,a,i)=>{i.r(a),i.d(a,{Attract:()=>e,loadExternalAttractInteraction:()=>n});var c=i(1197);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 r 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,r=e.onHover.enable,n=e.onHover.mode,s=e.onClick.enable,o=e.onClick.mode;i&&r&&(0,c.dB)("attract",n)?this.hoverAttract():s&&(0,c.dB)("attract",o)&&this.clickAttract()}isEnabled(t){var a;const i=this.container,e=i.actualOptions,r=i.interactivity.mouse,n=(null!==(a=null==t?void 0:t.interactivity)&&void 0!==a?a:e.interactivity).events;if(!(r.position&&n.onHover.enable||r.clickPosition&&n.onClick.enable))return!1;const s=n.onHover.mode,o=n.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,r=e.actualOptions.interactivity.modes.attract;if(!r)return;const n=e.particles.quadTree.query(i,(t=>this.isEnabled(t)));for(const i of n){const{dx:e,dy:n,distance:s}=(0,c.oW)(i.position,t),o=r.speed*r.factor,d=(0,c.uZ)((0,c._X)(r.easing)(1-s/a)*o,0,r.maxSpeed),l=c.OW.create(0===s?o:e/s*d,0===s?o:n/s*d);i.position.subFrom(l)}}}async function n(t){await t.addInteractor("externalAttract",(a=>new r(t,a)))}}}]);