@tsparticles/engine 3.2.1 → 3.2.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.
Files changed (117) hide show
  1. package/373.min.js +1 -1
  2. package/373.min.js.LICENSE.txt +1 -1
  3. package/438.min.js +1 -1
  4. package/438.min.js.LICENSE.txt +1 -1
  5. package/browser/Core/Container.js +1 -1
  6. package/browser/Core/Engine.js +1 -1
  7. package/browser/Core/Particle.js +1 -2
  8. package/browser/Core/Particles.js +1 -1
  9. package/browser/Core/Utils/EventListeners.js +4 -3
  10. package/browser/Core/Utils/QuadTree.js +4 -5
  11. package/browser/Core/Utils/Ranges.js +55 -0
  12. package/browser/Core/Utils/{Vector3d.js → Vectors.js} +15 -1
  13. package/browser/Options/Classes/AnimatableColor.js +1 -1
  14. package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
  15. package/browser/Options/Classes/Options.js +2 -1
  16. package/browser/Options/Classes/OptionsColor.js +1 -1
  17. package/browser/Options/Classes/Particles/Move/Move.js +1 -1
  18. package/browser/Types/RangeType.js +1 -0
  19. package/browser/Utils/ColorUtils.js +2 -1
  20. package/browser/Utils/NumberUtils.js +2 -2
  21. package/browser/Utils/TypeUtils.js +18 -0
  22. package/browser/Utils/Utils.js +2 -19
  23. package/browser/exports.js +3 -5
  24. package/cjs/Core/Container.js +1 -1
  25. package/cjs/Core/Engine.js +1 -1
  26. package/cjs/Core/Particle.js +4 -5
  27. package/cjs/Core/Particles.js +2 -2
  28. package/cjs/Core/Utils/EventListeners.js +4 -3
  29. package/cjs/Core/Utils/QuadTree.js +7 -8
  30. package/cjs/Core/Utils/Ranges.js +61 -0
  31. package/cjs/Core/Utils/{Vector3d.js → Vectors.js} +18 -3
  32. package/cjs/Options/Classes/AnimatableColor.js +2 -2
  33. package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +2 -2
  34. package/cjs/Options/Classes/Options.js +2 -1
  35. package/cjs/Options/Classes/OptionsColor.js +2 -2
  36. package/cjs/Options/Classes/Particles/Move/Move.js +4 -4
  37. package/cjs/Types/RangeType.js +2 -0
  38. package/cjs/Utils/ColorUtils.js +9 -8
  39. package/cjs/Utils/NumberUtils.js +9 -9
  40. package/cjs/Utils/TypeUtils.js +27 -0
  41. package/cjs/Utils/Utils.js +13 -36
  42. package/cjs/exports.js +3 -5
  43. package/dist_browser_Core_Container_js.js +5 -5
  44. package/dist_browser_Core_Particle_js.js +2 -2
  45. package/esm/Core/Container.js +1 -1
  46. package/esm/Core/Engine.js +1 -1
  47. package/esm/Core/Particle.js +1 -2
  48. package/esm/Core/Particles.js +1 -1
  49. package/esm/Core/Utils/EventListeners.js +4 -3
  50. package/esm/Core/Utils/QuadTree.js +4 -5
  51. package/esm/Core/Utils/Ranges.js +55 -0
  52. package/esm/Core/Utils/{Vector3d.js → Vectors.js} +15 -1
  53. package/esm/Options/Classes/AnimatableColor.js +1 -1
  54. package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
  55. package/esm/Options/Classes/Options.js +2 -1
  56. package/esm/Options/Classes/OptionsColor.js +1 -1
  57. package/esm/Options/Classes/Particles/Move/Move.js +1 -1
  58. package/esm/Types/RangeType.js +1 -0
  59. package/esm/Utils/ColorUtils.js +2 -1
  60. package/esm/Utils/NumberUtils.js +2 -2
  61. package/esm/Utils/TypeUtils.js +18 -0
  62. package/esm/Utils/Utils.js +2 -19
  63. package/esm/exports.js +3 -5
  64. package/package.json +1 -1
  65. package/report.html +1 -1
  66. package/tsparticles.engine.js +30 -50
  67. package/tsparticles.engine.min.js +1 -1
  68. package/tsparticles.engine.min.js.LICENSE.txt +1 -1
  69. package/types/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  70. package/types/Core/Interfaces/IMovePathGenerator.d.ts +1 -1
  71. package/types/Core/Particle.d.ts +1 -2
  72. package/types/Core/Utils/QuadTree.d.ts +2 -3
  73. package/types/Core/Utils/Ranges.d.ts +21 -0
  74. package/types/Core/Utils/{Vector3d.d.ts → Vectors.d.ts} +6 -0
  75. package/types/Types/RangeType.d.ts +4 -0
  76. package/types/Utils/NumberUtils.d.ts +1 -1
  77. package/types/Utils/TypeUtils.d.ts +6 -0
  78. package/types/Utils/Utils.d.ts +0 -6
  79. package/types/exports.d.ts +3 -5
  80. package/umd/Core/Container.js +1 -1
  81. package/umd/Core/Engine.js +1 -1
  82. package/umd/Core/Particle.js +5 -6
  83. package/umd/Core/Particles.js +3 -3
  84. package/umd/Core/Utils/EventListeners.js +5 -4
  85. package/umd/Core/Utils/QuadTree.js +8 -9
  86. package/umd/Core/Utils/Ranges.js +71 -0
  87. package/umd/Core/Utils/{Vector3d.js → Vectors.js} +19 -4
  88. package/umd/Options/Classes/AnimatableColor.js +3 -3
  89. package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +3 -3
  90. package/umd/Options/Classes/Options.js +3 -2
  91. package/umd/Options/Classes/OptionsColor.js +3 -3
  92. package/umd/Options/Classes/Particles/Move/Move.js +5 -5
  93. package/umd/{Core/Utils/Range.js → Types/RangeType.js} +0 -10
  94. package/umd/Utils/ColorUtils.js +10 -9
  95. package/umd/Utils/NumberUtils.js +10 -10
  96. package/umd/Utils/TypeUtils.js +37 -0
  97. package/umd/Utils/Utils.js +14 -37
  98. package/umd/exports.js +4 -6
  99. package/browser/Core/Utils/Circle.js +0 -28
  100. package/browser/Core/Utils/Range.js +0 -8
  101. package/browser/Core/Utils/Rectangle.js +0 -22
  102. package/browser/Core/Utils/Vector.js +0 -20
  103. package/cjs/Core/Utils/Circle.js +0 -32
  104. package/cjs/Core/Utils/Range.js +0 -12
  105. package/cjs/Core/Utils/Rectangle.js +0 -26
  106. package/cjs/Core/Utils/Vector.js +0 -24
  107. package/esm/Core/Utils/Circle.js +0 -28
  108. package/esm/Core/Utils/Range.js +0 -8
  109. package/esm/Core/Utils/Rectangle.js +0 -22
  110. package/esm/Core/Utils/Vector.js +0 -20
  111. package/types/Core/Utils/Circle.d.ts +0 -8
  112. package/types/Core/Utils/Range.d.ts +0 -7
  113. package/types/Core/Utils/Rectangle.d.ts +0 -9
  114. package/types/Core/Utils/Vector.d.ts +0 -8
  115. package/umd/Core/Utils/Circle.js +0 -42
  116. package/umd/Core/Utils/Rectangle.js +0 -36
  117. package/umd/Core/Utils/Vector.js +0 -34
package/373.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 373.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_engine=this.webpackChunk_tsparticles_engine||[]).push([[373],{2373:(t,i,e)=>{e.d(i,{Particle:()=>u});var s=e(3635),o=e(8279),a=e(5084),n=e(2418),h=e(7788),r=e(7162),c=e(7326),l=e(9087),p=e(3893);const d=.5;function f(t){if(!(0,o.dB)(t.outMode,t.checkModes))return;const i=2*t.radius;t.coord>t.maxCoord-i?t.setCb(-t.radius):t.coord<i&&t.setCb(t.radius)}class u{constructor(t,i){this.container=i,this._calcPosition=(t,i,e,o=0)=>{for(const[,s]of t.plugins){const t=void 0!==s.particlePosition?s.particlePosition(i,this):void 0;if(t)return c.U.create(t.x,t.y,e)}const a=t.canvas.size,n=(0,s.mC)({size:a,position:i}),h=c.U.create(n.x,n.y,e),r=this.getRadius(),l=this.options.move.outModes,p=i=>{f({outMode:i,checkModes:["bounce"],coord:h.x,maxCoord:t.canvas.size.width,setCb:t=>h.x+=t,radius:r})},d=i=>{f({outMode:i,checkModes:["bounce"],coord:h.y,maxCoord:t.canvas.size.height,setCb:t=>h.y+=t,radius:r})};if(p(l.left??l.default),p(l.right??l.default),d(l.top??l.default),d(l.bottom??l.default),this._checkOverlap(h,o)){const i=1;return this._calcPosition(t,void 0,e,o+i)}return h},this._calculateVelocity=()=>{const t=(0,s.lQ)(this.direction).copy(),i=this.options.move;if("inside"===i.direction||"outside"===i.direction)return t;const e=(0,s.Id)((0,s.Gu)(i.angle.value)),o=(0,s.Id)((0,s.Gu)(i.angle.offset)),a={left:o-e*d,right:o+e*d};return i.straight||(t.angle+=(0,s.vd)((0,s.Cs)(a.left,a.right))),i.random&&"number"==typeof i.speed&&(t.length*=(0,s.sZ)()),t},this._checkOverlap=(t,i=0)=>{const e=this.options.collisions,o=this.getRadius();if(!e.enable)return!1;const n=e.overlap;if(n.enable)return!1;const h=n.retries;if(h>=0&&i>h)throw new Error(`${a.gK} particle is overlapping and can't be placed`);return!!this.container.particles.find((i=>(0,s.Sp)(t,i.position)<o+i.getRadius()))},this._getRollColor=t=>{if(!t||!this.roll||!this.backColor&&!this.roll.alter)return t;const i=this.roll.horizontal&&this.roll.vertical?2:1,e=this.roll.horizontal?Math.PI*d:0;return Math.floor(((this.roll.angle??0)+e)/(Math.PI/i))%2?this.backColor?this.backColor:this.roll.alter?(0,l.PL)(t,this.roll.alter.type,this.roll.alter.value):t:t},this._initPosition=t=>{const i=this.container,e=(0,s.Gu)(this.options.zIndex.value);this.position=this._calcPosition(i,t,(0,s.uZ)(e,0,i.zLayers)),this.initialPosition=this.position.copy();const a=i.canvas.size;switch(this.moveCenter={...(0,o.bt)(this.options.move.center,a),radius:this.options.move.center.radius??0,mode:this.options.move.center.mode??"percent"},this.direction=(0,s.Gk)(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=r.O.origin},this._engine=t}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;const i=this.container,e=this.pathGenerator,s=i.shapeDrawers.get(this.shape);s?.particleDestroy?.(this);for(const[,e]of i.plugins)e.particleDestroyed?.(this,t);for(const e of i.particles.updaters)e.particleDestroyed?.(this,t);e?.reset(this),this._engine.dispatchEvent("particleDestroyed",{container:this.container,data:{particle:this}})}async draw(t){const i=this.container,e=i.canvas;for(const[,s]of i.plugins)await e.drawParticlePlugin(s,this,t);await e.drawParticle(this,t)}getFillColor(){return this._getRollColor(this.bubble.color??(0,n.gW)(this.color))}getMass(){return this.getRadius()**2*Math.PI*d}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??(0,n.gW)(this.strokeColor))}async init(t,i,e,r){const c=this.container,l=this._engine;this.id=t,this.group=r,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 d=c.retina.pixelRatio,f=c.actualOptions,u=(0,p.x)(this._engine,c,f.particles),g=u.effect.type,y=u.shape.type,{reduceDuplicates:v}=u;this.effect=(0,o.wA)(g,this.id,v),this.shape=(0,o.wA)(y,this.id,v);const w=u.effect,b=u.shape;if(e){if(e.effect?.type){const t=e.effect.type,i=(0,o.wA)(t,this.id,v);i&&(this.effect=i,w.load(e.effect))}if(e.shape?.type){const t=e.shape.type,i=(0,o.wA)(t,this.id,v);i&&(this.shape=i,b.load(e.shape))}}this.effectData=function(t,i,e,s){const a=i.options[t];if(a)return(0,o.ZB)({close:i.close,fill:i.fill},(0,o.wA)(a,e,s))}(this.effect,w,this.id,v),this.shapeData=function(t,i,e,s){const a=i.options[t];if(a)return(0,o.ZB)({close:i.close,fill:i.fill},(0,o.wA)(a,e,s))}(this.shape,b,this.id,v),u.load(e);const C=this.effectData;C&&u.load(C.particles);const m=this.shapeData;m&&u.load(m.particles);const _=new h.o(l,c);_.load(c.actualOptions.interactivity),_.load(u.interactivity),this.interactivity=_,this.effectFill=C?.fill??u.effect.fill,this.effectClose=C?.close??u.effect.close,this.shapeFill=m?.fill??u.shape.fill,this.shapeClose=m?.close??u.shape.close,this.options=u;const P=this.options.move.path;this.pathDelay=(0,s.Gu)(P.delay.value)*a.X5,P.generator&&(this.pathGenerator=this._engine.getPathGenerator(P.generator),this.pathGenerator&&c.addPath(P.generator,this.pathGenerator)&&await this.pathGenerator.init(c)),c.retina.initParticle(this),this.size=(0,o.V0)(this.options.size,d),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-(0,s.Gu)(this.options.move.decay);const z=c.particles;z.setLastZIndex(this.position.z),this.zIndexFactor=this.position.z/c.zLayers,this.sides=24;let D=c.effectDrawers.get(this.effect);D||(D=this._engine.getEffectDrawer(this.effect),D&&c.effectDrawers.set(this.effect,D)),D?.loadEffect&&await D.loadEffect(this);let k=c.shapeDrawers.get(this.shape);k||(k=this._engine.getShapeDrawer(this.shape),k&&c.shapeDrawers.set(this.shape,k)),k?.loadShape&&await k.loadShape(this);const x=k?.getSidesCount;x&&(this.sides=x(this)),this.spawning=!1,this.shadowColor=(0,n.tX)(this.options.shadow.color);for(const t of z.updaters)await t.init(this);for(const t of z.movers)await(t.init?.(this));await(D?.particleInit?.(c,this)),await(k?.particleInit?.(c,this));for(const[,t]of c.plugins)t.particleCreated?.(this)}isInsideCanvas(){const t=this.getRadius(),i=this.container.canvas.size,e=this.position;return e.x>=-t&&e.y>=-t&&e.y<=i.height+t&&e.x<=i.width+t}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(const t of this.container.particles.updaters)t.reset?.(this)}}}}]);
2
+ (this.webpackChunk_tsparticles_engine=this.webpackChunk_tsparticles_engine||[]).push([[373],{2373:(t,i,e)=>{e.d(i,{Particle:()=>f});var s=e(5410),o=e(3635),a=e(8279),n=e(5084),h=e(2418),r=e(7788),c=e(9087),l=e(3893);const p=.5;function d(t){if(!(0,a.dB)(t.outMode,t.checkModes))return;const i=2*t.radius;t.coord>t.maxCoord-i?t.setCb(-t.radius):t.coord<i&&t.setCb(t.radius)}class f{constructor(t,i){this.container=i,this._calcPosition=(t,i,e,a=0)=>{for(const[,o]of t.plugins){const t=void 0!==o.particlePosition?o.particlePosition(i,this):void 0;if(t)return s.U.create(t.x,t.y,e)}const n=t.canvas.size,h=(0,o.mC)({size:n,position:i}),r=s.U.create(h.x,h.y,e),c=this.getRadius(),l=this.options.move.outModes,p=i=>{d({outMode:i,checkModes:["bounce"],coord:r.x,maxCoord:t.canvas.size.width,setCb:t=>r.x+=t,radius:c})},f=i=>{d({outMode:i,checkModes:["bounce"],coord:r.y,maxCoord:t.canvas.size.height,setCb:t=>r.y+=t,radius:c})};if(p(l.left??l.default),p(l.right??l.default),f(l.top??l.default),f(l.bottom??l.default),this._checkOverlap(r,a)){const i=1;return this._calcPosition(t,void 0,e,a+i)}return r},this._calculateVelocity=()=>{const t=(0,o.lQ)(this.direction).copy(),i=this.options.move;if("inside"===i.direction||"outside"===i.direction)return t;const e=(0,o.Id)((0,o.Gu)(i.angle.value)),s=(0,o.Id)((0,o.Gu)(i.angle.offset)),a={left:s-e*p,right:s+e*p};return i.straight||(t.angle+=(0,o.vd)((0,o.Cs)(a.left,a.right))),i.random&&"number"==typeof i.speed&&(t.length*=(0,o.sZ)()),t},this._checkOverlap=(t,i=0)=>{const e=this.options.collisions,s=this.getRadius();if(!e.enable)return!1;const a=e.overlap;if(a.enable)return!1;const h=a.retries;if(h>=0&&i>h)throw new Error(`${n.gK} particle is overlapping and can't be placed`);return!!this.container.particles.find((i=>(0,o.Sp)(t,i.position)<s+i.getRadius()))},this._getRollColor=t=>{if(!t||!this.roll||!this.backColor&&!this.roll.alter)return t;const i=this.roll.horizontal&&this.roll.vertical?2:1,e=this.roll.horizontal?Math.PI*p:0;return Math.floor(((this.roll.angle??0)+e)/(Math.PI/i))%2?this.backColor?this.backColor:this.roll.alter?(0,c.PL)(t,this.roll.alter.type,this.roll.alter.value):t:t},this._initPosition=t=>{const i=this.container,e=(0,o.Gu)(this.options.zIndex.value);this.position=this._calcPosition(i,t,(0,o.uZ)(e,0,i.zLayers)),this.initialPosition=this.position.copy();const n=i.canvas.size;switch(this.moveCenter={...(0,a.bt)(this.options.move.center,n),radius:this.options.move.center.radius??0,mode:this.options.move.center.mode??"percent"},this.direction=(0,o.Gk)(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.O.origin},this._engine=t}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;const i=this.container,e=this.pathGenerator,s=i.shapeDrawers.get(this.shape);s?.particleDestroy?.(this);for(const[,e]of i.plugins)e.particleDestroyed?.(this,t);for(const e of i.particles.updaters)e.particleDestroyed?.(this,t);e?.reset(this),this._engine.dispatchEvent("particleDestroyed",{container:this.container,data:{particle:this}})}async draw(t){const i=this.container,e=i.canvas;for(const[,s]of i.plugins)await e.drawParticlePlugin(s,this,t);await e.drawParticle(this,t)}getFillColor(){return this._getRollColor(this.bubble.color??(0,h.gW)(this.color))}getMass(){return this.getRadius()**2*Math.PI*p}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??(0,h.gW)(this.strokeColor))}async init(t,i,e,s){const c=this.container,p=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 d=c.retina.pixelRatio,f=c.actualOptions,u=(0,l.x)(this._engine,c,f.particles),g=u.effect.type,y=u.shape.type,{reduceDuplicates:v}=u;this.effect=(0,a.wA)(g,this.id,v),this.shape=(0,a.wA)(y,this.id,v);const w=u.effect,b=u.shape;if(e){if(e.effect?.type){const t=e.effect.type,i=(0,a.wA)(t,this.id,v);i&&(this.effect=i,w.load(e.effect))}if(e.shape?.type){const t=e.shape.type,i=(0,a.wA)(t,this.id,v);i&&(this.shape=i,b.load(e.shape))}}this.effectData=function(t,i,e,s){const o=i.options[t];if(o)return(0,a.ZB)({close:i.close,fill:i.fill},(0,a.wA)(o,e,s))}(this.effect,w,this.id,v),this.shapeData=function(t,i,e,s){const o=i.options[t];if(o)return(0,a.ZB)({close:i.close,fill:i.fill},(0,a.wA)(o,e,s))}(this.shape,b,this.id,v),u.load(e);const C=this.effectData;C&&u.load(C.particles);const m=this.shapeData;m&&u.load(m.particles);const _=new r.o(p,c);_.load(c.actualOptions.interactivity),_.load(u.interactivity),this.interactivity=_,this.effectFill=C?.fill??u.effect.fill,this.effectClose=C?.close??u.effect.close,this.shapeFill=m?.fill??u.shape.fill,this.shapeClose=m?.close??u.shape.close,this.options=u;const P=this.options.move.path;this.pathDelay=(0,o.Gu)(P.delay.value)*n.X5,P.generator&&(this.pathGenerator=this._engine.getPathGenerator(P.generator),this.pathGenerator&&c.addPath(P.generator,this.pathGenerator)&&await this.pathGenerator.init(c)),c.retina.initParticle(this),this.size=(0,a.V0)(this.options.size,d),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-(0,o.Gu)(this.options.move.decay);const z=c.particles;z.setLastZIndex(this.position.z),this.zIndexFactor=this.position.z/c.zLayers,this.sides=24;let D=c.effectDrawers.get(this.effect);D||(D=this._engine.getEffectDrawer(this.effect),D&&c.effectDrawers.set(this.effect,D)),D?.loadEffect&&await D.loadEffect(this);let k=c.shapeDrawers.get(this.shape);k||(k=this._engine.getShapeDrawer(this.shape),k&&c.shapeDrawers.set(this.shape,k)),k?.loadShape&&await k.loadShape(this);const x=k?.getSidesCount;x&&(this.sides=x(this)),this.spawning=!1,this.shadowColor=(0,h.tX)(this.options.shadow.color);for(const t of z.updaters)await t.init(this);for(const t of z.movers)await(t.init?.(this));await(D?.particleInit?.(c,this)),await(k?.particleInit?.(c,this));for(const[,t]of c.plugins)t.particleCreated?.(this)}isInsideCanvas(){const t=this.getRadius(),i=this.container.canvas.size,e=this.position;return e.x>=-t&&e.y>=-t&&e.y<=i.height+t&&e.x<=i.width+t}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(const t of this.container.particles.updaters)t.reset?.(this)}}}}]);
@@ -1 +1 @@
1
- /*! tsParticles Engine v3.2.1 by Matteo Bruni */
1
+ /*! tsParticles Engine v3.2.2 by Matteo Bruni */
package/438.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 438.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_engine=this.webpackChunk_tsparticles_engine||[]).push([[438],{4438:(t,i,e)=>{e.d(i,{Container:()=>P});var s=e(5084),n=e(8279),a=e(9087),r=e(2418);function o(t,i,e){const s=i[e];void 0!==s&&(t[e]=(t[e]??1)*s)}function h(t,i,e=!1){if(!i)return;if(!t)return;const s=t.style;if(s)for(const t in i){const n=i[t];n&&s.setProperty(t,n,e?"important":"")}}class c{constructor(t){this.container=t,this._applyPostDrawUpdaters=t=>{for(const i of this._postDrawUpdaters)i.afterDraw?.(t)},this._applyPreDrawUpdaters=(t,i,e,s,n,a)=>{for(const r of this._preDrawUpdaters){if(r.getColorStyles){const{fill:a,stroke:o}=r.getColorStyles(i,t,e,s);a&&(n.fill=a),o&&(n.stroke=o)}if(r.getTransformValues){const t=r.getTransformValues(i);for(const i in t)o(a,t,i)}r.beforeDraw?.(i)}},this._applyResizePlugins=()=>{for(const t of this._resizePlugins)t.resize?.()},this._getPluginParticleColors=t=>{let i,e;for(const s of this._colorPlugins)if(!i&&s.particleFillColor&&(i=(0,r.lN)(s.particleFillColor(t))),!e&&s.particleStrokeColor&&(e=(0,r.lN)(s.particleStrokeColor(t))),i&&e)break;return[i,e]},this._initCover=async()=>{const t=this.container.actualOptions.backgroundMask.cover,i=t.color;if(i){const e=(0,r.tX)(i);if(e){const i={...e,a:t.opacity};this._coverColorStyle=(0,r.iz)(i,i.a)}}else await new Promise(((i,e)=>{if(!t.image)return;const s=document.createElement("img");s.addEventListener("load",(()=>{this._coverImage={image:s,opacity:t.opacity},i()})),s.addEventListener("error",(t=>{e(t.error)})),s.src=t.image}))},this._initStyle=()=>{const t=this.element,i=this.container.actualOptions;if(t){this._fullScreen?(this._originalStyle=(0,n.ZB)({},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")}}},this._initTrail=async()=>{const t=this.container.actualOptions.particles.move.trail,i=t.fill;if(!t.enable)return;const e=1/t.length;if(i.color){const t=(0,r.tX)(i.color);if(!t)return;this._trailFill={color:{...t},opacity:e}}else await new Promise(((t,s)=>{if(!i.image)return;const n=document.createElement("img");n.addEventListener("load",(()=>{this._trailFill={image:n,opacity:e},t()})),n.addEventListener("error",(t=>{s(t.error)})),n.src=i.image}))},this._paintBase=t=>{this.draw((i=>(0,a.TQ)(i,this.size,t)))},this._paintImage=(t,i)=>{this.draw((e=>(0,a.C3)(e,this.size,t,i)))},this._repairStyle=()=>{const t=this.element;t&&(this._safeMutationObserver((t=>t.disconnect())),this._initStyle(),this.initBackground(),this._safeMutationObserver((i=>i.observe(t,{attributes:!0}))))},this._resetOriginalStyle=()=>{const t=this.element,i=this._originalStyle;t&&i&&h(t,i)},this._safeMutationObserver=t=>{this._mutationObserver&&t(this._mutationObserver)},this._setFullScreenStyle=()=>{const t=this.element;if(!t)return;h(t,{position:"fixed",zIndex:this.container.actualOptions.fullScreen.zIndex.toString(10),top:"0",left:"0",width:"100%",height:"100%"},!0)},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,i=t.particles.move.trail,e=this._trailFill;t.backgroundMask.enable?this.paint():i.enable&&i.length>0&&e?e.color?this._paintBase((0,r.iz)(e.color,e.opacity)):e.image&&this._paintImage(e.image,e.opacity):t.clear&&this.draw((t=>{(0,a.ZH)(t,this.size)}))}destroy(){if(this.stop(),this._generated){const t=this.element;t?.remove()}else this._resetOriginalStyle();this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}draw(t){const i=this._context;if(i)return t(i)}drawAsync(t){const i=this._context;return i?t(i):Promise.resolve(void 0)}async drawParticle(t,i){if(t.spawning||t.destroyed)return;const e=t.getRadius();if(e<=0)return;const s=t.getFillColor(),n=t.getStrokeColor()??s;let[o,h]=this._getPluginParticleColors(t);o||(o=s),h||(h=n),(o||h)&&await this.drawAsync((async s=>{const n=this.container,c=n.actualOptions,l=t.options.zIndex,d=1-t.zIndexFactor,u=d**l.opacityRate,p=t.bubble.opacity??t.opacity?.value??1,_=p*u,f=(t.strokeOpacity??p)*u,m={},g={fill:o?(0,r.vz)(o,_):void 0};g.stroke=h?(0,r.vz)(h,f):g.fill,this._applyPreDrawUpdaters(s,t,e,_,g,m),await(0,a.zv)({container:n,context:s,particle:t,delta:i,colorStyles:g,backgroundMask:c.backgroundMask.enable,composite:c.backgroundMask.composite,radius:e*d**l.sizeRate,opacity:_,shadow:t.options.shadow,transform:m}),this._applyPostDrawUpdaters(t)}))}async drawParticlePlugin(t,i,e){await this.drawAsync((s=>(0,a.$F)(s,t,i,e)))}async drawPlugin(t,i){await this.drawAsync((e=>(0,a.Zw)(e,t,i)))}async init(){this._safeMutationObserver((t=>t.disconnect())),this._mutationObserver=(0,n.yf)((t=>{for(const i of t)"attributes"===i.type&&"style"===i.attributeName&&this._repairStyle()})),this.resize(),this._initStyle(),await this._initCover();try{await this._initTrail()}catch(t){(0,n.jl)().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,i=this.element;if(!i)return;const e=i.style;if(e){if(t.color){const i=(0,r.tX)(t.color);e.backgroundColor=i?(0,r.iz)(i,t.opacity):""}else e.backgroundColor="";e.backgroundImage=t.image||"",e.backgroundPosition=t.position||"",e.backgroundRepeat=t.repeat||"",e.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&&s.YU in t.dataset?"true"===t.dataset[s.YU]:this._generated,this.element=t,this.element.ariaHidden="true",this._originalStyle=(0,n.ZB)({},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((i=>{t.backgroundMask.enable&&t.backgroundMask.cover?((0,a.ZH)(i,this.size),this._coverImage?this._paintImage(this._coverImage.image,this._coverImage.opacity):this._coverColorStyle?this._paintBase(this._coverColorStyle):this._paintBase()):this._paintBase()}))}resize(){if(!this.element)return!1;const t=this.container,i=t.retina.pixelRatio,e=t.canvas.size,s=this.element.offsetWidth*i,n=this.element.offsetHeight*i;if(n===e.height&&s===e.width&&n===this.element.height&&s===this.element.width)return!1;const a={...e};return this.element.width=e.width=this.element.offsetWidth*i,this.element.height=e.height=this.element.offsetHeight*i,this.container.started&&t.particles.setResizeFactor({width:e.width/a.width,height:e.height/a.height}),!0}stop(){this._safeMutationObserver((t=>t.disconnect())),this._mutationObserver=void 0,this.draw((t=>(0,a.ZH)(t,this.size)))}async windowResize(){if(!this.element||!this.resize())return;const t=this.container,i=t.updateActualOptions();await t.particles.setDensity(),this._applyResizePlugins(),i&&await t.refresh()}}function l(t,i,e,s,a){if(s){let s={passive:!0};(0,n.jn)(a)?s.capture=a:void 0!==a&&(s=a),t.addEventListener(i,e,s)}else{const s=a;t.removeEventListener(i,e,s)}}class d{constructor(t){this.container=t,this._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={...s},t.clickTime=(new Date).getTime();const a=e.interactivity.events.onClick;(0,n.KH)(a.mode,(t=>this.container.handleClickMode(t)))}if("touchend"===t.type){setTimeout((()=>this._mouseTouchFinish()),500)}},this._handleThemeChange=t=>{const i=t,e=this.container,s=e.options,n=s.defaultThemes,a=i.matches?n.dark:n.light,r=s.themes.find((t=>t.name===a));r&&r.default.auto&&e.loadTheme(a)},this._handleVisibilityChange=()=>{const t=this.container,i=t.actualOptions;this._mouseTouchFinish(),i.pauseOnBlur&&(document&&document.hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))},this._handleWindowResize=()=>{this._resizeTimeout&&(clearTimeout(this._resizeTimeout),delete this._resizeTimeout);const t=async()=>{const t=this.container.canvas;await(t?.windowResize())};this._resizeTimeout=setTimeout((()=>{t()}),this.container.actualOptions.interactivity.events.resize.delay*s.X5)},this._manageInteractivityListeners=(t,i)=>{const e=this._handlers,n=this.container,a=n.actualOptions,r=n.interactivity.element;if(!r)return;const o=r,h=n.canvas.element;h&&(h.style.pointerEvents=o===h?"initial":"none"),(a.interactivity.events.onHover.enable||a.interactivity.events.onClick.enable)&&(l(r,s.Wt,e.mouseMove,i),l(r,s.Re,e.touchStart,i),l(r,s.zX,e.touchMove,i),a.interactivity.events.onClick.enable?(l(r,s.$o,e.touchEndClick,i),l(r,s.zw,e.mouseUp,i),l(r,s.ZL,e.mouseDown,i)):l(r,s.$o,e.touchEnd,i),l(r,t,e.mouseLeave,i),l(r,s.VH,e.touchCancel,i))},this._manageListeners=t=>{const i=this._handlers,e=this.container,n=e.actualOptions.interactivity.detectsOn,a=e.canvas.element;let r=s.aM;"window"===n?(e.interactivity.element=window,r=s.G1):e.interactivity.element="parent"===n&&a?a.parentElement??a.parentNode:a,this._manageMediaMatch(t),this._manageResize(t),this._manageInteractivityListeners(r,t),document&&l(document,s.QL,i.visibilityChange,t,!1)},this._manageMediaMatch=t=>{const i=this._handlers,e=(0,n.HY)("(prefers-color-scheme: dark)");e&&(void 0===e.addEventListener?void 0!==e.addListener&&(t?e.addListener(i.oldThemeChange):e.removeListener(i.oldThemeChange)):l(e,"change",i.themeChange,t))},this._manageResize=t=>{const i=this._handlers,e=this.container;if(!e.actualOptions.interactivity.events.resize)return;if("undefined"==typeof ResizeObserver)return void l(window,s.rR,i.resize,t);const n=e.canvas.element;this._resizeObserver&&!t?(n&&this._resizeObserver.unobserve(n),this._resizeObserver.disconnect(),delete this._resizeObserver):!this._resizeObserver&&t&&n&&(this._resizeObserver=new ResizeObserver((t=>{t.find((t=>t.target===n))&&this._handleWindowResize()})),this._resizeObserver.observe(n))},this._mouseDown=()=>{const{interactivity:t}=this.container;if(!t)return;const{mouse:i}=t;i.clicking=!0,i.downPosition=i.position},this._mouseTouchClick=t=>{const i=this.container,e=i.actualOptions,{mouse:s}=i.interactivity;s.inside=!0;let n=!1;const a=s.position;if(a&&e.interactivity.events.onClick.enable){for(const[,t]of i.plugins)if(t.clickPositionValid&&(n=t.clickPositionValid(a),n))break;n||this._doMouseTouchClick(t),s.clicking=!1}},this._mouseTouchFinish=()=>{const t=this.container.interactivity;if(!t)return;const i=t.mouse;delete i.position,delete i.clickPosition,delete i.downPosition,t.status=s.aM,i.inside=!1,i.clicking=!1},this._mouseTouchMove=t=>{const i=this.container,e=i.actualOptions,n=i.interactivity,a=i.canvas.element;if(!n?.element)return;let r;if(n.mouse.inside=!0,t.type.startsWith("pointer")){this._canPush=!0;const i=t;if(n.element===window){if(a){const t=a.getBoundingClientRect();r={x:i.clientX-t.left,y:i.clientY-t.top}}}else if("parent"===e.interactivity.detectsOn){const t=i.target,e=i.currentTarget;if(t&&e&&a){const s=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=a.getBoundingClientRect();r={x:i.offsetX+2*s.left-(n.left+o.left),y:i.offsetY+2*s.top-(n.top+o.top)}}else r={x:i.offsetX??i.clientX,y:i.offsetY??i.clientY}}else i.target===a&&(r={x:i.offsetX??i.clientX,y:i.offsetY??i.clientY})}else if(this._canPush="touchmove"!==t.type,a){const i=t,e=1,s=i.touches[i.touches.length-e],n=a.getBoundingClientRect(),o=0;r={x:s.clientX-(n.left??o),y:s.clientY-(n.top??o)}}const o=i.retina.pixelRatio;r&&(r.x*=o,r.y*=o),n.mouse.position=r,n.status=s.Wt},this._touchEnd=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)this._touches.delete(t.identifier);this._mouseTouchFinish()},this._touchEndClick=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)this._touches.delete(t.identifier);this._mouseTouchClick(t)},this._touchStart=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)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)}}var u=e(1875);class p{constructor(t,i){this.container=i,this._engine=t,this._interactors=[],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?.(t)}async init(){this._interactors=await this._engine.getInteractors(this.container,!0),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)}reset(t){for(const i of this._externalInteractors)i.isEnabled()&&i.reset(t);for(const i of this._particleInteractors)i.isEnabled(t)&&i.reset(t)}}var _=e(4116),f=e(9338),m=e(1363),g=e(3635);const v=.5;class y{constructor(t,i){this.rectangle=t,this.capacity=i,this._subdivide=()=>{const{x:t,y:i}=this.rectangle.position,{width:e,height:s}=this.rectangle.size,{capacity:n}=this;for(let a=0;a<4;a++){const r=a%2;this._subs.push(new y(new m.A(t+e*v*r,i+s*v*(Math.round(a*v)-r),e*v,s*v),n))}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((i=>i.insert(t)))))}query(t,i,e){const s=e??[];if(!t.intersects(this.rectangle))return[];for(const e of this._points)!t.contains(e.position)&&(0,g.Sp)(t.position,e.position)>e.particle.getRadius()&&(!i||i(e.particle))||s.push(e.particle);if(this._divided)for(const e of this._subs)e.query(t,i,s);return s}queryCircle(t,i,e){return this.query(new f.C(t.x,t.y,i),e)}queryRectangle(t,i,e){return this.query(new m.A(t.x,t.y,i.width,i.height),e)}}const w=t=>{const{height:i,width:e}=t;return new m.A(-.25*e,-.25*i,1.5*e,1.5*i)};class z{constructor(t,i){this._addToPool=(...t)=>{for(const i of t)this._pool.push(i)},this._applyDensity=async(t,i,e)=>{const s=t.number;if(!t.number.density?.enable)return void(void 0===e?this._limit=s.limit.value:s.limit&&this._groupLimits.set(e,s.limit.value));const n=this._initDensityFactor(s.density),a=s.value,r=s.limit.value>0?s.limit.value:a,o=Math.min(a,r)*n+i,h=Math.min(this.count,this.filter((t=>t.group===e)).length);void 0===e?this._limit=s.limit.value*n:this._groupLimits.set(e,s.limit.value*n),h<o?await this.push(Math.abs(o-h),void 0,t,e):h>o&&this.removeQuantity(h-o,e)},this._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.height*t.width*s**2)},this._pushParticle=async(t,i,a,r)=>{try{let s=this._pool.pop();if(!s){const{Particle:t}=await e.e(373).then(e.bind(e,2373));s=new t(this._engine,this._container)}await s.init(this._nextId,t,i,a);let n=!0;if(r&&(n=r(s)),!n)return;return this._array.push(s),this._zArray.push(s),this._nextId++,this._engine.dispatchEvent("particleAdded",{container:this._container,data:{particle:s}}),s}catch(t){(0,n.jl)().warning(`${s.gK} adding particle: ${t}`)}},this._removeParticle=(t,i,e)=>{const s=this._array[t];if(!s||s.group!==i)return!1;const n=this._zArray.indexOf(s);return this._array.splice(t,1),this._zArray.splice(n,1),s.destroy(e),this._engine.dispatchEvent("particleRemoved",{container:this._container,data:{particle:s}}),this._addToPool(s),!0},this._engine=t,this._container=i,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 p(t,i),this._pluginsInitialized=!1;const a=i.canvas.size;this.quadTree=new y(w(a),4),this.movers=[],this.updaters=[]}get count(){return this._array.length}async addManualParticles(){const t=this._container,i=t.actualOptions;for(const e of i.manualParticles)await this.addParticle(e.position?(0,n.bt)(e.position,t.canvas.size):void 0,e.options)}async addParticle(t,i,e,s){const n=this._container.actualOptions.particles.number.limit,a=void 0===e?this._limit:this._groupLimits.get(e)??this._limit,r=this.count;if(a>0)if("delete"===n.mode){const t=r+1-a;t>0&&this.removeQuantity(t)}else if("wait"===n.mode&&r>=a)return;return await this._pushParticle(t,i,e,s)}clear(){this._array=[],this._zArray=[],this._pluginsInitialized=!1}destroy(){this._array=[],this._zArray=[],this.movers=[],this.updaters=[]}async draw(t){const i=this._container,e=i.canvas;e.clear(),await this.update(t);for(const[,s]of i.plugins)await e.drawPlugin(s,t);for(const i of this._zArray)await i.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)}async init(){const t=this._container,i=t.actualOptions;this._lastZIndex=0,this._needsSort=!1,await this.initPlugins();let e=!1;for(const[,i]of t.plugins)if(void 0!==i.particlesInitialization&&(e=i.particlesInitialization()),e)break;if(await this.addManualParticles(),!e){const t=i.particles,e=t.groups;for(const i in e){const s=e[i];for(let e=this.count,n=0;n<s.number?.value&&e<t.number.value;e++,n++)await this.addParticle(void 0,s,i)}for(let i=this.count;i<t.number.value;i++)await this.addParticle()}}async initPlugins(){if(this._pluginsInitialized)return;const t=this._container;this.movers=await this._engine.getMovers(t,!0),this.updaters=await this._engine.getUpdaters(t,!0),await this._interactionManager.init();for(const[,i]of t.pathGenerators)await i.init(t)}async push(t,i,e,s){for(let n=0;n<t;n++)await this.addParticle(i?.position,e,s)}async redraw(){this.clear(),await 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 n=0;for(let a=t;n<i&&a<this.count;a++)this._removeParticle(a--,e,s)&&n++}removeQuantity(t,i){this.removeAt(0,t,i)}async setDensity(){const t=this._container.actualOptions,i=t.particles.groups;for(const t in i)await this._applyDensity(i[t],0,t);await 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 i=this._container,e=new Set;this.quadTree=new y(w(i.canvas.size),4);for(const[,t]of i.pathGenerators)t.update();for(const[,e]of i.plugins)await(e.update?.(t));const s=this._resizeFactor;for(const i of this._array){s&&!i.ignoresResizeRatio&&(i.position.x*=s.width,i.position.y*=s.height,i.initialPosition.x*=s.width,i.initialPosition.y*=s.height),i.ignoresResizeRatio=!1,this._interactionManager.reset(i);for(const[,e]of this._container.plugins){if(i.destroyed)break;e.particleUpdate?.(i,t)}for(const e of this.movers)e.isEnabled(i)&&await e.move(i,t);i.destroyed?e.add(i):this.quadTree.insert(new _.E(i.getPosition(),i))}if(e.size){const t=t=>!e.has(t);this._array=this.filter(t),this._zArray=this._zArray.filter(t);for(const t of e)this._engine.dispatchEvent("particleRemoved",{container:this._container,data:{particle:t}});this._addToPool(...e)}await this._interactionManager.externalInteract(t);for(const i of this._array){for(const e of this.updaters)await e.update(i,t);i.destroyed||i.spawning||await this._interactionManager.particlesInteract(i,t)}if(delete this._resizeFactor,this._needsSort){const t=this._zArray;t.sort(((t,i)=>i.position.z-t.position.z||t.id-i.id));const i=1;this._lastZIndex=t[t.length-i].position.z,this._needsSort=!1}}}class b{constructor(t){this.container=t,this.pixelRatio=1,this.reduceFactor=1}init(){const t=this.container,i=t.actualOptions;this.pixelRatio=!i.detectRetina||(0,n.Kr)()?1:window.devicePixelRatio,this.reduceFactor=1;const e=this.pixelRatio,s=t.canvas;if(s.element){const t=s.element;s.size.width=t.offsetWidth*e,s.size.height=t.offsetHeight*e}const a=i.particles,r=a.move;this.maxSpeed=(0,g.Gu)(r.gravity.maxSpeed)*e,this.sizeAnimationSpeed=(0,g.Gu)(a.size.animation.speed)*e}initParticle(t){const i=t.options,e=this.pixelRatio,s=i.move,n=s.distance,a=t.retina;a.moveDrift=(0,g.Gu)(s.drift)*e,a.moveSpeed=(0,g.Gu)(s.speed)*e,a.sizeAnimationSpeed=(0,g.Gu)(i.size.animation.speed)*e;const r=a.maxDistance;r.horizontal=void 0!==n.horizontal?n.horizontal*e:void 0,r.vertical=void 0!==n.vertical?n.vertical*e:void 0,a.maxSpeed=(0,g.Gu)(s.gravity.maxSpeed)*e}}var O=e(3893);function k(t){return t&&!t.destroyed}function T(t,i,...e){const s=new u.E(t,i);return(0,O.h)(s,...e),s}class P{constructor(t,i,e){this._intersectionManager=t=>{if(k(this)&&this.actualOptions.pauseOnOutsideViewport)for(const i of t)i.target===this.interactivity.element&&(i.isIntersecting?this.play():this.pause())},this._nextFrame=async t=>{try{if(!this._smooth&&void 0!==this._lastFrameTime&&t<this._lastFrameTime+s.X5/this.fpsLimit)return void this.draw(!1);this._lastFrameTime??=t;const i=function(t,i=60,e=!1){return{value:t,factor:e?60/i:60*t/s.X5}}(t-this._lastFrameTime,this.fpsLimit,this._smooth);if(this.addLifeTime(i.value),this._lastFrameTime=t,i.value>s.X5)return void this.draw(!1);if(await this.particles.draw(i),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){(0,n.jl)().error(`${s.gK} in animation loop`,t)}},this._engine=t,this.id=Symbol(i),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 b(this),this.canvas=new c(this),this.particles=new z(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=T(this._engine,this),this.actualOptions=T(this._engine,this),this._eventListeners=new d(this),this._intersectionObserver=(0,n.NM)((t=>this._intersectionManager(t))),this._engine.dispatchEvent("containerBuilt",{container:this})}get animationStatus(){return!this._paused&&!this.pageHidden&&k(this)}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addClickHandler(t){if(!k(this))return;const i=this.interactivity.element;if(!i)return;const e=(i,e,s)=>{if(!k(this))return;const n=this.retina.pixelRatio,a={x:e.x*n,y:e.y*n},r=this.particles.quadTree.queryCircle(a,s*n);t(i,r)};let s=!1,n=!1;i.addEventListener("click",(t=>{if(!k(this))return;const i=t,s={x:i.offsetX||i.clientX,y:i.offsetY||i.clientY};e(t,s,1)})),i.addEventListener("touchstart",(()=>{k(this)&&(s=!0,n=!1)})),i.addEventListener("touchmove",(()=>{k(this)&&(n=!0)})),i.addEventListener("touchend",(t=>{if(k(this)){if(s&&!n){const i=t,s=1;let n=i.touches[i.touches.length-s];if(!n&&(n=i.changedTouches[i.changedTouches.length-s],!n))return;const a=this.canvas.element,r=a?a.getBoundingClientRect():void 0,o=0,h={x:n.clientX-(r?r.left:o),y:n.clientY-(r?r.top:o)};e(t,h,Math.max(n.radiusX,n.radiusY))}s=!1,n=!1}})),i.addEventListener("touchcancel",(()=>{k(this)&&(s=!1,n=!1)}))}addLifeTime(t){this._lifeTime+=t}addPath(t,i,e=!1){return!(!k(this)||!e&&this.pathGenerators.has(t))&&(this.pathGenerators.set(t,i),!0)}alive(){return!this._duration||this._lifeTime<=this._duration}destroy(){if(!k(this))return;this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.effectDrawers)t.destroy?.(this);for(const[,t]of this.shapeDrawers)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(),i=t.findIndex((t=>t===this));if(i>=0){const e=1;t.splice(i,e)}this._engine.dispatchEvent("containerDestroyed",{container:this})}draw(t){if(!k(this))return;let i=t;const e=async t=>{i&&(this._lastFrameTime=void 0,i=!1),await this._nextFrame(t)};this._drawAnimationFrame=requestAnimationFrame((t=>{e(t)}))}async export(t,i={}){for(const[,e]of this.plugins){if(!e.export)continue;const s=await e.export(t,i);if(s.supported)return s.blob}(0,n.jl)().error(`${s.gK} - Export plugin with type ${t} not found`)}handleClickMode(t){if(k(this)){this.particles.handleClickMode(t);for(const[,i]of this.plugins)i.handleClickMode?.(t)}}async init(){if(!k(this))return;const t=this._engine.getSupportedEffects();for(const i of t){const t=this._engine.getEffectDrawer(i);t&&this.effectDrawers.set(i,t)}const i=this._engine.getSupportedShapes();for(const t of i){const i=this._engine.getShapeDrawer(t);i&&this.shapeDrawers.set(t,i)}await this.particles.initPlugins(),this._options=T(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=T(this._engine,this,this._options);const e=await this._engine.getAvailablePlugins(this);for(const[t,i]of e)this.plugins.set(t,i);this.retina.init(),await this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize(),this.zLayers=this.actualOptions.zLayers,this._duration=(0,g.Gu)(this.actualOptions.duration)*s.X5,this._delay=(0,g.Gu)(this.actualOptions.delay)*s.X5,this._lifeTime=0;this.fpsLimit=this.actualOptions.fpsLimit>0?this.actualOptions.fpsLimit:120,this._smooth=this.actualOptions.smooth;for(const[,t]of this.effectDrawers)await(t.init?.(this));for(const[,t]of this.shapeDrawers)await(t.init?.(this));for(const[,t]of this.plugins)await(t.init?.());this._engine.dispatchEvent("containerInit",{container:this}),await this.particles.init(),await this.particles.setDensity();for(const[,t]of this.plugins)t.particlesSetup?.();this._engine.dispatchEvent("particlesSetup",{container:this})}async loadTheme(t){k(this)&&(this._currentTheme=t,await this.refresh())}pause(){if(k(this)&&(void 0!==this._drawAnimationFrame&&(cancelAnimationFrame(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(const[,t]of this.plugins)t.pause?.();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent("containerPaused",{container:this})}}play(t){if(!k(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(k(this))return this.stop(),this.start()}async reset(){if(k(this))return this._initialSourceOptions=void 0,this._options=T(this._engine,this),this.actualOptions=T(this._engine,this,this._options),this.refresh()}async start(){k(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{const i=async()=>{this._eventListeners.addListeners(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.observe(this.interactivity.element);for(const[,t]of this.plugins)await(t.start?.());this._engine.dispatchEvent("containerStarted",{container:this}),this.play(),t()};this._delayTimeout=setTimeout((()=>{i()}),this._delay)})))}stop(){if(k(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?.();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)}}}}]);
2
+ (this.webpackChunk_tsparticles_engine=this.webpackChunk_tsparticles_engine||[]).push([[438],{4438:(t,i,e)=>{e.d(i,{Container:()=>P});var s=e(5084),n=e(8279),a=e(9087),r=e(2418);function o(t,i,e){const s=i[e];void 0!==s&&(t[e]=(t[e]??1)*s)}function h(t,i,e=!1){if(!i)return;if(!t)return;const s=t.style;if(s)for(const t in i){const n=i[t];n&&s.setProperty(t,n,e?"important":"")}}class c{constructor(t){this.container=t,this._applyPostDrawUpdaters=t=>{for(const i of this._postDrawUpdaters)i.afterDraw?.(t)},this._applyPreDrawUpdaters=(t,i,e,s,n,a)=>{for(const r of this._preDrawUpdaters){if(r.getColorStyles){const{fill:a,stroke:o}=r.getColorStyles(i,t,e,s);a&&(n.fill=a),o&&(n.stroke=o)}if(r.getTransformValues){const t=r.getTransformValues(i);for(const i in t)o(a,t,i)}r.beforeDraw?.(i)}},this._applyResizePlugins=()=>{for(const t of this._resizePlugins)t.resize?.()},this._getPluginParticleColors=t=>{let i,e;for(const s of this._colorPlugins)if(!i&&s.particleFillColor&&(i=(0,r.lN)(s.particleFillColor(t))),!e&&s.particleStrokeColor&&(e=(0,r.lN)(s.particleStrokeColor(t))),i&&e)break;return[i,e]},this._initCover=async()=>{const t=this.container.actualOptions.backgroundMask.cover,i=t.color;if(i){const e=(0,r.tX)(i);if(e){const i={...e,a:t.opacity};this._coverColorStyle=(0,r.iz)(i,i.a)}}else await new Promise(((i,e)=>{if(!t.image)return;const s=document.createElement("img");s.addEventListener("load",(()=>{this._coverImage={image:s,opacity:t.opacity},i()})),s.addEventListener("error",(t=>{e(t.error)})),s.src=t.image}))},this._initStyle=()=>{const t=this.element,i=this.container.actualOptions;if(t){this._fullScreen?(this._originalStyle=(0,n.ZB)({},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")}}},this._initTrail=async()=>{const t=this.container.actualOptions.particles.move.trail,i=t.fill;if(!t.enable)return;const e=1/t.length;if(i.color){const t=(0,r.tX)(i.color);if(!t)return;this._trailFill={color:{...t},opacity:e}}else await new Promise(((t,s)=>{if(!i.image)return;const n=document.createElement("img");n.addEventListener("load",(()=>{this._trailFill={image:n,opacity:e},t()})),n.addEventListener("error",(t=>{s(t.error)})),n.src=i.image}))},this._paintBase=t=>{this.draw((i=>(0,a.TQ)(i,this.size,t)))},this._paintImage=(t,i)=>{this.draw((e=>(0,a.C3)(e,this.size,t,i)))},this._repairStyle=()=>{const t=this.element;t&&(this._safeMutationObserver((t=>t.disconnect())),this._initStyle(),this.initBackground(),this._safeMutationObserver((i=>i.observe(t,{attributes:!0}))))},this._resetOriginalStyle=()=>{const t=this.element,i=this._originalStyle;t&&i&&h(t,i)},this._safeMutationObserver=t=>{this._mutationObserver&&t(this._mutationObserver)},this._setFullScreenStyle=()=>{const t=this.element;if(!t)return;h(t,{position:"fixed",zIndex:this.container.actualOptions.fullScreen.zIndex.toString(10),top:"0",left:"0",width:"100%",height:"100%"},!0)},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,i=t.particles.move.trail,e=this._trailFill;t.backgroundMask.enable?this.paint():i.enable&&i.length>0&&e?e.color?this._paintBase((0,r.iz)(e.color,e.opacity)):e.image&&this._paintImage(e.image,e.opacity):t.clear&&this.draw((t=>{(0,a.ZH)(t,this.size)}))}destroy(){if(this.stop(),this._generated){const t=this.element;t?.remove()}else this._resetOriginalStyle();this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}draw(t){const i=this._context;if(i)return t(i)}drawAsync(t){const i=this._context;return i?t(i):Promise.resolve(void 0)}async drawParticle(t,i){if(t.spawning||t.destroyed)return;const e=t.getRadius();if(e<=0)return;const s=t.getFillColor(),n=t.getStrokeColor()??s;let[o,h]=this._getPluginParticleColors(t);o||(o=s),h||(h=n),(o||h)&&await this.drawAsync((async s=>{const n=this.container,c=n.actualOptions,l=t.options.zIndex,d=1-t.zIndexFactor,u=d**l.opacityRate,p=t.bubble.opacity??t.opacity?.value??1,_=p*u,f=(t.strokeOpacity??p)*u,m={},g={fill:o?(0,r.vz)(o,_):void 0};g.stroke=h?(0,r.vz)(h,f):g.fill,this._applyPreDrawUpdaters(s,t,e,_,g,m),await(0,a.zv)({container:n,context:s,particle:t,delta:i,colorStyles:g,backgroundMask:c.backgroundMask.enable,composite:c.backgroundMask.composite,radius:e*d**l.sizeRate,opacity:_,shadow:t.options.shadow,transform:m}),this._applyPostDrawUpdaters(t)}))}async drawParticlePlugin(t,i,e){await this.drawAsync((s=>(0,a.$F)(s,t,i,e)))}async drawPlugin(t,i){await this.drawAsync((e=>(0,a.Zw)(e,t,i)))}async init(){this._safeMutationObserver((t=>t.disconnect())),this._mutationObserver=(0,n.yf)((t=>{for(const i of t)"attributes"===i.type&&"style"===i.attributeName&&this._repairStyle()})),this.resize(),this._initStyle(),await this._initCover();try{await this._initTrail()}catch(t){(0,n.jl)().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,i=this.element;if(!i)return;const e=i.style;if(e){if(t.color){const i=(0,r.tX)(t.color);e.backgroundColor=i?(0,r.iz)(i,t.opacity):""}else e.backgroundColor="";e.backgroundImage=t.image||"",e.backgroundPosition=t.position||"",e.backgroundRepeat=t.repeat||"",e.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&&s.YU in t.dataset?"true"===t.dataset[s.YU]:this._generated,this.element=t,this.element.ariaHidden="true",this._originalStyle=(0,n.ZB)({},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((i=>{t.backgroundMask.enable&&t.backgroundMask.cover?((0,a.ZH)(i,this.size),this._coverImage?this._paintImage(this._coverImage.image,this._coverImage.opacity):this._coverColorStyle?this._paintBase(this._coverColorStyle):this._paintBase()):this._paintBase()}))}resize(){if(!this.element)return!1;const t=this.container,i=t.retina.pixelRatio,e=t.canvas.size,s=this.element.offsetWidth*i,n=this.element.offsetHeight*i;if(n===e.height&&s===e.width&&n===this.element.height&&s===this.element.width)return!1;const a={...e};return this.element.width=e.width=this.element.offsetWidth*i,this.element.height=e.height=this.element.offsetHeight*i,this.container.started&&t.particles.setResizeFactor({width:e.width/a.width,height:e.height/a.height}),!0}stop(){this._safeMutationObserver((t=>t.disconnect())),this._mutationObserver=void 0,this.draw((t=>(0,a.ZH)(t,this.size)))}async windowResize(){if(!this.element||!this.resize())return;const t=this.container,i=t.updateActualOptions();await t.particles.setDensity(),this._applyResizePlugins(),i&&await t.refresh()}}var l=e(1180);function d(t,i,e,s,n){if(s){let s={passive:!0};(0,l.jn)(n)?s.capture=n:void 0!==n&&(s=n),t.addEventListener(i,e,s)}else{const s=n;t.removeEventListener(i,e,s)}}class u{constructor(t){this.container=t,this._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={...s},t.clickTime=(new Date).getTime();const a=e.interactivity.events.onClick;(0,n.KH)(a.mode,(t=>this.container.handleClickMode(t)))}if("touchend"===t.type){setTimeout((()=>this._mouseTouchFinish()),500)}},this._handleThemeChange=t=>{const i=t,e=this.container,s=e.options,n=s.defaultThemes,a=i.matches?n.dark:n.light,r=s.themes.find((t=>t.name===a));r&&r.default.auto&&e.loadTheme(a)},this._handleVisibilityChange=()=>{const t=this.container,i=t.actualOptions;this._mouseTouchFinish(),i.pauseOnBlur&&(document&&document.hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))},this._handleWindowResize=()=>{this._resizeTimeout&&(clearTimeout(this._resizeTimeout),delete this._resizeTimeout);const t=async()=>{const t=this.container.canvas;await(t?.windowResize())};this._resizeTimeout=setTimeout((()=>{t()}),this.container.actualOptions.interactivity.events.resize.delay*s.X5)},this._manageInteractivityListeners=(t,i)=>{const e=this._handlers,n=this.container,a=n.actualOptions,r=n.interactivity.element;if(!r)return;const o=r,h=n.canvas.element;h&&(h.style.pointerEvents=o===h?"initial":"none"),(a.interactivity.events.onHover.enable||a.interactivity.events.onClick.enable)&&(d(r,s.Wt,e.mouseMove,i),d(r,s.Re,e.touchStart,i),d(r,s.zX,e.touchMove,i),a.interactivity.events.onClick.enable?(d(r,s.$o,e.touchEndClick,i),d(r,s.zw,e.mouseUp,i),d(r,s.ZL,e.mouseDown,i)):d(r,s.$o,e.touchEnd,i),d(r,t,e.mouseLeave,i),d(r,s.VH,e.touchCancel,i))},this._manageListeners=t=>{const i=this._handlers,e=this.container,n=e.actualOptions.interactivity.detectsOn,a=e.canvas.element;let r=s.aM;"window"===n?(e.interactivity.element=window,r=s.G1):e.interactivity.element="parent"===n&&a?a.parentElement??a.parentNode:a,this._manageMediaMatch(t),this._manageResize(t),this._manageInteractivityListeners(r,t),document&&d(document,s.QL,i.visibilityChange,t,!1)},this._manageMediaMatch=t=>{const i=this._handlers,e=(0,n.HY)("(prefers-color-scheme: dark)");e&&(void 0===e.addEventListener?void 0!==e.addListener&&(t?e.addListener(i.oldThemeChange):e.removeListener(i.oldThemeChange)):d(e,"change",i.themeChange,t))},this._manageResize=t=>{const i=this._handlers,e=this.container;if(!e.actualOptions.interactivity.events.resize)return;if("undefined"==typeof ResizeObserver)return void d(window,s.rR,i.resize,t);const n=e.canvas.element;this._resizeObserver&&!t?(n&&this._resizeObserver.unobserve(n),this._resizeObserver.disconnect(),delete this._resizeObserver):!this._resizeObserver&&t&&n&&(this._resizeObserver=new ResizeObserver((t=>{t.find((t=>t.target===n))&&this._handleWindowResize()})),this._resizeObserver.observe(n))},this._mouseDown=()=>{const{interactivity:t}=this.container;if(!t)return;const{mouse:i}=t;i.clicking=!0,i.downPosition=i.position},this._mouseTouchClick=t=>{const i=this.container,e=i.actualOptions,{mouse:s}=i.interactivity;s.inside=!0;let n=!1;const a=s.position;if(a&&e.interactivity.events.onClick.enable){for(const[,t]of i.plugins)if(t.clickPositionValid&&(n=t.clickPositionValid(a),n))break;n||this._doMouseTouchClick(t),s.clicking=!1}},this._mouseTouchFinish=()=>{const t=this.container.interactivity;if(!t)return;const i=t.mouse;delete i.position,delete i.clickPosition,delete i.downPosition,t.status=s.aM,i.inside=!1,i.clicking=!1},this._mouseTouchMove=t=>{const i=this.container,e=i.actualOptions,n=i.interactivity,a=i.canvas.element;if(!n?.element)return;let r;if(n.mouse.inside=!0,t.type.startsWith("pointer")){this._canPush=!0;const i=t;if(n.element===window){if(a){const t=a.getBoundingClientRect();r={x:i.clientX-t.left,y:i.clientY-t.top}}}else if("parent"===e.interactivity.detectsOn){const t=i.target,e=i.currentTarget;if(t&&e&&a){const s=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=a.getBoundingClientRect();r={x:i.offsetX+2*s.left-(n.left+o.left),y:i.offsetY+2*s.top-(n.top+o.top)}}else r={x:i.offsetX??i.clientX,y:i.offsetY??i.clientY}}else i.target===a&&(r={x:i.offsetX??i.clientX,y:i.offsetY??i.clientY})}else if(this._canPush="touchmove"!==t.type,a){const i=t,e=1,s=i.touches[i.touches.length-e],n=a.getBoundingClientRect(),o=0;r={x:s.clientX-(n.left??o),y:s.clientY-(n.top??o)}}const o=i.retina.pixelRatio;r&&(r.x*=o,r.y*=o),n.mouse.position=r,n.status=s.Wt},this._touchEnd=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)this._touches.delete(t.identifier);this._mouseTouchFinish()},this._touchEndClick=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)this._touches.delete(t.identifier);this._mouseTouchClick(t)},this._touchStart=t=>{const i=t,e=Array.from(i.changedTouches);for(const t of e)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)}}var p=e(1875);class _{constructor(t,i){this.container=i,this._engine=t,this._interactors=[],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?.(t)}async init(){this._interactors=await this._engine.getInteractors(this.container,!0),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)}reset(t){for(const i of this._externalInteractors)i.isEnabled()&&i.reset(t);for(const i of this._particleInteractors)i.isEnabled(t)&&i.reset(t)}}var f=e(4116),m=e(1901),g=e(3635);const v=.5;class y{constructor(t,i){this.rectangle=t,this.capacity=i,this._subdivide=()=>{const{x:t,y:i}=this.rectangle.position,{width:e,height:s}=this.rectangle.size,{capacity:n}=this;for(let a=0;a<4;a++){const r=a%2;this._subs.push(new y(new m.Ae(t+e*v*r,i+s*v*(Math.round(a*v)-r),e*v,s*v),n))}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((i=>i.insert(t)))))}query(t,i){const e=[];if(!t.intersects(this.rectangle))return[];for(const s of this._points)!t.contains(s.position)&&(0,g.Sp)(t.position,s.position)>s.particle.getRadius()&&(!i||i(s.particle))||e.push(s.particle);if(this._divided)for(const s of this._subs)e.push(...s.query(t,i));return e}queryCircle(t,i,e){return this.query(new m.Cd(t.x,t.y,i),e)}queryRectangle(t,i,e){return this.query(new m.Ae(t.x,t.y,i.width,i.height),e)}}const w=t=>{const{height:i,width:e}=t;return new m.Ae(-.25*e,-.25*i,1.5*e,1.5*i)};class z{constructor(t,i){this._addToPool=(...t)=>{for(const i of t)this._pool.push(i)},this._applyDensity=async(t,i,e)=>{const s=t.number;if(!t.number.density?.enable)return void(void 0===e?this._limit=s.limit.value:s.limit&&this._groupLimits.set(e,s.limit.value));const n=this._initDensityFactor(s.density),a=s.value,r=s.limit.value>0?s.limit.value:a,o=Math.min(a,r)*n+i,h=Math.min(this.count,this.filter((t=>t.group===e)).length);void 0===e?this._limit=s.limit.value*n:this._groupLimits.set(e,s.limit.value*n),h<o?await this.push(Math.abs(o-h),void 0,t,e):h>o&&this.removeQuantity(h-o,e)},this._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.height*t.width*s**2)},this._pushParticle=async(t,i,a,r)=>{try{let s=this._pool.pop();if(!s){const{Particle:t}=await e.e(373).then(e.bind(e,2373));s=new t(this._engine,this._container)}await s.init(this._nextId,t,i,a);let n=!0;if(r&&(n=r(s)),!n)return;return this._array.push(s),this._zArray.push(s),this._nextId++,this._engine.dispatchEvent("particleAdded",{container:this._container,data:{particle:s}}),s}catch(t){(0,n.jl)().warning(`${s.gK} adding particle: ${t}`)}},this._removeParticle=(t,i,e)=>{const s=this._array[t];if(!s||s.group!==i)return!1;const n=this._zArray.indexOf(s);return this._array.splice(t,1),this._zArray.splice(n,1),s.destroy(e),this._engine.dispatchEvent("particleRemoved",{container:this._container,data:{particle:s}}),this._addToPool(s),!0},this._engine=t,this._container=i,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 _(t,i),this._pluginsInitialized=!1;const a=i.canvas.size;this.quadTree=new y(w(a),4),this.movers=[],this.updaters=[]}get count(){return this._array.length}async addManualParticles(){const t=this._container,i=t.actualOptions;for(const e of i.manualParticles)await this.addParticle(e.position?(0,n.bt)(e.position,t.canvas.size):void 0,e.options)}async addParticle(t,i,e,s){const n=this._container.actualOptions.particles.number.limit,a=void 0===e?this._limit:this._groupLimits.get(e)??this._limit,r=this.count;if(a>0)if("delete"===n.mode){const t=r+1-a;t>0&&this.removeQuantity(t)}else if("wait"===n.mode&&r>=a)return;return await this._pushParticle(t,i,e,s)}clear(){this._array=[],this._zArray=[],this._pluginsInitialized=!1}destroy(){this._array=[],this._zArray=[],this.movers=[],this.updaters=[]}async draw(t){const i=this._container,e=i.canvas;e.clear(),await this.update(t);for(const[,s]of i.plugins)await e.drawPlugin(s,t);for(const i of this._zArray)await i.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)}async init(){const t=this._container,i=t.actualOptions;this._lastZIndex=0,this._needsSort=!1,await this.initPlugins();let e=!1;for(const[,i]of t.plugins)if(void 0!==i.particlesInitialization&&(e=i.particlesInitialization()),e)break;if(await this.addManualParticles(),!e){const t=i.particles,e=t.groups;for(const i in e){const s=e[i];for(let e=this.count,n=0;n<s.number?.value&&e<t.number.value;e++,n++)await this.addParticle(void 0,s,i)}for(let i=this.count;i<t.number.value;i++)await this.addParticle()}}async initPlugins(){if(this._pluginsInitialized)return;const t=this._container;this.movers=await this._engine.getMovers(t,!0),this.updaters=await this._engine.getUpdaters(t,!0),await this._interactionManager.init();for(const[,i]of t.pathGenerators)await i.init(t)}async push(t,i,e,s){for(let n=0;n<t;n++)await this.addParticle(i?.position,e,s)}async redraw(){this.clear(),await 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 n=0;for(let a=t;n<i&&a<this.count;a++)this._removeParticle(a--,e,s)&&n++}removeQuantity(t,i){this.removeAt(0,t,i)}async setDensity(){const t=this._container.actualOptions,i=t.particles.groups;for(const t in i)await this._applyDensity(i[t],0,t);await 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 i=this._container,e=new Set;this.quadTree=new y(w(i.canvas.size),4);for(const[,t]of i.pathGenerators)t.update();for(const[,e]of i.plugins)await(e.update?.(t));const s=this._resizeFactor;for(const i of this._array){s&&!i.ignoresResizeRatio&&(i.position.x*=s.width,i.position.y*=s.height,i.initialPosition.x*=s.width,i.initialPosition.y*=s.height),i.ignoresResizeRatio=!1,this._interactionManager.reset(i);for(const[,e]of this._container.plugins){if(i.destroyed)break;e.particleUpdate?.(i,t)}for(const e of this.movers)e.isEnabled(i)&&await e.move(i,t);i.destroyed?e.add(i):this.quadTree.insert(new f.E(i.getPosition(),i))}if(e.size){const t=t=>!e.has(t);this._array=this.filter(t),this._zArray=this._zArray.filter(t);for(const t of e)this._engine.dispatchEvent("particleRemoved",{container:this._container,data:{particle:t}});this._addToPool(...e)}await this._interactionManager.externalInteract(t);for(const i of this._array){for(const e of this.updaters)await e.update(i,t);i.destroyed||i.spawning||await this._interactionManager.particlesInteract(i,t)}if(delete this._resizeFactor,this._needsSort){const t=this._zArray;t.sort(((t,i)=>i.position.z-t.position.z||t.id-i.id));const i=1;this._lastZIndex=t[t.length-i].position.z,this._needsSort=!1}}}class b{constructor(t){this.container=t,this.pixelRatio=1,this.reduceFactor=1}init(){const t=this.container,i=t.actualOptions;this.pixelRatio=!i.detectRetina||(0,n.Kr)()?1:window.devicePixelRatio,this.reduceFactor=1;const e=this.pixelRatio,s=t.canvas;if(s.element){const t=s.element;s.size.width=t.offsetWidth*e,s.size.height=t.offsetHeight*e}const a=i.particles,r=a.move;this.maxSpeed=(0,g.Gu)(r.gravity.maxSpeed)*e,this.sizeAnimationSpeed=(0,g.Gu)(a.size.animation.speed)*e}initParticle(t){const i=t.options,e=this.pixelRatio,s=i.move,n=s.distance,a=t.retina;a.moveDrift=(0,g.Gu)(s.drift)*e,a.moveSpeed=(0,g.Gu)(s.speed)*e,a.sizeAnimationSpeed=(0,g.Gu)(i.size.animation.speed)*e;const r=a.maxDistance;r.horizontal=void 0!==n.horizontal?n.horizontal*e:void 0,r.vertical=void 0!==n.vertical?n.vertical*e:void 0,a.maxSpeed=(0,g.Gu)(s.gravity.maxSpeed)*e}}var O=e(3893);function k(t){return t&&!t.destroyed}function T(t,i,...e){const s=new p.E(t,i);return(0,O.h)(s,...e),s}class P{constructor(t,i,e){this._intersectionManager=t=>{if(k(this)&&this.actualOptions.pauseOnOutsideViewport)for(const i of t)i.target===this.interactivity.element&&(i.isIntersecting?this.play():this.pause())},this._nextFrame=async t=>{try{if(!this._smooth&&void 0!==this._lastFrameTime&&t<this._lastFrameTime+s.X5/this.fpsLimit)return void this.draw(!1);this._lastFrameTime??=t;const i=function(t,i=60,e=!1){return{value:t,factor:e?60/i:60*t/s.X5}}(t-this._lastFrameTime,this.fpsLimit,this._smooth);if(this.addLifeTime(i.value),this._lastFrameTime=t,i.value>s.X5)return void this.draw(!1);if(await this.particles.draw(i),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){(0,n.jl)().error(`${s.gK} in animation loop`,t)}},this._engine=t,this.id=Symbol(i),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 b(this),this.canvas=new c(this),this.particles=new z(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=T(this._engine,this),this.actualOptions=T(this._engine,this),this._eventListeners=new u(this),this._intersectionObserver=(0,n.NM)((t=>this._intersectionManager(t))),this._engine.dispatchEvent("containerBuilt",{container:this})}get animationStatus(){return!this._paused&&!this.pageHidden&&k(this)}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addClickHandler(t){if(!k(this))return;const i=this.interactivity.element;if(!i)return;const e=(i,e,s)=>{if(!k(this))return;const n=this.retina.pixelRatio,a={x:e.x*n,y:e.y*n},r=this.particles.quadTree.queryCircle(a,s*n);t(i,r)};let s=!1,n=!1;i.addEventListener("click",(t=>{if(!k(this))return;const i=t,s={x:i.offsetX||i.clientX,y:i.offsetY||i.clientY};e(t,s,1)})),i.addEventListener("touchstart",(()=>{k(this)&&(s=!0,n=!1)})),i.addEventListener("touchmove",(()=>{k(this)&&(n=!0)})),i.addEventListener("touchend",(t=>{if(k(this)){if(s&&!n){const i=t,s=1;let n=i.touches[i.touches.length-s];if(!n&&(n=i.changedTouches[i.changedTouches.length-s],!n))return;const a=this.canvas.element,r=a?a.getBoundingClientRect():void 0,o=0,h={x:n.clientX-(r?r.left:o),y:n.clientY-(r?r.top:o)};e(t,h,Math.max(n.radiusX,n.radiusY))}s=!1,n=!1}})),i.addEventListener("touchcancel",(()=>{k(this)&&(s=!1,n=!1)}))}addLifeTime(t){this._lifeTime+=t}addPath(t,i,e=!1){return!(!k(this)||!e&&this.pathGenerators.has(t))&&(this.pathGenerators.set(t,i),!0)}alive(){return!this._duration||this._lifeTime<=this._duration}destroy(){if(!k(this))return;this.stop(),this.particles.destroy(),this.canvas.destroy();for(const[,t]of this.effectDrawers)t.destroy?.(this);for(const[,t]of this.shapeDrawers)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(),i=t.findIndex((t=>t===this));if(i>=0){const e=1;t.splice(i,e)}this._engine.dispatchEvent("containerDestroyed",{container:this})}draw(t){if(!k(this))return;let i=t;const e=async t=>{i&&(this._lastFrameTime=void 0,i=!1),await this._nextFrame(t)};this._drawAnimationFrame=requestAnimationFrame((t=>{e(t)}))}async export(t,i={}){for(const[,e]of this.plugins){if(!e.export)continue;const s=await e.export(t,i);if(s.supported)return s.blob}(0,n.jl)().error(`${s.gK} - Export plugin with type ${t} not found`)}handleClickMode(t){if(k(this)){this.particles.handleClickMode(t);for(const[,i]of this.plugins)i.handleClickMode?.(t)}}async init(){if(!k(this))return;const t=this._engine.getSupportedEffects();for(const i of t){const t=this._engine.getEffectDrawer(i);t&&this.effectDrawers.set(i,t)}const i=this._engine.getSupportedShapes();for(const t of i){const i=this._engine.getShapeDrawer(t);i&&this.shapeDrawers.set(t,i)}await this.particles.initPlugins(),this._options=T(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=T(this._engine,this,this._options);const e=await this._engine.getAvailablePlugins(this);for(const[t,i]of e)this.plugins.set(t,i);this.retina.init(),await this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize(),this.zLayers=this.actualOptions.zLayers,this._duration=(0,g.Gu)(this.actualOptions.duration)*s.X5,this._delay=(0,g.Gu)(this.actualOptions.delay)*s.X5,this._lifeTime=0;this.fpsLimit=this.actualOptions.fpsLimit>0?this.actualOptions.fpsLimit:120,this._smooth=this.actualOptions.smooth;for(const[,t]of this.effectDrawers)await(t.init?.(this));for(const[,t]of this.shapeDrawers)await(t.init?.(this));for(const[,t]of this.plugins)await(t.init?.());this._engine.dispatchEvent("containerInit",{container:this}),await this.particles.init(),await this.particles.setDensity();for(const[,t]of this.plugins)t.particlesSetup?.();this._engine.dispatchEvent("particlesSetup",{container:this})}async loadTheme(t){k(this)&&(this._currentTheme=t,await this.refresh())}pause(){if(k(this)&&(void 0!==this._drawAnimationFrame&&(cancelAnimationFrame(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(const[,t]of this.plugins)t.pause?.();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent("containerPaused",{container:this})}}play(t){if(!k(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(k(this))return this.stop(),this.start()}async reset(){if(k(this))return this._initialSourceOptions=void 0,this._options=T(this._engine,this),this.actualOptions=T(this._engine,this,this._options),this.refresh()}async start(){k(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{const i=async()=>{this._eventListeners.addListeners(),this.interactivity.element instanceof HTMLElement&&this._intersectionObserver&&this._intersectionObserver.observe(this.interactivity.element);for(const[,t]of this.plugins)await(t.start?.());this._engine.dispatchEvent("containerStarted",{container:this}),this.play(),t()};this._delayTimeout=setTimeout((()=>{i()}),this._delay)})))}stop(){if(k(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?.();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)}}}}]);
@@ -1 +1 @@
1
- /*! tsParticles Engine v3.2.1 by Matteo Bruni */
1
+ /*! tsParticles Engine v3.2.2 by Matteo Bruni */
@@ -33,7 +33,7 @@ export class Container {
33
33
  continue;
34
34
  }
35
35
  if (entry.isIntersecting) {
36
- this.play();
36
+ void this.play();
37
37
  }
38
38
  else {
39
39
  this.pause();
@@ -50,7 +50,7 @@ export class Engine {
50
50
  return res;
51
51
  }
52
52
  get version() {
53
- return "3.2.1";
53
+ return "3.2.2";
54
54
  }
55
55
  addConfig(config) {
56
56
  const key = config.key ?? config.name ?? "default";
@@ -1,10 +1,9 @@
1
+ import { Vector, Vector3d } from "./Utils/Vectors.js";
1
2
  import { calcExactPositionOrRandomFromSize, clamp, degToRad, getDistance, getParticleBaseVelocity, getParticleDirectionAngle, getRandom, getRangeValue, randomInRange, setRangeValue, } from "../Utils/NumberUtils.js";
2
3
  import { deepExtend, getPosition, initParticleNumericAnimationValue, isInArray, itemFromSingleOrMultiple, } from "../Utils/Utils.js";
3
4
  import { errorPrefix, millisecondsToSeconds } from "./Utils/Constants.js";
4
5
  import { getHslFromAnimation, rangeColorToRgb } from "../Utils/ColorUtils.js";
5
6
  import { Interactivity } from "../Options/Classes/Interactivity/Interactivity.js";
6
- import { Vector } from "./Utils/Vector.js";
7
- import { Vector3d } from "./Utils/Vector3d.js";
8
7
  import { alterHsl } from "../Utils/CanvasUtils.js";
9
8
  import { loadParticlesOptions } from "../Utils/OptionsUtils.js";
10
9
  const defaultRetryCount = 0, double = 2, half = 0.5, squareExp = 2;
@@ -2,7 +2,7 @@ import { getLogger, getPosition } from "../Utils/Utils.js";
2
2
  import { InteractionManager } from "./Utils/InteractionManager.js";
3
3
  import { Point } from "./Utils/Point.js";
4
4
  import { QuadTree } from "./Utils/QuadTree.js";
5
- import { Rectangle } from "./Utils/Rectangle.js";
5
+ import { Rectangle } from "./Utils/Ranges.js";
6
6
  import { errorPrefix } from "./Utils/Constants.js";
7
7
  const qTreeCapacity = 4, squareExp = 2, defaultRemoveQuantity = 1;
8
8
  const qTreeRectangle = (canvasSize) => {
@@ -1,5 +1,6 @@
1
- import { executeOnSingleOrMultiple, isBoolean, safeMatchMedia } from "../../Utils/Utils.js";
1
+ import { executeOnSingleOrMultiple, safeMatchMedia } from "../../Utils/Utils.js";
2
2
  import { millisecondsToSeconds, mouseDownEvent, mouseLeaveEvent, mouseMoveEvent, mouseOutEvent, mouseUpEvent, resizeEvent, touchCancelEvent, touchEndEvent, touchMoveEvent, touchStartEvent, visibilityChangeEvent, } from "./Constants.js";
3
+ import { isBoolean } from "../../Utils/TypeUtils.js";
3
4
  const double = 2;
4
5
  function manageListener(element, event, handler, add, options) {
5
6
  if (add) {
@@ -56,10 +57,10 @@ export class EventListeners {
56
57
  else {
57
58
  container.pageHidden = false;
58
59
  if (container.animationStatus) {
59
- container.play(true);
60
+ void container.play(true);
60
61
  }
61
62
  else {
62
- container.draw(true);
63
+ void container.draw(true);
63
64
  }
64
65
  }
65
66
  };
@@ -1,5 +1,4 @@
1
- import { Circle } from "./Circle.js";
2
- import { Rectangle } from "./Rectangle.js";
1
+ import { Circle, Rectangle } from "./Ranges.js";
3
2
  import { getDistance } from "../../Utils/NumberUtils.js";
4
3
  const half = 0.5, double = 2, subdivideCount = 4;
5
4
  export class QuadTree {
@@ -31,8 +30,8 @@ export class QuadTree {
31
30
  }
32
31
  return this._subs.some((sub) => sub.insert(point));
33
32
  }
34
- query(range, check, found) {
35
- const res = found ?? [];
33
+ query(range, check) {
34
+ const res = [];
36
35
  if (!range.intersects(this.rectangle)) {
37
36
  return [];
38
37
  }
@@ -46,7 +45,7 @@ export class QuadTree {
46
45
  }
47
46
  if (this._divided) {
48
47
  for (const sub of this._subs) {
49
- sub.query(range, check, res);
48
+ res.push(...sub.query(range, check));
50
49
  }
51
50
  }
52
51
  return res;
@@ -0,0 +1,55 @@
1
+ import { getDistance } from "../../Utils/NumberUtils.js";
2
+ const squareExp = 2;
3
+ export class BaseRange {
4
+ constructor(x, y, type) {
5
+ this.position = {
6
+ x: x,
7
+ y: y,
8
+ };
9
+ this.type = type;
10
+ }
11
+ }
12
+ export class Circle extends BaseRange {
13
+ constructor(x, y, radius) {
14
+ super(x, y, "circle");
15
+ this.radius = radius;
16
+ }
17
+ contains(point) {
18
+ return getDistance(point, this.position) <= this.radius;
19
+ }
20
+ intersects(range) {
21
+ const pos1 = this.position, pos2 = range.position, distPos = { x: Math.abs(pos2.x - pos1.x), y: Math.abs(pos2.y - pos1.y) }, r = this.radius;
22
+ if (range instanceof Circle || range.type === "circle") {
23
+ const circleRange = range, rSum = r + circleRange.radius, dist = Math.sqrt(distPos.x ** squareExp + distPos.y ** squareExp);
24
+ return rSum > dist;
25
+ }
26
+ else if (range instanceof Rectangle || range.type === "rectangle") {
27
+ const rectRange = range, { width, height } = rectRange.size, edges = Math.pow(distPos.x - width, squareExp) + Math.pow(distPos.y - height, squareExp);
28
+ return (edges <= r ** squareExp ||
29
+ (distPos.x <= r + width && distPos.y <= r + height) ||
30
+ distPos.x <= width ||
31
+ distPos.y <= height);
32
+ }
33
+ return false;
34
+ }
35
+ }
36
+ export class Rectangle extends BaseRange {
37
+ constructor(x, y, width, height) {
38
+ super(x, y, "rectangle");
39
+ this.size = {
40
+ height: height,
41
+ width: width,
42
+ };
43
+ }
44
+ contains(point) {
45
+ const w = this.size.width, h = this.size.height, pos = this.position;
46
+ return point.x >= pos.x && point.x <= pos.x + w && point.y >= pos.y && point.y <= pos.y + h;
47
+ }
48
+ intersects(range) {
49
+ if (range instanceof Circle) {
50
+ return range.intersects(this);
51
+ }
52
+ const w = this.size.width, h = this.size.height, pos1 = this.position, pos2 = range.position, size2 = range instanceof Rectangle ? range.size : { width: 0, height: 0 }, w2 = size2.width, h2 = size2.height;
53
+ return pos2.x < pos1.x + w && pos2.x + w2 > pos1.x && pos2.y < pos1.y + h && pos2.y + h2 > pos1.y;
54
+ }
55
+ }
@@ -1,5 +1,5 @@
1
1
  import { errorPrefix } from "./Constants.js";
2
- import { isNumber } from "../../Utils/Utils.js";
2
+ import { isNumber } from "../../Utils/TypeUtils.js";
3
3
  const origin = {
4
4
  x: 0,
5
5
  y: 0,
@@ -107,3 +107,17 @@ export class Vector3d {
107
107
  this.z -= v.z;
108
108
  }
109
109
  }
110
+ export class Vector extends Vector3d {
111
+ constructor(xOrCoords, y) {
112
+ super(xOrCoords, y, origin.z);
113
+ }
114
+ static get origin() {
115
+ return Vector.create(origin.x, origin.y);
116
+ }
117
+ static clone(source) {
118
+ return Vector.create(source.x, source.y);
119
+ }
120
+ static create(x, y) {
121
+ return new Vector(x, y);
122
+ }
123
+ }
@@ -1,4 +1,4 @@
1
- import { isArray, isString } from "../../Utils/Utils.js";
1
+ import { isArray, isString } from "../../Utils/TypeUtils.js";
2
2
  import { HslAnimation } from "./HslAnimation.js";
3
3
  import { OptionsColor } from "./OptionsColor.js";
4
4
  export class AnimatableColor extends OptionsColor {
@@ -1,5 +1,5 @@
1
1
  import { BackgroundMaskCover } from "./BackgroundMaskCover.js";
2
- import { isString } from "../../../Utils/Utils.js";
2
+ import { isString } from "../../../Utils/TypeUtils.js";
3
3
  export class BackgroundMask {
4
4
  constructor() {
5
5
  this.composite = "destination-out";
@@ -1,4 +1,4 @@
1
- import { deepExtend, executeOnSingleOrMultiple, isBoolean, safeMatchMedia } from "../../Utils/Utils.js";
1
+ import { deepExtend, executeOnSingleOrMultiple, safeMatchMedia } from "../../Utils/Utils.js";
2
2
  import { Background } from "./Background/Background.js";
3
3
  import { BackgroundMask } from "./BackgroundMask/BackgroundMask.js";
4
4
  import { FullScreen } from "./FullScreen/FullScreen.js";
@@ -6,6 +6,7 @@ import { Interactivity } from "./Interactivity/Interactivity.js";
6
6
  import { ManualParticle } from "./ManualParticle.js";
7
7
  import { Responsive } from "./Responsive.js";
8
8
  import { Theme } from "./Theme/Theme.js";
9
+ import { isBoolean } from "../../Utils/TypeUtils.js";
9
10
  import { loadParticlesOptions } from "../../Utils/OptionsUtils.js";
10
11
  import { setRangeValue } from "../../Utils/NumberUtils.js";
11
12
  export class Options {
@@ -1,4 +1,4 @@
1
- import { isArray, isString } from "../../Utils/Utils.js";
1
+ import { isArray, isString } from "../../Utils/TypeUtils.js";
2
2
  export class OptionsColor {
3
3
  constructor() {
4
4
  this.value = "";
@@ -1,4 +1,4 @@
1
- import { isNumber, isObject } from "../../../../Utils/Utils.js";
1
+ import { isNumber, isObject } from "../../../../Utils/TypeUtils.js";
2
2
  import { MoveAngle } from "./MoveAngle.js";
3
3
  import { MoveAttract } from "./MoveAttract.js";
4
4
  import { MoveCenter } from "./MoveCenter.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { clamp, getRandom, getRangeMax, getRangeMin, getRangeValue, mix, randomInRange, setRangeValue, } from "./NumberUtils.js";
2
- import { isArray, isString, itemFromArray } from "./Utils.js";
2
+ import { isArray, isString } from "./TypeUtils.js";
3
3
  import { millisecondsToSeconds, percentDenominator } from "../Core/Utils/Constants.js";
4
+ import { itemFromArray } from "./Utils.js";
4
5
  const randomColorValue = "random", midColorValue = "mid", colorManagers = new Map();
5
6
  export function addColorManager(manager) {
6
7
  colorManagers.set(manager.key, manager);
@@ -1,5 +1,5 @@
1
- import { Vector } from "../Core/Utils/Vector.js";
2
- import { isNumber } from "./Utils.js";
1
+ import { Vector } from "../Core/Utils/Vectors.js";
2
+ import { isNumber } from "./TypeUtils.js";
3
3
  import { percentDenominator } from "../Core/Utils/Constants.js";
4
4
  let _random = Math.random;
5
5
  const easings = new Map(), double = 2, doublePI = Math.PI * double;
@@ -0,0 +1,18 @@
1
+ export function isBoolean(arg) {
2
+ return typeof arg === "boolean";
3
+ }
4
+ export function isString(arg) {
5
+ return typeof arg === "string";
6
+ }
7
+ export function isNumber(arg) {
8
+ return typeof arg === "number";
9
+ }
10
+ export function isFunction(arg) {
11
+ return typeof arg === "function";
12
+ }
13
+ export function isObject(arg) {
14
+ return typeof arg === "object" && arg !== null;
15
+ }
16
+ export function isArray(arg) {
17
+ return Array.isArray(arg);
18
+ }
@@ -1,6 +1,7 @@
1
1
  import { clamp, collisionVelocity, getDistances, getRandom, getRangeMax, getRangeMin, getRangeValue, randomInRange, } from "./NumberUtils.js";
2
2
  import { halfRandom, millisecondsToSeconds, percentDenominator } from "../Core/Utils/Constants.js";
3
- import { Vector } from "../Core/Utils/Vector.js";
3
+ import { isArray, isObject } from "./TypeUtils.js";
4
+ import { Vector } from "../Core/Utils/Vectors.js";
4
5
  const _logger = {
5
6
  debug: console.debug,
6
7
  error: console.error,
@@ -332,24 +333,6 @@ export function getPosition(position, canvasSize) {
332
333
  export function getSize(size, canvasSize) {
333
334
  return getPositionOrSize(size, canvasSize);
334
335
  }
335
- export function isBoolean(arg) {
336
- return typeof arg === "boolean";
337
- }
338
- export function isString(arg) {
339
- return typeof arg === "string";
340
- }
341
- export function isNumber(arg) {
342
- return typeof arg === "number";
343
- }
344
- export function isFunction(arg) {
345
- return typeof arg === "function";
346
- }
347
- export function isObject(arg) {
348
- return typeof arg === "object" && arg !== null;
349
- }
350
- export function isArray(arg) {
351
- return Array.isArray(arg);
352
- }
353
336
  function checkDestroy(particle, destroyType, value, minValue, maxValue) {
354
337
  switch (destroyType) {
355
338
  case "max":
@@ -1,12 +1,9 @@
1
- export * from "./Core/Utils/Circle.js";
2
1
  export * from "./Core/Utils/Constants.js";
3
2
  export * from "./Core/Utils/ExternalInteractorBase.js";
4
3
  export * from "./Core/Utils/ParticlesInteractorBase.js";
5
4
  export * from "./Core/Utils/Point.js";
6
- export * from "./Core/Utils/Range.js";
7
- export * from "./Core/Utils/Rectangle.js";
8
- export * from "./Core/Utils/Vector.js";
9
- export * from "./Core/Utils/Vector3d.js";
5
+ export * from "./Core/Utils/Ranges.js";
6
+ export * from "./Core/Utils/Vectors.js";
10
7
  export * from "./Enums/Directions/MoveDirection.js";
11
8
  export * from "./Enums/Directions/RotateDirection.js";
12
9
  export * from "./Enums/Directions/OutModeDirection.js";
@@ -86,3 +83,4 @@ export * from "./Utils/NumberUtils.js";
86
83
  export * from "./Utils/OptionsUtils.js";
87
84
  export * from "./Utils/RgbColorManager.js";
88
85
  export * from "./Utils/Utils.js";
86
+ export * from "./Utils/TypeUtils.js";
@@ -36,7 +36,7 @@ class Container {
36
36
  continue;
37
37
  }
38
38
  if (entry.isIntersecting) {
39
- this.play();
39
+ void this.play();
40
40
  }
41
41
  else {
42
42
  this.pause();
@@ -76,7 +76,7 @@ class Engine {
76
76
  return res;
77
77
  }
78
78
  get version() {
79
- return "3.2.1";
79
+ return "3.2.2";
80
80
  }
81
81
  addConfig(config) {
82
82
  const key = config.key ?? config.name ?? "default";
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Particle = void 0;
4
+ const Vectors_js_1 = require("./Utils/Vectors.js");
4
5
  const NumberUtils_js_1 = require("../Utils/NumberUtils.js");
5
6
  const Utils_js_1 = require("../Utils/Utils.js");
6
7
  const Constants_js_1 = require("./Utils/Constants.js");
7
8
  const ColorUtils_js_1 = require("../Utils/ColorUtils.js");
8
9
  const Interactivity_js_1 = require("../Options/Classes/Interactivity/Interactivity.js");
9
- const Vector_js_1 = require("./Utils/Vector.js");
10
- const Vector3d_js_1 = require("./Utils/Vector3d.js");
11
10
  const CanvasUtils_js_1 = require("../Utils/CanvasUtils.js");
12
11
  const OptionsUtils_js_1 = require("../Utils/OptionsUtils.js");
13
12
  const defaultRetryCount = 0, double = 2, half = 0.5, squareExp = 2;
@@ -50,13 +49,13 @@ class Particle {
50
49
  for (const [, plugin] of container.plugins) {
51
50
  const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
52
51
  if (pluginPos) {
53
- return Vector3d_js_1.Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
52
+ return Vectors_js_1.Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
54
53
  }
55
54
  }
56
55
  const canvasSize = container.canvas.size, exactPosition = (0, NumberUtils_js_1.calcExactPositionOrRandomFromSize)({
57
56
  size: canvasSize,
58
57
  position: position,
59
- }), pos = Vector3d_js_1.Vector3d.create(exactPosition.x, exactPosition.y, zIndex), radius = this.getRadius(), outModes = this.options.move.outModes, fixHorizontal = (outMode) => {
58
+ }), pos = Vectors_js_1.Vector3d.create(exactPosition.x, exactPosition.y, zIndex), radius = this.getRadius(), outModes = this.options.move.outModes, fixHorizontal = (outMode) => {
60
59
  fixOutMode({
61
60
  outMode,
62
61
  checkModes: ["bounce"],
@@ -152,7 +151,7 @@ class Particle {
152
151
  this.outType = "outside";
153
152
  break;
154
153
  }
155
- this.offset = Vector_js_1.Vector.origin;
154
+ this.offset = Vectors_js_1.Vector.origin;
156
155
  };
157
156
  this._engine = engine;
158
157
  }
@@ -28,12 +28,12 @@ const Utils_js_1 = require("../Utils/Utils.js");
28
28
  const InteractionManager_js_1 = require("./Utils/InteractionManager.js");
29
29
  const Point_js_1 = require("./Utils/Point.js");
30
30
  const QuadTree_js_1 = require("./Utils/QuadTree.js");
31
- const Rectangle_js_1 = require("./Utils/Rectangle.js");
31
+ const Ranges_js_1 = require("./Utils/Ranges.js");
32
32
  const Constants_js_1 = require("./Utils/Constants.js");
33
33
  const qTreeCapacity = 4, squareExp = 2, defaultRemoveQuantity = 1;
34
34
  const qTreeRectangle = (canvasSize) => {
35
35
  const { height, width } = canvasSize, posOffset = -0.25, sizeFactor = 1.5;
36
- return new Rectangle_js_1.Rectangle(posOffset * width, posOffset * height, sizeFactor * width, sizeFactor * height);
36
+ return new Ranges_js_1.Rectangle(posOffset * width, posOffset * height, sizeFactor * width, sizeFactor * height);
37
37
  };
38
38
  class Particles {
39
39
  constructor(engine, container) {
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventListeners = void 0;
4
4
  const Utils_js_1 = require("../../Utils/Utils.js");
5
5
  const Constants_js_1 = require("./Constants.js");
6
+ const TypeUtils_js_1 = require("../../Utils/TypeUtils.js");
6
7
  const double = 2;
7
8
  function manageListener(element, event, handler, add, options) {
8
9
  if (add) {
9
10
  let addOptions = { passive: true };
10
- if ((0, Utils_js_1.isBoolean)(options)) {
11
+ if ((0, TypeUtils_js_1.isBoolean)(options)) {
11
12
  addOptions.capture = options;
12
13
  }
13
14
  else if (options !== undefined) {
@@ -59,10 +60,10 @@ class EventListeners {
59
60
  else {
60
61
  container.pageHidden = false;
61
62
  if (container.animationStatus) {
62
- container.play(true);
63
+ void container.play(true);
63
64
  }
64
65
  else {
65
- container.draw(true);
66
+ void container.draw(true);
66
67
  }
67
68
  }
68
69
  };