import{S as d,ad as b,m as g,a5 as v}from"./_plugin-vue_export-helper.js";function w(t,r){let n,e,o;const u=d(!0),a=()=>{u.value=!0,o()};b(t,a,{flush:"sync"});const c=typeof r=="function"?r:r.get,l=typeof r=="function"?void 0:r.set,i=g((s,f)=>(e=s,o=f,{get(){return u.value&&(n=c(),u.value=!1),e(),n},set(h){l?.(h)}}));return Object.isExtensible(i)&&(i.trigger=a),i}function m(t){return typeof t=="function"?t():v(t)}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const p=()=>{};function y(t,r){function n(...e){return new Promise((o,u)=>{Promise.resolve(t(()=>r.apply(this,e),{fn:r,thisArg:this,args:e})).then(o).catch(u)})}return n}function T(t,r={}){let n,e,o=p;const u=c=>{clearTimeout(c),o(),o=p};return c=>{const l=m(t),i=m(r.maxWait);return n&&u(n),l<=0||i!==void 0&&i<=0?(e&&(u(e),e=null),Promise.resolve(c())):new Promise((s,f)=>{o=r.rejectOnCancel?f:s,i&&!e&&(e=setTimeout(()=>{n&&u(n),e=null,s(c())},i)),n=setTimeout(()=>{e&&u(e),e=null,s(c())},l)})}}function x(t,r=200,n={}){return y(T(r,n),t)}function P(t,r=200,n={}){const e=d(t.value),o=x(()=>{e.value=t.value},r,n);return b(t,()=>o()),e}export{w as c,P as r};
