import e from"../../../_util/raf.mjs";import{onBeforeUnmount as t,shallowRef as n}from"vue";function r(r){let i=n(),a=n(!1);function o(...t){a.value||(e.cancel(i.value),i.value=e(()=>{r(...t)}))}return t(()=>{a.value=!0,e.cancel(i.value)}),o}function i(e){let t=n([]),i=n(typeof e==`function`?e():e),a=r(()=>{let e=i.value;t.value.forEach(t=>{e=t(e)}),t.value=[],i.value=e});function o(e){t.value.push(e),a()}return[i,o]}export{r as default,i as useRafState};