"use strict";(globalThis.webpackChunk_tsparticles_wordpress=globalThis.webpackChunk_tsparticles_wordpress||[]).push([[1100],{1100(r,i,t){t.d(i,{TrailPluginInstance:()=>e});var a=t(3199);class e{#r;#i;#t;constructor(r,i){this.#r=i,this.#i=r}canvasClear(){const r=this.#r,i=r.actualOptions.trail,t=this.#t;if(!i?.enable||!t||i.length<=0)return!1;let e=!1;const n=r.canvas;return t.color?(n.render.paintBase((0,a.xxz)(t.color,r.hdr,t.opacity)),e=!0):t.image&&(n.render.paintImage(t.image,t.opacity),e=!0),e}async init(){try{await this.#a()}catch(r){(0,a.tZQ)().error(r)}}async#a(){const r=this.#r.actualOptions.trail;if(!r?.enable)return;const i=r.fill,t=a.hBr/r.length;if(i.color){const r=(0,a.BN0)(this.#i,i.color);if(!r)return;this.#t={color:{...r},opacity:t}}else await new Promise((r,e)=>{if(!i.image)return;const n=(0,a.T5G)().createElement("img");n.addEventListener("load",()=>{this.#t={image:n,opacity:t},r()}),n.addEventListener("error",r=>{(0,a.tZQ)().error(r),e(new Error("Error loading image"))}),n.src=i.image})}}}}]);