function n(n,t,i){return new Promise((r=>{if((null==i?void 0:i.duration)===1/0)throw new Error("Promise-based animations must be finite.");if(!(null==n?void 0:n.animate))return;const a=n.animate(t,{...i,duration:e()?0:i.duration});a&&(a.addEventListener("cancel",r,{once:!0}),a.addEventListener("finish",r,{once:!0}))}))}function e(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function o(n){var e;return Promise.all(((null===(e=null==n?void 0:n.getAnimations)||void 0===e?void 0:e.call(n))||[]).map((n=>new Promise((e=>{const t=requestAnimationFrame(e);n.addEventListener("cancel",(()=>t),{once:!0}),n.addEventListener("finish",(()=>t),{once:!0}),n.cancel()})))))}function i(n,e){return n.map((n=>({...n,height:"auto"===n.height?`${e}px`:n.height})))}const r=new Map,t=new WeakMap;function u(n){return null!=n?n:{keyframes:[],options:{duration:0}}}function s(n,e){r.set(n,u(e))}function a(n,e,i={}){var a;const o=t.get(n),s=null!==(a=null==o?void 0:o[e])&&void 0!==a?a:r.get(e);return s?"rtl"===i.dir&&s.rtlKeyframes?{...s,keyframes:s.rtlKeyframes}:s:{keyframes:[],options:{duration:0}}}export{o as a,n as b,i as c,a as g,s};