From 0c9ebd4640a0fb5bc10dbc391af9e40f38edc086 Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Mon, 2 Nov 2026 08:03:08 -0500 Subject: [PATCH 1/2] Release 0.1.1 --- CHANGELOG.md | 32 ++++++++++++++++---------------- package.json | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2f3255..5d5281b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,28 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.1.1] - 2026-11-02 + ### Changed - The weekly release-currency check now runs through `laranail/.github`'s shared hygiene workflow, which uses `laranail/package-tools`' canonical script. Release tags are immutable, so a tag behind `main` is a warning that a release is due rather than a red run. -### Deprecated - -- `scripts/verify-tag-currency.sh`. It prints a notice and delegates to the canonical script when - an installed `laranail/package-tools` already follows the immutable-tag model, and otherwise keeps - working, now advising the next patch instead of a moved tag. Earliest removal: the next minor - release. - -### Added - -- The views also answer to the canonical `laranail/confetti` namespace - (`view('laranail/confetti::components.scripts')`), registered by - package-tools over the same paths as `laranail-confetti`, published overrides - included. A naming test asserts both forms against the live view finder. - -### Changed - - A guard now keeps literal credentials out of the tests, and every credential the tests generate is named with a single-word purpose, so secret scanning has nothing to report. `laranail/package-tools` in `require` is now `^0.1.10`, the first release with the purpose check. - `scripts/verify-tag-currency.sh` is now package-tools' current script: a tag behind `main` only by `.github/`-only commits (a Dependabot bump) passes, and a released package is told to cut a patch rather than move a published tag. - `laravel/framework ^13.0` is now declared in `require`. `src/` uses `Vite` from `Illuminate\Foundation`, which no `illuminate/*` component ships, so the dependency only arrived through the host application. @@ -45,6 +31,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `Package` in its constructor, and `handle()`'s `ConfettiConfig` parameter is now optional so the override stays compatible with the base's `handle(): int`. +### Deprecated + +- `scripts/verify-tag-currency.sh`. It prints a notice and delegates to the canonical script when + an installed `laranail/package-tools` already follows the immutable-tag model, and otherwise keeps + working, now advising the next patch instead of a moved tag. Earliest removal: the next minor + release. + +### Added + +- The views also answer to the canonical `laranail/confetti` namespace + (`view('laranail/confetti::components.scripts')`), registered by + package-tools over the same paths as `laranail-confetti`, published overrides + included. A naming test asserts both forms against the live view finder. + ### Fixed - **`tests.yml` no longer skips a markdown-only pull request.** The `pest` diff --git a/package.json b/package.json index 5529c7c..276843b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@laranail/confetti", - "version": "0.1.0", + "version": "0.1.1", "description": "Browser runtime for laranail/confetti: a canvas-confetti engine driven by a declarative JSON payload.", "license": "MIT", "private": true, From b2f980d74b3f995bfd2d2fc5a6530ae4e7b7bd38 Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Mon, 2 Nov 2026 08:22:45 -0500 Subject: [PATCH 2/2] Rebuild the bundle for 0.1.1 The bundle embeds the package version in its banner and its exported version constant, so the version bump has to ship a rebuilt resources/dist. --- resources/dist/confetti.esm.mjs | 4 ++-- resources/dist/confetti.iife.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/dist/confetti.esm.mjs b/resources/dist/confetti.esm.mjs index 4209ee6..353ae88 100644 --- a/resources/dist/confetti.esm.mjs +++ b/resources/dist/confetti.esm.mjs @@ -1,6 +1,6 @@ -/*! laranail/confetti v0.1.0 | MIT (c) Simtabi LLC +/*! laranail/confetti v0.1.1 | MIT (c) Simtabi LLC * Bundles canvas-confetti | ISC (c) 2020 Kiril Vatev | https://github.com/catdad/canvas-confetti * Full notice: resources/dist/LICENSE-canvas-confetti.txt */ function re(t,r=typeof window<"u"?window.Alpine:null){return!r||typeof r.data!="function"||r.data("laranailConfetti",()=>({fire(o){t.fire(o)},burst(o={}){t.fire({v:1,action:"fire",bursts:[{delay:0,options:o}],animations:[]})},preset(o,i={}){t.fire({v:1,action:"fire",bursts:[],animations:[{animation:o,duration:i.duration??15e3,options:i,params:{}}]})},realistic(){this.burst({particleCount:150,spread:70,origin:{x:.5,y:.7}})},stop(){t.stop()},reset(){t.reset()}})),t}function oe(t,{prop:r="confetti",target:o=typeof window<"u"?window:null}={}){return!o||typeof o.addEventListener!="function"||(o.addEventListener("inertia:before",()=>t.stop()),o.addEventListener("inertia:success",i=>{let d=i?.detail?.page?.props?.[r];d&&t.fire(d)})),t}function ae(t,r=typeof window<"u"?window:null){return!r||typeof r.addEventListener!="function"||(r.addEventListener("livewire:navigating",()=>t.stop()),r.addEventListener("livewire:navigated",()=>t.refresh())),t}var ie={};(function t(r,o,i,c){var d=!!(r.Worker&&r.Blob&&r.Promise&&r.OffscreenCanvas&&r.OffscreenCanvasRenderingContext2D&&r.HTMLCanvasElement&&r.HTMLCanvasElement.prototype.transferControlToOffscreen&&r.URL&&r.URL.createObjectURL),x=typeof Path2D=="function"&&typeof DOMMatrix=="function",M=(function(){if(!r.OffscreenCanvas)return!1;try{var n=new OffscreenCanvas(1,1),e=n.getContext("2d");e.fillRect(0,0,1,1);var a=n.transferToImageBitmap();e.createPattern(a,"no-repeat")}catch{return!1}return!0})();function C(){}function S(n){var e=o.exports.Promise,a=e!==void 0?e:r.Promise;return typeof a=="function"?new a(n):(n(C,C),null)}var P=(function(n,e){return{transform:function(a){if(n)return a;if(e.has(a))return e.get(a);var l=new OffscreenCanvas(a.width,a.height),u=l.getContext("2d");return u.drawImage(a,0,0),e.set(a,l),l},clear:function(){e.clear()}}})(M,new Map),F=(function(){var n=Math.floor(16.666666666666668),e,a,l={},u=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(e=function(f){var p=Math.random();return l[p]=requestAnimationFrame(function s(h){u===h||u+n-1"u"||typeof window.dispatchEvent!="function"))try{window.dispatchEvent(new CustomEvent(t,{detail:r}))}catch{}}function ot(t,r,o=typeof window<"u"?window:null){let i=A[t]??t;return!o||typeof o.addEventListener!="function"?()=>{}:(o.addEventListener(i,r),()=>o.removeEventListener(i,r))}function at(t,r,o=typeof window<"u"?window:null){let i=A[t]??t;o?.removeEventListener?.(i,r)}var Y=[];function it(t){return Y.push(t),()=>{let r=Y.indexOf(t);r!==-1&&Y.splice(r,1)}}function Ae(t){return Y.reduce((r,o)=>{try{return o(r)??r}catch(i){return k(A.error,{error:i,phase:"beforeFire"}),r}},t)}function se(t){return t?Array.isArray(t)?{v:0,id:null,action:"fire",bursts:t.map(lt).filter(Boolean),animations:[],reducedMotion:null}:typeof t!="object"?null:typeof t.v=="number"&&t.v>1?(console.error(`[laranail/confetti] Payload version ${t.v} is newer than this runtime supports (1). Rebuild the package assets.`),null):{v:t.v??0,id:typeof t.id=="string"?t.id:null,action:typeof t.action=="string"?t.action:"fire",bursts:Array.isArray(t.bursts)?t.bursts.map(st).filter(Boolean):[],animations:Array.isArray(t.animations)?t.animations.filter(Boolean):[],reducedMotion:typeof t.reducedMotion=="string"?t.reducedMotion:null}:null}function st(t){return!t||typeof t!="object"?null:{delay:typeof t.delay=="number"?t.delay:0,options:t.options&&typeof t.options=="object"?t.options:{}}}function lt(t){if(!t||typeof t!="object")return null;let{delay:r,...o}=t;return{delay:typeof r=="number"?r:0,options:o}}function Te(t,r){let o={...t||{},...r||{}};return delete o.delay,o}var ct="reduce",ut="skip";function ke(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function K(t){return t===ut&&ke()}function le(t){return t===ct&&ke()}function Pe(t){let r=Math.max(1,Math.floor((t.particleCount??50)/2));return{...t,particleCount:r,ticks:Math.min(t.ticks??200,100)}}var j=new Map,Ie=32;function Re({size:t}={}){typeof t=="number"&&t>0&&(Ie=t)}function ft(t){return t.type==="text"?`t|${t.text}|${t.scalar??""}|${t.color??""}|${t.fontFamily??""}`:`p|${t.path}|${Array.isArray(t.matrix)?t.matrix.join(","):"auto"}`}function Fe(t,r){if(j.size>=Ie){let o=j.keys().next().value,i=j.get(o);if(i&&i.bitmap&&typeof i.bitmap.close=="function")try{i.bitmap.close()}catch{}j.delete(o)}return j.set(t,r),r}function dt(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return null;let r=ft(t);if(j.has(r))return j.get(r);try{if(t.type==="text")return Fe(r,O.shapeFromText({text:t.text,scalar:t.scalar??1,color:t.color??"#000000",...t.fontFamily?{fontFamily:t.fontFamily}:{}}));if(t.type==="path")return Array.isArray(t.matrix)||Ee("A path shape was sent without a transform matrix. canvas-confetti will derive one by sampling a 1000x1000 grid, on the main thread. Compute it once and pass it to shapeFromPath() for anything that fires often."),Fe(r,O.shapeFromPath(Array.isArray(t.matrix)?{path:t.path,matrix:t.matrix}:{path:t.path}))}catch(o){return _(o,{phase:"shape",descriptor:t}),null}return null}function ce(t){if(!Array.isArray(t))return;let r=t.map(dt).filter(o=>o!=null);return r.length>0?r:void 0}function ue(){for(let t of j.values())if(t&&t.bitmap&&typeof t.bitmap.close=="function")try{t.bitmap.close()}catch{}j.clear()}function Oe(t={}){let r=t.canvas;if(!r)return O;let o=typeof document<"u"?document.querySelector(r):null;if(!o)return _(new Error(`No element matched the configured confetti canvas selector "${r}".`),{phase:"canvas"}),O;if(o.__laranailConfetti)return o.__laranailConfetti;Object.assign(o.style,{position:o.style.position||"fixed",inset:o.style.inset||"0",pointerEvents:"none",zIndex:o.style.zIndex||String(t.zIndex??100)});let i=O.create(o,{resize:!0,useWorker:t.useWorker!==!1});return o.__laranailConfetti=i,i}function V(t,r){let{cannon:o=O,defaults:i={},policy:c="reduce"}=r||{};if(K(c))return k(A.skipped,{reason:"reduced-motion",policy:c,options:t}),null;let d=Te(i,t),x=le(c);x&&(d=Pe(d)),d=Ae(d);let M=ce(d.shapes);M?d.shapes=M:delete d.shapes;let C;try{C=o(d)}catch(S){return _(S,{phase:"fire",options:d})}return k(A.burst,{options:d,reduced:x}),C&&typeof C.then=="function"&&C.catch(S=>_(S,{phase:"settle",options:d})),C}function fe(t,r){let{policy:o="reduce"}=r||{};return K(o)?(k(A.skipped,{reason:"reduced-motion",policy:o,bursts:t.length}),[]):(le(o)?t.slice(0,1):t).map(c=>{let d=c.delay??0;if(d<=0)return V(c.options,r);let x=setTimeout(()=>V(c.options,r),d);return r?.signal?.addEventListener?.("abort",()=>clearTimeout(x),{once:!0}),null})}function Z({duration:t,onFrame:r,interval:o=null,signal:i,pauseWhenHidden:c=!0}){return new Promise(d=>{if(i?.aborted){d();return}let x=typeof requestAnimationFrame=="function"?requestAnimationFrame:L=>setTimeout(()=>L(Date.now()),16),M=0,C=0,S=null,P=null,F=!1,B=()=>{F||(F=!0,P!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(P),i?.removeEventListener?.("abort",B),d())};i?.addEventListener?.("abort",B,{once:!0});let U=()=>c&&typeof document<"u"&&document.visibilityState==="hidden",z=L=>{if(F)return;let v=typeof L=="number"?L:Date.now();S===null&&(S=v);let W=Math.max(0,v-S);if(S=v,U()){P=x(z);return}M+=W;let q=!0;if(o===null)q=r(M,W)!==!1;else for(C+=W;C>=o&&q;)C-=o,q=r(M,W)!==!1;if(!q||M>=t){B();return}P=x(z)};P=x(z)})}function $(t,r){return Math.random()*(r-t)+t}function Be(t,r){let{duration:o=15e3,options:i={},params:c={}}=t,d=c.interval??250,x=c.particleCount??50,M=c.xRanges??[[.1,.3],[.7,.9]],[C,S]=c.yRange??[-.2,.8];return Z({duration:o,interval:d,signal:r.signal,pauseWhenHidden:r.pauseWhenHidden,onFrame:P=>{let F=o-P;if(F<=0)return!1;let B=Math.floor(x*(F/o));if(B<=0)return!0;for(let[U,z]of M)V({...i,particleCount:B,origin:{x:$(U,z),y:$(C,S)}},r);return!0}})}function Le(t,r){let{duration:o=15e3,options:i={},params:c={}}=t,d=c.sides??[{angle:60,origin:{x:0,y:.5}},{angle:120,origin:{x:1,y:.5}}];return Z({duration:o,signal:r.signal,pauseWhenHidden:r.pauseWhenHidden,onFrame:x=>{if(o-x<=0)return!1;for(let M of d)V({...i,angle:M.angle,origin:M.origin},r);return!0}})}function Ne(t,r){let{duration:o=15e3,options:i={},params:c={}}=t,d=c.ticksMin??200,x=c.ticksMax??500,M=c.skewTo??.8,C=c.skewStep??.001,[S,P]=c.gravity??[.4,.6],[F,B]=c.scalar??[.4,1],[U,z]=c.drift??[-.4,.4],L=c.skewFrom??1;return Z({duration:o,signal:r.signal,pauseWhenHidden:r.pauseWhenHidden,onFrame:v=>{let W=o-v;return W<=0?!1:(L=Math.max(M,L-C),V({...i,ticks:Math.max(d,x*(W/o)),origin:{x:Math.random(),y:Math.random()*L-.2},gravity:$(S,P),scalar:$(F,B),drift:$(U,z)},r),!0)}})}var de=new Map([["fireworks",Be],["snow",Ne],["schoolPride",Le]]);function pe(t,r){de.set(t,r)}function he(t){return de.get(t)??null}function pt(){return[...de.keys()]}var ht='script[type="application/json"][data-confetti-boot]',Q={event:"confetti:fire",legacyEvent:"fire-confetti",defaults:{},runtime:{useWorker:!0,canvas:null,reducedMotion:"reduce",pauseWhenHidden:!0,maxConcurrentAnimations:3,shapeCacheSize:32,debug:!1},payload:null};function G(t=typeof document<"u"?document:null){if(!t||typeof t.querySelector!="function")return{...Q};let r=t.querySelector(ht);if(!r)return{...Q};try{let o=JSON.parse(r.textContent||"{}");return{...Q,...o,runtime:{...Q.runtime,...o.runtime||{}}}}catch(o){return console.error("[laranail/confetti] Could not parse the boot payload.",o),{...Q}}}var J=class{constructor(r={}){this.boot=r,this.runtime=r.runtime||{},this.cannon=Oe(this.runtime),this.animations=new Set,this.seen=new Set,this.listeners=[],Re({size:this.runtime.shapeCacheSize}),Se(this.runtime.debug)}fire(r){let o=se(r);if(!o)return;if(o.action==="stop"||o.action==="reset"){this.stop(),o.action==="reset"&&this.reset();return}if(o.id){if(this.seen.has(o.id)){X("Ignored a payload already fired.",{id:o.id}),k(A.skipped,{reason:"already-fired",id:o.id});return}this.seen.add(o.id)}let i=o.reducedMotion||this.runtime.reducedMotion||"reduce";if(K(i)){X("Suppressed by the reduced-motion policy.",{policy:i}),k(A.skipped,{reason:"reduced-motion",policy:i,id:o.id});return}let c={cannon:this.cannon,defaults:this.boot.defaults||{},policy:i,pauseWhenHidden:this.runtime.pauseWhenHidden!==!1};o.bursts.length>0&&fe(o.bursts,c);for(let d of o.animations)this.animate(d,c)}animate(r,o){let i=he(r.animation);if(!i){_(new Error(`Unknown confetti animation "${r.animation}".`),{phase:"animate"});return}let c=this.runtime.maxConcurrentAnimations??3;for(;this.animations.size>=c;){let M=this.animations.values().next().value;M.abort(),this.animations.delete(M),X("Aborted the oldest animation to stay under the concurrency cap.",{limit:c}),k(A.skipped,{reason:"concurrency-cap",limit:c})}let d=new AbortController;this.animations.add(d),k(A.animationStart,{animation:r.animation,duration:r.duration});let x=()=>{this.animations.delete(d),k(A.animationEnd,{animation:r.animation})};Promise.resolve(i(r,{...o,signal:d.signal})).then(x).catch(M=>{x(),_(M,{phase:"animate",animation:r.animation})})}stop(){let r=this.animations.size;for(let o of this.animations)o.abort();this.animations.clear(),r>0&&k(A.stopped,{animations:r})}reset(){this.stop();try{typeof this.cannon.reset=="function"?this.cannon.reset():typeof O.reset=="function"&&O.reset()}catch(r){_(r,{phase:"reset"})}}listen(r=typeof window<"u"?window:null){if(!r)return this;let o=i=>{let c=i.detail,d=Array.isArray(c)?c[0]:c;this.fire(d)};for(let i of[this.boot.event,this.boot.legacyEvent])i&&(r.addEventListener(i,o),this.listeners.push([r,i,o]));return this}fireBootPayload(){return k(A.booted,{event:this.boot.event,hasPayload:!!this.boot.payload}),this.boot.payload&&this.fire(this.boot.payload),this}refresh(){let r=G();return this.boot={...this.boot,...r,runtime:this.runtime},r.payload&&this.fire(r.payload),this}registerAnimation(r,o){return pe(r,o),this}destroy(){this.stop(),ue();for(let[r,o,i]of this.listeners)r.removeEventListener(o,i);this.listeners=[]}};function mt(t=G()){return new J(t)}var dn="0.1.0";function pn(t={}){let r=new J(t.boot??G());return r.listen(),ae(r),oe(r,{prop:t.inertiaProp??"confetti"}),re(r),r.fireBootPayload(),r}export{xe as ERROR_EVENT,A as EVENTS,J as Runtime,pt as animationNames,it as beforeFire,ue as clearShapeCache,mt as createRuntime,k as emit,V as fire,fe as fireBursts,he as getAnimation,se as normalizePayload,at as off,ot as on,G as readBootConfig,re as registerAlpineAdapter,pe as registerAnimation,oe as registerInertiaAdapter,ae as registerLivewireAdapter,ce as resolveShapes,pn as start,dn as version}; +`);try{n=new Worker(URL.createObjectURL(new Blob([u])))}catch(f){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("\u{1F38A} Could not load worker",f),null}l(n)}return n}})(),U={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function z(n,e){return e?e(n):n}function L(n){return n!=null}function v(n,e,a){return z(n&&L(n[e])?n[e]:U[e],a)}function W(n){return n<0?0:Math.floor(n)}function q(n,e){return Math.floor(Math.random()*(e-n))+n}function ee(n){return parseInt(n,16)}function _e(n){return n.map(ze)}function ze(n){var e=String(n).replace(/[^0-9a-f]/gi,"");return e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),{r:ee(e.substring(0,2)),g:ee(e.substring(2,4)),b:ee(e.substring(4,6))}}function We(n){var e=v(n,"origin",Object);return e.x=v(e,"x",Number),e.y=v(e,"y",Number),e}function De(n){n.width=document.documentElement.clientWidth,n.height=document.documentElement.clientHeight}function je(n){var e=n.getBoundingClientRect();n.width=e.width,n.height=e.height}function Ve(n){var e=document.createElement("canvas");return e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",e.style.zIndex=n,e}function Ue(n,e,a,l,u,f,p,s,h){n.save(),n.translate(e,a),n.rotate(f),n.scale(l,u),n.arc(0,0,1,p,s,h),n.restore()}function He(n){var e=n.angle*(Math.PI/180),a=n.spread*(Math.PI/180);return{x:n.x,y:n.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:n.startVelocity*.5+Math.random()*n.startVelocity,angle2D:-e+(.5*a-Math.random()*a),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:n.color,shape:n.shape,tick:0,totalTicks:n.ticks,decay:n.decay,drift:n.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:n.gravity*3,ovalScalar:.6,scalar:n.scalar,flat:n.flat}}function $e(n,e){e.x+=Math.cos(e.angle2D)*e.velocity+e.drift,e.y+=Math.sin(e.angle2D)*e.velocity+e.gravity,e.velocity*=e.decay,e.flat?(e.wobble=0,e.wobbleX=e.x+10*e.scalar,e.wobbleY=e.y+10*e.scalar,e.tiltSin=0,e.tiltCos=0,e.random=1):(e.wobble+=e.wobbleSpeed,e.wobbleX=e.x+10*e.scalar*Math.cos(e.wobble),e.wobbleY=e.y+10*e.scalar*Math.sin(e.wobble),e.tiltAngle+=.1,e.tiltSin=Math.sin(e.tiltAngle),e.tiltCos=Math.cos(e.tiltAngle),e.random=Math.random()+2);var a=e.tick++/e.totalTicks,l=e.x+e.random*e.tiltCos,u=e.y+e.random*e.tiltSin,f=e.wobbleX+e.random*e.tiltCos,p=e.wobbleY+e.random*e.tiltSin;if(n.fillStyle="rgba("+e.color.r+", "+e.color.g+", "+e.color.b+", "+(1-a)+")",n.beginPath(),x&&e.shape.type==="path"&&typeof e.shape.path=="string"&&Array.isArray(e.shape.matrix))n.fill(Ze(e.shape.path,e.shape.matrix,e.x,e.y,Math.abs(f-l)*.1,Math.abs(p-u)*.1,Math.PI/10*e.wobble));else if(e.shape.type==="bitmap"){var s=Math.PI/10*e.wobble,h=Math.abs(f-l)*.1,y=Math.abs(p-u)*.1,b=e.shape.bitmap.width*e.scalar,g=e.shape.bitmap.height*e.scalar,w=new DOMMatrix([Math.cos(s)*h,Math.sin(s)*h,-Math.sin(s)*y,Math.cos(s)*y,e.x,e.y]);w.multiplySelf(new DOMMatrix(e.shape.matrix));var E=n.createPattern(P.transform(e.shape.bitmap),"no-repeat");E.setTransform(w),n.globalAlpha=1-a,n.fillStyle=E,n.fillRect(e.x-b/2,e.y-g/2,b,g),n.globalAlpha=1}else if(e.shape==="circle")n.ellipse?n.ellipse(e.x,e.y,Math.abs(f-l)*e.ovalScalar,Math.abs(p-u)*e.ovalScalar,Math.PI/10*e.wobble,0,2*Math.PI):Ue(n,e.x,e.y,Math.abs(f-l)*e.ovalScalar,Math.abs(p-u)*e.ovalScalar,Math.PI/10*e.wobble,0,2*Math.PI);else if(e.shape==="star")for(var m=Math.PI/2*3,T=4*e.scalar,I=8*e.scalar,R=e.x,D=e.y,H=5,N=Math.PI/H;H--;)R=e.x+Math.cos(m)*I,D=e.y+Math.sin(m)*I,n.lineTo(R,D),m+=N,R=e.x+Math.cos(m)*T,D=e.y+Math.sin(m)*T,n.lineTo(R,D),m+=N;else n.moveTo(Math.floor(e.x),Math.floor(e.y)),n.lineTo(Math.floor(e.wobbleX),Math.floor(u)),n.lineTo(Math.floor(f),Math.floor(p)),n.lineTo(Math.floor(l),Math.floor(e.wobbleY));return n.closePath(),n.fill(),e.tick"u"||typeof window.dispatchEvent!="function"))try{window.dispatchEvent(new CustomEvent(t,{detail:r}))}catch{}}function ot(t,r,o=typeof window<"u"?window:null){let i=A[t]??t;return!o||typeof o.addEventListener!="function"?()=>{}:(o.addEventListener(i,r),()=>o.removeEventListener(i,r))}function at(t,r,o=typeof window<"u"?window:null){let i=A[t]??t;o?.removeEventListener?.(i,r)}var Y=[];function it(t){return Y.push(t),()=>{let r=Y.indexOf(t);r!==-1&&Y.splice(r,1)}}function Ae(t){return Y.reduce((r,o)=>{try{return o(r)??r}catch(i){return k(A.error,{error:i,phase:"beforeFire"}),r}},t)}function se(t){return t?Array.isArray(t)?{v:0,id:null,action:"fire",bursts:t.map(lt).filter(Boolean),animations:[],reducedMotion:null}:typeof t!="object"?null:typeof t.v=="number"&&t.v>1?(console.error(`[laranail/confetti] Payload version ${t.v} is newer than this runtime supports (1). Rebuild the package assets.`),null):{v:t.v??0,id:typeof t.id=="string"?t.id:null,action:typeof t.action=="string"?t.action:"fire",bursts:Array.isArray(t.bursts)?t.bursts.map(st).filter(Boolean):[],animations:Array.isArray(t.animations)?t.animations.filter(Boolean):[],reducedMotion:typeof t.reducedMotion=="string"?t.reducedMotion:null}:null}function st(t){return!t||typeof t!="object"?null:{delay:typeof t.delay=="number"?t.delay:0,options:t.options&&typeof t.options=="object"?t.options:{}}}function lt(t){if(!t||typeof t!="object")return null;let{delay:r,...o}=t;return{delay:typeof r=="number"?r:0,options:o}}function Te(t,r){let o={...t||{},...r||{}};return delete o.delay,o}var ct="reduce",ut="skip";function ke(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function K(t){return t===ut&&ke()}function le(t){return t===ct&&ke()}function Pe(t){let r=Math.max(1,Math.floor((t.particleCount??50)/2));return{...t,particleCount:r,ticks:Math.min(t.ticks??200,100)}}var j=new Map,Ie=32;function Re({size:t}={}){typeof t=="number"&&t>0&&(Ie=t)}function ft(t){return t.type==="text"?`t|${t.text}|${t.scalar??""}|${t.color??""}|${t.fontFamily??""}`:`p|${t.path}|${Array.isArray(t.matrix)?t.matrix.join(","):"auto"}`}function Fe(t,r){if(j.size>=Ie){let o=j.keys().next().value,i=j.get(o);if(i&&i.bitmap&&typeof i.bitmap.close=="function")try{i.bitmap.close()}catch{}j.delete(o)}return j.set(t,r),r}function dt(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return null;let r=ft(t);if(j.has(r))return j.get(r);try{if(t.type==="text")return Fe(r,O.shapeFromText({text:t.text,scalar:t.scalar??1,color:t.color??"#000000",...t.fontFamily?{fontFamily:t.fontFamily}:{}}));if(t.type==="path")return Array.isArray(t.matrix)||Ee("A path shape was sent without a transform matrix. canvas-confetti will derive one by sampling a 1000x1000 grid, on the main thread. Compute it once and pass it to shapeFromPath() for anything that fires often."),Fe(r,O.shapeFromPath(Array.isArray(t.matrix)?{path:t.path,matrix:t.matrix}:{path:t.path}))}catch(o){return _(o,{phase:"shape",descriptor:t}),null}return null}function ce(t){if(!Array.isArray(t))return;let r=t.map(dt).filter(o=>o!=null);return r.length>0?r:void 0}function ue(){for(let t of j.values())if(t&&t.bitmap&&typeof t.bitmap.close=="function")try{t.bitmap.close()}catch{}j.clear()}function Oe(t={}){let r=t.canvas;if(!r)return O;let o=typeof document<"u"?document.querySelector(r):null;if(!o)return _(new Error(`No element matched the configured confetti canvas selector "${r}".`),{phase:"canvas"}),O;if(o.__laranailConfetti)return o.__laranailConfetti;Object.assign(o.style,{position:o.style.position||"fixed",inset:o.style.inset||"0",pointerEvents:"none",zIndex:o.style.zIndex||String(t.zIndex??100)});let i=O.create(o,{resize:!0,useWorker:t.useWorker!==!1});return o.__laranailConfetti=i,i}function V(t,r){let{cannon:o=O,defaults:i={},policy:c="reduce"}=r||{};if(K(c))return k(A.skipped,{reason:"reduced-motion",policy:c,options:t}),null;let d=Te(i,t),x=le(c);x&&(d=Pe(d)),d=Ae(d);let M=ce(d.shapes);M?d.shapes=M:delete d.shapes;let C;try{C=o(d)}catch(S){return _(S,{phase:"fire",options:d})}return k(A.burst,{options:d,reduced:x}),C&&typeof C.then=="function"&&C.catch(S=>_(S,{phase:"settle",options:d})),C}function fe(t,r){let{policy:o="reduce"}=r||{};return K(o)?(k(A.skipped,{reason:"reduced-motion",policy:o,bursts:t.length}),[]):(le(o)?t.slice(0,1):t).map(c=>{let d=c.delay??0;if(d<=0)return V(c.options,r);let x=setTimeout(()=>V(c.options,r),d);return r?.signal?.addEventListener?.("abort",()=>clearTimeout(x),{once:!0}),null})}function Z({duration:t,onFrame:r,interval:o=null,signal:i,pauseWhenHidden:c=!0}){return new Promise(d=>{if(i?.aborted){d();return}let x=typeof requestAnimationFrame=="function"?requestAnimationFrame:L=>setTimeout(()=>L(Date.now()),16),M=0,C=0,S=null,P=null,F=!1,B=()=>{F||(F=!0,P!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(P),i?.removeEventListener?.("abort",B),d())};i?.addEventListener?.("abort",B,{once:!0});let U=()=>c&&typeof document<"u"&&document.visibilityState==="hidden",z=L=>{if(F)return;let v=typeof L=="number"?L:Date.now();S===null&&(S=v);let W=Math.max(0,v-S);if(S=v,U()){P=x(z);return}M+=W;let q=!0;if(o===null)q=r(M,W)!==!1;else for(C+=W;C>=o&&q;)C-=o,q=r(M,W)!==!1;if(!q||M>=t){B();return}P=x(z)};P=x(z)})}function $(t,r){return Math.random()*(r-t)+t}function Be(t,r){let{duration:o=15e3,options:i={},params:c={}}=t,d=c.interval??250,x=c.particleCount??50,M=c.xRanges??[[.1,.3],[.7,.9]],[C,S]=c.yRange??[-.2,.8];return Z({duration:o,interval:d,signal:r.signal,pauseWhenHidden:r.pauseWhenHidden,onFrame:P=>{let F=o-P;if(F<=0)return!1;let B=Math.floor(x*(F/o));if(B<=0)return!0;for(let[U,z]of M)V({...i,particleCount:B,origin:{x:$(U,z),y:$(C,S)}},r);return!0}})}function Le(t,r){let{duration:o=15e3,options:i={},params:c={}}=t,d=c.sides??[{angle:60,origin:{x:0,y:.5}},{angle:120,origin:{x:1,y:.5}}];return Z({duration:o,signal:r.signal,pauseWhenHidden:r.pauseWhenHidden,onFrame:x=>{if(o-x<=0)return!1;for(let M of d)V({...i,angle:M.angle,origin:M.origin},r);return!0}})}function Ne(t,r){let{duration:o=15e3,options:i={},params:c={}}=t,d=c.ticksMin??200,x=c.ticksMax??500,M=c.skewTo??.8,C=c.skewStep??.001,[S,P]=c.gravity??[.4,.6],[F,B]=c.scalar??[.4,1],[U,z]=c.drift??[-.4,.4],L=c.skewFrom??1;return Z({duration:o,signal:r.signal,pauseWhenHidden:r.pauseWhenHidden,onFrame:v=>{let W=o-v;return W<=0?!1:(L=Math.max(M,L-C),V({...i,ticks:Math.max(d,x*(W/o)),origin:{x:Math.random(),y:Math.random()*L-.2},gravity:$(S,P),scalar:$(F,B),drift:$(U,z)},r),!0)}})}var de=new Map([["fireworks",Be],["snow",Ne],["schoolPride",Le]]);function pe(t,r){de.set(t,r)}function he(t){return de.get(t)??null}function pt(){return[...de.keys()]}var ht='script[type="application/json"][data-confetti-boot]',Q={event:"confetti:fire",legacyEvent:"fire-confetti",defaults:{},runtime:{useWorker:!0,canvas:null,reducedMotion:"reduce",pauseWhenHidden:!0,maxConcurrentAnimations:3,shapeCacheSize:32,debug:!1},payload:null};function G(t=typeof document<"u"?document:null){if(!t||typeof t.querySelector!="function")return{...Q};let r=t.querySelector(ht);if(!r)return{...Q};try{let o=JSON.parse(r.textContent||"{}");return{...Q,...o,runtime:{...Q.runtime,...o.runtime||{}}}}catch(o){return console.error("[laranail/confetti] Could not parse the boot payload.",o),{...Q}}}var J=class{constructor(r={}){this.boot=r,this.runtime=r.runtime||{},this.cannon=Oe(this.runtime),this.animations=new Set,this.seen=new Set,this.listeners=[],Re({size:this.runtime.shapeCacheSize}),Se(this.runtime.debug)}fire(r){let o=se(r);if(!o)return;if(o.action==="stop"||o.action==="reset"){this.stop(),o.action==="reset"&&this.reset();return}if(o.id){if(this.seen.has(o.id)){X("Ignored a payload already fired.",{id:o.id}),k(A.skipped,{reason:"already-fired",id:o.id});return}this.seen.add(o.id)}let i=o.reducedMotion||this.runtime.reducedMotion||"reduce";if(K(i)){X("Suppressed by the reduced-motion policy.",{policy:i}),k(A.skipped,{reason:"reduced-motion",policy:i,id:o.id});return}let c={cannon:this.cannon,defaults:this.boot.defaults||{},policy:i,pauseWhenHidden:this.runtime.pauseWhenHidden!==!1};o.bursts.length>0&&fe(o.bursts,c);for(let d of o.animations)this.animate(d,c)}animate(r,o){let i=he(r.animation);if(!i){_(new Error(`Unknown confetti animation "${r.animation}".`),{phase:"animate"});return}let c=this.runtime.maxConcurrentAnimations??3;for(;this.animations.size>=c;){let M=this.animations.values().next().value;M.abort(),this.animations.delete(M),X("Aborted the oldest animation to stay under the concurrency cap.",{limit:c}),k(A.skipped,{reason:"concurrency-cap",limit:c})}let d=new AbortController;this.animations.add(d),k(A.animationStart,{animation:r.animation,duration:r.duration});let x=()=>{this.animations.delete(d),k(A.animationEnd,{animation:r.animation})};Promise.resolve(i(r,{...o,signal:d.signal})).then(x).catch(M=>{x(),_(M,{phase:"animate",animation:r.animation})})}stop(){let r=this.animations.size;for(let o of this.animations)o.abort();this.animations.clear(),r>0&&k(A.stopped,{animations:r})}reset(){this.stop();try{typeof this.cannon.reset=="function"?this.cannon.reset():typeof O.reset=="function"&&O.reset()}catch(r){_(r,{phase:"reset"})}}listen(r=typeof window<"u"?window:null){if(!r)return this;let o=i=>{let c=i.detail,d=Array.isArray(c)?c[0]:c;this.fire(d)};for(let i of[this.boot.event,this.boot.legacyEvent])i&&(r.addEventListener(i,o),this.listeners.push([r,i,o]));return this}fireBootPayload(){return k(A.booted,{event:this.boot.event,hasPayload:!!this.boot.payload}),this.boot.payload&&this.fire(this.boot.payload),this}refresh(){let r=G();return this.boot={...this.boot,...r,runtime:this.runtime},r.payload&&this.fire(r.payload),this}registerAnimation(r,o){return pe(r,o),this}destroy(){this.stop(),ue();for(let[r,o,i]of this.listeners)r.removeEventListener(o,i);this.listeners=[]}};function mt(t=G()){return new J(t)}var dn="0.1.1";function pn(t={}){let r=new J(t.boot??G());return r.listen(),ae(r),oe(r,{prop:t.inertiaProp??"confetti"}),re(r),r.fireBootPayload(),r}export{xe as ERROR_EVENT,A as EVENTS,J as Runtime,pt as animationNames,it as beforeFire,ue as clearShapeCache,mt as createRuntime,k as emit,V as fire,fe as fireBursts,he as getAnimation,se as normalizePayload,at as off,ot as on,G as readBootConfig,re as registerAlpineAdapter,pe as registerAnimation,oe as registerInertiaAdapter,ae as registerLivewireAdapter,ce as resolveShapes,pn as start,dn as version}; diff --git a/resources/dist/confetti.iife.js b/resources/dist/confetti.iife.js index e325990..f84cf82 100644 --- a/resources/dist/confetti.iife.js +++ b/resources/dist/confetti.iife.js @@ -1,6 +1,6 @@ -/*! laranail/confetti v0.1.0 | MIT (c) Simtabi LLC +/*! laranail/confetti v0.1.1 | MIT (c) Simtabi LLC * Bundles canvas-confetti | ISC (c) 2020 Kiril Vatev | https://github.com/catdad/canvas-confetti * Full notice: resources/dist/LICENSE-canvas-confetti.txt */ var LaranailConfettiBundle=(()=>{var se=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var mt=(t,n)=>{for(var o in n)se(t,o,{get:n[o],enumerable:!0})},vt=(t,n,o,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of pt(n))!ht.call(t,s)&&s!==o&&se(t,s,{get:()=>n[s],enumerable:!(i=dt(n,s))||i.enumerable});return t};var yt=t=>vt(se({},"__esModule",{value:!0}),t);var Tt={};mt(Tt,{default:()=>At});function le(t,n=typeof window<"u"?window.Alpine:null){return!n||typeof n.data!="function"||n.data("laranailConfetti",()=>({fire(o){t.fire(o)},burst(o={}){t.fire({v:1,action:"fire",bursts:[{delay:0,options:o}],animations:[]})},preset(o,i={}){t.fire({v:1,action:"fire",bursts:[],animations:[{animation:o,duration:i.duration??15e3,options:i,params:{}}]})},realistic(){this.burst({particleCount:150,spread:70,origin:{x:.5,y:.7}})},stop(){t.stop()},reset(){t.reset()}})),t}function be(t,{prop:n="confetti",target:o=typeof window<"u"?window:null}={}){return!o||typeof o.addEventListener!="function"||(o.addEventListener("inertia:before",()=>t.stop()),o.addEventListener("inertia:success",i=>{let d=i?.detail?.page?.props?.[n];d&&t.fire(d)})),t}function we(t,n=typeof window<"u"?window:null){return!n||typeof n.addEventListener!="function"||(n.addEventListener("livewire:navigating",()=>t.stop()),n.addEventListener("livewire:navigated",()=>t.refresh())),t}var ce={};(function t(n,o,i,s){var d=!!(n.Worker&&n.Blob&&n.Promise&&n.OffscreenCanvas&&n.OffscreenCanvasRenderingContext2D&&n.HTMLCanvasElement&&n.HTMLCanvasElement.prototype.transferControlToOffscreen&&n.URL&&n.URL.createObjectURL),x=typeof Path2D=="function"&&typeof DOMMatrix=="function",M=(function(){if(!n.OffscreenCanvas)return!1;try{var r=new OffscreenCanvas(1,1),e=r.getContext("2d");e.fillRect(0,0,1,1);var a=r.transferToImageBitmap();e.createPattern(a,"no-repeat")}catch{return!1}return!0})();function S(){}function A(r){var e=o.exports.Promise,a=e!==void 0?e:n.Promise;return typeof a=="function"?new a(r):(r(S,S),null)}var k=(function(r,e){return{transform:function(a){if(r)return a;if(e.has(a))return e.get(a);var c=new OffscreenCanvas(a.width,a.height),u=c.getContext("2d");return u.drawImage(a,0,0),e.set(a,c),c},clear:function(){e.clear()}}})(M,new Map),P=(function(){var r=Math.floor(16.666666666666668),e,a,c={},u=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(e=function(f){var p=Math.random();return c[p]=requestAnimationFrame(function l(h){u===h||u+r-1"u"||typeof window.dispatchEvent!="function"))try{window.dispatchEvent(new CustomEvent(t,{detail:n}))}catch{}}function Se(t,n,o=typeof window<"u"?window:null){let i=C[t]??t;return!o||typeof o.addEventListener!="function"?()=>{}:(o.addEventListener(i,n),()=>o.removeEventListener(i,n))}function Ae(t,n,o=typeof window<"u"?window:null){let i=C[t]??t;o?.removeEventListener?.(i,n)}var Y=[];function Te(t){return Y.push(t),()=>{let n=Y.indexOf(t);n!==-1&&Y.splice(n,1)}}function ke(t){return Y.reduce((n,o)=>{try{return o(n)??n}catch(i){return F(C.error,{error:i,phase:"beforeFire"}),n}},t)}function Fe(t){return t?Array.isArray(t)?{v:0,id:null,action:"fire",bursts:t.map(bt).filter(Boolean),animations:[],reducedMotion:null}:typeof t!="object"?null:typeof t.v=="number"&&t.v>1?(console.error(`[laranail/confetti] Payload version ${t.v} is newer than this runtime supports (1). Rebuild the package assets.`),null):{v:t.v??0,id:typeof t.id=="string"?t.id:null,action:typeof t.action=="string"?t.action:"fire",bursts:Array.isArray(t.bursts)?t.bursts.map(gt).filter(Boolean):[],animations:Array.isArray(t.animations)?t.animations.filter(Boolean):[],reducedMotion:typeof t.reducedMotion=="string"?t.reducedMotion:null}:null}function gt(t){return!t||typeof t!="object"?null:{delay:typeof t.delay=="number"?t.delay:0,options:t.options&&typeof t.options=="object"?t.options:{}}}function bt(t){if(!t||typeof t!="object")return null;let{delay:n,...o}=t;return{delay:typeof n=="number"?n:0,options:o}}function Pe(t,n){let o={...t||{},...n||{}};return delete o.delay,o}var wt="reduce",Mt="skip";function Ie(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function K(t){return t===Mt&&Ie()}function fe(t){return t===wt&&Ie()}function Re(t){let n=Math.max(1,Math.floor((t.particleCount??50)/2));return{...t,particleCount:n,ticks:Math.min(t.ticks??200,100)}}var V=new Map,Le=32;function Be({size:t}={}){typeof t=="number"&&t>0&&(Le=t)}function xt(t){return t.type==="text"?`t|${t.text}|${t.scalar??""}|${t.color??""}|${t.fontFamily??""}`:`p|${t.path}|${Array.isArray(t.matrix)?t.matrix.join(","):"auto"}`}function Oe(t,n){if(V.size>=Le){let o=V.keys().next().value,i=V.get(o);if(i&&i.bitmap&&typeof i.bitmap.close=="function")try{i.bitmap.close()}catch{}V.delete(o)}return V.set(t,n),n}function Et(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return null;let n=xt(t);if(V.has(n))return V.get(n);try{if(t.type==="text")return Oe(n,O.shapeFromText({text:t.text,scalar:t.scalar??1,color:t.color??"#000000",...t.fontFamily?{fontFamily:t.fontFamily}:{}}));if(t.type==="path")return Array.isArray(t.matrix)||xe("A path shape was sent without a transform matrix. canvas-confetti will derive one by sampling a 1000x1000 grid, on the main thread. Compute it once and pass it to shapeFromPath() for anything that fires often."),Oe(n,O.shapeFromPath(Array.isArray(t.matrix)?{path:t.path,matrix:t.matrix}:{path:t.path}))}catch(o){return _(o,{phase:"shape",descriptor:t}),null}return null}function Ne(t){if(!Array.isArray(t))return;let n=t.map(Et).filter(o=>o!=null);return n.length>0?n:void 0}function ee(){for(let t of V.values())if(t&&t.bitmap&&typeof t.bitmap.close=="function")try{t.bitmap.close()}catch{}V.clear()}function _e(t={}){let n=t.canvas;if(!n)return O;let o=typeof document<"u"?document.querySelector(n):null;if(!o)return _(new Error(`No element matched the configured confetti canvas selector "${n}".`),{phase:"canvas"}),O;if(o.__laranailConfetti)return o.__laranailConfetti;Object.assign(o.style,{position:o.style.position||"fixed",inset:o.style.inset||"0",pointerEvents:"none",zIndex:o.style.zIndex||String(t.zIndex??100)});let i=O.create(o,{resize:!0,useWorker:t.useWorker!==!1});return o.__laranailConfetti=i,i}function U(t,n){let{cannon:o=O,defaults:i={},policy:s="reduce"}=n||{};if(K(s))return F(C.skipped,{reason:"reduced-motion",policy:s,options:t}),null;let d=Pe(i,t),x=fe(s);x&&(d=Re(d)),d=ke(d);let M=Ne(d.shapes);M?d.shapes=M:delete d.shapes;let S;try{S=o(d)}catch(A){return _(A,{phase:"fire",options:d})}return F(C.burst,{options:d,reduced:x}),S&&typeof S.then=="function"&&S.catch(A=>_(A,{phase:"settle",options:d})),S}function We(t,n){let{policy:o="reduce"}=n||{};return K(o)?(F(C.skipped,{reason:"reduced-motion",policy:o,bursts:t.length}),[]):(fe(o)?t.slice(0,1):t).map(s=>{let d=s.delay??0;if(d<=0)return U(s.options,n);let x=setTimeout(()=>U(s.options,n),d);return n?.signal?.addEventListener?.("abort",()=>clearTimeout(x),{once:!0}),null})}function J({duration:t,onFrame:n,interval:o=null,signal:i,pauseWhenHidden:s=!0}){return new Promise(d=>{if(i?.aborted){d();return}let x=typeof requestAnimationFrame=="function"?requestAnimationFrame:B=>setTimeout(()=>B(Date.now()),16),M=0,S=0,A=null,k=null,P=!1,L=()=>{P||(P=!0,k!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(k),i?.removeEventListener?.("abort",L),d())};i?.addEventListener?.("abort",L,{once:!0});let $=()=>s&&typeof document<"u"&&document.visibilityState==="hidden",z=B=>{if(P)return;let v=typeof B=="number"?B:Date.now();A===null&&(A=v);let D=Math.max(0,v-A);if(A=v,$()){k=x(z);return}M+=D;let G=!0;if(o===null)G=n(M,D)!==!1;else for(S+=D;S>=o&&G;)S-=o,G=n(M,D)!==!1;if(!G||M>=t){L();return}k=x(z)};k=x(z)})}function Z(t,n){return Math.random()*(n-t)+t}function ze(t,n){let{duration:o=15e3,options:i={},params:s={}}=t,d=s.interval??250,x=s.particleCount??50,M=s.xRanges??[[.1,.3],[.7,.9]],[S,A]=s.yRange??[-.2,.8];return J({duration:o,interval:d,signal:n.signal,pauseWhenHidden:n.pauseWhenHidden,onFrame:k=>{let P=o-k;if(P<=0)return!1;let L=Math.floor(x*(P/o));if(L<=0)return!0;for(let[$,z]of M)U({...i,particleCount:L,origin:{x:Z($,z),y:Z(S,A)}},n);return!0}})}function De(t,n){let{duration:o=15e3,options:i={},params:s={}}=t,d=s.sides??[{angle:60,origin:{x:0,y:.5}},{angle:120,origin:{x:1,y:.5}}];return J({duration:o,signal:n.signal,pauseWhenHidden:n.pauseWhenHidden,onFrame:x=>{if(o-x<=0)return!1;for(let M of d)U({...i,angle:M.angle,origin:M.origin},n);return!0}})}function je(t,n){let{duration:o=15e3,options:i={},params:s={}}=t,d=s.ticksMin??200,x=s.ticksMax??500,M=s.skewTo??.8,S=s.skewStep??.001,[A,k]=s.gravity??[.4,.6],[P,L]=s.scalar??[.4,1],[$,z]=s.drift??[-.4,.4],B=s.skewFrom??1;return J({duration:o,signal:n.signal,pauseWhenHidden:n.pauseWhenHidden,onFrame:v=>{let D=o-v;return D<=0?!1:(B=Math.max(M,B-S),U({...i,ticks:Math.max(d,x*(D/o)),origin:{x:Math.random(),y:Math.random()*B-.2},gravity:Z(A,k),scalar:Z(P,L),drift:Z($,z)},n),!0)}})}var de=new Map([["fireworks",ze],["snow",je],["schoolPride",De]]);function te(t,n){de.set(t,n)}function Ve(t){return de.get(t)??null}function Ue(){return[...de.keys()]}var Ct='script[type="application/json"][data-confetti-boot]',Q={event:"confetti:fire",legacyEvent:"fire-confetti",defaults:{},runtime:{useWorker:!0,canvas:null,reducedMotion:"reduce",pauseWhenHidden:!0,maxConcurrentAnimations:3,shapeCacheSize:32,debug:!1},payload:null};function ne(t=typeof document<"u"?document:null){if(!t||typeof t.querySelector!="function")return{...Q};let n=t.querySelector(Ct);if(!n)return{...Q};try{let o=JSON.parse(n.textContent||"{}");return{...Q,...o,runtime:{...Q.runtime,...o.runtime||{}}}}catch(o){return console.error("[laranail/confetti] Could not parse the boot payload.",o),{...Q}}}var re=class{constructor(n={}){this.boot=n,this.runtime=n.runtime||{},this.cannon=_e(this.runtime),this.animations=new Set,this.seen=new Set,this.listeners=[],Be({size:this.runtime.shapeCacheSize}),Ce(this.runtime.debug)}fire(n){let o=Fe(n);if(!o)return;if(o.action==="stop"||o.action==="reset"){this.stop(),o.action==="reset"&&this.reset();return}if(o.id){if(this.seen.has(o.id)){X("Ignored a payload already fired.",{id:o.id}),F(C.skipped,{reason:"already-fired",id:o.id});return}this.seen.add(o.id)}let i=o.reducedMotion||this.runtime.reducedMotion||"reduce";if(K(i)){X("Suppressed by the reduced-motion policy.",{policy:i}),F(C.skipped,{reason:"reduced-motion",policy:i,id:o.id});return}let s={cannon:this.cannon,defaults:this.boot.defaults||{},policy:i,pauseWhenHidden:this.runtime.pauseWhenHidden!==!1};o.bursts.length>0&&We(o.bursts,s);for(let d of o.animations)this.animate(d,s)}animate(n,o){let i=Ve(n.animation);if(!i){_(new Error(`Unknown confetti animation "${n.animation}".`),{phase:"animate"});return}let s=this.runtime.maxConcurrentAnimations??3;for(;this.animations.size>=s;){let M=this.animations.values().next().value;M.abort(),this.animations.delete(M),X("Aborted the oldest animation to stay under the concurrency cap.",{limit:s}),F(C.skipped,{reason:"concurrency-cap",limit:s})}let d=new AbortController;this.animations.add(d),F(C.animationStart,{animation:n.animation,duration:n.duration});let x=()=>{this.animations.delete(d),F(C.animationEnd,{animation:n.animation})};Promise.resolve(i(n,{...o,signal:d.signal})).then(x).catch(M=>{x(),_(M,{phase:"animate",animation:n.animation})})}stop(){let n=this.animations.size;for(let o of this.animations)o.abort();this.animations.clear(),n>0&&F(C.stopped,{animations:n})}reset(){this.stop();try{typeof this.cannon.reset=="function"?this.cannon.reset():typeof O.reset=="function"&&O.reset()}catch(n){_(n,{phase:"reset"})}}listen(n=typeof window<"u"?window:null){if(!n)return this;let o=i=>{let s=i.detail,d=Array.isArray(s)?s[0]:s;this.fire(d)};for(let i of[this.boot.event,this.boot.legacyEvent])i&&(n.addEventListener(i,o),this.listeners.push([n,i,o]));return this}fireBootPayload(){return F(C.booted,{event:this.boot.event,hasPayload:!!this.boot.payload}),this.boot.payload&&this.fire(this.boot.payload),this}refresh(){let n=ne();return this.boot={...this.boot,...n,runtime:this.runtime},n.payload&&this.fire(n.payload),this}registerAnimation(n,o){return te(n,o),this}destroy(){this.stop(),ee();for(let[n,o,i]of this.listeners)n.removeEventListener(o,i);this.listeners=[]}};var St="0.1.0",W=null;function H(){return W||(W=new re(ne()),W.listen(),we(W),be(W),le(W),window.addEventListener("alpine:init",()=>le(W),{once:!0}),W.fireBootPayload(),W)}var He={version:St,ERROR_EVENT:ue,EVENTS:C,on(t,n){return Se(t,n)},off(t,n){Ae(t,n)},beforeFire(t){return Te(t)},fire(t){H().fire(t)},burst(t={}){H().fire({v:1,action:"fire",bursts:[{delay:0,options:t}],animations:[]})},animate(t,{duration:n=15e3,options:o={},params:i={}}={}){H().fire({v:1,action:"fire",bursts:[],animations:[{animation:t,duration:n,options:o,params:i}]})},stop(){H().stop()},reset(){H().reset()},registerAnimation(t,n){te(t,n)},animations:Ue,clearShapeCache:ee,runtime:()=>H()};typeof window<"u"&&(window.LaranailConfetti=He,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",H,{once:!0}):H());var At=He;return yt(Tt);})(); +`);try{r=new Worker(URL.createObjectURL(new Blob([u])))}catch(f){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("\u{1F38A} Could not load worker",f),null}c(r)}return r}})(),$={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function z(r,e){return e?e(r):r}function B(r){return r!=null}function v(r,e,a){return z(r&&B(r[e])?r[e]:$[e],a)}function D(r){return r<0?0:Math.floor(r)}function G(r,e){return Math.floor(Math.random()*(e-r))+r}function oe(r){return parseInt(r,16)}function $e(r){return r.map(qe)}function qe(r){var e=String(r).replace(/[^0-9a-f]/gi,"");return e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),{r:oe(e.substring(0,2)),g:oe(e.substring(2,4)),b:oe(e.substring(4,6))}}function Ze(r){var e=v(r,"origin",Object);return e.x=v(e,"x",Number),e.y=v(e,"y",Number),e}function Ge(r){r.width=document.documentElement.clientWidth,r.height=document.documentElement.clientHeight}function Je(r){var e=r.getBoundingClientRect();r.width=e.width,r.height=e.height}function Ke(r){var e=document.createElement("canvas");return e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",e.style.zIndex=r,e}function Qe(r,e,a,c,u,f,p,l,h){r.save(),r.translate(e,a),r.rotate(f),r.scale(c,u),r.arc(0,0,1,p,l,h),r.restore()}function Xe(r){var e=r.angle*(Math.PI/180),a=r.spread*(Math.PI/180);return{x:r.x,y:r.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:r.startVelocity*.5+Math.random()*r.startVelocity,angle2D:-e+(.5*a-Math.random()*a),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:r.color,shape:r.shape,tick:0,totalTicks:r.ticks,decay:r.decay,drift:r.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:r.gravity*3,ovalScalar:.6,scalar:r.scalar,flat:r.flat}}function Ye(r,e){e.x+=Math.cos(e.angle2D)*e.velocity+e.drift,e.y+=Math.sin(e.angle2D)*e.velocity+e.gravity,e.velocity*=e.decay,e.flat?(e.wobble=0,e.wobbleX=e.x+10*e.scalar,e.wobbleY=e.y+10*e.scalar,e.tiltSin=0,e.tiltCos=0,e.random=1):(e.wobble+=e.wobbleSpeed,e.wobbleX=e.x+10*e.scalar*Math.cos(e.wobble),e.wobbleY=e.y+10*e.scalar*Math.sin(e.wobble),e.tiltAngle+=.1,e.tiltSin=Math.sin(e.tiltAngle),e.tiltCos=Math.cos(e.tiltAngle),e.random=Math.random()+2);var a=e.tick++/e.totalTicks,c=e.x+e.random*e.tiltCos,u=e.y+e.random*e.tiltSin,f=e.wobbleX+e.random*e.tiltCos,p=e.wobbleY+e.random*e.tiltSin;if(r.fillStyle="rgba("+e.color.r+", "+e.color.g+", "+e.color.b+", "+(1-a)+")",r.beginPath(),x&&e.shape.type==="path"&&typeof e.shape.path=="string"&&Array.isArray(e.shape.matrix))r.fill(tt(e.shape.path,e.shape.matrix,e.x,e.y,Math.abs(f-c)*.1,Math.abs(p-u)*.1,Math.PI/10*e.wobble));else if(e.shape.type==="bitmap"){var l=Math.PI/10*e.wobble,h=Math.abs(f-c)*.1,y=Math.abs(p-u)*.1,b=e.shape.bitmap.width*e.scalar,g=e.shape.bitmap.height*e.scalar,w=new DOMMatrix([Math.cos(l)*h,Math.sin(l)*h,-Math.sin(l)*y,Math.cos(l)*y,e.x,e.y]);w.multiplySelf(new DOMMatrix(e.shape.matrix));var E=r.createPattern(k.transform(e.shape.bitmap),"no-repeat");E.setTransform(w),r.globalAlpha=1-a,r.fillStyle=E,r.fillRect(e.x-b/2,e.y-g/2,b,g),r.globalAlpha=1}else if(e.shape==="circle")r.ellipse?r.ellipse(e.x,e.y,Math.abs(f-c)*e.ovalScalar,Math.abs(p-u)*e.ovalScalar,Math.PI/10*e.wobble,0,2*Math.PI):Qe(r,e.x,e.y,Math.abs(f-c)*e.ovalScalar,Math.abs(p-u)*e.ovalScalar,Math.PI/10*e.wobble,0,2*Math.PI);else if(e.shape==="star")for(var m=Math.PI/2*3,T=4*e.scalar,I=8*e.scalar,R=e.x,j=e.y,q=5,N=Math.PI/q;q--;)R=e.x+Math.cos(m)*I,j=e.y+Math.sin(m)*I,r.lineTo(R,j),m+=N,R=e.x+Math.cos(m)*T,j=e.y+Math.sin(m)*T,r.lineTo(R,j),m+=N;else r.moveTo(Math.floor(e.x),Math.floor(e.y)),r.lineTo(Math.floor(e.wobbleX),Math.floor(u)),r.lineTo(Math.floor(f),Math.floor(p)),r.lineTo(Math.floor(c),Math.floor(e.wobbleY));return r.closePath(),r.fill(),e.tick"u"||typeof window.dispatchEvent!="function"))try{window.dispatchEvent(new CustomEvent(t,{detail:n}))}catch{}}function Se(t,n,o=typeof window<"u"?window:null){let i=C[t]??t;return!o||typeof o.addEventListener!="function"?()=>{}:(o.addEventListener(i,n),()=>o.removeEventListener(i,n))}function Ae(t,n,o=typeof window<"u"?window:null){let i=C[t]??t;o?.removeEventListener?.(i,n)}var Y=[];function Te(t){return Y.push(t),()=>{let n=Y.indexOf(t);n!==-1&&Y.splice(n,1)}}function ke(t){return Y.reduce((n,o)=>{try{return o(n)??n}catch(i){return F(C.error,{error:i,phase:"beforeFire"}),n}},t)}function Fe(t){return t?Array.isArray(t)?{v:0,id:null,action:"fire",bursts:t.map(bt).filter(Boolean),animations:[],reducedMotion:null}:typeof t!="object"?null:typeof t.v=="number"&&t.v>1?(console.error(`[laranail/confetti] Payload version ${t.v} is newer than this runtime supports (1). Rebuild the package assets.`),null):{v:t.v??0,id:typeof t.id=="string"?t.id:null,action:typeof t.action=="string"?t.action:"fire",bursts:Array.isArray(t.bursts)?t.bursts.map(gt).filter(Boolean):[],animations:Array.isArray(t.animations)?t.animations.filter(Boolean):[],reducedMotion:typeof t.reducedMotion=="string"?t.reducedMotion:null}:null}function gt(t){return!t||typeof t!="object"?null:{delay:typeof t.delay=="number"?t.delay:0,options:t.options&&typeof t.options=="object"?t.options:{}}}function bt(t){if(!t||typeof t!="object")return null;let{delay:n,...o}=t;return{delay:typeof n=="number"?n:0,options:o}}function Pe(t,n){let o={...t||{},...n||{}};return delete o.delay,o}var wt="reduce",Mt="skip";function Ie(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function K(t){return t===Mt&&Ie()}function fe(t){return t===wt&&Ie()}function Re(t){let n=Math.max(1,Math.floor((t.particleCount??50)/2));return{...t,particleCount:n,ticks:Math.min(t.ticks??200,100)}}var V=new Map,Le=32;function Be({size:t}={}){typeof t=="number"&&t>0&&(Le=t)}function xt(t){return t.type==="text"?`t|${t.text}|${t.scalar??""}|${t.color??""}|${t.fontFamily??""}`:`p|${t.path}|${Array.isArray(t.matrix)?t.matrix.join(","):"auto"}`}function Oe(t,n){if(V.size>=Le){let o=V.keys().next().value,i=V.get(o);if(i&&i.bitmap&&typeof i.bitmap.close=="function")try{i.bitmap.close()}catch{}V.delete(o)}return V.set(t,n),n}function Et(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return null;let n=xt(t);if(V.has(n))return V.get(n);try{if(t.type==="text")return Oe(n,O.shapeFromText({text:t.text,scalar:t.scalar??1,color:t.color??"#000000",...t.fontFamily?{fontFamily:t.fontFamily}:{}}));if(t.type==="path")return Array.isArray(t.matrix)||xe("A path shape was sent without a transform matrix. canvas-confetti will derive one by sampling a 1000x1000 grid, on the main thread. Compute it once and pass it to shapeFromPath() for anything that fires often."),Oe(n,O.shapeFromPath(Array.isArray(t.matrix)?{path:t.path,matrix:t.matrix}:{path:t.path}))}catch(o){return _(o,{phase:"shape",descriptor:t}),null}return null}function Ne(t){if(!Array.isArray(t))return;let n=t.map(Et).filter(o=>o!=null);return n.length>0?n:void 0}function ee(){for(let t of V.values())if(t&&t.bitmap&&typeof t.bitmap.close=="function")try{t.bitmap.close()}catch{}V.clear()}function _e(t={}){let n=t.canvas;if(!n)return O;let o=typeof document<"u"?document.querySelector(n):null;if(!o)return _(new Error(`No element matched the configured confetti canvas selector "${n}".`),{phase:"canvas"}),O;if(o.__laranailConfetti)return o.__laranailConfetti;Object.assign(o.style,{position:o.style.position||"fixed",inset:o.style.inset||"0",pointerEvents:"none",zIndex:o.style.zIndex||String(t.zIndex??100)});let i=O.create(o,{resize:!0,useWorker:t.useWorker!==!1});return o.__laranailConfetti=i,i}function U(t,n){let{cannon:o=O,defaults:i={},policy:s="reduce"}=n||{};if(K(s))return F(C.skipped,{reason:"reduced-motion",policy:s,options:t}),null;let d=Pe(i,t),x=fe(s);x&&(d=Re(d)),d=ke(d);let M=Ne(d.shapes);M?d.shapes=M:delete d.shapes;let S;try{S=o(d)}catch(A){return _(A,{phase:"fire",options:d})}return F(C.burst,{options:d,reduced:x}),S&&typeof S.then=="function"&&S.catch(A=>_(A,{phase:"settle",options:d})),S}function We(t,n){let{policy:o="reduce"}=n||{};return K(o)?(F(C.skipped,{reason:"reduced-motion",policy:o,bursts:t.length}),[]):(fe(o)?t.slice(0,1):t).map(s=>{let d=s.delay??0;if(d<=0)return U(s.options,n);let x=setTimeout(()=>U(s.options,n),d);return n?.signal?.addEventListener?.("abort",()=>clearTimeout(x),{once:!0}),null})}function J({duration:t,onFrame:n,interval:o=null,signal:i,pauseWhenHidden:s=!0}){return new Promise(d=>{if(i?.aborted){d();return}let x=typeof requestAnimationFrame=="function"?requestAnimationFrame:B=>setTimeout(()=>B(Date.now()),16),M=0,S=0,A=null,k=null,P=!1,L=()=>{P||(P=!0,k!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(k),i?.removeEventListener?.("abort",L),d())};i?.addEventListener?.("abort",L,{once:!0});let $=()=>s&&typeof document<"u"&&document.visibilityState==="hidden",z=B=>{if(P)return;let v=typeof B=="number"?B:Date.now();A===null&&(A=v);let D=Math.max(0,v-A);if(A=v,$()){k=x(z);return}M+=D;let G=!0;if(o===null)G=n(M,D)!==!1;else for(S+=D;S>=o&&G;)S-=o,G=n(M,D)!==!1;if(!G||M>=t){L();return}k=x(z)};k=x(z)})}function Z(t,n){return Math.random()*(n-t)+t}function ze(t,n){let{duration:o=15e3,options:i={},params:s={}}=t,d=s.interval??250,x=s.particleCount??50,M=s.xRanges??[[.1,.3],[.7,.9]],[S,A]=s.yRange??[-.2,.8];return J({duration:o,interval:d,signal:n.signal,pauseWhenHidden:n.pauseWhenHidden,onFrame:k=>{let P=o-k;if(P<=0)return!1;let L=Math.floor(x*(P/o));if(L<=0)return!0;for(let[$,z]of M)U({...i,particleCount:L,origin:{x:Z($,z),y:Z(S,A)}},n);return!0}})}function De(t,n){let{duration:o=15e3,options:i={},params:s={}}=t,d=s.sides??[{angle:60,origin:{x:0,y:.5}},{angle:120,origin:{x:1,y:.5}}];return J({duration:o,signal:n.signal,pauseWhenHidden:n.pauseWhenHidden,onFrame:x=>{if(o-x<=0)return!1;for(let M of d)U({...i,angle:M.angle,origin:M.origin},n);return!0}})}function je(t,n){let{duration:o=15e3,options:i={},params:s={}}=t,d=s.ticksMin??200,x=s.ticksMax??500,M=s.skewTo??.8,S=s.skewStep??.001,[A,k]=s.gravity??[.4,.6],[P,L]=s.scalar??[.4,1],[$,z]=s.drift??[-.4,.4],B=s.skewFrom??1;return J({duration:o,signal:n.signal,pauseWhenHidden:n.pauseWhenHidden,onFrame:v=>{let D=o-v;return D<=0?!1:(B=Math.max(M,B-S),U({...i,ticks:Math.max(d,x*(D/o)),origin:{x:Math.random(),y:Math.random()*B-.2},gravity:Z(A,k),scalar:Z(P,L),drift:Z($,z)},n),!0)}})}var de=new Map([["fireworks",ze],["snow",je],["schoolPride",De]]);function te(t,n){de.set(t,n)}function Ve(t){return de.get(t)??null}function Ue(){return[...de.keys()]}var Ct='script[type="application/json"][data-confetti-boot]',Q={event:"confetti:fire",legacyEvent:"fire-confetti",defaults:{},runtime:{useWorker:!0,canvas:null,reducedMotion:"reduce",pauseWhenHidden:!0,maxConcurrentAnimations:3,shapeCacheSize:32,debug:!1},payload:null};function ne(t=typeof document<"u"?document:null){if(!t||typeof t.querySelector!="function")return{...Q};let n=t.querySelector(Ct);if(!n)return{...Q};try{let o=JSON.parse(n.textContent||"{}");return{...Q,...o,runtime:{...Q.runtime,...o.runtime||{}}}}catch(o){return console.error("[laranail/confetti] Could not parse the boot payload.",o),{...Q}}}var re=class{constructor(n={}){this.boot=n,this.runtime=n.runtime||{},this.cannon=_e(this.runtime),this.animations=new Set,this.seen=new Set,this.listeners=[],Be({size:this.runtime.shapeCacheSize}),Ce(this.runtime.debug)}fire(n){let o=Fe(n);if(!o)return;if(o.action==="stop"||o.action==="reset"){this.stop(),o.action==="reset"&&this.reset();return}if(o.id){if(this.seen.has(o.id)){X("Ignored a payload already fired.",{id:o.id}),F(C.skipped,{reason:"already-fired",id:o.id});return}this.seen.add(o.id)}let i=o.reducedMotion||this.runtime.reducedMotion||"reduce";if(K(i)){X("Suppressed by the reduced-motion policy.",{policy:i}),F(C.skipped,{reason:"reduced-motion",policy:i,id:o.id});return}let s={cannon:this.cannon,defaults:this.boot.defaults||{},policy:i,pauseWhenHidden:this.runtime.pauseWhenHidden!==!1};o.bursts.length>0&&We(o.bursts,s);for(let d of o.animations)this.animate(d,s)}animate(n,o){let i=Ve(n.animation);if(!i){_(new Error(`Unknown confetti animation "${n.animation}".`),{phase:"animate"});return}let s=this.runtime.maxConcurrentAnimations??3;for(;this.animations.size>=s;){let M=this.animations.values().next().value;M.abort(),this.animations.delete(M),X("Aborted the oldest animation to stay under the concurrency cap.",{limit:s}),F(C.skipped,{reason:"concurrency-cap",limit:s})}let d=new AbortController;this.animations.add(d),F(C.animationStart,{animation:n.animation,duration:n.duration});let x=()=>{this.animations.delete(d),F(C.animationEnd,{animation:n.animation})};Promise.resolve(i(n,{...o,signal:d.signal})).then(x).catch(M=>{x(),_(M,{phase:"animate",animation:n.animation})})}stop(){let n=this.animations.size;for(let o of this.animations)o.abort();this.animations.clear(),n>0&&F(C.stopped,{animations:n})}reset(){this.stop();try{typeof this.cannon.reset=="function"?this.cannon.reset():typeof O.reset=="function"&&O.reset()}catch(n){_(n,{phase:"reset"})}}listen(n=typeof window<"u"?window:null){if(!n)return this;let o=i=>{let s=i.detail,d=Array.isArray(s)?s[0]:s;this.fire(d)};for(let i of[this.boot.event,this.boot.legacyEvent])i&&(n.addEventListener(i,o),this.listeners.push([n,i,o]));return this}fireBootPayload(){return F(C.booted,{event:this.boot.event,hasPayload:!!this.boot.payload}),this.boot.payload&&this.fire(this.boot.payload),this}refresh(){let n=ne();return this.boot={...this.boot,...n,runtime:this.runtime},n.payload&&this.fire(n.payload),this}registerAnimation(n,o){return te(n,o),this}destroy(){this.stop(),ee();for(let[n,o,i]of this.listeners)n.removeEventListener(o,i);this.listeners=[]}};var St="0.1.1",W=null;function H(){return W||(W=new re(ne()),W.listen(),we(W),be(W),le(W),window.addEventListener("alpine:init",()=>le(W),{once:!0}),W.fireBootPayload(),W)}var He={version:St,ERROR_EVENT:ue,EVENTS:C,on(t,n){return Se(t,n)},off(t,n){Ae(t,n)},beforeFire(t){return Te(t)},fire(t){H().fire(t)},burst(t={}){H().fire({v:1,action:"fire",bursts:[{delay:0,options:t}],animations:[]})},animate(t,{duration:n=15e3,options:o={},params:i={}}={}){H().fire({v:1,action:"fire",bursts:[],animations:[{animation:t,duration:n,options:o,params:i}]})},stop(){H().stop()},reset(){H().reset()},registerAnimation(t,n){te(t,n)},animations:Ue,clearShapeCache:ee,runtime:()=>H()};typeof window<"u"&&(window.LaranailConfetti=He,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",H,{once:!0}):H());var At=He;return yt(Tt);})();