import{__spreadProps as e,__spreadValues as n}from"./chunk.6M63UXML.js";function animateTo(t,i,o){return new Promise((r=>{if((null==o?void 0:o.duration)===1/0)throw new Error("Promise-based animations must be finite.");const a=t.animate(i,e(n({},o),{duration:prefersReducedMotion()?0:o.duration}));a.addEventListener("cancel",r,{once:!0}),a.addEventListener("finish",r,{once:!0})}))}function parseDuration(e){return(e=e.toString().toLowerCase()).indexOf("ms")>-1?parseFloat(e):e.indexOf("s")>-1?1e3*parseFloat(e):parseFloat(e)}function prefersReducedMotion(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function stopAnimations(e){return Promise.all(e.getAnimations().map((e=>new Promise((n=>{const t=requestAnimationFrame(n);e.addEventListener("cancel",(()=>t),{once:!0}),e.addEventListener("finish",(()=>t),{once:!0}),e.cancel()})))))}function shimKeyframesHeightAuto(t,i){return t.map((t=>e(n({},t),{height:"auto"===t.height?`${i}px`:t.height})))}export{animateTo,parseDuration,prefersReducedMotion,stopAnimations,shimKeyframesHeightAuto};