1var e=Object.defineProperty,a=Object.defineProperties,t=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,s=(a,t,i)=>t in a?e(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,o=(e,a,t)=>s(e,"symbol"!=typeof a?a+"":a,t),n=(e,a,t)=>new Promise((i,r)=>{var l=e=>{try{o(t.next(e))}catch(a){r(a)}},s=e=>{try{o(t.throw(e))}catch(a){r(a)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(l,s);o((t=t.apply(e,a)).next())});import{d as c,j as h,k as v,et as u,a9 as I,a2 as g,f as d,o as E}from"./index-HR0nspFd.js";import{b as p,s as P}from"./sd-mv97tFD2.js";const m=c((S=((e,a)=>{for(var t in a||(a={}))r.call(a,t)&&s(e,t,a[t]);if(i)for(var t of i(a))l.call(a,t)&&s(e,t,a[t]);return e})({},{name:"ArtFireworksEffect"}),a(S,t({__name:"index",setup(e){const a={POOL_SIZE:600,PARTICLES_PER_BURST:200,SIZES:{RECTANGLE:{WIDTH:24,HEIGHT:12},SQUARE:{SIZE:12},CIRCLE:{SIZE:12},TRIANGLE:{SIZE:10},OVAL:{WIDTH:24,HEIGHT:12},IMAGE:{WIDTH:30,HEIGHT:30}},ROTATION:{BASE_SPEED:2,RANDOM_SPEED:3,DECAY:.98},PHYSICS:{GRAVITY:.525,VELOCITY_THRESHOLD:10,OPACITY_DECAY:.02},COLORS:["rgba(255, 68, 68, 1)","rgba(255, 68, 68, 0.9)","rgba(255, 68, 68, 0.8)","rgba(255, 116, 188, 1)","rgba(255, 116, 188, 0.9)","rgba(255, 116, 188, 0.8)","rgba(68, 68, 255, 0.8)","rgba(92, 202, 56, 0.7)","rgba(255, 68, 255, 0.8)","rgba(68, 255, 255, 0.7)","rgba(255, 136, 68, 0.7)","rgba(68, 136, 255, 1)","rgba(250, 198, 122, 0.8)"],SHAPES:["rectangle","rectangle","rectangle","rectangle","rectangle","rectangle","rectangle","circle","triangle","oval"]},t=v(),i=v(null),r=new class{constructor(){o(this,"particlePool",[]),o(this,"activeParticles",[]),o(this,"poolIndex",0),o(this,"imageCache",{}),o(this,"animationId",0),o(this,"canvasWidth",0),o(this,"canvasHeight",0),o(this,"animate",()=>{this.updateParticles(),this.render(),this.animationId=requestAnimationFrame(this.animate)}),this.initializePool()}initializePool(){for(let e=0;e<a.POOL_SIZE;e++)this.particlePool.push(this.createParticle())}createParticle(){return{x:0,y:0,vx:0,vy:0,color:"",rotation:0,rotationSpeed:0,scale:1,shape:"circle",opacity:1,active:!1}}getAvailableParticle(){for(let e=0;e<a.POOL_SIZE;e++){const t=(this.poolIndex+e)%a.POOL_SIZE,i=this.particlePool[t];if(!i.active)return this.poolIndex=(t+1)%a.POOL_SIZE,i.active=!0,i}return null}preloadImage(e){return n(this,null,function*(){return this.imageCache[e]?this.imageCache[e]:new Promise((a,t)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.imageCache[e]=i,a(i)},i.onerror=t,i.src=e})})}preloadAllImages(){return n(this,null,function*(){const e=[p,P,"/assets/yd-BrGqJ6Cs.png"];try{yield Promise.all(e.map(e=>this.preloadImage(e)))}catch(a){}})}createFirework(e){const t=Math.random()*this.canvasWidth,i=this.canvasHeight,r=e&&this.imageCache[e]?["image"]:a.SHAPES,l=[];for(let s=0;s<a.PARTICLES_PER_BURST;s++){const o=this.getAvailableParticle();if(!o)continue;const n=Math.PI*s/(a.PARTICLES_PER_BURST/2),c=1.5*(12+6*Math.random()),h=Math.random()*Math.PI*2;o.x=t,o.y=i,o.vx=Math.cos(n)*Math.cos(h)*c*(.5*Math.random()+.5),o.vy=Math.sin(n)*c-15,o.color=a.COLORS[Math.floor(Math.random()*a.COLORS.length)],o.rotation=360*Math.random(),o.rotationSpeed=(Math.random()*a.ROTATION.RANDOM_SPEED+a.ROTATION.BASE_SPEED)*(Math.random()>.5?1:-1),o.scale=.8+.4*Math.random(),o.shape=r[Math.floor(Math.random()*r.length)],o.opacity=1,o.imageUrl=e&&this.imageCache[e]?e:void 0,l.push(o)}this.activeParticles.push(...l)}updateParticles(){const{GRAVITY:e,VELOCITY_THRESHOLD:t,OPACITY_DECAY:i}=a.PHYSICS,{DECAY:r}=a.ROTATION;for(let a=this.activeParticles.length-1;a>=0;a--){const l=this.activeParticles[a];l.x+=l.vx,l.y+=l.vy,l.vy+=e,l.rotation+=l.rotationSpeed,l.rotationSpeed*=r,(l.vy>t&&(l.opacity-=i,l.opacity<=0)||this.isOutOfBounds(l))&&this.recycleParticle(a)}}recycleParticle(e){this.activeParticles[e].active=!1,this.activeParticles.splice(e,1)}isOutOfBounds(e){const a=100;return e.x<-100||e.x>this.canvasWidth+a||e.y<-100||e.y>this.canvasHeight+a}drawParticle(e){i.value&&(i.value.save(),i.value.globalAlpha=e.opacity,i.value.translate(e.x,e.y),i.value.rotate(e.rotation*Math.PI/180),i.value.scale(e.scale,e.scale),this.renderShape(e),i.value.restore(
1))}renderShape(e){if(!i.value)return;const{SIZES:t}=a;switch(i.value.fillStyle=e.color,e.shape){case"rectangle":i.value.fillRect(-12,-6,t.RECTANGLE.WIDTH,t.RECTANGLE.HEIGHT);break;case"square":i.value.fillRect(-6,-6,t.SQUARE.SIZE,t.SQUARE.SIZE);break;case"circle":i.value.beginPath(),i.value.arc(0,0,t.CIRCLE.SIZE/2,0,2*Math.PI),i.value.fill();break;case"triangle":i.value.beginPath(),i.value.moveTo(0,-10),i.value.lineTo(t.TRIANGLE.SIZE,t.TRIANGLE.SIZE),i.value.lineTo(-10,t.TRIANGLE.SIZE),i.value.closePath(),i.value.fill();break;case"oval":i.value.beginPath(),i.value.ellipse(0,0,t.OVAL.WIDTH/2,t.OVAL.HEIGHT/2,0,0,2*Math.PI),i.value.fill();break;case"image":this.renderImage(e)}}renderImage(e){if(!i.value||!e.imageUrl)return;const t=this.imageCache[e.imageUrl];if(null==t?void 0:t.complete){const{WIDTH:e,HEIGHT:r}=a.SIZES.IMAGE;i.value.drawImage(t,-e/2,-r/2,e,r)}}render(){if(i.value&&t.value){i.value.clearRect(0,0,this.canvasWidth,this.canvasHeight),i.value.globalCompositeOperation="lighter";for(const e of this.activeParticles)this.drawParticle(e)}}updateCanvasSize(e,a){this.canvasWidth=e,this.canvasHeight=a}start(){this.animate()}stop(){this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=0)}getActiveParticleCount(){return this.activeParticles.length}},l=e=>{(e.ctrlKey&&e.shiftKey&&"p"===e.key.toLowerCase()||e.metaKey&&e.shiftKey&&"p"===e.key.toLowerCase())&&(e.preventDefault(),r.createFirework())},s=()=>
1{if(!t.value)return;const{innerWidth:e,innerHeight:a}=window;t.value.width=e,t.value.height=a,r.updateCanvasSize(e,a)},c=e=>{const a=e;r.createFirework(a)};return h(()=>n(null,null,function*(){t.value&&(i.value=t.value.getContext("2d"),i.value&&(s(),yield r.preloadAllImages(),r.start(),u(window,"keydown",l),u(window,"resize",s),I.on("triggerFireworks",c)))})),g(()=>{r.stop(),I.off("triggerFireworks",c)}),(e,a)=>(E(),d("canvas",{ref_key:"canvasRef",ref:t,class:"fixed top-0 left-0 z-[9999] w-full h-full pointer-events-none"},null,512))}}))));var S;export{m as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.