1import{W as Y,aU as _,bi as j,Z as X,a1 as I,a2 as N,ad as q,ak as G,a3 as Q,a5 as O,a6 as J}from"./index-Rp1znJyq.js";const w=200,K=800,tt=.1,et=.3,$=.5,nt=.5,at=12,rt=800,it=1600,ot=150,st=3500,lt=["#FFC700","#FF0000","#2E3191","#41BBC7"];var S={props:{particleCount:{type:Number,default:ot},particleSize:{type:Number,default:at},duration:{type:Number,default:st},colors:{type:Array,default:lt},force:{type:Number,default:nt},stageHeight:{type:Number,default:rt},stageWidth:{type:Number,default:it},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(t){const l=Y(!0),v=(e,n)=>{F(e,{degree:n})},i=_(()=>p(t.particleCount,t.colors));j(()=>{t.particleCount>300&&console.log("[VUE-CONFETTI-EXPLOSION] That's a lot of confetti, you sure about that? A lesser number like 200 will still give off the party vibes while still not bricking the device ð")});const s=_(()=>z(t.particleCount,t.duration,t.colors,t.particleSize,t.force,t.stageHeight,t.stageWidth));X(async()=>{await x(t.duration),t.shouldDestroyAfterDone&&(l.value=!1)});const p=(e,n)=>{const a=360/e;return Array.from({length:e},(c,o)=>({color:n[o%n.length],degree:o*a}))},x=e=>new Promise(n=>setTimeout(n,e));function f(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round((e+Number.EPSILON)*10**n)/10**n}function b(e,n){if(e===n)return!0;if(e==null||n==null||e.length!==n.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!==n[a])return!1;return!0}const g=(e,n,a,c,o)=>(e-n)*(o-c)/(a-n)+c,A=(e,n)=>{const a=e+n;return a>360?a-360:a},R=()=>Math.random()>.5,T=[0,0,1],C=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],T],k=e=>!b(C[e],T)&&R(),u=e=>typeof e>"u",h=e=>{console.error(e)};function z(e,n,a,c,o,m,y){const d=Number.isSafeInteger;return!u(e)&&d(e)&&e<0?(h("particleCount must be a positive integer"),!1):!u(n)&&d(n)&&n<0?(h("duration must be a positive integer"),!1):!u(a)&&!Array.isArray(a)?(h("colors must be an array of strings"),!1):!u(c)&&d(c)&&c<0?(h("particleSize must be a positive integer"),!1):!u(o)&&d(o)&&(o<0||o>1)?(h("force must be a positive integer and should be within 0 and 1"),!1):!u(m)&&typeof m=="number"&&d(m)&&m<0?(h("floorHeight must be a positive integer"),!1):!u(y)&&typeof y=="number"&&d(y)&&y<0?(h("floorWidth must be a positive integer"),!1):!0}function F(e,n){let{degree:a}=n;
1const c=g(Math.abs(A(a,90)-180),0,180,-t.stageWidth/2,t.stageWidth/2),o=Math.random()*(K-w)+w,m=Math.round(Math.random()*(C.length-1)),y=t.duration-Math.round(Math.random()*1e3),d=Math.random()<tt,E=k(m),M=d?f(Math.random()*et,2):0,B=M*-1,P=M,D=f(Math.abs(g(Math.abs(A(a,90)-180),0,180,-1,1)),4),L=f(Math.random()*$,4),V=f(Math.random()*t.force*(R()?1:-1),4),H=$,U=f(Math.max(g(Math.abs(a-180),0,180,t.force,-t.force),0),4),r=(Z,W)=>e?.style.setProperty(Z,W+"");r("--x-landing-point",`${c}px`),r("--duration-chaos",`${y}ms`),r("--x1",`${M}`),r("--x2",`${B}`),r("--x3",`${P}`),r("--x4",`${D}`),r("--y1",`${L}`),r("--y2",`${V}`),r("--y3",`${H}`),r("--y4",`${U}`),r("--width",`${E?t.particleSize:Math.round(Math.random()*4)+t.particleSize/2}px`),r("--height",(E?t.particleSize:Math.round(Math.random()*2)+t.particleSize)+"px"),r("--rotation",`${C[m].join()}`),r("--rotation-duration",`${o}ms`),r("--border-radius",`${E?"50%":"0"}`)}return{isVisible:l,isValid:s,stageHeight:t.stageHeight,particles:i,setItemRef:v}}};function ct(t,l,v,i,s,p){return i.isVisible&&i.isValid?(I(),N("div",{key:0,class:"confetti-container",style:O(`--floor-height: ${i.stageHeight}px;`)},[(I(!0),N(q,null,G(i.particles,x=>{let{color:f,degree:b}=x;return I(),N("div",{key:b,class:"particle",ref:g=>i.setItemRef(g,b)},[Q("div",{style:O(`--bgcolor: ${f};`)},null,4)],512)}),128))],4)):J("",!0)}function dt(t,l){l===void 0&&(l={});var v=l.insertAt;if(!(!t||typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",v==="top"&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}}var ft=` 2@keyframes y-axis-4ff796ae { 3to { 4 transform: translate3d(0, var(--floor-height), 0); 5} 6} 7@keyframes x-axis-4ff796ae { 8to { 9 transform: translate3d(var(--x-landing-point), 0, 0); 10} 11} 12@keyframes rotation-4ff796ae { 13to { 14 transform: rotate3d(var(--rotation), 360deg); 15} 16} 17.confetti-container[data-v-4ff796ae] { 18 width: 0; 19 height: 0; 20 overflow: visible; 21 position: relative; 22 transform: translate3d(var(--x, 0), var(--y, 0), 0); 23 z-index: 1200; 24} 25.confetti-container > .particle[data-v-4ff796ae] { 26 animation: x-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--x1), var(--x2), var(--x3), var(--x4)); 27} 28.confetti-container > .particle div[data-v-4ff796ae] { 29 position: absolute; 30 top: 0; 31 left: 0; 32 animation: y-axis-4ff796ae var(--duration-chaos) forwards cubic-bezier(var(--y1), var(--y2), var(--y3), var(--y4)); 33 width: var(--width); 34 height: var(--height); 35} 36.confetti-container > .particle div[data-v-4ff796ae]:before { 37 display: block; 38 height: 100%; 39 width: 100%; 40 content: ""; 41 background-color: var(--bgcolor); 42 animation: rotation-4ff796ae var(--rotation-duration) infinite linear; 43 border-radius: var(--border-radius); 44} 45`;dt(ft);S.render=ct;S.__scopeId="data-v-4ff796ae";var ht=(()=>{const t=S;return t.install=l=>{l.component("ConfettiExplosion",t)},t})();export{ht as e}; 46//# sourceMappingURL=confetti-explosion.esm-g7x3_YBy.js.map
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.