Build 533169stable
Module 442802
1,114 characters · in 30a277b9d32d70b1.jsDependencies
Source Raw
function(e,t,n){n.d(t,{A:()=>c});var i=n(627968),l=n(64700),a=n(106778);let r=[n(426560)],s=["#FFFFFF"],o=1e3/60,d={velocity:{type:"static-random",minValue:{x:0,y:1},maxValue:{x:3,y:3}},rotation:{type:"linear-random",minValue:{x:0,y:0,z:0},maxValue:{x:0,y:0,z:360},minAddValue:{x:0,y:0,z:-5},maxAddValue:{x:0,y:0,z:5}},size:{type:"static-random",minValue:2,maxValue:6},dragCoefficient:{type:"static",value:830},opacity:{type:"static",value:.3}};function c(e){let{className:t,firing:n=!0,wind:c=2,sprites:u=r,spriteColors:A=s,confettiConfig:h}=e,[_,m]=l.useState(null),[g,p]=l.useState(null),E=(0,a.f9)(g,_),I=l.useMemo(()=>new a.OH({wind:c}),[c]),f=l.useCallback(()=>{let e=g?.getCanvas();if(null==e)return;let t=e.getBoundingClientRect();E.createConfetti({...d,...h,position:{type:"static-random",minValue:{x:-t.width/2,y:-6},maxValue:{x:t.width,y:-6}}})},[E,g,h]);return l.useEffect(()=>{let e=n?setInterval(f,o):null;return()=>clearInterval(e)},[n,f]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.Fk,{ref:p,className:t,environment:I}),(0,i.jsx)(a.K_,{ref:m,colors:A,sprites:u,spriteWidth:6,spriteHeight:6})]})}}