function r(){let n=[],s={addEventListener(e,t,i,a){return e.addEventListener(t,i,a),s.add(()=>e.removeEventListener(t,i,a))},requestAnimationFrame(...e){let t=requestAnimationFrame(...e);s.add(()=>cancelAnimationFrame(t))},nextFrame(...e){s.requestAnimationFrame(()=>{s.requestAnimationFrame(...e)})},setTimeout(...e){let t=setTimeout(...e);s.add(()=>clearTimeout(t))},style(e,t,i){let a=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:i}),this.add(()=>{Object.assign(e.style,{[t]:a})})},group(e){let t=r();return e(t),this.add(()=>t.dispose())},add(e){return n.push(e),()=>{let t=n.indexOf(e);if(t>=0)for(let i of n.splice(t,1))i()}},dispose(){for(let e of n.splice(0))e()}};return s}export{r as disposables};
