"use strict";(globalThis.webpackChunkwordpress_particles=globalThis.webpackChunkwordpress_particles||[]).push([[1740],{1740:(t,o,s)=>{s.r(o),s.d(o,{loadDestroyUpdater:()=>c});var e=s(3290);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)))}}class n extends e.SW{constructor(){super(),this.value=3}}class r extends e.SW{constructor(){super(),this.value={min:4,max:9}}}class l{constructor(){this.count=1,this.factor=new n,this.rate=new r,this.sizeOffset=!0}load(t){t&&(void 0!==t.count&&(this.count=t.count),this.factor.load(t.factor),this.rate.load(t.rate),this.particles=(0,e.KH)(t.particles,(t=>(0,e.ZB)({},t))),void 0!==t.sizeOffset&&(this.sizeOffset=t.sizeOffset))}}class d{constructor(){this.bounds=new i,this.mode="none",this.split=new l}load(t){t&&(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}class a{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={}),i.bottom&&(t.destroyBounds.bottom=(0,e.Gu)(i.bottom)*o.canvas.size.height/100),i.left&&(t.destroyBounds.left=(0,e.Gu)(i.left)*o.canvas.size.width/100),i.right&&(t.destroyBounds.right=(0,e.Gu)(i.right)*o.canvas.size.width/100),i.top&&(t.destroyBounds.top=(0,e.Gu)(i.top)*o.canvas.size.height/100)}isEnabled(t){return!t.destroyed}loadOptions(t){t.destroy||(t.destroy=new d);for(var o=arguments.length,s=new Array(o>1?o-1:0),e=1;e<o;e++)s[e-1]=arguments[e];for(const o of s)t.destroy.load(null==o?void 0:o.destroy)}particleDestroyed(t,o){if(o)return;const s=t.options.destroy;s&&"split"===s.mode&&this.split(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()}addSplitParticle(t,o){const s=t.options.destroy;if(!s)return;const i=s.split,n=(0,e.hT)(this.engine,this.container,t.options),r=(0,e.NA)(i.factor);n.color.load({value:{hsl:t.getFillColor()}}),n.move.load({center:{x:t.position.x,y:t.position.y,mode:"precise"}}),"number"==typeof n.size.value?n.size.value/=r:(n.size.value.min/=r,n.size.value.max/=r),n.load(o);const l=i.sizeOffset?(0,e.Cs)(-t.size.value,t.size.value):0,d={x:t.position.x+(0,e.vd)(l),y:t.position.y+(0,e.vd)(l)};return this.container.particles.addParticle(d,n,t.group,(o=>{var s;return!(o.size.value<.5||(o.velocity.length=(0,e.vd)((0,e.Cs)(t.velocity.length,o.velocity.length)),o.splitCount=(null!==(s=t.splitCount)&&void 0!==s?s:0)+1,o.unbreakable=!0,setTimeout((()=>{o.unbreakable=!1}),500),0))}))}split(t){const o=t.options.destroy;if(!o)return;const s=o.split;if(s.count>=0&&(void 0===t.splitCount||t.splitCount++>s.count))return;const i=(0,e.NA)(s.rate),n=(0,e.wA)(s.particles);for(let o=0;o<i;o++)this.addSplitParticle(t,n)}}async function c(t){await t.addParticleUpdater("destroy",(o=>new a(t,o)))}}}]);