@tsparticles/preset-fireworks 3.0.0-alpha.1 → 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -32
- package/browser/bundle.js +1 -3
- package/browser/index.js +12 -22
- package/browser/options.js +3 -1
- package/browser/package.json +1 -0
- package/cjs/bundle.js +1 -12
- package/cjs/index.js +12 -33
- package/cjs/options.js +3 -1
- package/cjs/package.json +1 -0
- package/esm/bundle.js +1 -3
- package/esm/index.js +12 -22
- package/esm/options.js +3 -1
- package/esm/package.json +1 -0
- package/package.json +17 -21
- package/report.html +5 -5
- package/tsparticles.preset.fireworks.bundle.js +3560 -3650
- package/tsparticles.preset.fireworks.bundle.min.js +1 -1
- package/tsparticles.preset.fireworks.bundle.min.js.LICENSE.txt +1 -8
- package/tsparticles.preset.fireworks.js +29 -82
- package/tsparticles.preset.fireworks.min.js +1 -1
- package/tsparticles.preset.fireworks.min.js.LICENSE.txt +1 -8
- package/types/index.d.ts +1 -1
- package/types/options.d.ts +1 -1
- package/umd/bundle.js +1 -3
- package/umd/index.js +13 -23
- package/umd/options.js +3 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.preset.fireworks.bundle.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,i){if("object"==typeof exports&&"object"==typeof module)module.exports=i();else if("function"==typeof define&&define.amd)define([],i);else{var e=i();for(var s in e)("object"==typeof exports?exports:t)[s]=e[s]}}(this,(()=>(()=>{"use strict";var t={d:(i,e)=>{for(var s in e)t.o(e,s)&&!t.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:e[s]})},o:(t,i)=>Object.prototype.hasOwnProperty.call(t,i),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},i={};t.r(i),t.d(i,{loadFireworksPreset:()=>Ce,tsParticles:()=>Mi});class e{constructor(t,i,e){if("number"!=typeof t&&t){this.x=t.x,this.y=t.y;const i=t;this.z=i.z?i.z:0}else{if(void 0===t||void 0===i)throw new Error("tsParticles - Vector3d not initialized correctly");this.x=t,this.y=i,this.z=null!=e?e:0}}static get origin(){return e.create(0,0,0)}get angle(){return Math.atan2(this.y,this.x)}set angle(t){this.updateFromAngle(t,this.length)}get length(){return Math.sqrt(this.getLengthSq())}set length(t){this.updateFromAngle(this.angle,t)}static clone(t){return e.create(t.x,t.y,t.z)}static create(t,i,s){return new e(t,i,s)}add(t){return e.create(this.x+t.x,this.y+t.y,this.z+t.z)}addTo(t){this.x+=t.x,this.y+=t.y,this.z+=t.z}copy(){return e.clone(this)}distanceTo(t){return this.sub(t).length}distanceToSq(t){return this.sub(t).getLengthSq()}div(t){return e.create(this.x/t,this.y/t,this.z/t)}divTo(t){this.x/=t,this.y/=t,this.z/=t}getLengthSq(){return this.x**2+this.y**2}mult(t){return e.create(this.x*t,this.y*t,this.z*t)}multTo(t){this.x*=t,this.y*=t,this.z*=t}rotate(t){return e.create(this.x*Math.cos(t)-this.y*Math.sin(t),this.x*Math.sin(t)+this.y*Math.cos(t),0)}setTo(t){this.x=t.x,this.y=t.y;const i=t;this.z=i.z?i.z:0}sub(t){return e.create(this.x-t.x,this.y-t.y,this.z-t.z)}subFrom(t){this.x-=t.x,this.y-=t.y,this.z-=t.z}updateFromAngle(t,i){this.x=Math.cos(t)*i,this.y=Math.sin(t)*i}}class s extends e{constructor(t,i){super(t,i,0)}static get origin(){return s.create(0,0)}static clone(t){return s.create(t.x,t.y)}static create(t,i){return new s(t,i)}}let o=Math.random;new Map;function n(){return a(o(),0,1-1e-16)}function a(t,i,e){return Math.min(Math.max(t,i),e)}function r(t){const i=h(t);let e=c(t);return i===e&&(e=0),n()*(i-e)+e}function l(t){return"number"==typeof t?t:r(t)}function c(t){return"number"==typeof t?t:t.min}function h(t){return"number"==typeof t?t:t.max}function d(t,i){if(t===i||void 0===i&&"number"==typeof t)return t;const e=c(t),s=h(t);return void 0!==i?{min:Math.min(e,i),max:Math.max(s,i)}:d(e,s)}function u(t){const i=t.random,{enable:e,minimumValue:s}="boolean"==typeof i?{enable:i,minimumValue:0}:i;return l(e?d(t.value,s):t.value)}function p(t,i){const e=t.x-i.x,s=t.y-i.y;return{dx:e,dy:s,distance:Math.sqrt(e**2+s**2)}}function v(t,i){return p(t,i).distance}function m(t){var i,e;const s={x:void 0!==(null===(i=t.position)||void 0===i?void 0:i.x)?l(t.position.x):void 0,y:void 0!==(null===(e=t.position)||void 0===e?void 0:e.y)?l(t.position.y):void 0};return function(t){var i,e,s,o;return{x:(null!==(e=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==e?e:100*n())*t.size.width/100,y:(null!==(o=null===(s=t.position)||void 0===s?void 0:s.y)&&void 0!==o?o:100*n())*t.size.height/100}}({size:t.size,position:s})}function f(t){var i,e,s,o;return{x:null!==(e=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==e?e:n()*t.size.width,y:null!==(o=null===(s=t.position)||void 0===s?void 0:s.y)&&void 0!==o?o:n()*t.size.height}}function y(t){return t?t.endsWith("%")?parseFloat(t)/100:parseFloat(t):1}function g(){return"undefined"==typeof window||!window||void 0===window.document||!window.document}function w(t){if(!g()&&"undefined"!=typeof matchMedia)return matchMedia(t)}function b(t,i){return t===i||i instanceof Array&&i.indexOf(t)>-1}function _(t){return Math.floor(n()*t.length)}function x(t,i,e=!0){return t[void 0!==i&&e?i%t.length:_(t)]}function z(t,i,e,s,o){return function(t,i,e,s){let o=!0;s&&"bottom"!==s||(o=t.top<i.height+e.x);!o||s&&"left"!==s||(o=t.right>e.x);!o||s&&"right"!==s||(o=t.left<i.width+e.y);!o||s&&"top"!==s||(o=t.bottom>e.y);return o}(M(t,null!=s?s:0),i,e,o)}function M(t,i){return{bottom:t.y+i,left:t.x-i,right:t.x+i,top:t.y-i}}function C(t,...i){for(const e of i){if(null==e)continue;if("object"!=typeof e){t=e;continue}const i=Array.isArray(e);!i||"object"==typeof t&&t&&Array.isArray(t)?i||"object"==typeof t&&t&&!Array.isArray(t)||(t={}):t=[];for(const i in e){if("__proto__"===i)continue;const s=e[i],o="object"==typeof s,n=t;n[i]=o&&Array.isArray(s)?s.map((t=>C(n[i],t))):C(n[i],s)}}return t}function P(t,i){return t instanceof Array?t.map(((t,e)=>i(t,e))):i(t,0)}function k(t,i,e){return t instanceof Array?x(t,i,e):t}function S(t,i){const e=t.value,s=t.animation,o={enable:t.animation.enable,value:l(t.value)*i,max:h(e)*i,min:c(e)*i,loops:0,maxLoops:l(t.animation.count)};if(s.enable){o.decay=1-l(s.decay);let t=!1;switch(s.mode){case"increase":o.status="increasing";break;case"decrease":o.status="decreasing";break;case"random":o.status=n()>=.5?"increasing":"decreasing";break;case"auto":t=!0}switch(s.startValue){case"min":o.value=o.min,t&&(o.status="increasing");break;case"random":o.value=r(o),t&&(o.status=n()>=.5?"increasing":"decreasing");break;default:o.value=o.max,t&&(o.status="decreasing")}}return o.initialValue=o.value,o}const O="random",I=new Map;function E(t){I.set(t.key,t)}function D(t,i,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(i-t)*e:e<.5?i:e<2/3?t+(i-t)*(2/3-e)*6:t}function T(t){for(const[,i]of I)if(t.startsWith(i.stringPrefix))return i.parseString(t);const i=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,((t,i,e,s,o)=>i+i+e+e+s+s+(void 0!==o?o+o:""))),e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(i);return e?{a:void 0!==e[4]?parseInt(e[4],16)/255:1,b:parseInt(e[3],16),g:parseInt(e[2],16),r:parseInt(e[1],16)}:void 0}function R(t,i,e=!0){if(!t)return;const s="string"==typeof t?{value:t}:t;if("string"==typeof s.value)return L(s.value,i,e);if(s.value instanceof Array)return R({value:x(s.value,i,e)});for(const[,t]of I){const i=t.handleRangeColor(s);if(i)return i}}function L(t,i,e=!0){if(!t)return;const s="string"==typeof t?{value:t}:t;if("string"==typeof s.value)return s.value===O?U():F(s.value);if(s.value instanceof Array)return L({value:x(s.value,i,e)});for(const[,t]of I){const i=t.handleColor(s);if(i)return i}}function A(t,i,e=!0){const s=R(t,i,e);return s?V(s):void 0}function V(t){const i=t.r/255,e=t.g/255,s=t.b/255,o=Math.max(i,e,s),n=Math.min(i,e,s),a={h:0,l:(o+n)/2,s:0};return o!==n&&(a.s=a.l<.5?(o-n)/(o+n):(o-n)/(2-o-n),a.h=i===o?(e-s)/(o-n):a.h=e===o?2+(s-i)/(o-n):4+(i-e)/(o-n)),a.l*=100,a.s*=100,a.h*=60,a.h<0&&(a.h+=360),a.h>=360&&(a.h-=360),a}function F(t){return T(t)}function B(t){const i={b:0,g:0,r:0},e={h:t.h/360,l:t.l/100,s:t.s/100};if(e.s){const t=e.l<.5?e.l*(1+e.s):e.l+e.s-e.l*e.s,s=2*e.l-t;i.r=D(s,t,e.h+1/3),i.g=D(s,t,e.h),i.b=D(s,t,e.h-1/3)}else i.b=e.l,i.g=e.l,i.r=e.l;return i.r=Math.floor(255*i.r),i.g=Math.floor(255*i.g),i.b=Math.floor(255*i.b),i}function U(t){const i=null!=t?t:0;return{b:Math.floor(r(d(i,256))),g:Math.floor(r(d(i,256))),r:Math.floor(r(d(i,256)))}}function q(t,i){return`rgba(${t.r}, ${t.g}, ${t.b}, ${null!=i?i:1})`}function W(t,i){return`hsla(${t.h}, ${t.s}%, ${t.l}%, ${null!=i?i:1})`}function j(t){return void 0!==t?{h:t.h.value,s:t.s.value,l:t.l.value}:void 0}function G(t,i,e){const s={h:{enable:!1,value:t.h},s:{enable:!1,value:t.s},l:{enable:!1,value:t.l}};return i&&(H(s.h,i.h,e),H(s.s,i.s,e),H(s.l,i.l,e)),s}function H(t,i,e){t.enable=i.enable,t.enable?(t.velocity=l(i.speed)/100*e,t.decay=1-l(i.decay),t.status="increasing",t.loops=0,t.maxLoops=l(i.count),i.sync||(t.velocity*=n(),t.value*=n()),t.initialValue=t.value):t.velocity=0}function N(t,i,e){t.fillStyle=null!=e?e:"rgba(0,0,0,0)",t.fillRect(0,0,i.width,i.height)}function $(t,i,e,s){e.backgroundMask.enable&&s?(X(t,i),N(t,i,s)):N(t,i)}function X(t,i){t.clearRect(0,0,i.width,i.height)}const Y="generated",Z="touchend",Q="pointermove",J="pointerleave";function K(t,i,e){var s;const o=i[e];void 0!==o&&(t[e]=(null!==(s=t[e])&&void 0!==s?s:1)*o)}class tt{constructor(t){this.container=t,this.size={height:0,width:0},this._context=null,this._generated=!1,this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[],this._mutationObserver=g()||"undefined"==typeof MutationObserver?void 0:new MutationObserver((t=>{for(const i of t)"attributes"===i.type&&"style"===i.attributeName&&this._repairStyle()}))}get _fullScreen(){return this.container.actualOptions.fullScreen.enable}clear(){this.draw((t=>{!function(t,i,e,s,o){if(e.backgroundMask.enable)$(t,i,e,o);else{const o=e.particles.move.trail;o.enable&&o.length>0&&s?s.color?N(t,i,q(s.color,s.opacity)):s.image&&function(t,i,e,s){e&&(t.globalAlpha=s,t.drawImage(e,0,0,i.width,i.height),t.globalAlpha=1)}(t,i,s.image,s.opacity):X(t,i)}}(t,this.size,this.container.actualOptions,this._trailFill,this._coverColorStyle)}))}destroy(){var t,i;null===(t=this._mutationObserver)||void 0===t||t.disconnect(),this._generated?null===(i=this.element)||void 0===i||i.remove():this._resetOriginalStyle(),this.draw((t=>{X(t,this.size)})),this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}draw(t){if(this._context)return t(this._context)}drawParticle(t,i){var e;if(t.spawning||t.destroyed)return;const s=t.getRadius();if(s<=0)return;const o=t.getFillColor(),n=null!==(e=t.getStrokeColor())&&void 0!==e?e:o;let[a,r]=this._getPluginParticleColors(t);a||(a=o),r||(r=n),(a||r)&&this.draw((e=>{var o,n,l,c;const h=this.container.actualOptions,d=t.options.zIndex,u=(1-t.zIndexFactor)**d.opacityRate,p=null!==(l=null!==(o=t.bubble.opacity)&&void 0!==o?o:null===(n=t.opacity)||void 0===n?void 0:n.value)&&void 0!==l?l:1,v=p*u,m=(null!==(c=t.strokeOpacity)&&void 0!==c?c:p)*u,f={},y={fill:a?W(a,v):void 0};y.stroke=r?W(r,m):y.fill,this._applyPreDrawUpdaters(e,t,s,v,y,f),function(t){var i,e,s,o,n;const{container:a,context:r,particle:l,delta:c,colorStyles:h,backgroundMask:d,composite:u,radius:p,opacity:v,shadow:m,transform:f}=t,y=l.getPosition(),g=l.rotation+(l.pathRotation?l.velocity.angle:0),w=Math.sin(g),b=Math.cos(g),_={a:b*(null!==(i=f.a)&&void 0!==i?i:1),b:w*(null!==(e=f.b)&&void 0!==e?e:1),c:-w*(null!==(s=f.c)&&void 0!==s?s:1),d:b*(null!==(o=f.d)&&void 0!==o?o:1)};r.setTransform(_.a,_.b,_.c,_.d,y.x,y.y),r.beginPath(),d&&(r.globalCompositeOperation=u);const x=l.shadowColor;m.enable&&x&&(r.shadowBlur=m.blur,r.shadowColor=q(x),r.shadowOffsetX=m.offset.x,r.shadowOffsetY=m.offset.y),h.fill&&(r.fillStyle=h.fill);const z=null!==(n=l.strokeWidth)&&void 0!==n?n:0;r.lineWidth=z,h.stroke&&(r.strokeStyle=h.stroke),function(t,i,e,s,o,n){if(!e.shape)return;const a=t.drawers.get(e.shape);a&&a.draw(i,e,s,o,n,t.retina.pixelRatio)}(a,r,l,p,v,c),z>0&&r.stroke(),l.close&&r.closePath(),l.fill&&r.fill(),function(t,i,e,s,o,n){if(!e.shape)return;const a=t.drawers.get(e.shape);(null==a?void 0:a.afterEffect)&&a.afterEffect(i,e,s,o,n,t.retina.pixelRatio)}(a,r,l,p,v,c),r.globalCompositeOperation="source-over",r.setTransform(1,0,0,1,0,0)}({container:this.container,context:e,particle:t,delta:i,colorStyles:y,backgroundMask:h.backgroundMask.enable,composite:h.backgroundMask.composite,radius:s*(1-t.zIndexFactor)**d.sizeRate,opacity:v,shadow:t.options.shadow,transform:f}),this._applyPostDrawUpdaters(t)}))}drawParticlePlugin(t,i,e){this.draw((s=>{!function(t,i,e,s){i.drawParticle&&i.drawParticle(t,e,s)}(s,t,i,e)}))}drawPlugin(t,i){this.draw((e=>{!function(t,i,e){i.draw&&i.draw(t,e)}(e,t,i)}))}async init(){var t;this._resize(),this._initStyle(),this._initCover();try{await this._initTrail()}catch(t){console.error(t)}this._initBackground(),this.element&&(null===(t=this._mutationObserver)||void 0===t||t.observe(this.element,{attributes:!0})),this._initUpdaters(),this._initPlugins(),this._paint(),this.container.updateActualOptions(),this._resize(),this._initBackground()}loadCanvas(t){var i,e;this._generated&&(null===(i=this.element)||void 0===i||i.remove()),this._generated=t.dataset&&Y in t.dataset?"true"===t.dataset[Y]:this._generated,this.element=t,this.element.ariaHidden="true",this._originalStyle=C({},this.element.style),this.size.height=t.offsetHeight,this.size.width=t.offsetWidth,this._context=function(t){const i=t.getContext("2d");if(!i)throw new Error("Error tsParticles - No canvas context found");return i}(t),null===(e=this._mutationObserver)||void 0===e||e.observe(this.element,{attributes:!0}),this.container.retina.init(),this._initBackground()}async windowResize(){if(!this.element)return;this._resize();const t=this.container,i=t.updateActualOptions();t.particles.setDensity(),this._applyResizePlugins(),i&&await t.refresh()}_applyPostDrawUpdaters(t){var i;for(const e of this._postDrawUpdaters)null===(i=e.afterDraw)||void 0===i||i.call(e,t)}_applyPreDrawUpdaters(t,i,e,s,o,n){var a;for(const r of this._preDrawUpdaters){if(r.getColorStyles){const{fill:n,stroke:a}=r.getColorStyles(i,t,e,s);n&&(o.fill=n),a&&(o.stroke=a)}if(r.getTransformValues){const t=r.getTransformValues(i);for(const i in t)K(n,t,i)}null===(a=r.beforeDraw)||void 0===a||a.call(r,i)}}_applyResizePlugins(){for(const t of this._resizePlugins)t.resize&&t.resize()}_getPluginParticleColors(t){let i,e;for(const s of this._colorPlugins)if(!i&&s.particleFillColor&&(i=A(s.particleFillColor(t))),!e&&s.particleStrokeColor&&(e=A(s.particleStrokeColor(t))),i&&e)break;return[i,e]}_initBackground(){const t=this.container.actualOptions.background,i=this.element,e=null==i?void 0:i.style;if(e){if(t.color){const i=R(t.color);e.backgroundColor=i?q(i,t.opacity):""}else e.backgroundColor="";e.backgroundImage=t.image||"",e.backgroundPosition=t.position||"",e.backgroundRepeat=t.repeat||"",e.backgroundSize=t.size||""}}_initCover(){const t=this.container.actualOptions.backgroundMask.cover,i=R(t.color);if(i){const e={r:i.r,g:i.g,b:i.b,a:t.opacity};this._coverColorStyle=q(e,e.a)}}_initPlugins(){this._resizePlugins=[];for(const[,t]of this.container.plugins)t.resize&&this._resizePlugins.push(t),(t.particleFillColor||t.particleStrokeColor)&&this._colorPlugins.push(t)}_initStyle(){const t=this.element,i=this.container.actualOptions;if(t){this._fullScreen?(this._originalStyle=C({},t.style),this._setFullScreenStyle()):this._resetOriginalStyle();for(const e in i.style){if(!e||!i.style)continue;const s=i.style[e];s&&t.style.setProperty(e,s,"important")}}}async _initTrail(){const t=this.container.actualOptions,i=t.particles.move.trail,e=i.fill;if(i.enable)if(e.color){const i=R(e.color);if(!i)return;const s=t.particles.move.trail;this._trailFill={color:Object.assign({},i),opacity:1/s.length}}else await new Promise(((t,s)=>{if(!e.image)return;const o=document.createElement("img");o.addEventListener("load",(()=>{this._trailFill={image:o,opacity:1/i.length},t()})),o.addEventListener("error",(t=>{s(t.error)})),o.src=e.image}))}_initUpdaters(){this._preDrawUpdaters=[],this._postDrawUpdaters=[];for(const t of this.container.particles.updaters)t.afterDraw&&this._postDrawUpdaters.push(t),(t.getColorStyles||t.getTransformValues||t.beforeDraw)&&this._preDrawUpdaters.push(t)}_paint(){this.draw((t=>{$(t,this.size,this.container.actualOptions,this._coverColorStyle)}))}_repairStyle(){var t,i;const e=this.element;e&&(null===(t=this._mutationObserver)||void 0===t||t.disconnect(),this._initStyle(),this._initBackground(),null===(i=this._mutationObserver)||void 0===i||i.observe(e,{attributes:!0}))}_resetOriginalStyle(){const t=this.element,i=this._originalStyle;t&&i&&(t.style.position=i.position,t.style.zIndex=i.zIndex,t.style.top=i.top,t.style.left=i.left,t.style.width=i.width,t.style.height=i.height)}_resize(){if(!this.element)return;const t=this.container,i=t.retina.pixelRatio,e=t.canvas.size,s=this.element.offsetWidth*i,o=this.element.offsetHeight*i;if(o===e.height&&s===e.width&&o===this.element.height&&s===this.element.width)return;const n=Object.assign({},e);this.element.width=e.width=this.element.offsetWidth*i,this.element.height=e.height=this.element.offsetHeight*i,this.container.started&&(this.resizeFactor={width:e.width/n.width,height:e.height/n.height})}_setFullScreenStyle(){const t=this.element;if(!t)return;const i="important";t.style.setProperty("position","fixed",i),t.style.setProperty("z-index",this.container.actualOptions.fullScreen.zIndex.toString(10),i),t.style.setProperty("top","0",i),t.style.setProperty("left","0",i),t.style.setProperty("width","100%",i),t.style.setProperty("height","100%",i)}}function it(t,i,e,s,o){if(s){let s={passive:!0};"boolean"==typeof o?s.capture=o:void 0!==o&&(s=o),t.addEventListener(i,e,s)}else{const s=o;t.removeEventListener(i,e,s)}}class et{constructor(t){this.container=t,this.canPush=!0,this.handlers={mouseMove:t=>this._mouseTouchMove(t),touchStart:t=>this._mouseTouchMove(t),touchMove:t=>this._mouseTouchMove(t),touchEnd:()=>this._mouseTouchFinish(),mouseLeave:()=>this._mouseTouchFinish(),touchCancel:()=>this._mouseTouchFinish(),touchEndClick:t=>this._mouseTouchClick(t),mouseUp:t=>this._mouseTouchClick(t),mouseDown:()=>this._mouseDown(),visibilityChange:()=>this._handleVisibilityChange(),themeChange:t=>this._handleThemeChange(t),oldThemeChange:t=>this._handleThemeChange(t),resize:()=>this._handleWindowResize()}}addListeners(){this._manageListeners(!0)}removeListeners(){this._manageListeners(!1)}_doMouseTouchClick(t){const i=this.container,e=i.actualOptions;if(this.canPush){const t=i.interactivity.mouse,s=t.position;if(!s)return;t.clickPosition=Object.assign({},s),t.clickTime=(new Date).getTime();P(e.interactivity.events.onClick.mode,(t=>this._handleClickMode(t)))}"touchend"===t.type&&setTimeout((()=>this._mouseTouchFinish()),500)}_handleClickMode(t){this.container.handleClickMode(t)}_handleThemeChange(t){const i=t,e=this.container,s=e.options,o=s.defaultThemes,n=i.matches?o.dark:o.light,a=s.themes.find((t=>t.name===n));a&&a.default.auto&&e.loadTheme(n)}_handleVisibilityChange(){const t=this.container,i=t.actualOptions;this._mouseTouchFinish(),i.pauseOnBlur&&(t.pageHidden=(null===document||void 0===document?void 0:document.hidden)||!1,t.pageHidden?t.pause():t.getAnimationStatus()?t.play(!0):t.draw(!0))}_handleWindowResize(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),delete this.resizeTimeout),this.resizeTimeout=setTimeout((async()=>{var t;return null===(t=this.container.canvas)||void 0===t?void 0:t.windowResize()}),1e3*this.container.actualOptions.interactivity.events.resize.delay)}_manageInteractivityEvents(t){var i;const e=this.handlers,s=this.container,o=s.actualOptions,n=o.interactivity.detectsOn;let a=J;if("window"===n)s.interactivity.element=window,a="pointerout";else if("parent"===n&&s.canvas.element){const t=s.canvas.element;s.interactivity.element=null!==(i=t.parentElement)&&void 0!==i?i:t.parentNode}else s.interactivity.element=s.canvas.element;const r=s.interactivity.element;if(!r)return;const l=r;(o.interactivity.events.onHover.enable||o.interactivity.events.onClick.enable)&&(it(r,Q,e.mouseMove,t),it(r,"touchstart",e.touchStart,t),it(r,"touchmove",e.touchMove,t),o.interactivity.events.onClick.enable?(it(r,Z,e.touchEndClick,t),it(r,"pointerup",e.mouseUp,t),it(r,"pointerdown",e.mouseDown,t)):it(r,Z,e.touchEnd,t),it(r,a,e.mouseLeave,t),it(r,"touchcancel",e.touchCancel,t)),s.canvas.element&&(s.canvas.element.style.pointerEvents=l===s.canvas.element?"initial":"none")}_manageListeners(t){this._manageMediaEvents(t),this._manageInteractivityEvents(t),this._manageResizeEvent(t),this._manageVisibilityEvent(t)}_manageMediaEvents(t){const i=this.handlers,e=w("(prefers-color-scheme: dark)");e&&(void 0===e.addEventListener?void 0!==e.addListener&&(t?e.addListener(i.oldThemeChange):e.removeListener(i.oldThemeChange)):it(e,"change",i.themeChange,t))}_manageResizeEvent(t){const i=this.handlers,e=this.container;e.actualOptions.interactivity.events.resize&&("undefined"!=typeof ResizeObserver?this.resizeObserver&&!t?(e.canvas.element&&this.resizeObserver.unobserve(e.canvas.element),this.resizeObserver.disconnect(),delete this.resizeObserver):!this.resizeObserver&&t&&e.canvas.element&&(this.resizeObserver=new ResizeObserver((t=>{t.find((t=>t.target===e.canvas.element))&&this._handleWindowResize()})),this.resizeObserver.observe(e.canvas.element)):it(window,"resize",i.resize,t))}_manageVisibilityEvent(t){document&&it(document,"visibilitychange",this.handlers.visibilityChange,t)}_mouseDown(){const t=this.container.interactivity;if(t){const i=t.mouse;i.clicking=!0,i.downPosition=i.position}}_mouseTouchClick(t){const i=this.container,e=i.actualOptions,s=i.interactivity.mouse;s.inside=!0;let o=!1;const n=s.position;if(n&&e.interactivity.events.onClick.enable){for(const[,t]of i.plugins)if(t.clickPositionValid&&(o=t.clickPositionValid(n),o))break;o||this._doMouseTouchClick(t),s.clicking=!1}}_mouseTouchFinish(){const t=this.container.interactivity;if(!t)return;const i=t.mouse;delete i.position,delete i.clickPosition,delete i.downPosition,t.status=J,i.inside=!1,i.clicking=!1}_mouseTouchMove(t){var i,e,s,o,n,a,r;const l=this.container,c=l.actualOptions;if(!(null===(i=l.interactivity)||void 0===i?void 0:i.element))return;let h;l.interactivity.mouse.inside=!0;const d=l.canvas.element;if(t.type.startsWith("pointer")){this.canPush=!0;const i=t;if(l.interactivity.element===window){if(d){const t=d.getBoundingClientRect();h={x:i.clientX-t.left,y:i.clientY-t.top}}}else if("parent"===c.interactivity.detectsOn){const t=i.target,o=i.currentTarget,n=l.canvas.element;if(t&&o&&n){const e=t.getBoundingClientRect(),s=o.getBoundingClientRect(),a=n.getBoundingClientRect();h={x:i.offsetX+2*e.left-(s.left+a.left),y:i.offsetY+2*e.top-(s.top+a.top)}}else h={x:null!==(e=i.offsetX)&&void 0!==e?e:i.clientX,y:null!==(s=i.offsetY)&&void 0!==s?s:i.clientY}}else i.target===l.canvas.element&&(h={x:null!==(o=i.offsetX)&&void 0!==o?o:i.clientX,y:null!==(n=i.offsetY)&&void 0!==n?n:i.clientY})}else{this.canPush="touchmove"!==t.type;const i=t,e=i.touches[i.touches.length-1],s=null==d?void 0:d.getBoundingClientRect();h={x:e.clientX-(null!==(a=null==s?void 0:s.left)&&void 0!==a?a:0),y:e.clientY-(null!==(r=null==s?void 0:s.top)&&void 0!==r?r:0)}}const u=l.retina.pixelRatio;h&&(h.x*=u,h.y*=u),l.interactivity.mouse.position=h,l.interactivity.status=Q}}class st{constructor(t){this.container=t}async nextFrame(t){var i;try{const e=this.container;if(!e.smooth&&void 0!==e.lastFrameTime&&t<e.lastFrameTime+1e3/e.fpsLimit)return void e.draw(!1);null!==(i=e.lastFrameTime)&&void 0!==i||(e.lastFrameTime=t);const s=function(t,i=60,e=!1){return{value:t,factor:e?60/i:60*t/1e3}}(t-e.lastFrameTime,e.fpsLimit,e.smooth);if(e.lifeTime+=s.value,e.lastFrameTime=t,s.value>1e3)return void e.draw(!1);if(await e.particles.draw(s),e.duration>0&&e.lifeTime>e.duration)return void e.destroy();e.getAnimationStatus()&&e.draw(!1)}catch(t){console.error("tsParticles error in animation loop",t)}}}class ot{constructor(){this.value=""}static create(t,i){const e=new ot;return e.load(t),void 0!==i&&("string"==typeof i||i instanceof Array?e.load({value:i}):e.load(i)),e}load(t){void 0!==(null==t?void 0:t.value)&&(this.value=t.value)}}class nt{constructor(){this.color=new ot,this.color.value="",this.image="",this.position="",this.repeat="",this.size="",this.opacity=1}load(t){t&&(void 0!==t.color&&(this.color=ot.create(this.color,t.color)),void 0!==t.image&&(this.image=t.image),void 0!==t.position&&(this.position=t.position),void 0!==t.repeat&&(this.repeat=t.repeat),void 0!==t.size&&(this.size=t.size),void 0!==t.opacity&&(this.opacity=t.opacity))}}class at{constructor(){this.color=new ot,this.color.value="#fff",this.opacity=1}load(t){t&&(void 0!==t.color&&(this.color=ot.create(this.color,t.color)),void 0!==t.opacity&&(this.opacity=t.opacity))}}class rt{constructor(){this.composite="destination-out",this.cover=new at,this.enable=!1}load(t){if(t){if(void 0!==t.composite&&(this.composite=t.composite),void 0!==t.cover){const i=t.cover,e="string"==typeof t.cover?{color:t.cover}:t.cover;this.cover.load(void 0!==i.color?i:{color:e})}void 0!==t.enable&&(this.enable=t.enable)}}}class lt{constructor(){this.enable=!0,this.zIndex=0}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.zIndex&&(this.zIndex=t.zIndex))}}class ct{constructor(){this.enable=!1,this.mode=[]}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.mode&&(this.mode=t.mode))}}class ht{constructor(){this.selectors=[],this.enable=!1,this.mode=[],this.type="circle"}get el(){return this.elementId}set el(t){this.elementId=t}get elementId(){return this.ids}set elementId(t){this.ids=t}get ids(){return P(this.selectors,(t=>t.replace("#","")))}set ids(t){this.selectors=P(t,(t=>`#${t}`))}load(t){var i,e;if(!t)return;const s=null!==(e=null!==(i=t.ids)&&void 0!==i?i:t.elementId)&&void 0!==e?e:t.el;void 0!==s&&(this.ids=s),void 0!==t.selectors&&(this.selectors=t.selectors),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.mode&&(this.mode=t.mode),void 0!==t.type&&(this.type=t.type)}}class dt{constructor(){this.enable=!1,this.force=2,this.smooth=10}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.force&&(this.force=t.force),void 0!==t.smooth&&(this.smooth=t.smooth))}}class ut{constructor(){this.enable=!1,this.mode=[],this.parallax=new dt}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.mode&&(this.mode=t.mode),this.parallax.load(t.parallax))}}class pt{constructor(){this.delay=.5,this.enable=!0}load(t){void 0!==t&&(void 0!==t.delay&&(this.delay=t.delay),void 0!==t.enable&&(this.enable=t.enable))}}class vt{constructor(){this.onClick=new ct,this.onDiv=new ht,this.onHover=new ut,this.resize=new pt}get onclick(){return this.onClick}set onclick(t){this.onClick=t}get ondiv(){return this.onDiv}set ondiv(t){this.onDiv=t}get onhover(){return this.onHover}set onhover(t){this.onHover=t}load(t){var i,e,s;if(!t)return;this.onClick.load(null!==(i=t.onClick)&&void 0!==i?i:t.onclick);const o=null!==(e=t.onDiv)&&void 0!==e?e:t.ondiv;void 0!==o&&(this.onDiv=P(o,(t=>{const i=new ht;return i.load(t),i}))),this.onHover.load(null!==(s=t.onHover)&&void 0!==s?s:t.onhover),"boolean"==typeof t.resize?this.resize.enable=t.resize:this.resize.load(t.resize)}}class mt{constructor(t,i){this._engine=t,this._container=i}load(t){if(t&&this._container){const i=this._engine.plugins.interactors.get(this._container);if(i)for(const e of i)e.loadModeOptions&&e.loadModeOptions(this,t)}}}class ft{constructor(t,i){this.detectsOn="window",this.events=new vt,this.modes=new mt(t,i)}get detect_on(){return this.detectsOn}set detect_on(t){this.detectsOn=t}load(t){var i;if(!t)return;const e=null!==(i=t.detectsOn)&&void 0!==i?i:t.detect_on;void 0!==e&&(this.detectsOn=e),this.events.load(t.events),this.modes.load(t.modes)}}class yt{load(t){var i,e,s;t&&(void 0!==t.position&&(this.position={x:null!==(i=t.position.x)&&void 0!==i?i:50,y:null!==(e=t.position.y)&&void 0!==e?e:50,mode:null!==(s=t.position.mode)&&void 0!==s?s:"percent"}),void 0!==t.options&&(this.options=C({},t.options)))}}class gt{constructor(){this.maxWidth=1/0,this.options={},this.mode="canvas"}load(t){t&&(void 0!==t.maxWidth&&(this.maxWidth=t.maxWidth),void 0!==t.mode&&("screen"===t.mode?this.mode="screen":this.mode="canvas"),void 0!==t.options&&(this.options=C({},t.options)))}}class wt{constructor(){this.auto=!1,this.mode="any",this.value=!1}load(t){t&&(void 0!==t.auto&&(this.auto=t.auto),void 0!==t.mode&&(this.mode=t.mode),void 0!==t.value&&(this.value=t.value))}}class bt{constructor(){this.name="",this.default=new wt}load(t){t&&(void 0!==t.name&&(this.name=t.name),this.default.load(t.default),void 0!==t.options&&(this.options=C({},t.options)))}}class _t{constructor(){this.count=0,this.enable=!1,this.offset=0,this.speed=1,this.decay=0,this.sync=!0}load(t){t&&(void 0!==t.count&&(this.count=d(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.offset&&(this.offset=d(t.offset)),void 0!==t.speed&&(this.speed=d(t.speed)),void 0!==t.decay&&(this.decay=d(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class xt{constructor(){this.h=new _t,this.s=new _t,this.l=new _t}load(t){t&&(this.h.load(t.h),this.s.load(t.s),this.l.load(t.l))}}class zt extends ot{constructor(){super(),this.animation=new xt}static create(t,i){const e=new zt;return e.load(t),void 0!==i&&("string"==typeof i||i instanceof Array?e.load({value:i}):e.load(i)),e}load(t){if(super.load(t),!t)return;const i=t.animation;void 0!==i&&(void 0!==i.enable?this.animation.h.load(i):this.animation.load(t.animation))}}class Mt{constructor(){this.speed=2}load(t){t&&void 0!==t.speed&&(this.speed=t.speed)}}class Ct{constructor(){this.enable=!0,this.retries=0}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.retries&&(this.retries=t.retries))}}class Pt{constructor(){this.count=0,this.enable=!1,this.speed=1,this.decay=0,this.sync=!1}load(t){t&&(void 0!==t.count&&(this.count=d(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=d(t.speed)),void 0!==t.decay&&(this.decay=d(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class kt extends Pt{constructor(){super(),this.mode="auto",this.startValue="random"}load(t){super.load(t),t&&(void 0!==t.minimumValue&&(this.minimumValue=t.minimumValue),void 0!==t.mode&&(this.mode=t.mode),void 0!==t.startValue&&(this.startValue=t.startValue))}}class St{constructor(){this.enable=!1,this.minimumValue=0}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.minimumValue&&(this.minimumValue=t.minimumValue))}}class Ot{constructor(){this.random=new St,this.value=0}load(t){t&&("boolean"==typeof t.random?this.random.enable=t.random:this.random.load(t.random),void 0!==t.value&&(this.value=d(t.value,this.random.enable?this.random.minimumValue:void 0)))}}class It extends Ot{constructor(){super(),this.animation=new Pt}get anim(){return this.animation}set anim(t){this.animation=t}load(t){var i;if(super.load(t),!t)return;const e=null!==(i=t.animation)&&void 0!==i?i:t.anim;void 0!==e&&this.animation.load(e)}}class Et extends It{constructor(){super(),this.animation=new kt}load(t){super.load(t),t&&void 0!==t.animation&&(this.value=d(this.value,this.animation.enable?this.animation.minimumValue:void 0))}}class Dt extends Ot{constructor(){super(),this.random.minimumValue=.1,this.value=1}}class Tt{constructor(){this.horizontal=new Dt,this.vertical=new Dt}load(t){t&&(this.horizontal.load(t.horizontal),this.vertical.load(t.vertical))}}class Rt{constructor(){this.absorb=new Mt,this.bounce=new Tt,this.enable=!1,this.mode="bounce",this.overlap=new Ct}load(t){t&&(this.absorb.load(t.absorb),this.bounce.load(t.bounce),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.mode&&(this.mode=t.mode),this.overlap.load(t.overlap))}}class Lt{constructor(){this.offset=0,this.value=90}load(t){t&&(void 0!==t.offset&&(this.offset=d(t.offset)),void 0!==t.value&&(this.value=d(t.value)))}}class At{constructor(){this.distance=200,this.enable=!1,this.rotate={x:3e3,y:3e3}}get rotateX(){return this.rotate.x}set rotateX(t){this.rotate.x=t}get rotateY(){return this.rotate.y}set rotateY(t){this.rotate.y=t}load(t){var i,e,s,o;if(!t)return;void 0!==t.distance&&(this.distance=d(t.distance)),void 0!==t.enable&&(this.enable=t.enable);const n=null!==(e=null===(i=t.rotate)||void 0===i?void 0:i.x)&&void 0!==e?e:t.rotateX;void 0!==n&&(this.rotate.x=n);const a=null!==(o=null===(s=t.rotate)||void 0===s?void 0:s.y)&&void 0!==o?o:t.rotateY;void 0!==a&&(this.rotate.y=a)}}class Vt{constructor(){this.x=50,this.y=50,this.mode="percent",this.radius=0}load(t){t&&(void 0!==t.x&&(this.x=t.x),void 0!==t.y&&(this.y=t.y),void 0!==t.mode&&(this.mode=t.mode),void 0!==t.radius&&(this.radius=t.radius))}}class Ft{constructor(){this.acceleration=9.81,this.enable=!1,this.inverse=!1,this.maxSpeed=50}load(t){t&&(void 0!==t.acceleration&&(this.acceleration=d(t.acceleration)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.inverse&&(this.inverse=t.inverse),void 0!==t.maxSpeed&&(this.maxSpeed=d(t.maxSpeed)))}}class Bt{constructor(){this.clamp=!0,this.delay=new Ot,this.enable=!1,this.options={}}load(t){t&&(void 0!==t.clamp&&(this.clamp=t.clamp),this.delay.load(t.delay),void 0!==t.enable&&(this.enable=t.enable),this.generator=t.generator,t.options&&(this.options=C(this.options,t.options)))}}class Ut{load(t){t&&(void 0!==t.color&&(this.color=ot.create(this.color,t.color)),void 0!==t.image&&(this.image=t.image))}}class qt{constructor(){this.enable=!1,this.length=10,this.fill=new Ut}get fillColor(){return this.fill.color}set fillColor(t){this.fill.load({color:t})}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0===t.fill&&void 0===t.fillColor||this.fill.load(t.fill||{color:t.fillColor}),void 0!==t.length&&(this.length=t.length))}}class Wt{constructor(){this.default="out"}load(t){var i,e,s,o;t&&(void 0!==t.default&&(this.default=t.default),this.bottom=null!==(i=t.bottom)&&void 0!==i?i:t.default,this.left=null!==(e=t.left)&&void 0!==e?e:t.default,this.right=null!==(s=t.right)&&void 0!==s?s:t.default,this.top=null!==(o=t.top)&&void 0!==o?o:t.default)}}class jt{constructor(){this.acceleration=0,this.enable=!1}load(t){t&&(void 0!==t.acceleration&&(this.acceleration=d(t.acceleration)),void 0!==t.enable&&(this.enable=t.enable),this.position=t.position?C({},t.position):void 0)}}class Gt{constructor(){this.angle=new Lt,this.attract=new At,this.center=new Vt,this.decay=0,this.distance={},this.direction="none",this.drift=0,this.enable=!1,this.gravity=new Ft,this.path=new Bt,this.outModes=new Wt,this.random=!1,this.size=!1,this.speed=2,this.spin=new jt,this.straight=!1,this.trail=new qt,this.vibrate=!1,this.warp=!1}get bounce(){return this.collisions}set bounce(t){this.collisions=t}get collisions(){return!1}set collisions(t){}get noise(){return this.path}set noise(t){this.path=t}get outMode(){return this.outModes.default}set outMode(t){this.outModes.default=t}get out_mode(){return this.outMode}set out_mode(t){this.outMode=t}load(t){var i,e,s;if(!t)return;this.angle.load("number"==typeof t.angle?{value:t.angle}:t.angle),this.attract.load(t.attract),this.center.load(t.center),void 0!==t.decay&&(this.decay=d(t.decay)),void 0!==t.direction&&(this.direction=t.direction),void 0!==t.distance&&(this.distance="number"==typeof t.distance?{horizontal:t.distance,vertical:t.distance}:Object.assign({},t.distance)),void 0!==t.drift&&(this.drift=d(t.drift)),void 0!==t.enable&&(this.enable=t.enable),this.gravity.load(t.gravity);const o=null!==(e=null!==(i=t.outModes)&&void 0!==i?i:t.outMode)&&void 0!==e?e:t.out_mode;void 0!==o&&("object"==typeof o?this.outModes.load(o):this.outModes.load({default:o})),this.path.load(null!==(s=t.path)&&void 0!==s?s:t.noise),void 0!==t.random&&(this.random=t.random),void 0!==t.size&&(this.size=t.size),void 0!==t.speed&&(this.speed=d(t.speed)),this.spin.load(t.spin),void 0!==t.straight&&(this.straight=t.straight),this.trail.load(t.trail),void 0!==t.vibrate&&(this.vibrate=t.vibrate),void 0!==t.warp&&(this.warp=t.warp)}}class Ht extends kt{constructor(){super(),this.destroy="none",this.speed=2}get opacity_min(){return this.minimumValue}set opacity_min(t){this.minimumValue=t}load(t){void 0!==(null==t?void 0:t.opacity_min)&&void 0===t.minimumValue&&(t.minimumValue=t.opacity_min),super.load(t),t&&void 0!==t.destroy&&(this.destroy=t.destroy)}}class Nt extends Et{constructor(){super(),this.animation=new Ht,this.random.minimumValue=.1,this.value=1}get anim(){return this.animation}set anim(t){this.animation=t}}class $t{constructor(){this.enable=!1,this.width=1920,this.height=1080}get area(){return this.width}set area(t){this.width=t}get factor(){return this.height}set factor(t){this.height=t}get value_area(){return this.area}set value_area(t){this.area=t}load(t){var i,e,s;if(!t)return;void 0!==t.enable&&(this.enable=t.enable);const o=null!==(e=null!==(i=t.width)&&void 0!==i?i:t.area)&&void 0!==e?e:t.value_area;void 0!==o&&(this.width=o);const n=null!==(s=t.height)&&void 0!==s?s:t.factor;void 0!==n&&(this.height=n)}}class Xt{constructor(){this.density=new $t,this.limit=0,this.value=100}get max(){return this.limit}set max(t){this.limit=t}load(t){var i;if(!t)return;this.density.load(t.density);const e=null!==(i=t.limit)&&void 0!==i?i:t.max;void 0!==e&&(this.limit=e),void 0!==t.value&&(this.value=t.value)}}class Yt{constructor(){this.blur=0,this.color=new ot,this.enable=!1,this.offset={x:0,y:0},this.color.value="#000"}load(t){t&&(void 0!==t.blur&&(this.blur=t.blur),this.color=ot.create(this.color,t.color),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.offset&&(void 0!==t.offset.x&&(this.offset.x=t.offset.x),void 0!==t.offset.y&&(this.offset.y=t.offset.y)))}}class Zt{constructor(){this.options={},this.type="circle",this.close=!0,this.fill=!0}load(t){var i;if(!t)return;void 0!==t.close&&(this.close=t.close),void 0!==t.fill&&(this.fill=t.fill);const e=t.options;if(void 0!==e)for(const t in e){const s=e[t];s&&(this.options[t]=C(null!==(i=this.options[t])&&void 0!==i?i:{},s))}void 0!==t.type&&(this.type=t.type)}}class Qt extends kt{constructor(){super(),this.destroy="none",this.speed=5}get size_min(){return this.minimumValue}set size_min(t){this.minimumValue=t}load(t){void 0!==(null==t?void 0:t.size_min)&&void 0===t.minimumValue&&(t.minimumValue=t.size_min),super.load(t),t&&void 0!==t.destroy&&(this.destroy=t.destroy)}}class Jt extends Et{constructor(){super(),this.animation=new Qt,this.random.minimumValue=1,this.value=3}get anim(){return this.animation}set anim(t){this.animation=t}}class Kt{constructor(){this.width=0}load(t){t&&(void 0!==t.color&&(this.color=zt.create(this.color,t.color)),void 0!==t.width&&(this.width=d(t.width)),void 0!==t.opacity&&(this.opacity=d(t.opacity)))}}class ti extends Ot{constructor(){super(),this.opacityRate=1,this.sizeRate=1,this.velocityRate=1}load(t){super.load(t),t&&(void 0!==t.opacityRate&&(this.opacityRate=t.opacityRate),void 0!==t.sizeRate&&(this.sizeRate=t.sizeRate),void 0!==t.velocityRate&&(this.velocityRate=t.velocityRate))}}class ii{constructor(t,i){this._engine=t,this._container=i,this.bounce=new Tt,this.collisions=new Rt,this.color=new zt,this.color.value="#fff",this.groups={},this.move=new Gt,this.number=new Xt,this.opacity=new Nt,this.reduceDuplicates=!1,this.shadow=new Yt,this.shape=new Zt,this.size=new Jt,this.stroke=new Kt,this.zIndex=new ti}load(t){var i,e,s,o;if(!t)return;if(this.bounce.load(t.bounce),this.color.load(zt.create(this.color,t.color)),void 0!==t.groups)for(const e in t.groups){const s=t.groups[e];void 0!==s&&(this.groups[e]=C(null!==(i=this.groups[e])&&void 0!==i?i:{},s))}this.move.load(t.move),this.number.load(t.number),this.opacity.load(t.opacity),void 0!==t.reduceDuplicates&&(this.reduceDuplicates=t.reduceDuplicates),this.shape.load(t.shape),this.size.load(t.size),this.shadow.load(t.shadow),this.zIndex.load(t.zIndex);const n=null!==(s=null===(e=t.move)||void 0===e?void 0:e.collisions)&&void 0!==s?s:null===(o=t.move)||void 0===o?void 0:o.bounce;void 0!==n&&(this.collisions.enable=n),this.collisions.load(t.collisions),void 0!==t.interactivity&&(this.interactivity=C({},t.interactivity));const a=t.stroke;if(a&&(this.stroke=P(a,(t=>{const i=new Kt;return i.load(t),i}))),this._container){const i=this._engine.plugins.updaters.get(this._container);if(i)for(const e of i)e.loadOptions&&e.loadOptions(this,t);const e=this._engine.plugins.interactors.get(this._container);if(e)for(const i of e)i.loadParticlesOptions&&i.loadParticlesOptions(this,t)}}}function ei(t,...i){for(const e of i)t.load(e)}function si(t,i,...e){const s=new ii(t,i);return ei(s,...e),s}class oi{constructor(t,i){this._engine=t,this._container=i,this.autoPlay=!0,this.background=new nt,this.backgroundMask=new rt,this.defaultThemes={},this.delay=0,this.fullScreen=new lt,this.detectRetina=!0,this.duration=0,this.fpsLimit=120,this.interactivity=new ft(t,i),this.manualParticles=[],this.name="default",this.particles=si(this._engine,this._container),this.pauseOnBlur=!0,this.pauseOnOutsideViewport=!0,this.responsive=[],this.smooth=!1,this.style={},this.themes=[],this.zLayers=100}get backgroundMode(){return this.fullScreen}set backgroundMode(t){this.fullScreen.load(t)}get fps_limit(){return this.fpsLimit}set fps_limit(t){this.fpsLimit=t}get retina_detect(){return this.detectRetina}set retina_detect(t){this.detectRetina=t}load(t){var i,e,s,o,n;if(!t)return;void 0!==t.preset&&P(t.preset,(t=>this._importPreset(t))),void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.delay&&(this.delay=d(t.delay));const a=null!==(i=t.detectRetina)&&void 0!==i?i:t.retina_detect;void 0!==a&&(this.detectRetina=a),void 0!==t.duration&&(this.duration=d(t.duration));const r=null!==(e=t.fpsLimit)&&void 0!==e?e:t.fps_limit;void 0!==r&&(this.fpsLimit=r),void 0!==t.pauseOnBlur&&(this.pauseOnBlur=t.pauseOnBlur),void 0!==t.pauseOnOutsideViewport&&(this.pauseOnOutsideViewport=t.pauseOnOutsideViewport),void 0!==t.zLayers&&(this.zLayers=t.zLayers),this.background.load(t.background);const l=null!==(s=t.fullScreen)&&void 0!==s?s:t.backgroundMode;"boolean"==typeof l?this.fullScreen.enable=l:this.fullScreen.load(l),this.backgroundMask.load(t.backgroundMask),this.interactivity.load(t.interactivity),void 0!==t.manualParticles&&(this.manualParticles=t.manualParticles.map((t=>{const i=new yt;return i.load(t),i}))),this.particles.load(t.particles),this.style=C(this.style,t.style),this._engine.plugins.loadOptions(this,t),void 0!==t.smooth&&(this.smooth=t.smooth);const c=this._engine.plugins.interactors.get(this._container);if(c)for(const i of c)i.loadOptions&&i.loadOptions(this,t);if(void 0!==t.responsive)for(const i of t.responsive){const t=new gt;t.load(i),this.responsive.push(t)}if(this.responsive.sort(((t,i)=>t.maxWidth-i.maxWidth)),void 0!==t.themes)for(const i of t.themes){const t=this.themes.find((t=>t.name===i.name));if(t)t.load(i);else{const t=new bt;t.load(i),this.themes.push(t)}}this.defaultThemes.dark=null===(o=this._findDefaultTheme("dark"))||void 0===o?void 0:o.name,this.defaultThemes.light=null===(n=this._findDefaultTheme("light"))||void 0===n?void 0:n.name}setResponsive(t,i,e){this.load(e);const s=this.responsive.find((e=>"screen"===e.mode&&screen?e.maxWidth>screen.availWidth:e.maxWidth*i>t));return this.load(null==s?void 0:s.options),null==s?void 0:s.maxWidth}setTheme(t){if(t){const i=this.themes.find((i=>i.name===t));i&&this.load(i.options)}else{const t=w("(prefers-color-scheme: dark)"),i=t&&t.matches,e=this._findDefaultTheme(i?"dark":"light");e&&this.load(e.options)}}_findDefaultTheme(t){var i;return null!==(i=this.themes.find((i=>i.default.value&&i.default.mode===t)))&&void 0!==i?i:this.themes.find((t=>t.default.value&&"any"===t.default.mode))}_importPreset(t){this.load(this._engine.plugins.getPreset(t))}}class ni{constructor(t,i){this.container=i,this._engine=t,this._interactors=this._engine.plugins.getInteractors(this.container,!0),this._externalInteractors=[],this._particleInteractors=[]}async externalInteract(t){for(const i of this._externalInteractors)i.isEnabled()&&await i.interact(t)}handleClickMode(t){for(const i of this._externalInteractors)i.handleClickMode&&i.handleClickMode(t)}init(){this._externalInteractors=[],this._particleInteractors=[];for(const t of this._interactors){switch(t.type){case"external":this._externalInteractors.push(t);break;case"particles":this._particleInteractors.push(t)}t.init()}}async particlesInteract(t,i){for(const e of this._externalInteractors)e.clear(t,i);for(const e of this._particleInteractors)e.isEnabled(t)&&await e.interact(t,i)}async reset(t){for(const i of this._externalInteractors)i.isEnabled()&&await i.reset(t);for(const i of this._particleInteractors)i.isEnabled(t)&&await i.reset(t)}}const ai=t=>{b(t.outMode,t.checkModes)&&(t.coord>t.maxCoord-2*t.radius?t.setCb(-t.radius):t.coord<2*t.radius&&t.setCb(t.radius))};class ri{constructor(t,i,e,s,o,n){this.container=e,this._engine=t,this.init(i,s,o,n)}destroy(t){var i;if(!this.unbreakable&&!this.destroyed){this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;for(const[,i]of this.container.plugins)i.particleDestroyed&&i.particleDestroyed(this,t);for(const i of this.container.particles.updaters)i.particleDestroyed&&i.particleDestroyed(this,t);null===(i=this.pathGenerator)||void 0===i||i.reset(this)}}draw(t){const i=this.container;for(const[,e]of i.plugins)i.canvas.drawParticlePlugin(e,this,t);i.canvas.drawParticle(this,t)}getFillColor(){var t;return this._getRollColor(null!==(t=this.bubble.color)&&void 0!==t?t:j(this.color))}getMass(){return this.getRadius()**2*Math.PI/2}getPosition(){return{x:this.position.x+this.offset.x,y:this.position.y+this.offset.y,z:this.position.z}}getRadius(){var t;return null!==(t=this.bubble.radius)&&void 0!==t?t:this.size.value}getStrokeColor(){var t;return this._getRollColor(null!==(t=this.bubble.color)&&void 0!==t?t:j(this.strokeColor))}init(t,i,e,s){var o,n,a,r,c,h,d;const p=this.container,v=this._engine;this.id=t,this.group=s,this.fill=!0,this.pathRotation=!1,this.close=!0,this.lastPathTime=0,this.destroyed=!1,this.unbreakable=!1,this.rotation=0,this.misplaced=!1,this.retina={maxDistance:{}},this.outType="normal",this.ignoresResizeRatio=!0;const m=p.retina.pixelRatio,f=p.actualOptions,y=si(this._engine,p,f.particles),g=y.shape.type,{reduceDuplicates:w}=y;this.shape=k(g,this.id,w);const b=y.shape;if(e&&e.shape&&e.shape.type){const t=k(e.shape.type,this.id,w);t&&(this.shape=t,b.load(e.shape))}this.shapeData=this._loadShapeData(b,w),y.load(e),y.load(null===(o=this.shapeData)||void 0===o?void 0:o.particles),this.interactivity=new ft(v,p),this.interactivity.load(p.actualOptions.interactivity),this.interactivity.load(y.interactivity),this.fill=null!==(a=null===(n=this.shapeData)||void 0===n?void 0:n.fill)&&void 0!==a?a:this.fill,this.close=null!==(c=null===(r=this.shapeData)||void 0===r?void 0:r.close)&&void 0!==c?c:this.close,this.options=y;const _=this.options.move.path;this.pathDelay=1e3*u(_.delay),_.generator&&(this.pathGenerator=this._engine.plugins.getPathGenerator(_.generator),this.pathGenerator&&p.addPath(_.generator,this.pathGenerator)&&this.pathGenerator.init(p)),p.retina.initParticle(this),this.size=S(this.options.size,m),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this._initPosition(i),this.initialVelocity=this._calculateVelocity(),this.velocity=this.initialVelocity.copy(),this.moveDecay=1-l(this.options.move.decay);const x=p.particles;x.needsSort=x.needsSort||x.lastZIndex<this.position.z,x.lastZIndex=this.position.z,this.zIndexFactor=this.position.z/p.zLayers,this.sides=24;let z=p.drawers.get(this.shape);z||(z=this._engine.plugins.getShapeDrawer(this.shape),z&&p.drawers.set(this.shape,z)),(null==z?void 0:z.loadShape)&&(null==z||z.loadShape(this));const M=null==z?void 0:z.getSidesCount;M&&(this.sides=M(this)),this.spawning=!1,this.shadowColor=R(this.options.shadow.color);for(const t of p.particles.updaters)t.init(this);for(const t of p.particles.movers)null===(h=t.init)||void 0===h||h.call(t,this);(null==z?void 0:z.particleInit)&&z.particleInit(p,this);for(const[,t]of p.plugins)null===(d=t.particleCreated)||void 0===d||d.call(t,this)}isInsideCanvas(){const t=this.getRadius(),i=this.container.canvas.size;return this.position.x>=-t&&this.position.y>=-t&&this.position.y<=i.height+t&&this.position.x<=i.width+t}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){var t;for(const i of this.container.particles.updaters)null===(t=i.reset)||void 0===t||t.call(i,this)}_calcPosition(t,i,s,o=0){var n,a,r,l;for(const[,o]of t.plugins){const t=void 0!==o.particlePosition?o.particlePosition(i,this):void 0;if(void 0!==t)return e.create(t.x,t.y,s)}const c=f({size:t.canvas.size,position:i}),h=e.create(c.x,c.y,s),d=this.getRadius(),u=this.options.move.outModes,p=i=>{ai({outMode:i,checkModes:["bounce","bounce-horizontal"],coord:h.x,maxCoord:t.canvas.size.width,setCb:t=>h.x+=t,radius:d})},v=i=>{ai({outMode:i,checkModes:["bounce","bounce-vertical"],coord:h.y,maxCoord:t.canvas.size.height,setCb:t=>h.y+=t,radius:d})};return p(null!==(n=u.left)&&void 0!==n?n:u.default),p(null!==(a=u.right)&&void 0!==a?a:u.default),v(null!==(r=u.top)&&void 0!==r?r:u.default),v(null!==(l=u.bottom)&&void 0!==l?l:u.default),this._checkOverlap(h,o)?this._calcPosition(t,void 0,s,o+1):h}_calculateVelocity(){const t=function(t){const i=s.origin;return i.length=1,i.angle=t,i}(this.direction).copy(),i=this.options.move;if("inside"===i.direction||"outside"===i.direction)return t;const e=Math.PI/180*l(i.angle.value),o=Math.PI/180*l(i.angle.offset),a={left:o-e/2,right:o+e/2};return i.straight||(t.angle+=r(d(a.left,a.right))),i.random&&"number"==typeof i.speed&&(t.length*=n()),t}_checkOverlap(t,i=0){const e=this.options.collisions,s=this.getRadius();if(!e.enable)return!1;const o=e.overlap;if(o.enable)return!1;const n=o.retries;if(n>=0&&i>n)throw new Error("Particle is overlapping and can't be placed");let a=!1;for(const i of this.container.particles.array)if(v(t,i.position)<s+i.getRadius()){a=!0;break}return a}_getRollColor(t){var i;if(!t||!this.roll||!this.backColor&&!this.roll.alter)return t;const e=this.roll.horizontal&&this.roll.vertical?2:1,s=this.roll.horizontal?Math.PI/2:0;return Math.floor(((null!==(i=this.roll.angle)&&void 0!==i?i:0)+s)/(Math.PI/e))%2?this.backColor?this.backColor:this.roll.alter?function(t,i,e){return{h:t.h,s:t.s,l:t.l+("darken"===i?-1:1)*e}}(t,this.roll.alter.type,this.roll.alter.value):t:t}_initPosition(t){var i,e;const o=this.container,r=l(this.options.zIndex.value);this.position=this._calcPosition(o,t,a(r,0,o.zLayers)),this.initialPosition=this.position.copy();const c=o.canvas.size,h=Object.assign({},this.options.move.center),d="percent"===h.mode;switch(this.moveCenter={x:h.x*(d?c.width/100:1),y:h.y*(d?c.height/100:1),radius:null!==(i=this.options.move.center.radius)&&void 0!==i?i:0,mode:null!==(e=this.options.move.center.mode)&&void 0!==e?e:"percent"},this.direction=function(t,i,e){if("number"==typeof t)return t*Math.PI/180;switch(t){case"top":return-Math.PI/2;case"top-right":return-Math.PI/4;case"right":return 0;case"bottom-right":return Math.PI/4;case"bottom":return Math.PI/2;case"bottom-left":return 3*Math.PI/4;case"left":return Math.PI;case"top-left":return-3*Math.PI/4;case"inside":return Math.atan2(e.y-i.y,e.x-i.x);case"outside":return Math.atan2(i.y-e.y,i.x-e.x);default:return n()*Math.PI*2}}(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case"inside":this.outType="inside";break;case"outside":this.outType="outside"}this.offset=s.origin}_loadShapeData(t,i){const e=t.options[this.shape];if(e)return C({close:t.close,fill:t.fill},k(e,this.id,i))}}class li{constructor(t,i){this.position=t,this.particle=i}}class ci{constructor(t,i){this.position={x:t,y:i}}}class hi extends ci{constructor(t,i,e){super(t,i),this.radius=e}contains(t){return v(t,this.position)<=this.radius}intersects(t){const i=t,e=t,s=this.position,o=t.position,n=Math.abs(o.x-s.x),a=Math.abs(o.y-s.y),r=this.radius;if(void 0!==e.radius){return r+e.radius>Math.sqrt(n**2+a**2)}if(void 0!==i.size){const t=i.size.width,e=i.size.height;return Math.pow(n-t,2)+Math.pow(a-e,2)<=r**2||n<=r+t&&a<=r+e||n<=t||a<=e}return!1}}class di extends ci{constructor(t,i,e,s){super(t,i),this.size={height:s,width:e}}contains(t){const i=this.size.width,e=this.size.height,s=this.position;return t.x>=s.x&&t.x<=s.x+i&&t.y>=s.y&&t.y<=s.y+e}intersects(t){t instanceof hi&&t.intersects(this);const i=this.size.width,e=this.size.height,s=this.position,o=t.position,n=t instanceof di?t.size:{width:0,height:0},a=n.width,r=n.height;return o.x<s.x+i&&o.x+a>s.x&&o.y<s.y+e&&o.y+r>s.y}}class ui{constructor(t,i){this.rectangle=t,this.capacity=i,this._points=[],this._divided=!1}insert(t){var i,e,s,o,n;return!!this.rectangle.contains(t.position)&&(this._points.length<this.capacity?(this._points.push(t),!0):(this._divided||this.subdivide(),null!==(n=(null===(i=this._NE)||void 0===i?void 0:i.insert(t))||(null===(e=this._NW)||void 0===e?void 0:e.insert(t))||(null===(s=this._SE)||void 0===s?void 0:s.insert(t))||(null===(o=this._SW)||void 0===o?void 0:o.insert(t)))&&void 0!==n&&n))}query(t,i,e){var s,o,n,a;const r=null!=e?e:[];if(!t.intersects(this.rectangle))return[];for(const e of this._points)!t.contains(e.position)&&v(t.position,e.position)>e.particle.getRadius()&&(!i||i(e.particle))||r.push(e.particle);return this._divided&&(null===(s=this._NE)||void 0===s||s.query(t,i,r),null===(o=this._NW)||void 0===o||o.query(t,i,r),null===(n=this._SE)||void 0===n||n.query(t,i,r),null===(a=this._SW)||void 0===a||a.query(t,i,r)),r}queryCircle(t,i,e){return this.query(new hi(t.x,t.y,i),e)}queryRectangle(t,i,e){return this.query(new di(t.x,t.y,i.width,i.height),e)}subdivide(){const t=this.rectangle.position.x,i=this.rectangle.position.y,e=this.rectangle.size.width,s=this.rectangle.size.height,o=this.capacity;this._NE=new ui(new di(t,i,e/2,s/2),o),this._NW=new ui(new di(t+e/2,i,e/2,s/2),o),this._SE=new ui(new di(t,i+s/2,e/2,s/2),o),this._SW=new ui(new di(t+e/2,i+s/2,e/2,s/2),o),this._divided=!0}}class pi{constructor(t,i){this.container=i,this._engine=t,this.nextId=0,this.array=[],this.zArray=[],this.pool=[],this.limit=0,this.needsSort=!1,this.lastZIndex=0,this.interactionManager=new ni(this._engine,i);const e=this.container.canvas.size;this.quadTree=new ui(new di(-e.width/4,-e.height/4,3*e.width/2,3*e.height/2),4),this.movers=this._engine.plugins.getMovers(i,!0),this.updaters=this._engine.plugins.getUpdaters(i,!0)}get count(){return this.array.length}addManualParticles(){const t=this.container,i=t.actualOptions;for(const s of i.manualParticles)this.addParticle(s.position?"precise"===s.position.mode?s.position:(e={size:t.canvas.size,position:s.position}).position&&void 0!==e.position.x&&void 0!==e.position.y?{x:e.position.x*e.size.width/100,y:e.position.y*e.size.height/100}:void 0:void 0,s.options);var e}addParticle(t,i,e,s){const o=this.container.actualOptions.particles.number.limit;if(o>0){const t=this.count+1-o;t>0&&this.removeQuantity(t)}return this._pushParticle(t,i,e,s)}clear(){this.array=[],this.zArray=[]}destroy(){this.array=[],this.zArray=[],this.movers=[],this.updaters=[]}async draw(t){const i=this.container,e=this.container.canvas.size;this.quadTree=new ui(new di(-e.width/4,-e.height/4,3*e.width/2,3*e.height/2),4),i.canvas.clear(),await this.update(t),this.needsSort&&(this.zArray.sort(((t,i)=>i.position.z-t.position.z||t.id-i.id)),this.lastZIndex=this.zArray[this.zArray.length-1].position.z,this.needsSort=!1);for(const[,e]of i.plugins)i.canvas.drawPlugin(e,t);for(const i of this.zArray)i.draw(t)}handleClickMode(t){this.interactionManager.handleClickMode(t)}init(){var t;const i=this.container,e=i.actualOptions;this.lastZIndex=0,this.needsSort=!1;let s=!1;this.updaters=this._engine.plugins.getUpdaters(i,!0),this.interactionManager.init();for(const[,t]of i.plugins)if(void 0!==t.particlesInitialization&&(s=t.particlesInitialization()),s)break;this.interactionManager.init();for(const[,t]of i.pathGenerators)t.init(i);if(this.addManualParticles(),!s){for(const i in e.particles.groups){const s=e.particles.groups[i];for(let o=this.count,n=0;n<(null===(t=s.number)||void 0===t?void 0:t.value)&&o<e.particles.number.value;o++,n++)this.addParticle(void 0,s,i)}for(let t=this.count;t<e.particles.number.value;t++)this.addParticle()}}push(t,i,e,s){this.pushing=!0;for(let o=0;o<t;o++)this.addParticle(null==i?void 0:i.position,e,s);this.pushing=!1}async redraw(){this.clear(),this.init(),await this.draw({value:0,factor:0})}remove(t,i,e){this.removeAt(this.array.indexOf(t),void 0,i,e)}removeAt(t,i=1,e,s){if(t<0||t>this.count)return;let o=0;for(let n=t;o<i&&n<this.count;n++)this._removeParticle(n--,e,s)&&o++}removeQuantity(t,i){this.removeAt(0,t,i)}setDensity(){const t=this.container.actualOptions;for(const i in t.particles.groups)this._applyDensity(t.particles.groups[i],0,i);this._applyDensity(t.particles,t.manualParticles.length)}async update(t){var i,e;const s=this.container,o=[];for(const[,t]of s.pathGenerators)t.update();for(const[,e]of s.plugins)null===(i=e.update)||void 0===i||i.call(e,t);for(const i of this.array){const n=s.canvas.resizeFactor;n&&!i.ignoresResizeRatio&&(i.position.x*=n.width,i.position.y*=n.height,i.initialPosition.x*=n.width,i.initialPosition.y*=n.height),i.ignoresResizeRatio=!1,await this.interactionManager.reset(i);for(const[,s]of this.container.plugins){if(i.destroyed)break;null===(e=s.particleUpdate)||void 0===e||e.call(s,i,t)}for(const e of this.movers)e.isEnabled(i)&&e.move(i,t);i.destroyed?o.push(i):this.quadTree.insert(new li(i.getPosition(),i))}for(const t of o)this.remove(t);await this.interactionManager.externalInteract(t);for(const i of this.array){for(const e of this.updaters)e.update(i,t);i.destroyed||i.spawning||await this.interactionManager.particlesInteract(i,t)}delete s.canvas.resizeFactor}_applyDensity(t,i,e){var s;if(!(null===(s=t.number.density)||void 0===s?void 0:s.enable))return;const o=t.number,n=this._initDensityFactor(o.density),a=o.value,r=o.limit>0?o.limit:a,l=Math.min(a,r)*n+i,c=Math.min(this.count,this.array.filter((t=>t.group===e)).length);this.limit=o.limit*n,c<l?this.push(Math.abs(l-c),void 0,t,e):c>l&&this.removeQuantity(c-l,e)}_initDensityFactor(t){const i=this.container;if(!i.canvas.element||!t.enable)return 1;const e=i.canvas.element,s=i.retina.pixelRatio;return e.width*e.height/(t.factor*s**2*t.area)}_pushParticle(t,i,e,s){try{let o=this.pool.pop();o?o.init(this.nextId,t,i,e):o=new ri(this._engine,this.nextId,this.container,t,i,e);let n=!0;if(s&&(n=s(o)),!n)return;return this.array.push(o),this.zArray.push(o),this.nextId++,this._engine.dispatchEvent("particleAdded",{container:this.container,data:{particle:o}}),o}catch(t){return void console.warn(`error adding particle: ${t}`)}}_removeParticle(t,i,e){const s=this.array[t];if(!s||s.group!==i)return!1;s.destroy(e),this.array.splice(t,1);const o=this.zArray.indexOf(s);return this.zArray.splice(o,1),this.pool.push(s),this._engine.dispatchEvent("particleRemoved",{container:this.container,data:{particle:s}}),!0}}class vi{constructor(t){this.container=t}init(){const t=this.container,i=t.actualOptions;this.pixelRatio=!i.detectRetina||g()?1:window.devicePixelRatio,this.reduceFactor=1;const e=this.pixelRatio;if(t.canvas.element){const i=t.canvas.element;t.canvas.size.width=i.offsetWidth*e,t.canvas.size.height=i.offsetHeight*e}const s=i.particles;this.attractDistance=l(s.move.attract.distance)*e,this.sizeAnimationSpeed=l(s.size.animation.speed)*e,this.maxSpeed=l(s.move.gravity.maxSpeed)*e}initParticle(t){const i=t.options,e=this.pixelRatio,s=i.move.distance,o=t.retina;o.attractDistance=l(i.move.attract.distance)*e,o.moveDrift=l(i.move.drift)*e,o.moveSpeed=l(i.move.speed)*e,o.sizeAnimationSpeed=l(i.size.animation.speed)*e;const n=o.maxDistance;n.horizontal=void 0!==s.horizontal?s.horizontal*e:void 0,n.vertical=void 0!==s.vertical?s.vertical*e:void 0,o.maxSpeed=l(i.move.gravity.maxSpeed)*e}}function mi(t){return t&&!t.destroyed}function fi(t,i,...e){const s=new oi(t,i);return ei(s,...e),s}const yi={generate:t=>{const i=t.velocity.copy();return i.angle+=i.length*Math.PI/180,i},init:()=>{},update:()=>{},reset:()=>{}};class gi{constructor(t,i,e){this.id=i,this._engine=t,this.fpsLimit=120,this.smooth=!1,this._delay=0,this.duration=0,this.lifeTime=0,this._firstStart=!0,this.started=!1,this.destroyed=!1,this._paused=!0,this.lastFrameTime=0,this.zLayers=100,this.pageHidden=!1,this._sourceOptions=e,this._initialSourceOptions=e,this.retina=new vi(this),this.canvas=new tt(this),this.particles=new pi(this._engine,this),this.frameManager=new st(this),this.pathGenerators=new Map,this.interactivity={mouse:{clicking:!1,inside:!1}},this.plugins=new Map,this.drawers=new Map,this._options=fi(this._engine,this),this.actualOptions=fi(this._engine,this),this._eventListeners=new et(this),"undefined"!=typeof IntersectionObserver&&IntersectionObserver&&(this._intersectionObserver=new IntersectionObserver((t=>this._intersectionManager(t)))),this._engine.dispatchEvent("containerBuilt",{container:this})}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addClickHandler(t){if(!mi(this))return;const i=this.interactivity.element;if(!i)return;const e=(i,e,s)=>{if(!mi(this))return;const o=this.retina.pixelRatio,n={x:e.x*o,y:e.y*o},a=this.particles.quadTree.queryCircle(n,s*o);t(i,a)};let s=!1,o=!1;i.addEventListener("click",(t=>{if(!mi(this))return;const i=t,s={x:i.offsetX||i.clientX,y:i.offsetY||i.clientY};e(t,s,1)})),i.addEventListener("touchstart",(()=>{mi(this)&&(s=!0,o=!1)})),i.addEventListener("touchmove",(()=>{mi(this)&&(o=!0)})),i.addEventListener("touchend",(t=>{if(mi(this)){if(s&&!o){const i=t;let s=i.touches[i.touches.length-1];if(!s&&(s=i.changedTouches[i.changedTouches.length-1],!s))return;const o=this.canvas.element,n=o?o.getBoundingClientRect():void 0,a={x:s.clientX-(n?n.left:0),y:s.clientY-(n?n.top:0)};e(t,a,Math.max(s.radiusX,s.radiusY))}s=!1,o=!1}})),i.addEventListener("touchcancel",(()=>{mi(this)&&(s=!1,o=!1)}))}addPath(t,i,e=!1){return!(!mi(this)||!e&&this.pathGenerators.has(t))&&(this.pathGenerators.set(t,null!=i?i:yi),!0)}destroy(){if(!mi(this))return;this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.drawers)t.destroy&&t.destroy(this);for(const t of this.drawers.keys())this.drawers.delete(t);this._engine.plugins.destroy(this),this.destroyed=!0;const t=this._engine.dom(),i=t.findIndex((t=>t===this));i>=0&&t.splice(i,1),this._engine.dispatchEvent("containerDestroyed",{container:this})}draw(t){if(!mi(this))return;let i=t;this._drawAnimationFrame=(g()?t=>setTimeout(t):t=>(requestAnimationFrame||setTimeout)(t))((async t=>{i&&(this.lastFrameTime=void 0,i=!1),await this.frameManager.nextFrame(t)}))}exportConfiguration(){return JSON.stringify(this.actualOptions,((t,i)=>{if("_engine"!==t&&"_container"!==t)return i}),2)}exportImage(t,i,e){const s=this.canvas.element;s&&s.toBlob(t,null!=i?i:"image/png",e)}exportImg(t){this.exportImage(t)}getAnimationStatus(){return!this._paused&&!this.pageHidden&&mi(this)}handleClickMode(t){if(mi(this)){this.particles.handleClickMode(t);for(const[,i]of this.plugins)i.handleClickMode&&i.handleClickMode(t)}}async init(){if(!mi(this))return;const t=this._engine.plugins.getSupportedShapes();for(const i of t){const t=this._engine.plugins.getShapeDrawer(i);t&&this.drawers.set(i,t)}this._options=fi(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=fi(this._engine,this,this._options);const i=this._engine.plugins.getAvailablePlugins(this);for(const[t,e]of i)this.plugins.set(t,e);this.retina.init(),await this.canvas.init(),this.zLayers=this.actualOptions.zLayers,this.duration=1e3*l(this.actualOptions.duration),this._delay=1e3*l(this.actualOptions.delay),this.lifeTime=0,this.fpsLimit=this.actualOptions.fpsLimit>0?this.actualOptions.fpsLimit:120,this.smooth=this.actualOptions.smooth;for(const[,t]of this.drawers)t.init&&await t.init(this);for(const[,t]of this.plugins)t.init&&await t.init();this._engine.dispatchEvent("containerInit",{container:this}),this.particles.init(),this.particles.setDensity();for(const[,t]of this.plugins)t.particlesSetup&&t.particlesSetup();this._engine.dispatchEvent("particlesSetup",{container:this})}async loadTheme(t){mi(this)&&(this._currentTheme=t,await this.refresh())}pause(){if(mi(this)&&(void 0!==this._drawAnimationFrame&&((g()?t=>clearTimeout(t):t=>(cancelAnimationFrame||clearTimeout)(t))(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(const[,t]of this.plugins)t.pause&&t.pause();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent("containerPaused",{container:this})}}play(t){if(!mi(this))return;const i=this._paused||t;if(!this._firstStart||this.actualOptions.autoPlay){if(this._paused&&(this._paused=!1),i)for(const[,t]of this.plugins)t.play&&t.play();this._engine.dispatchEvent("containerPlay",{container:this}),this.draw(i||!1)}else this._firstStart=!1}async refresh(){if(mi(this))return this.stop(),this.start()}async reset(){if(mi(this))return this._options=fi(this._engine,this),this.refresh()}setNoise(t,i,e){mi(this)&&this.setPath(t,i,e)}setPath(t,i,e){if(!t||!mi(this))return;const s=Object.assign({},yi);if("function"==typeof t)s.generate=t,i&&(s.init=i),e&&(s.update=e);else{const i=s;s.generate=t.generate||i.generate,s.init=t.init||i.init,s.update=t.update||i.update}this.addPath("default",s,!0)}async start(){mi(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{this._delayTimeout=setTimeout((async()=>{this._eventListeners.addListeners(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.observe(this.interactivity.element);for(const[,t]of this.plugins)t.start&&await t.start();this._engine.dispatchEvent("containerStarted",{container:this}),this.play(),t()}),this._delay)})))}stop(){if(mi(this)&&this.started){this._delayTimeout&&(clearTimeout(this._delayTimeout),delete this._delayTimeout),this._firstStart=!0,this.started=!1,this._eventListeners.removeListeners(),this.pause(),this.particles.clear(),this.canvas.clear(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.unobserve(this.interactivity.element);for(const[,t]of this.plugins)t.stop&&t.stop();for(const t of this.plugins.keys())this.plugins.delete(t);this._sourceOptions=this._options,this._engine.dispatchEvent("containerStopped",{container:this})}}updateActualOptions(){this.actualOptions.responsive=[];const t=this.actualOptions.setResponsive(this.canvas.size.width,this.retina.pixelRatio,this._options);return this.actualOptions.setTheme(this._currentTheme),this.responsiveMaxWidth!==t&&(this.responsiveMaxWidth=t,!0)}_intersectionManager(t){if(mi(this)&&this.actualOptions.pauseOnOutsideViewport)for(const i of t)i.target===this.interactivity.element&&(i.isIntersecting?this.play:this.pause)()}}class wi{constructor(){this._listeners=new Map}addEventListener(t,i){var e;this.removeEventListener(t,i),this._listeners.get(t)||this._listeners.set(t,[]),null===(e=this._listeners.get(t))||void 0===e||e.push(i)}dispatchEvent(t,i){var e;null===(e=this._listeners.get(t))||void 0===e||e.forEach((t=>t(i)))}hasEventListener(t){return!!this._listeners.get(t)}removeAllEventListeners(t){t?this._listeners.delete(t):this._listeners=new Map}removeEventListener(t,i){const e=this._listeners.get(t);if(!e)return;const s=e.length,o=e.indexOf(i);o<0||(1===s?this._listeners.delete(t):e.splice(o,1))}}function bi(t,i,e,s=!1){let o=i.get(t);return o&&!s||(o=[...e.values()].map((i=>i(t))),i.set(t,o)),o}class _i{constructor(t){this._engine=t,this.plugins=[],this._initializers={interactors:new Map,movers:new Map,updaters:new Map},this.interactors=new Map,this.movers=new Map,this.updaters=new Map,this.presets=new Map,this.drawers=new Map,this.pathGenerators=new Map}addInteractor(t,i){this._initializers.interactors.set(t,i)}addParticleMover(t,i){this._initializers.movers.set(t,i)}addParticleUpdater(t,i){this._initializers.updaters.set(t,i)}addPathGenerator(t,i){this.getPathGenerator(t)||this.pathGenerators.set(t,i)}addPlugin(t){this.getPlugin(t.id)||this.plugins.push(t)}addPreset(t,i,e=!1){!e&&this.getPreset(t)||this.presets.set(t,i)}addShapeDrawer(t,i){P(t,(t=>{this.getShapeDrawer(t)||this.drawers.set(t,i)}))}destroy(t){this.updaters.delete(t),this.movers.delete(t),this.interactors.delete(t)}getAvailablePlugins(t){const i=new Map;for(const e of this.plugins)e.needsPlugin(t.actualOptions)&&i.set(e.id,e.getPlugin(t));return i}getInteractors(t,i=!1){return bi(t,this.interactors,this._initializers.interactors,i)}getMovers(t,i=!1){return bi(t,this.movers,this._initializers.movers,i)}getPathGenerator(t){return this.pathGenerators.get(t)}getPlugin(t){return this.plugins.find((i=>i.id===t))}getPreset(t){return this.presets.get(t)}getShapeDrawer(t){return this.drawers.get(t)}getSupportedShapes(){return this.drawers.keys()}getUpdaters(t,i=!1){return bi(t,this.updaters,this._initializers.updaters,i)}loadOptions(t,i){for(const e of this.plugins)e.loadOptions(t,i)}loadParticlesOptions(t,i,...e){const s=this.updaters.get(t);if(s)for(const t of s)t.loadOptions&&t.loadOptions(i,...e)}}const xi=new class{constructor(){this.key="rgb",this.stringPrefix="rgb"}handleColor(t){var i;const e=null!==(i=t.value.rgb)&&void 0!==i?i:t.value;if(void 0!==e.r)return e}handleRangeColor(t){var i;const e=null!==(i=t.value.rgb)&&void 0!==i?i:t.value;if(void 0!==e.r)return{r:l(e.r),g:l(e.g),b:l(e.b)}}parseString(t){if(!t.startsWith(this.stringPrefix))return;const i=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.%]+)\s*)?\)/i.exec(t);return i?{a:i.length>4?y(i[5]):1,b:parseInt(i[3],10),g:parseInt(i[2],10),r:parseInt(i[1],10)}:void 0}},zi=new class{constructor(){this.key="hsl",this.stringPrefix="hsl"}handleColor(t){var i;const e=null!==(i=t.value.hsl)&&void 0!==i?i:t.value;if(void 0!==e.h&&void 0!==e.s&&void 0!==e.l)return B(e)}handleRangeColor(t){var i;const e=null!==(i=t.value.hsl)&&void 0!==i?i:t.value;if(void 0!==e.h&&void 0!==e.l)return B({h:l(e.h),l:l(e.l),s:l(e.s)})}parseString(t){if(!t.startsWith("hsl"))return;const i=/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([\d.%]+)\s*)?\)/i.exec(t);return i?function(t){const i=B(t);return{a:t.a,b:i.b,g:i.g,r:i.r}}({a:i.length>4?y(i[5]):1,h:parseInt(i[1],10),l:parseInt(i[3],10),s:parseInt(i[2],10)}):void 0}};E(xi),E(zi);const Mi=new class{constructor(){this._configs=new Map,this._domArray=[],this._eventDispatcher=new wi,this.plugins=new _i(this)}get configs(){const t={};for(const[i,e]of this._configs)t[i]=e;return t}addConfig(t,i){var e;"string"==typeof t?i&&(i.name=t,this._configs.set(t,i)):this._configs.set(null!==(e=t.name)&&void 0!==e?e:"default",t)}addEventListener(t,i){this._eventDispatcher.addEventListener(t,i)}async addInteractor(t,i){this.plugins.addInteractor(t,i),await this.refresh()}async addMover(t,i){this.plugins.addParticleMover(t,i),await this.refresh()}async addParticleUpdater(t,i){this.plugins.addParticleUpdater(t,i),await this.refresh()}async addPathGenerator(t,i){this.plugins.addPathGenerator(t,i),await this.refresh()}async addPlugin(t){this.plugins.addPlugin(t),await this.refresh()}async addPreset(t,i,e=!1){this.plugins.addPreset(t,i,e),await this.refresh()}async addShape(t,i,e,s,o){let n;n="function"==typeof i?{afterEffect:s,destroy:o,draw:i,init:e}:i,this.plugins.addShapeDrawer(t,n),await this.refresh()}dispatchEvent(t,i){this._eventDispatcher.dispatchEvent(t,i)}dom(){return this._domArray}domItem(t){const i=this.dom(),e=i[t];if(e&&!e.destroyed)return e;i.splice(t,1)}async load(t){var i,e,s;const o=null!==(i=t.id)&&void 0!==i?i:`tsparticles${Math.floor(1e4*n())}`,{index:a,url:r}=t,l=r?await async function(t){const i=k(t.url,t.index);if(!i)return t.fallback;const e=await fetch(i);return e.ok?e.json():(console.error(`tsParticles - Error ${e.status} while retrieving config file`),t.fallback)}({fallback:t.options,index:a,url:r}):t.options;let c=null!==(e=t.element)&&void 0!==e?e:document.getElementById(o);c||(c=document.createElement("div"),c.id=o,null===(s=document.querySelector("body"))||void 0===s||s.append(c));const h=k(l,a),d=this.dom(),u=d.findIndex((t=>t.id===o));if(u>=0){const t=this.domItem(u);t&&!t.destroyed&&(t.destroy(),d.splice(u,1))}let p;if("canvas"===c.tagName.toLowerCase())p=c,p.dataset[Y]="false";else{const t=c.getElementsByTagName("canvas");t.length?(p=t[0],p.dataset[Y]="false"):(p=document.createElement("canvas"),p.dataset[Y]="true",c.appendChild(p))}p.style.width||(p.style.width="100%"),p.style.height||(p.style.height="100%");const v=new gi(this,o,h);return u>=0?d.splice(u,0,v):d.push(v),v.canvas.loadCanvas(p),await v.start(),v}async refresh(){for(const t of this.dom())await t.refresh()}removeEventListener(t,i){this._eventDispatcher.removeEventListener(t,i)}setOnClickHandler(t){const i=this.dom();if(!i.length)throw new Error("Can only set click handlers after calling tsParticles.load()");for(const e of i)e.addClickHandler(t)}};class Ci{constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=d(t.speed)),void 0!==t.decay&&(this.decay=d(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class Pi extends Ot{constructor(){super(),this.animation=new Ci,this.direction="clockwise",this.path=!1,this.value=0}load(t){t&&(super.load(t),void 0!==t.direction&&(this.direction=t.direction),this.animation.load(t.animation),void 0!==t.path&&(this.path=t.path))}}class ki{constructor(t){this.container=t}init(t){const i=t.options.rotate;if(!i)return;t.rotate={enable:i.animation.enable,value:l(i.value)*Math.PI/180},t.pathRotation=i.path;let e=i.direction;if("random"===e){e=Math.floor(2*n())>0?"counter-clockwise":"clockwise"}switch(e){case"counter-clockwise":case"counterClockwise":t.rotate.status="decreasing";break;case"clockwise":t.rotate.status="increasing"}const s=i.animation;s.enable&&(t.rotate.decay=1-l(s.decay),t.rotate.velocity=l(s.speed)/360*this.container.retina.reduceFactor,s.sync||(t.rotate.velocity*=n())),t.rotation=t.rotate.value}isEnabled(t){const i=t.options.rotate;return!!i&&(!t.destroyed&&!t.spawning&&i.animation.enable&&!i.path)}loadOptions(t,...i){t.rotate||(t.rotate=new Pi);for(const e of i)t.rotate.load(null==e?void 0:e.rotate)}update(t,i){var e,s;this.isEnabled(t)&&(!function(t,i){var e,s;const o=t.rotate,n=t.options.rotate;if(!o||!n)return;const a=n.animation,r=(null!==(e=o.velocity)&&void 0!==e?e:0)*i.factor,l=2*Math.PI,c=null!==(s=o.decay)&&void 0!==s?s:1;a.enable&&("increasing"===o.status?(o.value+=r,o.value>l&&(o.value-=l)):(o.value-=r,o.value<0&&(o.value+=l)),o.velocity&&1!==c&&(o.velocity*=c))}(t,i),t.rotation=null!==(s=null===(e=t.rotate)||void 0===e?void 0:e.value)&&void 0!==s?s:0)}}class Si{init(t){var i;const e=t.container,s=t.options,o=s.move.gravity,n=s.move.spin;if(t.gravity={enable:o.enable,acceleration:l(o.acceleration),inverse:o.inverse},n.enable){const s=null!==(i=n.position)&&void 0!==i?i:{x:50,y:50},o={x:s.x/100*e.canvas.size.width,y:s.y/100*e.canvas.size.height},a=v(t.getPosition(),o),r=l(n.acceleration);t.retina.spinAcceleration=r*e.retina.pixelRatio,t.spin={center:o,direction:t.velocity.x>=0?"clockwise":"counter-clockwise",angle:t.velocity.angle,radius:a,acceleration:t.retina.spinAcceleration}}}isEnabled(t){return!t.destroyed&&t.options.move.enable}move(t,i){var e,s,o,r,c;const d=t.options,u=d.move;if(!u.enable)return;const v=t.container,m=function(t){return t.slow.inRange?t.slow.factor:1}(t),f=(null!==(e=(r=t.retina).moveSpeed)&&void 0!==e?e:r.moveSpeed=l(u.speed)*v.retina.pixelRatio)*v.retina.reduceFactor,y=null!==(s=(c=t.retina).moveDrift)&&void 0!==s?s:c.moveDrift=l(t.options.move.drift)*v.retina.pixelRatio,g=h(d.size.value)*v.retina.pixelRatio,w=f*((u.size?t.getRadius()/g:1)*m*(i.factor||1))/2;if(u.spin.enable)!function(t,i){const e=t.container;if(!t.spin)return;const s={x:"clockwise"===t.spin.direction?Math.cos:Math.sin,y:"clockwise"===t.spin.direction?Math.sin:Math.cos};t.position.x=t.spin.center.x+t.spin.radius*s.x(t.spin.angle),t.position.y=t.spin.center.y+t.spin.radius*s.y(t.spin.angle),t.spin.radius+=t.spin.acceleration;const o=Math.max(e.canvas.size.width,e.canvas.size.height);t.spin.radius>o/2?(t.spin.radius=o/2,t.spin.acceleration*=-1):t.spin.radius<0&&(t.spin.radius=0,t.spin.acceleration*=-1),t.spin.angle+=i/100*(1-t.spin.radius/o)}(t,w);else{!function(t,i){var e;const s=t.options.move.path;if(!s.enable)return;if(t.lastPathTime<=t.pathDelay)return void(t.lastPathTime+=i.value);const o=null===(e=t.pathGenerator)||void 0===e?void 0:e.generate(t);o&&t.velocity.addTo(o),s.clamp&&(t.velocity.x=a(t.velocity.x,-1,1),t.velocity.y=a(t.velocity.y,-1,1)),t.lastPathTime-=t.pathDelay}(t,i);const e=t.gravity,s=(null==e?void 0:e.enable)&&e.inverse?-1:1;(null==e?void 0:e.enable)&&w&&(t.velocity.y+=s*(e.acceleration*i.factor)/(60*w)),y&&w&&(t.velocity.x+=y*i.factor/(60*w));const n=t.moveDecay;1!=n&&t.velocity.multTo(n);const r=t.velocity.mult(w),l=null!==(o=t.retina.maxSpeed)&&void 0!==o?o:v.retina.maxSpeed;(null==e?void 0:e.enable)&&l>0&&(!e.inverse&&r.y>=0&&r.y>=l||e.inverse&&r.y<=0&&r.y<=-l)&&(r.y=s*l,w&&(t.velocity.y=r.y/w));const c=t.options.zIndex,h=(1-t.zIndexFactor)**c.velocityRate;1!=h&&r.multTo(h),t.position.addTo(r),u.vibrate&&(t.position.x+=Math.sin(t.position.x*Math.cos(t.position.y)),t.position.y+=Math.cos(t.position.y*Math.sin(t.position.x)))}!function(t){const i=t.initialPosition,{dx:e,dy:s}=p(i,t.position),o=Math.abs(e),a=Math.abs(s),r=t.retina.maxDistance.horizontal,l=t.retina.maxDistance.vertical;if(r||l)if((r&&o>=r||l&&a>=l)&&!t.misplaced)t.misplaced=!!r&&o>r||!!l&&a>l,r&&(t.velocity.x=t.velocity.y/2-t.velocity.x),l&&(t.velocity.y=t.velocity.x/2-t.velocity.y);else if((!r||o<r)&&(!l||a<l)&&t.misplaced)t.misplaced=!1;else if(t.misplaced){const e=t.position,s=t.velocity;r&&(e.x<i.x&&s.x<0||e.x>i.x&&s.x>0)&&(s.x*=-n()),l&&(e.y<i.y&&s.y<0||e.y>i.y&&s.y>0)&&(s.y*=-n())}}(t)}}class Oi{draw(t,i,e){i.circleRange||(i.circleRange={min:0,max:2*Math.PI});const s=i.circleRange;t.arc(0,0,e,s.min,s.max,!1)}getSidesCount(){return 12}particleInit(t,i){var e;const s=i.shapeData,o=null!==(e=null==s?void 0:s.angle)&&void 0!==e?e:{max:360,min:0};i.circleRange="object"!=typeof o?{min:0,max:o*Math.PI/180}:{min:o.min*Math.PI/180,max:o.max*Math.PI/180}}}function Ii(t,i,e,s,o){var n,a;const l=i;if(!l||!e.enable||void 0!==l.loops&&void 0!==l.maxLoops&&l.maxLoops>0&&l.loops>=l.maxLoops)return;const c=r(e.offset),h=(null!==(n=i.velocity)&&void 0!==n?n:0)*t.factor+3.6*c,d=null!==(a=i.decay)&&void 0!==a?a:1;o&&"increasing"!==l.status?(l.value-=h,l.value<0&&(l.loops||(l.loops=0),l.loops++,l.status="increasing",l.value+=l.value)):(l.value+=h,l.value>s&&(l.loops||(l.loops=0),l.loops++,o&&(l.status="decreasing",l.value-=l.value%s))),l.velocity&&1!==d&&(l.velocity*=d),l.value>s&&(l.value%=s)}class Ei{constructor(t){this.container=t}init(t){const i=A(t.options.color,t.id,t.options.reduceDuplicates);i&&(t.color=G(i,t.options.color.animation,this.container.retina.reduceFactor))}isEnabled(t){var i,e,s;const o=t.options.color.animation;return!t.destroyed&&!t.spawning&&(void 0!==(null===(i=t.color)||void 0===i?void 0:i.h.value)&&o.h.enable||void 0!==(null===(e=t.color)||void 0===e?void 0:e.s.value)&&o.s.enable||void 0!==(null===(s=t.color)||void 0===s?void 0:s.l.value)&&o.l.enable)}update(t,i){!function(t,i){var e,s,o;const n=t.options.color.animation,a=null===(e=t.color)||void 0===e?void 0:e.h,r=null===(s=t.color)||void 0===s?void 0:s.s,l=null===(o=t.color)||void 0===o?void 0:o.l;a&&Ii(i,a,n.h,360,!1),r&&Ii(i,r,n.s,100,!0),l&&Ii(i,l,n.l,100,!0)}(t,i)}}class Di{load(t){t&&(void 0!==t.bottom&&(this.bottom=d(t.bottom)),void 0!==t.left&&(this.left=d(t.left)),void 0!==t.right&&(this.right=d(t.right)),void 0!==t.top&&(this.top=d(t.top)))}}class Ti extends Ot{constructor(){super(),this.value=3}}class Ri extends Ot{constructor(){super(),this.value={min:4,max:9}}}class Li{constructor(){this.count=1,this.factor=new Ti,this.rate=new Ri,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=P(t.particles,(t=>C({},t))),void 0!==t.sizeOffset&&(this.sizeOffset=t.sizeOffset))}}class Ai{constructor(){this.bounds=new Di,this.mode="none",this.split=new Li}load(t){t&&(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}class Vi{constructor(t,i){this.engine=t,this.container=i}init(t){const i=this.container,e=t.options.destroy;if(!e)return;t.splitCount=0;const s=e.bounds;t.destroyBounds||(t.destroyBounds={}),s.bottom&&(t.destroyBounds.bottom=l(s.bottom)*i.canvas.size.height/100),s.left&&(t.destroyBounds.left=l(s.left)*i.canvas.size.width/100),s.right&&(t.destroyBounds.right=l(s.right)*i.canvas.size.width/100),s.top&&(t.destroyBounds.top=l(s.top)*i.canvas.size.height/100)}isEnabled(t){return!t.destroyed}loadOptions(t,...i){t.destroy||(t.destroy=new Ai);for(const e of i)t.destroy.load(null==e?void 0:e.destroy)}particleDestroyed(t,i){if(i)return;const e=t.options.destroy;e&&"split"===e.mode&&this.split(t)}update(t){if(!this.isEnabled(t))return;const i=t.getPosition(),e=t.destroyBounds;e&&(void 0!==e.bottom&&i.y>=e.bottom||void 0!==e.left&&i.x<=e.left||void 0!==e.right&&i.x>=e.right||void 0!==e.top&&i.y<=e.top)&&t.destroy()}addSplitParticle(t,i){const e=t.options.destroy;if(!e)return;const s=e.split,o=si(this.engine,this.container,t.options),n=u(s.factor);o.color.load({value:{hsl:t.getFillColor()}}),o.move.load({center:{x:t.position.x,y:t.position.y,mode:"precise"}}),"number"==typeof o.size.value?o.size.value/=n:(o.size.value.min/=n,o.size.value.max/=n),o.load(i);const a=s.sizeOffset?d(-t.size.value,t.size.value):0,l={x:t.position.x+r(a),y:t.position.y+r(a)};return this.container.particles.addParticle(l,o,t.group,(i=>{var e;return!(i.size.value<.5)&&(i.velocity.length=r(d(t.velocity.length,i.velocity.length)),i.splitCount=(null!==(e=t.splitCount)&&void 0!==e?e:0)+1,i.unbreakable=!0,setTimeout((()=>{i.unbreakable=!1}),500),!0)}))}split(t){const i=t.options.destroy;if(!i)return;const e=i.split;if(e.count>=0&&(void 0===t.splitCount||t.splitCount++>e.count))return;const s=u(e.rate),o=k(e.particles);for(let i=0;i<s;i++)this.addSplitParticle(t,o)}}class Fi{randomPosition(t,i,e){const[s,o]=[i.width/2,i.height/2],a=((t,i)=>{const e=n()/4,s=Math.atan(i/t*Math.tan(2*Math.PI*e)),o=n();return o<.25?s:o<.5?Math.PI-s:o<.75?Math.PI+s:-s})(s,o),r=(d=a,(c=s)*(h=o)/Math.sqrt((h*Math.cos(d))**2+(c*Math.sin(d))**2)),l=e?r*Math.sqrt(n()):r;var c,h,d;return{x:t.x+l*Math.cos(a),y:t.y+l*Math.sin(a)}}}class Bi{constructor(){this.wait=!1}load(t){void 0!==t&&(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=t.delay),void 0!==t.duration&&(this.duration=t.duration),void 0!==t.wait&&(this.wait=t.wait))}}class Ui{constructor(){this.quantity=1,this.delay=.1}load(t){void 0!==t&&(void 0!==t.quantity&&(this.quantity=d(t.quantity)),void 0!==t.delay&&(this.delay=d(t.delay)))}}class qi{constructor(){this.mode="percent",this.height=0,this.width=0}load(t){void 0!==t&&(void 0!==t.mode&&(this.mode=t.mode),void 0!==t.height&&(this.height=t.height),void 0!==t.width&&(this.width=t.width))}}class Wi{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new Bi,this.rate=new Ui,this.shape="square",this.startCount=0}load(t){void 0!==t&&(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(void 0===this.size&&(this.size=new qi),this.size.load(t.size)),void 0!==t.direction&&(this.direction=t.direction),this.domId=t.domId,void 0!==t.fill&&(this.fill=t.fill),this.life.load(t.life),this.name=t.name,this.particles=P(t.particles,(t=>C({},t))),this.rate.load(t.rate),void 0!==t.shape&&(this.shape=t.shape),void 0!==t.position&&(this.position={},void 0!==t.position.x&&(this.position.x=d(t.position.x)),void 0!==t.position.y&&(this.position.y=d(t.position.y))),void 0!==t.spawnColor&&(void 0===this.spawnColor&&(this.spawnColor=new zt),this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}class ji{constructor(t,i,e,s,o){var n,a,r,l,c,h,d,u;this.emitters=i,this.container=e,this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=o,s instanceof Wi?this.options=s:(this.options=new Wi,this.options.load(s)),this._spawnDelay=1e3*(null!==(n=this.options.life.delay)&&void 0!==n?n:0)/this.container.retina.reduceFactor,this.position=null!==(a=this._initialPosition)&&void 0!==a?a:this.calcPosition(),this.name=this.options.name,this._shape=null===(r=this._engine.emitterShapeManager)||void 0===r?void 0:r.getShape(this.options.shape),this.fill=this.options.fill,this._firstSpawn=!this.options.life.wait,this._startParticlesAdded=!1;let p=C({},this.options.particles);null!=p||(p={}),null!==(l=p.move)&&void 0!==l||(p.move={}),null!==(c=(u=p.move).direction)&&void 0!==c||(u.direction=this.options.direction),this.options.spawnColor&&(this.spawnColor=A(this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=p,this.size=null!==(h=this.options.size)&&void 0!==h?h:(()=>{const t=new qi;return t.load({height:0,mode:"percent",width:0}),t})(),this._lifeCount=null!==(d=this.options.life.count)&&void 0!==d?d:-1,this._immortal=this._lifeCount<=0,this._engine.dispatchEvent("emitterCreated",{container:e,data:{emitter:this}}),this.play()}externalPause(){this._paused=!0,this.pause()}externalPlay(){this._paused=!1,this.play()}getPosition(){if(this.options.domId){const t=this.container,i=document.getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect();return{x:(e.x+e.width/2)*t.retina.pixelRatio,y:(e.y+e.height/2)*t.retina.pixelRatio}}}return this.position}getSize(){const t=this.container;if(this.options.domId){const i=document.getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect();return{width:e.width*t.retina.pixelRatio,height:e.height*t.retina.pixelRatio}}}return{width:"percent"===this.size.mode?t.canvas.size.width*this.size.width/100:this.size.width,height:"percent"===this.size.mode?t.canvas.size.height*this.size.height/100:this.size.height}}pause(){this._paused||delete this._emitDelay}play(){var t;if(!this._paused&&this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal||!this.options.life.count)&&(this._firstSpawn||this._currentSpawnDelay>=(null!==(t=this._spawnDelay)&&void 0!==t?t:0))){if(void 0===this._emitDelay){const t=l(this.options.rate.delay);this._emitDelay=1e3*t/this.container.retina.reduceFactor}(this._lifeCount>0||this._immortal)&&this.prepareToDie()}}resize(){const t=this._initialPosition;this.position=t&&z(t,this.container.canvas.size,s.origin)?t:this.calcPosition()}update(t){var i,e,s;this._paused||(this._firstSpawn&&(this._firstSpawn=!1,this._currentSpawnDelay=null!==(i=this._spawnDelay)&&void 0!==i?i:0,this._currentEmitDelay=null!==(e=this._emitDelay)&&void 0!==e?e:0),this._startParticlesAdded||(this._startParticlesAdded=!0,this.emitParticles(this.options.startCount)),void 0!==this._duration&&(this._currentDuration+=t.value,this._currentDuration>=this._duration&&(this.pause(),void 0!==this._spawnDelay&&delete this._spawnDelay,this._immortal||this._lifeCount--,this._lifeCount>0||this._immortal?(this.position=this.calcPosition(),this._spawnDelay=1e3*(null!==(s=this.options.life.delay)&&void 0!==s?s:0)/this.container.retina.reduceFactor):this.destroy(),this._currentDuration-=this._duration,delete this._duration)),void 0!==this._spawnDelay&&(this._currentSpawnDelay+=t.value,this._currentSpawnDelay>=this._spawnDelay&&(this._engine.dispatchEvent("emitterPlay",{container:this.container}),this.play(),this._currentSpawnDelay-=this._currentSpawnDelay,delete this._spawnDelay)),void 0!==this._emitDelay&&(this._currentEmitDelay+=t.value,this._currentEmitDelay>=this._emitDelay&&(this.emit(),this._currentEmitDelay-=this._emitDelay)))}calcPosition(){return m({size:this.container.canvas.size,position:this.options.position})}destroy(){this.emitters.removeEmitter(this),this._engine.dispatchEvent("emitterDestroyed",{container:this.container,data:{emitter:this}})}emit(){if(this._paused)return;const t=l(this.options.rate.quantity);this.emitParticles(t)}emitParticles(t){var i,e,s;const o=this.getPosition(),n=this.getSize(),a=k(this._particlesOptions);for(let r=0;r<t;r++){const t=C({},a);if(this.spawnColor){const e=null===(i=this.options.spawnColor)||void 0===i?void 0:i.animation;e&&(this.spawnColor.h=this.setColorAnimation(e.h,this.spawnColor.h,360),this.spawnColor.s=this.setColorAnimation(e.s,this.spawnColor.s,100),this.spawnColor.l=this.setColorAnimation(e.l,this.spawnColor.l,100)),t.color?t.color.value=this.spawnColor:t.color={value:this.spawnColor}}if(!o)return;const r=null!==(s=null===(e=this._shape)||void 0===e?void 0:e.randomPosition(o,n,this.fill))&&void 0!==s?s:o;this.container.particles.addParticle(r,t)}}prepareToDie(){var t;if(this._paused)return;const i=null===(t=this.options.life)||void 0===t?void 0:t.duration;this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal)&&void 0!==i&&i>0&&(this._duration=1e3*i)}setColorAnimation(t,i,e){var s;const o=this.container;if(!t.enable)return i;const n=r(t.offset),a=1e3*l(this.options.rate.delay)/o.retina.reduceFactor;return(i+l(null!==(s=t.speed)&&void 0!==s?s:0)*o.fpsLimit/a+3.6*n)%e}}class Gi{constructor(t,i){this.container=i,this._engine=t,this.array=[],this.emitters=[],this.interactivityEmitters={random:{count:1,enable:!1},value:[]},i.getEmitter=t=>void 0===t||"number"==typeof t?this.array[t||0]:this.array.find((i=>i.name===t)),i.addEmitter=(t,i)=>this.addEmitter(t,i),i.removeEmitter=t=>{const e=i.getEmitter(t);e&&this.removeEmitter(e)},i.playEmitter=t=>{const e=i.getEmitter(t);e&&e.externalPlay()},i.pauseEmitter=t=>{const e=i.getEmitter(t);e&&e.externalPause()}}addEmitter(t,i){const e=new Wi;e.load(t);const s=new ji(this._engine,this,this.container,e,i);return this.array.push(s),s}handleClickMode(t){const i=this.emitters,e=this.interactivityEmitters;if("emitter"===t){let t;if(e&&e.value instanceof Array)if(e.value.length>0&&e.random.enable){t=[];const i=[];for(let s=0;s<e.random.count;s++){const o=_(e.value);i.includes(o)&&i.length<e.value.length?s--:(i.push(o),t.push(x(e.value,o)))}}else t=e.value;else t=null==e?void 0:e.value;const s=null!=t?t:i,o=this.container.interactivity.mouse.clickPosition;P(s,(t=>{this.addEmitter(t,o)}))}}async init(){if(this.emitters=this.container.actualOptions.emitters,this.interactivityEmitters=this.container.actualOptions.interactivity.modes.emitters,this.emitters instanceof Array)for(const t of this.emitters)this.addEmitter(t);else this.addEmitter(this.emitters)}pause(){for(const t of this.array)t.pause()}play(){for(const t of this.array)t.play()}removeEmitter(t){const i=this.array.indexOf(t);i>=0&&this.array.splice(i,1)}resize(){for(const t of this.array)t.resize()}stop(){this.array=[]}update(t){for(const i of this.array)i.update(t)}}const Hi=new Map;class Ni{constructor(t){this._engine=t}addShape(t,i){this.getShape(t)||Hi.set(t,i)}getShape(t){return Hi.get(t)}getSupportedShapes(){return Hi.keys()}}function $i(t,i){return t+i*(n()-.5)}class Xi{randomPosition(t,i,e){if(e)return{x:$i(t.x,i.width),y:$i(t.y,i.height)};{const e=i.width/2,s=i.height/2,o=Math.floor(4*n()),a=2*(n()-.5);switch(o){case 0:return{x:t.x+a*e,y:t.y-s};case 1:return{x:t.x-e,y:t.y+a*s};case 2:return{x:t.x+a*e,y:t.y+s};default:return{x:t.x+e,y:t.y+a*s}}}}}class Yi{constructor(t){this._engine=t,this.id="emitters"}getPlugin(t){return new Gi(this._engine,t)}loadOptions(t,i){var e,s,o,n,a,r;if(!this.needsPlugin(t)&&!this.needsPlugin(i))return;(null==i?void 0:i.emitters)&&(t.emitters=P(i.emitters,(t=>{const i=new Wi;return i.load(t),i})));const l=null===(s=null===(e=null==i?void 0:i.interactivity)||void 0===e?void 0:e.modes)||void 0===s?void 0:s.emitters;if(l)if(l instanceof Array)t.interactivity.modes.emitters={random:{count:1,enable:!0},value:l.map((t=>{const i=new Wi;return i.load(t),i}))};else{const i=l;if(void 0!==i.value)if(i.value instanceof Array)t.interactivity.modes.emitters={random:{count:null!==(o=i.random.count)&&void 0!==o?o:1,enable:null!==(n=i.random.enable)&&void 0!==n&&n},value:i.value.map((t=>{const i=new Wi;return i.load(t),i}))};else{const e=new Wi;e.load(i.value),t.interactivity.modes.emitters={random:{count:null!==(a=i.random.count)&&void 0!==a?a:1,enable:null!==(r=i.random.enable)&&void 0!==r&&r},value:e}}else{(t.interactivity.modes.emitters={random:{count:1,enable:!1},value:new Wi}).value.load(l)}}}needsPlugin(t){var i,e,s;if(!t)return!1;const o=t.emitters;return o instanceof Array&&!!o.length||void 0!==o||!!(null===(s=null===(e=null===(i=t.interactivity)||void 0===i?void 0:i.events)||void 0===e?void 0:e.onClick)||void 0===s?void 0:s.mode)&&b("emitter",t.interactivity.events.onClick.mode)}}class Zi extends Ot{constructor(){super(),this.sync=!1}load(t){t&&(super.load(t),void 0!==t.sync&&(this.sync=t.sync))}}class Qi extends Ot{constructor(){super(),this.random.minimumValue=1e-4,this.sync=!1}load(t){t&&(super.load(t),void 0!==t.sync&&(this.sync=t.sync))}}class Ji{constructor(){this.count=0,this.delay=new Zi,this.duration=new Qi}load(t){t&&(void 0!==t.count&&(this.count=t.count),this.delay.load(t.delay),this.duration.load(t.duration))}}class Ki{constructor(t){this.container=t}init(t){const i=this.container,e=t.options.life;e&&(t.life={delay:i.retina.reduceFactor?l(e.delay.value)*(e.delay.sync?1:n())/i.retina.reduceFactor*1e3:0,delayTime:0,duration:i.retina.reduceFactor?l(e.duration.value)*(e.duration.sync?1:n())/i.retina.reduceFactor*1e3:0,time:0,count:e.count},t.life.duration<=0&&(t.life.duration=-1),t.life.count<=0&&(t.life.count=-1),t.life&&(t.spawning=t.life.delay>0))}isEnabled(t){return!t.destroyed}loadOptions(t,...i){t.life||(t.life=new Ji);for(const e of i)t.life.load(null==e?void 0:e.life)}update(t,i){if(!this.isEnabled(t)||!t.life)return;const e=t.life;let s=!1;if(t.spawning){if(e.delayTime+=i.value,!(e.delayTime>=t.life.delay))return;s=!0,t.spawning=!1,e.delayTime=0,e.time=0}if(-1===e.duration)return;if(t.spawning)return;if(s?e.time=0:e.time+=i.value,e.time<e.duration)return;if(e.time=0,t.life.count>0&&t.life.count--,0===t.life.count)return void t.destroy();const o=this.container.canvas.size,n=d(0,o.width),a=d(0,o.width);t.position.x=r(n),t.position.y=r(a),t.spawning=!0,e.delayTime=0,e.time=0,t.reset();const c=t.options.life;c&&(e.delay=1e3*l(c.delay.value),e.duration=1e3*l(c.duration.value))}}class te{draw(t,i,e){t.moveTo(-e/2,0),t.lineTo(e/2,0)}getSidesCount(){return 1}}class ie{constructor(t){this.container=t}init(t){const i=t.options.opacity;t.opacity=S(i,1);const e=i.animation;e.enable&&(t.opacity.velocity=l(e.speed)/100*this.container.retina.reduceFactor,e.sync||(t.opacity.velocity*=n()))}isEnabled(t){var i,e,s,o;return!t.destroyed&&!t.spawning&&!!t.opacity&&t.opacity.enable&&((null!==(i=t.opacity.maxLoops)&&void 0!==i?i:0)<=0||(null!==(e=t.opacity.maxLoops)&&void 0!==e?e:0)>0&&(null!==(s=t.opacity.loops)&&void 0!==s?s:0)<(null!==(o=t.opacity.maxLoops)&&void 0!==o?o:0))}reset(t){t.opacity&&(t.opacity.loops=0)}update(t,i){this.isEnabled(t)&&function(t,i){var e,s,o,n,r,l;if(!t.opacity)return;const c=t.opacity.min,h=t.opacity.max,d=null!==(e=t.opacity.decay)&&void 0!==e?e:1;if(!(t.destroyed||!t.opacity.enable||(null!==(s=t.opacity.maxLoops)&&void 0!==s?s:0)>0&&(null!==(o=t.opacity.loops)&&void 0!==o?o:0)>(null!==(n=t.opacity.maxLoops)&&void 0!==n?n:0))){switch(t.opacity.status){case"increasing":t.opacity.value>=h?(t.opacity.status="decreasing",t.opacity.loops||(t.opacity.loops=0),t.opacity.loops++):t.opacity.value+=(null!==(r=t.opacity.velocity)&&void 0!==r?r:0)*i.factor;break;case"decreasing":t.opacity.value<=c?(t.opacity.status="increasing",t.opacity.loops||(t.opacity.loops=0),t.opacity.loops++):t.opacity.value-=(null!==(l=t.opacity.velocity)&&void 0!==l?l:0)*i.factor}t.opacity.velocity&&1!==t.opacity.decay&&(t.opacity.velocity*=d),function(t,i,e,s){switch(t.options.opacity.animation.destroy){case"max":i>=s&&t.destroy();break;case"min":i<=e&&t.destroy()}}(t,t.opacity.value,c,h),t.destroyed||(t.opacity.value=a(t.opacity.value,c,h))}}(t,i)}}class ee{constructor(t){this.container=t,this.modes=["bounce","bounce-vertical","bounce-horizontal","bounceVertical","bounceHorizontal","split"]}update(t,i,e,s){if(!this.modes.includes(s))return;const o=this.container;let n=!1;for(const[,s]of o.plugins)if(void 0!==s.particleBounce&&(n=s.particleBounce(t,e,i)),n)break;if(n)return;const a=t.getPosition(),r=t.offset,l=t.getRadius(),c=M(a,l),h=o.canvas.size;!function(t){if("bounce"!==t.outMode&&"bounce-horizontal"!==t.outMode&&"bounceHorizontal"!==t.outMode&&"split"!==t.outMode)return;t.bounds.right<0?t.particle.position.x=t.size+t.offset.x:t.bounds.left>t.canvasSize.width&&(t.particle.position.x=t.canvasSize.width-t.size-t.offset.x);const i=t.particle.velocity.x;let e=!1;if("right"===t.direction&&t.bounds.right>=t.canvasSize.width&&i>0||"left"===t.direction&&t.bounds.left<=0&&i<0){const i=u(t.particle.options.bounce.horizontal);t.particle.velocity.x*=-i,e=!0}if(!e)return;const s=t.offset.x+t.size;t.bounds.right>=t.canvasSize.width?t.particle.position.x=t.canvasSize.width-s:t.bounds.left<=0&&(t.particle.position.x=s),"split"===t.outMode&&t.particle.destroy()}({particle:t,outMode:s,direction:i,bounds:c,canvasSize:h,offset:r,size:l}),function(t){if("bounce"!==t.outMode&&"bounce-vertical"!==t.outMode&&"bounceVertical"!==t.outMode&&"split"!==t.outMode)return;t.bounds.bottom<0?t.particle.position.y=t.size+t.offset.y:t.bounds.top>t.canvasSize.height&&(t.particle.position.y=t.canvasSize.height-t.size-t.offset.y);const i=t.particle.velocity.y;let e=!1;if("bottom"===t.direction&&t.bounds.bottom>=t.canvasSize.height&&i>0||"top"===t.direction&&t.bounds.top<=0&&i<0){const i=u(t.particle.options.bounce.vertical);t.particle.velocity.y*=-i,e=!0}if(!e)return;const s=t.offset.y+t.size;t.bounds.bottom>=t.canvasSize.height?t.particle.position.y=t.canvasSize.height-s:t.bounds.top<=0&&(t.particle.position.y=s),"split"===t.outMode&&t.particle.destroy()}({particle:t,outMode:s,direction:i,bounds:c,canvasSize:h,offset:r,size:l})}}class se{constructor(t){this.container=t,this.modes=["destroy"]}update(t,i,e,o){if(!this.modes.includes(o))return;const n=this.container;switch(t.outType){case"normal":case"outside":if(z(t.position,n.canvas.size,s.origin,t.getRadius(),i))return;break;case"inside":{const{dx:i,dy:e}=p(t.position,t.moveCenter),{x:s,y:o}=t.velocity;if(s<0&&i>t.moveCenter.radius||o<0&&e>t.moveCenter.radius||s>=0&&i<-t.moveCenter.radius||o>=0&&e<-t.moveCenter.radius)return;break}}n.particles.remove(t,void 0,!0)}}class oe{constructor(t){this.container=t,this.modes=["none"]}update(t,i,e,o){if(!this.modes.includes(o))return;if(t.options.move.distance.horizontal&&("left"===i||"right"===i)||t.options.move.distance.vertical&&("top"===i||"bottom"===i))return;const n=t.options.move.gravity,a=this.container,r=a.canvas.size,l=t.getRadius();if(n.enable){const e=t.position;(!n.inverse&&e.y>r.height+l&&"bottom"===i||n.inverse&&e.y<-l&&"top"===i)&&a.particles.remove(t)}else{if(t.velocity.y>0&&t.position.y<=r.height+l||t.velocity.y<0&&t.position.y>=-l||t.velocity.x>0&&t.position.x<=r.width+l||t.velocity.x<0&&t.position.x>=-l)return;z(t.position,a.canvas.size,s.origin,l,i)||a.particles.remove(t)}}}class ne{constructor(t){this.container=t,this.modes=["out"]}update(t,i,e,o){if(!this.modes.includes(o))return;const a=this.container;switch(t.outType){case"inside":{const{x:i,y:e}=t.velocity,o=s.origin;o.length=t.moveCenter.radius,o.angle=t.velocity.angle+Math.PI,o.addTo(s.create(t.moveCenter));const{dx:n,dy:l}=p(t.position,o);if(i<=0&&n>=0||e<=0&&l>=0||i>=0&&n<=0||e>=0&&l<=0)return;t.position.x=Math.floor(r({min:0,max:a.canvas.size.width})),t.position.y=Math.floor(r({min:0,max:a.canvas.size.height}));const{dx:c,dy:h}=p(t.position,t.moveCenter);t.direction=Math.atan2(-h,-c),t.velocity.angle=t.direction;break}default:if(z(t.position,a.canvas.size,s.origin,t.getRadius(),i))return;switch(t.outType){case"outside":{t.position.x=Math.floor(r({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.x,t.position.y=Math.floor(r({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.y;const{dx:i,dy:e}=p(t.position,t.moveCenter);t.moveCenter.radius&&(t.direction=Math.atan2(e,i),t.velocity.angle=t.direction);break}case"normal":{const e=t.options.move.warp,s=a.canvas.size,o={bottom:s.height+t.getRadius()+t.offset.y,left:-t.getRadius()-t.offset.x,right:s.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},r=t.getRadius(),l=M(t.position,r);"right"===i&&l.left>s.width+t.offset.x?(t.position.x=o.left,t.initialPosition.x=t.position.x,e||(t.position.y=n()*s.height,t.initialPosition.y=t.position.y)):"left"===i&&l.right<-t.offset.x&&(t.position.x=o.right,t.initialPosition.x=t.position.x,e||(t.position.y=n()*s.height,t.initialPosition.y=t.position.y)),"bottom"===i&&l.top>s.height+t.offset.y?(e||(t.position.x=n()*s.width,t.initialPosition.x=t.position.x),t.position.y=o.top,t.initialPosition.y=t.position.y):"top"===i&&l.bottom<-t.offset.y&&(e||(t.position.x=n()*s.width,t.initialPosition.x=t.position.x),t.position.y=o.bottom,t.initialPosition.y=t.position.y);break}}}}}class ae{constructor(t){this.container=t,this.updaters=[new ee(t),new se(t),new ne(t),new oe(t)]}init(){}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,i){var e,s,o,n;const a=t.options.move.outModes;this.updateOutMode(t,i,null!==(e=a.bottom)&&void 0!==e?e:a.default,"bottom"),this.updateOutMode(t,i,null!==(s=a.left)&&void 0!==s?s:a.default,"left"),this.updateOutMode(t,i,null!==(o=a.right)&&void 0!==o?o:a.default,"right"),this.updateOutMode(t,i,null!==(n=a.top)&&void 0!==n?n:a.default,"top")}updateOutMode(t,i,e,s){for(const o of this.updaters)o.update(t,s,i,e)}}class re{init(t){var i;const e=t.container,s=t.options.size.animation;s.enable&&(t.size.velocity=(null!==(i=t.retina.sizeAnimationSpeed)&&void 0!==i?i:e.retina.sizeAnimationSpeed)/100*e.retina.reduceFactor,s.sync||(t.size.velocity*=n()))}isEnabled(t){var i,e,s,o;return!t.destroyed&&!t.spawning&&t.size.enable&&((null!==(i=t.size.maxLoops)&&void 0!==i?i:0)<=0||(null!==(e=t.size.maxLoops)&&void 0!==e?e:0)>0&&(null!==(s=t.size.loops)&&void 0!==s?s:0)<(null!==(o=t.size.maxLoops)&&void 0!==o?o:0))}reset(t){t.size.loops=0}update(t,i){this.isEnabled(t)&&function(t,i){var e,s,o,n,r;const l=(null!==(e=t.size.velocity)&&void 0!==e?e:0)*i.factor,c=t.size.min,h=t.size.max,d=null!==(s=t.size.decay)&&void 0!==s?s:1;if(!(t.destroyed||!t.size.enable||(null!==(o=t.size.maxLoops)&&void 0!==o?o:0)>0&&(null!==(n=t.size.loops)&&void 0!==n?n:0)>(null!==(r=t.size.maxLoops)&&void 0!==r?r:0))){switch(t.size.status){case"increasing":t.size.value>=h?(t.size.status="decreasing",t.size.loops||(t.size.loops=0),t.size.loops++):t.size.value+=l;break;case"decreasing":t.size.value<=c?(t.size.status="increasing",t.size.loops||(t.size.loops=0),t.size.loops++):t.size.value-=l}t.size.velocity&&1!==d&&(t.size.velocity*=d),function(t,i,e,s){switch(t.options.size.animation.destroy){case"max":i>=s&&t.destroy();break;case"min":i<=e&&t.destroy()}}(t,t.size.value,c,h),t.destroyed||(t.size.value=a(t.size.value,c,h))}}(t,i)}}class le{constructor(){this.loop=!1,this.source=""}load(t){void 0!==t&&("object"==typeof t?(void 0!==t.loop&&(this.loop=t.loop),void 0!==t.source&&(this.source=t.source)):this.source=t)}}class ce{constructor(){this.duration=500,this.value=[]}load(t){t&&(void 0!==t.duration&&(this.duration=t.duration),void 0!==t.value&&(this.value=t.value))}}class he{constructor(){this.loop=!1,this.melodies=[],this.notes=[]}load(t){void 0!==t&&(void 0!==t.loop&&(this.loop=t.loop),void 0!==t.melodies&&(this.melodies=t.melodies.map((t=>{const i=new he;return i.load(t),i}))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const i=new ce;return i.load(t),i}))))}}class de{constructor(){this.event=[],this.notes=[]}load(t){t&&(void 0!==t.event&&(this.event=t.event),void 0!==t.audio&&(t.audio instanceof Array?this.audio=t.audio.map((t=>{const i=new le;return i.load(t),i})):(this.audio=new le,this.audio.load(t.audio))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const i=new ce;return i.load(t),i}))),void 0!==t.melodies&&(this.melodies=t.melodies.map((t=>{const i=new he;return i.load(t),i}))),void 0!==t.filter&&("string"==typeof t.filter?"function"==typeof window[t.filter]&&(this.filter=window[t.filter]):this.filter=t.filter))}}class ue{constructor(){this.width=24,this.height=24}load(t){t&&(void 0!==t.path&&(this.path=t.path),void 0!==t.svg&&(this.svg=t.svg),void 0!==t.width&&(this.width=t.width),void 0!==t.height&&(this.height=t.height))}}class pe{constructor(){this.mute=new ue,this.unmute=new ue,this.volumeDown=new ue,this.volumeUp=new ue,this.mute.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M19.707,5.293c-0.391-0.391-1.023-0.391-1.414,0l-1.551,1.551c-0.345-0.688-0.987-1.02-1.604-1.02c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.237,0.754,2.302,1.826,2.76l-1.533,1.533c-0.391,0.391-0.391,1.023,0,1.414C5.488,19.902,5.744,20,6,20s0.512-0.098,0.707-0.293l2.527-2.527c0.697,0.174,1.416,0.455,1.875,0.762l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V9.414l2.707-2.707C20.098,6.316,20.098,5.684,19.707,5.293z M14.891,7.941c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8v1.293l-2,2V9.202L14.891,7.941z M7,12c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v2.439l-2.83,2.83C8.757,15.046,8.356,15,8,15c-0.552,0-1-0.448-1-1V12z M10.301,15.406L12,13.707v2.439C11.519,15.859,10.925,15.604,10.301,15.406z M14.994,18.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798v-4.091l2-2V18C15,18.046,14.998,18.086,14.994,18.12z"/>\n </g>\n</svg>',this.unmute.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M17.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C12.357,8.561,10.904,9,10,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C18.035,20.176,19,19.495,19,18V8C19,6.505,18.035,5.824,17.138,5.824z M14,16.146C12.907,15.495,11.211,15,10,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146V16.146z M17,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L15,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C16.998,7.914,17,7.954,17,8V18z"/>\n </g>\n</svg>',this.volumeDown.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M15.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V8C17,6.505,16.035,5.824,15.138,5.824z M8,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C10.907,15.495,9.211,15,8,15z M15,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8V18z"/>\n <path fill="#fff" d="M18.292,10.294c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C18.488,15.902,18.744,16,19,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708s-0.398-1.984-1.123-2.707C19.317,9.903,18.683,9.901,18.292,10.294z"/>\n </g>\n</svg>',this.volumeUp.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M16.706,10.292c-0.389-0.389-1.023-0.391-1.414,0.002c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C15.488,15.902,15.744,16,16,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708S17.431,11.015,16.706,10.292z"/>\n <path fill="#fff" d="M18.706,8.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c0.879,0.877,1.363,2.044,1.364,3.287c0.001,1.246-0.484,2.417-1.365,3.298c-0.391,0.391-0.391,1.023,0,1.414C17.488,17.902,17.744,18,18,18s0.512-0.098,0.707-0.293c1.259-1.259,1.952-2.933,1.951-4.713C20.657,11.217,19.964,9.547,18.706,8.292z"/>\n <path fill="#fff" d="M20.706,6.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c1.412,1.409,2.191,3.285,2.192,5.284c0.002,2.002-0.777,3.885-2.193,5.301c-0.391,0.391-0.391,1.023,0,1.414C19.488,19.902,19.744,20,20,20s0.512-0.098,0.707-0.293c1.794-1.794,2.781-4.18,2.779-6.717C23.485,10.457,22.497,8.078,20.706,6.292z"/>\n <path fill="#fff" d="M12.138,5.824c-0.449,0-0.905,0.152-1.356,0.453L8.109,8.059C7.357,8.561,5.904,9,5,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C13.035,20.176,14,19.495,14,18V8C14,6.505,13.035,5.824,12.138,5.824z M5,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C7.907,15.495,6.211,15,5,15z M12,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L10,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C11.998,7.914,12,7.954,12,8V18z"/>\n </g>\n</svg>'}load(t){t&&(this.mute.load(t.mute),this.unmute.load(t.unmute),this.volumeDown.load(t.volumeDown),this.volumeUp.load(t.volumeUp))}}class ve{constructor(){this.value=100,this.max=100,this.min=0,this.step=10}load(t){void 0!==t&&("object"==typeof t?(void 0!==t.max&&(this.max=t.max),void 0!==t.min&&(this.min=t.min),void 0!==t.step&&(this.step=t.step),void 0!==t.value&&(this.value=t.value)):this.value=t)}}class me{constructor(){this.enable=!1,this.events=[],this.icons=new pe,this.volume=new ve}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.events&&(this.events=t.events.map((t=>{const i=new de;return i.load(t),i}))),this.icons.load(t.icons),void 0!==t.volume&&this.volume.load(t.volume))}}const fe=new Map;function ye(t){const i=/(([A-G]b?)(\d))|pause/i.exec(t);if(!i||!i.length)return;console.log(i);const e=i[2]||i[0],s=fe.get(e);return s?s[parseInt(i[3]||"0")]:void 0}function ge(t,i,e,s,o,n,a){t.style.userSelect="none",t.style.webkitUserSelect="none",t.style.position="absolute",t.style.top=`${i+a}px`,t.style.left=e-a-n+"px",t.style.display=s,t.style.zIndex=`${o+1}`}fe.set("C",[16.35,32.7,65.41,130.81,261.63,523.25,1046.5,2093,4186.01]),fe.set("Db",[17.32,34.65,69.3,138.59,277.18,554.37,1108.73,2217.46,4434.92]),fe.set("D",[18.35,36.71,73.42,146.83,293.66,587.33,1174.66,2349.32,4698.63]),fe.set("Eb",[19.45,38.89,77.78,155.56,311.13,622.25,1244.51,2489.02,4978.03]),fe.set("E",[20.6,41.2,82.41,164.81,329.63,659.25,1318.51,2637.02,5274.04]),fe.set("F",[21.83,43.65,87.31,174.61,349.23,698.46,1396.91,2793.83,5587.65]),fe.set("Gb",[23.12,46.25,92.5,185,369.99,739.99,1479.98,2959.96,5919.91]),fe.set("G",[24.5,49,98,196,392,783.99,1567.98,3135.96,6271.93]),fe.set("Ab",[25.96,51.91,103.83,207.65,415.3,830.61,1661.22,3322.44,6644.88]),fe.set("A",[27.5,55,110,220,440,880,1760,3520,7040]),fe.set("Bb",[29.14,58.27,116.54,233.08,466.16,932.33,1864.66,3729.31,7458.62]),fe.set("B",[30.87,61.74,123.47,246.94,493.88,987.77,1975.53,3951.07,7902.13]),fe.set("pause",[0]);class we{constructor(t,i){this._container=t,this._engine=i,this._volume=0,this._audioSources=[],this._audioMap=new Map}async init(){const t=this._container,i=t.actualOptions.sounds;if(!(null==i?void 0:i.enable))return;this._volume=i.volume.value;const e=i.events;this._audioMap=new Map;for(const i of e)i.audio&&P(i.audio,(async i=>{const e=await fetch(i.source);if(!e.ok)return;const s=await e.arrayBuffer();t.audioContext=new AudioContext;const o=await t.audioContext.decodeAudioData(s);this._audioMap.set(i.source,o)}))}async start(){var t,i,e,s;const o=this._container,n=o.actualOptions,a=n.sounds;if(!(null==a?void 0:a.enable)||!o.canvas.element)return;o.muted=!0,this._muteImg=document.createElement("img"),this._unmuteImg=document.createElement("img"),this._volumeDownImg=document.createElement("img"),this._volumeUpImg=document.createElement("img");const r=this._muteImg,l=this._unmuteImg,c=this._volumeDownImg,h=this._volumeUpImg,d=o.canvas.element.offsetTop,u=o.canvas.element.offsetLeft+o.canvas.element.offsetWidth,p=a.icons,v=p.mute,m=p.unmute,f=p.volumeDown,y=p.volumeUp,g=10;ge(r,d+g,u-30-v.width-f.width-y.width,"block",n.fullScreen.zIndex+1,v.width,g),ge(l,d+g,u-30-m.width-f.width-y.width,"none",n.fullScreen.zIndex+1,m.width,g),ge(c,d+g,u-20-f.width-y.width,"block",n.fullScreen.zIndex+1,f.width,g),ge(h,d+g,u-g-y.width,"block",n.fullScreen.zIndex+1,y.width,g),r.src=null!==(t=v.path)&&void 0!==t?t:v.svg?`data:image/svg+xml;base64,${btoa(v.svg)}`:"",l.src=null!==(i=m.path)&&void 0!==i?i:m.svg?`data:image/svg+xml;base64,${btoa(m.svg)}`:"",c.src=null!==(e=f.path)&&void 0!==e?e:f.svg?`data:image/svg+xml;base64,${btoa(f.svg)}`:"",h.src=null!==(s=y.path)&&void 0!==s?s:y.svg?`data:image/svg+xml;base64,${btoa(y.svg)}`:"";const w=o.canvas.element.parentNode||document.body;w.append(r),w.append(l),w.append(c),w.append(h);const b=()=>{o.muted=!o.muted,this._updateMuteIcons(),this._updateMuteStatus()};r.addEventListener("click",b),l.addEventListener("click",b),c.addEventListener("click",(()=>{o.muted&&(this._volume=0),this._volume-=a.volume.step,this._updateVolume()})),h.addEventListener("click",(()=>{o.muted&&(this._volume=0),this._volume+=a.volume.step,this._updateVolume()}))}stop(){this._container.muted=!0,this._mute(),this._muteImg&&this._muteImg.remove(),this._unmuteImg&&this._unmuteImg.remove(),this._volumeDownImg&&this._volumeDownImg.remove(),this._volumeUpImg&&this._volumeUpImg.remove()}_addBuffer(t){const i=t.createBufferSource();return this._audioSources.push(i),i}_addOscillator(t){const i=t.createOscillator();return this._audioSources.push(i),i}_initEvents(){const t=this._container,i=t.actualOptions.sounds;if((null==i?void 0:i.enable)&&t.canvas.element)for(const t of i.events){const i=async e=>{if(this._container===e.container)if(!this._container||this._container.muted||this._container.destroyed)P(t.event,(t=>{this._engine.removeEventListener(t,i)}));else if(!t.filter||t.filter(e))if(t.audio)this._playBuffer(k(t.audio));else if(t.melodies){const i=x(t.melodies);i.melodies.length?await Promise.allSettled(i.melodies.map((t=>this._playNote(t.notes,0,i.loop)))):await this._playNote(i.notes,0,i.loop)}else if(t.notes){const i=x(t.notes);await this._playNote([i],0,!1)}};P(t.event,(t=>{this._engine.addEventListener(t,i)}))}}_mute(){const t=this._container;if(t.audioContext){for(const t of this._audioSources)this._removeAudioSource(t);this._gain&&this._gain.disconnect(),t.audioContext.close(),t.audioContext=void 0,this._engine.dispatchEvent("soundsMuted",{container:this._container})}}_playBuffer(t){var i;const e=this._audioMap.get(t.source);if(!e)return;const s=this._container.audioContext;if(!s)return;const o=this._addBuffer(s);o.loop=t.loop,o.buffer=e,o.connect(null!==(i=this._gain)&&void 0!==i?i:s.destination),o.start()}async _playFrequency(t,i){if(!this._container.audioContext||!this._gain)return;const e=this._addOscillator(this._container.audioContext);return e.connect(this._gain),e.type="sine",e.frequency.value=t,e.start(),new Promise((t=>{setTimeout((()=>{this._removeAudioSource(e),t()}),i)}))}_playMuteSound(){const t=this._container;if(!t.audioContext)return;const i=t.audioContext.createGain();i.connect(t.audioContext.destination),i.gain.value=0;const e=t.audioContext.createOscillator();e.connect(i),e.type="sine",e.frequency.value=1,e.start(),setTimeout((()=>{e.stop(),e.disconnect(),i.disconnect()}))}async _playNote(t,i,e){if(this._container.muted)return;const s=t[i];if(!s)return;const o=P(s.value,(async(e,s)=>this._playNoteValue(t,i,s)));await(o instanceof Array?Promise.allSettled(o):o);let n=i+1;e&&n>=t.length&&(n%=t.length),this._container.muted||await this._playNote(t,n,e)}async _playNoteValue(t,i,e){const s=t[i];if(!s)return;const o=k(s.value,e,!0);try{const t=ye(o);if("number"!=typeof t)return;await this._playFrequency(t,s.duration)}catch(t){console.error(t)}}_removeAudioSource(t){t.stop(),t.disconnect(),this._audioSources.splice(this._audioSources.indexOf(t),1)}_unmute(){const t=this._container,i=t.actualOptions.sounds;if(!i)return;t.audioContext||(t.audioContext=new AudioContext),this._audioSources||(this._audioSources=[]);const e=t.audioContext.createGain();e.connect(t.audioContext.destination),e.gain.value=i.volume.value/100,this._gain=e,this._initEvents(),this._engine.dispatchEvent("soundsUnmuted",{container:this._container})}_updateMuteIcons(){const t=this._container,i=this._muteImg,e=this._unmuteImg;i&&(i.style.display=t.muted?"block":"none"),e&&(e.style.display=t.muted?"none":"block")}_updateMuteStatus(){this._container.muted?this._mute():(this._unmute(),this._playMuteSound())}_updateVolume(){var t;const i=this._container,e=i.actualOptions.sounds;if(!(null==e?void 0:e.enable))return;a(this._volume,e.volume.min,e.volume.max);let s=!1;this._volume<=0&&!i.muted?(this._volume=0,i.muted=!0,s=!0):this._volume>0&&i.muted&&(i.muted=!1,s=!0),s&&(this._updateMuteIcons(),this._updateMuteStatus()),(null===(t=this._gain)||void 0===t?void 0:t.gain)&&(this._gain.gain.value=this._volume/100)}}class be{constructor(t){this.id="sounds",this._engine=t}getPlugin(t){return new we(t,this._engine)}loadOptions(t,i){if(!this.needsPlugin(i))return;let e=t.sounds;void 0===(null==e?void 0:e.load)&&(t.sounds=e=new me),e.load(null==i?void 0:i.sounds)}needsPlugin(t){var i,e;return null!==(e=null===(i=null==t?void 0:t.sounds)||void 0===i?void 0:i.enable)&&void 0!==e&&e}}function _e(t,i,e,s,o){var n,a;const l=i;if(!l||!l.enable||void 0!==l.loops&&void 0!==l.maxLoops&&l.maxLoops>0&&l.loops>=l.maxLoops)return;const c=r(e.offset),h=(null!==(n=i.velocity)&&void 0!==n?n:0)*t.factor+3.6*c,d=null!==(a=i.decay)&&void 0!==a?a:1;o&&"increasing"!==l.status?(l.value-=h,l.value<0&&(l.loops||(l.loops=0),l.loops++,l.status="increasing",l.value+=l.value)):(l.value+=h,l.value>s&&(l.loops||(l.loops=0),l.loops++,o&&(l.status="decreasing",l.value-=l.value%s))),l.velocity&&1!==d&&(l.velocity*=d),l.value>s&&(l.value%=s)}class xe{constructor(t){this.container=t}init(t){var i,e,s;const o=this.container,n=k(t.options.stroke,t.id,t.options.reduceDuplicates);t.strokeWidth=l(n.width)*o.retina.pixelRatio,t.strokeOpacity=l(null!==(i=n.opacity)&&void 0!==i?i:1),t.strokeAnimation=null===(e=n.color)||void 0===e?void 0:e.animation;const a=null!==(s=A(n.color))&&void 0!==s?s:t.getFillColor();a&&(t.strokeColor=G(a,t.strokeAnimation,o.retina.reduceFactor))}isEnabled(t){var i,e,s;const o=t.strokeAnimation;return!t.destroyed&&!t.spawning&&!!o&&(void 0!==(null===(i=t.strokeColor)||void 0===i?void 0:i.h.value)&&t.strokeColor.h.enable||void 0!==(null===(e=t.strokeColor)||void 0===e?void 0:e.s.value)&&t.strokeColor.s.enable||void 0!==(null===(s=t.strokeColor)||void 0===s?void 0:s.l.value)&&t.strokeColor.l.enable)}update(t,i){this.isEnabled(t)&&function(t,i){if(!t.strokeColor||!t.strokeAnimation)return;const e=t.strokeColor.h;e&&_e(i,e,t.strokeAnimation.h,360,!1);const s=t.strokeColor.s;s&&_e(i,s,t.strokeAnimation.s,100,!0);const o=t.strokeColor.l;o&&_e(i,o,t.strokeAnimation.l,100,!0)}(t,i)}}const ze=(t,i,e)=>{const s=t.max>e?t.max-e:0;let o=d(t);s&&(o=d(t.min-s,e));const n=t.min<i?t.min:0;return n&&(o=d(0,t.max+n)),o},Me={detectRetina:!0,background:{color:"#000"},fpsLimit:120,emitters:{direction:"top",life:{count:0,duration:.1,delay:.1},rate:{delay:.05,quantity:1},size:{width:100,height:0},position:{y:100,x:50}},particles:{number:{value:0},destroy:{mode:"split",bounds:{top:{min:10,max:30}},split:{sizeOffset:!1,count:1,factor:{value:.333333},rate:{value:{min:75,max:150}},particles:["#ff595e","#ffca3a","#8ac926","#1982c4","#6a4c93"].map((t=>{const i=F(t);if(!i)return;const e=V(i),s=ze({min:e.s-30,max:e.s+30},0,100),o=ze({min:e.l-30,max:e.l+30},0,100);return{color:{value:{h:e.h,s,l:o}},stroke:{width:0},number:{value:0},opacity:{value:{min:.1,max:1},animation:{enable:!0,speed:.7,sync:!1,startValue:"max",destroy:"min"}},shape:{type:"circle"},size:{value:{min:1,max:2},animation:{enable:!0,speed:5,count:1,sync:!1,startValue:"min",destroy:"none"}},life:{count:1,duration:{value:{min:1,max:2}}},move:{decay:{min:.075,max:.1},enable:!0,gravity:{enable:!0,inverse:!1,acceleration:5},speed:{min:5,max:15},direction:"none",outModes:"destroy"}}})).filter((t=>void 0!==t))}},life:{count:1},shape:{type:"line"},size:{value:{min:.1,max:50},animation:{enable:!0,sync:!0,speed:90,startValue:"max",destroy:"min"}},stroke:{color:{value:"#ffffff"},width:1},rotate:{path:!0},move:{enable:!0,gravity:{acceleration:15,enable:!0,inverse:!0,maxSpeed:100},speed:{min:10,max:20},outModes:{default:"destroy",top:"none"},trail:{fillColor:"#000",enable:!0,length:10}}},sounds:{enable:!0,events:[{event:"particleRemoved",filter:t=>"line"===t.data.particle.shape,audio:["https://particles.js.org/audio/explosion0.mp3","https://particles.js.org/audio/explosion1.mp3","https://particles.js.org/audio/explosion2.mp3"]}],volume:50}};async function Ce(t){await async function(t){t.addMover("base",(()=>new Si))}(t),await async function(t){t.emitterShapeManager||(t.emitterShapeManager=new Ni(t)),t.addEmitterShape||(t.addEmitterShape=(i,e)=>{var s;null===(s=t.emitterShapeManager)||void 0===s||s.addShape(i,e)});const i=new Yi(t);await t.addPlugin(i),t.addEmitterShape("circle",new Fi),t.addEmitterShape("square",new Xi)}(t),await async function(t){const i=new be(t);await t.addPlugin(i)}(t),await async function(t){await t.addShape("circle",new Oi)}(t),await async function(t){await t.addShape("line",new te)}(t),await async function(t){await t.addParticleUpdater("rotate",(t=>new ki(t)))}(t),await async function(t){await t.addParticleUpdater("color",(t=>new Ei(t)))}(t),await async function(t){await t.addParticleUpdater("destroy",(i=>new Vi(t,i)))}(t),await async function(t){await t.addParticleUpdater("life",(t=>new Ki(t)))}(t),await async function(t){await t.addParticleUpdater("opacity",(t=>new ie(t)))}(t),await async function(t){await t.addParticleUpdater("outModes",(t=>new ae(t)))}(t),await async function(t){await t.addParticleUpdater("size",(()=>new re))}(t),await async function(t){await t.addParticleUpdater("strokeColor",(t=>new xe(t)))}(t),await t.addPreset("fireworks",Me)}return(async()=>{await Ce(Mi)})(),i})()));
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,(()=>(()=>{"use strict";var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{loadFireworksPreset:()=>Fi,tsParticles:()=>Te});const i="generated",s="pointerleave",o="pointermove",n="touchend",a="tsParticles - Error";class r{constructor(t,e,i){if(this._updateFromAngle=(t,e)=>{this.x=Math.cos(t)*e,this.y=Math.sin(t)*e},!U(t)&&t){this.x=t.x,this.y=t.y;const e=t;this.z=e.z?e.z:0}else{if(void 0===t||void 0===e)throw new Error(`${a} Vector3d not initialized correctly`);this.x=t,this.y=e,this.z=i??0}}static get origin(){return r.create(0,0,0)}get angle(){return Math.atan2(this.y,this.x)}set angle(t){this._updateFromAngle(t,this.length)}get length(){return Math.sqrt(this.getLengthSq())}set length(t){this._updateFromAngle(this.angle,t)}static clone(t){return r.create(t.x,t.y,t.z)}static create(t,e,i){return new r(t,e,i)}add(t){return r.create(this.x+t.x,this.y+t.y,this.z+t.z)}addTo(t){this.x+=t.x,this.y+=t.y,this.z+=t.z}copy(){return r.clone(this)}distanceTo(t){return this.sub(t).length}distanceToSq(t){return this.sub(t).getLengthSq()}div(t){return r.create(this.x/t,this.y/t,this.z/t)}divTo(t){this.x/=t,this.y/=t,this.z/=t}getLengthSq(){return this.x**2+this.y**2}mult(t){return r.create(this.x*t,this.y*t,this.z*t)}multTo(t){this.x*=t,this.y*=t,this.z*=t}normalize(){const t=this.length;0!=t&&this.multTo(1/t)}rotate(t){return r.create(this.x*Math.cos(t)-this.y*Math.sin(t),this.x*Math.sin(t)+this.y*Math.cos(t),0)}setTo(t){this.x=t.x,this.y=t.y;const e=t;this.z=e.z?e.z:0}sub(t){return r.create(this.x-t.x,this.y-t.y,this.z-t.z)}subFrom(t){this.x-=t.x,this.y-=t.y,this.z-=t.z}}class c extends r{constructor(t,e){super(t,e,0)}static get origin(){return c.create(0,0)}static clone(t){return c.create(t.x,t.y)}static create(t,e){return new c(t,e)}}let l=Math.random;new Map;function h(){return d(l(),0,1-1e-16)}function d(t,e,i){return Math.min(Math.max(t,e),i)}function u(t){const e=v(t);let i=f(t);return e===i&&(i=0),h()*(e-i)+i}function p(t){return U(t)?t:u(t)}function f(t){return U(t)?t:t.min}function v(t){return U(t)?t:t.max}function m(t,e){if(t===e||void 0===e&&U(t))return t;const i=f(t),s=v(t);return void 0!==e?{min:Math.min(i,e),max:Math.max(s,e)}:m(i,s)}function y(t,e){const i=t.x-e.x,s=t.y-e.y;return{dx:i,dy:s,distance:Math.sqrt(i**2+s**2)}}function g(t,e){return y(t,e).distance}function _(t){const e={x:void 0!==t.position?.x?p(t.position.x):void 0,y:void 0!==t.position?.y?p(t.position.y):void 0};return function(t){return{x:(t.position?.x??100*h())*t.size.width/100,y:(t.position?.y??100*h())*t.size.height/100}}({size:t.size,position:e})}function w(t){return{x:t.position?.x??h()*t.size.width,y:t.position?.y??h()*t.size.height}}function b(t){return t?t.endsWith("%")?parseFloat(t)/100:parseFloat(t):1}const x={debug:console.debug,error:console.error,info:console.info,log:console.log,verbose:console.log,warning:console.warn};function z(){return x}function M(){return"undefined"==typeof window||!window||void 0===window.document||!window.document}function C(t){if(!M()&&"undefined"!=typeof matchMedia)return matchMedia(t)}function P(t,e){return t===e||q(e)&&e.indexOf(t)>-1}function k(t){return Math.floor(h()*t.length)}function O(t,e,i=!0){return t[void 0!==e&&i?e%t.length:k(t)]}function S(t,e,i,s,o){return function(t,e,i,s){let o=!0;s&&"bottom"!==s||(o=t.top<e.height+i.x);!o||s&&"left"!==s||(o=t.right>i.x);!o||s&&"right"!==s||(o=t.left<e.width+i.y);!o||s&&"top"!==s||(o=t.bottom>i.y);return o}(D(t,s??0),e,i,o)}function D(t,e){return{bottom:t.y+e,left:t.x-e,right:t.x+e,top:t.y-e}}function T(t,...e){for(const i of e){if(null==i)continue;if(!G(i)){t=i;continue}const e=Array.isArray(i);!e||!G(t)&&t&&Array.isArray(t)?e||!G(t)&&t&&!Array.isArray(t)||(t={}):t=[];for(const e in i){if("__proto__"===e)continue;const s=i[e],o=t;o[e]=G(s)&&Array.isArray(s)?s.map((t=>T(o[e],t))):T(o[e],s)}}return t}function E(t,e){return q(t)?t.map(((t,i)=>e(t,i))):e(t,0)}function I(t,e,i){return q(t)?O(t,e,i):t}function R(t,e){const i=t.value,s=t.animation,o={delayTime:1e3*p(s.delay),enable:s.enable,value:p(t.value)*e,max:v(i)*e,min:f(i)*e,loops:0,maxLoops:p(s.count),time:0};if(s.enable){switch(o.decay=1-p(s.decay),s.mode){case"increase":o.status="increasing";break;case"decrease":o.status="decreasing";break;case"random":o.status=h()>=.5?"increasing":"decreasing"}const t="auto"===s.mode;switch(s.startValue){case"min":o.value=o.min,t&&(o.status="increasing");break;case"max":o.value=o.max,t&&(o.status="decreasing");break;default:o.value=u(o),t&&(o.status=h()>=.5?"increasing":"decreasing")}}return o.initialValue=o.value,o}function L(t,e){if(!("percent"===t.mode)){const{mode:e,...i}=t;return i}return"x"in t?{x:t.x/100*e.width,y:t.y/100*e.height}:{width:t.width/100*e.width,height:t.height/100*e.height}}function F(t,e){return L(t,e)}function A(t,e){return L(t,e)}function V(t){return"boolean"==typeof t}function B(t){return"string"==typeof t}function U(t){return"number"==typeof t}function G(t){return"object"==typeof t&&null!==t}function q(t){return Array.isArray(t)}const W="random",$=new Map;function H(t){$.set(t.key,t)}function j(t){for(const[,e]of $)if(t.startsWith(e.stringPrefix))return e.parseString(t);const e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,((t,e,i,s,o)=>e+e+i+i+s+s+(void 0!==o?o+o:""))),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e);return i?{a:void 0!==i[4]?parseInt(i[4],16)/255:1,b:parseInt(i[3],16),g:parseInt(i[2],16),r:parseInt(i[1],16)}:void 0}function N(t,e,i=!0){if(!t)return;const s=B(t)?{value:t}:t;if(B(s.value))return X(s.value,e,i);if(q(s.value))return N({value:O(s.value,e,i)});for(const[,t]of $){const e=t.handleRangeColor(s);if(e)return e}}function X(t,e,i=!0){if(!t)return;const s=B(t)?{value:t}:t;if(B(s.value))return s.value===W?K():Q(s.value);if(q(s.value))return X({value:O(s.value,e,i)});for(const[,t]of $){const e=t.handleColor(s);if(e)return e}}function Y(t,e,i=!0){const s=N(t,e,i);return s?Z(s):void 0}function Z(t){const e=t.r/255,i=t.g/255,s=t.b/255,o=Math.max(e,i,s),n=Math.min(e,i,s),a={h:0,l:.5*(o+n),s:0};return o!==n&&(a.s=a.l<.5?(o-n)/(o+n):(o-n)/(2-o-n),a.h=e===o?(i-s)/(o-n):a.h=i===o?2+(s-e)/(o-n):4+(e-i)/(o-n)),a.l*=100,a.s*=100,a.h*=60,a.h<0&&(a.h+=360),a.h>=360&&(a.h-=360),a}function Q(t){return j(t)}function J(t){const e=(t.h%360+360)%360,i=Math.max(0,Math.min(100,t.s)),s=e/360,o=i/100,n=Math.max(0,Math.min(100,t.l))/100;if(0===i){const t=Math.round(255*n);return{r:t,g:t,b:t}}const a=(t,e,i)=>(i<0&&(i+=1),i>1&&(i-=1),6*i<1?t+6*(e-t)*i:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t),r=n<.5?n*(1+o):n+o-n*o,c=2*n-r,l=Math.min(255,255*a(c,r,s+1/3)),h=Math.min(255,255*a(c,r,s)),d=Math.min(255,255*a(c,r,s-1/3));return{r:Math.round(l),g:Math.round(h),b:Math.round(d)}}function K(t){const e=t??0;return{b:Math.floor(u(m(e,256))),g:Math.floor(u(m(e,256))),r:Math.floor(u(m(e,256)))}}function tt(t,e){return`rgba(${t.r}, ${t.g}, ${t.b}, ${e??1})`}function et(t,e){return`hsla(${t.h}, ${t.s}%, ${t.l}%, ${e??1})`}function it(t){return void 0!==t?{h:t.h.value,s:t.s.value,l:t.l.value}:void 0}function st(t,e,i){const s={h:{enable:!1,value:t.h},s:{enable:!1,value:t.s},l:{enable:!1,value:t.l}};return e&&(ot(s.h,e.h,i),ot(s.s,e.s,i),ot(s.l,e.l,i)),s}function ot(t,e,i){t.enable=e.enable,t.enable?(t.velocity=p(e.speed)/100*i,t.decay=1-p(e.decay),t.status="increasing",t.loops=0,t.maxLoops=p(e.count),t.time=0,t.delayTime=1e3*p(e.delay),e.sync||(t.velocity*=h(),t.value*=h()),t.initialValue=t.value):t.velocity=0}function nt(t,e){t.clearRect(0,0,e.width,e.height)}function at(t,e,i){const s=e[i];void 0!==s&&(t[i]=(t[i]??1)*s)}class rt{constructor(t){this.container=t,this._applyPostDrawUpdaters=t=>{for(const e of this._postDrawUpdaters)e.afterDraw&&e.afterDraw(t)},this._applyPreDrawUpdaters=(t,e,i,s,o,n)=>{for(const a of this._preDrawUpdaters){if(a.getColorStyles){const{fill:n,stroke:r}=a.getColorStyles(e,t,i,s);n&&(o.fill=n),r&&(o.stroke=r)}if(a.getTransformValues){const t=a.getTransformValues(e);for(const e in t)at(n,t,e)}a.beforeDraw&&a.beforeDraw(e)}},this._applyResizePlugins=()=>{for(const t of this._resizePlugins)t.resize&&t.resize()},this._getPluginParticleColors=t=>{let e,i;for(const s of this._colorPlugins)if(!e&&s.particleFillColor&&(e=Y(s.particleFillColor(t))),!i&&s.particleStrokeColor&&(i=Y(s.particleStrokeColor(t))),e&&i)break;return[e,i]},this._initCover=()=>{const t=this.container.actualOptions.backgroundMask.cover,e=N(t.color);if(e){const i={...e,a:t.opacity};this._coverColorStyle=tt(i,i.a)}},this._initStyle=()=>{const t=this.element,e=this.container.actualOptions;if(t){this._fullScreen?(this._originalStyle=T({},t.style),this._setFullScreenStyle()):this._resetOriginalStyle();for(const i in e.style){if(!i||!e.style)continue;const s=e.style[i];s&&t.style.setProperty(i,s,"important")}}},this._initTrail=async()=>{const t=this.container.actualOptions,e=t.particles.move.trail,i=e.fill;if(e.enable)if(i.color){const e=N(i.color);if(!e)return;const s=t.particles.move.trail;this._trailFill={color:{...e},opacity:1/s.length}}else await new Promise(((t,s)=>{if(!i.image)return;const o=document.createElement("img");o.addEventListener("load",(()=>{this._trailFill={image:o,opacity:1/e.length},t()})),o.addEventListener("error",(t=>{s(t.error)})),o.src=i.image}))},this._paintBase=t=>{this.draw((e=>function(t,e,i){t.fillStyle=i??"rgba(0,0,0,0)",t.fillRect(0,0,e.width,e.height)}(e,this.size,t)))},this._paintImage=(t,e)=>{this.draw((i=>function(t,e,i,s){i&&(t.globalAlpha=s,t.drawImage(i,0,0,e.width,e.height),t.globalAlpha=1)}(i,this.size,t,e)))},this._repairStyle=()=>{const t=this.element;t&&(this._safeMutationObserver((t=>t.disconnect())),this._initStyle(),this.initBackground(),this._safeMutationObserver((e=>e.observe(t,{attributes:!0}))))},this._resetOriginalStyle=()=>{const t=this.element,e=this._originalStyle;if(!t||!e)return;const i=t.style;i.position=e.position,i.zIndex=e.zIndex,i.top=e.top,i.left=e.left,i.width=e.width,i.height=e.height},this._safeMutationObserver=t=>{this._mutationObserver&&t(this._mutationObserver)},this._setFullScreenStyle=()=>{const t=this.element;if(!t)return;const e="important",i=t.style;i.setProperty("position","fixed",e),i.setProperty("z-index",this.container.actualOptions.fullScreen.zIndex.toString(10),e),i.setProperty("top","0",e),i.setProperty("left","0",e),i.setProperty("width","100%",e),i.setProperty("height","100%",e)},this.size={height:0,width:0},this._context=null,this._generated=!1,this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}get _fullScreen(){return this.container.actualOptions.fullScreen.enable}clear(){const t=this.container.actualOptions,e=t.particles.move.trail,i=this._trailFill;t.backgroundMask.enable?this.paint():e.enable&&e.length>0&&i?i.color?this._paintBase(tt(i.color,i.opacity)):i.image&&this._paintImage(i.image,i.opacity):this.draw((t=>{nt(t,this.size)}))}destroy(){if(this.stop(),this._generated){const t=this.element;t&&t.remove()}else this._resetOriginalStyle();this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}draw(t){const e=this._context;if(e)return t(e)}drawParticle(t,e){if(t.spawning||t.destroyed)return;const i=t.getRadius();if(i<=0)return;const s=t.getFillColor(),o=t.getStrokeColor()??s;let[n,a]=this._getPluginParticleColors(t);n||(n=s),a||(a=o),(n||a)&&this.draw((s=>{const o=this.container,r=o.actualOptions,c=t.options.zIndex,l=(1-t.zIndexFactor)**c.opacityRate,h=t.bubble.opacity??t.opacity?.value??1,d=h*l,u=(t.strokeOpacity??h)*l,p={},f={fill:n?et(n,d):void 0};f.stroke=a?et(a,u):f.fill,this._applyPreDrawUpdaters(s,t,i,d,f,p),function(t){const{container:e,context:i,particle:s,delta:o,colorStyles:n,backgroundMask:a,composite:r,radius:c,opacity:l,shadow:h,transform:d}=t,u=s.getPosition(),p=s.rotation+(s.pathRotation?s.velocity.angle:0),f=Math.sin(p),v=Math.cos(p),m={a:v*(d.a??1),b:f*(d.b??1),c:-f*(d.c??1),d:v*(d.d??1)};i.setTransform(m.a,m.b,m.c,m.d,u.x,u.y),a&&(i.globalCompositeOperation=r);const y=s.shadowColor;h.enable&&y&&(i.shadowBlur=h.blur,i.shadowColor=tt(y),i.shadowOffsetX=h.offset.x,i.shadowOffsetY=h.offset.y),n.fill&&(i.fillStyle=n.fill);const g=s.strokeWidth??0;i.lineWidth=g,n.stroke&&(i.strokeStyle=n.stroke);const _={container:e,context:i,particle:s,radius:c,opacity:l,delta:o};i.beginPath(),function(t){const{container:e,context:i,particle:s,radius:o,opacity:n,delta:a}=t;if(!s.shape)return;const r=e.shapeDrawers.get(s.shape);r&&r.draw({context:i,particle:s,radius:o,opacity:n,delta:a,pixelRatio:e.retina.pixelRatio})}(_),s.shapeClose&&i.closePath(),g>0&&i.stroke(),s.shapeFill&&i.fill(),function(t){const{container:e,context:i,particle:s,radius:o,opacity:n,delta:a}=t;if(!s.shape)return;const r=e.shapeDrawers.get(s.shape);r&&r.afterDraw&&r.afterDraw({context:i,particle:s,radius:o,opacity:n,delta:a,pixelRatio:e.retina.pixelRatio})}(_),function(t){const{container:e,context:i,particle:s,radius:o,opacity:n,delta:a}=t;if(!s.effect)return;const r=e.effectDrawers.get(s.effect);r&&r.draw({context:i,particle:s,radius:o,opacity:n,delta:a,pixelRatio:e.retina.pixelRatio})}(_),i.globalCompositeOperation="source-over",i.setTransform(1,0,0,1,0,0)}({container:o,context:s,particle:t,delta:e,colorStyles:f,backgroundMask:r.backgroundMask.enable,composite:r.backgroundMask.composite,radius:i*(1-t.zIndexFactor)**c.sizeRate,opacity:d,shadow:t.options.shadow,transform:p}),this._applyPostDrawUpdaters(t)}))}drawParticlePlugin(t,e,i){this.draw((s=>function(t,e,i,s){e.drawParticle&&e.drawParticle(t,i,s)}(s,t,e,i)))}drawPlugin(t,e){this.draw((i=>function(t,e,i){e.draw&&e.draw(t,i)}(i,t,e)))}async init(){this._safeMutationObserver((t=>t.disconnect())),this._mutationObserver=function(t){if(!M()&&"undefined"!=typeof MutationObserver)return new MutationObserver(t)}((t=>{for(const e of t)"attributes"===e.type&&"style"===e.attributeName&&this._repairStyle()})),this.resize(),this._initStyle(),this._initCover();try{await this._initTrail()}catch(t){z().error(t)}this.initBackground(),this._safeMutationObserver((t=>{this.element&&t.observe(this.element,{attributes:!0})})),this.initUpdaters(),this.initPlugins(),this.paint()}initBackground(){const t=this.container.actualOptions.background,e=this.element;if(!e)return;const i=e.style;if(i){if(t.color){const e=N(t.color);i.backgroundColor=e?tt(e,t.opacity):""}else i.backgroundColor="";i.backgroundImage=t.image||"",i.backgroundPosition=t.position||"",i.backgroundRepeat=t.repeat||"",i.backgroundSize=t.size||""}}initPlugins(){this._resizePlugins=[];for(const[,t]of this.container.plugins)t.resize&&this._resizePlugins.push(t),(t.particleFillColor||t.particleStrokeColor)&&this._colorPlugins.push(t)}initUpdaters(){this._preDrawUpdaters=[],this._postDrawUpdaters=[];for(const t of this.container.particles.updaters)t.afterDraw&&this._postDrawUpdaters.push(t),(t.getColorStyles||t.getTransformValues||t.beforeDraw)&&this._preDrawUpdaters.push(t)}loadCanvas(t){this._generated&&this.element&&this.element.remove(),this._generated=t.dataset&&i in t.dataset?"true"===t.dataset[i]:this._generated,this.element=t,this.element.ariaHidden="true",this._originalStyle=T({},this.element.style),this.size.height=t.offsetHeight,this.size.width=t.offsetWidth,this._context=this.element.getContext("2d"),this._safeMutationObserver((t=>{this.element&&t.observe(this.element,{attributes:!0})})),this.container.retina.init(),this.initBackground()}paint(){const t=this.container.actualOptions;this.draw((e=>{t.backgroundMask.enable&&t.backgroundMask.cover?(nt(e,this.size),this._paintBase(this._coverColorStyle)):this._paintBase()}))}resize(){if(!this.element)return!1;const t=this.container,e=t.retina.pixelRatio,i=t.canvas.size,s=this.element.offsetWidth*e,o=this.element.offsetHeight*e;if(o===i.height&&s===i.width&&o===this.element.height&&s===this.element.width)return!1;const n={...i};return this.element.width=i.width=this.element.offsetWidth*e,this.element.height=i.height=this.element.offsetHeight*e,this.container.started&&t.particles.setResizeFactor({width:i.width/n.width,height:i.height/n.height}),!0}stop(){this._safeMutationObserver((t=>t.disconnect())),this._mutationObserver=void 0,this.draw((t=>nt(t,this.size)))}async windowResize(){if(!this.element||!this.resize())return;const t=this.container,e=t.updateActualOptions();t.particles.setDensity(),this._applyResizePlugins(),e&&await t.refresh()}}function ct(t,e,i,s,o){if(s){let s={passive:!0};V(o)?s.capture=o:void 0!==o&&(s=o),t.addEventListener(e,i,s)}else{const s=o;t.removeEventListener(e,i,s)}}class lt{constructor(t){this.container=t,this._doMouseTouchClick=t=>{const e=this.container,i=e.actualOptions;if(this._canPush){const t=e.interactivity.mouse,s=t.position;if(!s)return;t.clickPosition={...s},t.clickTime=(new Date).getTime();E(i.interactivity.events.onClick.mode,(t=>this.container.handleClickMode(t)))}"touchend"===t.type&&setTimeout((()=>this._mouseTouchFinish()),500)},this._handleThemeChange=t=>{const e=t,i=this.container,s=i.options,o=s.defaultThemes,n=e.matches?o.dark:o.light,a=s.themes.find((t=>t.name===n));a&&a.default.auto&&i.loadTheme(n)},this._handleVisibilityChange=()=>{const t=this.container,e=t.actualOptions;this._mouseTouchFinish(),e.pauseOnBlur&&(document&&document.hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.getAnimationStatus()?t.play(!0):t.draw(!0)))},this._handleWindowResize=async()=>{this._resizeTimeout&&(clearTimeout(this._resizeTimeout),delete this._resizeTimeout),this._resizeTimeout=setTimeout((async()=>{const t=this.container.canvas;t&&await t.windowResize()}),1e3*this.container.actualOptions.interactivity.events.resize.delay)},this._manageInteractivityListeners=(t,e)=>{const i=this._handlers,s=this.container,a=s.actualOptions,r=s.interactivity.element;if(!r)return;const c=r,l=s.canvas.element;l&&(l.style.pointerEvents=c===l?"initial":"none"),(a.interactivity.events.onHover.enable||a.interactivity.events.onClick.enable)&&(ct(r,o,i.mouseMove,e),ct(r,"touchstart",i.touchStart,e),ct(r,"touchmove",i.touchMove,e),a.interactivity.events.onClick.enable?(ct(r,n,i.touchEndClick,e),ct(r,"pointerup",i.mouseUp,e),ct(r,"pointerdown",i.mouseDown,e)):ct(r,n,i.touchEnd,e),ct(r,t,i.mouseLeave,e),ct(r,"touchcancel",i.touchCancel,e))},this._manageListeners=t=>{const e=this._handlers,i=this.container,o=i.actualOptions.interactivity.detectsOn,n=i.canvas.element;let a=s;"window"===o?(i.interactivity.element=window,a="pointerout"):i.interactivity.element="parent"===o&&n?n.parentElement??n.parentNode:n,this._manageMediaMatch(t),this._manageResize(t),this._manageInteractivityListeners(a,t),document&&ct(document,"visibilitychange",e.visibilityChange,t,!1)},this._manageMediaMatch=t=>{const e=this._handlers,i=C("(prefers-color-scheme: dark)");i&&(void 0===i.addEventListener?void 0!==i.addListener&&(t?i.addListener(e.oldThemeChange):i.removeListener(e.oldThemeChange)):ct(i,"change",e.themeChange,t))},this._manageResize=t=>{const e=this._handlers,i=this.container;if(!i.actualOptions.interactivity.events.resize)return;if("undefined"==typeof ResizeObserver)return void ct(window,"resize",e.resize,t);const s=i.canvas.element;this._resizeObserver&&!t?(s&&this._resizeObserver.unobserve(s),this._resizeObserver.disconnect(),delete this._resizeObserver):!this._resizeObserver&&t&&s&&(this._resizeObserver=new ResizeObserver((async t=>{t.find((t=>t.target===s))&&await this._handleWindowResize()})),this._resizeObserver.observe(s))},this._mouseDown=()=>{const{interactivity:t}=this.container;if(!t)return;const{mouse:e}=t;e.clicking=!0,e.downPosition=e.position},this._mouseTouchClick=t=>{const e=this.container,i=e.actualOptions,{mouse:s}=e.interactivity;s.inside=!0;let o=!1;const n=s.position;if(n&&i.interactivity.events.onClick.enable){for(const[,t]of e.plugins)if(t.clickPositionValid&&(o=t.clickPositionValid(n),o))break;o||this._doMouseTouchClick(t),s.clicking=!1}},this._mouseTouchFinish=()=>{const t=this.container.interactivity;if(!t)return;const e=t.mouse;delete e.position,delete e.clickPosition,delete e.downPosition,t.status=s,e.inside=!1,e.clicking=!1},this._mouseTouchMove=t=>{const e=this.container,i=e.actualOptions,s=e.interactivity,n=e.canvas.element;if(!s||!s.element)return;let a;if(s.mouse.inside=!0,t.type.startsWith("pointer")){this._canPush=!0;const e=t;if(s.element===window){if(n){const t=n.getBoundingClientRect();a={x:e.clientX-t.left,y:e.clientY-t.top}}}else if("parent"===i.interactivity.detectsOn){const t=e.target,i=e.currentTarget;if(t&&i&&n){const s=t.getBoundingClientRect(),o=i.getBoundingClientRect(),r=n.getBoundingClientRect();a={x:e.offsetX+2*s.left-(o.left+r.left),y:e.offsetY+2*s.top-(o.top+r.top)}}else a={x:e.offsetX??e.clientX,y:e.offsetY??e.clientY}}else e.target===n&&(a={x:e.offsetX??e.clientX,y:e.offsetY??e.clientY})}else if(this._canPush="touchmove"!==t.type,n){const e=t,i=e.touches[e.touches.length-1],s=n.getBoundingClientRect();a={x:i.clientX-(s.left??0),y:i.clientY-(s.top??0)}}const r=e.retina.pixelRatio;a&&(a.x*=r,a.y*=r),s.mouse.position=a,s.status=o},this._touchEnd=t=>{const e=t,i=Array.from(e.changedTouches);for(const t of i)this._touches.delete(t.identifier);this._mouseTouchFinish()},this._touchEndClick=t=>{const e=t,i=Array.from(e.changedTouches);for(const t of i)this._touches.delete(t.identifier);this._mouseTouchClick(t)},this._touchStart=t=>{const e=t,i=Array.from(e.changedTouches);for(const t of i)this._touches.set(t.identifier,performance.now());this._mouseTouchMove(t)},this._canPush=!0,this._touches=new Map,this._handlers={mouseDown:()=>this._mouseDown(),mouseLeave:()=>this._mouseTouchFinish(),mouseMove:t=>this._mouseTouchMove(t),mouseUp:t=>this._mouseTouchClick(t),touchStart:t=>this._touchStart(t),touchMove:t=>this._mouseTouchMove(t),touchEnd:t=>this._touchEnd(t),touchCancel:t=>this._touchEnd(t),touchEndClick:t=>this._touchEndClick(t),visibilityChange:()=>this._handleVisibilityChange(),themeChange:t=>this._handleThemeChange(t),oldThemeChange:t=>this._handleThemeChange(t),resize:()=>{this._handleWindowResize()}}}addListeners(){this._manageListeners(!0)}removeListeners(){this._manageListeners(!1)}}class ht{constructor(){this.value=""}static create(t,e){const i=new ht;return i.load(t),void 0!==e&&(B(e)||q(e)?i.load({value:e}):i.load(e)),i}load(t){void 0!==t?.value&&(this.value=t.value)}}class dt{constructor(){this.color=new ht,this.color.value="",this.image="",this.position="",this.repeat="",this.size="",this.opacity=1}load(t){t&&(void 0!==t.color&&(this.color=ht.create(this.color,t.color)),void 0!==t.image&&(this.image=t.image),void 0!==t.position&&(this.position=t.position),void 0!==t.repeat&&(this.repeat=t.repeat),void 0!==t.size&&(this.size=t.size),void 0!==t.opacity&&(this.opacity=t.opacity))}}class ut{constructor(){this.color=new ht,this.color.value="#fff",this.opacity=1}load(t){t&&(void 0!==t.color&&(this.color=ht.create(this.color,t.color)),void 0!==t.opacity&&(this.opacity=t.opacity))}}class pt{constructor(){this.composite="destination-out",this.cover=new ut,this.enable=!1}load(t){if(t){if(void 0!==t.composite&&(this.composite=t.composite),void 0!==t.cover){const e=t.cover,i=B(t.cover)?{color:t.cover}:t.cover;this.cover.load(void 0!==e.color?e:{color:i})}void 0!==t.enable&&(this.enable=t.enable)}}}class ft{constructor(){this.enable=!0,this.zIndex=0}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.zIndex&&(this.zIndex=t.zIndex))}}class vt{constructor(){this.enable=!1,this.mode=[]}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.mode&&(this.mode=t.mode))}}class mt{constructor(){this.selectors=[],this.enable=!1,this.mode=[],this.type="circle"}load(t){t&&(void 0!==t.selectors&&(this.selectors=t.selectors),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.mode&&(this.mode=t.mode),void 0!==t.type&&(this.type=t.type))}}class yt{constructor(){this.enable=!1,this.force=2,this.smooth=10}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.force&&(this.force=t.force),void 0!==t.smooth&&(this.smooth=t.smooth))}}class gt{constructor(){this.enable=!1,this.mode=[],this.parallax=new yt}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.mode&&(this.mode=t.mode),this.parallax.load(t.parallax))}}class _t{constructor(){this.delay=.5,this.enable=!0}load(t){void 0!==t&&(void 0!==t.delay&&(this.delay=t.delay),void 0!==t.enable&&(this.enable=t.enable))}}class wt{constructor(){this.onClick=new vt,this.onDiv=new mt,this.onHover=new gt,this.resize=new _t}load(t){if(!t)return;this.onClick.load(t.onClick);const e=t.onDiv;void 0!==e&&(this.onDiv=E(e,(t=>{const e=new mt;return e.load(t),e}))),this.onHover.load(t.onHover),V(t.resize)?this.resize.enable=t.resize:this.resize.load(t.resize)}}class bt{constructor(t,e){this._engine=t,this._container=e}load(t){if(!t)return;if(!this._container)return;const e=this._engine.interactors.get(this._container);if(e)for(const i of e)i.loadModeOptions&&i.loadModeOptions(this,t)}}class xt{constructor(t,e){this.detectsOn="window",this.events=new wt,this.modes=new bt(t,e)}load(t){if(!t)return;const e=t.detectsOn;void 0!==e&&(this.detectsOn=e),this.events.load(t.events),this.modes.load(t.modes)}}class zt{load(t){t&&(t.position&&(this.position={x:t.position.x??50,y:t.position.y??50,mode:t.position.mode??"percent"}),t.options&&(this.options=T({},t.options)))}}class Mt{constructor(){this.maxWidth=1/0,this.options={},this.mode="canvas"}load(t){t&&(void 0!==t.maxWidth&&(this.maxWidth=t.maxWidth),void 0!==t.mode&&("screen"===t.mode?this.mode="screen":this.mode="canvas"),void 0!==t.options&&(this.options=T({},t.options)))}}class Ct{constructor(){this.auto=!1,this.mode="any",this.value=!1}load(t){t&&(void 0!==t.auto&&(this.auto=t.auto),void 0!==t.mode&&(this.mode=t.mode),void 0!==t.value&&(this.value=t.value))}}class Pt{constructor(){this.name="",this.default=new Ct}load(t){t&&(void 0!==t.name&&(this.name=t.name),this.default.load(t.default),void 0!==t.options&&(this.options=T({},t.options)))}}class kt{constructor(){this.count=0,this.enable=!1,this.speed=1,this.decay=0,this.delay=0,this.sync=!1}load(t){t&&(void 0!==t.count&&(this.count=m(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=m(t.speed)),void 0!==t.decay&&(this.decay=m(t.decay)),void 0!==t.delay&&(this.delay=m(t.delay)),void 0!==t.sync&&(this.sync=t.sync))}}class Ot extends kt{constructor(){super(),this.mode="auto",this.startValue="random"}load(t){super.load(t),t&&(void 0!==t.mode&&(this.mode=t.mode),void 0!==t.startValue&&(this.startValue=t.startValue))}}class St extends kt{constructor(){super(),this.offset=0,this.sync=!0}load(t){super.load(t),t&&void 0!==t.offset&&(this.offset=m(t.offset))}}class Dt{constructor(){this.h=new St,this.s=new St,this.l=new St}load(t){t&&(this.h.load(t.h),this.s.load(t.s),this.l.load(t.l))}}class Tt extends ht{constructor(){super(),this.animation=new Dt}static create(t,e){const i=new Tt;return i.load(t),void 0!==e&&(B(e)||q(e)?i.load({value:e}):i.load(e)),i}load(t){if(super.load(t),!t)return;const e=t.animation;void 0!==e&&(void 0!==e.enable?this.animation.h.load(e):this.animation.load(t.animation))}}class Et{constructor(){this.speed=2}load(t){t&&void 0!==t.speed&&(this.speed=t.speed)}}class It{constructor(){this.enable=!0,this.retries=0}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.retries&&(this.retries=t.retries))}}class Rt{constructor(){this.value=0}load(t){t&&void 0!==t.value&&(this.value=m(t.value))}}class Lt extends Rt{constructor(){super(),this.animation=new kt}load(t){if(super.load(t),!t)return;const e=t.animation;void 0!==e&&this.animation.load(e)}}class Ft extends Lt{constructor(){super(),this.animation=new Ot}load(t){super.load(t)}}class At extends Rt{constructor(){super(),this.value=1}}class Vt{constructor(){this.horizontal=new At,this.vertical=new At}load(t){t&&(this.horizontal.load(t.horizontal),this.vertical.load(t.vertical))}}class Bt{constructor(){this.absorb=new Et,this.bounce=new Vt,this.enable=!1,this.maxSpeed=50,this.mode="bounce",this.overlap=new It}load(t){t&&(this.absorb.load(t.absorb),this.bounce.load(t.bounce),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.maxSpeed&&(this.maxSpeed=m(t.maxSpeed)),void 0!==t.mode&&(this.mode=t.mode),this.overlap.load(t.overlap))}}class Ut{constructor(){this.close=!0,this.fill=!0,this.options={},this.type=[]}load(t){if(!t)return;const e=t.options;if(void 0!==e)for(const t in e){const i=e[t];i&&(this.options[t]=T(this.options[t]??{},i))}void 0!==t.close&&(this.close=t.close),void 0!==t.fill&&(this.fill=t.fill),void 0!==t.type&&(this.type=t.type)}}class Gt{constructor(){this.offset=0,this.value=90}load(t){t&&(void 0!==t.offset&&(this.offset=m(t.offset)),void 0!==t.value&&(this.value=m(t.value)))}}class qt{constructor(){this.distance=200,this.enable=!1,this.rotate={x:3e3,y:3e3}}load(t){if(t&&(void 0!==t.distance&&(this.distance=m(t.distance)),void 0!==t.enable&&(this.enable=t.enable),t.rotate)){const e=t.rotate.x;void 0!==e&&(this.rotate.x=e);const i=t.rotate.y;void 0!==i&&(this.rotate.y=i)}}}class Wt{constructor(){this.x=50,this.y=50,this.mode="percent",this.radius=0}load(t){t&&(void 0!==t.x&&(this.x=t.x),void 0!==t.y&&(this.y=t.y),void 0!==t.mode&&(this.mode=t.mode),void 0!==t.radius&&(this.radius=t.radius))}}class $t{constructor(){this.acceleration=9.81,this.enable=!1,this.inverse=!1,this.maxSpeed=50}load(t){t&&(void 0!==t.acceleration&&(this.acceleration=m(t.acceleration)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.inverse&&(this.inverse=t.inverse),void 0!==t.maxSpeed&&(this.maxSpeed=m(t.maxSpeed)))}}class Ht{constructor(){this.clamp=!0,this.delay=new Rt,this.enable=!1,this.options={}}load(t){t&&(void 0!==t.clamp&&(this.clamp=t.clamp),this.delay.load(t.delay),void 0!==t.enable&&(this.enable=t.enable),this.generator=t.generator,t.options&&(this.options=T(this.options,t.options)))}}class jt{load(t){t&&(void 0!==t.color&&(this.color=ht.create(this.color,t.color)),void 0!==t.image&&(this.image=t.image))}}class Nt{constructor(){this.enable=!1,this.length=10,this.fill=new jt}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.fill&&this.fill.load(t.fill),void 0!==t.length&&(this.length=t.length))}}class Xt{constructor(){this.default="out"}load(t){t&&(void 0!==t.default&&(this.default=t.default),this.bottom=t.bottom??t.default,this.left=t.left??t.default,this.right=t.right??t.default,this.top=t.top??t.default)}}class Yt{constructor(){this.acceleration=0,this.enable=!1}load(t){t&&(void 0!==t.acceleration&&(this.acceleration=m(t.acceleration)),void 0!==t.enable&&(this.enable=t.enable),t.position&&(this.position=T({},t.position)))}}class Zt{constructor(){this.angle=new Gt,this.attract=new qt,this.center=new Wt,this.decay=0,this.distance={},this.direction="none",this.drift=0,this.enable=!1,this.gravity=new $t,this.path=new Ht,this.outModes=new Xt,this.random=!1,this.size=!1,this.speed=2,this.spin=new Yt,this.straight=!1,this.trail=new Nt,this.vibrate=!1,this.warp=!1}load(t){if(!t)return;this.angle.load(U(t.angle)?{value:t.angle}:t.angle),this.attract.load(t.attract),this.center.load(t.center),void 0!==t.decay&&(this.decay=m(t.decay)),void 0!==t.direction&&(this.direction=t.direction),void 0!==t.distance&&(this.distance=U(t.distance)?{horizontal:t.distance,vertical:t.distance}:{...t.distance}),void 0!==t.drift&&(this.drift=m(t.drift)),void 0!==t.enable&&(this.enable=t.enable),this.gravity.load(t.gravity);const e=t.outModes;void 0!==e&&(G(e)?this.outModes.load(e):this.outModes.load({default:e})),this.path.load(t.path),void 0!==t.random&&(this.random=t.random),void 0!==t.size&&(this.size=t.size),void 0!==t.speed&&(this.speed=m(t.speed)),this.spin.load(t.spin),void 0!==t.straight&&(this.straight=t.straight),this.trail.load(t.trail),void 0!==t.vibrate&&(this.vibrate=t.vibrate),void 0!==t.warp&&(this.warp=t.warp)}}class Qt extends Ot{constructor(){super(),this.destroy="none",this.speed=2}load(t){super.load(t),t&&void 0!==t.destroy&&(this.destroy=t.destroy)}}class Jt extends Ft{constructor(){super(),this.animation=new Qt,this.value=1}load(t){if(!t)return;super.load(t);const e=t.animation;void 0!==e&&this.animation.load(e)}}class Kt{constructor(){this.enable=!1,this.width=1920,this.height=1080}load(t){if(!t)return;void 0!==t.enable&&(this.enable=t.enable);const e=t.width;void 0!==e&&(this.width=e);const i=t.height;void 0!==i&&(this.height=i)}}class te{constructor(){this.mode="delete",this.value=0}load(t){t&&(void 0!==t.mode&&(this.mode=t.mode),void 0!==t.value&&(this.value=t.value))}}class ee{constructor(){this.density=new Kt,this.limit=new te,this.value=0}load(t){t&&(this.density.load(t.density),this.limit.load(t.limit),void 0!==t.value&&(this.value=t.value))}}class ie{constructor(){this.blur=0,this.color=new ht,this.enable=!1,this.offset={x:0,y:0},this.color.value="#000"}load(t){t&&(void 0!==t.blur&&(this.blur=t.blur),this.color=ht.create(this.color,t.color),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.offset&&(void 0!==t.offset.x&&(this.offset.x=t.offset.x),void 0!==t.offset.y&&(this.offset.y=t.offset.y)))}}class se{constructor(){this.close=!0,this.fill=!0,this.options={},this.type="circle"}load(t){if(!t)return;const e=t.options;if(void 0!==e)for(const t in e){const i=e[t];i&&(this.options[t]=T(this.options[t]??{},i))}void 0!==t.close&&(this.close=t.close),void 0!==t.fill&&(this.fill=t.fill),void 0!==t.type&&(this.type=t.type)}}class oe extends Ot{constructor(){super(),this.destroy="none",this.speed=5}load(t){super.load(t),t&&void 0!==t.destroy&&(this.destroy=t.destroy)}}class ne extends Ft{constructor(){super(),this.animation=new oe,this.value=3}load(t){if(super.load(t),!t)return;const e=t.animation;void 0!==e&&this.animation.load(e)}}class ae{constructor(){this.width=0}load(t){t&&(void 0!==t.color&&(this.color=Tt.create(this.color,t.color)),void 0!==t.width&&(this.width=m(t.width)),void 0!==t.opacity&&(this.opacity=m(t.opacity)))}}class re extends Rt{constructor(){super(),this.opacityRate=1,this.sizeRate=1,this.velocityRate=1}load(t){super.load(t),t&&(void 0!==t.opacityRate&&(this.opacityRate=t.opacityRate),void 0!==t.sizeRate&&(this.sizeRate=t.sizeRate),void 0!==t.velocityRate&&(this.velocityRate=t.velocityRate))}}class ce{constructor(t,e){this._engine=t,this._container=e,this.bounce=new Vt,this.collisions=new Bt,this.color=new Tt,this.color.value="#fff",this.effect=new Ut,this.groups={},this.move=new Zt,this.number=new ee,this.opacity=new Jt,this.reduceDuplicates=!1,this.shadow=new ie,this.shape=new se,this.size=new ne,this.stroke=new ae,this.zIndex=new re}load(t){if(!t)return;if(this.bounce.load(t.bounce),this.color.load(Tt.create(this.color,t.color)),this.effect.load(t.effect),void 0!==t.groups)for(const e in t.groups){const i=t.groups[e];void 0!==i&&(this.groups[e]=T(this.groups[e]??{},i))}this.move.load(t.move),this.number.load(t.number),this.opacity.load(t.opacity),void 0!==t.reduceDuplicates&&(this.reduceDuplicates=t.reduceDuplicates),this.shape.load(t.shape),this.size.load(t.size),this.shadow.load(t.shadow),this.zIndex.load(t.zIndex),this.collisions.load(t.collisions),void 0!==t.interactivity&&(this.interactivity=T({},t.interactivity));const e=t.stroke;if(e&&(this.stroke=E(e,(t=>{const e=new ae;return e.load(t),e}))),this._container){const e=this._engine.updaters.get(this._container);if(e)for(const i of e)i.loadOptions&&i.loadOptions(this,t);const i=this._engine.interactors.get(this._container);if(i)for(const e of i)e.loadParticlesOptions&&e.loadParticlesOptions(this,t)}}}function le(t,...e){for(const i of e)t.load(i)}function he(t,e,...i){const s=new ce(t,e);return le(s,...i),s}class de{constructor(t,e){this._findDefaultTheme=t=>this.themes.find((e=>e.default.value&&e.default.mode===t))??this.themes.find((t=>t.default.value&&"any"===t.default.mode)),this._importPreset=t=>{this.load(this._engine.getPreset(t))},this._engine=t,this._container=e,this.autoPlay=!0,this.background=new dt,this.backgroundMask=new pt,this.defaultThemes={},this.delay=0,this.fullScreen=new ft,this.detectRetina=!0,this.duration=0,this.fpsLimit=120,this.interactivity=new xt(t,e),this.manualParticles=[],this.particles=he(this._engine,this._container),this.pauseOnBlur=!0,this.pauseOnOutsideViewport=!0,this.responsive=[],this.smooth=!1,this.style={},this.themes=[],this.zLayers=100}load(t){if(!t)return;void 0!==t.preset&&E(t.preset,(t=>this._importPreset(t))),void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.delay&&(this.delay=m(t.delay));const e=t.detectRetina;void 0!==e&&(this.detectRetina=e),void 0!==t.duration&&(this.duration=m(t.duration));const i=t.fpsLimit;void 0!==i&&(this.fpsLimit=i),void 0!==t.pauseOnBlur&&(this.pauseOnBlur=t.pauseOnBlur),void 0!==t.pauseOnOutsideViewport&&(this.pauseOnOutsideViewport=t.pauseOnOutsideViewport),void 0!==t.zLayers&&(this.zLayers=t.zLayers),this.background.load(t.background);const s=t.fullScreen;V(s)?this.fullScreen.enable=s:this.fullScreen.load(s),this.backgroundMask.load(t.backgroundMask),this.interactivity.load(t.interactivity),t.manualParticles&&(this.manualParticles=t.manualParticles.map((t=>{const e=new zt;return e.load(t),e}))),this.particles.load(t.particles),this.style=T(this.style,t.style),this._engine.loadOptions(this,t),void 0!==t.smooth&&(this.smooth=t.smooth);const o=this._engine.interactors.get(this._container);if(o)for(const e of o)e.loadOptions&&e.loadOptions(this,t);if(void 0!==t.responsive)for(const e of t.responsive){const t=new Mt;t.load(e),this.responsive.push(t)}if(this.responsive.sort(((t,e)=>t.maxWidth-e.maxWidth)),void 0!==t.themes)for(const e of t.themes){const t=this.themes.find((t=>t.name===e.name));if(t)t.load(e);else{const t=new Pt;t.load(e),this.themes.push(t)}}this.defaultThemes.dark=this._findDefaultTheme("dark")?.name,this.defaultThemes.light=this._findDefaultTheme("light")?.name}setResponsive(t,e,i){this.load(i);const s=this.responsive.find((i=>"screen"===i.mode&&screen?i.maxWidth>screen.availWidth:i.maxWidth*e>t));return this.load(s?.options),s?.maxWidth}setTheme(t){if(t){const e=this.themes.find((e=>e.name===t));e&&this.load(e.options)}else{const t=C("(prefers-color-scheme: dark)"),e=t&&t.matches,i=this._findDefaultTheme(e?"dark":"light");i&&this.load(i.options)}}}class ue{constructor(t,e){this.container=e,this._engine=t,this._interactors=t.getInteractors(this.container,!0),this._externalInteractors=[],this._particleInteractors=[]}async externalInteract(t){for(const e of this._externalInteractors)e.isEnabled()&&await e.interact(t)}handleClickMode(t){for(const e of this._externalInteractors)e.handleClickMode&&e.handleClickMode(t)}init(){this._externalInteractors=[],this._particleInteractors=[];for(const t of this._interactors){switch(t.type){case"external":this._externalInteractors.push(t);break;case"particles":this._particleInteractors.push(t)}t.init()}}async particlesInteract(t,e){for(const i of this._externalInteractors)i.clear(t,e);for(const i of this._particleInteractors)i.isEnabled(t)&&await i.interact(t,e)}async reset(t){for(const e of this._externalInteractors)e.isEnabled()&&e.reset(t);for(const e of this._particleInteractors)e.isEnabled(t)&&e.reset(t)}}function pe(t){if(!P(t.outMode,t.checkModes))return;const e=2*t.radius;t.coord>t.maxCoord-e?t.setCb(-t.radius):t.coord<e&&t.setCb(t.radius)}class fe{constructor(t,e,i,s,o,n){this.container=i,this._calcPosition=(t,e,i,s=0)=>{for(const[,s]of t.plugins){const t=void 0!==s.particlePosition?s.particlePosition(e,this):void 0;if(t)return r.create(t.x,t.y,i)}const o=w({size:t.canvas.size,position:e}),n=r.create(o.x,o.y,i),a=this.getRadius(),c=this.options.move.outModes,l=e=>{pe({outMode:e,checkModes:["bounce","bounce-horizontal"],coord:n.x,maxCoord:t.canvas.size.width,setCb:t=>n.x+=t,radius:a})},h=e=>{pe({outMode:e,checkModes:["bounce","bounce-vertical"],coord:n.y,maxCoord:t.canvas.size.height,setCb:t=>n.y+=t,radius:a})};return l(c.left??c.default),l(c.right??c.default),h(c.top??c.default),h(c.bottom??c.default),this._checkOverlap(n,s)?this._calcPosition(t,void 0,i,s+1):n},this._calculateVelocity=()=>{const t=function(t){const e=c.origin;return e.length=1,e.angle=t,e}(this.direction).copy(),e=this.options.move;if("inside"===e.direction||"outside"===e.direction)return t;const i=Math.PI/180*p(e.angle.value),s=Math.PI/180*p(e.angle.offset),o={left:s-.5*i,right:s+.5*i};return e.straight||(t.angle+=u(m(o.left,o.right))),e.random&&"number"==typeof e.speed&&(t.length*=h()),t},this._checkOverlap=(t,e=0)=>{const i=this.options.collisions,s=this.getRadius();if(!i.enable)return!1;const o=i.overlap;if(o.enable)return!1;const n=o.retries;if(n>=0&&e>n)throw new Error(`${a} particle is overlapping and can't be placed`);return!!this.container.particles.find((e=>g(t,e.position)<s+e.getRadius()))},this._getRollColor=t=>{if(!t||!this.roll||!this.backColor&&!this.roll.alter)return t;const e=this.roll.horizontal&&this.roll.vertical?2:1,i=this.roll.horizontal?.5*Math.PI:0;return Math.floor(((this.roll.angle??0)+i)/(Math.PI/e))%2?this.backColor?this.backColor:this.roll.alter?function(t,e,i){return{h:t.h,s:t.s,l:t.l+("darken"===e?-1:1)*i}}(t,this.roll.alter.type,this.roll.alter.value):t:t},this._initPosition=t=>{const e=this.container,i=p(this.options.zIndex.value);this.position=this._calcPosition(e,t,d(i,0,e.zLayers)),this.initialPosition=this.position.copy();const s=e.canvas.size;switch(this.moveCenter={...F(this.options.move.center,s),radius:this.options.move.center.radius??0,mode:this.options.move.center.mode??"percent"},this.direction=function(t,e,i){if(U(t))return t*Math.PI/180;switch(t){case"top":return.5*-Math.PI;case"top-right":return.25*-Math.PI;case"right":return 0;case"bottom-right":return.25*Math.PI;case"bottom":return.5*Math.PI;case"bottom-left":return.75*Math.PI;case"left":return Math.PI;case"top-left":return.75*-Math.PI;case"inside":return Math.atan2(i.y-e.y,i.x-e.x);case"outside":return Math.atan2(e.y-i.y,e.x-i.x);default:return h()*Math.PI*2}}(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case"inside":this.outType="inside";break;case"outside":this.outType="outside"}this.offset=c.origin},this._engine=t,this.init(e,s,o,n)}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;const e=this.container,i=this.pathGenerator;for(const[,i]of e.plugins)i.particleDestroyed&&i.particleDestroyed(this,t);for(const i of e.particles.updaters)i.particleDestroyed&&i.particleDestroyed(this,t);i&&i.reset(this)}draw(t){const e=this.container,i=e.canvas;for(const[,s]of e.plugins)i.drawParticlePlugin(s,this,t);i.drawParticle(this,t)}getFillColor(){return this._getRollColor(this.bubble.color??it(this.color))}getMass(){return this.getRadius()**2*Math.PI*.5}getPosition(){return{x:this.position.x+this.offset.x,y:this.position.y+this.offset.y,z:this.position.z}}getRadius(){return this.bubble.radius??this.size.value}getStrokeColor(){return this._getRollColor(this.bubble.color??it(this.strokeColor))}init(t,e,i,s){const o=this.container,n=this._engine;this.id=t,this.group=s,this.effectClose=!0,this.effectFill=!0,this.shapeClose=!0,this.shapeFill=!0,this.pathRotation=!1,this.lastPathTime=0,this.destroyed=!1,this.unbreakable=!1,this.rotation=0,this.misplaced=!1,this.retina={maxDistance:{}},this.outType="normal",this.ignoresResizeRatio=!0;const a=o.retina.pixelRatio,r=o.actualOptions,c=he(this._engine,o,r.particles),l=c.effect.type,h=c.shape.type,{reduceDuplicates:d}=c;this.effect=I(l,this.id,d),this.shape=I(h,this.id,d);const u=c.effect,f=c.shape;if(i){if(i.effect&&i.effect.type){const t=I(i.effect.type,this.id,d);t&&(this.effect=t,u.load(i.effect))}if(i.shape&&i.shape.type){const t=I(i.shape.type,this.id,d);t&&(this.shape=t,f.load(i.shape))}}this.effectData=function(t,e,i,s){const o=e.options[t];if(o)return T({close:e.close,fill:e.fill},I(o,i,s))}(this.effect,u,this.id,d),this.shapeData=function(t,e,i,s){const o=e.options[t];if(o)return T({close:e.close,fill:e.fill},I(o,i,s))}(this.shape,f,this.id,d),c.load(i);const v=this.effectData;v&&c.load(v.particles);const m=this.shapeData;m&&c.load(m.particles);const y=new xt(n,o);y.load(o.actualOptions.interactivity),y.load(c.interactivity),this.interactivity=y,this.effectFill=v?.fill??c.effect.fill,this.effectClose=v?.close??c.effect.close,this.shapeFill=m?.fill??c.shape.fill,this.shapeClose=m?.close??c.shape.close,this.options=c;const g=this.options.move.path;this.pathDelay=1e3*p(g.delay.value),g.generator&&(this.pathGenerator=this._engine.getPathGenerator(g.generator),this.pathGenerator&&o.addPath(g.generator,this.pathGenerator)&&this.pathGenerator.init(o)),o.retina.initParticle(this),this.size=R(this.options.size,a),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this._initPosition(e),this.initialVelocity=this._calculateVelocity(),this.velocity=this.initialVelocity.copy(),this.moveDecay=1-p(this.options.move.decay);const _=o.particles;_.setLastZIndex(this.position.z),this.zIndexFactor=this.position.z/o.zLayers,this.sides=24;let w=o.effectDrawers.get(this.effect);w||(w=this._engine.getEffectDrawer(this.effect),w&&o.effectDrawers.set(this.effect,w)),w&&w.loadEffect&&w.loadEffect(this);let b=o.shapeDrawers.get(this.shape);b||(b=this._engine.getShapeDrawer(this.shape),b&&o.shapeDrawers.set(this.shape,b)),b&&b.loadShape&&b.loadShape(this);const x=b?.getSidesCount;x&&(this.sides=x(this)),this.spawning=!1,this.shadowColor=N(this.options.shadow.color);for(const t of _.updaters)t.init(this);for(const t of _.movers)t.init&&t.init(this);w&&w.particleInit&&w.particleInit(o,this),b&&b.particleInit&&b.particleInit(o,this);for(const[,t]of o.plugins)t.particleCreated&&t.particleCreated(this)}isInsideCanvas(){const t=this.getRadius(),e=this.container.canvas.size,i=this.position;return i.x>=-t&&i.y>=-t&&i.y<=e.height+t&&i.x<=e.width+t}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(const t of this.container.particles.updaters)t.reset&&t.reset(this)}}class ve{constructor(t,e){this.position=t,this.particle=e}}class me{constructor(t,e){this.position={x:t,y:e}}}class ye extends me{constructor(t,e,i,s){super(t,e),this.size={height:s,width:i}}contains(t){const e=this.size.width,i=this.size.height,s=this.position;return t.x>=s.x&&t.x<=s.x+e&&t.y>=s.y&&t.y<=s.y+i}intersects(t){t instanceof ge&&t.intersects(this);const e=this.size.width,i=this.size.height,s=this.position,o=t.position,n=t instanceof ye?t.size:{width:0,height:0},a=n.width,r=n.height;return o.x<s.x+e&&o.x+a>s.x&&o.y<s.y+i&&o.y+r>s.y}}class ge extends me{constructor(t,e,i){super(t,e),this.radius=i}contains(t){return g(t,this.position)<=this.radius}intersects(t){const e=this.position,i=t.position,s=Math.abs(i.x-e.x),o=Math.abs(i.y-e.y),n=this.radius;if(t instanceof ge){return n+t.radius>Math.sqrt(s**2+o**2)}if(t instanceof ye){const{width:e,height:i}=t.size;return Math.pow(s-e,2)+Math.pow(o-i,2)<=n**2||s<=n+e&&o<=n+i||s<=e||o<=i}return!1}}class _e{constructor(t,e){this.rectangle=t,this.capacity=e,this._subdivide=()=>{const{x:t,y:e}=this.rectangle.position,{width:i,height:s}=this.rectangle.size,{capacity:o}=this;for(let n=0;n<4;n++)this._subs.push(new _e(new ye(t+.5*i*(n%2),e+.5*s*(Math.round(.5*n)-n%2),.5*i,.5*s),o));this._divided=!0},this._points=[],this._divided=!1,this._subs=[]}insert(t){return!!this.rectangle.contains(t.position)&&(this._points.length<this.capacity?(this._points.push(t),!0):(this._divided||this._subdivide(),this._subs.some((e=>e.insert(t)))))}query(t,e,i){const s=i||[];if(!t.intersects(this.rectangle))return[];for(const i of this._points)!t.contains(i.position)&&g(t.position,i.position)>i.particle.getRadius()&&(!e||e(i.particle))||s.push(i.particle);if(this._divided)for(const i of this._subs)i.query(t,e,s);return s}queryCircle(t,e,i){return this.query(new ge(t.x,t.y,e),i)}queryRectangle(t,e,i){return this.query(new ye(t.x,t.y,e.width,e.height),i)}}const we=t=>{const{height:e,width:i}=t;return new ye(-.25*i,-.25*e,1.5*i,1.5*e)};class be{constructor(t,e){this._applyDensity=(t,e,i)=>{const s=t.number;if(!t.number.density?.enable)return void(void 0===i?this._limit=s.limit.value:this._groupLimits.set(i,s.limit.value));const o=this._initDensityFactor(s.density),n=s.value,a=s.limit.value>0?s.limit.value:n,r=Math.min(n,a)*o+e,c=Math.min(this.count,this.filter((t=>t.group===i)).length);void 0===i?this._limit=s.limit.value*o:this._groupLimits.set(i,s.limit.value*o),c<r?this.push(Math.abs(r-c),void 0,t,i):c>r&&this.removeQuantity(c-r,i)},this._initDensityFactor=t=>{const e=this._container;if(!e.canvas.element||!t.enable)return 1;const i=e.canvas.element,s=e.retina.pixelRatio;return i.width*i.height/(t.height*t.width*s**2)},this._pushParticle=(t,e,i,s)=>{try{let o=this._pool.pop();o?o.init(this._nextId,t,e,i):o=new fe(this._engine,this._nextId,this._container,t,e,i);let n=!0;if(s&&(n=s(o)),!n)return;return this._array.push(o),this._zArray.push(o),this._nextId++,this._engine.dispatchEvent("particleAdded",{container:this._container,data:{particle:o}}),o}catch(t){return void z().warning(`${a} adding particle: ${t}`)}},this._removeParticle=(t,e,i)=>{const s=this._array[t];if(!s||s.group!==e)return!1;s.destroy(i);const o=this._zArray.indexOf(s);return this._array.splice(t,1),this._zArray.splice(o,1),this._pool.push(s),this._engine.dispatchEvent("particleRemoved",{container:this._container,data:{particle:s}}),!0},this._engine=t,this._container=e,this._nextId=0,this._array=[],this._zArray=[],this._pool=[],this._limit=0,this._groupLimits=new Map,this._needsSort=!1,this._lastZIndex=0,this._interactionManager=new ue(t,e);const i=e.canvas.size;this.quadTree=new _e(we(i),4),this.movers=this._engine.getMovers(e,!0),this.updaters=this._engine.getUpdaters(e,!0)}get count(){return this._array.length}addManualParticles(){const t=this._container,e=t.actualOptions;for(const i of e.manualParticles)this.addParticle(i.position?F(i.position,t.canvas.size):void 0,i.options)}addParticle(t,e,i,s){const o=this._container.actualOptions.particles.number.limit,n=void 0===i?this._limit:this._groupLimits.get(i)??this._limit,a=this.count;if(n>0)if("delete"===o.mode){const t=a+1-n;t>0&&this.removeQuantity(t)}else if("wait"===o.mode&&a>=n)return;return this._pushParticle(t,e,i,s)}clear(){this._array=[],this._zArray=[]}destroy(){this._array=[],this._zArray=[],this.movers=[],this.updaters=[]}async draw(t){const e=this._container,i=e.canvas;i.clear(),await this.update(t);for(const[,s]of e.plugins)i.drawPlugin(s,t);for(const e of this._zArray)e.draw(t)}filter(t){return this._array.filter(t)}find(t){return this._array.find(t)}get(t){return this._array[t]}handleClickMode(t){this._interactionManager.handleClickMode(t)}init(){const t=this._container,e=t.actualOptions;this._lastZIndex=0,this._needsSort=!1;let i=!1;this.updaters=this._engine.getUpdaters(t,!0),this._interactionManager.init();for(const[,e]of t.plugins)if(void 0!==e.particlesInitialization&&(i=e.particlesInitialization()),i)break;this._interactionManager.init();for(const[,e]of t.pathGenerators)e.init(t);if(this.addManualParticles(),!i){const t=e.particles,i=t.groups;for(const e in i){const s=i[e];for(let i=this.count,o=0;o<s.number?.value&&i<t.number.value;i++,o++)this.addParticle(void 0,s,e)}for(let e=this.count;e<t.number.value;e++)this.addParticle()}}push(t,e,i,s){for(let o=0;o<t;o++)this.addParticle(e?.position,i,s)}async redraw(){this.clear(),this.init(),await this.draw({value:0,factor:0})}remove(t,e,i){this.removeAt(this._array.indexOf(t),void 0,e,i)}removeAt(t,e=1,i,s){if(t<0||t>this.count)return;let o=0;for(let n=t;o<e&&n<this.count;n++)this._removeParticle(n--,i,s)&&o++}removeQuantity(t,e){this.removeAt(0,t,e)}setDensity(){const t=this._container.actualOptions,e=t.particles.groups;for(const t in e)this._applyDensity(e[t],0,t);this._applyDensity(t.particles,t.manualParticles.length)}setLastZIndex(t){this._lastZIndex=t,this._needsSort=this._needsSort||this._lastZIndex<t}setResizeFactor(t){this._resizeFactor=t}async update(t){const e=this._container,i=new Set;this.quadTree=new _e(we(e.canvas.size),4);for(const[,t]of e.pathGenerators)t.update();for(const[,i]of e.plugins)i.update&&await i.update(t);const s=this._resizeFactor;for(const e of this._array){s&&!e.ignoresResizeRatio&&(e.position.x*=s.width,e.position.y*=s.height,e.initialPosition.x*=s.width,e.initialPosition.y*=s.height),e.ignoresResizeRatio=!1,await this._interactionManager.reset(e);for(const[,i]of this._container.plugins){if(e.destroyed)break;i.particleUpdate&&i.particleUpdate(e,t)}for(const i of this.movers)i.isEnabled(e)&&i.move(e,t);e.destroyed?i.add(e):this.quadTree.insert(new ve(e.getPosition(),e))}if(i.size){const t=t=>!i.has(t);this._array=this.filter(t),this._zArray=this._zArray.filter(t),this._pool.push(...i)}await this._interactionManager.externalInteract(t);for(const e of this._array){for(const i of this.updaters)i.update(e,t);e.destroyed||e.spawning||await this._interactionManager.particlesInteract(e,t)}if(delete this._resizeFactor,this._needsSort){const t=this._zArray;t.sort(((t,e)=>e.position.z-t.position.z||t.id-e.id)),this._lastZIndex=t[t.length-1].position.z,this._needsSort=!1}}}class xe{constructor(t){this.container=t,this.pixelRatio=1,this.reduceFactor=1}init(){const t=this.container,e=t.actualOptions;this.pixelRatio=!e.detectRetina||M()?1:window.devicePixelRatio,this.reduceFactor=1;const i=this.pixelRatio,s=t.canvas;if(s.element){const t=s.element;s.size.width=t.offsetWidth*i,s.size.height=t.offsetHeight*i}const o=e.particles,n=o.move;this.maxSpeed=p(n.gravity.maxSpeed)*i,this.sizeAnimationSpeed=p(o.size.animation.speed)*i}initParticle(t){const e=t.options,i=this.pixelRatio,s=e.move,o=s.distance,n=t.retina;n.moveDrift=p(s.drift)*i,n.moveSpeed=p(s.speed)*i,n.sizeAnimationSpeed=p(e.size.animation.speed)*i;const a=n.maxDistance;a.horizontal=void 0!==o.horizontal?o.horizontal*i:void 0,a.vertical=void 0!==o.vertical?o.vertical*i:void 0,n.maxSpeed=p(s.gravity.maxSpeed)*i}}function ze(t){return t&&!t.destroyed}function Me(t,e,...i){const s=new de(t,e);return le(s,...i),s}class Ce{constructor(t,e,i){this._intersectionManager=t=>{if(ze(this)&&this.actualOptions.pauseOnOutsideViewport)for(const e of t)e.target===this.interactivity.element&&(e.isIntersecting?this.play:this.pause)()},this._nextFrame=async t=>{try{if(!this._smooth&&void 0!==this._lastFrameTime&&t<this._lastFrameTime+1e3/this.fpsLimit)return void this.draw(!1);this._lastFrameTime??=t;const e=function(t,e=60,i=!1){return{value:t,factor:i?60/e:60*t/1e3}}(t-this._lastFrameTime,this.fpsLimit,this._smooth);if(this.addLifeTime(e.value),this._lastFrameTime=t,e.value>1e3)return void this.draw(!1);if(await this.particles.draw(e),!this.alive())return void this.destroy();this.getAnimationStatus()&&this.draw(!1)}catch(t){z().error(`${a} in animation loop`,t)}},this._engine=t,this.id=Symbol(e),this.fpsLimit=120,this._smooth=!1,this._delay=0,this._duration=0,this._lifeTime=0,this._firstStart=!0,this.started=!1,this.destroyed=!1,this._paused=!0,this._lastFrameTime=0,this.zLayers=100,this.pageHidden=!1,this._sourceOptions=i,this._initialSourceOptions=i,this.retina=new xe(this),this.canvas=new rt(this),this.particles=new be(this._engine,this),this.pathGenerators=new Map,this.interactivity={mouse:{clicking:!1,inside:!1}},this.plugins=new Map,this.effectDrawers=new Map,this.shapeDrawers=new Map,this._options=Me(this._engine,this),this.actualOptions=Me(this._engine,this),this._eventListeners=new lt(this),this._intersectionObserver=function(t){if(!M()&&"undefined"!=typeof IntersectionObserver)return new IntersectionObserver(t)}((t=>this._intersectionManager(t))),this._engine.dispatchEvent("containerBuilt",{container:this})}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addClickHandler(t){if(!ze(this))return;const e=this.interactivity.element;if(!e)return;const i=(e,i,s)=>{if(!ze(this))return;const o=this.retina.pixelRatio,n={x:i.x*o,y:i.y*o},a=this.particles.quadTree.queryCircle(n,s*o);t(e,a)};let s=!1,o=!1;e.addEventListener("click",(t=>{if(!ze(this))return;const e=t,s={x:e.offsetX||e.clientX,y:e.offsetY||e.clientY};i(t,s,1)})),e.addEventListener("touchstart",(()=>{ze(this)&&(s=!0,o=!1)})),e.addEventListener("touchmove",(()=>{ze(this)&&(o=!0)})),e.addEventListener("touchend",(t=>{if(ze(this)){if(s&&!o){const e=t;let s=e.touches[e.touches.length-1];if(!s&&(s=e.changedTouches[e.changedTouches.length-1],!s))return;const o=this.canvas.element,n=o?o.getBoundingClientRect():void 0,a={x:s.clientX-(n?n.left:0),y:s.clientY-(n?n.top:0)};i(t,a,Math.max(s.radiusX,s.radiusY))}s=!1,o=!1}})),e.addEventListener("touchcancel",(()=>{ze(this)&&(s=!1,o=!1)}))}addLifeTime(t){this._lifeTime+=t}addPath(t,e,i=!1){return!(!ze(this)||!i&&this.pathGenerators.has(t))&&(this.pathGenerators.set(t,e),!0)}alive(){return!this._duration||this._lifeTime<=this._duration}destroy(){if(!ze(this))return;this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.effectDrawers)t.destroy&&t.destroy(this);for(const[,t]of this.shapeDrawers)t.destroy&&t.destroy(this);for(const t of this.effectDrawers.keys())this.effectDrawers.delete(t);for(const t of this.shapeDrawers.keys())this.shapeDrawers.delete(t);this._engine.clearPlugins(this),this.destroyed=!0;const t=this._engine.dom(),e=t.findIndex((t=>t===this));e>=0&&t.splice(e,1),this._engine.dispatchEvent("containerDestroyed",{container:this})}draw(t){if(!ze(this))return;let e=t;this._drawAnimationFrame=requestAnimationFrame((async t=>{e&&(this._lastFrameTime=void 0,e=!1),await this._nextFrame(t)}))}async export(t,e={}){for(const[,i]of this.plugins){if(!i.export)continue;const s=await i.export(t,e);if(s.supported)return s.blob}z().error(`${a} - Export plugin with type ${t} not found`)}getAnimationStatus(){return!this._paused&&!this.pageHidden&&ze(this)}handleClickMode(t){if(ze(this)){this.particles.handleClickMode(t);for(const[,e]of this.plugins)e.handleClickMode&&e.handleClickMode(t)}}async init(){if(!ze(this))return;const t=this._engine.getSupportedEffects();for(const e of t){const t=this._engine.getEffectDrawer(e);t&&this.effectDrawers.set(e,t)}const e=this._engine.getSupportedShapes();for(const t of e){const e=this._engine.getShapeDrawer(t);e&&this.shapeDrawers.set(t,e)}this._options=Me(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=Me(this._engine,this,this._options);const i=this._engine.getAvailablePlugins(this);for(const[t,e]of i)this.plugins.set(t,e);this.retina.init(),await this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize(),this.zLayers=this.actualOptions.zLayers,this._duration=1e3*p(this.actualOptions.duration),this._delay=1e3*p(this.actualOptions.delay),this._lifeTime=0,this.fpsLimit=this.actualOptions.fpsLimit>0?this.actualOptions.fpsLimit:120,this._smooth=this.actualOptions.smooth;for(const[,t]of this.effectDrawers)t.init&&await t.init(this);for(const[,t]of this.shapeDrawers)t.init&&await t.init(this);for(const[,t]of this.plugins)t.init&&await t.init();this._engine.dispatchEvent("containerInit",{container:this}),this.particles.init(),this.particles.setDensity();for(const[,t]of this.plugins)t.particlesSetup&&t.particlesSetup();this._engine.dispatchEvent("particlesSetup",{container:this})}async loadTheme(t){ze(this)&&(this._currentTheme=t,await this.refresh())}pause(){if(ze(this)&&(void 0!==this._drawAnimationFrame&&(cancelAnimationFrame(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(const[,t]of this.plugins)t.pause&&t.pause();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent("containerPaused",{container:this})}}play(t){if(!ze(this))return;const e=this._paused||t;if(!this._firstStart||this.actualOptions.autoPlay){if(this._paused&&(this._paused=!1),e)for(const[,t]of this.plugins)t.play&&t.play();this._engine.dispatchEvent("containerPlay",{container:this}),this.draw(e||!1)}else this._firstStart=!1}async refresh(){if(ze(this))return this.stop(),this.start()}async reset(){if(ze(this))return this._initialSourceOptions=void 0,this._options=Me(this._engine,this),this.actualOptions=Me(this._engine,this,this._options),this.refresh()}async start(){ze(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{this._delayTimeout=setTimeout((async()=>{this._eventListeners.addListeners(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.observe(this.interactivity.element);for(const[,t]of this.plugins)t.start&&await t.start();this._engine.dispatchEvent("containerStarted",{container:this}),this.play(),t()}),this._delay)})))}stop(){if(ze(this)&&this.started){this._delayTimeout&&(clearTimeout(this._delayTimeout),delete this._delayTimeout),this._firstStart=!0,this.started=!1,this._eventListeners.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.unobserve(this.interactivity.element);for(const[,t]of this.plugins)t.stop&&t.stop();for(const t of this.plugins.keys())this.plugins.delete(t);this._sourceOptions=this._options,this._engine.dispatchEvent("containerStopped",{container:this})}}updateActualOptions(){this.actualOptions.responsive=[];const t=this.actualOptions.setResponsive(this.canvas.size.width,this.retina.pixelRatio,this._options);return this.actualOptions.setTheme(this._currentTheme),this._responsiveMaxWidth!==t&&(this._responsiveMaxWidth=t,!0)}}class Pe{constructor(){this._listeners=new Map}addEventListener(t,e){this.removeEventListener(t,e);let i=this._listeners.get(t);i||(i=[],this._listeners.set(t,i)),i.push(e)}dispatchEvent(t,e){const i=this._listeners.get(t);i&&i.forEach((t=>t(e)))}hasEventListener(t){return!!this._listeners.get(t)}removeAllEventListeners(t){t?this._listeners.delete(t):this._listeners=new Map}removeEventListener(t,e){const i=this._listeners.get(t);if(!i)return;const s=i.length,o=i.indexOf(e);o<0||(1===s?this._listeners.delete(t):i.splice(o,1))}}function ke(t,e,i,s=!1){let o=e.get(t);return o&&!s||(o=[...i.values()].map((e=>e(t))),e.set(t,o)),o}class Oe{constructor(){this._configs=new Map,this._domArray=[],this._eventDispatcher=new Pe,this._initialized=!1,this.plugins=[],this._initializers={interactors:new Map,movers:new Map,updaters:new Map},this.interactors=new Map,this.movers=new Map,this.updaters=new Map,this.presets=new Map,this.effectDrawers=new Map,this.shapeDrawers=new Map,this.pathGenerators=new Map}get configs(){const t={};for(const[e,i]of this._configs)t[e]=i;return t}get version(){return"3.0.0-beta.4"}addConfig(t){const e=t.name??"default";this._configs.set(e,t),this._eventDispatcher.dispatchEvent("configAdded",{data:{name:e,config:t}})}async addEffect(t,e,i=!0){E(t,(t=>{!this.getEffectDrawer(t)&&this.effectDrawers.set(t,e)})),await this.refresh(i)}addEventListener(t,e){this._eventDispatcher.addEventListener(t,e)}async addInteractor(t,e,i=!0){this._initializers.interactors.set(t,e),await this.refresh(i)}async addMover(t,e,i=!0){this._initializers.movers.set(t,e),await this.refresh(i)}async addParticleUpdater(t,e,i=!0){this._initializers.updaters.set(t,e),await this.refresh(i)}async addPathGenerator(t,e,i=!0){!this.getPathGenerator(t)&&this.pathGenerators.set(t,e),await this.refresh(i)}async addPlugin(t,e=!0){!this.getPlugin(t.id)&&this.plugins.push(t),await this.refresh(e)}async addPreset(t,e,i=!1,s=!0){(i||!this.getPreset(t))&&this.presets.set(t,e),await this.refresh(s)}async addShape(t,e,i=!0){E(t,(t=>{!this.getShapeDrawer(t)&&this.shapeDrawers.set(t,e)})),await this.refresh(i)}clearPlugins(t){this.updaters.delete(t),this.movers.delete(t),this.interactors.delete(t)}dispatchEvent(t,e){this._eventDispatcher.dispatchEvent(t,e)}dom(){return this._domArray}domItem(t){const e=this.dom(),i=e[t];if(i&&!i.destroyed)return i;e.splice(t,1)}getAvailablePlugins(t){const e=new Map;for(const i of this.plugins)i.needsPlugin(t.actualOptions)&&e.set(i.id,i.getPlugin(t));return e}getEffectDrawer(t){return this.effectDrawers.get(t)}getInteractors(t,e=!1){return ke(t,this.interactors,this._initializers.interactors,e)}getMovers(t,e=!1){return ke(t,this.movers,this._initializers.movers,e)}getPathGenerator(t){return this.pathGenerators.get(t)}getPlugin(t){return this.plugins.find((e=>e.id===t))}getPreset(t){return this.presets.get(t)}getShapeDrawer(t){return this.shapeDrawers.get(t)}getSupportedEffects(){return this.effectDrawers.keys()}getSupportedShapes(){return this.shapeDrawers.keys()}getUpdaters(t,e=!1){return ke(t,this.updaters,this._initializers.updaters,e)}init(){this._initialized||(this._initialized=!0)}async load(t){const e=t.id??`tsparticles${Math.floor(1e4*h())}`,{index:s,url:o}=t,n=o?await async function(t){const e=I(t.url,t.index);if(!e)return t.fallback;const i=await fetch(e);return i.ok?i.json():(z().error(`${a} ${i.status} while retrieving config file`),t.fallback)}({fallback:t.options,url:o,index:s}):t.options;let r=t.element??document.getElementById(e);r||(r=document.createElement("div"),r.id=e,document.body.append(r));const c=I(n,s),l=this.dom(),d=l.findIndex((t=>t.id.description===e));if(d>=0){const t=this.domItem(d);t&&!t.destroyed&&(t.destroy(),l.splice(d,1))}let u;if("canvas"===r.tagName.toLowerCase())u=r,u.dataset[i]="false";else{const t=r.getElementsByTagName("canvas");t.length?(u=t[0],u.dataset[i]="false"):(u=document.createElement("canvas"),u.dataset[i]="true",r.appendChild(u))}u.style.width||(u.style.width="100%"),u.style.height||(u.style.height="100%");const p=new Ce(this,e,c);return d>=0?l.splice(d,0,p):l.push(p),p.canvas.loadCanvas(u),await p.start(),p}loadOptions(t,e){for(const i of this.plugins)i.loadOptions(t,e)}loadParticlesOptions(t,e,...i){const s=this.updaters.get(t);if(s)for(const t of s)t.loadOptions&&t.loadOptions(e,...i)}async refresh(t=!0){t&&this.dom().forEach((t=>t.refresh()))}removeEventListener(t,e){this._eventDispatcher.removeEventListener(t,e)}setOnClickHandler(t){const e=this.dom();if(!e.length)throw new Error(`${a} can only set click handlers after calling tsParticles.load()`);for(const i of e)i.addClickHandler(t)}}class Se{constructor(){this.key="hsl",this.stringPrefix="hsl"}handleColor(t){const e=t.value.hsl??t.value;if(void 0!==e.h&&void 0!==e.s&&void 0!==e.l)return J(e)}handleRangeColor(t){const e=t.value.hsl??t.value;if(void 0!==e.h&&void 0!==e.l)return J({h:p(e.h),l:p(e.l),s:p(e.s)})}parseString(t){if(!t.startsWith("hsl"))return;const e=/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([\d.%]+)\s*)?\)/i.exec(t);return e?function(t){const e=J(t);return{a:t.a,b:e.b,g:e.g,r:e.r}}({a:e.length>4?b(e[5]):1,h:parseInt(e[1],10),l:parseInt(e[3],10),s:parseInt(e[2],10)}):void 0}}class De{constructor(){this.key="rgb",this.stringPrefix="rgb"}handleColor(t){const e=t.value.rgb??t.value;if(void 0!==e.r)return e}handleRangeColor(t){const e=t.value.rgb??t.value;if(void 0!==e.r)return{r:p(e.r),g:p(e.g),b:p(e.b)}}parseString(t){if(!t.startsWith(this.stringPrefix))return;const e=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.%]+)\s*)?\)/i.exec(t);return e?{a:e.length>4?b(e[5]):1,b:parseInt(e[3],10),g:parseInt(e[2],10),r:parseInt(e[1],10)}:void 0}}const Te=function(){const t=new De,e=new Se;H(t),H(e);const i=new Oe;return i.init(),i}();function Ee(t,e,i,s,o,n){!function(t,e){const i=t.options,s=i.move.path;if(!s.enable)return;if(t.lastPathTime<=t.pathDelay)return void(t.lastPathTime+=e.value);const o=t.pathGenerator?.generate(t,e);o&&t.velocity.addTo(o);s.clamp&&(t.velocity.x=d(t.velocity.x,-1,1),t.velocity.y=d(t.velocity.y,-1,1));t.lastPathTime-=t.pathDelay}(t,n);const a=t.gravity,r=a?.enable&&a.inverse?-1:1;o&&i&&(t.velocity.x+=o*n.factor/(60*i)),a?.enable&&i&&(t.velocity.y+=r*(a.acceleration*n.factor)/(60*i));const c=t.moveDecay;t.velocity.multTo(c);const l=t.velocity.mult(i);a?.enable&&s>0&&(!a.inverse&&l.y>=0&&l.y>=s||a.inverse&&l.y<=0&&l.y<=-s)&&(l.y=r*s,i&&(t.velocity.y=l.y/i));const h=t.options.zIndex,u=(1-t.zIndexFactor)**h.velocityRate;l.multTo(u);const{position:p}=t;p.addTo(l),e.vibrate&&(p.x+=Math.sin(p.x*Math.cos(p.y)),p.y+=Math.cos(p.y*Math.sin(p.x)))}M()||(window.tsParticles=Te);class Ie{constructor(){this._initSpin=t=>{const e=t.container,i=t.options.move.spin;if(!i.enable)return;const s=i.position??{x:50,y:50},o={x:.01*s.x*e.canvas.size.width,y:.01*s.y*e.canvas.size.height},n=g(t.getPosition(),o),a=p(i.acceleration);t.retina.spinAcceleration=a*e.retina.pixelRatio,t.spin={center:o,direction:t.velocity.x>=0?"clockwise":"counter-clockwise",angle:t.velocity.angle,radius:n,acceleration:t.retina.spinAcceleration}}}init(t){const e=t.options.move.gravity;t.gravity={enable:e.enable,acceleration:p(e.acceleration),inverse:e.inverse},this._initSpin(t)}isEnabled(t){return!t.destroyed&&t.options.move.enable}move(t,e){const i=t.options,s=i.move;if(!s.enable)return;const o=t.container,n=o.retina.pixelRatio,a=function(t){return t.slow.inRange?t.slow.factor:1}(t),r=(t.retina.moveSpeed??=p(s.speed)*n)*o.retina.reduceFactor,c=t.retina.moveDrift??=p(t.options.move.drift)*n,l=v(i.size.value)*n,d=r*(s.size?t.getRadius()/l:1)*a*(e.factor||1)/2,u=t.retina.maxSpeed??o.retina.maxSpeed;s.spin.enable?function(t,e){const i=t.container;if(!t.spin)return;const s={x:"clockwise"===t.spin.direction?Math.cos:Math.sin,y:"clockwise"===t.spin.direction?Math.sin:Math.cos};t.position.x=t.spin.center.x+t.spin.radius*s.x(t.spin.angle),t.position.y=t.spin.center.y+t.spin.radius*s.y(t.spin.angle),t.spin.radius+=t.spin.acceleration;const o=Math.max(i.canvas.size.width,i.canvas.size.height),n=.5*o;t.spin.radius>n?(t.spin.radius=n,t.spin.acceleration*=-1):t.spin.radius<0&&(t.spin.radius=0,t.spin.acceleration*=-1),t.spin.angle+=.01*e*(1-t.spin.radius/o)}(t,d):Ee(t,s,d,u,c,e),function(t){const e=t.initialPosition,{dx:i,dy:s}=y(e,t.position),o=Math.abs(i),n=Math.abs(s),{maxDistance:a}=t.retina,r=a.horizontal,c=a.vertical;if(r||c)if((r&&o>=r||c&&n>=c)&&!t.misplaced)t.misplaced=!!r&&o>r||!!c&&n>c,r&&(t.velocity.x=.5*t.velocity.y-t.velocity.x),c&&(t.velocity.y=.5*t.velocity.x-t.velocity.y);else if((!r||o<r)&&(!c||n<c)&&t.misplaced)t.misplaced=!1;else if(t.misplaced){const i=t.position,s=t.velocity;r&&(i.x<e.x&&s.x<0||i.x>e.x&&s.x>0)&&(s.x*=-h()),c&&(i.y<e.y&&s.y<0||i.y>e.y&&s.y>0)&&(s.y*=-h())}}(t)}}class Re{draw(t){const{context:e,particle:i,radius:s}=t;i.circleRange||(i.circleRange={min:0,max:2*Math.PI});const o=i.circleRange;e.arc(0,0,s,o.min,o.max,!1)}getSidesCount(){return 12}particleInit(t,e){const i=e.shapeData,s=i?.angle??{max:360,min:0};e.circleRange=G(s)?{min:s.min*Math.PI/180,max:s.max*Math.PI/180}:{min:0,max:s*Math.PI/180}}}function Le(t,e,i,s,o){if(!e||!i.enable||(e.maxLoops??0)>0&&(e.loops??0)>(e.maxLoops??0))return;if(e.time||(e.time=0),(e.delayTime??0)>0&&e.time<(e.delayTime??0)&&(e.time+=t.value),(e.delayTime??0)>0&&e.time<(e.delayTime??0))return;const n=u(i.offset),a=(e.velocity??0)*t.factor+3.6*n,r=e.decay??1;o&&"increasing"!==e.status?(e.value-=a,e.value<0&&(e.loops||(e.loops=0),e.loops++,e.status="increasing",e.value+=e.value)):(e.value+=a,e.value>s&&(e.loops||(e.loops=0),e.loops++,o&&(e.status="decreasing",e.value-=e.value%s))),e.velocity&&1!==r&&(e.velocity*=r),e.value>s&&(e.value%=s)}class Fe{constructor(t){this.container=t}init(t){const e=Y(t.options.color,t.id,t.options.reduceDuplicates);e&&(t.color=st(e,t.options.color.animation,this.container.retina.reduceFactor))}isEnabled(t){const{h:e,s:i,l:s}=t.options.color.animation,{color:o}=t;return!t.destroyed&&!t.spawning&&(void 0!==o?.h.value&&e.enable||void 0!==o?.s.value&&i.enable||void 0!==o?.l.value&&s.enable)}update(t,e){!function(t,e){const{h:i,s,l:o}=t.options.color.animation,{color:n}=t;if(!n)return;const{h:a,s:r,l:c}=n;a&&Le(e,a,i,360,!1),r&&Le(e,r,s,100,!0),c&&Le(e,c,o,100,!0)}(t,e)}}class Ae{constructor(t){this.container=t}init(t){const e=t.options.opacity;t.opacity=R(e,1);const i=e.animation;i.enable&&(t.opacity.velocity=p(i.speed)/100*this.container.retina.reduceFactor,i.sync||(t.opacity.velocity*=h()))}isEnabled(t){return!t.destroyed&&!t.spawning&&!!t.opacity&&t.opacity.enable&&((t.opacity.maxLoops??0)<=0||(t.opacity.maxLoops??0)>0&&(t.opacity.loops??0)<(t.opacity.maxLoops??0))}reset(t){t.opacity&&(t.opacity.time=0,t.opacity.loops=0)}update(t,e){this.isEnabled(t)&&function(t,e){const i=t.opacity;if(t.destroyed||!i?.enable||(i.maxLoops??0)>0&&(i.loops??0)>(i.maxLoops??0))return;const s=i.min,o=i.max,n=i.decay??1;if(i.time||(i.time=0),(i.delayTime??0)>0&&i.time<(i.delayTime??0)&&(i.time+=e.value),!((i.delayTime??0)>0&&i.time<(i.delayTime??0))){switch(i.status){case"increasing":i.value>=o?(i.status="decreasing",i.loops||(i.loops=0),i.loops++):i.value+=(i.velocity??0)*e.factor;break;case"decreasing":i.value<=s?(i.status="increasing",i.loops||(i.loops=0),i.loops++):i.value-=(i.velocity??0)*e.factor}i.velocity&&1!==i.decay&&(i.velocity*=n),function(t,e,i,s){switch(t.options.opacity.animation.destroy){case"max":e>=s&&t.destroy();break;case"min":e<=i&&t.destroy()}}(t,i.value,s,o),t.destroyed||(i.value=d(i.value,s,o))}}(t,e)}}class Ve{constructor(t){this.container=t,this.modes=["bounce","bounce-vertical","bounce-horizontal","bounceVertical","bounceHorizontal","split"]}update(t,e,i,s){if(!this.modes.includes(s))return;const o=this.container;let n=!1;for(const[,s]of o.plugins)if(void 0!==s.particleBounce&&(n=s.particleBounce(t,i,e)),n)break;if(n)return;const a=t.getPosition(),r=t.offset,c=t.getRadius(),l=D(a,c),h=o.canvas.size;!function(t){if("bounce"!==t.outMode&&"bounce-horizontal"!==t.outMode&&"bounceHorizontal"!==t.outMode&&"split"!==t.outMode||"left"!==t.direction&&"right"!==t.direction)return;t.bounds.right<0&&"left"===t.direction?t.particle.position.x=t.size+t.offset.x:t.bounds.left>t.canvasSize.width&&"right"===t.direction&&(t.particle.position.x=t.canvasSize.width-t.size-t.offset.x);const e=t.particle.velocity.x;let i=!1;if("right"===t.direction&&t.bounds.right>=t.canvasSize.width&&e>0||"left"===t.direction&&t.bounds.left<=0&&e<0){const e=p(t.particle.options.bounce.horizontal.value);t.particle.velocity.x*=-e,i=!0}if(!i)return;const s=t.offset.x+t.size;t.bounds.right>=t.canvasSize.width&&"right"===t.direction?t.particle.position.x=t.canvasSize.width-s:t.bounds.left<=0&&"left"===t.direction&&(t.particle.position.x=s),"split"===t.outMode&&t.particle.destroy()}({particle:t,outMode:s,direction:e,bounds:l,canvasSize:h,offset:r,size:c}),function(t){if("bounce"!==t.outMode&&"bounce-vertical"!==t.outMode&&"bounceVertical"!==t.outMode&&"split"!==t.outMode||"bottom"!==t.direction&&"top"!==t.direction)return;t.bounds.bottom<0&&"top"===t.direction?t.particle.position.y=t.size+t.offset.y:t.bounds.top>t.canvasSize.height&&"bottom"===t.direction&&(t.particle.position.y=t.canvasSize.height-t.size-t.offset.y);const e=t.particle.velocity.y;let i=!1;if("bottom"===t.direction&&t.bounds.bottom>=t.canvasSize.height&&e>0||"top"===t.direction&&t.bounds.top<=0&&e<0){const e=p(t.particle.options.bounce.vertical.value);t.particle.velocity.y*=-e,i=!0}if(!i)return;const s=t.offset.y+t.size;t.bounds.bottom>=t.canvasSize.height&&"bottom"===t.direction?t.particle.position.y=t.canvasSize.height-s:t.bounds.top<=0&&"top"===t.direction&&(t.particle.position.y=s),"split"===t.outMode&&t.particle.destroy()}({particle:t,outMode:s,direction:e,bounds:l,canvasSize:h,offset:r,size:c})}}class Be{constructor(t){this.container=t,this.modes=["destroy"]}update(t,e,i,s){if(!this.modes.includes(s))return;const o=this.container;switch(t.outType){case"normal":case"outside":if(S(t.position,o.canvas.size,c.origin,t.getRadius(),e))return;break;case"inside":{const{dx:e,dy:i}=y(t.position,t.moveCenter),{x:s,y:o}=t.velocity;if(s<0&&e>t.moveCenter.radius||o<0&&i>t.moveCenter.radius||s>=0&&e<-t.moveCenter.radius||o>=0&&i<-t.moveCenter.radius)return;break}}o.particles.remove(t,void 0,!0)}}class Ue{constructor(t){this.container=t,this.modes=["none"]}update(t,e,i,s){if(!this.modes.includes(s))return;if(t.options.move.distance.horizontal&&("left"===e||"right"===e)||t.options.move.distance.vertical&&("top"===e||"bottom"===e))return;const o=t.options.move.gravity,n=this.container,a=n.canvas.size,r=t.getRadius();if(o.enable){const i=t.position;(!o.inverse&&i.y>a.height+r&&"bottom"===e||o.inverse&&i.y<-r&&"top"===e)&&n.particles.remove(t)}else{if(t.velocity.y>0&&t.position.y<=a.height+r||t.velocity.y<0&&t.position.y>=-r||t.velocity.x>0&&t.position.x<=a.width+r||t.velocity.x<0&&t.position.x>=-r)return;S(t.position,n.canvas.size,c.origin,r,e)||n.particles.remove(t)}}}class Ge{constructor(t){this.container=t,this.modes=["out"]}update(t,e,i,s){if(!this.modes.includes(s))return;const o=this.container;switch(t.outType){case"inside":{const{x:e,y:i}=t.velocity,s=c.origin;s.length=t.moveCenter.radius,s.angle=t.velocity.angle+Math.PI,s.addTo(c.create(t.moveCenter));const{dx:n,dy:a}=y(t.position,s);if(e<=0&&n>=0||i<=0&&a>=0||e>=0&&n<=0||i>=0&&a<=0)return;t.position.x=Math.floor(u({min:0,max:o.canvas.size.width})),t.position.y=Math.floor(u({min:0,max:o.canvas.size.height}));const{dx:r,dy:l}=y(t.position,t.moveCenter);t.direction=Math.atan2(-l,-r),t.velocity.angle=t.direction;break}default:if(S(t.position,o.canvas.size,c.origin,t.getRadius(),e))return;switch(t.outType){case"outside":{t.position.x=Math.floor(u({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.x,t.position.y=Math.floor(u({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.y;const{dx:e,dy:i}=y(t.position,t.moveCenter);t.moveCenter.radius&&(t.direction=Math.atan2(i,e),t.velocity.angle=t.direction);break}case"normal":{const i=t.options.move.warp,s=o.canvas.size,n={bottom:s.height+t.getRadius()+t.offset.y,left:-t.getRadius()-t.offset.x,right:s.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},a=t.getRadius(),r=D(t.position,a);"right"===e&&r.left>s.width+t.offset.x?(t.position.x=n.left,t.initialPosition.x=t.position.x,i||(t.position.y=h()*s.height,t.initialPosition.y=t.position.y)):"left"===e&&r.right<-t.offset.x&&(t.position.x=n.right,t.initialPosition.x=t.position.x,i||(t.position.y=h()*s.height,t.initialPosition.y=t.position.y)),"bottom"===e&&r.top>s.height+t.offset.y?(i||(t.position.x=h()*s.width,t.initialPosition.x=t.position.x),t.position.y=n.top,t.initialPosition.y=t.position.y):"top"===e&&r.bottom<-t.offset.y&&(i||(t.position.x=h()*s.width,t.initialPosition.x=t.position.x),t.position.y=n.bottom,t.initialPosition.y=t.position.y);break}}}}}class qe{constructor(t){this.container=t,this._updateOutMode=(t,e,i,s)=>{for(const o of this.updaters)o.update(t,s,e,i)},this.updaters=[new Ve(t),new Be(t),new Ge(t),new Ue(t)]}init(){}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,e){const i=t.options.move.outModes;this._updateOutMode(t,e,i.bottom??i.default,"bottom"),this._updateOutMode(t,e,i.left??i.default,"left"),this._updateOutMode(t,e,i.right??i.default,"right"),this._updateOutMode(t,e,i.top??i.default,"top")}}class We{init(t){const e=t.container,i=t.options.size.animation;i.enable&&(t.size.velocity=(t.retina.sizeAnimationSpeed??e.retina.sizeAnimationSpeed)/100*e.retina.reduceFactor,i.sync||(t.size.velocity*=h()))}isEnabled(t){return!t.destroyed&&!t.spawning&&t.size.enable&&((t.size.maxLoops??0)<=0||(t.size.maxLoops??0)>0&&(t.size.loops??0)<(t.size.maxLoops??0))}reset(t){t.size.loops=0}update(t,e){this.isEnabled(t)&&function(t,e){const i=t.size;if(t.destroyed||!i||!i.enable||(i.maxLoops??0)>0&&(i.loops??0)>(i.maxLoops??0))return;const s=(i.velocity??0)*e.factor,o=i.min,n=i.max,a=i.decay??1;if(i.time||(i.time=0),(i.delayTime??0)>0&&i.time<(i.delayTime??0)&&(i.time+=e.value),!((i.delayTime??0)>0&&i.time<(i.delayTime??0))){switch(i.status){case"increasing":i.value>=n?(i.status="decreasing",i.loops||(i.loops=0),i.loops++):i.value+=s;break;case"decreasing":i.value<=o?(i.status="increasing",i.loops||(i.loops=0),i.loops++):i.value-=s}i.velocity&&1!==a&&(i.velocity*=a),function(t,e,i,s){switch(t.options.size.animation.destroy){case"max":e>=s&&t.destroy();break;case"min":e<=i&&t.destroy()}}(t,i.value,o,n),t.destroyed||(i.value=d(i.value,o,n))}}(t,e)}}async function $e(t,e=!0){await async function(t,e=!0){await t.addMover("base",(()=>new Ie),e)}(t,!1),await async function(t,e=!0){await t.addShape("circle",new Re,e)}(t,!1),await async function(t,e=!0){await t.addParticleUpdater("color",(t=>new Fe(t)),e)}(t,!1),await async function(t,e=!0){await t.addParticleUpdater("opacity",(t=>new Ae(t)),e)}(t,!1),await async function(t,e=!0){await t.addParticleUpdater("outModes",(t=>new qe(t)),e)}(t,!1),await async function(t,e=!0){await t.addParticleUpdater("size",(()=>new We),e)}(t,!1),await t.refresh(e)}class He{load(t){t&&(void 0!==t.bottom&&(this.bottom=m(t.bottom)),void 0!==t.left&&(this.left=m(t.left)),void 0!==t.right&&(this.right=m(t.right)),void 0!==t.top&&(this.top=m(t.top)))}}class je extends Rt{constructor(){super(),this.value=3}}class Ne extends Rt{constructor(){super(),this.value={min:4,max:9}}}class Xe{constructor(){this.count=1,this.factor=new je,this.rate=new Ne,this.sizeOffset=!0}load(t){t&&(void 0!==t.color&&(this.color=ht.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=E(t.particles,(t=>T({},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 Ye{constructor(){this.bounds=new He,this.mode="none",this.split=new Xe}load(t){t&&(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}function Ze(t,e,i,s){const o=i.options.destroy;if(!o)return;const n=o.split,a=he(t,e,i.options),r=p(n.factor.value),c=i.getFillColor();n.color?a.color.load(n.color):n.colorOffset&&c?a.color.load({value:{hsl:{h:c.h+p(n.colorOffset.h??0),s:c.s+p(n.colorOffset.s??0),l:c.l+p(n.colorOffset.l??0)}}}):a.color.load({value:{hsl:i.getFillColor()}}),a.move.load({center:{x:i.position.x,y:i.position.y,mode:"precise"}}),U(a.size.value)?a.size.value/=r:(a.size.value.min/=r,a.size.value.max/=r),a.load(s);const l=n.sizeOffset?m(-i.size.value,i.size.value):0,h={x:i.position.x+u(l),y:i.position.y+u(l)};return e.particles.addParticle(h,a,i.group,(t=>!(t.size.value<.5)&&(t.velocity.length=u(m(i.velocity.length,t.velocity.length)),t.splitCount=(i.splitCount??0)+1,t.unbreakable=!0,setTimeout((()=>{t.unbreakable=!1}),500),!0)))}class Qe{constructor(t,e){this.engine=t,this.container=e}init(t){const e=this.container,i=t.options.destroy;if(!i)return;t.splitCount=0;const s=i.bounds;t.destroyBounds||(t.destroyBounds={});const{bottom:o,left:n,right:a,top:r}=s,{destroyBounds:c}=t,l=e.canvas.size;o&&(c.bottom=p(o)*l.height/100),n&&(c.left=p(n)*l.width/100),a&&(c.right=p(a)*l.width/100),r&&(c.top=p(r)*l.height/100)}isEnabled(t){return!t.destroyed}loadOptions(t,...e){t.destroy||(t.destroy=new Ye);for(const i of e)t.destroy.load(i?.destroy)}particleDestroyed(t,e){if(e)return;const i=t.options.destroy;i&&"split"===i.mode&&function(t,e,i){const s=i.options.destroy;if(!s)return;const o=s.split;if(o.count>=0&&(void 0===i.splitCount||i.splitCount++>o.count))return;const n=p(o.rate.value),a=I(o.particles);for(let s=0;s<n;s++)Ze(t,e,i,a)}(this.engine,this.container,t)}update(t){if(!this.isEnabled(t))return;const e=t.getPosition(),i=t.destroyBounds;i&&(void 0!==i.bottom&&e.y>=i.bottom||void 0!==i.left&&e.x<=i.left||void 0!==i.right&&e.x>=i.right||void 0!==i.top&&e.y<=i.top)&&t.destroy()}}class Je{constructor(){this.wait=!1}load(t){t&&(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=m(t.delay)),void 0!==t.duration&&(this.duration=m(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class Ke{constructor(){this.quantity=1,this.delay=.1}load(t){void 0!==t&&(void 0!==t.quantity&&(this.quantity=m(t.quantity)),void 0!==t.delay&&(this.delay=m(t.delay)))}}class ti{constructor(){this.color=!1,this.opacity=!1}load(t){t&&(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}class ei{constructor(){this.options={},this.replace=new ti,this.type="square"}load(t){t&&(void 0!==t.options&&(this.options=T({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}class ii{constructor(){this.mode="percent",this.height=0,this.width=0}load(t){void 0!==t&&(void 0!==t.mode&&(this.mode=t.mode),void 0!==t.height&&(this.height=t.height),void 0!==t.width&&(this.width=t.width))}}class si{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new Je,this.rate=new Ke,this.shape=new ei,this.startCount=0}load(t){t&&(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(this.size||(this.size=new ii),this.size.load(t.size)),void 0!==t.direction&&(this.direction=t.direction),this.domId=t.domId,void 0!==t.fill&&(this.fill=t.fill),this.life.load(t.life),this.name=t.name,this.particles=E(t.particles,(t=>T({},t))),this.rate.load(t.rate),this.shape.load(t.shape),void 0!==t.position&&(this.position={},void 0!==t.position.x&&(this.position.x=m(t.position.x)),void 0!==t.position.y&&(this.position.y=m(t.position.y))),void 0!==t.spawnColor&&(void 0===this.spawnColor&&(this.spawnColor=new Tt),this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}function oi(t,e){t.color?t.color.value=e:t.color={value:e}}class ni{constructor(t,e,i,s,o){this.emitters=e,this.container=i,this._destroy=()=>{this._mutationObserver?.disconnect(),this._mutationObserver=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0,this.emitters.removeEmitter(this),this._engine.dispatchEvent("emitterDestroyed",{container:this.container,data:{emitter:this}})},this._prepareToDie=()=>{if(this._paused)return;const t=void 0!==this.options.life?.duration?p(this.options.life.duration):void 0;this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal)&&void 0!==t&&t>0&&(this._duration=1e3*t)},this._setColorAnimation=(t,e,i)=>{const s=this.container;if(!t.enable)return e;const o=u(t.offset),n=1e3*p(this.options.rate.delay)/s.retina.reduceFactor;return(e+p(t.speed??0)*s.fpsLimit/n+3.6*o)%i},this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=o,s instanceof si?this.options=s:(this.options=new si,this.options.load(s)),this._spawnDelay=1e3*p(this.options.life.delay??0)/this.container.retina.reduceFactor,this.position=this._initialPosition??this._calcPosition(),this.name=this.options.name,this.fill=this.options.fill,this._firstSpawn=!this.options.life.wait,this._startParticlesAdded=!1;let n=T({},this.options.particles);if(n??={},n.move??={},n.move.direction??=this.options.direction,this.options.spawnColor&&(this.spawnColor=Y(this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=n,this._size=this._calcSize(),this.size=A(this._size,this.container.canvas.size),this._lifeCount=this.options.life.count??-1,this._immortal=this._lifeCount<=0,this.options.domId){const t=document.getElementById(this.options.domId);t&&(this._mutationObserver=new MutationObserver((()=>{this.resize()})),this._resizeObserver=new ResizeObserver((()=>{this.resize()})),this._mutationObserver.observe(t,{attributes:!0,attributeFilter:["style","width","height"]}),this._resizeObserver.observe(t))}const a=this.options.shape,r=this._engine.emitterShapeManager?.getShapeGenerator(a.type);r&&(this._shape=r.generate(this.position,this.size,this.fill,a.options)),this._engine.dispatchEvent("emitterCreated",{container:i,data:{emitter:this}}),this.play()}externalPause(){this._paused=!0,this.pause()}externalPlay(){this._paused=!1,this.play()}async init(){await(this._shape?.init())}pause(){this._paused||delete this._emitDelay}play(){if(!this._paused&&this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal||!this.options.life.count)&&(this._firstSpawn||this._currentSpawnDelay>=(this._spawnDelay??0))){if(void 0===this._emitDelay){const t=p(this.options.rate.delay);this._emitDelay=1e3*t/this.container.retina.reduceFactor}(this._lifeCount>0||this._immortal)&&this._prepareToDie()}}resize(){const t=this._initialPosition;this.position=t&&S(t,this.container.canvas.size,c.origin)?t:this._calcPosition(),this._size=this._calcSize(),this.size=A(this._size,this.container.canvas.size),this._shape?.resize(this.position,this.size)}async update(t){this._paused||(this._firstSpawn&&(this._firstSpawn=!1,this._currentSpawnDelay=this._spawnDelay??0,this._currentEmitDelay=this._emitDelay??0),this._startParticlesAdded||(this._startParticlesAdded=!0,await this._emitParticles(this.options.startCount)),void 0!==this._duration&&(this._currentDuration+=t.value,this._currentDuration>=this._duration&&(this.pause(),void 0!==this._spawnDelay&&delete this._spawnDelay,this._immortal||this._lifeCount--,this._lifeCount>0||this._immortal?(this.position=this._calcPosition(),this._spawnDelay=1e3*p(this.options.life.delay??0)/this.container.retina.reduceFactor):this._destroy(),this._currentDuration-=this._duration,delete this._duration)),void 0!==this._spawnDelay&&(this._currentSpawnDelay+=t.value,this._currentSpawnDelay>=this._spawnDelay&&(this._engine.dispatchEvent("emitterPlay",{container:this.container}),this.play(),this._currentSpawnDelay-=this._currentSpawnDelay,delete this._spawnDelay)),void 0!==this._emitDelay&&(this._currentEmitDelay+=t.value,this._currentEmitDelay>=this._emitDelay&&(this._emit(),this._currentEmitDelay-=this._emitDelay)))}_calcPosition(){if(this.options.domId){const t=this.container,e=document.getElementById(this.options.domId);if(e){const i=e.getBoundingClientRect();return{x:(i.x+i.width/2)*t.retina.pixelRatio,y:(i.y+i.height/2)*t.retina.pixelRatio}}}return _({size:this.container.canvas.size,position:this.options.position})}_calcSize(){const t=this.container;if(this.options.domId){const e=document.getElementById(this.options.domId);if(e){const i=e.getBoundingClientRect();return{width:i.width*t.retina.pixelRatio,height:i.height*t.retina.pixelRatio,mode:"precise"}}}return this.options.size??(()=>{const t=new ii;return t.load({height:0,mode:"percent",width:0}),t})()}async _emit(){if(this._paused)return;const t=p(this.options.rate.quantity);await this._emitParticles(t)}async _emitParticles(t){const e=I(this._particlesOptions);for(let i=0;i<t;i++){const t=T({},e);if(this.spawnColor){const e=this.options.spawnColor?.animation;e&&(this.spawnColor.h=this._setColorAnimation(e.h,this.spawnColor.h,360),this.spawnColor.s=this._setColorAnimation(e.s,this.spawnColor.s,100),this.spawnColor.l=this._setColorAnimation(e.l,this.spawnColor.l,100)),oi(t,this.spawnColor)}const i=this.options.shape;let s=this.position;if(this._shape){const e=await this._shape.randomPosition();if(e){s=e.position;const o=i.replace;o.color&&e.color&&oi(t,e.color),o.opacity&&(t.opacity?t.opacity.value=e.opacity:t.opacity={value:e.opacity})}else s=null}s&&this.container.particles.addParticle(s,t)}}}class ai{constructor(t,e){this.container=e,this._engine=t,this.array=[],this.emitters=[],this.interactivityEmitters={random:{count:1,enable:!1},value:[]},e.getEmitter=t=>void 0===t||U(t)?this.array[t||0]:this.array.find((e=>e.name===t)),e.addEmitter=async(t,e)=>this.addEmitter(t,e),e.removeEmitter=t=>{const i=e.getEmitter(t);i&&this.removeEmitter(i)},e.playEmitter=t=>{const i=e.getEmitter(t);i&&i.externalPlay()},e.pauseEmitter=t=>{const i=e.getEmitter(t);i&&i.externalPause()}}async addEmitter(t,e){const i=new si;i.load(t);const s=new ni(this._engine,this,this.container,i,e);return await s.init(),this.array.push(s),s}handleClickMode(t){const e=this.emitters,i=this.interactivityEmitters;if("emitter"!==t)return;let s;if(i&&q(i.value))if(i.value.length>0&&i.random.enable){s=[];const t=[];for(let e=0;e<i.random.count;e++){const o=k(i.value);t.includes(o)&&t.length<i.value.length?e--:(t.push(o),s.push(O(i.value,o)))}}else s=i.value;else s=i?.value;const o=s??e,n=this.container.interactivity.mouse.clickPosition;E(o,(t=>{this.addEmitter(t,n)}))}async init(){if(this.emitters=this.container.actualOptions.emitters,this.interactivityEmitters=this.container.actualOptions.interactivity.modes.emitters,this.emitters)if(q(this.emitters))for(const t of this.emitters)await this.addEmitter(t);else await this.addEmitter(this.emitters)}pause(){for(const t of this.array)t.pause()}play(){for(const t of this.array)t.play()}removeEmitter(t){const e=this.array.indexOf(t);e>=0&&this.array.splice(e,1)}resize(){for(const t of this.array)t.resize()}stop(){this.array=[]}async update(t){for(const e of this.array)await e.update(t)}}const ri=new Map;class ci{constructor(t){this._engine=t}addShapeGenerator(t,e){this.getShapeGenerator(t)||ri.set(t,e)}getShapeGenerator(t){return ri.get(t)}getSupportedShapeGenerators(){return ri.keys()}}class li{constructor(t){this._engine=t,this.id="emitters"}getPlugin(t){return new ai(this._engine,t)}loadOptions(t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;e?.emitters&&(t.emitters=E(e.emitters,(t=>{const e=new si;return e.load(t),e})));const i=e?.interactivity?.modes?.emitters;if(i)if(q(i))t.interactivity.modes.emitters={random:{count:1,enable:!0},value:i.map((t=>{const e=new si;return e.load(t),e}))};else{const e=i;if(void 0!==e.value)if(q(e.value))t.interactivity.modes.emitters={random:{count:e.random.count??1,enable:e.random.enable??!1},value:e.value.map((t=>{const e=new si;return e.load(t),e}))};else{const i=new si;i.load(e.value),t.interactivity.modes.emitters={random:{count:e.random.count??1,enable:e.random.enable??!1},value:i}}else{(t.interactivity.modes.emitters={random:{count:1,enable:!1},value:new si}).value.load(i)}}}needsPlugin(t){if(!t)return!1;const e=t.emitters;return q(e)&&!!e.length||void 0!==e||!!t.interactivity?.events?.onClick?.mode&&P("emitter",t.interactivity.events.onClick.mode)}}class hi extends Rt{constructor(){super(),this.sync=!1}load(t){t&&(super.load(t),void 0!==t.sync&&(this.sync=t.sync))}}class di extends Rt{constructor(){super(),this.sync=!1}load(t){t&&(super.load(t),void 0!==t.sync&&(this.sync=t.sync))}}class ui{constructor(){this.count=0,this.delay=new hi,this.duration=new di}load(t){t&&(void 0!==t.count&&(this.count=t.count),this.delay.load(t.delay),this.duration.load(t.duration))}}class pi{constructor(t){this.container=t}init(t){const e=this.container,i=t.options.life;i&&(t.life={delay:e.retina.reduceFactor?p(i.delay.value)*(i.delay.sync?1:h())/e.retina.reduceFactor*1e3:0,delayTime:0,duration:e.retina.reduceFactor?p(i.duration.value)*(i.duration.sync?1:h())/e.retina.reduceFactor*1e3:0,time:0,count:i.count},t.life.duration<=0&&(t.life.duration=-1),t.life.count<=0&&(t.life.count=-1),t.life&&(t.spawning=t.life.delay>0))}isEnabled(t){return!t.destroyed}loadOptions(t,...e){t.life||(t.life=new ui);for(const i of e)t.life.load(i?.life)}update(t,e){if(!this.isEnabled(t)||!t.life)return;const i=t.life;let s=!1;if(t.spawning){if(i.delayTime+=e.value,!(i.delayTime>=t.life.delay))return;s=!0,t.spawning=!1,i.delayTime=0,i.time=0}if(-1===i.duration)return;if(t.spawning)return;if(s?i.time=0:i.time+=e.value,i.time<i.duration)return;if(i.time=0,t.life.count>0&&t.life.count--,0===t.life.count)return void t.destroy();const o=this.container.canvas.size,n=m(0,o.width),a=m(0,o.width);t.position.x=u(n),t.position.y=u(a),t.spawning=!0,i.delayTime=0,i.time=0,t.reset();const r=t.options.life;r&&(i.delay=1e3*p(r.delay.value),i.duration=1e3*p(r.duration.value))}}class fi{draw(t){const{context:e,particle:i,radius:s}=t,o=i.shapeData;e.moveTo(-s/2,0),e.lineTo(s/2,0),e.lineCap=o?.cap??"butt"}getSidesCount(){return 1}}class vi{constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=m(t.speed)),void 0!==t.decay&&(this.decay=m(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class mi extends Rt{constructor(){super(),this.animation=new vi,this.direction="clockwise",this.path=!1,this.value=0}load(t){t&&(super.load(t),void 0!==t.direction&&(this.direction=t.direction),this.animation.load(t.animation),void 0!==t.path&&(this.path=t.path))}}class yi{constructor(t){this.container=t}init(t){const e=t.options.rotate;if(!e)return;t.rotate={enable:e.animation.enable,value:p(e.value)*Math.PI/180},t.pathRotation=e.path;let i=e.direction;if("random"===i){i=Math.floor(2*h())>0?"counter-clockwise":"clockwise"}switch(i){case"counter-clockwise":case"counterClockwise":t.rotate.status="decreasing";break;case"clockwise":t.rotate.status="increasing"}const s=e.animation;s.enable&&(t.rotate.decay=1-p(s.decay),t.rotate.velocity=p(s.speed)/360*this.container.retina.reduceFactor,s.sync||(t.rotate.velocity*=h())),t.rotation=t.rotate.value}isEnabled(t){const e=t.options.rotate;return!!e&&(!t.destroyed&&!t.spawning&&e.animation.enable&&!e.path)}loadOptions(t,...e){t.rotate||(t.rotate=new mi);for(const i of e)t.rotate.load(i?.rotate)}update(t,e){this.isEnabled(t)&&(!function(t,e){const i=t.rotate,s=t.options.rotate;if(!i||!s)return;const o=s.animation,n=(i.velocity??0)*e.factor,a=2*Math.PI,r=i.decay??1;o.enable&&("increasing"===i.status?(i.value+=n,i.value>a&&(i.value-=a)):(i.value-=n,i.value<0&&(i.value+=a)),i.velocity&&1!==r&&(i.velocity*=r))}(t,e),t.rotation=t.rotate?.value??0)}}class gi{constructor(){this.loop=!1,this.source=""}load(t){void 0!==t&&(G(t)?(void 0!==t.loop&&(this.loop=t.loop),void 0!==t.source&&(this.source=t.source)):this.source=t)}}class _i{constructor(){this.duration=500,this.value=[]}load(t){t&&(void 0!==t.duration&&(this.duration=t.duration),void 0!==t.value&&(this.value=t.value))}}class wi{constructor(){this.loop=!1,this.melodies=[],this.notes=[]}load(t){void 0!==t&&(void 0!==t.loop&&(this.loop=t.loop),void 0!==t.melodies&&(this.melodies=t.melodies.map((t=>{const e=new wi;return e.load(t),e}))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const e=new _i;return e.load(t),e}))))}}class bi{constructor(){this.event=[],this.notes=[]}load(t){t&&(void 0!==t.event&&(this.event=t.event),void 0!==t.audio&&(q(t.audio)?this.audio=t.audio.map((t=>{const e=new gi;return e.load(t),e})):(this.audio=new gi,this.audio.load(t.audio))),void 0!==t.notes&&(this.notes=t.notes.map((t=>{const e=new _i;return e.load(t),e}))),void 0!==t.melodies&&(this.melodies=t.melodies.map((t=>{const e=new wi;return e.load(t),e}))),void 0!==t.filter&&(B(t.filter)?"function"==typeof window[t.filter]&&(this.filter=window[t.filter]):this.filter=t.filter))}}class xi{constructor(){this.width=24,this.height=24}load(t){t&&(void 0!==t.path&&(this.path=t.path),void 0!==t.svg&&(this.svg=t.svg),void 0!==t.width&&(this.width=t.width),void 0!==t.height&&(this.height=t.height))}}class zi{constructor(){this.mute=new xi,this.unmute=new xi,this.volumeDown=new xi,this.volumeUp=new xi,this.mute.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M19.707,5.293c-0.391-0.391-1.023-0.391-1.414,0l-1.551,1.551c-0.345-0.688-0.987-1.02-1.604-1.02c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.237,0.754,2.302,1.826,2.76l-1.533,1.533c-0.391,0.391-0.391,1.023,0,1.414C5.488,19.902,5.744,20,6,20s0.512-0.098,0.707-0.293l2.527-2.527c0.697,0.174,1.416,0.455,1.875,0.762l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V9.414l2.707-2.707C20.098,6.316,20.098,5.684,19.707,5.293z M14.891,7.941c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8v1.293l-2,2V9.202L14.891,7.941z M7,12c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v2.439l-2.83,2.83C8.757,15.046,8.356,15,8,15c-0.552,0-1-0.448-1-1V12z M10.301,15.406L12,13.707v2.439C11.519,15.859,10.925,15.604,10.301,15.406z M14.994,18.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798v-4.091l2-2V18C15,18.046,14.998,18.086,14.994,18.12z"/>\n </g>\n</svg>',this.unmute.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M17.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C12.357,8.561,10.904,9,10,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C18.035,20.176,19,19.495,19,18V8C19,6.505,18.035,5.824,17.138,5.824z M14,16.146C12.907,15.495,11.211,15,10,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146V16.146z M17,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L15,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C16.998,7.914,17,7.954,17,8V18z"/>\n </g>\n</svg>',this.volumeDown.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M15.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V8C17,6.505,16.035,5.824,15.138,5.824z M8,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C10.907,15.495,9.211,15,8,15z M15,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8V18z"/>\n <path fill="#fff" d="M18.292,10.294c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C18.488,15.902,18.744,16,19,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708s-0.398-1.984-1.123-2.707C19.317,9.903,18.683,9.901,18.292,10.294z"/>\n </g>\n</svg>',this.volumeUp.svg='<?xml version="1.0"?>\n<svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"\n xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Layer_1">\n <path fill="#fff" d="M16.706,10.292c-0.389-0.389-1.023-0.391-1.414,0.002c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C15.488,15.902,15.744,16,16,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708S17.431,11.015,16.706,10.292z"/>\n <path fill="#fff" d="M18.706,8.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c0.879,0.877,1.363,2.044,1.364,3.287c0.001,1.246-0.484,2.417-1.365,3.298c-0.391,0.391-0.391,1.023,0,1.414C17.488,17.902,17.744,18,18,18s0.512-0.098,0.707-0.293c1.259-1.259,1.952-2.933,1.951-4.713C20.657,11.217,19.964,9.547,18.706,8.292z"/>\n <path fill="#fff" d="M20.706,6.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c1.412,1.409,2.191,3.285,2.192,5.284c0.002,2.002-0.777,3.885-2.193,5.301c-0.391,0.391-0.391,1.023,0,1.414C19.488,19.902,19.744,20,20,20s0.512-0.098,0.707-0.293c1.794-1.794,2.781-4.18,2.779-6.717C23.485,10.457,22.497,8.078,20.706,6.292z"/>\n <path fill="#fff" d="M12.138,5.824c-0.449,0-0.905,0.152-1.356,0.453L8.109,8.059C7.357,8.561,5.904,9,5,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C13.035,20.176,14,19.495,14,18V8C14,6.505,13.035,5.824,12.138,5.824z M5,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C7.907,15.495,6.211,15,5,15z M12,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L10,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C11.998,7.914,12,7.954,12,8V18z"/>\n </g>\n</svg>'}load(t){t&&(this.mute.load(t.mute),this.unmute.load(t.unmute),this.volumeDown.load(t.volumeDown),this.volumeUp.load(t.volumeUp))}}class Mi{constructor(){this.value=100,this.max=100,this.min=0,this.step=10}load(t){void 0!==t&&(G(t)?(void 0!==t.max&&(this.max=t.max),void 0!==t.min&&(this.min=t.min),void 0!==t.step&&(this.step=t.step),void 0!==t.value&&(this.value=t.value)):this.value=t)}}class Ci{constructor(){this.enable=!1,this.events=[],this.icons=new zi,this.volume=new Mi}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.events&&(this.events=t.events.map((t=>{const e=new bi;return e.load(t),e}))),this.icons.load(t.icons),void 0!==t.volume&&this.volume.load(t.volume))}}const Pi=new Map;function ki(t){const e=/(([A-G]b?)(\d))|pause/i.exec(t);if(!e||!e.length)return;const i=e[2]||e[0],s=Pi.get(i);return s?s[parseInt(e[3]||"0")]:void 0}function Oi(t){const e=document.createElement("img"),{clickCb:i,container:s,display:o,iconOptions:n,margin:a,options:r,pos:c,rightOffsets:l}=t,{width:h,path:d,svg:u}=n;!function(t,e,i,s,o,n,a){t.style.userSelect="none",t.style.webkitUserSelect="none",t.style.position="absolute",t.style.top=`${e+a}px`,t.style.left=i-a-n+"px",t.style.display=s,t.style.zIndex=`${o+1}`}(e,c.top+a,c.right-(a*(l.length+1)+h+l.reduce(((t,e)=>t+e),0)),o,r.fullScreen.zIndex+1,h,a),e.src=d??(u?`data:image/svg+xml;base64,${btoa(u)}`:"");return(s.canvas.element?.parentNode||document.body).append(e),e.addEventListener("click",i),e}function Si(t){t&&t.remove()}Pi.set("C",[16.35,32.7,65.41,130.81,261.63,523.25,1046.5,2093,4186.01]),Pi.set("Db",[17.32,34.65,69.3,138.59,277.18,554.37,1108.73,2217.46,4434.92]),Pi.set("D",[18.35,36.71,73.42,146.83,293.66,587.33,1174.66,2349.32,4698.63]),Pi.set("Eb",[19.45,38.89,77.78,155.56,311.13,622.25,1244.51,2489.02,4978.03]),Pi.set("E",[20.6,41.2,82.41,164.81,329.63,659.25,1318.51,2637.02,5274.04]),Pi.set("F",[21.83,43.65,87.31,174.61,349.23,698.46,1396.91,2793.83,5587.65]),Pi.set("Gb",[23.12,46.25,92.5,185,369.99,739.99,1479.98,2959.96,5919.91]),Pi.set("G",[24.5,49,98,196,392,783.99,1567.98,3135.96,6271.93]),Pi.set("Ab",[25.96,51.91,103.83,207.65,415.3,830.61,1661.22,3322.44,6644.88]),Pi.set("A",[27.5,55,110,220,440,880,1760,3520,7040]),Pi.set("Bb",[29.14,58.27,116.54,233.08,466.16,932.33,1864.66,3729.31,7458.62]),Pi.set("B",[30.87,61.74,123.47,246.94,493.88,987.77,1975.53,3951.07,7902.13]),Pi.set("pause",[0]);class Di{constructor(t,e){this._addBuffer=t=>{const e=t.createBufferSource();return this._audioSources.push(e),e},this._addOscillator=t=>{const e=t.createOscillator();return this._audioSources.push(e),e},this._initEvents=()=>{const t=this._container,e=t.actualOptions.sounds;if(e?.enable&&t.canvas.element)for(const t of e.events){const e=async i=>{if(this._container===i.container)if(!this._container||this._container.muted||this._container.destroyed)E(t.event,(t=>{this._engine.removeEventListener(t,e)}));else if(!t.filter||t.filter(i))if(t.audio)this._playBuffer(I(t.audio));else if(t.melodies){const e=O(t.melodies);e.melodies.length?await Promise.allSettled(e.melodies.map((t=>this._playNote(t.notes,0,e.loop)))):await this._playNote(e.notes,0,e.loop)}else if(t.notes){const e=O(t.notes);await this._playNote([e],0,!1)}};E(t.event,(t=>{this._engine.addEventListener(t,e)}))}},this._mute=()=>{const t=this._container;if(t.audioContext){for(const t of this._audioSources)this._removeAudioSource(t);this._gain&&this._gain.disconnect(),t.audioContext.close(),t.audioContext=void 0,this._engine.dispatchEvent("soundsMuted",{container:this._container})}},this._playBuffer=t=>{const e=this._audioMap.get(t.source);if(!e)return;const i=this._container.audioContext;if(!i)return;const s=this._addBuffer(i);s.loop=t.loop,s.buffer=e,s.connect(this._gain??i.destination),s.start()},this._playFrequency=async(t,e)=>{if(!this._container.audioContext||!this._gain)return;const i=this._addOscillator(this._container.audioContext);return i.connect(this._gain),i.type="sine",i.frequency.value=t,i.start(),new Promise((t=>{setTimeout((()=>{this._removeAudioSource(i),t()}),e)}))},this._playMuteSound=()=>{const t=this._container;if(!t.audioContext)return;const e=t.audioContext.createGain();e.connect(t.audioContext.destination),e.gain.value=0;const i=t.audioContext.createOscillator();i.connect(e),i.type="sine",i.frequency.value=1,i.start(),setTimeout((()=>{i.stop(),i.disconnect(),e.disconnect()}))},this._playNote=async(t,e,i)=>{if(this._container.muted)return;const s=t[e];if(!s)return;const o=E(s.value,(async(i,s)=>this._playNoteValue(t,e,s)));await(q(o)?Promise.allSettled(o):o);let n=e+1;i&&n>=t.length&&(n%=t.length),this._container.muted||await this._playNote(t,n,i)},this._playNoteValue=async(t,e,i)=>{const s=t[e];if(!s)return;const o=I(s.value,i,!0);try{const t=ki(o);if(!U(t))return;await this._playFrequency(t,s.duration)}catch(t){z().error(t)}},this._removeAudioSource=t=>{t.stop(),t.disconnect(),this._audioSources.splice(this._audioSources.indexOf(t),1)},this._unmute=()=>{const t=this._container,e=t.actualOptions.sounds;if(!e)return;t.audioContext||(t.audioContext=new AudioContext);const{audioContext:i}=t;this._audioSources||(this._audioSources=[]);const s=i.createGain();s.connect(i.destination),s.gain.value=e.volume.value/100,this._gain=s,this._initEvents(),this._engine.dispatchEvent("soundsUnmuted",{container:this._container})},this._updateMuteIcons=()=>{const t=this._container,e=this._muteImg,i=this._unmuteImg;e&&(e.style.display=t.muted?"block":"none"),i&&(i.style.display=t.muted?"none":"block")},this._updateMuteStatus=()=>{this._container.muted?this._mute():(this._unmute(),this._playMuteSound())},this._updateVolume=()=>{const t=this._container,e=t.actualOptions.sounds;if(!e?.enable)return;d(this._volume,e.volume.min,e.volume.max);let i=!1;this._volume<=0&&!t.muted?(this._volume=0,t.muted=!0,i=!0):this._volume>0&&t.muted&&(t.muted=!1,i=!0),i&&(this._updateMuteIcons(),this._updateMuteStatus()),this._gain?.gain&&(this._gain.gain.value=this._volume/100)},this._container=t,this._engine=e,this._volume=0,this._audioSources=[],this._audioMap=new Map}async init(){const t=this._container,e=t.actualOptions.sounds;if(!e?.enable)return;this._volume=e.volume.value;const i=e.events;this._audioMap=new Map;for(const e of i)e.audio&&E(e.audio,(async e=>{const i=await fetch(e.source);if(!i.ok)return;const s=await i.arrayBuffer();t.audioContext=new AudioContext;const o=await t.audioContext.decodeAudioData(s);this._audioMap.set(e.source,o)}))}async start(){const t=this._container,e=t.actualOptions,i=e.sounds;if(!i?.enable||!t.canvas.element)return;t.muted=!0;const s=t.canvas.element,o={top:s.offsetTop,right:s.offsetLeft+s.offsetWidth},{mute:n,unmute:a,volumeDown:r,volumeUp:c}=i.icons,l=()=>{t.muted=!t.muted,this._updateMuteIcons(),this._updateMuteStatus()};this._muteImg=Oi({container:t,options:e,pos:o,display:"block",iconOptions:n,margin:10,rightOffsets:[r.width,c.width],clickCb:l}),this._unmuteImg=Oi({container:t,options:e,pos:o,display:"none",iconOptions:a,margin:10,rightOffsets:[r.width,c.width],clickCb:l}),this._volumeDownImg=Oi({container:t,options:e,pos:o,display:"block",iconOptions:r,margin:10,rightOffsets:[c.width],clickCb:()=>{t.muted&&(this._volume=0),this._volume-=i.volume.step,this._updateVolume()}}),this._volumeUpImg=Oi({container:t,options:e,pos:o,display:"block",iconOptions:c,margin:10,rightOffsets:[],clickCb:()=>{t.muted&&(this._volume=0),this._volume+=i.volume.step,this._updateVolume()}})}stop(){this._container.muted=!0,this._mute(),Si(this._muteImg),Si(this._unmuteImg),Si(this._volumeDownImg),Si(this._volumeUpImg)}}class Ti{constructor(t){this.id="sounds",this._engine=t}getPlugin(t){return new Di(t,this._engine)}loadOptions(t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let i=t.sounds;void 0===i?.load&&(t.sounds=i=new Ci),i.load(e?.sounds)}needsPlugin(t){return t?.sounds?.enable??!1}}function Ei(t,e,i,s,o){if(!e||!i.enable||(e.maxLoops??0)>0&&(e.loops??0)>(e.maxLoops??0))return;if(e.time||(e.time=0),(e.delayTime??0)>0&&e.time<(e.delayTime??0)&&(e.time+=t.value),(e.delayTime??0)>0&&e.time<(e.delayTime??0))return;const n=u(i.offset),a=(e.velocity??0)*t.factor+3.6*n,r=e.decay??1;o&&"increasing"!==e.status?(e.value-=a,e.value<0&&(e.loops||(e.loops=0),e.loops++,e.status="increasing",e.value+=e.value)):(e.value+=a,e.value>s&&(e.loops||(e.loops=0),e.loops++,o&&(e.status="decreasing",e.value-=e.value%s))),e.velocity&&1!==r&&(e.velocity*=r),e.value>s&&(e.value%=s)}class Ii{constructor(t){this.container=t}init(t){const e=this.container,i=t.options,s=I(i.stroke,t.id,i.reduceDuplicates);t.strokeWidth=p(s.width)*e.retina.pixelRatio,t.strokeOpacity=p(s.opacity??1),t.strokeAnimation=s.color?.animation;const o=Y(s.color)??t.getFillColor();o&&(t.strokeColor=st(o,t.strokeAnimation,e.retina.reduceFactor))}isEnabled(t){const e=t.strokeAnimation,{strokeColor:i}=t;return!t.destroyed&&!t.spawning&&!!e&&(void 0!==i?.h.value&&i.h.enable||void 0!==i?.s.value&&i.s.enable||void 0!==i?.l.value&&i.l.enable)}update(t,e){this.isEnabled(t)&&function(t,e){if(!t.strokeColor||!t.strokeAnimation)return;const{h:i,s,l:o}=t.strokeColor,{h:n,s:a,l:r}=t.strokeAnimation;i&&Ei(e,i,n,360,!1),s&&Ei(e,s,a,100,!0),o&&Ei(e,o,r,100,!0)}(t,e)}}const Ri=(t,e,i)=>{const s=t.max>i?t.max-i:0;let o=m(t);s&&(o=m(t.min-s,i));const n=t.min<e?t.min:0;return n&&(o=m(0,t.max+n)),o},Li={detectRetina:!0,background:{color:"#000"},fpsLimit:120,emitters:{direction:"top",life:{count:0,duration:.1,delay:.1},rate:{delay:.05,quantity:1},size:{width:100,height:0},position:{y:100,x:50}},particles:{number:{value:0},destroy:{mode:"split",bounds:{top:{min:10,max:30}},split:{sizeOffset:!1,count:1,factor:{value:.333333},rate:{value:{min:75,max:150}},particles:["#ff595e","#ffca3a","#8ac926","#1982c4","#6a4c93"].map((t=>{const e=Q(t);if(!e)return;const i=Z(e),s=Ri({min:i.s-30,max:i.s+30},0,100),o=Ri({min:i.l-30,max:i.l+30},0,100);return{color:{value:{h:i.h,s,l:o}},stroke:{width:0},number:{value:0},opacity:{value:{min:.1,max:1},animation:{enable:!0,speed:.7,sync:!1,startValue:"max",destroy:"min"}},shape:{type:"circle"},size:{value:{min:1,max:2},animation:{enable:!0,speed:5,count:1,sync:!1,startValue:"min",destroy:"none"}},life:{count:1,duration:{value:{min:1,max:2}}},move:{decay:{min:.075,max:.1},enable:!0,gravity:{enable:!0,inverse:!1,acceleration:5},speed:{min:5,max:15},direction:"none",outModes:"destroy"}}})).filter((t=>void 0!==t))}},life:{count:1},shape:{type:"line"},size:{value:{min:.1,max:50},animation:{enable:!0,sync:!0,speed:90,startValue:"max",destroy:"min"}},stroke:{color:{value:"#ffffff"},width:1},rotate:{path:!0},move:{enable:!0,gravity:{acceleration:15,enable:!0,inverse:!0,maxSpeed:100},speed:{min:10,max:20},outModes:{default:"destroy",top:"none"},trail:{fill:{color:"#000"},enable:!0,length:10}}},sounds:{enable:!0,events:[{event:"particleRemoved",filter:t=>"line"===t.data.particle.shape,audio:["https://particles.js.org/audio/explosion0.mp3","https://particles.js.org/audio/explosion1.mp3","https://particles.js.org/audio/explosion2.mp3"]}],volume:50}};async function Fi(t,e=!0){await $e(t,!1),await async function(t,e=!0){t.emitterShapeManager||(t.emitterShapeManager=new ci(t)),t.addEmitterShapeGenerator||(t.addEmitterShapeGenerator=(e,i)=>{t.emitterShapeManager?.addShapeGenerator(e,i)});const i=new li(t);await t.addPlugin(i,e)}(t,!1),await async function(t,e=!0){await t.addPlugin(new Ti(t),e)}(t,!1),await async function(t,e=!0){await t.addShape("line",new fi,e)}(t,!1),await async function(t,e=!0){await t.addParticleUpdater("rotate",(t=>new yi(t)),e)}(t,!1),await async function(t,e=!0){await t.addParticleUpdater("destroy",(e=>new Qe(t,e)),e)}(t,!1),await async function(t,e=!0){await t.addParticleUpdater("life",(t=>new pi(t)),e)}(t,!1),await async function(t,e=!0){await t.addParticleUpdater("strokeColor",(t=>new Ii(t)),e)}(t,!1),await t.addPreset("fireworks",Li,e)}return Fi(Te),e})()));
|