"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[5644],{5644:(t,a,i)=>{i.d(a,{loadTrailEffect:()=>r});var l=i(9201);class e{draw(t){const{context:a,radius:i,particle:l}=t,e=2*i,r=l.container.retina.pixelRatio,n=l.getPosition();if(!l.trail||!l.trailLength)return;const o=l.trailLength;if(l.trail.push({color:a.fillStyle??a.strokeStyle,position:{x:n.x,y:n.y}}),l.trail.length<2)return;for(;l.trail.length>o;)l.trail.shift();const s=Math.min(l.trail.length,o),h=n.x,c=n.y,d=l.container.canvas.size.width+e,x=l.container.canvas.size.height+e;let p=l.trail[s-1].position;a.setTransform(1,0,0,1,n.x,n.y);for(let t=s;t>0;t--){const i=l.trail[t-1],n=i.position;a.beginPath(),a.moveTo(p.x-h,p.y-c);const o={x:(p.x+d)%d,y:(p.y+x)%x};if(Math.abs(p.x-n.x)>d/2||Math.abs(p.y-n.y)>x/2){p=n;continue}a.lineTo((Math.abs(p.x-n.x)>d/2?o.x:n.x)-h,(Math.abs(p.y-n.y)>x/2?o.y:n.y)-c);const f=Math.max(t/s*e,r,l.trailMinWidth??-1),y=a.globalAlpha;a.globalAlpha=l.trailFade?t/s:1,a.lineWidth=l.trailMaxWidth?Math.min(f,l.trailMaxWidth):f,a.strokeStyle=i.color,a.stroke(),a.globalAlpha=y,p=n}const{transformData:f}=t;a.setTransform(f.a,f.b,f.c,f.d,n.x,n.y)}particleInit(t,a){a.trail=[];const i=a.effectData;a.trailFade=i?.fade??!0,a.trailLength=(0,l.Gu)(i?.length??10)*t.retina.pixelRatio,a.trailMaxWidth=i?.maxWidth?(0,l.Gu)(i.maxWidth)*t.retina.pixelRatio:void 0,a.trailMinWidth=i?.minWidth?(0,l.Gu)(i.minWidth)*t.retina.pixelRatio:void 0}}async function r(t,a=!0){await t.addEffect("trail",new e,a)}}}]);