iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 36.9 kB
JavaScript
export const __rspack_esm_id=39094;export const __rspack_esm_ids=[39094];export const __webpack_modules__={77957(t,i,e){var s=e(76080),a=e(79504),r=e(47055),n=e(48981),o=e(56969),h=e(26198),l=e(2360),c=e(35370),d=Array,u=a([].push);t.exports=function(t,i,e,a){for(var p,_,f,g=n(t),P=r(g),y=s(i,e),m=l(null),w=h(P),v=0;w>v;v++)f=P[v],(_=o(y(f,v,g)))in m?u(m[_],f):m[_]=[f];if(a&&(p=a(g))!==d)for(_ in m)m[_]=c(p,m[_]);return m}},46058(t,i,e){var s=e(46518),a=e(77957),r=e(6469);s({target:"Array",proto:!0},{group:function(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}}),r("group")},63893(t,i,e){e.d(i,{Container:()=>B});e(44114),e(45367),e(92731);var s=e(65746),a=(e(17642),e(58004),e(33853),e(45876),e(32475),e(15024),e(31698),e(88454),e(29452),e(35128)),r=e(90500),n=e(53461);function o(t,i){t.clearRect(r.bo.x,r.bo.y,i.width,i.height)}function h(t,i,e,s){i.drawParticle&&i.drawParticle(t,e,s)}function l(t,i,e){const s=i[e];void 0!==s&&(t[e]=(t[e]??1)*s)}class c{get settings(){return this._contextSettings}canvasClear(){this._container.actualOptions.clear&&this.draw(t=>{o(t,this._canvasManager.size)})}clear(){let t=!1;for(const i of this._canvasClearPlugins)if(t=i.canvasClear?.()??!1,t)break;t||this.canvasClear()}destroy(){this.stop(),this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesCleanupPlugins=[],this._drawParticlesSetupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[]}draw(t){const i=this._context;if(i)return t(i)}drawParticle(t,i){if(t.spawning||t.destroyed)return;const e=t.getRadius();if(e<=0)return;const s=t.getFillColor(),a=t.getStrokeColor();let[r,o]=this._getPluginParticleColors(t);if(r??=s,o??=a,!r&&!o)return;const h=this._container,l=t.options.zIndex,c=1-t.zIndexFactor,{fillOpacity:d,opacity:u,strokeOpacity:p}=t.getOpacity(),_=this._reusableTransform,f=this._reusableColorStyles,g=r?(0,n.LC)(r,h.hdr,d*u):void 0,P=o?(0,n.LC)(o,h.hdr,p*u):g;_.a=_.b=_.c=_.d=void 0,f.fill=g,f.stroke=P,this.draw(s=>{for(const e of this._drawParticlesSetupPlugins)e.drawParticleSetup?.(s,t,i);this._applyPreDrawUpdaters(s,t,e,u,f,_),function(t){const{container:i,context:e,particle:s,delta:a,colorStyles:r,radius:n,opacity:o,transform:h}=t,{effectDrawers:l,shapeDrawers:c}=i,d=s.getPosition(),u=s.getTransformData(h),p={x:d.x,y:d.y};e.setTransform(u.a,u.b,u.c,u.d,d.x,d.y),r.fill&&(e.fillStyle=r.fill);const _=!!s.fillEnabled,f=s.strokeWidth??0;e.lineWidth=f,r.stroke&&(e.strokeStyle=r.stroke);const g={context:e,particle:s,radius:n,drawRadius:1*n,opacity:o,delta:a,pixelRatio:i.retina.pixelRatio,fill:_,stroke:f>0,transformData:u,position:{...d},drawPosition:p,drawScale:1};for(const t of i.plugins)t.drawParticleTransform?.(g);const P=s.effect?l.get(s.effect):void 0,y=s.shape?c.get(s.shape):void 0;!function(t,i){if(!t?.drawBefore)return;const{particle:e}=i;e.effect&&t.drawBefore(i)}(P,g),function(t,i){if(!t?.beforeDraw)return;const{particle:e}=i;e.shape&&t.beforeDraw(i)}(y,g),function(t,i){if(!t)return;const{context:e,fill:s,particle:a,stroke:r}=i;a.shape&&(e.beginPath(),t.draw(i),a.shapeClose&&e.closePath(),s&&e.fill(),r&&e.stroke())}(y,g),function(t,i){if(!t?.afterDraw)return;const{particle:e}=i;e.shape&&t.afterDraw(i)}(y,g),function(t,i){if(!t?.drawAfter)return;const{particle:e}=i;e.effect&&t.drawAfter(i)}(P,g),e.resetTransform()}({container:h,context:s,particle:t,delta:i,colorStyles:f,radius:e*c**l.sizeRate,opacity:u,transform:_}),this._applyPostDrawUpdaters(t);for(const e of this._drawParticlesCleanupPlugins)e.drawParticleCleanup?.(s,t,i)})}drawParticlePlugins(t,i){this.draw(e=>{for(const s of this._drawParticlePlugins)h(e,s,t,i)})}drawParticles(t){const{particles:i}=this._container;this.clear(),i.update(t),this.draw(e=>{for(const i of this._drawSettingsSetupPlugins)i.drawSettingsSetup?.(e,t);for(const i of this._drawPlugins)i.draw?.(e,t);i.drawParticles(t);for(const i of this._clearDrawPlugins)i.clearDraw?.(e,t);for(const i of this._drawSettingsCleanupPlugins)i.drawSettingsCleanup?.(e,t)})}init(){this.initUpdaters(),this.initPlugins(),this.paint()}initPlugins(){this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesSetupPlugins=[],this._drawParticlesCleanupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[];for(const t of this._container.plugins)(t.particleFillColor??t.particleStrokeColor)&&this._colorPlugins.push(t),t.canvasClear&&this._canvasClearPlugins.push(t),t.canvasPaint&&this._canvasPaintPlugins.push(t),t.drawParticle&&this._drawParticlePlugins.push(t),t.drawParticleSetup&&this._drawParticlesSetupPlugins.push(t),t.drawParticleCleanup&&this._drawParticlesCleanupPlugins.push(t),t.draw&&this._drawPlugins.push(t),t.drawSettingsSetup&&this._drawSettingsSetupPlugins.push(t),t.drawSettingsCleanup&&this._drawSettingsCleanupPlugins.push(t),t.clearDraw&&this._clearDrawPlugins.push(t)}initUpdaters(){this._preDrawUpdaters=[],this._postDrawUpdaters=[];for(const t of this._container.particleUpdaters)t.afterDraw&&this._postDrawUpdaters.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this._preDrawUpdaters.push(t)}paint(){let t=!1;for(const i of this._canvasPaintPlugins)if(t=i.canvasPaint?.()??!1,t)break;t||this.paintBase()}paintBase(t){this.draw(i=>{!function(t,i,e){t.fillStyle=e??"rgba(0,0,0,0)",t.fillRect(r.bo.x,r.bo.y,i.width,i.height)}(i,this._canvasManager.size,t)})}paintImage(t,i){this.draw(e=>{!function(t,i,e,s){if(!e)return;const a=t.globalAlpha;t.globalAlpha=s,t.drawImage(e,r.bo.x,r.bo.y,i.width,i.height),t.globalAlpha=a}(e,this._canvasManager.size,t,i)})}setContext(t){this._context=t,this._context&&(this._context.globalCompositeOperation=r.yj)}setContextSettings(t){this._contextSettings=t}stop(){this.draw(t=>{o(t,this._canvasManager.size)})}constructor(t,i,e){this._reusableColorStyles={},this._reusablePluginColors=[void 0,void 0],this._reusableTransform={},this._applyPostDrawUpdaters=t=>{for(const i of this._postDrawUpdaters)i.afterDraw?.(t)},this._applyPreDrawUpdaters=(t,i,e,s,a,r)=>{for(const n of this._preDrawUpdaters){if(n.getColorStyles){const{fill:r,stroke:o}=n.getColorStyles(i,t,e,s);r&&(a.fill=r),o&&(a.stroke=o)}if(n.getTransformValues){const t=n.getTransformValues(i);for(const i in t)l(r,t,i)}n.beforeDraw?.(i)}},this._getPluginParticleColors=t=>{let i,e;for(const s of this._colorPlugins)if(!i&&s.particleFillColor&&(i=(0,n.R5)(this._pluginManager,s.particleFillColor(t))),!e&&s.particleStrokeColor&&(e=(0,n.R5)(this._pluginManager,s.particleStrokeColor(t))),i&&e)break;return this._reusablePluginColors[0]=i,this._reusablePluginColors[1]=e,this._reusablePluginColors},this._pluginManager=t,this._container=i,this._canvasManager=e,this._context=null,this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesCleanupPlugins=[],this._drawParticlesSetupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[]}}const d=new WeakMap;function u(t,i,e=!1){if(!i)return;const s=t.style,a=new Set;for(let t=0;t<s.length;t++){const i=s.item(t);i&&a.add(i)}for(let t=0;t<i.length;t++){const e=i.item(t);e&&a.add(e)}for(const t of a){const a=i.getPropertyValue(t);a?s.setProperty(t,a,e?"important":""):s.removeProperty(t)}}class p{get _fullScreen(){return this._container.actualOptions.fullScreen.enable}destroy(){if(this.stop(),this._generated){const t=this.domElement;t?.remove(),this.domElement=void 0,this.renderCanvas=void 0}else this._resetOriginalStyle();this.render.destroy(),this._resizePlugins=[]}getZoomCenter(){const t=this._container.retina.pixelRatio,{width:i,height:e}=this.size;return this._zoomCenter?this._zoomCenter:{x:.5*i/t,y:.5*e/t}}init(){this._safeMutationObserver(t=>{t.disconnect()}),this._mutationObserver=(0,a.tG)(t=>{for(const i of t)"attributes"===i.type&&"style"===i.attributeName&&this._repairStyle()}),this.resize(),this._initStyle(),this.initBackground(),this._safeMutationObserver(t=>{const i=this.domElement;i&&i instanceof Node&&t.observe(i,{attributes:!0})}),this.initPlugins(),this.render.init()}initBackground(){const{_container:t}=this,i=t.actualOptions.background,e=this.domElement;if(!e)return;const s=e.style,a=(0,n.BN)(this._pluginManager,i.color);s.backgroundColor=a?(0,n.xx)(a,t.hdr,i.opacity):"",s.backgroundImage=i.image||"",s.backgroundPosition=i.position||"",s.backgroundRepeat=i.repeat||"",s.backgroundSize=i.size||""}initPlugins(){this._resizePlugins=[];for(const t of this._container.plugins)t.resize&&this._resizePlugins.push(t)}loadCanvas(t){this._generated&&this.domElement&&this.domElement.remove();const i=this._container,e=(t=>"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement)(t)?t:void 0;this.domElement=e,this._generated=!!e&&"true"===e.dataset[r.eb],this.renderCanvas=e?(t=>{const i=d.get(t);if(i)return i;if("function"!=typeof t.transferControlToOffscreen)throw new TypeError("OffscreenCanvas is required but not supported by this browser");try{const i=t.transferControlToOffscreen();return d.set(t,i),i}catch{throw new TypeError("OffscreenCanvas transfer failed")}})(e):t;const s=this.domElement;s&&(s.ariaHidden="true",this._originalStyle=(0,a.td)(s.style));const n=this._standardSize,o=this.renderCanvas;s?(n.height=s.offsetHeight,n.width=s.offsetWidth):(n.height=o.height,n.width=o.width);const h=this._container.retina.pixelRatio,l=this.size;o.height=l.height=n.height*h,o.width=l.width=n.width*h;const c=(0,a.lV)("(color-gamut: p3)");this.render.setContextSettings({alpha:!0,colorSpace:c?.matches&&i.hdr?"display-p3":"srgb",desynchronized:!0,willReadFrequently:!1}),this.render.setContext(o.getContext("2d",this.render.settings)),this._safeMutationObserver(t=>{t.disconnect()}),i.retina.init(),this.initBackground(),this._safeMutationObserver(t=>{const i=this.domElement;i&&i instanceof Node&&t.observe(i,{attributes:!0})})}resize(){const t=this.domElement;if(!t)return!1;const i=this._container,e=this.renderCanvas;if(void 0===e)return!1;const s=i.canvas._standardSize,a={width:t.offsetWidth,height:t.offsetHeight},r=i.retina.pixelRatio,n={width:a.width*r,height:a.height*r};if(a.height===s.height&&a.width===s.width&&n.height===e.height&&n.width===e.width)return!1;const o={...s};s.height=a.height,s.width=a.width;const h=this.size;return e.width=h.width=n.width,e.height=h.height=n.height,this._container.started&&i.particles.setResizeFactor({width:s.width/o.width,height:s.height/o.height}),!0}setPointerEvents(t){this.domElement&&(this._pointerEvents=t,this._repairStyle())}setZoom(t,i){this.zoom=t,this._zoomCenter=i}stop(){this._safeMutationObserver(t=>{t.disconnect()}),this._mutationObserver=void 0,this.render.stop()}async windowResize(){if(!this.domElement||!this.resize())return;const t=this._container,i=t.updateActualOptions();t.particles.setDensity(),this._applyResizePlugins(),i&&await t.refresh()}constructor(t,i){this.zoom=1,this._applyResizePlugins=()=>{for(const t of this._resizePlugins)t.resize?.()},this._initStyle=()=>{const t=this.domElement,i=this._container.actualOptions;if(t){this._fullScreen?this._setFullScreenStyle():this._resetOriginalStyle();for(const e in i.style){if(!e||!(e in i.style))continue;const s=i.style[e];s&&t.style.setProperty(e,s,"important")}}},this._repairStyle=()=>{const t=this.domElement;if(!t)return;this._safeMutationObserver(t=>{t.disconnect()}),this._initStyle(),this.initBackground();const i=this._pointerEvents;t.style.pointerEvents=i,t.style.setProperty("pointer-events",i),this._safeMutationObserver(i=>{t instanceof Node&&i.observe(t,{attributes:!0})})},this._resetOriginalStyle=()=>{const t=this.domElement,i=this._originalStyle;t&&i&&u(t,i,!0)},this._safeMutationObserver=t=>{this._mutationObserver&&t(this._mutationObserver)},this._setFullScreenStyle=()=>{const t=this.domElement;t&&u(t,(0,a.hJ)(this._container.actualOptions.fullScreen.zIndex),!0)},this._pluginManager=t,this._container=i,this.render=new c(t,i,this),this._standardSize={height:0,width:0};const e=i.retina.pixelRatio,s=this._standardSize;this.size={height:s.height*e,width:s.width*e},this._generated=!1,this._resizePlugins=[],this._pointerEvents="none"}}e(18111),e(20116);class _{addListeners(){this._manageListeners(!0)}removeListeners(){this._manageListeners(!1)}constructor(t){this._handleVisibilityChange=()=>{const t=this.container;t.actualOptions.pauseOnBlur&&((0,a.T5)().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()},1e3*this.container.actualOptions.resize.delay)},this._manageListeners=t=>{const i=this._handlers;this._manageResize(t),(0,a.Kp)(document,r.nK,i.visibilityChange,t,!1)},this._manageResize=t=>{const i=this._handlers,e=this.container;if(!e.actualOptions.resize.enable)return;if("undefined"==typeof ResizeObserver)return void(0,a.Kp)(globalThis,"resize",i.resize,t);const s=e.canvas.domElement;this._resizeObserver&&!t?(s&&this._resizeObserver.unobserve(s),this._resizeObserver.disconnect(),delete this._resizeObserver):!this._resizeObserver&&t&&s&&(this._resizeObserver=new ResizeObserver(t=>{t.find(t=>t.target===s)&&this._handleWindowResize()}),this._resizeObserver.observe(s))},this.container=t,this._handlers={visibilityChange:()=>{this._handleVisibilityChange()},resize:()=>{this._handleWindowResize()}}}}var f=e(33904),g=e(46359),P=(e(22489),e(46058),e(24881)),y=e(23685),m=e(91519),w=e(39814),v=e(46398),b=e(9310);function z(t){if(!(0,a.hn)(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 x{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.shape?i.shapeDrawers.get(this.shape):void 0;e?.particleDestroy?.(this);for(const e of i.particleDestroyedPlugins)e.particleDestroyed?.(this,t);for(const e of i.particleUpdaters)e.particleDestroyed?.(this,t);this._container.dispatchEvent(f.B.particleDestroyed,{particle:this})}draw(t){const i=this._container.canvas.render;i.drawParticlePlugins(this,t),i.drawParticle(this,t)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:0)}getFillColor(){return this._getRollColor(this.bubble.color??(0,n.O_)(this.fillColor))}getMass(){return this.getRadius()**2*Math.PI*.5}getOpacity(){const t=this.options.zIndex,i=(1-this.zIndexFactor)**t.opacityRate,e=this.bubble.opacity??(0,s.VG)(this.opacity?.value??1),a=this.fillOpacity??1,r=this.strokeOpacity??1;return this._cachedOpacityData.fillOpacity=e*a*i,this._cachedOpacityData.opacity=e*i,this._cachedOpacityData.strokeOpacity=e*r*i,this._cachedOpacityData}getPosition(){return this._cachedPosition.x=this.position.x+this.offset.x,this._cachedPosition.y=this.position.y+this.offset.y,this._cachedPosition.z=this.position.z,this._cachedPosition}getRadius(){return this.bubble.radius??this.size.value}getRotateData(){const t=this.getAngle();return this._cachedRotateData.sin=Math.sin(t),this._cachedRotateData.cos=Math.cos(t),this._cachedRotateData}getStrokeColor(){return this._getRollColor(this.bubble.color??(0,n.O_)(this.strokeColor))}getTransformData(t){const i=this.getRotateData(),e=this.isRotating;return this._cachedTransform.a=i.cos*(t.a??r.Ug.a),this._cachedTransform.b=e?i.sin*(t.b??1):t.b??r.Ug.b,this._cachedTransform.c=e?-i.sin*(t.c??1):t.c??r.Ug.c,this._cachedTransform.d=i.cos*(t.d??r.Ug.d),this._cachedTransform}init(t,i,e,r){const n=this._container;this.id=t,this.group=r,this.justWarped=!1,this.effectClose=!0,this.shapeClose=!0,this.pathRotation=!1,this.lastPathTime=0,this.destroyed=!1,this.unbreakable=!1,this.isRotating=!1,this.rotation=0,this.misplaced=!1,this.retina={maxDistance:{},maxSpeed:0,moveDrift:0,moveSpeed:0,sizeAnimationSpeed:0},this.outType=v.x.normal,this.ignoresResizeRatio=!0;const o=n.retina.pixelRatio,h=n.actualOptions,l=(0,b.y)(this._pluginManager,n,h.particles),c=l.reduceDuplicates,d=l.effect.type,u=l.shape.type;this.effect=(0,a.TA)(d,this.id,c),this.shape=(0,a.TA)(u,this.id,c);const p=l.effect,_=l.shape;if(e){if(e.effect?.type){const t=e.effect.type,i=(0,a.TA)(t,this.id,c);i&&(this.effect=i,p.load(e.effect))}if(e.shape?.type){const t=e.shape.type,i=(0,a.TA)(t,this.id,c);i&&(this.shape=i,_.load(e.shape))}}if("random"===this.effect){const t=[...this._container.effectDrawers.keys()];this.effect=t[Math.floor((0,s.G0)()*t.length)]}if("random"===this.shape){const t=[...this._container.shapeDrawers.keys()];this.shape=t[Math.floor((0,s.G0)()*t.length)]}this.effectData=this.effect?function(t,i,e,s){const r=i.options[t];return(0,a.zw)({close:i.close},(0,a.TA)(r,e,s))}(this.effect,p,this.id,c):void 0,this.shapeData=this.shape?function(t,i,e,s){const r=i.options[t];return(0,a.zw)({close:i.close},(0,a.TA)(r,e,s))}(this.shape,_,this.id,c):void 0,l.load(e);const f=this.effectData;f&&l.load(f.particles);const g=this.shapeData;let P,y;g&&l.load(g.particles),this.effectClose=f?.close??l.effect.close,this.shapeClose=g?.close??l.shape.close,this.options=l,n.retina.initParticle(this),this.size=(0,a.Xs)(this.options.size,o),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this._initPosition(i),this.initialVelocity=this._calculateVelocity(),this.velocity=this.initialVelocity.copy(),this.zIndexFactor=this.position.z/n.zLayers,this.sides=24,this.effect&&(P=n.effectDrawers.get(this.effect)),P?.loadEffect&&P.loadEffect(this),this.shape&&(y=n.shapeDrawers.get(this.shape)),y?.loadShape&&y.loadShape(this);const m=y?.getSidesCount;m&&(this.sides=m(this)),this.spawning=!1;for(const t of n.particleUpdaters)t.init(this);P?.particleInit?.(n,this),y?.particleInit?.(n,this);for(const t of n.particleCreatedPlugins)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}isShowingBack(){if(!this.roll)return!1;const t=this.roll.angle;if(this.roll.horizontal&&this.roll.vertical){const i=t%r.R1,e=i<0?i+r.R1:i;return e>=.5*Math.PI&&e<3*Math.PI*.5}if(this.roll.horizontal){const i=(t+.5*Math.PI)%(2*Math.PI),e=i<0?i+2*Math.PI:i;return e>=Math.PI&&e<2*Math.PI}if(this.roll.vertical){const i=t%(2*Math.PI),e=i<0?i+2*Math.PI:i;return e>=Math.PI&&e<2*Math.PI}return!1}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(const t of this._container.particleUpdaters)t.reset?.(this)}constructor(t,i){this._cachedOpacityData={fillOpacity:1,opacity:1,strokeOpacity:1},this._cachedPosition=y.p.origin,this._cachedRotateData={sin:0,cos:0},this._cachedTransform={a:1,b:0,c:0,d:1},this._calcPosition=(t,i)=>{let e=0,a=t?y.p.create(t.x,t.y,i):void 0;const r=this._container,n=r.particlePositionPlugins,o=this.options.move.outModes,h=this.getRadius(),l=r.canvas.size,c=new AbortController,{signal:d}=c;for(;!d.aborted;){for(const t of n){const e=t.particlePosition?.(a,this);if(e)return y.p.create(e.x,e.y,i)}const t=(0,s.Nx)({size:l,position:a}),c=y.p.create(t.x,t.y,i);this._fixHorizontal(c,h,o.left??o.default),this._fixHorizontal(c,h,o.right??o.default),this._fixVertical(c,h,o.top??o.default),this._fixVertical(c,h,o.bottom??o.default);let d=!0;for(const t of r.particles.checkParticlePositionPlugins)if(d=t.checkParticlePosition?.(this,c,e)??!0,!d)break;if(d)return c;e+=1,a=void 0}return a},this._calculateVelocity=()=>{const t=(0,s.$m)(this.direction).copy(),i=this.options.move;if(i.direction===m.F.inside||i.direction===m.F.outside)return t;const e=(0,s.pu)((0,s.VG)(i.angle.value)),a=(0,s.pu)((0,s.VG)(i.angle.offset)),r={left:a-.5*e,right:a+.5*e};return i.straight||(t.angle+=(0,s.vE)((0,s.DT)(r.left,r.right))),i.random&&"number"==typeof i.speed&&(t.length*=(0,s.G0)()),t},this._fixHorizontal=(t,i,e)=>{z({outMode:e,checkModes:[w.Y.bounce],coord:t.x,maxCoord:this._container.canvas.size.width,setCb:i=>t.x+=i,radius:i})},this._fixVertical=(t,i,e)=>{z({outMode:e,checkModes:[w.Y.bounce],coord:t.y,maxCoord:this._container.canvas.size.height,setCb:i=>t.y+=i,radius:i})},this._getRollColor=t=>t&&this.roll&&(this.backColor||this.roll.alter)&&this.isShowingBack()?this.backColor?this.backColor:this.roll.alter?(0,n.yx)(t,this.roll.alter.type,this.roll.alter.value):t:t,this._initPosition=t=>{const i=this._container,e=Math.floor((0,s.VG)(this.options.zIndex.value)),r=this._calcPosition(t,(0,s.qE)(e,0,i.zLayers));if(!r)throw new Error("a valid position cannot be found for particle");this.position=r,this.initialPosition=this.position.copy();const n=i.canvas.size;switch(this.moveCenter={...(0,a.E9)(this.options.move.center,n),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=(0,s.JY)(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case m.F.inside:this.outType=v.x.inside;break;case m.F.outside:this.outType=v.x.outside}this.offset=y.M.origin},this._pluginManager=t,this._container=i}}var C=e(52531);class S{clear(){this._cells.clear();const t=this._pendingCellSize;t&&(this._cellSize=t),this._pendingCellSize=void 0}insert(t){const{x:i,y:e}=t.getPosition(),s=this._cellKeyFromCoords(i,e);this._cells.has(s)||this._cells.set(s,[]),this._cells.get(s)?.push(t)}query(t,i,e=[]){const s=this._getRangeBounds(t);if(!s)return e;const a=Math.floor(s.minX/this._cellSize),r=Math.floor(s.maxX/this._cellSize),n=Math.floor(s.minY/this._cellSize),o=Math.floor(s.maxY/this._cellSize);for(let s=a;s<=r;s++)for(let a=n;a<=o;a++){const r=`${s}_${a}`,n=this._cells.get(r);if(n)for(const s of n)i&&!i(s)||t.contains(s.getPosition())&&e.push(s)}return e}queryCircle(t,i,e,s=[]){const a=this._acquireCircle(t.x,t.y,i),r=this.query(a,e,s);return this._releaseShapes(),r}queryRectangle(t,i,e,s=[]){const a=this._acquireRectangle(t.x,t.y,i.width,i.height),r=this.query(a,e,s);return this._releaseShapes(),r}setCellSize(t){this._pendingCellSize=t}_acquireCircle(t,i,e){return(this._circlePool[this._circlePoolIdx++]??=new C.jl(t,i,e)).reset(t,i,e)}_acquireRectangle(t,i,e,s){return(this._rectanglePool[this._rectanglePoolIdx++]??=new C.M_(t,i,e,s)).reset(t,i,e,s)}_cellKeyFromCoords(t,i){return`${Math.floor(t/this._cellSize)}_${Math.floor(i/this._cellSize)}`}_getRangeBounds(t){if(t instanceof C.jl){const i=t.radius,{x:e,y:s}=t.position;return{minX:e-i,maxX:e+i,minY:s-i,maxY:s+i}}if(t instanceof C.M_){const{x:i,y:e}=t.position,{width:s,height:a}=t.size;return{minX:i,maxX:i+s,minY:e,maxY:e+a}}return null}_releaseShapes(){this._circlePoolIdx=0,this._rectanglePoolIdx=0}constructor(t){this._cells=new Map,this._circlePool=[],this._rectanglePool=[],this._cellSize=t,this._circlePoolIdx=0,this._rectanglePoolIdx=0}}var k=e(13250);class D{get count(){return this._array.length}addParticle(t,i,e,s){const a=this._container.actualOptions.particles.number.limit.mode,r=void 0===e?this._limit:this._groupLimits.get(e)??this._limit,n=this.count;if(r>0)switch(a){case P.d.delete:{const t=n+1-r;t>0&&this.removeQuantity(t);break}case P.d.wait:if(n>=r)return}try{const a=this._pool.pop()??new x(this._pluginManager,this._container);a.init(this._nextId,t,i,e);let r=!0;return s&&(r=s(a)),r?(this._array.push(a),this._insertParticleIntoBucket(a),this._nextId++,this._container.dispatchEvent(f.B.particleAdded,{particle:a}),a):void this._pool.push(a)}catch(t){(0,k.t)().warning(`error adding particle: ${t}`)}}clear(){this._array=[],this._particleBuckets.clear(),this._resetBuckets(this._container.zLayers)}destroy(){this._array=[],this._pool.length=0,this._particleBuckets.clear(),this._zBuckets=[],this.checkParticlePositionPlugins=[],this._particleResetPlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._postParticleUpdatePlugins=[],this._updatePlugins=[]}drawParticles(t){for(let i=this._zBuckets.length-1;i>=0;i--){const e=this._zBuckets[i];if(e)for(const i of e)i.draw(t)}}filter(t){return this._array.filter(t)}find(t){return this._array.find(t)}get(t){return this._array[t]}async init(){const t=this._container,i=t.actualOptions;this.checkParticlePositionPlugins=[],this._updatePlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._particleResetPlugins=[],this._postParticleUpdatePlugins=[],this._particleBuckets.clear(),this._resetBuckets(t.zLayers),this.grid=new S(100*t.retina.pixelRatio);for(const i of t.plugins)i.redrawInit&&await i.redrawInit(),i.checkParticlePosition&&this.checkParticlePositionPlugins.push(i),i.update&&this._updatePlugins.push(i),i.particleUpdate&&this._particleUpdatePlugins.push(i),i.postUpdate&&this._postUpdatePlugins.push(i),i.particleReset&&this._particleResetPlugins.push(i),i.postParticleUpdate&&this._postParticleUpdatePlugins.push(i);await this._container.initDrawersAndUpdaters();for(const i of this._container.effectDrawers.values())await(i.init?.(t));for(const i of this._container.shapeDrawers.values())await(i.init?.(t));let e=!1;for(const i of t.plugins)if(e=i.particlesInitialization?.()??e,e)break;if(!e){const t=i.particles,e=t.groups;for(const i in e){const s=e[i];if(s)for(let e=this.count,a=0;a<s.number.value&&e<t.number.value;e++,a++)this.addParticle(void 0,s,i)}for(let i=this.count;i<t.number.value;i++)this.addParticle()}}push(t,i,e,s){for(let a=0;a<t;a++)this.addParticle(i,e,s)}async redraw(){this.clear(),await this.init(),this._container.canvas.render.drawParticles({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 a=0;for(let r=t;a<i&&r<this.count;r++)this._removeParticle(r,e,s)&&(r--,a++)}removeQuantity(t,i){this.removeAt(0,t,i)}setDensity(){const t=this._container.actualOptions,i=t.particles.groups;let e=0;for(const t of this._container.plugins)t.particlesDensityCount&&(e+=t.particlesDensityCount());for(const t in i){const s=i[t];if(!s)continue;const a=(0,b.y)(this._pluginManager,this._container,s);this._applyDensity(a,e,t)}this._applyDensity(t.particles,e)}setResizeFactor(t){this._resizeFactor=t}update(t){this.grid.clear();for(const i of this._updatePlugins)i.update?.(t);const i=this._updateParticlesPhase1(t);for(const i of this._postUpdatePlugins)i.postUpdate?.(t);if(this._updateParticlesPhase2(t,i),i.size)for(const t of i)this.remove(t);delete this._resizeFactor}constructor(t,i){this._addToPool=(...t)=>{this._pool.push(...t)},this._applyDensity=(t,i,e,s)=>{const a=t.number;if(!a.density.enable)return void(void 0===e?this._limit=a.limit.value:(s?.number.limit.value??a.limit.value)&&this._groupLimits.set(e,s?.number.limit.value??a.limit.value));const r=this._initDensityFactor(a.density),n=a.value,o=a.limit.value>0?a.limit.value:n,h=Math.min(n,o)*r+i,l=Math.min(this.count,this.filter(t=>t.group===e).length);void 0===e?this._limit=a.limit.value*r:this._groupLimits.set(e,a.limit.value*r),l<h?this.push(Math.abs(h-l),void 0,t,e):l>h&&this.removeQuantity(l-h,e)},this._createBuckets=t=>{const i=Math.max(Math.floor(t),1);return Array.from({length:i},()=>[])},this._getBucketIndex=t=>{const i=this._zBuckets.length-1;return i<=0?0:Math.min(Math.max(Math.floor(t),0),i)},this._getParticleInsertIndex=(t,i)=>{let e=0,s=t.length;for(;e<s;){const a=Math.floor((e+s)/2),r=t[a];r?r.id<i?e=a+1:s=a:s=a}return e},this._initDensityFactor=t=>{const i=this._container;if(!t.enable)return 1;const e=i.canvas.size,s=i.retina.pixelRatio;return e.width&&e.height?e.width*e.height/(t.height*t.width*s**2):1},this._insertParticleIntoBucket=t=>{const i=this._getBucketIndex(t.position.z),e=this._zBuckets[i];e&&(e.splice(this._getParticleInsertIndex(e,t.id),0,t),this._particleBuckets.set(t.id,i))},this._removeParticle=(t,i,e)=>{const s=this._array[t];return!!s&&(s.group===i&&(this._array.splice(t,1),this._removeParticleFromBucket(s),s.destroy(e),this._container.dispatchEvent(f.B.particleRemoved,{particle:s}),this._addToPool(s),!0))},this._removeParticleFromBucket=t=>{const i=this._particleBuckets.get(t.id)??this._getBucketIndex(t.position.z),e=this._zBuckets[i];if(!e)return void this._particleBuckets.delete(t.id);const s=this._getParticleInsertIndex(e,t.id);e[s]?.id===t.id?(e.splice(s,1),this._particleBuckets.delete(t.id)):this._particleBuckets.delete(t.id)},this._resetBuckets=t=>{const i=Math.max(Math.floor(t),1);if(this._zBuckets.length===i)for(const t of this._zBuckets)t.length=0;else this._zBuckets=this._createBuckets(i)},this._updateParticleBucket=t=>{const i=this._getBucketIndex(t.position.z),e=this._particleBuckets.get(t.id);if(void 0===e)return void this._insertParticleIntoBucket(t);if(e===i)return;const s=this._zBuckets[e];if(s){const i=this._getParticleInsertIndex(s,t.id);s[i]?.id===t.id&&s.splice(i,1)}const a=this._zBuckets[i];a?(a.splice(this._getParticleInsertIndex(a,t.id),0,t),this._particleBuckets.set(t.id,i)):this._particleBuckets.set(t.id,i)},this._updateParticlesPhase1=t=>{const i=new Set,e=this._resizeFactor;for(const s of this._array){e&&!s.ignoresResizeRatio&&(s.position.x*=e.width,s.position.y*=e.height,s.initialPosition.x*=e.width,s.initialPosition.y*=e.height),s.ignoresResizeRatio=!1;for(const t of this._particleResetPlugins)t.particleReset?.(s);for(const i of this._particleUpdatePlugins){if(s.destroyed)break;i.particleUpdate?.(s,t)}s.destroyed?i.add(s):this.grid.insert(s)}return i},this._updateParticlesPhase2=(t,i)=>{for(const e of this._array)if(e.destroyed)i.add(e);else{for(const i of this._container.particleUpdaters)i.update(e,t);if(!e.spawning)for(const i of this._postParticleUpdatePlugins)i.postParticleUpdate?.(e,t);this._updateParticleBucket(e)}},this._pluginManager=t,this._container=i,this._nextId=0,this._array=[],this._pool=[],this._limit=0,this._groupLimits=new Map,this._particleBuckets=new Map,this._zBuckets=this._createBuckets(this._container.zLayers),this.grid=new S(100),this.checkParticlePositionPlugins=[],this._particleResetPlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._postParticleUpdatePlugins=[],this._updatePlugins=[]}}class M{init(){const t=this.container,i=t.actualOptions;this.pixelRatio=i.detectRetina?devicePixelRatio:1,this.reduceFactor=1;const e=this.pixelRatio,s=t.canvas,a=s.domElement;a&&(s.size.width=a.offsetWidth*e,s.size.height=a.offsetHeight*e)}initParticle(t){const i=t.options,e=this.pixelRatio,a=i.move,r=a.distance,n=t.retina;n.maxSpeed=(0,s.VG)(a.gravity.maxSpeed)*e,n.moveDrift=(0,s.VG)(a.drift)*e,n.moveSpeed=(0,s.VG)(a.speed)*e,n.sizeAnimationSpeed=(0,s.VG)(i.size.animation.speed)*e;const o=n.maxDistance;o.horizontal=void 0===r.horizontal?void 0:r.horizontal*e,o.vertical=void 0===r.vertical?void 0:r.vertical*e}constructor(t){this.container=t,this.pixelRatio=1,this.reduceFactor=1}}function O(t){return!t.destroyed}function R(t,i,...e){const s=new g.J(t,i);return(0,b.Z)(s,...e),s}class B{get animationStatus(){return!this._paused&&!this.pageHidden&&O(this)}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addLifeTime(t){this._lifeTime+=t}alive(){return!this._duration||this._lifeTime<=this._duration}destroy(t=!0){if(O(this)){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.plugins)t.destroy?.();this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.plugins.length=0,this._pluginManager.clearPlugins(this),this.destroyed=!0,this._onDestroy(t),this.dispatchEvent(f.B.containerDestroyed)}}dispatchEvent(t,i){this._dispatchCallback(t,{container:this,data:i})}draw(t){if(!O(this))return;let i=t;this._drawAnimationFrame=(0,s.i0)(t=>{i&&(this._lastFrameTime=void 0,i=!1),this._nextFrame(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,k.t)().error(`Export plugin with type ${t} not found`)}async init(){if(!O(this))return;const t=new Map;for(const i of this._pluginManager.plugins){const e=await i.getPlugin(this);e.preInit&&await e.preInit(),t.set(i,e)}await this.initDrawersAndUpdaters(),this._options=R(this._pluginManager,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=R(this._pluginManager,this,this._options),this.plugins.length=0,this.particleDestroyedPlugins.length=0,this.particleCreatedPlugins.length=0,this.particlePositionPlugins.length=0;for(const[i,e]of t)i.needsPlugin(this.actualOptions)&&(this.plugins.push(e),e.particleCreated&&this.particleCreatedPlugins.push(e),e.particleDestroyed&&this.particleDestroyedPlugins.push(e),e.particlePosition&&this.particlePositionPlugins.push(e));this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();const{delay:i,duration:e,fpsLimit:a,hdr:r,smooth:n,zLayers:o}=this.actualOptions;this.hdr=r,this.zLayers=o,this._duration=1e3*(0,s.VG)(e),this._delay=1e3*(0,s.VG)(i),this._lifeTime=0,this.fpsLimit=a>0?a:120,this._smooth=n;for(const t of this.plugins)await(t.init?.());await this.particles.init(),this.dispatchEvent(f.B.containerInit),this.particles.setDensity();for(const t of this.plugins)t.particlesSetup?.();this.dispatchEvent(f.B.particlesSetup)}async initDrawersAndUpdaters(){const t=this._pluginManager;this.effectDrawers=await t.getEffectDrawers(this,!0),this.shapeDrawers=await t.getShapeDrawers(this,!0),this.particleUpdaters=await t.getUpdaters(this,!0)}pause(){if(O(this)&&(void 0!==this._drawAnimationFrame&&((0,s.px)(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(const t of this.plugins)t.pause?.();this.pageHidden||(this._paused=!0),this.dispatchEvent(f.B.containerPaused)}}play(t){if(!O(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.dispatchEvent(f.B.containerPlay),this.draw(i??!1)}else this._firstStart=!1}async refresh(){if(O(this))return this.stop(),this.start()}async reset(t){if(O(this))return this._initialSourceOptions=t,this._sourceOptions=t,this._options=R(this._pluginManager,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=R(this._pluginManager,this,this._options),this.refresh()}async start(){O(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise(t=>{const i=async()=>{this._eventListeners.addListeners();for(const t of this.plugins)await(t.start?.());this.dispatchEvent(f.B.containerStarted),this.play(),t()};this._delayTimeout=setTimeout(()=>{i()},this._delay)}))}stop(){if(O(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();for(const t of this.plugins)t.stop?.();this.particleCreatedPlugins.length=0,this.particleDestroyedPlugins.length=0,this.particlePositionPlugins.length=0,this._sourceOptions=this._options,this.dispatchEvent(f.B.containerStopped)}}updateActualOptions(){let t=!1;for(const i of this.plugins)i.updateActualOptions&&(t=i.updateActualOptions()||t);return t}constructor(t){this._delta={value:0,factor:0},this._nextFrame=t=>{try{if(!this._smooth&&void 0!==this._lastFrameTime&&t<this._lastFrameTime+1e3/this.fpsLimit)return void this.draw(!1);if(this._lastFrameTime??=t,function(t,i,e=60,s=!1){t.value=i,t.factor=s?60/e:60*i/1e3}(this._delta,t-this._lastFrameTime,this.fpsLimit,this._smooth),this.addLifeTime(this._delta.value),this._lastFrameTime=t,this._delta.value>1e3)return void this.draw(!1);if(this.canvas.render.drawParticles(this._delta),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){(0,k.t)().error("error in animation loop",t)}};const{dispatchCallback:i,pluginManager:e,id:s,onDestroy:a,sourceOptions:r}=t;this._pluginManager=e,this._dispatchCallback=i,this._onDestroy=a,this.id=Symbol(s),this.fpsLimit=120,this.hdr=!1,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=r,this._initialSourceOptions=r,this.effectDrawers=new Map,this.shapeDrawers=new Map,this.particleUpdaters=[],this.retina=new M(this),this.canvas=new p(this._pluginManager,this),this.particles=new D(this._pluginManager,this),this.plugins=[],this.particleDestroyedPlugins=[],this.particleCreatedPlugins=[],this.particlePositionPlugins=[],this._options=R(this._pluginManager,this),this.actualOptions=R(this._pluginManager,this),this._eventListeners=new _(this),this.dispatchEvent(f.B.containerBuilt)}}}};