@vueuse/shared 12.4.0 → 12.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +57 -40
- package/index.d.cts +26 -11
- package/index.d.mts +26 -11
- package/index.d.ts +26 -11
- package/index.iife.js +57 -40
- package/index.iife.min.js +1 -1
- package/index.mjs +57 -40
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { WatchOptionsBase, Ref,
|
|
2
|
+
import { WatchOptionsBase, Ref, WatchSource, ComputedGetter, ComputedRef, WritableComputedOptions, WritableComputedRef, WatchOptions, MaybeRef, MaybeRefOrGetter, InjectionKey, ShallowUnwrapRef as ShallowUnwrapRef$1, inject, provide, UnwrapNestedRefs, UnwrapRef, ToRef, ToRefs, toValue as toValue$1, WatchCallback, WatchStopHandle } from 'vue';
|
|
3
3
|
export { MaybeRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -142,12 +142,12 @@ type IsAny<T> = IfAny<T, true, false>;
|
|
|
142
142
|
|
|
143
143
|
type Callback<T> = IsAny<T> extends true ? (...param: any) => void : ([
|
|
144
144
|
T
|
|
145
|
-
] extends [void] ? (...param: unknown[]) => void : (...param: [T, ...unknown[]]) => void);
|
|
145
|
+
] extends [void] ? (...param: unknown[]) => void : [T] extends [any[]] ? (...param: T) => void : (...param: [T, ...unknown[]]) => void);
|
|
146
146
|
type EventHookOn<T = any> = (fn: Callback<T>) => {
|
|
147
147
|
off: () => void;
|
|
148
148
|
};
|
|
149
149
|
type EventHookOff<T = any> = (fn: Callback<T>) => void;
|
|
150
|
-
type EventHookTrigger<T = any> = (...param:
|
|
150
|
+
type EventHookTrigger<T = any> = (...param: Parameters<Callback<T>>) => Promise<unknown[]>;
|
|
151
151
|
interface EventHook<T = any> {
|
|
152
152
|
on: EventHookOn<T>;
|
|
153
153
|
off: EventHookOff<T>;
|
|
@@ -226,13 +226,21 @@ interface ThrottleFilterOptions {
|
|
|
226
226
|
*/
|
|
227
227
|
declare function throttleFilter(ms: MaybeRefOrGetter<number>, trailing?: boolean, leading?: boolean, rejectOnCancel?: boolean): EventFilter;
|
|
228
228
|
declare function throttleFilter(options: ThrottleFilterOptions): EventFilter;
|
|
229
|
+
interface PausableFilterOptions {
|
|
230
|
+
/**
|
|
231
|
+
* The initial state
|
|
232
|
+
*
|
|
233
|
+
* @default 'active'
|
|
234
|
+
*/
|
|
235
|
+
initialState?: 'active' | 'paused';
|
|
236
|
+
}
|
|
229
237
|
/**
|
|
230
238
|
* EventFilter that gives extra controls to pause and resume the filter
|
|
231
239
|
*
|
|
232
240
|
* @param extendFilter Extra filter to apply when the PausableFilter is active, default to none
|
|
233
|
-
*
|
|
241
|
+
* @param options Options to configure the filter
|
|
234
242
|
*/
|
|
235
|
-
declare function pausableFilter(extendFilter?: EventFilter): Pausable & {
|
|
243
|
+
declare function pausableFilter(extendFilter?: EventFilter, options?: PausableFilterOptions): Pausable & {
|
|
236
244
|
eventFilter: EventFilter;
|
|
237
245
|
};
|
|
238
246
|
|
|
@@ -433,7 +441,7 @@ declare function reactifyObject<T extends object, S extends boolean = true>(obj:
|
|
|
433
441
|
/**
|
|
434
442
|
* Computed reactive object.
|
|
435
443
|
*/
|
|
436
|
-
declare function reactiveComputed<T extends object>(fn:
|
|
444
|
+
declare function reactiveComputed<T extends object>(fn: ComputedGetter<T>): UnwrapNestedRefs<T>;
|
|
437
445
|
|
|
438
446
|
type ReactiveOmitPredicate<T> = (value: T[keyof T], key: keyof T) => boolean;
|
|
439
447
|
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
@@ -1051,11 +1059,17 @@ declare function useThrottleFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGet
|
|
|
1051
1059
|
|
|
1052
1060
|
interface UseTimeoutFnOptions {
|
|
1053
1061
|
/**
|
|
1054
|
-
* Start the timer
|
|
1062
|
+
* Start the timer immediately
|
|
1055
1063
|
*
|
|
1056
1064
|
* @default true
|
|
1057
1065
|
*/
|
|
1058
1066
|
immediate?: boolean;
|
|
1067
|
+
/**
|
|
1068
|
+
* Execute the callback immediately after calling `start`
|
|
1069
|
+
*
|
|
1070
|
+
* @default false
|
|
1071
|
+
*/
|
|
1072
|
+
immediateCallback?: boolean;
|
|
1059
1073
|
}
|
|
1060
1074
|
/**
|
|
1061
1075
|
* Wrapper for `setTimeout` with controls.
|
|
@@ -1185,9 +1199,10 @@ declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sourc
|
|
|
1185
1199
|
interface WatchPausableReturn extends Pausable {
|
|
1186
1200
|
stop: WatchStopHandle;
|
|
1187
1201
|
}
|
|
1188
|
-
|
|
1189
|
-
declare function watchPausable<T
|
|
1190
|
-
declare function watchPausable<T
|
|
1202
|
+
type WatchPausableOptions<Immediate> = WatchWithFilterOptions<Immediate> & PausableFilterOptions;
|
|
1203
|
+
declare function watchPausable<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1204
|
+
declare function watchPausable<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1205
|
+
declare function watchPausable<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchPausableOptions<Immediate>): WatchPausableReturn;
|
|
1191
1206
|
|
|
1192
1207
|
interface WatchThrottledOptions<Immediate> extends WatchOptions<Immediate> {
|
|
1193
1208
|
throttle?: MaybeRefOrGetter<number>;
|
|
@@ -1225,4 +1240,4 @@ interface WheneverOptions extends WatchOptions {
|
|
|
1225
1240
|
*/
|
|
1226
1241
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WheneverOptions): vue.WatchHandle;
|
|
1227
1242
|
|
|
1228
|
-
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
|
1243
|
+
export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IfAny, type IgnoredUpdater, type IsAny, type MapOldSources, type MapSources, type MultiWatchSources, type Mutable, type Pausable, type PausableFilterOptions, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ThrottleFilterOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayDifferenceOptions, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableOptions, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WheneverOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
package/index.iife.js
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
result.value = fn();
|
|
9
9
|
}, {
|
|
10
10
|
...options,
|
|
11
|
-
flush: (_a = options == null ?
|
|
11
|
+
flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
|
|
12
12
|
});
|
|
13
13
|
return vue.readonly(result);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function computedWithControl(source, fn) {
|
|
17
|
-
let v =
|
|
17
|
+
let v = void 0;
|
|
18
18
|
let track;
|
|
19
19
|
let trigger;
|
|
20
20
|
const dirty = vue.ref(true);
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
};
|
|
25
25
|
vue.watch(source, update, { flush: "sync" });
|
|
26
26
|
const get = typeof fn === "function" ? fn : fn.get;
|
|
27
|
-
const set = typeof fn === "function" ?
|
|
27
|
+
const set = typeof fn === "function" ? void 0 : fn.set;
|
|
28
28
|
const result = vue.customRef((_track, _trigger) => {
|
|
29
29
|
track = _track;
|
|
30
30
|
trigger = _trigger;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
return v;
|
|
39
39
|
},
|
|
40
40
|
set(v2) {
|
|
41
|
-
set == null ?
|
|
41
|
+
set == null ? void 0 : set(v2);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
});
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
const injectLocal = (...args) => {
|
|
101
101
|
var _a;
|
|
102
102
|
const key = args[0];
|
|
103
|
-
const instance = (_a = vue.getCurrentInstance()) == null ?
|
|
103
|
+
const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
104
104
|
if (instance == null && !vue.hasInjectionContext())
|
|
105
105
|
throw new Error("injectLocal must be called in setup");
|
|
106
106
|
if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
|
|
111
111
|
const provideLocal = (key, value) => {
|
|
112
112
|
var _a;
|
|
113
|
-
const instance = (_a = vue.getCurrentInstance()) == null ?
|
|
113
|
+
const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
114
114
|
if (instance == null)
|
|
115
115
|
throw new Error("provideLocal must be called in setup");
|
|
116
116
|
if (!localProvidedStateMap.has(instance))
|
|
@@ -121,8 +121,8 @@
|
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
function createInjectionState(composable, options) {
|
|
124
|
-
const key = (options == null ?
|
|
125
|
-
const defaultValue = options == null ?
|
|
124
|
+
const key = (options == null ? void 0 : options.injectionKey) || Symbol(composable.name || "InjectionState");
|
|
125
|
+
const defaultValue = options == null ? void 0 : options.defaultValue;
|
|
126
126
|
const useProvidingState = (...args) => {
|
|
127
127
|
const state = composable(...args);
|
|
128
128
|
provideLocal(key, state);
|
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
subscribers -= 1;
|
|
141
141
|
if (scope && subscribers <= 0) {
|
|
142
142
|
scope.stop();
|
|
143
|
-
state =
|
|
144
|
-
scope =
|
|
143
|
+
state = void 0;
|
|
144
|
+
scope = void 0;
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
return (...args) => {
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
function reactify(fn, options) {
|
|
211
|
-
const unrefFn = (options == null ?
|
|
211
|
+
const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? vue.unref : vue.toValue;
|
|
212
212
|
return function(...args) {
|
|
213
213
|
return vue.computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
214
214
|
};
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
const isIOS = /* @__PURE__ */ getIsIOS();
|
|
305
305
|
function getIsIOS() {
|
|
306
306
|
var _a, _b;
|
|
307
|
-
return isClient && ((_a = window == null ?
|
|
307
|
+
return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
function createFilterWrapper(filter, fn) {
|
|
@@ -327,12 +327,13 @@
|
|
|
327
327
|
lastRejector();
|
|
328
328
|
lastRejector = noop;
|
|
329
329
|
};
|
|
330
|
+
let lastInvoker;
|
|
330
331
|
const filter = (invoke) => {
|
|
331
332
|
const duration = vue.toValue(ms);
|
|
332
333
|
const maxDuration = vue.toValue(options.maxWait);
|
|
333
334
|
if (timer)
|
|
334
335
|
_clearTimeout(timer);
|
|
335
|
-
if (duration <= 0 || maxDuration !==
|
|
336
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
336
337
|
if (maxTimer) {
|
|
337
338
|
_clearTimeout(maxTimer);
|
|
338
339
|
maxTimer = null;
|
|
@@ -341,12 +342,13 @@
|
|
|
341
342
|
}
|
|
342
343
|
return new Promise((resolve, reject) => {
|
|
343
344
|
lastRejector = options.rejectOnCancel ? reject : resolve;
|
|
345
|
+
lastInvoker = invoke;
|
|
344
346
|
if (maxDuration && !maxTimer) {
|
|
345
347
|
maxTimer = setTimeout(() => {
|
|
346
348
|
if (timer)
|
|
347
349
|
_clearTimeout(timer);
|
|
348
350
|
maxTimer = null;
|
|
349
|
-
resolve(
|
|
351
|
+
resolve(lastInvoker());
|
|
350
352
|
}, maxDuration);
|
|
351
353
|
}
|
|
352
354
|
timer = setTimeout(() => {
|
|
@@ -376,7 +378,7 @@
|
|
|
376
378
|
const clear = () => {
|
|
377
379
|
if (timer) {
|
|
378
380
|
clearTimeout(timer);
|
|
379
|
-
timer =
|
|
381
|
+
timer = void 0;
|
|
380
382
|
lastRejector();
|
|
381
383
|
lastRejector = noop;
|
|
382
384
|
}
|
|
@@ -413,8 +415,11 @@
|
|
|
413
415
|
};
|
|
414
416
|
return filter;
|
|
415
417
|
}
|
|
416
|
-
function pausableFilter(extendFilter = bypassFilter) {
|
|
417
|
-
const
|
|
418
|
+
function pausableFilter(extendFilter = bypassFilter, options = {}) {
|
|
419
|
+
const {
|
|
420
|
+
initialState = "active"
|
|
421
|
+
} = options;
|
|
422
|
+
const isActive = toRef(initialState === "active");
|
|
418
423
|
function pause() {
|
|
419
424
|
isActive.value = false;
|
|
420
425
|
}
|
|
@@ -462,7 +467,7 @@
|
|
|
462
467
|
}
|
|
463
468
|
wrapper.reset = async () => {
|
|
464
469
|
const _prev = _promise;
|
|
465
|
-
_promise =
|
|
470
|
+
_promise = void 0;
|
|
466
471
|
if (_prev)
|
|
467
472
|
await _prev;
|
|
468
473
|
};
|
|
@@ -478,7 +483,7 @@
|
|
|
478
483
|
var _a;
|
|
479
484
|
if (typeof target === "number")
|
|
480
485
|
return target + delta;
|
|
481
|
-
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ?
|
|
486
|
+
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ? void 0 : _a[0]) || "";
|
|
482
487
|
const unit = target.slice(value.length);
|
|
483
488
|
const result = Number.parseFloat(value) + delta;
|
|
484
489
|
if (Number.isNaN(result))
|
|
@@ -491,7 +496,7 @@
|
|
|
491
496
|
function objectPick(obj, keys, omitUndefined = false) {
|
|
492
497
|
return keys.reduce((n, k) => {
|
|
493
498
|
if (k in obj) {
|
|
494
|
-
if (!omitUndefined || obj[k] !==
|
|
499
|
+
if (!omitUndefined || obj[k] !== void 0)
|
|
495
500
|
n[k] = obj[k];
|
|
496
501
|
}
|
|
497
502
|
return n;
|
|
@@ -499,7 +504,7 @@
|
|
|
499
504
|
}
|
|
500
505
|
function objectOmit(obj, keys, omitUndefined = false) {
|
|
501
506
|
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {
|
|
502
|
-
return (!omitUndefined || value !==
|
|
507
|
+
return (!omitUndefined || value !== void 0) && !keys.includes(key);
|
|
503
508
|
}));
|
|
504
509
|
}
|
|
505
510
|
function objectEntries(obj) {
|
|
@@ -624,10 +629,10 @@
|
|
|
624
629
|
if (value === source)
|
|
625
630
|
return;
|
|
626
631
|
const old = source;
|
|
627
|
-
if (((_a = options.onBeforeChange) == null ?
|
|
632
|
+
if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)
|
|
628
633
|
return;
|
|
629
634
|
source = value;
|
|
630
|
-
(_b = options.onChanged) == null ?
|
|
635
|
+
(_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);
|
|
631
636
|
if (triggering)
|
|
632
637
|
trigger();
|
|
633
638
|
}
|
|
@@ -679,9 +684,10 @@
|
|
|
679
684
|
function watchPausable(source, cb, options = {}) {
|
|
680
685
|
const {
|
|
681
686
|
eventFilter: filter,
|
|
687
|
+
initialState = "active",
|
|
682
688
|
...watchOptions
|
|
683
689
|
} = options;
|
|
684
|
-
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
690
|
+
const { eventFilter, pause, resume, isActive } = pausableFilter(filter, { initialState });
|
|
685
691
|
const stop = watchWithFilter(
|
|
686
692
|
source,
|
|
687
693
|
cb,
|
|
@@ -823,7 +829,7 @@
|
|
|
823
829
|
if (stop)
|
|
824
830
|
stop();
|
|
825
831
|
else
|
|
826
|
-
vue.nextTick(() => stop == null ?
|
|
832
|
+
vue.nextTick(() => stop == null ? void 0 : stop());
|
|
827
833
|
resolve(v);
|
|
828
834
|
}
|
|
829
835
|
},
|
|
@@ -837,7 +843,7 @@
|
|
|
837
843
|
const promises = [watcher];
|
|
838
844
|
if (timeout != null) {
|
|
839
845
|
promises.push(
|
|
840
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => stop == null ?
|
|
846
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => stop == null ? void 0 : stop())
|
|
841
847
|
);
|
|
842
848
|
}
|
|
843
849
|
return Promise.race(promises);
|
|
@@ -855,7 +861,7 @@
|
|
|
855
861
|
if (stop)
|
|
856
862
|
stop();
|
|
857
863
|
else
|
|
858
|
-
vue.nextTick(() => stop == null ?
|
|
864
|
+
vue.nextTick(() => stop == null ? void 0 : stop());
|
|
859
865
|
resolve(v1);
|
|
860
866
|
}
|
|
861
867
|
},
|
|
@@ -870,7 +876,7 @@
|
|
|
870
876
|
if (timeout != null) {
|
|
871
877
|
promises.push(
|
|
872
878
|
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => {
|
|
873
|
-
stop == null ?
|
|
879
|
+
stop == null ? void 0 : stop();
|
|
874
880
|
return vue.toValue(r);
|
|
875
881
|
})
|
|
876
882
|
);
|
|
@@ -884,7 +890,7 @@
|
|
|
884
890
|
return toBe(null, options);
|
|
885
891
|
}
|
|
886
892
|
function toBeUndefined(options) {
|
|
887
|
-
return toBe(
|
|
893
|
+
return toBe(void 0, options);
|
|
888
894
|
}
|
|
889
895
|
function toBeNaN(options) {
|
|
890
896
|
return toMatch(Number.isNaN, options);
|
|
@@ -985,7 +991,7 @@
|
|
|
985
991
|
if (cb(arr[index], index, arr))
|
|
986
992
|
return arr[index];
|
|
987
993
|
}
|
|
988
|
-
return
|
|
994
|
+
return void 0;
|
|
989
995
|
}
|
|
990
996
|
function useArrayFindLast(list, fn) {
|
|
991
997
|
return vue.computed(() => vue.toValue(
|
|
@@ -1075,7 +1081,7 @@
|
|
|
1075
1081
|
}
|
|
1076
1082
|
|
|
1077
1083
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
|
|
1078
|
-
const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
1084
|
+
const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;
|
|
1079
1085
|
function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
|
|
1080
1086
|
let m = hours < 12 ? "AM" : "PM";
|
|
1081
1087
|
if (hasPeriod)
|
|
@@ -1098,6 +1104,10 @@
|
|
|
1098
1104
|
const milliseconds = date.getMilliseconds();
|
|
1099
1105
|
const day = date.getDay();
|
|
1100
1106
|
const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
|
|
1107
|
+
const stripTimeZone = (dateString) => {
|
|
1108
|
+
var _a2;
|
|
1109
|
+
return (_a2 = dateString.split(" ")[1]) != null ? _a2 : "";
|
|
1110
|
+
};
|
|
1101
1111
|
const matches = {
|
|
1102
1112
|
Yo: () => formatOrdinal(years),
|
|
1103
1113
|
YY: () => String(years).slice(-2),
|
|
@@ -1130,17 +1140,21 @@
|
|
|
1130
1140
|
A: () => meridiem(hours, minutes),
|
|
1131
1141
|
AA: () => meridiem(hours, minutes, false, true),
|
|
1132
1142
|
a: () => meridiem(hours, minutes, true),
|
|
1133
|
-
aa: () => meridiem(hours, minutes, true, true)
|
|
1143
|
+
aa: () => meridiem(hours, minutes, true, true),
|
|
1144
|
+
z: () => stripTimeZone(date.toLocaleDateString(vue.toValue(options.locales), { timeZoneName: "shortOffset" })),
|
|
1145
|
+
zz: () => stripTimeZone(date.toLocaleDateString(vue.toValue(options.locales), { timeZoneName: "shortOffset" })),
|
|
1146
|
+
zzz: () => stripTimeZone(date.toLocaleDateString(vue.toValue(options.locales), { timeZoneName: "shortOffset" })),
|
|
1147
|
+
zzzz: () => stripTimeZone(date.toLocaleDateString(vue.toValue(options.locales), { timeZoneName: "longOffset" }))
|
|
1134
1148
|
};
|
|
1135
1149
|
return formatStr.replace(REGEX_FORMAT, (match, $1) => {
|
|
1136
1150
|
var _a2, _b;
|
|
1137
|
-
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ?
|
|
1151
|
+
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? void 0 : _a2.call(matches)) != null ? _b : match;
|
|
1138
1152
|
});
|
|
1139
1153
|
}
|
|
1140
1154
|
function normalizeDate(date) {
|
|
1141
1155
|
if (date === null)
|
|
1142
1156
|
return new Date(Number.NaN);
|
|
1143
|
-
if (date ===
|
|
1157
|
+
if (date === void 0)
|
|
1144
1158
|
return /* @__PURE__ */ new Date();
|
|
1145
1159
|
if (date instanceof Date)
|
|
1146
1160
|
return new Date(date);
|
|
@@ -1246,7 +1260,8 @@
|
|
|
1246
1260
|
|
|
1247
1261
|
function useTimeoutFn(cb, interval, options = {}) {
|
|
1248
1262
|
const {
|
|
1249
|
-
immediate = true
|
|
1263
|
+
immediate = true,
|
|
1264
|
+
immediateCallback = false
|
|
1250
1265
|
} = options;
|
|
1251
1266
|
const isPending = vue.ref(false);
|
|
1252
1267
|
let timer = null;
|
|
@@ -1261,6 +1276,8 @@
|
|
|
1261
1276
|
clear();
|
|
1262
1277
|
}
|
|
1263
1278
|
function start(...args) {
|
|
1279
|
+
if (immediateCallback)
|
|
1280
|
+
cb();
|
|
1264
1281
|
clear();
|
|
1265
1282
|
isPending.value = true;
|
|
1266
1283
|
timer = setTimeout(() => {
|
|
@@ -1349,7 +1366,7 @@
|
|
|
1349
1366
|
}
|
|
1350
1367
|
|
|
1351
1368
|
function watchArray(source, cb, options) {
|
|
1352
|
-
let oldList = (options == null ?
|
|
1369
|
+
let oldList = (options == null ? void 0 : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : vue.toValue(source)];
|
|
1353
1370
|
return vue.watch(source, (newList, _, onCleanup) => {
|
|
1354
1371
|
const oldListRemains = Array.from({ length: oldList.length });
|
|
1355
1372
|
const added = [];
|
|
@@ -1393,7 +1410,7 @@
|
|
|
1393
1410
|
function watchDebounced(source, cb, options = {}) {
|
|
1394
1411
|
const {
|
|
1395
1412
|
debounce = 0,
|
|
1396
|
-
maxWait =
|
|
1413
|
+
maxWait = void 0,
|
|
1397
1414
|
...watchOptions
|
|
1398
1415
|
} = options;
|
|
1399
1416
|
return watchWithFilter(
|
|
@@ -1530,7 +1547,7 @@
|
|
|
1530
1547
|
if (!cleanupFn)
|
|
1531
1548
|
return;
|
|
1532
1549
|
const fn = cleanupFn;
|
|
1533
|
-
cleanupFn =
|
|
1550
|
+
cleanupFn = void 0;
|
|
1534
1551
|
fn();
|
|
1535
1552
|
}
|
|
1536
1553
|
function onCleanup(callback) {
|
|
@@ -1562,7 +1579,7 @@
|
|
|
1562
1579
|
return vue.toValue(sources);
|
|
1563
1580
|
}
|
|
1564
1581
|
function getOldValue(source) {
|
|
1565
|
-
return Array.isArray(source) ? source.map(() =>
|
|
1582
|
+
return Array.isArray(source) ? source.map(() => void 0) : void 0;
|
|
1566
1583
|
}
|
|
1567
1584
|
|
|
1568
1585
|
function whenever(source, cb, options) {
|
|
@@ -1570,7 +1587,7 @@
|
|
|
1570
1587
|
source,
|
|
1571
1588
|
(v, ov, onInvalidate) => {
|
|
1572
1589
|
if (v) {
|
|
1573
|
-
if (options == null ?
|
|
1590
|
+
if (options == null ? void 0 : options.once)
|
|
1574
1591
|
vue.nextTick(() => stop());
|
|
1575
1592
|
cb(v, ov, onInvalidate);
|
|
1576
1593
|
}
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,o){"use strict";function H(e,t){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=e()},{...t,flush:(n=t?.flush)!=null?n:"sync"}),o.readonly(r)}function G(e,t){let n,r,a;const u=o.ref(!0),c=()=>{u.value=!0,a()};o.watch(e,c,{flush:"sync"});const l=typeof t=="function"?t:t.get,s=typeof t=="function"?void 0:t.set,h=o.customRef((m,d)=>(r=m,a=d,{get(){return u.value&&(n=l(n),u.value=!1),r(),n},set(f){s?.(f)}}));return Object.isExtensible(h)&&(h.trigger=c),h}function p(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function de(){const e=new Set,t=u=>{e.delete(u)};return{on:u=>{e.add(u);const c=()=>t(u);return p(c),{off:c}},off:t,trigger:(...u)=>Promise.all(Array.from(e).map(c=>c(...u))),clear:()=>{e.clear()}}}function me(e){let t=!1,n;const r=o.effectScope(!0);return(...a)=>(t||(n=r.run(()=>e(...a)),t=!0),n)}const S=new WeakMap,z=(...e)=>{var t;const n=e[0],r=(t=o.getCurrentInstance())==null?void 0:t.proxy;if(r==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&S.has(r)&&n in S.get(r)?S.get(r)[n]:o.inject(...e)},q=(e,t)=>{var n;const r=(n=o.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");S.has(r)||S.set(r,Object.create(null));const a=S.get(r);a[e]=t,o.provide(e,t)};function he(e,t){const n=t?.injectionKey||Symbol(e.name||"InjectionState"),r=t?.defaultValue;return[(...c)=>{const l=e(...c);return q(n,l),l},()=>z(n,r)]}function ye(e){let t=0,n,r;const a=()=>{t-=1,r&&t<=0&&(r.stop(),n=void 0,r=void 0)};return(...u)=>(t+=1,r||(r=o.effectScope(!0),n=r.run(()=>e(...u))),p(a),n)}function Z(e,t,{enumerable:n=!1,unwrap:r=!0}={}){for(const[a,u]of Object.entries(t))a!=="value"&&(o.isRef(u)&&r?Object.defineProperty(e,a,{get(){return u.value},set(c){u.value=c},enumerable:n}):Object.defineProperty(e,a,{value:u,enumerable:n}));return e}function ge(e,t){return t==null?o.unref(e):o.unref(e)[t]}function we(e){return o.unref(e)!=null}function Ve(e,t){if(typeof Symbol<"u"){const n={...e};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:t[r++],done:r>t.length})}}}),n}else return Object.assign([...t],e)}function k(e,t){const n=t?.computedGetter===!1?o.unref:o.toValue;return function(...r){return o.computed(()=>e.apply(this,r.map(a=>n(a))))}}function be(e,t={}){let n=[],r;if(Array.isArray(t))n=t;else{r=t;const{includeOwnProperties:a=!0}=t;n.push(...Object.keys(e)),a&&n.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(n.map(a=>{const u=e[a];return[a,typeof u=="function"?k(u.bind(e),r):u]}))}function J(e){if(!o.isRef(e))return o.reactive(e);const t=new Proxy({},{get(n,r,a){return o.unref(Reflect.get(e.value,r,a))},set(n,r,a){return o.isRef(e.value[r])&&!o.isRef(a)?e.value[r].value=a:e.value[r]=a,!0},deleteProperty(n,r){return Reflect.deleteProperty(e.value,r)},has(n,r){return Reflect.has(e.value,r)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return o.reactive(t)}function E(e){return J(o.computed(e))}function pe(e,...t){const n=t.flat(),r=n[0];return E(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(e)).filter(([a,u])=>!r(o.toValue(u),a)):Object.entries(o.toRefs(e)).filter(a=>!n.includes(a[0]))))}const D=typeof window<"u"&&typeof document<"u",Ae=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Oe=e=>typeof e<"u",Se=e=>e!=null,Te=(e,...t)=>{e||console.warn(...t)},De=Object.prototype.toString,X=e=>De.call(e)==="[object Object]",Fe=()=>Date.now(),K=()=>+Date.now(),Me=(e,t,n)=>Math.min(n,Math.max(t,e)),A=()=>{},Pe=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),Ie=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Re=Ce();function Ce(){var e,t;return D&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function F(e,t){function n(...r){return new Promise((a,u)=>{Promise.resolve(e(()=>t.apply(this,r),{fn:t,thisArg:this,args:r})).then(a).catch(u)})}return n}const I=e=>e();function _(e,t={}){let n,r,a=A;const u=l=>{clearTimeout(l),a(),a=A};return l=>{const s=o.toValue(e),h=o.toValue(t.maxWait);return n&&u(n),s<=0||h!==void 0&&h<=0?(r&&(u(r),r=null),Promise.resolve(l())):new Promise((m,d)=>{a=t.rejectOnCancel?d:m,h&&!r&&(r=setTimeout(()=>{n&&u(n),r=null,m(l())},h)),n=setTimeout(()=>{r&&u(r),r=null,m(l())},s)})}}function N(...e){let t=0,n,r=!0,a=A,u,c,l,s,h;!o.isRef(e[0])&&typeof e[0]=="object"?{delay:c,trailing:l=!0,leading:s=!0,rejectOnCancel:h=!1}=e[0]:[c,l=!0,s=!0,h=!1]=e;const m=()=>{n&&(clearTimeout(n),n=void 0,a(),a=A)};return f=>{const y=o.toValue(c),g=Date.now()-t,V=()=>u=f();return m(),y<=0?(t=Date.now(),V()):(g>y&&(s||!r)?(t=Date.now(),V()):l&&(u=new Promise((w,b)=>{a=h?b:w,n=setTimeout(()=>{t=Date.now(),r=!0,w(V()),m()},Math.max(0,y-g))})),!s&&!n&&(n=setTimeout(()=>r=!0,y)),r=!1,u)}}function Q(e=I){const t=o.ref(!0);function n(){t.value=!1}function r(){t.value=!0}const a=(...u)=>{t.value&&e(...u)};return{isActive:o.readonly(t),pause:n,resume:r,eventFilter:a}}function v(e){const t=Object.create(null);return n=>t[n]||(t[n]=e(n))}const ke=/\B([A-Z])/g,Ee=v(e=>e.replace(ke,"-$1").toLowerCase()),_e=/-(\w)/g,Ne=v(e=>e.replace(_e,(t,n)=>n?n.toUpperCase():""));function j(e,t=!1,n="Timeout"){return new Promise((r,a)=>{setTimeout(t?()=>a(n):r,e)})}function je(e){return e}function Le(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const r=t;t=void 0,r&&await r},n}function We(e){return e()}function x(e,...t){return t.some(n=>n in e)}function Ue(e,t){var n;if(typeof e=="number")return e+t;const r=((n=e.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",a=e.slice(r.length),u=Number.parseFloat(r)+t;return Number.isNaN(u)?e:u+a}function Be(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function Ye(e,t,n=!1){return t.reduce((r,a)=>(a in e&&(!n||e[a]!==void 0)&&(r[a]=e[a]),r),{})}function $e(e,t,n=!1){return Object.fromEntries(Object.entries(e).filter(([r,a])=>(!n||a!==void 0)&&!t.includes(r)))}function He(e){return Object.entries(e)}function M(e){return e||o.getCurrentInstance()}function ee(e){return Array.isArray(e)?e:[e]}function L(...e){if(e.length!==1)return o.toRef(...e);const t=e[0];return typeof t=="function"?o.readonly(o.customRef(()=>({get:t,set:A}))):o.ref(t)}const Ge=L;function ze(e,...t){const n=t.flat(),r=n[0];return E(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(e)).filter(([a,u])=>r(o.toValue(u),a)):n.map(a=>[a,L(e,a)])))}function te(e,t=1e4){return o.customRef((n,r)=>{let a=o.toValue(e),u;const c=()=>setTimeout(()=>{a=o.toValue(e),r()},o.toValue(t));return p(()=>{clearTimeout(u)}),{get(){return n(),a},set(l){a=l,r(),clearTimeout(u),u=c()}}})}function ne(e,t=200,n={}){return F(_(t,n),e)}function W(e,t=200,n={}){const r=o.ref(e.value),a=ne(()=>{r.value=e.value},t,n);return o.watch(e,()=>a()),r}function qe(e,t){return o.computed({get(){var n;return(n=e.value)!=null?n:t},set(n){e.value=n}})}function re(e,t=200,n=!1,r=!0,a=!1){return F(N(t,n,r,a),e)}function U(e,t=200,n=!0,r=!0){if(t<=0)return e;const a=o.ref(e.value),u=re(()=>{a.value=e.value},t,n,r);return o.watch(e,()=>u()),a}function oe(e,t={}){let n=e,r,a;const u=o.customRef((f,y)=>(r=f,a=y,{get(){return c()},set(g){l(g)}}));function c(f=!0){return f&&r(),n}function l(f,y=!0){var g,V;if(f===n)return;const w=n;((g=t.onBeforeChange)==null?void 0:g.call(t,f,w))!==!1&&(n=f,(V=t.onChanged)==null||V.call(t,f,w),y&&a())}return Z(u,{get:c,set:l,untrackedGet:()=>c(!1),silentSet:f=>l(f,!1),peek:()=>c(!1),lay:f=>l(f,!1)},{enumerable:!0})}const Ze=oe;function Je(...e){if(e.length===2){const[t,n]=e;t.value=n}if(e.length===3){const[t,n,r]=e;t[n]=r}}function P(e,t,n={}){const{eventFilter:r=I,...a}=n;return o.watch(e,F(r,t),a)}function R(e,t,n={}){const{eventFilter:r,...a}=n,{eventFilter:u,pause:c,resume:l,isActive:s}=Q(r);return{stop:P(e,t,{...a,eventFilter:u}),pause:c,resume:l,isActive:s}}function Xe(e,t,...[n]){const{flush:r="sync",deep:a=!1,immediate:u=!0,direction:c="both",transform:l={}}=n||{},s=[],h="ltr"in l&&l.ltr||(f=>f),m="rtl"in l&&l.rtl||(f=>f);return(c==="both"||c==="ltr")&&s.push(R(e,f=>{s.forEach(y=>y.pause()),t.value=h(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:u})),(c==="both"||c==="rtl")&&s.push(R(t,f=>{s.forEach(y=>y.pause()),e.value=m(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:u})),()=>{s.forEach(f=>f.stop())}}function Ke(e,t,n={}){const{flush:r="sync",deep:a=!1,immediate:u=!0}=n;return t=ee(t),o.watch(e,c=>t.forEach(l=>l.value=c),{flush:r,deep:a,immediate:u})}function Qe(e,t={}){if(!o.isRef(e))return o.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const r in e.value)n[r]=o.customRef(()=>({get(){return e.value[r]},set(a){var u;if((u=o.toValue(t.replaceRef))!=null?u:!0)if(Array.isArray(e.value)){const l=[...e.value];l[r]=a,e.value=l}else{const l={...e.value,[r]:a};Object.setPrototypeOf(l,Object.getPrototypeOf(e.value)),e.value=l}else e.value[r]=a}}));return n}const ve=o.toValue,xe=o.toValue;function et(e,t=!0,n){M(n)?o.onBeforeMount(e,n):t?e():o.nextTick(e)}function tt(e,t){M(t)&&o.onBeforeUnmount(e,t)}function nt(e,t=!0,n){M()?o.onMounted(e,n):t?e():o.nextTick(e)}function rt(e,t){M(t)&&o.onUnmounted(e,t)}function B(e,t=!1){function n(d,{flush:f="sync",deep:y=!1,timeout:g,throwOnTimeout:V}={}){let w=null;const $=[new Promise(C=>{w=o.watch(e,T=>{d(T)!==t&&(w?w():o.nextTick(()=>w?.()),C(T))},{flush:f,deep:y,immediate:!0})})];return g!=null&&$.push(j(g,V).then(()=>o.toValue(e)).finally(()=>w?.())),Promise.race($)}function r(d,f){if(!o.isRef(d))return n(T=>T===d,f);const{flush:y="sync",deep:g=!1,timeout:V,throwOnTimeout:w}=f??{};let b=null;const C=[new Promise(T=>{b=o.watch([e,d],([fe,$t])=>{t!==(fe===$t)&&(b?b():o.nextTick(()=>b?.()),T(fe))},{flush:y,deep:g,immediate:!0})})];return V!=null&&C.push(j(V,w).then(()=>o.toValue(e)).finally(()=>(b?.(),o.toValue(e)))),Promise.race(C)}function a(d){return n(f=>!!f,d)}function u(d){return r(null,d)}function c(d){return r(void 0,d)}function l(d){return n(Number.isNaN,d)}function s(d,f){return n(y=>{const g=Array.from(y);return g.includes(d)||g.includes(o.toValue(d))},f)}function h(d){return m(1,d)}function m(d=1,f){let y=-1;return n(()=>(y+=1,y>=d),f)}return Array.isArray(o.toValue(e))?{toMatch:n,toContains:s,changed:h,changedTimes:m,get not(){return B(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:a,toBeNull:u,toBeNaN:l,toBeUndefined:c,changed:h,changedTimes:m,get not(){return B(e,!t)}}}function ot(e){return B(e)}function at(e,t){return e===t}function ut(...e){var t,n;const r=e[0],a=e[1];let u=(t=e[2])!=null?t:at;const{symmetric:c=!1}=(n=e[3])!=null?n:{};if(typeof u=="string"){const s=u;u=(h,m)=>h[s]===m[s]}const l=o.computed(()=>o.toValue(r).filter(s=>o.toValue(a).findIndex(h=>u(s,h))===-1));if(c){const s=o.computed(()=>o.toValue(a).filter(h=>o.toValue(r).findIndex(m=>u(h,m))===-1));return o.computed(()=>c?[...o.toValue(l),...o.toValue(s)]:o.toValue(l))}else return l}function it(e,t){return o.computed(()=>o.toValue(e).every((n,r,a)=>t(o.toValue(n),r,a)))}function ct(e,t){return o.computed(()=>o.toValue(e).map(n=>o.toValue(n)).filter(t))}function lt(e,t){return o.computed(()=>o.toValue(o.toValue(e).find((n,r,a)=>t(o.toValue(n),r,a))))}function st(e,t){return o.computed(()=>o.toValue(e).findIndex((n,r,a)=>t(o.toValue(n),r,a)))}function ft(e,t){let n=e.length;for(;n-- >0;)if(t(e[n],n,e))return e[n]}function dt(e,t){return o.computed(()=>o.toValue(Array.prototype.findLast?o.toValue(e).findLast((n,r,a)=>t(o.toValue(n),r,a)):ft(o.toValue(e),(n,r,a)=>t(o.toValue(n),r,a))))}function mt(e){return X(e)&&x(e,"formIndex","comparator")}function ht(...e){var t;const n=e[0],r=e[1];let a=e[2],u=0;if(mt(a)&&(u=(t=a.fromIndex)!=null?t:0,a=a.comparator),typeof a=="string"){const c=a;a=(l,s)=>l[c]===o.toValue(s)}return a=a??((c,l)=>c===o.toValue(l)),o.computed(()=>o.toValue(n).slice(u).some((c,l,s)=>a(o.toValue(c),o.toValue(r),l,o.toValue(s))))}function yt(e,t){return o.computed(()=>o.toValue(e).map(n=>o.toValue(n)).join(o.toValue(t)))}function gt(e,t){return o.computed(()=>o.toValue(e).map(n=>o.toValue(n)).map(t))}function wt(e,t,...n){const r=(a,u,c)=>t(o.toValue(a),o.toValue(u),c);return o.computed(()=>{const a=o.toValue(e);return n.length?a.reduce(r,typeof n[0]=="function"?o.toValue(n[0]()):o.toValue(n[0])):a.reduce(r)})}function Vt(e,t){return o.computed(()=>o.toValue(e).some((n,r,a)=>t(o.toValue(n),r,a)))}function bt(e){return Array.from(new Set(e))}function pt(e,t){return e.reduce((n,r)=>(n.some(a=>t(r,a,e))||n.push(r),n),[])}function At(e,t){return o.computed(()=>{const n=o.toValue(e).map(r=>o.toValue(r));return t?pt(n,t):bt(n)})}function Ot(e=0,t={}){let n=o.unref(e);const r=o.ref(e),{max:a=Number.POSITIVE_INFINITY,min:u=Number.NEGATIVE_INFINITY}=t,c=(d=1)=>r.value=Math.max(Math.min(a,r.value+d),u),l=(d=1)=>r.value=Math.min(Math.max(u,r.value-d),a),s=()=>r.value,h=d=>r.value=Math.max(u,Math.min(a,d));return{count:r,inc:c,dec:l,get:s,set:h,reset:(d=n)=>(n=d,h(d))}}const St=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,Tt=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function Dt(e,t,n,r){let a=e<12?"AM":"PM";return r&&(a=a.split("").reduce((u,c)=>u+=`${c}.`,"")),n?a.toLowerCase():a}function O(e){const t=["th","st","nd","rd"],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function ae(e,t,n={}){var r;const a=e.getFullYear(),u=e.getMonth(),c=e.getDate(),l=e.getHours(),s=e.getMinutes(),h=e.getSeconds(),m=e.getMilliseconds(),d=e.getDay(),f=(r=n.customMeridiem)!=null?r:Dt,y={Yo:()=>O(a),YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>u+1,Mo:()=>O(u+1),MM:()=>`${u+1}`.padStart(2,"0"),MMM:()=>e.toLocaleDateString(o.toValue(n.locales),{month:"short"}),MMMM:()=>e.toLocaleDateString(o.toValue(n.locales),{month:"long"}),D:()=>String(c),Do:()=>O(c),DD:()=>`${c}`.padStart(2,"0"),H:()=>String(l),Ho:()=>O(l),HH:()=>`${l}`.padStart(2,"0"),h:()=>`${l%12||12}`.padStart(1,"0"),ho:()=>O(l%12||12),hh:()=>`${l%12||12}`.padStart(2,"0"),m:()=>String(s),mo:()=>O(s),mm:()=>`${s}`.padStart(2,"0"),s:()=>String(h),so:()=>O(h),ss:()=>`${h}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>e.toLocaleDateString(o.toValue(n.locales),{weekday:"narrow"}),ddd:()=>e.toLocaleDateString(o.toValue(n.locales),{weekday:"short"}),dddd:()=>e.toLocaleDateString(o.toValue(n.locales),{weekday:"long"}),A:()=>f(l,s),AA:()=>f(l,s,!1,!0),a:()=>f(l,s,!0),aa:()=>f(l,s,!0,!0)};return t.replace(Tt,(g,V)=>{var w,b;return(b=V??((w=y[g])==null?void 0:w.call(y)))!=null?b:g})}function ue(e){if(e===null)return new Date(Number.NaN);if(e===void 0)return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){const t=e.match(St);if(t){const n=t[2]-1||0,r=(t[7]||"0").substring(0,3);return new Date(t[1],n,t[3]||1,t[4]||0,t[5]||0,t[6]||0,r)}}return new Date(e)}function Ft(e,t="HH:mm:ss",n={}){return o.computed(()=>ae(ue(o.toValue(e)),o.toValue(t),n))}function ie(e,t=1e3,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n;let u=null;const c=o.ref(!1);function l(){u&&(clearInterval(u),u=null)}function s(){c.value=!1,l()}function h(){const m=o.toValue(t);m<=0||(c.value=!0,a&&e(),l(),c.value&&(u=setInterval(e,m)))}if(r&&D&&h(),o.isRef(t)||typeof t=="function"){const m=o.watch(t,()=>{c.value&&D&&h()});p(m)}return p(s),{isActive:c,pause:s,resume:h}}function Mt(e=1e3,t={}){const{controls:n=!1,immediate:r=!0,callback:a}=t,u=o.ref(0),c=()=>u.value+=1,l=()=>{u.value=0},s=ie(a?()=>{c(),a(u.value)}:c,e,{immediate:r});return n?{counter:u,reset:l,...s}:u}function Pt(e,t={}){var n;const r=o.ref((n=t.initialValue)!=null?n:null);return o.watch(e,()=>r.value=K(),t),r}function ce(e,t,n={}){const{immediate:r=!0}=n,a=o.ref(!1);let u=null;function c(){u&&(clearTimeout(u),u=null)}function l(){a.value=!1,c()}function s(...h){c(),a.value=!0,u=setTimeout(()=>{a.value=!1,u=null,e(...h)},o.toValue(t))}return r&&(a.value=!0,D&&s()),p(l),{isPending:o.readonly(a),start:s,stop:l}}function It(e=1e3,t={}){const{controls:n=!1,callback:r}=t,a=ce(r??A,e,t),u=o.computed(()=>!a.isPending.value);return n?{ready:u,...a}:u}function Rt(e,t={}){const{method:n="parseFloat",radix:r,nanToZero:a}=t;return o.computed(()=>{let u=o.toValue(e);return typeof n=="function"?u=n(u):typeof u=="string"&&(u=Number[n](u,r)),a&&Number.isNaN(u)&&(u=0),u})}function Ct(e){return o.computed(()=>`${o.toValue(e)}`)}function kt(e=!1,t={}){const{truthyValue:n=!0,falsyValue:r=!1}=t,a=o.isRef(e),u=o.ref(e);function c(l){if(arguments.length)return u.value=l,u.value;{const s=o.toValue(n);return u.value=u.value===s?o.toValue(r):s,u.value}}return a?c:[u,c]}function Et(e,t,n){let r=n?.immediate?[]:[...e instanceof Function?e():Array.isArray(e)?e:o.toValue(e)];return o.watch(e,(a,u,c)=>{const l=Array.from({length:r.length}),s=[];for(const m of a){let d=!1;for(let f=0;f<r.length;f++)if(!l[f]&&m===r[f]){l[f]=!0,d=!0;break}d||s.push(m)}const h=r.filter((m,d)=>!l[d]);t(a,r,s,h,c),r=[...a]},n)}function _t(e,t,n){const{count:r,...a}=n,u=o.ref(0),c=P(e,(...l)=>{u.value+=1,u.value>=o.toValue(r)&&o.nextTick(()=>c()),t(...l)},a);return{count:u,stop:c}}function le(e,t,n={}){const{debounce:r=0,maxWait:a=void 0,...u}=n;return P(e,t,{...u,eventFilter:_(r,{maxWait:a})})}function Nt(e,t,n){return o.watch(e,t,{...n,deep:!0})}function Y(e,t,n={}){const{eventFilter:r=I,...a}=n,u=F(r,t);let c,l,s;if(a.flush==="sync"){const h=o.ref(!1);l=()=>{},c=m=>{h.value=!0,m(),h.value=!1},s=o.watch(e,(...m)=>{h.value||u(...m)},a)}else{const h=[],m=o.ref(0),d=o.ref(0);l=()=>{m.value=d.value},h.push(o.watch(e,()=>{d.value++},{...a,flush:"sync"})),c=f=>{const y=d.value;f(),m.value+=d.value-y},h.push(o.watch(e,(...f)=>{const y=m.value>0&&m.value===d.value;m.value=0,d.value=0,!y&&u(...f)},a)),s=()=>{h.forEach(f=>f())}}return{stop:s,ignoreUpdates:c,ignorePrevAsyncUpdates:l}}function jt(e,t,n){return o.watch(e,t,{...n,immediate:!0})}function Lt(e,t,n){const r=o.watch(e,(...a)=>(o.nextTick(()=>r()),t(...a)),n);return r}function se(e,t,n={}){const{throttle:r=0,trailing:a=!0,leading:u=!0,...c}=n;return P(e,t,{...c,eventFilter:N(r,a,u)})}function Wt(e,t,n={}){let r;function a(){if(!r)return;const m=r;r=void 0,m()}function u(m){r=m}const c=(m,d)=>(a(),t(m,d,u)),l=Y(e,c,n),{ignoreUpdates:s}=l;return{...l,trigger:()=>{let m;return s(()=>{m=c(Ut(e),Bt(e))}),m}}}function Ut(e){return o.isReactive(e)?e:Array.isArray(e)?e.map(t=>o.toValue(t)):o.toValue(e)}function Bt(e){return Array.isArray(e)?e.map(()=>{}):void 0}function Yt(e,t,n){const r=o.watch(e,(a,u,c)=>{a&&(n?.once&&o.nextTick(()=>r()),t(a,u,c))},{...n,once:!1});return r}i.assert=Te,i.autoResetRef=te,i.bypassFilter=I,i.camelize=Ne,i.clamp=Me,i.computedEager=H,i.computedWithControl=G,i.containsProp=x,i.controlledComputed=G,i.controlledRef=Ze,i.createEventHook=de,i.createFilterWrapper=F,i.createGlobalState=me,i.createInjectionState=he,i.createReactiveFn=k,i.createSharedComposable=ye,i.createSingletonPromise=Le,i.debounceFilter=_,i.debouncedRef=W,i.debouncedWatch=le,i.eagerComputed=H,i.extendRef=Z,i.formatDate=ae,i.get=ge,i.getLifeCycleTarget=M,i.hasOwn=Ie,i.hyphenate=Ee,i.identity=je,i.ignorableWatch=Y,i.increaseWithUnit=Ue,i.injectLocal=z,i.invoke=We,i.isClient=D,i.isDef=Oe,i.isDefined=we,i.isIOS=Re,i.isObject=X,i.isWorker=Ae,i.makeDestructurable=Ve,i.noop=A,i.normalizeDate=ue,i.notNullish=Se,i.now=Fe,i.objectEntries=He,i.objectOmit=$e,i.objectPick=Ye,i.pausableFilter=Q,i.pausableWatch=R,i.promiseTimeout=j,i.provideLocal=q,i.pxValue=Be,i.rand=Pe,i.reactify=k,i.reactifyObject=be,i.reactiveComputed=E,i.reactiveOmit=pe,i.reactivePick=ze,i.refAutoReset=te,i.refDebounced=W,i.refDefault=qe,i.refThrottled=U,i.refWithControl=oe,i.resolveRef=Ge,i.resolveUnref=xe,i.set=Je,i.syncRef=Xe,i.syncRefs=Ke,i.throttleFilter=N,i.throttledRef=U,i.throttledWatch=se,i.timestamp=K,i.toArray=ee,i.toReactive=J,i.toRef=L,i.toRefs=Qe,i.toValue=ve,i.tryOnBeforeMount=et,i.tryOnBeforeUnmount=tt,i.tryOnMounted=nt,i.tryOnScopeDispose=p,i.tryOnUnmounted=rt,i.until=ot,i.useArrayDifference=ut,i.useArrayEvery=it,i.useArrayFilter=ct,i.useArrayFind=lt,i.useArrayFindIndex=st,i.useArrayFindLast=dt,i.useArrayIncludes=ht,i.useArrayJoin=yt,i.useArrayMap=gt,i.useArrayReduce=wt,i.useArraySome=Vt,i.useArrayUnique=At,i.useCounter=Ot,i.useDateFormat=Ft,i.useDebounce=W,i.useDebounceFn=ne,i.useInterval=Mt,i.useIntervalFn=ie,i.useLastChanged=Pt,i.useThrottle=U,i.useThrottleFn=re,i.useTimeout=It,i.useTimeoutFn=ce,i.useToNumber=Rt,i.useToString=Ct,i.useToggle=kt,i.watchArray=Et,i.watchAtMost=_t,i.watchDebounced=le,i.watchDeep=Nt,i.watchIgnorable=Y,i.watchImmediate=jt,i.watchOnce=Lt,i.watchPausable=R,i.watchThrottled=se,i.watchTriggerable=Wt,i.watchWithFilter=P,i.whenever=Yt})(this.VueUse=this.VueUse||{},Vue);
|
|
1
|
+
(function(l,o){"use strict";function $(t,e){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),o.readonly(r)}function H(t,e){let n,r,a;const i=o.ref(!0),c=()=>{i.value=!0,a()};o.watch(t,c,{flush:"sync"});const u=typeof e=="function"?e:e.get,s=typeof e=="function"?void 0:e.set,h=o.customRef((m,d)=>(r=m,a=d,{get(){return i.value&&(n=u(n),i.value=!1),r(),n},set(f){s?.(f)}}));return Object.isExtensible(h)&&(h.trigger=c),h}function p(t){return o.getCurrentScope()?(o.onScopeDispose(t),!0):!1}function dt(){const t=new Set,e=i=>{t.delete(i)};return{on:i=>{t.add(i);const c=()=>e(i);return p(c),{off:c}},off:e,trigger:(...i)=>Promise.all(Array.from(t).map(c=>c(...i))),clear:()=>{t.clear()}}}function mt(t){let e=!1,n;const r=o.effectScope(!0);return(...a)=>(e||(n=r.run(()=>t(...a)),e=!0),n)}const S=new WeakMap,G=(...t)=>{var e;const n=t[0],r=(e=o.getCurrentInstance())==null?void 0:e.proxy;if(r==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&S.has(r)&&n in S.get(r)?S.get(r)[n]:o.inject(...t)},Z=(t,e)=>{var n;const r=(n=o.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");S.has(r)||S.set(r,Object.create(null));const a=S.get(r);a[t]=e,o.provide(t,e)};function ht(t,e){const n=e?.injectionKey||Symbol(t.name||"InjectionState"),r=e?.defaultValue;return[(...c)=>{const u=t(...c);return Z(n,u),u},()=>G(n,r)]}function yt(t){let e=0,n,r;const a=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...i)=>(e+=1,r||(r=o.effectScope(!0),n=r.run(()=>t(...i))),p(a),n)}function q(t,e,{enumerable:n=!1,unwrap:r=!0}={}){for(const[a,i]of Object.entries(e))a!=="value"&&(o.isRef(i)&&r?Object.defineProperty(t,a,{get(){return i.value},set(c){i.value=c},enumerable:n}):Object.defineProperty(t,a,{value:i,enumerable:n}));return t}function gt(t,e){return e==null?o.unref(t):o.unref(t)[e]}function wt(t){return o.unref(t)!=null}function Vt(t,e){if(typeof Symbol<"u"){const n={...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 _(t,e){const n=e?.computedGetter===!1?o.unref:o.toValue;return function(...r){return o.computed(()=>t.apply(this,r.map(a=>n(a))))}}function bt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:a=!0}=e;n.push(...Object.keys(t)),a&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(a=>{const i=t[a];return[a,typeof i=="function"?_(i.bind(t),r):i]}))}function J(t){if(!o.isRef(t))return o.reactive(t);const e=new Proxy({},{get(n,r,a){return o.unref(Reflect.get(t.value,r,a))},set(n,r,a){return o.isRef(t.value[r])&&!o.isRef(a)?t.value[r].value=a:t.value[r]=a,!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 o.reactive(e)}function N(t){return J(o.computed(t))}function pt(t,...e){const n=e.flat(),r=n[0];return N(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,i])=>!r(o.toValue(i),a)):Object.entries(o.toRefs(t)).filter(a=>!n.includes(a[0]))))}const F=typeof window<"u"&&typeof document<"u",At=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Ot=t=>typeof t<"u",St=t=>t!=null,Tt=(t,...e)=>{t||console.warn(...e)},Dt=Object.prototype.toString,X=t=>Dt.call(t)==="[object Object]",Ft=()=>Date.now(),K=()=>+Date.now(),Mt=(t,e,n)=>Math.min(n,Math.max(e,t)),A=()=>{},Pt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),It=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Rt=Ct();function Ct(){var t,e;return F&&((t=window?.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window?.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function M(t,e){function n(...r){return new Promise((a,i)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(a).catch(i)})}return n}const R=t=>t();function L(t,e={}){let n,r,a=A;const i=s=>{clearTimeout(s),a(),a=A};let c;return s=>{const h=o.toValue(t),m=o.toValue(e.maxWait);return n&&i(n),h<=0||m!==void 0&&m<=0?(r&&(i(r),r=null),Promise.resolve(s())):new Promise((d,f)=>{a=e.rejectOnCancel?f:d,c=s,m&&!r&&(r=setTimeout(()=>{n&&i(n),r=null,d(c())},m)),n=setTimeout(()=>{r&&i(r),r=null,d(s())},h)})}}function j(...t){let e=0,n,r=!0,a=A,i,c,u,s,h;!o.isRef(t[0])&&typeof t[0]=="object"?{delay:c,trailing:u=!0,leading:s=!0,rejectOnCancel:h=!1}=t[0]:[c,u=!0,s=!0,h=!1]=t;const m=()=>{n&&(clearTimeout(n),n=void 0,a(),a=A)};return f=>{const y=o.toValue(c),w=Date.now()-e,V=()=>i=f();return m(),y<=0?(e=Date.now(),V()):(w>y&&(s||!r)?(e=Date.now(),V()):u&&(i=new Promise((g,b)=>{a=h?b:g,n=setTimeout(()=>{e=Date.now(),r=!0,g(V()),m()},Math.max(0,y-w))})),!s&&!n&&(n=setTimeout(()=>r=!0,y)),r=!1,i)}}function v(t=R,e={}){const{initialState:n="active"}=e,r=C(n==="active");function a(){r.value=!1}function i(){r.value=!0}const c=(...u)=>{r.value&&t(...u)};return{isActive:o.readonly(r),pause:a,resume:i,eventFilter:c}}function Q(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const kt=/\B([A-Z])/g,Et=Q(t=>t.replace(kt,"-$1").toLowerCase()),_t=/-(\w)/g,Nt=Q(t=>t.replace(_t,(e,n)=>n?n.toUpperCase():""));function W(t,e=!1,n="Timeout"){return new Promise((r,a)=>{setTimeout(e?()=>a(n):r,t)})}function Lt(t){return t}function jt(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 Wt(t){return t()}function x(t,...e){return e.some(n=>n in t)}function Ut(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",a=t.slice(r.length),i=Number.parseFloat(r)+e;return Number.isNaN(i)?t:i+a}function zt(t){return t.endsWith("rem")?Number.parseFloat(t)*16:Number.parseFloat(t)}function Bt(t,e,n=!1){return e.reduce((r,a)=>(a in t&&(!n||t[a]!==void 0)&&(r[a]=t[a]),r),{})}function Yt(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,a])=>(!n||a!==void 0)&&!e.includes(r)))}function $t(t){return Object.entries(t)}function P(t){return t||o.getCurrentInstance()}function tt(t){return Array.isArray(t)?t:[t]}function C(...t){if(t.length!==1)return o.toRef(...t);const e=t[0];return typeof e=="function"?o.readonly(o.customRef(()=>({get:e,set:A}))):o.ref(e)}const Ht=C;function Gt(t,...e){const n=e.flat(),r=n[0];return N(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,i])=>r(o.toValue(i),a)):n.map(a=>[a,C(t,a)])))}function et(t,e=1e4){return o.customRef((n,r)=>{let a=o.toValue(t),i;const c=()=>setTimeout(()=>{a=o.toValue(t),r()},o.toValue(e));return p(()=>{clearTimeout(i)}),{get(){return n(),a},set(u){a=u,r(),clearTimeout(i),i=c()}}})}function nt(t,e=200,n={}){return M(L(e,n),t)}function U(t,e=200,n={}){const r=o.ref(t.value),a=nt(()=>{r.value=t.value},e,n);return o.watch(t,()=>a()),r}function Zt(t,e){return o.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function rt(t,e=200,n=!1,r=!0,a=!1){return M(j(e,n,r,a),t)}function z(t,e=200,n=!0,r=!0){if(e<=0)return t;const a=o.ref(t.value),i=rt(()=>{a.value=t.value},e,n,r);return o.watch(t,()=>i()),a}function ot(t,e={}){let n=t,r,a;const i=o.customRef((f,y)=>(r=f,a=y,{get(){return c()},set(w){u(w)}}));function c(f=!0){return f&&r(),n}function u(f,y=!0){var w,V;if(f===n)return;const g=n;((w=e.onBeforeChange)==null?void 0:w.call(e,f,g))!==!1&&(n=f,(V=e.onChanged)==null||V.call(e,f,g),y&&a())}return q(i,{get:c,set:u,untrackedGet:()=>c(!1),silentSet:f=>u(f,!1),peek:()=>c(!1),lay:f=>u(f,!1)},{enumerable:!0})}const qt=ot;function Jt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3){const[e,n,r]=t;e[n]=r}}function I(t,e,n={}){const{eventFilter:r=R,...a}=n;return o.watch(t,M(r,e),a)}function k(t,e,n={}){const{eventFilter:r,initialState:a="active",...i}=n,{eventFilter:c,pause:u,resume:s,isActive:h}=v(r,{initialState:a});return{stop:I(t,e,{...i,eventFilter:c}),pause:u,resume:s,isActive:h}}function Xt(t,e,...[n]){const{flush:r="sync",deep:a=!1,immediate:i=!0,direction:c="both",transform:u={}}=n||{},s=[],h="ltr"in u&&u.ltr||(f=>f),m="rtl"in u&&u.rtl||(f=>f);return(c==="both"||c==="ltr")&&s.push(k(t,f=>{s.forEach(y=>y.pause()),e.value=h(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:i})),(c==="both"||c==="rtl")&&s.push(k(e,f=>{s.forEach(y=>y.pause()),t.value=m(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:i})),()=>{s.forEach(f=>f.stop())}}function Kt(t,e,n={}){const{flush:r="sync",deep:a=!1,immediate:i=!0}=n;return e=tt(e),o.watch(t,c=>e.forEach(u=>u.value=c),{flush:r,deep:a,immediate:i})}function vt(t,e={}){if(!o.isRef(t))return o.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=o.customRef(()=>({get(){return t.value[r]},set(a){var i;if((i=o.toValue(e.replaceRef))!=null?i:!0)if(Array.isArray(t.value)){const u=[...t.value];u[r]=a,t.value=u}else{const u={...t.value,[r]:a};Object.setPrototypeOf(u,Object.getPrototypeOf(t.value)),t.value=u}else t.value[r]=a}}));return n}const Qt=o.toValue,xt=o.toValue;function te(t,e=!0,n){P(n)?o.onBeforeMount(t,n):e?t():o.nextTick(t)}function ee(t,e){P(e)&&o.onBeforeUnmount(t,e)}function ne(t,e=!0,n){P()?o.onMounted(t,n):e?t():o.nextTick(t)}function re(t,e){P(e)&&o.onUnmounted(t,e)}function B(t,e=!1){function n(d,{flush:f="sync",deep:y=!1,timeout:w,throwOnTimeout:V}={}){let g=null;const T=[new Promise(E=>{g=o.watch(t,D=>{d(D)!==e&&(g?g():o.nextTick(()=>g?.()),E(D))},{flush:f,deep:y,immediate:!0})})];return w!=null&&T.push(W(w,V).then(()=>o.toValue(t)).finally(()=>g?.())),Promise.race(T)}function r(d,f){if(!o.isRef(d))return n(D=>D===d,f);const{flush:y="sync",deep:w=!1,timeout:V,throwOnTimeout:g}=f??{};let b=null;const E=[new Promise(D=>{b=o.watch([t,d],([ft,Ye])=>{e!==(ft===Ye)&&(b?b():o.nextTick(()=>b?.()),D(ft))},{flush:y,deep:w,immediate:!0})})];return V!=null&&E.push(W(V,g).then(()=>o.toValue(t)).finally(()=>(b?.(),o.toValue(t)))),Promise.race(E)}function a(d){return n(f=>!!f,d)}function i(d){return r(null,d)}function c(d){return r(void 0,d)}function u(d){return n(Number.isNaN,d)}function s(d,f){return n(y=>{const w=Array.from(y);return w.includes(d)||w.includes(o.toValue(d))},f)}function h(d){return m(1,d)}function m(d=1,f){let y=-1;return n(()=>(y+=1,y>=d),f)}return Array.isArray(o.toValue(t))?{toMatch:n,toContains:s,changed:h,changedTimes:m,get not(){return B(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:a,toBeNull:i,toBeNaN:u,toBeUndefined:c,changed:h,changedTimes:m,get not(){return B(t,!e)}}}function oe(t){return B(t)}function ae(t,e){return t===e}function ie(...t){var e,n;const r=t[0],a=t[1];let i=(e=t[2])!=null?e:ae;const{symmetric:c=!1}=(n=t[3])!=null?n:{};if(typeof i=="string"){const s=i;i=(h,m)=>h[s]===m[s]}const u=o.computed(()=>o.toValue(r).filter(s=>o.toValue(a).findIndex(h=>i(s,h))===-1));if(c){const s=o.computed(()=>o.toValue(a).filter(h=>o.toValue(r).findIndex(m=>i(h,m))===-1));return o.computed(()=>c?[...o.toValue(u),...o.toValue(s)]:o.toValue(u))}else return u}function le(t,e){return o.computed(()=>o.toValue(t).every((n,r,a)=>e(o.toValue(n),r,a)))}function ce(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).filter(e))}function ue(t,e){return o.computed(()=>o.toValue(o.toValue(t).find((n,r,a)=>e(o.toValue(n),r,a))))}function se(t,e){return o.computed(()=>o.toValue(t).findIndex((n,r,a)=>e(o.toValue(n),r,a)))}function fe(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function de(t,e){return o.computed(()=>o.toValue(Array.prototype.findLast?o.toValue(t).findLast((n,r,a)=>e(o.toValue(n),r,a)):fe(o.toValue(t),(n,r,a)=>e(o.toValue(n),r,a))))}function me(t){return X(t)&&x(t,"formIndex","comparator")}function he(...t){var e;const n=t[0],r=t[1];let a=t[2],i=0;if(me(a)&&(i=(e=a.fromIndex)!=null?e:0,a=a.comparator),typeof a=="string"){const c=a;a=(u,s)=>u[c]===o.toValue(s)}return a=a??((c,u)=>c===o.toValue(u)),o.computed(()=>o.toValue(n).slice(i).some((c,u,s)=>a(o.toValue(c),o.toValue(r),u,o.toValue(s))))}function ye(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).join(o.toValue(e)))}function ge(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).map(e))}function we(t,e,...n){const r=(a,i,c)=>e(o.toValue(a),o.toValue(i),c);return o.computed(()=>{const a=o.toValue(t);return n.length?a.reduce(r,typeof n[0]=="function"?o.toValue(n[0]()):o.toValue(n[0])):a.reduce(r)})}function Ve(t,e){return o.computed(()=>o.toValue(t).some((n,r,a)=>e(o.toValue(n),r,a)))}function be(t){return Array.from(new Set(t))}function pe(t,e){return t.reduce((n,r)=>(n.some(a=>e(r,a,t))||n.push(r),n),[])}function Ae(t,e){return o.computed(()=>{const n=o.toValue(t).map(r=>o.toValue(r));return e?pe(n,e):be(n)})}function Oe(t=0,e={}){let n=o.unref(t);const r=o.ref(t),{max:a=Number.POSITIVE_INFINITY,min:i=Number.NEGATIVE_INFINITY}=e,c=(d=1)=>r.value=Math.max(Math.min(a,r.value+d),i),u=(d=1)=>r.value=Math.min(Math.max(i,r.value-d),a),s=()=>r.value,h=d=>r.value=Math.max(i,Math.min(a,d));return{count:r,inc:c,dec:u,get:s,set:h,reset:(d=n)=>(n=d,h(d))}}const Se=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,Te=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;function De(t,e,n,r){let a=t<12?"AM":"PM";return r&&(a=a.split("").reduce((i,c)=>i+=`${c}.`,"")),n?a.toLowerCase():a}function O(t){const e=["th","st","nd","rd"],n=t%100;return t+(e[(n-20)%10]||e[n]||e[0])}function at(t,e,n={}){var r;const a=t.getFullYear(),i=t.getMonth(),c=t.getDate(),u=t.getHours(),s=t.getMinutes(),h=t.getSeconds(),m=t.getMilliseconds(),d=t.getDay(),f=(r=n.customMeridiem)!=null?r:De,y=V=>{var g;return(g=V.split(" ")[1])!=null?g:""},w={Yo:()=>O(a),YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>i+1,Mo:()=>O(i+1),MM:()=>`${i+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"short"}),MMMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"long"}),D:()=>String(c),Do:()=>O(c),DD:()=>`${c}`.padStart(2,"0"),H:()=>String(u),Ho:()=>O(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),ho:()=>O(u%12||12),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(s),mo:()=>O(s),mm:()=>`${s}`.padStart(2,"0"),s:()=>String(h),so:()=>O(h),ss:()=>`${h}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"short"}),dddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"long"}),A:()=>f(u,s),AA:()=>f(u,s,!1,!0),a:()=>f(u,s,!0),aa:()=>f(u,s,!0,!0),z:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zzz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"shortOffset"})),zzzz:()=>y(t.toLocaleDateString(o.toValue(n.locales),{timeZoneName:"longOffset"}))};return e.replace(Te,(V,g)=>{var b,T;return(T=g??((b=w[V])==null?void 0:b.call(w)))!=null?T:V})}function it(t){if(t===null)return new Date(Number.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(Se);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 Fe(t,e="HH:mm:ss",n={}){return o.computed(()=>at(it(o.toValue(t)),o.toValue(e),n))}function lt(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n;let i=null;const c=o.ref(!1);function u(){i&&(clearInterval(i),i=null)}function s(){c.value=!1,u()}function h(){const m=o.toValue(e);m<=0||(c.value=!0,a&&t(),u(),c.value&&(i=setInterval(t,m)))}if(r&&F&&h(),o.isRef(e)||typeof e=="function"){const m=o.watch(e,()=>{c.value&&F&&h()});p(m)}return p(s),{isActive:c,pause:s,resume:h}}function Me(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:a}=e,i=o.ref(0),c=()=>i.value+=1,u=()=>{i.value=0},s=lt(a?()=>{c(),a(i.value)}:c,t,{immediate:r});return n?{counter:i,reset:u,...s}:i}function Pe(t,e={}){var n;const r=o.ref((n=e.initialValue)!=null?n:null);return o.watch(t,()=>r.value=K(),e),r}function ct(t,e,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n,i=o.ref(!1);let c=null;function u(){c&&(clearTimeout(c),c=null)}function s(){i.value=!1,u()}function h(...m){a&&t(),u(),i.value=!0,c=setTimeout(()=>{i.value=!1,c=null,t(...m)},o.toValue(e))}return r&&(i.value=!0,F&&h()),p(s),{isPending:o.readonly(i),start:h,stop:s}}function Ie(t=1e3,e={}){const{controls:n=!1,callback:r}=e,a=ct(r??A,t,e),i=o.computed(()=>!a.isPending.value);return n?{ready:i,...a}:i}function Re(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:a}=e;return o.computed(()=>{let i=o.toValue(t);return typeof n=="function"?i=n(i):typeof i=="string"&&(i=Number[n](i,r)),a&&Number.isNaN(i)&&(i=0),i})}function Ce(t){return o.computed(()=>`${o.toValue(t)}`)}function ke(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,a=o.isRef(t),i=o.ref(t);function c(u){if(arguments.length)return i.value=u,i.value;{const s=o.toValue(n);return i.value=i.value===s?o.toValue(r):s,i.value}}return a?c:[i,c]}function Ee(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:o.toValue(t)];return o.watch(t,(a,i,c)=>{const u=Array.from({length:r.length}),s=[];for(const m of a){let d=!1;for(let f=0;f<r.length;f++)if(!u[f]&&m===r[f]){u[f]=!0,d=!0;break}d||s.push(m)}const h=r.filter((m,d)=>!u[d]);e(a,r,s,h,c),r=[...a]},n)}function _e(t,e,n){const{count:r,...a}=n,i=o.ref(0),c=I(t,(...u)=>{i.value+=1,i.value>=o.toValue(r)&&o.nextTick(()=>c()),e(...u)},a);return{count:i,stop:c}}function ut(t,e,n={}){const{debounce:r=0,maxWait:a=void 0,...i}=n;return I(t,e,{...i,eventFilter:L(r,{maxWait:a})})}function Ne(t,e,n){return o.watch(t,e,{...n,deep:!0})}function Y(t,e,n={}){const{eventFilter:r=R,...a}=n,i=M(r,e);let c,u,s;if(a.flush==="sync"){const h=o.ref(!1);u=()=>{},c=m=>{h.value=!0,m(),h.value=!1},s=o.watch(t,(...m)=>{h.value||i(...m)},a)}else{const h=[],m=o.ref(0),d=o.ref(0);u=()=>{m.value=d.value},h.push(o.watch(t,()=>{d.value++},{...a,flush:"sync"})),c=f=>{const y=d.value;f(),m.value+=d.value-y},h.push(o.watch(t,(...f)=>{const y=m.value>0&&m.value===d.value;m.value=0,d.value=0,!y&&i(...f)},a)),s=()=>{h.forEach(f=>f())}}return{stop:s,ignoreUpdates:c,ignorePrevAsyncUpdates:u}}function Le(t,e,n){return o.watch(t,e,{...n,immediate:!0})}function je(t,e,n){const r=o.watch(t,(...a)=>(o.nextTick(()=>r()),e(...a)),n);return r}function st(t,e,n={}){const{throttle:r=0,trailing:a=!0,leading:i=!0,...c}=n;return I(t,e,{...c,eventFilter:j(r,a,i)})}function We(t,e,n={}){let r;function a(){if(!r)return;const m=r;r=void 0,m()}function i(m){r=m}const c=(m,d)=>(a(),e(m,d,i)),u=Y(t,c,n),{ignoreUpdates:s}=u;return{...u,trigger:()=>{let m;return s(()=>{m=c(Ue(t),ze(t))}),m}}}function Ue(t){return o.isReactive(t)?t:Array.isArray(t)?t.map(e=>o.toValue(e)):o.toValue(t)}function ze(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Be(t,e,n){const r=o.watch(t,(a,i,c)=>{a&&(n?.once&&o.nextTick(()=>r()),e(a,i,c))},{...n,once:!1});return r}l.assert=Tt,l.autoResetRef=et,l.bypassFilter=R,l.camelize=Nt,l.clamp=Mt,l.computedEager=$,l.computedWithControl=H,l.containsProp=x,l.controlledComputed=H,l.controlledRef=qt,l.createEventHook=dt,l.createFilterWrapper=M,l.createGlobalState=mt,l.createInjectionState=ht,l.createReactiveFn=_,l.createSharedComposable=yt,l.createSingletonPromise=jt,l.debounceFilter=L,l.debouncedRef=U,l.debouncedWatch=ut,l.eagerComputed=$,l.extendRef=q,l.formatDate=at,l.get=gt,l.getLifeCycleTarget=P,l.hasOwn=It,l.hyphenate=Et,l.identity=Lt,l.ignorableWatch=Y,l.increaseWithUnit=Ut,l.injectLocal=G,l.invoke=Wt,l.isClient=F,l.isDef=Ot,l.isDefined=wt,l.isIOS=Rt,l.isObject=X,l.isWorker=At,l.makeDestructurable=Vt,l.noop=A,l.normalizeDate=it,l.notNullish=St,l.now=Ft,l.objectEntries=$t,l.objectOmit=Yt,l.objectPick=Bt,l.pausableFilter=v,l.pausableWatch=k,l.promiseTimeout=W,l.provideLocal=Z,l.pxValue=zt,l.rand=Pt,l.reactify=_,l.reactifyObject=bt,l.reactiveComputed=N,l.reactiveOmit=pt,l.reactivePick=Gt,l.refAutoReset=et,l.refDebounced=U,l.refDefault=Zt,l.refThrottled=z,l.refWithControl=ot,l.resolveRef=Ht,l.resolveUnref=xt,l.set=Jt,l.syncRef=Xt,l.syncRefs=Kt,l.throttleFilter=j,l.throttledRef=z,l.throttledWatch=st,l.timestamp=K,l.toArray=tt,l.toReactive=J,l.toRef=C,l.toRefs=vt,l.toValue=Qt,l.tryOnBeforeMount=te,l.tryOnBeforeUnmount=ee,l.tryOnMounted=ne,l.tryOnScopeDispose=p,l.tryOnUnmounted=re,l.until=oe,l.useArrayDifference=ie,l.useArrayEvery=le,l.useArrayFilter=ce,l.useArrayFind=ue,l.useArrayFindIndex=se,l.useArrayFindLast=de,l.useArrayIncludes=he,l.useArrayJoin=ye,l.useArrayMap=ge,l.useArrayReduce=we,l.useArraySome=Ve,l.useArrayUnique=Ae,l.useCounter=Oe,l.useDateFormat=Fe,l.useDebounce=U,l.useDebounceFn=nt,l.useInterval=Me,l.useIntervalFn=lt,l.useLastChanged=Pe,l.useThrottle=z,l.useThrottleFn=rt,l.useTimeout=Ie,l.useTimeoutFn=ct,l.useToNumber=Re,l.useToString=Ce,l.useToggle=ke,l.watchArray=Ee,l.watchAtMost=_e,l.watchDebounced=ut,l.watchDeep=Ne,l.watchIgnorable=Y,l.watchImmediate=Le,l.watchOnce=je,l.watchPausable=k,l.watchThrottled=st,l.watchTriggerable=We,l.watchWithFilter=I,l.whenever=Be})(this.VueUse=this.VueUse||{},Vue);
|