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