"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[3084],{3084:(t,i,e)=>{e.d(i,{loadEmittersShapePath:()=>a});var s=e(1814),n=e(9201);class o extends s.F{constructor(t,i,e,s){super(t,i,e,s);const o=document.createElement("canvas").getContext("2d");if(!o)throw new Error(`${n.gK} No 2d context available`);this.checkContext=o,this.points=s.points;const h=this.points,r=new Path2D,a=t.x-i.width/2,c=t.y-i.height/2;for(const[t,e]of h.entries()){const s={x:a+e.x*i.width/100,y:c+e.y*i.height/100};0===t?r.moveTo(s.x,s.y):r.lineTo(s.x,s.y)}if(h[0]){const t={x:a+h[0].x*i.width/100,y:c+h[0].y*i.height/100};r.lineTo(t.x,t.y)}this.path=r}async init(){}async randomPosition(){const t=this.checkContext,i=this.position,e=this.size,s=this.fill,o=this.path,h=s?function(t,i,e,s){let o=null;for(let h=0;h<100;h++){const h={x:e.x+(0,n.sZ)()*s.width-s.width/2,y:e.y+(0,n.sZ)()*s.height-s.height/2};if(t.isPointInPath(i,h.x,h.y)){o=h;break}}return o}(t,o,i,e):function(t,i,e,s){let o=null;for(let h=0;h<100;h++){const h={x:e.x+(0,n.sZ)()*s.width-s.width/2,y:e.y+(0,n.sZ)()*s.height-s.height/2};if(t.isPointInStroke(i,h.x,h.y)){o=h;break}}return o}(t,o,i,e);return h?{position:h}:null}resize(t,i){super.resize(t,i);const e=this.points,s=new Path2D,n=t.x-i.width/2,o=t.y-i.height/2;for(const[t,h]of e.entries()){const e={x:n+h.x*i.width/100,y:o+h.y*i.height/100};0===t?s.moveTo(e.x,e.y):s.lineTo(e.x,e.y)}if(e[0]){const t={x:n+e[0].x*i.width/100,y:o+e[0].y*i.height/100};s.lineTo(t.x,t.y)}this.path=s}}class h{constructor(){this.points=[]}load(t){t&&void 0!==t.points&&(this.points=t.points.map((t=>({x:t.x??50,y:t.y??50}))))}}class r{generate(t,i,e,s){const n=new h;return n.load(s),new o(t,i,e,n)}}async function a(t,i=!0){const e=t;e.addEmitterShapeGenerator&&e.addEmitterShapeGenerator("path",new r),await e.refresh(i)}}}]);