@vueuse/shared
Advanced tools
Comparing version 8.6.0 to 8.7.0
@@ -580,18 +580,20 @@ import * as vue_demi from 'vue-demi'; | ||
} | ||
interface UntilBaseInstance<T> { | ||
toMatch(condition: (v: T) => boolean, options?: UntilToMatchOptions): Promise<void>; | ||
changed(options?: UntilToMatchOptions): Promise<void>; | ||
changedTimes(n?: number, options?: UntilToMatchOptions): Promise<void>; | ||
interface UntilBaseInstance<T, Not extends boolean = false> { | ||
toMatch<U extends T = T>(condition: (v: T) => v is U, options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, U>> : Promise<U>; | ||
toMatch(condition: (v: T) => boolean, options?: UntilToMatchOptions): Promise<T>; | ||
changed(options?: UntilToMatchOptions): Promise<T>; | ||
changedTimes(n?: number, options?: UntilToMatchOptions): Promise<T>; | ||
} | ||
interface UntilValueInstance<T> extends UntilBaseInstance<T> { | ||
readonly not: UntilValueInstance<T>; | ||
toBe<P = T>(value: MaybeRef<T | P>, options?: UntilToMatchOptions): Promise<void>; | ||
toBeTruthy(options?: UntilToMatchOptions): Promise<void>; | ||
toBeNull(options?: UntilToMatchOptions): Promise<void>; | ||
toBeUndefined(options?: UntilToMatchOptions): Promise<void>; | ||
toBeNaN(options?: UntilToMatchOptions): Promise<void>; | ||
declare type Falsy = false | void | null | undefined | 0 | 0n | ''; | ||
interface UntilValueInstance<T, Not extends boolean = false> extends UntilBaseInstance<T, Not> { | ||
readonly not: UntilValueInstance<T, Not extends true ? false : true>; | ||
toBe<P = T>(value: MaybeRef<P>, options?: UntilToMatchOptions): Not extends true ? Promise<T> : Promise<P>; | ||
toBeTruthy(options?: UntilToMatchOptions): Not extends true ? Promise<T & Falsy> : Promise<Exclude<T, Falsy>>; | ||
toBeNull(options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, null>> : Promise<null>; | ||
toBeUndefined(options?: UntilToMatchOptions): Not extends true ? Promise<Exclude<T, undefined>> : Promise<undefined>; | ||
toBeNaN(options?: UntilToMatchOptions): Promise<T>; | ||
} | ||
interface UntilArrayInstance<T> extends UntilBaseInstance<T> { | ||
readonly not: UntilArrayInstance<T>; | ||
toContains(value: MaybeRef<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions): Promise<void>; | ||
toContains(value: MaybeRef<ElementOf<ShallowUnwrapRef<T>>>, options?: UntilToMatchOptions): Promise<T>; | ||
} | ||
@@ -774,3 +776,3 @@ /** | ||
} | ||
declare function watchWithFilter<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle; | ||
declare function watchWithFilter<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle; | ||
declare function watchWithFilter<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle; | ||
@@ -786,4 +788,3 @@ declare function watchWithFilter<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchStopHandle; | ||
} | ||
declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn; | ||
declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn; | ||
declare function watchAtMost<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn; | ||
declare function watchAtMost<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options: WatchAtMostOptions<Immediate>): WatchAtMostReturn; | ||
@@ -794,3 +795,3 @@ | ||
} | ||
declare function watchDebounced<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle; | ||
declare function watchDebounced<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle; | ||
declare function watchDebounced<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle; | ||
@@ -805,8 +806,7 @@ declare function watchDebounced<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchDebouncedOptions<Immediate>): WatchStopHandle; | ||
} | ||
declare function watchIgnorable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn; | ||
declare function watchIgnorable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn; | ||
declare function watchIgnorable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn; | ||
declare function watchIgnorable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchIgnorableReturn; | ||
declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): void; | ||
declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): void; | ||
declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): void; | ||
declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): void; | ||
@@ -817,3 +817,3 @@ | ||
} | ||
declare function watchPausable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn; | ||
declare function watchPausable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn; | ||
declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn; | ||
@@ -827,3 +827,3 @@ declare function watchPausable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchWithFilterOptions<Immediate>): WatchPausableReturn; | ||
} | ||
declare function watchThrottled<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle; | ||
declare function watchThrottled<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle; | ||
declare function watchThrottled<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle; | ||
@@ -830,0 +830,0 @@ declare function watchThrottled<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchThrottledOptions<Immediate>): WatchStopHandle; |
@@ -798,5 +798,5 @@ ;var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) { | ||
stop = vueDemi.watch(r, (v) => { | ||
if (condition(v) === !isNot) { | ||
if (condition(v) !== isNot) { | ||
stop == null ? void 0 : stop(); | ||
resolve(); | ||
resolve(v); | ||
} | ||
@@ -810,5 +810,29 @@ }, { | ||
const promises = [watcher]; | ||
if (timeout) { | ||
promises.push(promiseTimeout(timeout, throwOnTimeout).finally(() => { | ||
if (timeout != null) { | ||
promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => vueDemi.unref(r)).finally(() => stop == null ? void 0 : stop())); | ||
} | ||
return Promise.race(promises); | ||
} | ||
function toBe(value, options) { | ||
if (!vueDemi.isRef(value)) | ||
return toMatch((v) => v === value, options); | ||
const { flush = "sync", deep = false, timeout, throwOnTimeout } = options != null ? options : {}; | ||
let stop = null; | ||
const watcher = new Promise((resolve) => { | ||
stop = vueDemi.watch([r, value], ([v1, v2]) => { | ||
if (isNot !== (v1 === v2)) { | ||
stop == null ? void 0 : stop(); | ||
resolve(v1); | ||
} | ||
}, { | ||
flush, | ||
deep, | ||
immediate: true | ||
}); | ||
}); | ||
const promises = [watcher]; | ||
if (timeout != null) { | ||
promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => vueDemi.unref(r)).finally(() => { | ||
stop == null ? void 0 : stop(); | ||
return vueDemi.unref(r); | ||
})); | ||
@@ -818,5 +842,2 @@ } | ||
} | ||
function toBe(value, options) { | ||
return toMatch((v) => v === vueDemi.unref(value), options); | ||
} | ||
function toBeTruthy(options) { | ||
@@ -980,3 +1001,3 @@ return toMatch((v) => Boolean(v), options); | ||
const stopWatch = vueDemi.watch(interval, () => { | ||
if (immediate && isClient) | ||
if (isActive.value && isClient) | ||
resume(); | ||
@@ -983,0 +1004,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
var VueDemi=function(o,a,m){if(o.install)return o;if(a)if(a.version.slice(0,4)==="2.7."){for(var P in a)o[P]=a[P];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=a,o.Vue2=a,o.version=a.version,o.set=function(y,h,w){return Array.isArray(y)?(y.length=Math.max(y.length,h),y.splice(h,1,w),w):(a.set(y,h,w),w)},o.del=function(y,h){if(Array.isArray(y)){y.splice(h,1);return}a.delete(y,h)}}else if(a.version.slice(0,2)==="2.")if(m){for(var P in m)o[P]=m[P];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=a,o.Vue2=a,o.version=a.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(a.version.slice(0,2)==="3."){for(var P in a)o[P]=a[P];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=a,o.Vue2=void 0,o.version=a.version,o.set=function(y,h,w){return Array.isArray(y)?(y.length=Math.max(y.length,h),y.splice(h,1,w),w):(y[h]=w,w)},o.del=function(y,h){if(Array.isArray(y)){y.splice(h,1);return}delete y[h]}}else console.error("[vue-demi] Vue version "+a.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return o}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(o,a){"use strict";var m=Object.defineProperty,P=Object.defineProperties,y=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,U=(t,e,n)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wt=(t,e)=>{for(var n in e||(e={}))w.call(e,n)&&U(t,n,e[n]);if(h)for(var n of h(e))Nt.call(e,n)&&U(t,n,e[n]);return t},Bt=(t,e)=>P(t,y(e));function H(t,e){var n;const r=a.shallowRef();return a.watchEffect(()=>{r.value=t()},Bt(Wt({},e),{flush:(n=e==null?void 0:e.flush)!=null?n:"sync"})),a.readonly(r)}function Y(t,e){let n,r,i;const l=a.ref(!0);return a.watch(t,()=>{l.value=!0,i()},{flush:"sync"}),a.customRef((c,u)=>(r=c,i=u,{get(){return l.value&&(n=e(),l.value=!1),r(),n},set(){}}))}function Ut(){const t=[],e=i=>{const l=t.indexOf(i);l!==-1&&t.splice(l,1)};return{on:i=>(t.push(i),{off:()=>e(i)}),off:e,trigger:i=>{t.forEach(l=>l(i))}}}function Ht(t){let e=!1,n;const r=a.effectScope(!0);return()=>(e||(n=r.run(t),e=!0),n)}function Yt(t){const e=Symbol("InjectionState");return[(...i)=>{a.provide(e,t(...i))},()=>a.inject(e)]}function b(t){return a.getCurrentScope()?(a.onScopeDispose(t),!0):!1}function Gt(t){let e=0,n,r;const i=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...l)=>(e+=1,n||(r=a.effectScope(!0),n=r.run(()=>t(...l))),b(i),n)}function G(t="this function"){if(!a.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}const zt={mounted:a.isVue3?"mounted":"inserted",updated:a.isVue3?"updated":"componentUpdated",unmounted:a.isVue3?"unmounted":"unbind"};function z(t,e,{enumerable:n=!1,unwrap:r=!0}={}){G();for(const[i,l]of Object.entries(e))i!=="value"&&(a.isRef(l)&&r?Object.defineProperty(t,i,{get(){return l.value},set(c){l.value=c},enumerable:n}):Object.defineProperty(t,i,{value:l,enumerable:n}));return t}function Lt(t,e){return e==null?a.unref(t):a.unref(t)[e]}function Xt(t){return a.unref(t)!=null}function L(...t){return a.computed(()=>t.every(e=>a.unref(e)))}function X(t){return a.computed(()=>!a.unref(t))}function Z(...t){return a.computed(()=>t.some(e=>a.unref(e)))}var Zt=Object.defineProperty,q=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,J=(t,e,n)=>e in t?Zt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qt=(t,e)=>{for(var n in e||(e={}))qt.call(e,n)&&J(t,n,e[n]);if(q)for(var n of q(e))Jt.call(e,n)&&J(t,n,e[n]);return t};function Kt(t,e){if(typeof Symbol!="undefined"){const n=Qt({},t);return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function R(t){return function(...e){return a.computed(()=>t.apply(this,e.map(n=>a.unref(n))))}}function kt(t,e={}){let n=[];if(Array.isArray(e))n=e;else{const{includeOwnProperties:r=!0}=e;n.push(...Object.keys(t)),r&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(r=>{const i=t[r];return[r,typeof i=="function"?R(i.bind(t)):i]}))}function Q(t){if(!a.isRef(t))return a.reactive(t);const e=new Proxy({},{get(n,r,i){return a.unref(Reflect.get(t.value,r,i))},set(n,r,i){return a.isRef(t.value[r])&&!a.isRef(i)?t.value[r].value=i:t.value[r]=i,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return a.reactive(e)}function K(t){return Q(a.computed(t))}function Vt(t,...e){return K(()=>Object.fromEntries(Object.entries(a.toRefs(t)).filter(n=>!e.includes(n[0]))))}function xt(t,...e){return a.reactive(Object.fromEntries(e.map(n=>[n,a.toRef(t,n)])))}function k(t,e=1e4){return a.customRef((n,r)=>{let i=t,l;const c=()=>setTimeout(()=>{i=t,r()},a.unref(e));return b(()=>{clearTimeout(l)}),{get(){return n(),i},set(u){i=u,r(),clearTimeout(l),l=c()}}})}var V;const $=typeof window!="undefined",Dt=t=>typeof t!="undefined",te=(t,...e)=>{t||console.warn(...e)},x=Object.prototype.toString,ee=t=>typeof t=="boolean",ne=t=>typeof t=="function",re=t=>typeof t=="number",oe=t=>typeof t=="string",ae=t=>x.call(t)==="[object Object]",ie=t=>typeof window!="undefined"&&x.call(t)==="[object Window]",le=()=>Date.now(),D=()=>+Date.now(),ce=(t,e,n)=>Math.min(n,Math.max(e,t)),tt=()=>{},ue=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),se=$&&((V=window==null?void 0:window.navigator)==null?void 0:V.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function S(t,e){function n(...r){t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})}return n}const I=t=>t();function M(t,e={}){let n,r;return l=>{const c=a.unref(t),u=a.unref(e.maxWait);if(n&&clearTimeout(n),c<=0||u!==void 0&&u<=0)return r&&(clearTimeout(r),r=null),l();u&&!r&&(r=setTimeout(()=>{n&&clearTimeout(n),r=null,l()},u)),n=setTimeout(()=>{r&&clearTimeout(r),r=null,l()},c)}}function N(t,e=!0,n=!0){let r=0,i,l=!0;const c=()=>{i&&(clearTimeout(i),i=void 0)};return d=>{const _=a.unref(t),p=Date.now()-r;if(c(),_<=0)return r=Date.now(),d();p>_&&(n||!l)?(r=Date.now(),d()):e&&(i=setTimeout(()=>{r=Date.now(),l=!0,c(),d()},_)),!n&&!i&&(i=setTimeout(()=>l=!0,_)),l=!1}}function et(t=I){const e=a.ref(!0);function n(){e.value=!1}function r(){e.value=!0}return{isActive:e,pause:n,resume:r,eventFilter:(...l)=>{e.value&&t(...l)}}}function nt(t,e=!1,n="Timeout"){return new Promise((r,i)=>{setTimeout(e?()=>i(n):r,t)})}function fe(t){return t}function de(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function pe(t){return t()}function _e(t,...e){return e.some(n=>n in t)}function ye(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:n[0])||"",i=t.slice(r.length),l=parseFloat(r)+e;return Number.isNaN(l)?t:l+i}function Oe(t,e,n=!1){return e.reduce((r,i)=>(i in t&&(!n||t[i]!==void 0)&&(r[i]=t[i]),r),{})}function rt(t,e=200,n={}){return S(M(e,n),t)}function W(t,e=200,n={}){if(e<=0)return t;const r=a.ref(t.value),i=rt(()=>{r.value=t.value},e,n);return a.watch(t,()=>i()),r}function he(t,e){return a.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function ot(t,e=200,n=!0,r=!0){return S(N(e,n,r),t)}function B(t,e=200,n=!0,r=!0){if(e<=0)return t;const i=a.ref(t.value),l=ot(()=>{i.value=t.value},e,n,r);return a.watch(t,()=>l()),i}function at(t,e={}){let n=t,r,i;const l=a.customRef((f,O)=>(r=f,i=O,{get(){return c()},set(v){u(v)}}));function c(f=!0){return f&&r(),n}function u(f,O=!0){var v,C;if(f===n)return;const g=n;((v=e.onBeforeChange)==null?void 0:v.call(e,f,g))!==!1&&(n=f,(C=e.onChanged)==null||C.call(e,f,g),O&&i())}return z(l,{get:c,set:u,untrackedGet:()=>c(!1),silentSet:f=>u(f,!1),peek:()=>c(!1),lay:f=>u(f,!1)},{enumerable:!0})}const ve=at;function we(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3)if(a.isVue2)a.set(...t);else{const[e,n,r]=t;e[n]=r}}function Pe(t,e,n={}){const{flush:r="sync",deep:i=!1,immediate:l=!0,direction:c="both"}=n;let u,d;return(c==="both"||c==="ltr")&&(u=a.watch(t,_=>e.value=_,{flush:r,deep:i,immediate:l})),(c==="both"||c==="rtl")&&(d=a.watch(e,_=>t.value=_,{flush:r,deep:i,immediate:l})),()=>{u==null||u(),d==null||d()}}function ge(t,e,n={}){const{flush:r="sync",deep:i=!1,immediate:l=!0}=n;return Array.isArray(e)||(e=[e]),a.watch(t,c=>e.forEach(u=>u.value=c),{flush:r,deep:i,immediate:l})}var be=Object.defineProperty,me=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,it=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,lt=(t,e,n)=>e in t?be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ie=(t,e)=>{for(var n in e||(e={}))Se.call(e,n)&<(t,n,e[n]);if(it)for(var n of it(e))je.call(e,n)&<(t,n,e[n]);return t},Te=(t,e)=>me(t,$e(e));function Ee(t){if(!a.isRef(t))return a.toRefs(t);const e=Array.isArray(t.value)?new Array(t.value.length):{};for(const n in t.value)e[n]=a.customRef(()=>({get(){return t.value[n]},set(r){if(Array.isArray(t.value)){const i=[...t.value];i[n]=r,t.value=i}else{const i=Te(Ie({},t.value),{[n]:r});Object.setPrototypeOf(i,t.value),t.value=i}}}));return e}function Ae(t,e=!0){a.getCurrentInstance()?a.onBeforeMount(t):e?t():a.nextTick(t)}function Fe(t){a.getCurrentInstance()&&a.onBeforeUnmount(t)}function Ce(t,e=!0){a.getCurrentInstance()?a.onMounted(t):e?t():a.nextTick(t)}function Re(t){a.getCurrentInstance()&&a.onUnmounted(t)}function Me(t){let e=!1;function n(s,{flush:f="sync",deep:O=!1,timeout:v,throwOnTimeout:C}={}){let g=null;const Mt=[new Promise(Fn=>{g=a.watch(t,Cn=>{s(Cn)===!e&&(g==null||g(),Fn())},{flush:f,deep:O,immediate:!0})})];return v&&Mt.push(nt(v,C).finally(()=>{g==null||g()})),Promise.race(Mt)}function r(s,f){return n(O=>O===a.unref(s),f)}function i(s){return n(f=>Boolean(f),s)}function l(s){return r(null,s)}function c(s){return r(void 0,s)}function u(s){return n(Number.isNaN,s)}function d(s,f){return n(O=>{const v=Array.from(O);return v.includes(s)||v.includes(a.unref(s))},f)}function _(s){return p(1,s)}function p(s=1,f){let O=-1;return n(()=>(O+=1,O>=s),f)}return Array.isArray(a.unref(t))?{toMatch:n,toContains:d,changed:_,changedTimes:p,get not(){return e=!e,this}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:l,toBeNaN:u,toBeUndefined:c,changed:_,changedTimes:p,get not(){return e=!e,this}}}function Ne(t=0,e={}){const n=a.ref(t),{max:r=1/0,min:i=-1/0}=e,l=(p=1)=>n.value=Math.min(r,n.value+p),c=(p=1)=>n.value=Math.max(i,n.value-p),u=()=>n.value,d=p=>n.value=p;return{count:n,inc:l,dec:c,get:u,set:d,reset:(p=t)=>(t=p,d(p))}}const We=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Be=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ct=(t,e)=>{const n=t.getFullYear(),r=t.getMonth(),i=t.getDate(),l=t.getHours(),c=t.getMinutes(),u=t.getSeconds(),d=t.getMilliseconds(),_=t.getDay(),p={YY:String(n).slice(-2),YYYY:n,M:r+1,MM:`${r+1}`.padStart(2,"0"),D:String(i),DD:`${i}`.padStart(2,"0"),H:String(l),HH:`${l}`.padStart(2,"0"),h:`${l%12||12}`.padStart(1,"0"),hh:`${l%12||12}`.padStart(2,"0"),m:String(c),mm:`${c}`.padStart(2,"0"),s:String(u),ss:`${u}`.padStart(2,"0"),SSS:`${d}`.padStart(3,"0"),d:_};return e.replace(Be,(s,f)=>f||p[s])},ut=t=>{if(t===null)return new Date(NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(We);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)};function Ue(t,e="HH:mm:ss"){return a.computed(()=>ct(ut(a.unref(t)),a.unref(e)))}function st(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n;let l=null;const c=a.ref(!1);function u(){l&&(clearInterval(l),l=null)}function d(){c.value=!1,u()}function _(){a.unref(e)<=0||(c.value=!0,i&&t(),u(),l=setInterval(t,a.unref(e)))}if(r&&$&&_(),a.isRef(e)){const p=a.watch(e,()=>{r&&$&&_()});b(p)}return b(d),{isActive:c,pause:d,resume:_}}var He=Object.defineProperty,ft=Object.getOwnPropertySymbols,Ye=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,dt=(t,e,n)=>e in t?He(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ze=(t,e)=>{for(var n in e||(e={}))Ye.call(e,n)&&dt(t,n,e[n]);if(ft)for(var n of ft(e))Ge.call(e,n)&&dt(t,n,e[n]);return t};function Le(t=1e3,e={}){const{controls:n=!1,immediate:r=!0}=e,i=a.ref(0),l=st(()=>i.value+=1,t,{immediate:r});return n?ze({counter:i},l):i}function Xe(t,e={}){var n;const r=a.ref((n=e.initialValue)!=null?n:null);return a.watch(t,()=>r.value=D(),e),r}function pt(t,e,n={}){const{immediate:r=!0}=n,i=a.ref(!1);let l=null;function c(){l&&(clearTimeout(l),l=null)}function u(){i.value=!1,c()}function d(..._){c(),i.value=!0,l=setTimeout(()=>{i.value=!1,l=null,t(..._)},a.unref(e))}return r&&(i.value=!0,$&&d()),b(u),{isPending:i,start:d,stop:u}}var Ze=Object.defineProperty,_t=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,yt=(t,e,n)=>e in t?Ze(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qe=(t,e)=>{for(var n in e||(e={}))qe.call(e,n)&&yt(t,n,e[n]);if(_t)for(var n of _t(e))Je.call(e,n)&&yt(t,n,e[n]);return t};function Ke(t=1e3,e={}){const{controls:n=!1}=e,r=pt(tt,t,e),i=a.computed(()=>!r.isPending.value);return n?Qe({ready:i},r):i}function ke(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,i=a.isRef(t),l=a.ref(t);function c(u){return arguments.length?(l.value=u,l.value):(l.value=l.value===a.unref(n)?a.unref(r):a.unref(n),l.value)}return i?c:[l,c]}var Ot=Object.getOwnPropertySymbols,Ve=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,De=(t,e)=>{var n={};for(var r in t)Ve.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ot)for(var r of Ot(t))e.indexOf(r)<0&&xe.call(t,r)&&(n[r]=t[r]);return n};function j(t,e,n={}){const r=n,{eventFilter:i=I}=r,l=De(r,["eventFilter"]);return a.watch(t,S(i,e),l)}var ht=Object.getOwnPropertySymbols,tn=Object.prototype.hasOwnProperty,en=Object.prototype.propertyIsEnumerable,nn=(t,e)=>{var n={};for(var r in t)tn.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&ht)for(var r of ht(t))e.indexOf(r)<0&&en.call(t,r)&&(n[r]=t[r]);return n};function rn(t,e,n){const r=n,{count:i}=r,l=nn(r,["count"]),c=a.ref(0),u=j(t,(...d)=>{c.value+=1,c.value>=a.unref(i)&&a.nextTick(()=>u()),e(...d)},l);return{count:c,stop:u}}var on=Object.defineProperty,an=Object.defineProperties,ln=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,vt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,Pt=(t,e,n)=>e in t?on(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,cn=(t,e)=>{for(var n in e||(e={}))vt.call(e,n)&&Pt(t,n,e[n]);if(T)for(var n of T(e))wt.call(e,n)&&Pt(t,n,e[n]);return t},un=(t,e)=>an(t,ln(e)),sn=(t,e)=>{var n={};for(var r in t)vt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&T)for(var r of T(t))e.indexOf(r)<0&&wt.call(t,r)&&(n[r]=t[r]);return n};function gt(t,e,n={}){const r=n,{debounce:i=0,maxWait:l=void 0}=r,c=sn(r,["debounce","maxWait"]);return j(t,e,un(cn({},c),{eventFilter:M(i,{maxWait:l})}))}var fn=Object.defineProperty,dn=Object.defineProperties,pn=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable,$t=(t,e,n)=>e in t?fn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_n=(t,e)=>{for(var n in e||(e={}))bt.call(e,n)&&$t(t,n,e[n]);if(E)for(var n of E(e))mt.call(e,n)&&$t(t,n,e[n]);return t},yn=(t,e)=>dn(t,pn(e)),On=(t,e)=>{var n={};for(var r in t)bt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&E)for(var r of E(t))e.indexOf(r)<0&&mt.call(t,r)&&(n[r]=t[r]);return n};function St(t,e,n={}){const r=n,{eventFilter:i=I}=r,l=On(r,["eventFilter"]),c=S(i,e);let u,d,_;if(l.flush==="sync"){const p=a.ref(!1);d=()=>{},u=s=>{p.value=!0,s(),p.value=!1},_=a.watch(t,(...s)=>{p.value||c(...s)},l)}else{const p=[],s=a.ref(0),f=a.ref(0);d=()=>{s.value=f.value},p.push(a.watch(t,()=>{f.value++},yn(_n({},l),{flush:"sync"}))),u=O=>{const v=f.value;O(),s.value+=f.value-v},p.push(a.watch(t,(...O)=>{const v=s.value>0&&s.value===f.value;s.value=0,f.value=0,!v&&c(...O)},l)),_=()=>{p.forEach(O=>O())}}return{stop:_,ignoreUpdates:u,ignorePrevAsyncUpdates:d}}function hn(t,e,n){const r=a.watch(t,(...i)=>(a.nextTick(()=>r()),e(...i)),n)}var vn=Object.defineProperty,wn=Object.defineProperties,Pn=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,jt=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable,Tt=(t,e,n)=>e in t?vn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gn=(t,e)=>{for(var n in e||(e={}))jt.call(e,n)&&Tt(t,n,e[n]);if(A)for(var n of A(e))It.call(e,n)&&Tt(t,n,e[n]);return t},bn=(t,e)=>wn(t,Pn(e)),mn=(t,e)=>{var n={};for(var r in t)jt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&A)for(var r of A(t))e.indexOf(r)<0&&It.call(t,r)&&(n[r]=t[r]);return n};function Et(t,e,n={}){const r=n,{eventFilter:i}=r,l=mn(r,["eventFilter"]),{eventFilter:c,pause:u,resume:d,isActive:_}=et(i);return{stop:j(t,e,bn(gn({},l),{eventFilter:c})),pause:u,resume:d,isActive:_}}var $n=Object.defineProperty,Sn=Object.defineProperties,jn=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Ct=(t,e,n)=>e in t?$n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,In=(t,e)=>{for(var n in e||(e={}))At.call(e,n)&&Ct(t,n,e[n]);if(F)for(var n of F(e))Ft.call(e,n)&&Ct(t,n,e[n]);return t},Tn=(t,e)=>Sn(t,jn(e)),En=(t,e)=>{var n={};for(var r in t)At.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&F)for(var r of F(t))e.indexOf(r)<0&&Ft.call(t,r)&&(n[r]=t[r]);return n};function Rt(t,e,n={}){const r=n,{throttle:i=0,trailing:l=!0,leading:c=!0}=r,u=En(r,["throttle","trailing","leading"]);return j(t,e,Tn(In({},u),{eventFilter:N(i,l,c)}))}function An(t,e,n){return a.watch(t,(r,i,l)=>{r&&e(r,i,l)},n)}o.__onlyVue3=G,o.and=L,o.assert=te,o.autoResetRef=k,o.bypassFilter=I,o.clamp=ce,o.computedEager=H,o.computedWithControl=Y,o.containsProp=_e,o.controlledComputed=Y,o.controlledRef=ve,o.createEventHook=Ut,o.createFilterWrapper=S,o.createGlobalState=Ht,o.createInjectionState=Yt,o.createReactiveFn=R,o.createSharedComposable=Gt,o.createSingletonPromise=de,o.debounceFilter=M,o.debouncedRef=W,o.debouncedWatch=gt,o.directiveHooks=zt,o.eagerComputed=H,o.extendRef=z,o.formatDate=ct,o.get=Lt,o.identity=fe,o.ignorableWatch=St,o.increaseWithUnit=ye,o.invoke=pe,o.isBoolean=ee,o.isClient=$,o.isDef=Dt,o.isDefined=Xt,o.isFunction=ne,o.isIOS=se,o.isNumber=re,o.isObject=ae,o.isString=oe,o.isWindow=ie,o.logicAnd=L,o.logicNot=X,o.logicOr=Z,o.makeDestructurable=Kt,o.noop=tt,o.normalizeDate=ut,o.not=X,o.now=le,o.objectPick=Oe,o.or=Z,o.pausableFilter=et,o.pausableWatch=Et,o.promiseTimeout=nt,o.rand=ue,o.reactify=R,o.reactifyObject=kt,o.reactiveComputed=K,o.reactiveOmit=Vt,o.reactivePick=xt,o.refAutoReset=k,o.refDebounced=W,o.refDefault=he,o.refThrottled=B,o.refWithControl=at,o.set=we,o.syncRef=Pe,o.syncRefs=ge,o.throttleFilter=N,o.throttledRef=B,o.throttledWatch=Rt,o.timestamp=D,o.toReactive=Q,o.toRefs=Ee,o.tryOnBeforeMount=Ae,o.tryOnBeforeUnmount=Fe,o.tryOnMounted=Ce,o.tryOnScopeDispose=b,o.tryOnUnmounted=Re,o.until=Me,o.useCounter=Ne,o.useDateFormat=Ue,o.useDebounce=W,o.useDebounceFn=rt,o.useInterval=Le,o.useIntervalFn=st,o.useLastChanged=Xe,o.useThrottle=B,o.useThrottleFn=ot,o.useTimeout=Ke,o.useTimeoutFn=pt,o.useToggle=ke,o.watchAtMost=rn,o.watchDebounced=gt,o.watchIgnorable=St,o.watchOnce=hn,o.watchPausable=Et,o.watchThrottled=Rt,o.watchWithFilter=j,o.whenever=An,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi); | ||
var VueDemi=function(o,a,j){if(o.install)return o;if(a)if(a.version.slice(0,4)==="2.7."){for(var P in a)o[P]=a[P];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=a,o.Vue2=a,o.version=a.version,o.set=function(y,O,w){return Array.isArray(y)?(y.length=Math.max(y.length,O),y.splice(O,1,w),w):(a.set(y,O,w),w)},o.del=function(y,O){if(Array.isArray(y)){y.splice(O,1);return}a.delete(y,O)}}else if(a.version.slice(0,2)==="2.")if(j){for(var P in j)o[P]=j[P];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=a,o.Vue2=a,o.version=a.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(a.version.slice(0,2)==="3."){for(var P in a)o[P]=a[P];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=a,o.Vue2=void 0,o.version=a.version,o.set=function(y,O,w){return Array.isArray(y)?(y.length=Math.max(y.length,O),y.splice(O,1,w),w):(y[O]=w,w)},o.del=function(y,O){if(Array.isArray(y)){y.splice(O,1);return}delete y[O]}}else console.error("[vue-demi] Vue version "+a.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return o}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(o,a){"use strict";var j=Object.defineProperty,P=Object.defineProperties,y=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,Ht=Object.prototype.propertyIsEnumerable,L=(t,e,n)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Yt=(t,e)=>{for(var n in e||(e={}))w.call(e,n)&&L(t,n,e[n]);if(O)for(var n of O(e))Ht.call(e,n)&&L(t,n,e[n]);return t},Gt=(t,e)=>P(t,y(e));function X(t,e){var n;const r=a.shallowRef();return a.watchEffect(()=>{r.value=t()},Gt(Yt({},e),{flush:(n=e==null?void 0:e.flush)!=null?n:"sync"})),a.readonly(r)}function Z(t,e){let n,r,i;const l=a.ref(!0);return a.watch(t,()=>{l.value=!0,i()},{flush:"sync"}),a.customRef((c,u)=>(r=c,i=u,{get(){return l.value&&(n=e(),l.value=!1),r(),n},set(){}}))}function zt(){const t=[],e=i=>{const l=t.indexOf(i);l!==-1&&t.splice(l,1)};return{on:i=>(t.push(i),{off:()=>e(i)}),off:e,trigger:i=>{t.forEach(l=>l(i))}}}function Lt(t){let e=!1,n;const r=a.effectScope(!0);return()=>(e||(n=r.run(t),e=!0),n)}function Xt(t){const e=Symbol("InjectionState");return[(...i)=>{a.provide(e,t(...i))},()=>a.inject(e)]}function m(t){return a.getCurrentScope()?(a.onScopeDispose(t),!0):!1}function Zt(t){let e=0,n,r;const i=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...l)=>(e+=1,n||(r=a.effectScope(!0),n=r.run(()=>t(...l))),m(i),n)}function q(t="this function"){if(!a.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}const qt={mounted:a.isVue3?"mounted":"inserted",updated:a.isVue3?"updated":"componentUpdated",unmounted:a.isVue3?"unmounted":"unbind"};function J(t,e,{enumerable:n=!1,unwrap:r=!0}={}){q();for(const[i,l]of Object.entries(e))i!=="value"&&(a.isRef(l)&&r?Object.defineProperty(t,i,{get(){return l.value},set(c){l.value=c},enumerable:n}):Object.defineProperty(t,i,{value:l,enumerable:n}));return t}function Jt(t,e){return e==null?a.unref(t):a.unref(t)[e]}function Qt(t){return a.unref(t)!=null}function Q(...t){return a.computed(()=>t.every(e=>a.unref(e)))}function K(t){return a.computed(()=>!a.unref(t))}function k(...t){return a.computed(()=>t.some(e=>a.unref(e)))}var Kt=Object.defineProperty,V=Object.getOwnPropertySymbols,kt=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable,x=(t,e,n)=>e in t?Kt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xt=(t,e)=>{for(var n in e||(e={}))kt.call(e,n)&&x(t,n,e[n]);if(V)for(var n of V(e))Vt.call(e,n)&&x(t,n,e[n]);return t};function Dt(t,e){if(typeof Symbol!="undefined"){const n=xt({},t);return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function W(t){return function(...e){return a.computed(()=>t.apply(this,e.map(n=>a.unref(n))))}}function te(t,e={}){let n=[];if(Array.isArray(e))n=e;else{const{includeOwnProperties:r=!0}=e;n.push(...Object.keys(t)),r&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(r=>{const i=t[r];return[r,typeof i=="function"?W(i.bind(t)):i]}))}function D(t){if(!a.isRef(t))return a.reactive(t);const e=new Proxy({},{get(n,r,i){return a.unref(Reflect.get(t.value,r,i))},set(n,r,i){return a.isRef(t.value[r])&&!a.isRef(i)?t.value[r].value=i:t.value[r]=i,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return a.reactive(e)}function tt(t){return D(a.computed(t))}function ee(t,...e){return tt(()=>Object.fromEntries(Object.entries(a.toRefs(t)).filter(n=>!e.includes(n[0]))))}function ne(t,...e){return a.reactive(Object.fromEntries(e.map(n=>[n,a.toRef(t,n)])))}function et(t,e=1e4){return a.customRef((n,r)=>{let i=t,l;const c=()=>setTimeout(()=>{i=t,r()},a.unref(e));return m(()=>{clearTimeout(l)}),{get(){return n(),i},set(u){i=u,r(),clearTimeout(l),l=c()}}})}var nt;const I=typeof window!="undefined",re=t=>typeof t!="undefined",oe=(t,...e)=>{t||console.warn(...e)},rt=Object.prototype.toString,ae=t=>typeof t=="boolean",ie=t=>typeof t=="function",le=t=>typeof t=="number",ce=t=>typeof t=="string",ue=t=>rt.call(t)==="[object Object]",se=t=>typeof window!="undefined"&&rt.call(t)==="[object Window]",fe=()=>Date.now(),ot=()=>+Date.now(),de=(t,e,n)=>Math.min(n,Math.max(e,t)),at=()=>{},pe=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),_e=I&&((nt=window==null?void 0:window.navigator)==null?void 0:nt.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function T(t,e){function n(...r){t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})}return n}const A=t=>t();function B(t,e={}){let n,r;return l=>{const c=a.unref(t),u=a.unref(e.maxWait);if(n&&clearTimeout(n),c<=0||u!==void 0&&u<=0)return r&&(clearTimeout(r),r=null),l();u&&!r&&(r=setTimeout(()=>{n&&clearTimeout(n),r=null,l()},u)),n=setTimeout(()=>{r&&clearTimeout(r),r=null,l()},c)}}function U(t,e=!0,n=!0){let r=0,i,l=!0;const c=()=>{i&&(clearTimeout(i),i=void 0)};return d=>{const _=a.unref(t),p=Date.now()-r;if(c(),_<=0)return r=Date.now(),d();p>_&&(n||!l)?(r=Date.now(),d()):e&&(i=setTimeout(()=>{r=Date.now(),l=!0,c(),d()},_)),!n&&!i&&(i=setTimeout(()=>l=!0,_)),l=!1}}function it(t=A){const e=a.ref(!0);function n(){e.value=!1}function r(){e.value=!0}return{isActive:e,pause:n,resume:r,eventFilter:(...l)=>{e.value&&t(...l)}}}function H(t,e=!1,n="Timeout"){return new Promise((r,i)=>{setTimeout(e?()=>i(n):r,t)})}function ye(t){return t}function he(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function Oe(t){return t()}function ve(t,...e){return e.some(n=>n in t)}function we(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:n[0])||"",i=t.slice(r.length),l=parseFloat(r)+e;return Number.isNaN(l)?t:l+i}function Pe(t,e,n=!1){return e.reduce((r,i)=>(i in t&&(!n||t[i]!==void 0)&&(r[i]=t[i]),r),{})}function lt(t,e=200,n={}){return T(B(e,n),t)}function Y(t,e=200,n={}){if(e<=0)return t;const r=a.ref(t.value),i=lt(()=>{r.value=t.value},e,n);return a.watch(t,()=>i()),r}function ge(t,e){return a.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function ct(t,e=200,n=!0,r=!0){return T(U(e,n,r),t)}function G(t,e=200,n=!0,r=!0){if(e<=0)return t;const i=a.ref(t.value),l=ct(()=>{i.value=t.value},e,n,r);return a.watch(t,()=>l()),i}function ut(t,e={}){let n=t,r,i;const l=a.customRef((f,h)=>(r=f,i=h,{get(){return c()},set(v){u(v)}}));function c(f=!0){return f&&r(),n}function u(f,h=!0){var v,b;if(f===n)return;const g=n;((v=e.onBeforeChange)==null?void 0:v.call(e,f,g))!==!1&&(n=f,(b=e.onChanged)==null||b.call(e,f,g),h&&i())}return J(l,{get:c,set:u,untrackedGet:()=>c(!1),silentSet:f=>u(f,!1),peek:()=>c(!1),lay:f=>u(f,!1)},{enumerable:!0})}const be=ut;function me(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3)if(a.isVue2)a.set(...t);else{const[e,n,r]=t;e[n]=r}}function $e(t,e,n={}){const{flush:r="sync",deep:i=!1,immediate:l=!0,direction:c="both"}=n;let u,d;return(c==="both"||c==="ltr")&&(u=a.watch(t,_=>e.value=_,{flush:r,deep:i,immediate:l})),(c==="both"||c==="rtl")&&(d=a.watch(e,_=>t.value=_,{flush:r,deep:i,immediate:l})),()=>{u==null||u(),d==null||d()}}function Se(t,e,n={}){const{flush:r="sync",deep:i=!1,immediate:l=!0}=n;return Array.isArray(e)||(e=[e]),a.watch(t,c=>e.forEach(u=>u.value=c),{flush:r,deep:i,immediate:l})}var je=Object.defineProperty,Ie=Object.defineProperties,Te=Object.getOwnPropertyDescriptors,st=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ft=(t,e,n)=>e in t?je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fe=(t,e)=>{for(var n in e||(e={}))Ee.call(e,n)&&ft(t,n,e[n]);if(st)for(var n of st(e))Ae.call(e,n)&&ft(t,n,e[n]);return t},Ce=(t,e)=>Ie(t,Te(e));function Re(t){if(!a.isRef(t))return a.toRefs(t);const e=Array.isArray(t.value)?new Array(t.value.length):{};for(const n in t.value)e[n]=a.customRef(()=>({get(){return t.value[n]},set(r){if(Array.isArray(t.value)){const i=[...t.value];i[n]=r,t.value=i}else{const i=Ce(Fe({},t.value),{[n]:r});Object.setPrototypeOf(i,t.value),t.value=i}}}));return e}function Me(t,e=!0){a.getCurrentInstance()?a.onBeforeMount(t):e?t():a.nextTick(t)}function Ne(t){a.getCurrentInstance()&&a.onBeforeUnmount(t)}function We(t,e=!0){a.getCurrentInstance()?a.onMounted(t):e?t():a.nextTick(t)}function Be(t){a.getCurrentInstance()&&a.onUnmounted(t)}function Ue(t){let e=!1;function n(s,{flush:f="sync",deep:h=!1,timeout:v,throwOnTimeout:b}={}){let g=null;const z=[new Promise(N=>{g=a.watch(t,S=>{s(S)!==e&&(g==null||g(),N(S))},{flush:f,deep:h,immediate:!0})})];return v!=null&&z.push(H(v,b).then(()=>a.unref(t)).finally(()=>g==null?void 0:g())),Promise.race(z)}function r(s,f){if(!a.isRef(s))return n(S=>S===s,f);const{flush:h="sync",deep:v=!1,timeout:b,throwOnTimeout:g}=f??{};let $=null;const N=[new Promise(S=>{$=a.watch([t,s],([Ut,Nn])=>{e!==(Ut===Nn)&&($==null||$(),S(Ut))},{flush:h,deep:v,immediate:!0})})];return b!=null&&N.push(H(b,g).then(()=>a.unref(t)).finally(()=>($==null||$(),a.unref(t)))),Promise.race(N)}function i(s){return n(f=>Boolean(f),s)}function l(s){return r(null,s)}function c(s){return r(void 0,s)}function u(s){return n(Number.isNaN,s)}function d(s,f){return n(h=>{const v=Array.from(h);return v.includes(s)||v.includes(a.unref(s))},f)}function _(s){return p(1,s)}function p(s=1,f){let h=-1;return n(()=>(h+=1,h>=s),f)}return Array.isArray(a.unref(t))?{toMatch:n,toContains:d,changed:_,changedTimes:p,get not(){return e=!e,this}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:l,toBeNaN:u,toBeUndefined:c,changed:_,changedTimes:p,get not(){return e=!e,this}}}function He(t=0,e={}){const n=a.ref(t),{max:r=1/0,min:i=-1/0}=e,l=(p=1)=>n.value=Math.min(r,n.value+p),c=(p=1)=>n.value=Math.max(i,n.value-p),u=()=>n.value,d=p=>n.value=p;return{count:n,inc:l,dec:c,get:u,set:d,reset:(p=t)=>(t=p,d(p))}}const Ye=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Ge=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,dt=(t,e)=>{const n=t.getFullYear(),r=t.getMonth(),i=t.getDate(),l=t.getHours(),c=t.getMinutes(),u=t.getSeconds(),d=t.getMilliseconds(),_=t.getDay(),p={YY:String(n).slice(-2),YYYY:n,M:r+1,MM:`${r+1}`.padStart(2,"0"),D:String(i),DD:`${i}`.padStart(2,"0"),H:String(l),HH:`${l}`.padStart(2,"0"),h:`${l%12||12}`.padStart(1,"0"),hh:`${l%12||12}`.padStart(2,"0"),m:String(c),mm:`${c}`.padStart(2,"0"),s:String(u),ss:`${u}`.padStart(2,"0"),SSS:`${d}`.padStart(3,"0"),d:_};return e.replace(Ge,(s,f)=>f||p[s])},pt=t=>{if(t===null)return new Date(NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(Ye);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)};function ze(t,e="HH:mm:ss"){return a.computed(()=>dt(pt(a.unref(t)),a.unref(e)))}function _t(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n;let l=null;const c=a.ref(!1);function u(){l&&(clearInterval(l),l=null)}function d(){c.value=!1,u()}function _(){a.unref(e)<=0||(c.value=!0,i&&t(),u(),l=setInterval(t,a.unref(e)))}if(r&&I&&_(),a.isRef(e)){const p=a.watch(e,()=>{c.value&&I&&_()});m(p)}return m(d),{isActive:c,pause:d,resume:_}}var Le=Object.defineProperty,yt=Object.getOwnPropertySymbols,Xe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,ht=(t,e,n)=>e in t?Le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qe=(t,e)=>{for(var n in e||(e={}))Xe.call(e,n)&&ht(t,n,e[n]);if(yt)for(var n of yt(e))Ze.call(e,n)&&ht(t,n,e[n]);return t};function Je(t=1e3,e={}){const{controls:n=!1,immediate:r=!0}=e,i=a.ref(0),l=_t(()=>i.value+=1,t,{immediate:r});return n?qe({counter:i},l):i}function Qe(t,e={}){var n;const r=a.ref((n=e.initialValue)!=null?n:null);return a.watch(t,()=>r.value=ot(),e),r}function Ot(t,e,n={}){const{immediate:r=!0}=n,i=a.ref(!1);let l=null;function c(){l&&(clearTimeout(l),l=null)}function u(){i.value=!1,c()}function d(..._){c(),i.value=!0,l=setTimeout(()=>{i.value=!1,l=null,t(..._)},a.unref(e))}return r&&(i.value=!0,I&&d()),m(u),{isPending:i,start:d,stop:u}}var Ke=Object.defineProperty,vt=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,wt=(t,e,n)=>e in t?Ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xe=(t,e)=>{for(var n in e||(e={}))ke.call(e,n)&&wt(t,n,e[n]);if(vt)for(var n of vt(e))Ve.call(e,n)&&wt(t,n,e[n]);return t};function De(t=1e3,e={}){const{controls:n=!1}=e,r=Ot(at,t,e),i=a.computed(()=>!r.isPending.value);return n?xe({ready:i},r):i}function tn(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,i=a.isRef(t),l=a.ref(t);function c(u){return arguments.length?(l.value=u,l.value):(l.value=l.value===a.unref(n)?a.unref(r):a.unref(n),l.value)}return i?c:[l,c]}var Pt=Object.getOwnPropertySymbols,en=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable,rn=(t,e)=>{var n={};for(var r in t)en.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Pt)for(var r of Pt(t))e.indexOf(r)<0&&nn.call(t,r)&&(n[r]=t[r]);return n};function E(t,e,n={}){const r=n,{eventFilter:i=A}=r,l=rn(r,["eventFilter"]);return a.watch(t,T(i,e),l)}var gt=Object.getOwnPropertySymbols,on=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable,ln=(t,e)=>{var n={};for(var r in t)on.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&>)for(var r of gt(t))e.indexOf(r)<0&&an.call(t,r)&&(n[r]=t[r]);return n};function cn(t,e,n){const r=n,{count:i}=r,l=ln(r,["count"]),c=a.ref(0),u=E(t,(...d)=>{c.value+=1,c.value>=a.unref(i)&&a.nextTick(()=>u()),e(...d)},l);return{count:c,stop:u}}var un=Object.defineProperty,sn=Object.defineProperties,fn=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable,$t=(t,e,n)=>e in t?un(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,dn=(t,e)=>{for(var n in e||(e={}))bt.call(e,n)&&$t(t,n,e[n]);if(F)for(var n of F(e))mt.call(e,n)&&$t(t,n,e[n]);return t},pn=(t,e)=>sn(t,fn(e)),_n=(t,e)=>{var n={};for(var r in t)bt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&F)for(var r of F(t))e.indexOf(r)<0&&mt.call(t,r)&&(n[r]=t[r]);return n};function St(t,e,n={}){const r=n,{debounce:i=0,maxWait:l=void 0}=r,c=_n(r,["debounce","maxWait"]);return E(t,e,pn(dn({},c),{eventFilter:B(i,{maxWait:l})}))}var yn=Object.defineProperty,hn=Object.defineProperties,On=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,jt=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable,Tt=(t,e,n)=>e in t?yn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vn=(t,e)=>{for(var n in e||(e={}))jt.call(e,n)&&Tt(t,n,e[n]);if(C)for(var n of C(e))It.call(e,n)&&Tt(t,n,e[n]);return t},wn=(t,e)=>hn(t,On(e)),Pn=(t,e)=>{var n={};for(var r in t)jt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&C)for(var r of C(t))e.indexOf(r)<0&&It.call(t,r)&&(n[r]=t[r]);return n};function Et(t,e,n={}){const r=n,{eventFilter:i=A}=r,l=Pn(r,["eventFilter"]),c=T(i,e);let u,d,_;if(l.flush==="sync"){const p=a.ref(!1);d=()=>{},u=s=>{p.value=!0,s(),p.value=!1},_=a.watch(t,(...s)=>{p.value||c(...s)},l)}else{const p=[],s=a.ref(0),f=a.ref(0);d=()=>{s.value=f.value},p.push(a.watch(t,()=>{f.value++},wn(vn({},l),{flush:"sync"}))),u=h=>{const v=f.value;h(),s.value+=f.value-v},p.push(a.watch(t,(...h)=>{const v=s.value>0&&s.value===f.value;s.value=0,f.value=0,!v&&c(...h)},l)),_=()=>{p.forEach(h=>h())}}return{stop:_,ignoreUpdates:u,ignorePrevAsyncUpdates:d}}function gn(t,e,n){const r=a.watch(t,(...i)=>(a.nextTick(()=>r()),e(...i)),n)}var bn=Object.defineProperty,mn=Object.defineProperties,$n=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Ct=(t,e,n)=>e in t?bn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Sn=(t,e)=>{for(var n in e||(e={}))At.call(e,n)&&Ct(t,n,e[n]);if(R)for(var n of R(e))Ft.call(e,n)&&Ct(t,n,e[n]);return t},jn=(t,e)=>mn(t,$n(e)),In=(t,e)=>{var n={};for(var r in t)At.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&R)for(var r of R(t))e.indexOf(r)<0&&Ft.call(t,r)&&(n[r]=t[r]);return n};function Rt(t,e,n={}){const r=n,{eventFilter:i}=r,l=In(r,["eventFilter"]),{eventFilter:c,pause:u,resume:d,isActive:_}=it(i);return{stop:E(t,e,jn(Sn({},l),{eventFilter:c})),pause:u,resume:d,isActive:_}}var Tn=Object.defineProperty,En=Object.defineProperties,An=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,Wt=(t,e,n)=>e in t?Tn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fn=(t,e)=>{for(var n in e||(e={}))Mt.call(e,n)&&Wt(t,n,e[n]);if(M)for(var n of M(e))Nt.call(e,n)&&Wt(t,n,e[n]);return t},Cn=(t,e)=>En(t,An(e)),Rn=(t,e)=>{var n={};for(var r in t)Mt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&M)for(var r of M(t))e.indexOf(r)<0&&Nt.call(t,r)&&(n[r]=t[r]);return n};function Bt(t,e,n={}){const r=n,{throttle:i=0,trailing:l=!0,leading:c=!0}=r,u=Rn(r,["throttle","trailing","leading"]);return E(t,e,Cn(Fn({},u),{eventFilter:U(i,l,c)}))}function Mn(t,e,n){return a.watch(t,(r,i,l)=>{r&&e(r,i,l)},n)}o.__onlyVue3=q,o.and=Q,o.assert=oe,o.autoResetRef=et,o.bypassFilter=A,o.clamp=de,o.computedEager=X,o.computedWithControl=Z,o.containsProp=ve,o.controlledComputed=Z,o.controlledRef=be,o.createEventHook=zt,o.createFilterWrapper=T,o.createGlobalState=Lt,o.createInjectionState=Xt,o.createReactiveFn=W,o.createSharedComposable=Zt,o.createSingletonPromise=he,o.debounceFilter=B,o.debouncedRef=Y,o.debouncedWatch=St,o.directiveHooks=qt,o.eagerComputed=X,o.extendRef=J,o.formatDate=dt,o.get=Jt,o.identity=ye,o.ignorableWatch=Et,o.increaseWithUnit=we,o.invoke=Oe,o.isBoolean=ae,o.isClient=I,o.isDef=re,o.isDefined=Qt,o.isFunction=ie,o.isIOS=_e,o.isNumber=le,o.isObject=ue,o.isString=ce,o.isWindow=se,o.logicAnd=Q,o.logicNot=K,o.logicOr=k,o.makeDestructurable=Dt,o.noop=at,o.normalizeDate=pt,o.not=K,o.now=fe,o.objectPick=Pe,o.or=k,o.pausableFilter=it,o.pausableWatch=Rt,o.promiseTimeout=H,o.rand=pe,o.reactify=W,o.reactifyObject=te,o.reactiveComputed=tt,o.reactiveOmit=ee,o.reactivePick=ne,o.refAutoReset=et,o.refDebounced=Y,o.refDefault=ge,o.refThrottled=G,o.refWithControl=ut,o.set=me,o.syncRef=$e,o.syncRefs=Se,o.throttleFilter=U,o.throttledRef=G,o.throttledWatch=Bt,o.timestamp=ot,o.toReactive=D,o.toRefs=Re,o.tryOnBeforeMount=Me,o.tryOnBeforeUnmount=Ne,o.tryOnMounted=We,o.tryOnScopeDispose=m,o.tryOnUnmounted=Be,o.until=Ue,o.useCounter=He,o.useDateFormat=ze,o.useDebounce=Y,o.useDebounceFn=lt,o.useInterval=Je,o.useIntervalFn=_t,o.useLastChanged=Qe,o.useThrottle=G,o.useThrottleFn=ct,o.useTimeout=De,o.useTimeoutFn=Ot,o.useToggle=tn,o.watchAtMost=cn,o.watchDebounced=St,o.watchIgnorable=Et,o.watchOnce=gn,o.watchPausable=Rt,o.watchThrottled=Bt,o.watchWithFilter=E,o.whenever=Mn,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi); |
{ | ||
"name": "@vueuse/shared", | ||
"version": "8.6.0", | ||
"version": "8.7.0", | ||
"author": "Anthony Fu <https://github.com/antfu>", | ||
@@ -25,4 +25,4 @@ "license": "MIT", | ||
"types": "./index.d.ts", | ||
"import": "./index.mjs", | ||
"require": "./index.cjs" | ||
"require": "./index.cjs", | ||
"import": "./index.mjs" | ||
}, | ||
@@ -29,0 +29,0 @@ "./*": "./*" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
183627
5000