"use strict";(globalThis.webpackChunkwordpress_particles=globalThis.webpackChunkwordpress_particles||[]).push([[2496],{2496:(t,o,s)=>{s.r(o),s.d(o,{loadDestroyUpdater:()=>v});var e=s(5302);class i{load(t){t&&(void 0!==t.bottom&&(this.bottom=(0,e.Cs)(t.bottom)),void 0!==t.left&&(this.left=(0,e.Cs)(t.left)),void 0!==t.right&&(this.right=(0,e.Cs)(t.right)),void 0!==t.top&&(this.top=(0,e.Cs)(t.top)))}}var r=s(2187),l=s(4684),n=s(4400);class c extends n.SW{constructor(){super(),this.value=3}}class d extends n.SW{constructor(){super(),this.value={min:4,max:9}}}class a{constructor(){this.count=1,this.factor=new c,this.rate=new d,this.sizeOffset=!0}load(t){t&&(void 0!==t.color&&(this.color=r.O.create(this.color,t.color)),void 0!==t.count&&(this.count=t.count),this.factor.load(t.factor),this.rate.load(t.rate),this.particles=(0,l.KH)(t.particles,(t=>(0,l.ZB)({},t))),void 0!==t.sizeOffset&&(this.sizeOffset=t.sizeOffset),t.colorOffset&&(this.colorOffset=this.colorOffset??{},void 0!==t.colorOffset.h&&(this.colorOffset.h=t.colorOffset.h),void 0!==t.colorOffset.s&&(this.colorOffset.s=t.colorOffset.s),void 0!==t.colorOffset.l&&(this.colorOffset.l=t.colorOffset.l)))}}class f{constructor(){this.bounds=new i,this.mode="none",this.split=new a}load(t){t&&(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}var u=s(8056);function h(t,o,s,i){const r=s.options.destroy;if(!r)return;const n=r.split,c=(0,u.x)(t,o,s.options),d=(0,e.NA)(n.factor),a=s.getFillColor();n.color?c.color.load(n.color):n.colorOffset&&a?c.color.load({value:{hsl:{h:a.h+(0,e.Gu)(n.colorOffset.h??0),s:a.s+(0,e.Gu)(n.colorOffset.s??0),l:a.l+(0,e.Gu)(n.colorOffset.l??0)}}}):c.color.load({value:{hsl:s.getFillColor()}}),c.move.load({center:{x:s.position.x,y:s.position.y,mode:"precise"}}),(0,l.hj)(c.size.value)?c.size.value/=d:(c.size.value.min/=d,c.size.value.max/=d),c.load(i);const f=n.sizeOffset?(0,e.Cs)(-s.size.value,s.size.value):0,h={x:s.position.x+(0,e.vd)(f),y:s.position.y+(0,e.vd)(f)};return o.particles.addParticle(h,c,s.group,(t=>!(t.size.value<.5||(t.velocity.length=(0,e.vd)((0,e.Cs)(s.velocity.length,t.velocity.length)),t.splitCount=(s.splitCount??0)+1,t.unbreakable=!0,setTimeout((()=>{t.unbreakable=!1}),500),0))))}class p{constructor(t,o){this.engine=t,this.container=o}init(t){const o=this.container,s=t.options.destroy;if(!s)return;t.splitCount=0;const i=s.bounds;t.destroyBounds||(t.destroyBounds={});const{bottom:r,left:l,right:n,top:c}=i,{destroyBounds:d}=t,a=o.canvas.size;r&&(d.bottom=(0,e.Gu)(r)*a.height/100),l&&(d.left=(0,e.Gu)(l)*a.width/100),n&&(d.right=(0,e.Gu)(n)*a.width/100),c&&(d.top=(0,e.Gu)(c)*a.height/100)}isEnabled(t){return!t.destroyed}loadOptions(t,...o){t.destroy||(t.destroy=new f);for(const s of o)t.destroy.load(s?.destroy)}particleDestroyed(t,o){if(o)return;const s=t.options.destroy;s&&"split"===s.mode&&function(t,o,s){const i=s.options.destroy;if(!i)return;const r=i.split;if(r.count>=0&&(void 0===s.splitCount||s.splitCount++>r.count))return;const n=(0,e.NA)(r.rate),c=(0,l.wA)(r.particles);for(let e=0;e<n;e++)h(t,o,s,c)}(this.engine,this.container,t)}update(t){if(!this.isEnabled(t))return;const o=t.getPosition(),s=t.destroyBounds;s&&(void 0!==s.bottom&&o.y>=s.bottom||void 0!==s.left&&o.x<=s.left||void 0!==s.right&&o.x>=s.right||void 0!==s.top&&o.y<=s.top)&&t.destroy()}}async function v(t,o=!0){await t.addParticleUpdater("destroy",(o=>new p(t,o)),o)}}}]);