@vueuse/shared 9.0.1 → 9.1.1
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 +35 -14
- package/index.d.ts +61 -21
- package/index.iife.js +37 -15
- package/index.iife.min.js +1 -1
- package/index.mjs +34 -15
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var vueDemi = require('vue-demi');
|
|
6
|
-
var shared = require('@vueuse/shared');
|
|
7
6
|
|
|
8
7
|
var __defProp$9 = Object.defineProperty;
|
|
9
8
|
var __defProps$6 = Object.defineProperties;
|
|
@@ -481,7 +480,7 @@ function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
|
481
480
|
const resetAfter = () => setTimeout(() => {
|
|
482
481
|
value = defaultValue;
|
|
483
482
|
trigger();
|
|
484
|
-
},
|
|
483
|
+
}, resolveUnref(afterMs));
|
|
485
484
|
tryOnScopeDispose(() => {
|
|
486
485
|
clearTimeout(timer);
|
|
487
486
|
});
|
|
@@ -825,39 +824,39 @@ function until(r) {
|
|
|
825
824
|
}
|
|
826
825
|
|
|
827
826
|
function useArrayEvery(list, fn) {
|
|
828
|
-
return vueDemi.computed(() =>
|
|
827
|
+
return vueDemi.computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
829
828
|
}
|
|
830
829
|
|
|
831
830
|
function useArrayFilter(list, fn) {
|
|
832
|
-
return vueDemi.computed(() =>
|
|
831
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).filter(fn));
|
|
833
832
|
}
|
|
834
833
|
|
|
835
834
|
function useArrayFind(list, fn) {
|
|
836
|
-
return vueDemi.computed(() =>
|
|
835
|
+
return vueDemi.computed(() => resolveUnref(resolveUnref(list).find((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
837
836
|
}
|
|
838
837
|
|
|
839
838
|
function useArrayFindIndex(list, fn) {
|
|
840
|
-
return vueDemi.computed(() =>
|
|
839
|
+
return vueDemi.computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
841
840
|
}
|
|
842
841
|
|
|
843
842
|
function useArrayJoin(list, separator) {
|
|
844
|
-
return vueDemi.computed(() =>
|
|
843
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
845
844
|
}
|
|
846
845
|
|
|
847
846
|
function useArrayMap(list, fn) {
|
|
848
|
-
return vueDemi.computed(() =>
|
|
847
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).map(fn));
|
|
849
848
|
}
|
|
850
849
|
|
|
851
850
|
function useArrayReduce(list, reducer, ...args) {
|
|
852
|
-
const reduceCallback = (sum, value, index) => reducer(
|
|
851
|
+
const reduceCallback = (sum, value, index) => reducer(resolveUnref(sum), resolveUnref(value), index);
|
|
853
852
|
return vueDemi.computed(() => {
|
|
854
|
-
const resolved =
|
|
855
|
-
return args.length ? resolved.reduce(reduceCallback,
|
|
853
|
+
const resolved = resolveUnref(list);
|
|
854
|
+
return args.length ? resolved.reduce(reduceCallback, resolveUnref(args[0])) : resolved.reduce(reduceCallback);
|
|
856
855
|
});
|
|
857
856
|
}
|
|
858
857
|
|
|
859
858
|
function useArraySome(list, fn) {
|
|
860
|
-
return vueDemi.computed(() =>
|
|
859
|
+
return vueDemi.computed(() => resolveUnref(list).some((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
861
860
|
}
|
|
862
861
|
|
|
863
862
|
function useCounter(initialValue = 0, options = {}) {
|
|
@@ -929,7 +928,7 @@ const normalizeDate = (date) => {
|
|
|
929
928
|
return new Date(date);
|
|
930
929
|
};
|
|
931
930
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
932
|
-
return vueDemi.computed(() => formatDate(normalizeDate(
|
|
931
|
+
return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
|
|
933
932
|
}
|
|
934
933
|
|
|
935
934
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1037,7 +1036,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1037
1036
|
isPending.value = false;
|
|
1038
1037
|
timer = null;
|
|
1039
1038
|
cb(...args);
|
|
1040
|
-
},
|
|
1039
|
+
}, resolveUnref(interval));
|
|
1041
1040
|
}
|
|
1042
1041
|
if (immediate) {
|
|
1043
1042
|
isPending.value = true;
|
|
@@ -1083,6 +1082,26 @@ function useTimeout(interval = 1e3, options = {}) {
|
|
|
1083
1082
|
}
|
|
1084
1083
|
}
|
|
1085
1084
|
|
|
1085
|
+
function useToNumber(value, options = {}) {
|
|
1086
|
+
const {
|
|
1087
|
+
method = "parseFloat",
|
|
1088
|
+
radix,
|
|
1089
|
+
nanToZero
|
|
1090
|
+
} = options;
|
|
1091
|
+
return vueDemi.computed(() => {
|
|
1092
|
+
let resolved = resolveUnref(value);
|
|
1093
|
+
if (typeof resolved === "string")
|
|
1094
|
+
resolved = Number[method](resolved, radix);
|
|
1095
|
+
if (nanToZero && isNaN(resolved))
|
|
1096
|
+
resolved = 0;
|
|
1097
|
+
return resolved;
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
function useToString(value) {
|
|
1102
|
+
return vueDemi.computed(() => `${resolveUnref(value)}`);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1086
1105
|
function useToggle(initialValue = false, options = {}) {
|
|
1087
1106
|
const {
|
|
1088
1107
|
truthyValue = true,
|
|
@@ -1574,6 +1593,8 @@ exports.useThrottle = refThrottled;
|
|
|
1574
1593
|
exports.useThrottleFn = useThrottleFn;
|
|
1575
1594
|
exports.useTimeout = useTimeout;
|
|
1576
1595
|
exports.useTimeoutFn = useTimeoutFn;
|
|
1596
|
+
exports.useToNumber = useToNumber;
|
|
1597
|
+
exports.useToString = useToString;
|
|
1577
1598
|
exports.useToggle = useToggle;
|
|
1578
1599
|
exports.watchArray = watchArray;
|
|
1579
1600
|
exports.watchAtMost = watchAtMost;
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { WatchOptionsBase, Ref, ComputedRef, WritableComputedRef, WatchSource, ComputedGetter, WritableComputedOptions, ShallowUnwrapRef as ShallowUnwrapRef$1, WatchOptions, UnwrapRef, ToRefs, WatchCallback, WatchStopHandle } from 'vue-demi';
|
|
3
|
-
import { MaybeComputedRef as MaybeComputedRef$1 } from '@vueuse/shared';
|
|
4
3
|
|
|
5
4
|
declare function computedEager<T>(fn: () => T, options?: WatchOptionsBase): Readonly<Ref<T>>;
|
|
6
5
|
|
|
@@ -128,10 +127,18 @@ declare type MaybeRef<T> = T | Ref<T>;
|
|
|
128
127
|
* Maybe it's a ref, or a plain value, or a getter function
|
|
129
128
|
*
|
|
130
129
|
* ```ts
|
|
131
|
-
* type MaybeComputedRef<T> = T | Ref<T> |
|
|
130
|
+
* type MaybeComputedRef<T> = (() => T) | T | Ref<T> | ComputedRef<T>
|
|
132
131
|
* ```
|
|
133
132
|
*/
|
|
134
|
-
declare type MaybeComputedRef<T> = T
|
|
133
|
+
declare type MaybeComputedRef<T> = MaybeReadonlyRef<T> | MaybeRef<T>;
|
|
134
|
+
/**
|
|
135
|
+
* Maybe it's a computed ref, or a getter function
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
declare type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T>;
|
|
135
142
|
/**
|
|
136
143
|
* Make all the nested attributes of an object or array to MaybeRef<T>
|
|
137
144
|
*
|
|
@@ -238,7 +245,7 @@ declare const bypassFilter: EventFilter;
|
|
|
238
245
|
* Create an EventFilter that debounce the events
|
|
239
246
|
*
|
|
240
247
|
* @param ms
|
|
241
|
-
* @param
|
|
248
|
+
* @param options
|
|
242
249
|
*/
|
|
243
250
|
declare function debounceFilter(ms: MaybeComputedRef<number>, options?: DebounceFilterOptions): EventFilter<any[], any>;
|
|
244
251
|
/**
|
|
@@ -384,7 +391,7 @@ declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...ke
|
|
|
384
391
|
* @param defaultValue The value which will be set.
|
|
385
392
|
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
386
393
|
*/
|
|
387
|
-
declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeComputedRef
|
|
394
|
+
declare function refAutoReset<T>(defaultValue: T, afterMs?: MaybeComputedRef<number>): Ref<T>;
|
|
388
395
|
|
|
389
396
|
/**
|
|
390
397
|
* Debounce updates of a ref.
|
|
@@ -641,7 +648,7 @@ declare function until<T>(r: WatchSource<T> | MaybeComputedRef<T>): UntilValueIn
|
|
|
641
648
|
*
|
|
642
649
|
* @returns {boolean} **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
|
|
643
650
|
*/
|
|
644
|
-
declare function useArrayEvery<T>(list: MaybeComputedRef
|
|
651
|
+
declare function useArrayEvery<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<boolean>;
|
|
645
652
|
|
|
646
653
|
/**
|
|
647
654
|
* Reactive `Array.filter`
|
|
@@ -652,7 +659,7 @@ declare function useArrayEvery<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>
|
|
|
652
659
|
*
|
|
653
660
|
* @returns {Array} a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
|
|
654
661
|
*/
|
|
655
|
-
declare function useArrayFilter<T>(list: MaybeComputedRef
|
|
662
|
+
declare function useArrayFilter<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => boolean): ComputedRef<T[]>;
|
|
656
663
|
|
|
657
664
|
/**
|
|
658
665
|
* Reactive `Array.find`
|
|
@@ -663,7 +670,7 @@ declare function useArrayFilter<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T
|
|
|
663
670
|
*
|
|
664
671
|
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
665
672
|
*/
|
|
666
|
-
declare function useArrayFind<T>(list: MaybeComputedRef
|
|
673
|
+
declare function useArrayFind<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
667
674
|
|
|
668
675
|
/**
|
|
669
676
|
* Reactive `Array.findIndex`
|
|
@@ -674,7 +681,7 @@ declare function useArrayFind<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[
|
|
|
674
681
|
*
|
|
675
682
|
* @returns {number} the index of the first element in the array that passes the test. Otherwise, "-1".
|
|
676
683
|
*/
|
|
677
|
-
declare function useArrayFindIndex<T>(list: MaybeComputedRef
|
|
684
|
+
declare function useArrayFindIndex<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<number>;
|
|
678
685
|
|
|
679
686
|
/**
|
|
680
687
|
* Reactive `Array.join`
|
|
@@ -685,7 +692,7 @@ declare function useArrayFindIndex<T>(list: MaybeComputedRef$1<MaybeComputedRef$
|
|
|
685
692
|
*
|
|
686
693
|
* @returns {string} a string with all array elements joined. If arr.length is 0, the empty string is returned.
|
|
687
694
|
*/
|
|
688
|
-
declare function useArrayJoin(list: MaybeComputedRef
|
|
695
|
+
declare function useArrayJoin(list: MaybeComputedRef<MaybeComputedRef<any>[]>, separator?: MaybeComputedRef<string>): ComputedRef<string>;
|
|
689
696
|
|
|
690
697
|
/**
|
|
691
698
|
* Reactive `Array.map`
|
|
@@ -696,7 +703,7 @@ declare function useArrayJoin(list: MaybeComputedRef$1<MaybeComputedRef$1<any>[]
|
|
|
696
703
|
*
|
|
697
704
|
* @returns {Array} a new array with each element being the result of the callback function.
|
|
698
705
|
*/
|
|
699
|
-
declare function useArrayMap<T>(list: MaybeComputedRef
|
|
706
|
+
declare function useArrayMap<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: T[]) => T): ComputedRef<T[]>;
|
|
700
707
|
|
|
701
708
|
declare type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
702
709
|
/**
|
|
@@ -708,7 +715,7 @@ declare type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV,
|
|
|
708
715
|
*
|
|
709
716
|
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
710
717
|
*/
|
|
711
|
-
declare function useArrayReduce<T>(list: MaybeComputedRef
|
|
718
|
+
declare function useArrayReduce<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
|
|
712
719
|
/**
|
|
713
720
|
* Reactive `Array.reduce`
|
|
714
721
|
*
|
|
@@ -719,7 +726,7 @@ declare function useArrayReduce<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T
|
|
|
719
726
|
*
|
|
720
727
|
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
721
728
|
*/
|
|
722
|
-
declare function useArrayReduce<T, U>(list: MaybeComputedRef
|
|
729
|
+
declare function useArrayReduce<T, U>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeComputedRef<U>): ComputedRef<U>;
|
|
723
730
|
|
|
724
731
|
/**
|
|
725
732
|
* Reactive `Array.some`
|
|
@@ -730,7 +737,7 @@ declare function useArrayReduce<T, U>(list: MaybeComputedRef$1<MaybeComputedRef$
|
|
|
730
737
|
*
|
|
731
738
|
* @returns {boolean} **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
|
|
732
739
|
*/
|
|
733
|
-
declare function useArraySome<T>(list: MaybeComputedRef
|
|
740
|
+
declare function useArraySome<T>(list: MaybeComputedRef<MaybeComputedRef<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef<T>[]) => unknown): ComputedRef<boolean>;
|
|
734
741
|
|
|
735
742
|
interface UseCounterOptions {
|
|
736
743
|
min?: number;
|
|
@@ -771,7 +778,7 @@ declare const normalizeDate: (date: DateLike) => Date;
|
|
|
771
778
|
* @param formatStr
|
|
772
779
|
* @param options
|
|
773
780
|
*/
|
|
774
|
-
declare function useDateFormat(date: MaybeComputedRef
|
|
781
|
+
declare function useDateFormat(date: MaybeComputedRef<DateLike>, formatStr?: MaybeComputedRef<string>, options?: UseDateFormatOptions): vue_demi.ComputedRef<string>;
|
|
775
782
|
declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
776
783
|
|
|
777
784
|
/**
|
|
@@ -784,7 +791,7 @@ declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
|
784
791
|
*
|
|
785
792
|
* @return A new, debounce, function.
|
|
786
793
|
*/
|
|
787
|
-
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef
|
|
794
|
+
declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeComputedRef<number>, options?: DebounceFilterOptions): T;
|
|
788
795
|
|
|
789
796
|
interface UseIntervalOptions<Controls extends boolean> {
|
|
790
797
|
/**
|
|
@@ -794,7 +801,7 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
794
801
|
*/
|
|
795
802
|
controls?: Controls;
|
|
796
803
|
/**
|
|
797
|
-
*
|
|
804
|
+
* Execute the update immediately on calling
|
|
798
805
|
*
|
|
799
806
|
* @default true
|
|
800
807
|
*/
|
|
@@ -804,6 +811,8 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
804
811
|
* Reactive counter increases on every interval
|
|
805
812
|
*
|
|
806
813
|
* @see https://vueuse.org/useInterval
|
|
814
|
+
* @param interval
|
|
815
|
+
* @param options
|
|
807
816
|
*/
|
|
808
817
|
declare function useInterval(interval?: MaybeComputedRef<number>, options?: UseIntervalOptions<false>): Ref<number>;
|
|
809
818
|
declare function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>): {
|
|
@@ -874,9 +883,9 @@ interface UseTimeoutFnOptions {
|
|
|
874
883
|
*
|
|
875
884
|
* @param cb
|
|
876
885
|
* @param interval
|
|
877
|
-
* @param
|
|
886
|
+
* @param options
|
|
878
887
|
*/
|
|
879
|
-
declare function useTimeoutFn(cb: (...args: unknown[]) => any, interval: MaybeComputedRef
|
|
888
|
+
declare function useTimeoutFn(cb: (...args: unknown[]) => any, interval: MaybeComputedRef<number>, options?: UseTimeoutFnOptions): Stoppable;
|
|
880
889
|
|
|
881
890
|
interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
|
|
882
891
|
/**
|
|
@@ -891,13 +900,44 @@ interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOption
|
|
|
891
900
|
*
|
|
892
901
|
* @see {@link https://vueuse.org/useTimeout}
|
|
893
902
|
* @param interval
|
|
894
|
-
* @param
|
|
903
|
+
* @param options
|
|
895
904
|
*/
|
|
896
905
|
declare function useTimeout(interval?: number, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
|
|
897
906
|
declare function useTimeout(interval: number, options: UseTimeoutOptions<true>): {
|
|
898
907
|
ready: ComputedRef<boolean>;
|
|
899
908
|
} & Stoppable;
|
|
900
909
|
|
|
910
|
+
interface UseToNumberOptions {
|
|
911
|
+
/**
|
|
912
|
+
* Method to use to convert the value to a number.
|
|
913
|
+
*
|
|
914
|
+
* @default 'parseFloat'
|
|
915
|
+
*/
|
|
916
|
+
method?: 'parseFloat' | 'parseInt';
|
|
917
|
+
/**
|
|
918
|
+
* The base in mathematical numeral systems passed to `parseInt`.
|
|
919
|
+
* Only works with `method: 'parseInt'`
|
|
920
|
+
*/
|
|
921
|
+
radix?: number;
|
|
922
|
+
/**
|
|
923
|
+
* Replace NaN with zero
|
|
924
|
+
*
|
|
925
|
+
* @default false
|
|
926
|
+
*/
|
|
927
|
+
nanToZero?: boolean;
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Computed reactive object.
|
|
931
|
+
*/
|
|
932
|
+
declare function useToNumber(value: MaybeComputedRef<number | string>, options?: UseToNumberOptions): ComputedRef<number>;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Reactively convert a ref to string.
|
|
936
|
+
*
|
|
937
|
+
* @see https://vueuse.org/useToString
|
|
938
|
+
*/
|
|
939
|
+
declare function useToString(value: MaybeComputedRef<unknown>): ComputedRef<string>;
|
|
940
|
+
|
|
901
941
|
interface UseToggleOptions<Truthy, Falsy> {
|
|
902
942
|
truthyValue?: MaybeComputedRef<Truthy>;
|
|
903
943
|
falsyValue?: MaybeComputedRef<Falsy>;
|
|
@@ -982,4 +1022,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
|
|
|
982
1022
|
*/
|
|
983
1023
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
|
|
984
1024
|
|
|
985
|
-
export { ArgumentsType, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeRef, Pausable, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
|
1025
|
+
export { ArgumentsType, Awaitable, ComputedRefWithControl, ComputedWithControlRefExtra, ConfigurableEventFilter, ConfigurableFlush, ConfigurableFlushSync, ControlledRefOptions, CreateGlobalStateReturn, DateLike, DebounceFilterOptions, DeepMaybeRef, ElementOf, EventFilter, EventHook, EventHookOff, EventHookOn, EventHookTrigger, ExtendRefOptions, Fn, FunctionArgs, FunctionWrapperOptions, IgnoredUpdater, MapOldSources, MapSources, MaybeComputedRef, MaybeReadonlyRef, MaybeRef, Pausable, Reactified, ReactifyNested, ReactifyObjectOptions, ReactifyOptions, RemovableRef, RemoveableRef, ShallowUnwrapRef, SingletonPromiseReturn, Stopable, Stoppable, SyncRefOptions, SyncRefsOptions, UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, UseArrayReducer, UseCounterOptions, UseDateFormatOptions, UseDateFormatReturn, UseIntervalFnOptions, UseIntervalOptions, UseLastChangedOptions, UseTimeoutFnOptions, UseTimeoutOptions, UseToNumberOptions, UseToggleOptions, WatchArrayCallback, WatchAtMostOptions, WatchAtMostReturn, WatchDebouncedOptions, WatchIgnorableReturn, WatchPausableReturn, WatchThrottledOptions, WatchTriggerableCallback, WatchTriggerableReturn, WatchWithFilterOptions, WritableComputedRefWithControl, __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
package/index.iife.js
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
this.VueCompositionAPI || (typeof VueCompositionAPI !== "undefined" ? VueCompositionAPI : undefined)
|
|
72
72
|
);
|
|
73
73
|
;
|
|
74
|
-
;(function (exports, vueDemi
|
|
74
|
+
;(function (exports, vueDemi) {
|
|
75
75
|
'use strict';
|
|
76
76
|
|
|
77
77
|
var __defProp$9 = Object.defineProperty;
|
|
@@ -550,7 +550,7 @@
|
|
|
550
550
|
const resetAfter = () => setTimeout(() => {
|
|
551
551
|
value = defaultValue;
|
|
552
552
|
trigger();
|
|
553
|
-
},
|
|
553
|
+
}, resolveUnref(afterMs));
|
|
554
554
|
tryOnScopeDispose(() => {
|
|
555
555
|
clearTimeout(timer);
|
|
556
556
|
});
|
|
@@ -894,39 +894,39 @@
|
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
function useArrayEvery(list, fn) {
|
|
897
|
-
return vueDemi.computed(() =>
|
|
897
|
+
return vueDemi.computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
898
898
|
}
|
|
899
899
|
|
|
900
900
|
function useArrayFilter(list, fn) {
|
|
901
|
-
return vueDemi.computed(() =>
|
|
901
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).filter(fn));
|
|
902
902
|
}
|
|
903
903
|
|
|
904
904
|
function useArrayFind(list, fn) {
|
|
905
|
-
return vueDemi.computed(() =>
|
|
905
|
+
return vueDemi.computed(() => resolveUnref(resolveUnref(list).find((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
906
906
|
}
|
|
907
907
|
|
|
908
908
|
function useArrayFindIndex(list, fn) {
|
|
909
|
-
return vueDemi.computed(() =>
|
|
909
|
+
return vueDemi.computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
910
910
|
}
|
|
911
911
|
|
|
912
912
|
function useArrayJoin(list, separator) {
|
|
913
|
-
return vueDemi.computed(() =>
|
|
913
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
function useArrayMap(list, fn) {
|
|
917
|
-
return vueDemi.computed(() =>
|
|
917
|
+
return vueDemi.computed(() => resolveUnref(list).map((i) => resolveUnref(i)).map(fn));
|
|
918
918
|
}
|
|
919
919
|
|
|
920
920
|
function useArrayReduce(list, reducer, ...args) {
|
|
921
|
-
const reduceCallback = (sum, value, index) => reducer(
|
|
921
|
+
const reduceCallback = (sum, value, index) => reducer(resolveUnref(sum), resolveUnref(value), index);
|
|
922
922
|
return vueDemi.computed(() => {
|
|
923
|
-
const resolved =
|
|
924
|
-
return args.length ? resolved.reduce(reduceCallback,
|
|
923
|
+
const resolved = resolveUnref(list);
|
|
924
|
+
return args.length ? resolved.reduce(reduceCallback, resolveUnref(args[0])) : resolved.reduce(reduceCallback);
|
|
925
925
|
});
|
|
926
926
|
}
|
|
927
927
|
|
|
928
928
|
function useArraySome(list, fn) {
|
|
929
|
-
return vueDemi.computed(() =>
|
|
929
|
+
return vueDemi.computed(() => resolveUnref(list).some((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
930
930
|
}
|
|
931
931
|
|
|
932
932
|
function useCounter(initialValue = 0, options = {}) {
|
|
@@ -998,7 +998,7 @@
|
|
|
998
998
|
return new Date(date);
|
|
999
999
|
};
|
|
1000
1000
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
1001
|
-
return vueDemi.computed(() => formatDate(normalizeDate(
|
|
1001
|
+
return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
1004
1004
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1106,7 +1106,7 @@
|
|
|
1106
1106
|
isPending.value = false;
|
|
1107
1107
|
timer = null;
|
|
1108
1108
|
cb(...args);
|
|
1109
|
-
},
|
|
1109
|
+
}, resolveUnref(interval));
|
|
1110
1110
|
}
|
|
1111
1111
|
if (immediate) {
|
|
1112
1112
|
isPending.value = true;
|
|
@@ -1152,6 +1152,26 @@
|
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
|
+
function useToNumber(value, options = {}) {
|
|
1156
|
+
const {
|
|
1157
|
+
method = "parseFloat",
|
|
1158
|
+
radix,
|
|
1159
|
+
nanToZero
|
|
1160
|
+
} = options;
|
|
1161
|
+
return vueDemi.computed(() => {
|
|
1162
|
+
let resolved = resolveUnref(value);
|
|
1163
|
+
if (typeof resolved === "string")
|
|
1164
|
+
resolved = Number[method](resolved, radix);
|
|
1165
|
+
if (nanToZero && isNaN(resolved))
|
|
1166
|
+
resolved = 0;
|
|
1167
|
+
return resolved;
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
function useToString(value) {
|
|
1172
|
+
return vueDemi.computed(() => `${resolveUnref(value)}`);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1155
1175
|
function useToggle(initialValue = false, options = {}) {
|
|
1156
1176
|
const {
|
|
1157
1177
|
truthyValue = true,
|
|
@@ -1643,6 +1663,8 @@
|
|
|
1643
1663
|
exports.useThrottleFn = useThrottleFn;
|
|
1644
1664
|
exports.useTimeout = useTimeout;
|
|
1645
1665
|
exports.useTimeoutFn = useTimeoutFn;
|
|
1666
|
+
exports.useToNumber = useToNumber;
|
|
1667
|
+
exports.useToString = useToString;
|
|
1646
1668
|
exports.useToggle = useToggle;
|
|
1647
1669
|
exports.watchArray = watchArray;
|
|
1648
1670
|
exports.watchAtMost = watchAtMost;
|
|
@@ -1657,4 +1679,4 @@
|
|
|
1657
1679
|
|
|
1658
1680
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1659
1681
|
|
|
1660
|
-
})(this.VueUse = this.VueUse || {}, VueDemi
|
|
1682
|
+
})(this.VueUse = this.VueUse || {}, VueDemi);
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(o,i,y){if(o.install)return o;if(i)if(i.version.slice(0,4)==="2.7."){for(var g in i)o[g]=i[g];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else if(i.version.slice(0,2)==="2.")if(y){for(var g in y)o[g]=y[g];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(i.version.slice(0,2)==="3."){for(var g in i)o[g]=i[g];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=i,o.Vue2=void 0,o.version=i.version,o.set=function(h,m,b){return Array.isArray(h)?(h.length=Math.max(h.length,m),h.splice(m,1,b),b):(h[m]=b,b)},o.del=function(h,m){if(Array.isArray(h)){h.splice(m,1);return}delete h[m]}}else console.error("[vue-demi] Vue version "+i.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,i,y){"use strict";var g=Object.defineProperty,h=Object.defineProperties,m=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,Ye=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,J=(e,t,r)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ke=(e,t)=>{for(var r in t||(t={}))Ye.call(t,r)&&J(e,r,t[r]);if(b)for(var r of b(t))Ge.call(t,r)&&J(e,r,t[r]);return e},ze=(e,t)=>h(e,m(t));function X(e,t){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=e()},ze(ke({},t),{flush:(r=t==null?void 0:t.flush)!=null?r:"sync"})),i.readonly(n)}var Z;const I=typeof window!="undefined",Ve=e=>typeof e!="undefined",Je=(e,...t)=>{e||console.warn(...t)},q=Object.prototype.toString,Xe=e=>typeof e=="boolean",W=e=>typeof e=="function",Ze=e=>typeof e=="number",qe=e=>typeof e=="string",Ke=e=>q.call(e)==="[object Object]",Qe=e=>typeof window!="undefined"&&q.call(e)==="[object Window]",De=()=>Date.now(),K=()=>+Date.now(),xe=(e,t,r)=>Math.min(r,Math.max(t,e)),Q=()=>{},et=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),tt=I&&((Z=window==null?void 0:window.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function w(e){return typeof e=="function"?e():i.unref(e)}function F(e,t){function r(...n){e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})}return r}const T=e=>e();function B(e,t={}){let r,n;return l=>{const u=w(e),c=w(t.maxWait);if(r&&clearTimeout(r),u<=0||c!==void 0&&c<=0)return n&&(clearTimeout(n),n=null),l();c&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,l()},c)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,l()},u)}}function H(e,t=!0,r=!0){let n=0,a,l=!0;const u=()=>{a&&(clearTimeout(a),a=void 0)};return p=>{const v=w(e),f=Date.now()-n;if(u(),v<=0)return n=Date.now(),p();f>v&&(r||!l)?(n=Date.now(),p()):t&&(a=setTimeout(()=>{n=Date.now(),l=!0,u(),p()},v)),!r&&!a&&(a=setTimeout(()=>l=!0,v)),l=!1}}function D(e=T){const t=i.ref(!0);function r(){t.value=!1}function n(){t.value=!0}return{isActive:t,pause:r,resume:n,eventFilter:(...l)=>{t.value&&e(...l)}}}function x(e="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${e} is only works on Vue 3.`)}const rt={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function L(e,t=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(t?()=>a(r):n,e)})}function nt(e){return e}function ot(e){let t;function r(){return t||(t=e()),t}return r.reset=async()=>{const n=t;t=void 0,n&&await n},r}function at(e){return e()}function it(e,...t){return t.some(r=>r in e)}function lt(e,t){var r;if(typeof e=="number")return e+t;const n=((r=e.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:r[0])||"",a=e.slice(n.length),l=parseFloat(n)+t;return Number.isNaN(l)?e:l+a}function ut(e,t,r=!1){return t.reduce((n,a)=>(a in e&&(!r||e[a]!==void 0)&&(n[a]=e[a]),n),{})}function ee(e,t){let r,n,a;const l=i.ref(!0),u=()=>{l.value=!0,a()};i.watch(e,u,{flush:"sync"});const c=W(t)?t:t.get,p=W(t)?void 0:t.set,v=i.customRef((f,s)=>(n=f,a=s,{get(){return l.value&&(r=c(),l.value=!1),n(),r},set(d){p==null||p(d)}}));return Object.isExtensible(v)&&(v.trigger=u),v}function ct(){const e=[],t=a=>{const l=e.indexOf(a);l!==-1&&e.splice(l,1)};return{on:a=>(e.push(a),{off:()=>t(a)}),off:t,trigger:a=>{e.forEach(l=>l(a))}}}function st(e){let t=!1,r;const n=i.effectScope(!0);return()=>(t||(r=n.run(e),t=!0),r)}function ft(e){const t=Symbol("InjectionState");return[(...a)=>{i.provide(t,e(...a))},()=>i.inject(t)]}function S(e){return i.getCurrentScope()?(i.onScopeDispose(e),!0):!1}function dt(e){let t=0,r,n;const a=()=>{t-=1,n&&t<=0&&(n.stop(),r=void 0,n=void 0)};return(...l)=>(t+=1,r||(n=i.effectScope(!0),r=n.run(()=>e(...l))),S(a),r)}function te(e,t,{enumerable:r=!1,unwrap:n=!0}={}){x();for(const[a,l]of Object.entries(t))a!=="value"&&(i.isRef(l)&&n?Object.defineProperty(e,a,{get(){return l.value},set(u){l.value=u},enumerable:r}):Object.defineProperty(e,a,{value:l,enumerable:r}));return e}function pt(e,t){return t==null?i.unref(e):i.unref(e)[t]}function vt(e){return i.unref(e)!=null}var yt=Object.defineProperty,re=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,ne=(e,t,r)=>t in e?yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wt=(e,t)=>{for(var r in t||(t={}))_t.call(t,r)&&ne(e,r,t[r]);if(re)for(var r of re(t))Ot.call(t,r)&&ne(e,r,t[r]);return e};function ht(e,t){if(typeof Symbol!="undefined"){const r=wt({},e);return Object.defineProperty(r,Symbol.iterator,{enumerable:!1,value(){let n=0;return{next:()=>({value:t[n++],done:n>t.length})}}}),r}else return Object.assign([...t],e)}function Y(e,t){const r=(t==null?void 0:t.computedGetter)===!1?i.unref:w;return function(...n){return i.computed(()=>e.apply(this,n.map(a=>r(a))))}}function gt(e,t={}){let r=[],n;if(Array.isArray(t))r=t;else{n=t;const{includeOwnProperties:a=!0}=t;r.push(...Object.keys(e)),a&&r.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(r.map(a=>{const l=e[a];return[a,typeof l=="function"?Y(l.bind(e),n):l]}))}function oe(e){if(!i.isRef(e))return i.reactive(e);const t=new Proxy({},{get(r,n,a){return i.unref(Reflect.get(e.value,n,a))},set(r,n,a){return i.isRef(e.value[n])&&!i.isRef(a)?e.value[n].value=a:e.value[n]=a,!0},deleteProperty(r,n){return Reflect.deleteProperty(e.value,n)},has(r,n){return Reflect.has(e.value,n)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return i.reactive(t)}function ae(e){return oe(i.computed(e))}function Pt(e,...t){const r=t.flat();return ae(()=>Object.fromEntries(Object.entries(i.toRefs(e)).filter(n=>!r.includes(n[0]))))}function mt(e,...t){const r=t.flat();return i.reactive(Object.fromEntries(r.map(n=>[n,i.toRef(e,n)])))}function ie(e,t=1e4){return i.customRef((r,n)=>{let a=e,l;const u=()=>setTimeout(()=>{a=e,n()},y.resolveUnref(t));return S(()=>{clearTimeout(l)}),{get(){return r(),a},set(c){a=c,n(),clearTimeout(l),l=u()}}})}function le(e,t=200,r={}){return F(B(t,r),e)}function G(e,t=200,r={}){if(t<=0)return e;const n=i.ref(e.value),a=le(()=>{n.value=e.value},t,r);return i.watch(e,()=>a()),n}function bt(e,t){return i.computed({get(){var r;return(r=e.value)!=null?r:t},set(r){e.value=r}})}function ue(e,t=200,r=!1,n=!0){return F(H(t,r,n),e)}function k(e,t=200,r=!0,n=!0){if(t<=0)return e;const a=i.ref(e.value),l=ue(()=>{a.value=e.value},t,r,n);return i.watch(e,()=>l()),a}function ce(e,t={}){let r=e,n,a;const l=i.customRef((d,O)=>(n=d,a=O,{get(){return u()},set(_){c(_)}}));function u(d=!0){return d&&n(),r}function c(d,O=!0){var _,$;if(d===r)return;const P=r;((_=t.onBeforeChange)==null?void 0:_.call(t,d,P))!==!1&&(r=d,($=t.onChanged)==null||$.call(t,d,P),O&&a())}return te(l,{get:u,set:c,untrackedGet:()=>u(!1),silentSet:d=>c(d,!1),peek:()=>u(!1),lay:d=>c(d,!1)},{enumerable:!0})}const $t=ce;function St(e){return typeof e=="function"?i.computed(e):i.ref(e)}function At(...e){if(e.length===2){const[t,r]=e;t.value=r}if(e.length===3)if(i.isVue2)i.set(...e);else{const[t,r,n]=e;t[r]=n}}function jt(e,t,r={}){var n,a;const{flush:l="sync",deep:u=!1,immediate:c=!0,direction:p="both",transform:v={}}=r;let f,s;const d=(n=v.ltr)!=null?n:_=>_,O=(a=v.rtl)!=null?a:_=>_;return(p==="both"||p==="ltr")&&(f=i.watch(e,_=>t.value=d(_),{flush:l,deep:u,immediate:c})),(p==="both"||p==="rtl")&&(s=i.watch(t,_=>e.value=O(_),{flush:l,deep:u,immediate:c})),()=>{f==null||f(),s==null||s()}}function It(e,t,r={}){const{flush:n="sync",deep:a=!1,immediate:l=!0}=r;return Array.isArray(t)||(t=[t]),i.watch(e,u=>t.forEach(c=>c.value=u),{flush:n,deep:a,immediate:l})}var Ft=Object.defineProperty,Et=Object.defineProperties,Tt=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertySymbols,Ut=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,fe=(e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ct=(e,t)=>{for(var r in t||(t={}))Ut.call(t,r)&&fe(e,r,t[r]);if(se)for(var r of se(t))Rt.call(t,r)&&fe(e,r,t[r]);return e},Mt=(e,t)=>Et(e,Tt(t));function Nt(e){if(!i.isRef(e))return i.toRefs(e);const t=Array.isArray(e.value)?new Array(e.value.length):{};for(const r in e.value)t[r]=i.customRef(()=>({get(){return e.value[r]},set(n){if(Array.isArray(e.value)){const a=[...e.value];a[r]=n,e.value=a}else{const a=Mt(Ct({},e.value),{[r]:n});Object.setPrototypeOf(a,e.value),e.value=a}}}));return t}function Wt(e,t=!0){i.getCurrentInstance()?i.onBeforeMount(e):t?e():i.nextTick(e)}function Bt(e){i.getCurrentInstance()&&i.onBeforeUnmount(e)}function Ht(e,t=!0){i.getCurrentInstance()?i.onMounted(e):t?e():i.nextTick(e)}function Lt(e){i.getCurrentInstance()&&i.onUnmounted(e)}function Yt(e){let t=!1;function r(s,{flush:d="sync",deep:O=!1,timeout:_,throwOnTimeout:$}={}){let P=null;const V=[new Promise(N=>{P=i.watch(e,j=>{s(j)!==t&&(P==null||P(),N(j))},{flush:d,deep:O,immediate:!0})})];return _!=null&&V.push(L(_,$).then(()=>w(e)).finally(()=>P==null?void 0:P())),Promise.race(V)}function n(s,d){if(!i.isRef(s))return r(j=>j===s,d);const{flush:O="sync",deep:_=!1,timeout:$,throwOnTimeout:P}=d??{};let A=null;const N=[new Promise(j=>{A=i.watch([e,s],([Le,rn])=>{t!==(Le===rn)&&(A==null||A(),j(Le))},{flush:O,deep:_,immediate:!0})})];return $!=null&&N.push(L($,P).then(()=>w(e)).finally(()=>(A==null||A(),w(e)))),Promise.race(N)}function a(s){return r(d=>Boolean(d),s)}function l(s){return n(null,s)}function u(s){return n(void 0,s)}function c(s){return r(Number.isNaN,s)}function p(s,d){return r(O=>{const _=Array.from(O);return _.includes(s)||_.includes(w(s))},d)}function v(s){return f(1,s)}function f(s=1,d){let O=-1;return r(()=>(O+=1,O>=s),d)}return Array.isArray(w(e))?{toMatch:r,toContains:p,changed:v,changedTimes:f,get not(){return t=!t,this}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:l,toBeNaN:c,toBeUndefined:u,changed:v,changedTimes:f,get not(){return t=!t,this}}}function Gt(e,t){return i.computed(()=>y.resolveUnref(e).every((r,n,a)=>t(y.resolveUnref(r),n,a)))}function kt(e,t){return i.computed(()=>y.resolveUnref(e).map(r=>y.resolveUnref(r)).filter(t))}function zt(e,t){return i.computed(()=>y.resolveUnref(y.resolveUnref(e).find((r,n,a)=>t(y.resolveUnref(r),n,a))))}function Vt(e,t){return i.computed(()=>y.resolveUnref(e).findIndex((r,n,a)=>t(y.resolveUnref(r),n,a)))}function Jt(e,t){return i.computed(()=>y.resolveUnref(e).map(r=>y.resolveUnref(r)).join(y.resolveUnref(t)))}function Xt(e,t){return i.computed(()=>y.resolveUnref(e).map(r=>y.resolveUnref(r)).map(t))}function Zt(e,t,...r){const n=(a,l,u)=>t(y.resolveUnref(a),y.resolveUnref(l),u);return i.computed(()=>{const a=y.resolveUnref(e);return r.length?a.reduce(n,y.resolveUnref(r[0])):a.reduce(n)})}function qt(e,t){return i.computed(()=>y.resolveUnref(e).some((r,n,a)=>t(y.resolveUnref(r),n,a)))}function Kt(e=0,t={}){const r=i.ref(e),{max:n=1/0,min:a=-1/0}=t,l=(f=1)=>r.value=Math.min(n,r.value+f),u=(f=1)=>r.value=Math.max(a,r.value-f),c=()=>r.value,p=f=>r.value=f;return{count:r,inc:l,dec:u,get:c,set:p,reset:(f=e)=>(e=f,p(f))}}const Qt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Dt=/\[([^\]]+)]|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,de=(e,t,r)=>{const n=e.getFullYear(),a=e.getMonth(),l=e.getDate(),u=e.getHours(),c=e.getMinutes(),p=e.getSeconds(),v=e.getMilliseconds(),f=e.getDay(),s={YY:()=>String(n).slice(-2),YYYY:()=>n,M:()=>a+1,MM:()=>`${a+1}`.padStart(2,"0"),D:()=>String(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(c),mm:()=>`${c}`.padStart(2,"0"),s:()=>String(p),ss:()=>`${p}`.padStart(2,"0"),SSS:()=>`${v}`.padStart(3,"0"),d:()=>f,dd:()=>e.toLocaleDateString(r,{weekday:"narrow"}),ddd:()=>e.toLocaleDateString(r,{weekday:"short"}),dddd:()=>e.toLocaleDateString(r,{weekday:"long"})};return t.replace(Dt,(d,O)=>O||s[d]())},pe=e=>{if(e===null)return new Date(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(Qt);if(t){const r=t[2]-1||0,n=(t[7]||"0").substring(0,3);return new Date(t[1],r,t[3]||1,t[4]||0,t[5]||0,t[6]||0,n)}}return new Date(e)};function xt(e,t="HH:mm:ss",r={}){return i.computed(()=>de(pe(y.resolveUnref(e)),y.resolveUnref(t),r==null?void 0:r.locales))}function ve(e,t=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let l=null;const u=i.ref(!1);function c(){l&&(clearInterval(l),l=null)}function p(){u.value=!1,c()}function v(){i.unref(t)<=0||(u.value=!0,a&&e(),c(),l=setInterval(e,w(t)))}if(n&&I&&v(),i.isRef(t)){const f=i.watch(t,()=>{u.value&&I&&v()});S(f)}return S(p),{isActive:u,pause:p,resume:v}}var er=Object.defineProperty,ye=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,_e=(e,t,r)=>t in e?er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nr=(e,t)=>{for(var r in t||(t={}))tr.call(t,r)&&_e(e,r,t[r]);if(ye)for(var r of ye(t))rr.call(t,r)&&_e(e,r,t[r]);return e};function or(e=1e3,t={}){const{controls:r=!1,immediate:n=!0}=t,a=i.ref(0),l=ve(()=>a.value+=1,e,{immediate:n});return r?nr({counter:a},l):a}function ar(e,t={}){var r;const n=i.ref((r=t.initialValue)!=null?r:null);return i.watch(e,()=>n.value=K(),t),n}function Oe(e,t,r={}){const{immediate:n=!0}=r,a=i.ref(!1);let l=null;function u(){l&&(clearTimeout(l),l=null)}function c(){a.value=!1,u()}function p(...v){u(),a.value=!0,l=setTimeout(()=>{a.value=!1,l=null,e(...v)},y.resolveUnref(t))}return n&&(a.value=!0,I&&p()),S(c),{isPending:a,start:p,stop:c}}var ir=Object.defineProperty,we=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,ur=Object.prototype.propertyIsEnumerable,he=(e,t,r)=>t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cr=(e,t)=>{for(var r in t||(t={}))lr.call(t,r)&&he(e,r,t[r]);if(we)for(var r of we(t))ur.call(t,r)&&he(e,r,t[r]);return e};function sr(e=1e3,t={}){const{controls:r=!1}=t,n=Oe(Q,e,t),a=i.computed(()=>!n.isPending.value);return r?cr({ready:a},n):a}function fr(e=!1,t={}){const{truthyValue:r=!0,falsyValue:n=!1}=t,a=i.isRef(e),l=i.ref(e);function u(c){if(arguments.length)return l.value=c,l.value;{const p=w(r);return l.value=l.value===p?w(n):p,l.value}}return a?u:[l,u]}function dr(e,t,r){let n=(r==null?void 0:r.immediate)?[]:[...e instanceof Function?e():Array.isArray(e)?e:i.unref(e)];return i.watch(e,(a,l,u)=>{const c=new Array(n.length),p=[];for(const f of a){let s=!1;for(let d=0;d<n.length;d++)if(!c[d]&&f===n[d]){c[d]=!0,s=!0;break}s||p.push(f)}const v=n.filter((f,s)=>!c[s]);t(a,n,p,v,u),n=[...a]},r)}var ge=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,vr=Object.prototype.propertyIsEnumerable,yr=(e,t)=>{var r={};for(var n in e)pr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ge)for(var n of ge(e))t.indexOf(n)<0&&vr.call(e,n)&&(r[n]=e[n]);return r};function E(e,t,r={}){const n=r,{eventFilter:a=T}=n,l=yr(n,["eventFilter"]);return i.watch(e,F(a,t),l)}var Pe=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,wr=(e,t)=>{var r={};for(var n in e)_r.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pe)for(var n of Pe(e))t.indexOf(n)<0&&Or.call(e,n)&&(r[n]=e[n]);return r};function hr(e,t,r){const n=r,{count:a}=n,l=wr(n,["count"]),u=i.ref(0),c=E(e,(...p)=>{u.value+=1,u.value>=w(a)&&i.nextTick(()=>c()),t(...p)},l);return{count:u,stop:c}}var gr=Object.defineProperty,Pr=Object.defineProperties,mr=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,$e=(e,t,r)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,br=(e,t)=>{for(var r in t||(t={}))me.call(t,r)&&$e(e,r,t[r]);if(U)for(var r of U(t))be.call(t,r)&&$e(e,r,t[r]);return e},$r=(e,t)=>Pr(e,mr(t)),Sr=(e,t)=>{var r={};for(var n in e)me.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&U)for(var n of U(e))t.indexOf(n)<0&&be.call(e,n)&&(r[n]=e[n]);return r};function Se(e,t,r={}){const n=r,{debounce:a=0,maxWait:l=void 0}=n,u=Sr(n,["debounce","maxWait"]);return E(e,t,$r(br({},u),{eventFilter:B(a,{maxWait:l})}))}var Ar=Object.defineProperty,jr=Object.defineProperties,Ir=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,Ie=(e,t,r)=>t in e?Ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fr=(e,t)=>{for(var r in t||(t={}))Ae.call(t,r)&&Ie(e,r,t[r]);if(R)for(var r of R(t))je.call(t,r)&&Ie(e,r,t[r]);return e},Er=(e,t)=>jr(e,Ir(t)),Tr=(e,t)=>{var r={};for(var n in e)Ae.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&R)for(var n of R(e))t.indexOf(n)<0&&je.call(e,n)&&(r[n]=e[n]);return r};function z(e,t,r={}){const n=r,{eventFilter:a=T}=n,l=Tr(n,["eventFilter"]),u=F(a,t);let c,p,v;if(l.flush==="sync"){const f=i.ref(!1);p=()=>{},c=s=>{f.value=!0,s(),f.value=!1},v=i.watch(e,(...s)=>{f.value||u(...s)},l)}else{const f=[],s=i.ref(0),d=i.ref(0);p=()=>{s.value=d.value},f.push(i.watch(e,()=>{d.value++},Er(Fr({},l),{flush:"sync"}))),c=O=>{const _=d.value;O(),s.value+=d.value-_},f.push(i.watch(e,(...O)=>{const _=s.value>0&&s.value===d.value;s.value=0,d.value=0,!_&&u(...O)},l)),v=()=>{f.forEach(O=>O())}}return{stop:v,ignoreUpdates:c,ignorePrevAsyncUpdates:p}}function Ur(e,t,r){const n=i.watch(e,(...a)=>(i.nextTick(()=>n()),t(...a)),r)}var Rr=Object.defineProperty,Cr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Te=(e,t,r)=>t in e?Rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Nr=(e,t)=>{for(var r in t||(t={}))Fe.call(t,r)&&Te(e,r,t[r]);if(C)for(var r of C(t))Ee.call(t,r)&&Te(e,r,t[r]);return e},Wr=(e,t)=>Cr(e,Mr(t)),Br=(e,t)=>{var r={};for(var n in e)Fe.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&C)for(var n of C(e))t.indexOf(n)<0&&Ee.call(e,n)&&(r[n]=e[n]);return r};function Ue(e,t,r={}){const n=r,{eventFilter:a}=n,l=Br(n,["eventFilter"]),{eventFilter:u,pause:c,resume:p,isActive:v}=D(a);return{stop:E(e,t,Wr(Nr({},l),{eventFilter:u})),pause:c,resume:p,isActive:v}}var Hr=Object.defineProperty,Lr=Object.defineProperties,Yr=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,Me=(e,t,r)=>t in e?Hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Gr=(e,t)=>{for(var r in t||(t={}))Re.call(t,r)&&Me(e,r,t[r]);if(M)for(var r of M(t))Ce.call(t,r)&&Me(e,r,t[r]);return e},kr=(e,t)=>Lr(e,Yr(t)),zr=(e,t)=>{var r={};for(var n in e)Re.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&M)for(var n of M(e))t.indexOf(n)<0&&Ce.call(e,n)&&(r[n]=e[n]);return r};function Ne(e,t,r={}){const n=r,{throttle:a=0,trailing:l=!0,leading:u=!0}=n,c=zr(n,["throttle","trailing","leading"]);return E(e,t,kr(Gr({},c),{eventFilter:H(a,l,u)}))}var Vr=Object.defineProperty,Jr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,qr=Object.prototype.propertyIsEnumerable,Be=(e,t,r)=>t in e?Vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Kr=(e,t)=>{for(var r in t||(t={}))Zr.call(t,r)&&Be(e,r,t[r]);if(We)for(var r of We(t))qr.call(t,r)&&Be(e,r,t[r]);return e},Qr=(e,t)=>Jr(e,Xr(t));function Dr(e,t,r={}){let n;function a(){if(!n)return;const f=n;n=void 0,f()}function l(f){n=f}const u=(f,s)=>(a(),t(f,s,l)),c=z(e,u,r),{ignoreUpdates:p}=c,v=()=>{let f;return p(()=>{f=u(xr(e),en(e))}),f};return Qr(Kr({},c),{trigger:v})}function xr(e){return i.isReactive(e)?e:Array.isArray(e)?e.map(t=>He(t)):He(e)}function He(e){return typeof e=="function"?e():i.unref(e)}function en(e){return Array.isArray(e)?e.map(()=>{}):void 0}function tn(e,t,r){return i.watch(e,(n,a,l)=>{n&&t(n,a,l)},r)}o.__onlyVue3=x,o.assert=Je,o.autoResetRef=ie,o.bypassFilter=T,o.clamp=xe,o.computedEager=X,o.computedWithControl=ee,o.containsProp=it,o.controlledComputed=ee,o.controlledRef=$t,o.createEventHook=ct,o.createFilterWrapper=F,o.createGlobalState=st,o.createInjectionState=ft,o.createReactiveFn=Y,o.createSharedComposable=dt,o.createSingletonPromise=ot,o.debounceFilter=B,o.debouncedRef=G,o.debouncedWatch=Se,o.directiveHooks=rt,o.eagerComputed=X,o.extendRef=te,o.formatDate=de,o.get=pt,o.identity=nt,o.ignorableWatch=z,o.increaseWithUnit=lt,o.invoke=at,o.isBoolean=Xe,o.isClient=I,o.isDef=Ve,o.isDefined=vt,o.isFunction=W,o.isIOS=tt,o.isNumber=Ze,o.isObject=Ke,o.isString=qe,o.isWindow=Qe,o.makeDestructurable=ht,o.noop=Q,o.normalizeDate=pe,o.now=De,o.objectPick=ut,o.pausableFilter=D,o.pausableWatch=Ue,o.promiseTimeout=L,o.rand=et,o.reactify=Y,o.reactifyObject=gt,o.reactiveComputed=ae,o.reactiveOmit=Pt,o.reactivePick=mt,o.refAutoReset=ie,o.refDebounced=G,o.refDefault=bt,o.refThrottled=k,o.refWithControl=ce,o.resolveRef=St,o.resolveUnref=w,o.set=At,o.syncRef=jt,o.syncRefs=It,o.throttleFilter=H,o.throttledRef=k,o.throttledWatch=Ne,o.timestamp=K,o.toReactive=oe,o.toRefs=Nt,o.tryOnBeforeMount=Wt,o.tryOnBeforeUnmount=Bt,o.tryOnMounted=Ht,o.tryOnScopeDispose=S,o.tryOnUnmounted=Lt,o.until=Yt,o.useArrayEvery=Gt,o.useArrayFilter=kt,o.useArrayFind=zt,o.useArrayFindIndex=Vt,o.useArrayJoin=Jt,o.useArrayMap=Xt,o.useArrayReduce=Zt,o.useArraySome=qt,o.useCounter=Kt,o.useDateFormat=xt,o.useDebounce=G,o.useDebounceFn=le,o.useInterval=or,o.useIntervalFn=ve,o.useLastChanged=ar,o.useThrottle=k,o.useThrottleFn=ue,o.useTimeout=sr,o.useTimeoutFn=Oe,o.useToggle=fr,o.watchArray=dr,o.watchAtMost=hr,o.watchDebounced=Se,o.watchIgnorable=z,o.watchOnce=Ur,o.watchPausable=Ue,o.watchThrottled=Ne,o.watchTriggerable=Dr,o.watchWithFilter=E,o.whenever=tn,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi,VueUse);
|
|
1
|
+
var VueDemi=function(o,i,j){if(o.install)return o;if(i)if(i.version.slice(0,4)==="2.7."){for(var w in i)o[w]=i[w];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else if(i.version.slice(0,2)==="2.")if(j){for(var w in j)o[w]=j[w];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(i.version.slice(0,2)==="3."){for(var w in i)o[w]=i[w];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=i,o.Vue2=void 0,o.version=i.version,o.set=function(O,P,b){return Array.isArray(O)?(O.length=Math.max(O.length,P),O.splice(P,1,b),b):(O[P]=b,b)},o.del=function(O,P){if(Array.isArray(O)){O.splice(P,1);return}delete O[P]}}else console.error("[vue-demi] Vue version "+i.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,i){"use strict";var j=Object.defineProperty,w=Object.defineProperties,O=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,Yt=Object.prototype.propertyIsEnumerable,J=(t,e,r)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Gt=(t,e)=>{for(var r in e||(e={}))b.call(e,r)&&J(t,r,e[r]);if(P)for(var r of P(e))Yt.call(e,r)&&J(t,r,e[r]);return t},kt=(t,e)=>w(t,O(e));function V(t,e){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=t()},kt(Gt({},e),{flush:(r=e==null?void 0:e.flush)!=null?r:"sync"})),i.readonly(n)}var X;const I=typeof window!="undefined",zt=t=>typeof t!="undefined",Zt=(t,...e)=>{t||console.warn(...e)},q=Object.prototype.toString,Jt=t=>typeof t=="boolean",U=t=>typeof t=="function",Vt=t=>typeof t=="number",Xt=t=>typeof t=="string",qt=t=>q.call(t)==="[object Object]",Kt=t=>typeof window!="undefined"&&q.call(t)==="[object Window]",Qt=()=>Date.now(),K=()=>+Date.now(),Dt=(t,e,r)=>Math.min(r,Math.max(e,t)),Q=()=>{},xt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),te=I&&((X=window==null?void 0:window.navigator)==null?void 0:X.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function y(t){return typeof t=="function"?t():i.unref(t)}function T(t,e){function r(...n){t(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})}return r}const E=t=>t();function B(t,e={}){let r,n;return l=>{const u=y(t),c=y(e.maxWait);if(r&&clearTimeout(r),u<=0||c!==void 0&&c<=0)return n&&(clearTimeout(n),n=null),l();c&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,l()},c)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,l()},u)}}function H(t,e=!0,r=!0){let n=0,a,l=!0;const u=()=>{a&&(clearTimeout(a),a=void 0)};return p=>{const _=y(t),f=Date.now()-n;if(u(),_<=0)return n=Date.now(),p();f>_&&(r||!l)?(n=Date.now(),p()):e&&(a=setTimeout(()=>{n=Date.now(),l=!0,u(),p()},_)),!r&&!a&&(a=setTimeout(()=>l=!0,_)),l=!1}}function D(t=E){const e=i.ref(!0);function r(){e.value=!1}function n(){e.value=!0}return{isActive:e,pause:r,resume:n,eventFilter:(...l)=>{e.value&&t(...l)}}}function x(t="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}const ee={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function L(t,e=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(e?()=>a(r):n,t)})}function re(t){return t}function ne(t){let e;function r(){return e||(e=t()),e}return r.reset=async()=>{const n=e;e=void 0,n&&await n},r}function oe(t){return t()}function ae(t,...e){return e.some(r=>r in t)}function ie(t,e){var r;if(typeof t=="number")return t+e;const n=((r=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:r[0])||"",a=t.slice(n.length),l=parseFloat(n)+e;return Number.isNaN(l)?t:l+a}function le(t,e,r=!1){return e.reduce((n,a)=>(a in t&&(!r||t[a]!==void 0)&&(n[a]=t[a]),n),{})}function tt(t,e){let r,n,a;const l=i.ref(!0),u=()=>{l.value=!0,a()};i.watch(t,u,{flush:"sync"});const c=U(e)?e:e.get,p=U(e)?void 0:e.set,_=i.customRef((f,s)=>(n=f,a=s,{get(){return l.value&&(r=c(),l.value=!1),n(),r},set(d){p==null||p(d)}}));return Object.isExtensible(_)&&(_.trigger=u),_}function ue(){const t=[],e=a=>{const l=t.indexOf(a);l!==-1&&t.splice(l,1)};return{on:a=>(t.push(a),{off:()=>e(a)}),off:e,trigger:a=>{t.forEach(l=>l(a))}}}function ce(t){let e=!1,r;const n=i.effectScope(!0);return()=>(e||(r=n.run(t),e=!0),r)}function se(t){const e=Symbol("InjectionState");return[(...a)=>{i.provide(e,t(...a))},()=>i.inject(e)]}function $(t){return i.getCurrentScope()?(i.onScopeDispose(t),!0):!1}function fe(t){let e=0,r,n;const a=()=>{e-=1,n&&e<=0&&(n.stop(),r=void 0,n=void 0)};return(...l)=>(e+=1,r||(n=i.effectScope(!0),r=n.run(()=>t(...l))),$(a),r)}function et(t,e,{enumerable:r=!1,unwrap:n=!0}={}){x();for(const[a,l]of Object.entries(e))a!=="value"&&(i.isRef(l)&&n?Object.defineProperty(t,a,{get(){return l.value},set(u){l.value=u},enumerable:r}):Object.defineProperty(t,a,{value:l,enumerable:r}));return t}function de(t,e){return e==null?i.unref(t):i.unref(t)[e]}function pe(t){return i.unref(t)!=null}var ye=Object.defineProperty,rt=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,nt=(t,e,r)=>e in t?ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,he=(t,e)=>{for(var r in e||(e={}))_e.call(e,r)&&nt(t,r,e[r]);if(rt)for(var r of rt(e))ve.call(e,r)&&nt(t,r,e[r]);return t};function Oe(t,e){if(typeof Symbol!="undefined"){const r=he({},t);return Object.defineProperty(r,Symbol.iterator,{enumerable:!1,value(){let n=0;return{next:()=>({value:e[n++],done:n>e.length})}}}),r}else return Object.assign([...e],t)}function Y(t,e){const r=(e==null?void 0:e.computedGetter)===!1?i.unref:y;return function(...n){return i.computed(()=>t.apply(this,n.map(a=>r(a))))}}function we(t,e={}){let r=[],n;if(Array.isArray(e))r=e;else{n=e;const{includeOwnProperties:a=!0}=e;r.push(...Object.keys(t)),a&&r.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(r.map(a=>{const l=t[a];return[a,typeof l=="function"?Y(l.bind(t),n):l]}))}function ot(t){if(!i.isRef(t))return i.reactive(t);const e=new Proxy({},{get(r,n,a){return i.unref(Reflect.get(t.value,n,a))},set(r,n,a){return i.isRef(t.value[n])&&!i.isRef(a)?t.value[n].value=a:t.value[n]=a,!0},deleteProperty(r,n){return Reflect.deleteProperty(t.value,n)},has(r,n){return Reflect.has(t.value,n)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return i.reactive(e)}function at(t){return ot(i.computed(t))}function ge(t,...e){const r=e.flat();return at(()=>Object.fromEntries(Object.entries(i.toRefs(t)).filter(n=>!r.includes(n[0]))))}function Pe(t,...e){const r=e.flat();return i.reactive(Object.fromEntries(r.map(n=>[n,i.toRef(t,n)])))}function it(t,e=1e4){return i.customRef((r,n)=>{let a=t,l;const u=()=>setTimeout(()=>{a=t,n()},y(e));return $(()=>{clearTimeout(l)}),{get(){return r(),a},set(c){a=c,n(),clearTimeout(l),l=u()}}})}function lt(t,e=200,r={}){return T(B(e,r),t)}function G(t,e=200,r={}){if(e<=0)return t;const n=i.ref(t.value),a=lt(()=>{n.value=t.value},e,r);return i.watch(t,()=>a()),n}function me(t,e){return i.computed({get(){var r;return(r=t.value)!=null?r:e},set(r){t.value=r}})}function ut(t,e=200,r=!1,n=!0){return T(H(e,r,n),t)}function k(t,e=200,r=!0,n=!0){if(e<=0)return t;const a=i.ref(t.value),l=ut(()=>{a.value=t.value},e,r,n);return i.watch(t,()=>l()),a}function ct(t,e={}){let r=t,n,a;const l=i.customRef((d,h)=>(n=d,a=h,{get(){return u()},set(v){c(v)}}));function u(d=!0){return d&&n(),r}function c(d,h=!0){var v,m;if(d===r)return;const g=r;((v=e.onBeforeChange)==null?void 0:v.call(e,d,g))!==!1&&(r=d,(m=e.onChanged)==null||m.call(e,d,g),h&&a())}return et(l,{get:u,set:c,untrackedGet:()=>u(!1),silentSet:d=>c(d,!1),peek:()=>u(!1),lay:d=>c(d,!1)},{enumerable:!0})}const be=ct;function $e(t){return typeof t=="function"?i.computed(t):i.ref(t)}function Se(...t){if(t.length===2){const[e,r]=t;e.value=r}if(t.length===3)if(i.isVue2)i.set(...t);else{const[e,r,n]=t;e[r]=n}}function Ae(t,e,r={}){var n,a;const{flush:l="sync",deep:u=!1,immediate:c=!0,direction:p="both",transform:_={}}=r;let f,s;const d=(n=_.ltr)!=null?n:v=>v,h=(a=_.rtl)!=null?a:v=>v;return(p==="both"||p==="ltr")&&(f=i.watch(t,v=>e.value=d(v),{flush:l,deep:u,immediate:c})),(p==="both"||p==="rtl")&&(s=i.watch(e,v=>t.value=h(v),{flush:l,deep:u,immediate:c})),()=>{f==null||f(),s==null||s()}}function je(t,e,r={}){const{flush:n="sync",deep:a=!1,immediate:l=!0}=r;return Array.isArray(e)||(e=[e]),i.watch(t,u=>e.forEach(c=>c.value=u),{flush:n,deep:a,immediate:l})}var Ie=Object.defineProperty,Te=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,st=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,ft=(t,e,r)=>e in t?Ie(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ce=(t,e)=>{for(var r in e||(e={}))Ee.call(e,r)&&ft(t,r,e[r]);if(st)for(var r of st(e))Re.call(e,r)&&ft(t,r,e[r]);return t},Ne=(t,e)=>Te(t,Fe(e));function Me(t){if(!i.isRef(t))return i.toRefs(t);const e=Array.isArray(t.value)?new Array(t.value.length):{};for(const r in t.value)e[r]=i.customRef(()=>({get(){return t.value[r]},set(n){if(Array.isArray(t.value)){const a=[...t.value];a[r]=n,t.value=a}else{const a=Ne(Ce({},t.value),{[r]:n});Object.setPrototypeOf(a,t.value),t.value=a}}}));return e}function We(t,e=!0){i.getCurrentInstance()?i.onBeforeMount(t):e?t():i.nextTick(t)}function Ue(t){i.getCurrentInstance()&&i.onBeforeUnmount(t)}function Be(t,e=!0){i.getCurrentInstance()?i.onMounted(t):e?t():i.nextTick(t)}function He(t){i.getCurrentInstance()&&i.onUnmounted(t)}function Le(t){let e=!1;function r(s,{flush:d="sync",deep:h=!1,timeout:v,throwOnTimeout:m}={}){let g=null;const Z=[new Promise(W=>{g=i.watch(t,A=>{s(A)!==e&&(g==null||g(),W(A))},{flush:d,deep:h,immediate:!0})})];return v!=null&&Z.push(L(v,m).then(()=>y(t)).finally(()=>g==null?void 0:g())),Promise.race(Z)}function n(s,d){if(!i.isRef(s))return r(A=>A===s,d);const{flush:h="sync",deep:v=!1,timeout:m,throwOnTimeout:g}=d??{};let S=null;const W=[new Promise(A=>{S=i.watch([t,s],([Lt,nn])=>{e!==(Lt===nn)&&(S==null||S(),A(Lt))},{flush:h,deep:v,immediate:!0})})];return m!=null&&W.push(L(m,g).then(()=>y(t)).finally(()=>(S==null||S(),y(t)))),Promise.race(W)}function a(s){return r(d=>Boolean(d),s)}function l(s){return n(null,s)}function u(s){return n(void 0,s)}function c(s){return r(Number.isNaN,s)}function p(s,d){return r(h=>{const v=Array.from(h);return v.includes(s)||v.includes(y(s))},d)}function _(s){return f(1,s)}function f(s=1,d){let h=-1;return r(()=>(h+=1,h>=s),d)}return Array.isArray(y(t))?{toMatch:r,toContains:p,changed:_,changedTimes:f,get not(){return e=!e,this}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:l,toBeNaN:c,toBeUndefined:u,changed:_,changedTimes:f,get not(){return e=!e,this}}}function Ye(t,e){return i.computed(()=>y(t).every((r,n,a)=>e(y(r),n,a)))}function Ge(t,e){return i.computed(()=>y(t).map(r=>y(r)).filter(e))}function ke(t,e){return i.computed(()=>y(y(t).find((r,n,a)=>e(y(r),n,a))))}function ze(t,e){return i.computed(()=>y(t).findIndex((r,n,a)=>e(y(r),n,a)))}function Ze(t,e){return i.computed(()=>y(t).map(r=>y(r)).join(y(e)))}function Je(t,e){return i.computed(()=>y(t).map(r=>y(r)).map(e))}function Ve(t,e,...r){const n=(a,l,u)=>e(y(a),y(l),u);return i.computed(()=>{const a=y(t);return r.length?a.reduce(n,y(r[0])):a.reduce(n)})}function Xe(t,e){return i.computed(()=>y(t).some((r,n,a)=>e(y(r),n,a)))}function qe(t=0,e={}){const r=i.ref(t),{max:n=1/0,min:a=-1/0}=e,l=(f=1)=>r.value=Math.min(n,r.value+f),u=(f=1)=>r.value=Math.max(a,r.value-f),c=()=>r.value,p=f=>r.value=f;return{count:r,inc:l,dec:u,get:c,set:p,reset:(f=t)=>(t=f,p(f))}}const Ke=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Qe=/\[([^\]]+)]|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,r)=>{const n=t.getFullYear(),a=t.getMonth(),l=t.getDate(),u=t.getHours(),c=t.getMinutes(),p=t.getSeconds(),_=t.getMilliseconds(),f=t.getDay(),s={YY:()=>String(n).slice(-2),YYYY:()=>n,M:()=>a+1,MM:()=>`${a+1}`.padStart(2,"0"),D:()=>String(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(c),mm:()=>`${c}`.padStart(2,"0"),s:()=>String(p),ss:()=>`${p}`.padStart(2,"0"),SSS:()=>`${_}`.padStart(3,"0"),d:()=>f,dd:()=>t.toLocaleDateString(r,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(r,{weekday:"short"}),dddd:()=>t.toLocaleDateString(r,{weekday:"long"})};return e.replace(Qe,(d,h)=>h||s[d]())},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(Ke);if(e){const r=e[2]-1||0,n=(e[7]||"0").substring(0,3);return new Date(e[1],r,e[3]||1,e[4]||0,e[5]||0,e[6]||0,n)}}return new Date(t)};function De(t,e="HH:mm:ss",r={}){return i.computed(()=>dt(pt(y(t)),y(e),r==null?void 0:r.locales))}function yt(t,e=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let l=null;const u=i.ref(!1);function c(){l&&(clearInterval(l),l=null)}function p(){u.value=!1,c()}function _(){i.unref(e)<=0||(u.value=!0,a&&t(),c(),l=setInterval(t,y(e)))}if(n&&I&&_(),i.isRef(e)){const f=i.watch(e,()=>{u.value&&I&&_()});$(f)}return $(p),{isActive:u,pause:p,resume:_}}var xe=Object.defineProperty,_t=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable,vt=(t,e,r)=>e in t?xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rr=(t,e)=>{for(var r in e||(e={}))tr.call(e,r)&&vt(t,r,e[r]);if(_t)for(var r of _t(e))er.call(e,r)&&vt(t,r,e[r]);return t};function nr(t=1e3,e={}){const{controls:r=!1,immediate:n=!0}=e,a=i.ref(0),l=yt(()=>a.value+=1,t,{immediate:n});return r?rr({counter:a},l):a}function or(t,e={}){var r;const n=i.ref((r=e.initialValue)!=null?r:null);return i.watch(t,()=>n.value=K(),e),n}function ht(t,e,r={}){const{immediate:n=!0}=r,a=i.ref(!1);let l=null;function u(){l&&(clearTimeout(l),l=null)}function c(){a.value=!1,u()}function p(..._){u(),a.value=!0,l=setTimeout(()=>{a.value=!1,l=null,t(..._)},y(e))}return n&&(a.value=!0,I&&p()),$(c),{isPending:a,start:p,stop:c}}var ar=Object.defineProperty,Ot=Object.getOwnPropertySymbols,ir=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,wt=(t,e,r)=>e in t?ar(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ur=(t,e)=>{for(var r in e||(e={}))ir.call(e,r)&&wt(t,r,e[r]);if(Ot)for(var r of Ot(e))lr.call(e,r)&&wt(t,r,e[r]);return t};function cr(t=1e3,e={}){const{controls:r=!1}=e,n=ht(Q,t,e),a=i.computed(()=>!n.isPending.value);return r?ur({ready:a},n):a}function sr(t,e={}){const{method:r="parseFloat",radix:n,nanToZero:a}=e;return i.computed(()=>{let l=y(t);return typeof l=="string"&&(l=Number[r](l,n)),a&&isNaN(l)&&(l=0),l})}function fr(t){return i.computed(()=>`${y(t)}`)}function dr(t=!1,e={}){const{truthyValue:r=!0,falsyValue:n=!1}=e,a=i.isRef(t),l=i.ref(t);function u(c){if(arguments.length)return l.value=c,l.value;{const p=y(r);return l.value=l.value===p?y(n):p,l.value}}return a?u:[l,u]}function pr(t,e,r){let n=(r==null?void 0:r.immediate)?[]:[...t instanceof Function?t():Array.isArray(t)?t:i.unref(t)];return i.watch(t,(a,l,u)=>{const c=new Array(n.length),p=[];for(const f of a){let s=!1;for(let d=0;d<n.length;d++)if(!c[d]&&f===n[d]){c[d]=!0,s=!0;break}s||p.push(f)}const _=n.filter((f,s)=>!c[s]);e(a,n,p,_,u),n=[...a]},r)}var gt=Object.getOwnPropertySymbols,yr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,vr=(t,e)=>{var r={};for(var n in t)yr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&>)for(var n of gt(t))e.indexOf(n)<0&&_r.call(t,n)&&(r[n]=t[n]);return r};function F(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=vr(n,["eventFilter"]);return i.watch(t,T(a,e),l)}var Pt=Object.getOwnPropertySymbols,hr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,wr=(t,e)=>{var r={};for(var n in t)hr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Pt)for(var n of Pt(t))e.indexOf(n)<0&&Or.call(t,n)&&(r[n]=t[n]);return r};function gr(t,e,r){const n=r,{count:a}=n,l=wr(n,["count"]),u=i.ref(0),c=F(t,(...p)=>{u.value+=1,u.value>=y(a)&&i.nextTick(()=>c()),e(...p)},l);return{count:u,stop:c}}var Pr=Object.defineProperty,mr=Object.defineProperties,br=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable,$t=(t,e,r)=>e in t?Pr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$r=(t,e)=>{for(var r in e||(e={}))mt.call(e,r)&&$t(t,r,e[r]);if(R)for(var r of R(e))bt.call(e,r)&&$t(t,r,e[r]);return t},Sr=(t,e)=>mr(t,br(e)),Ar=(t,e)=>{var r={};for(var n in t)mt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&R)for(var n of R(t))e.indexOf(n)<0&&bt.call(t,n)&&(r[n]=t[n]);return r};function St(t,e,r={}){const n=r,{debounce:a=0,maxWait:l=void 0}=n,u=Ar(n,["debounce","maxWait"]);return F(t,e,Sr($r({},u),{eventFilter:B(a,{maxWait:l})}))}var jr=Object.defineProperty,Ir=Object.defineProperties,Tr=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,It=(t,e,r)=>e in t?jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fr=(t,e)=>{for(var r in e||(e={}))At.call(e,r)&&It(t,r,e[r]);if(C)for(var r of C(e))jt.call(e,r)&&It(t,r,e[r]);return t},Er=(t,e)=>Ir(t,Tr(e)),Rr=(t,e)=>{var r={};for(var n in t)At.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&C)for(var n of C(t))e.indexOf(n)<0&&jt.call(t,n)&&(r[n]=t[n]);return r};function z(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=Rr(n,["eventFilter"]),u=T(a,e);let c,p,_;if(l.flush==="sync"){const f=i.ref(!1);p=()=>{},c=s=>{f.value=!0,s(),f.value=!1},_=i.watch(t,(...s)=>{f.value||u(...s)},l)}else{const f=[],s=i.ref(0),d=i.ref(0);p=()=>{s.value=d.value},f.push(i.watch(t,()=>{d.value++},Er(Fr({},l),{flush:"sync"}))),c=h=>{const v=d.value;h(),s.value+=d.value-v},f.push(i.watch(t,(...h)=>{const v=s.value>0&&s.value===d.value;s.value=0,d.value=0,!v&&u(...h)},l)),_=()=>{f.forEach(h=>h())}}return{stop:_,ignoreUpdates:c,ignorePrevAsyncUpdates:p}}function Cr(t,e,r){const n=i.watch(t,(...a)=>(i.nextTick(()=>n()),e(...a)),r)}var Nr=Object.defineProperty,Mr=Object.defineProperties,Wr=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Tt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Et=(t,e,r)=>e in t?Nr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ur=(t,e)=>{for(var r in e||(e={}))Tt.call(e,r)&&Et(t,r,e[r]);if(N)for(var r of N(e))Ft.call(e,r)&&Et(t,r,e[r]);return t},Br=(t,e)=>Mr(t,Wr(e)),Hr=(t,e)=>{var r={};for(var n in t)Tt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&N)for(var n of N(t))e.indexOf(n)<0&&Ft.call(t,n)&&(r[n]=t[n]);return r};function Rt(t,e,r={}){const n=r,{eventFilter:a}=n,l=Hr(n,["eventFilter"]),{eventFilter:u,pause:c,resume:p,isActive:_}=D(a);return{stop:F(t,e,Br(Ur({},l),{eventFilter:u})),pause:c,resume:p,isActive:_}}var Lr=Object.defineProperty,Yr=Object.defineProperties,Gr=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,Mt=(t,e,r)=>e in t?Lr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kr=(t,e)=>{for(var r in e||(e={}))Ct.call(e,r)&&Mt(t,r,e[r]);if(M)for(var r of M(e))Nt.call(e,r)&&Mt(t,r,e[r]);return t},zr=(t,e)=>Yr(t,Gr(e)),Zr=(t,e)=>{var r={};for(var n in t)Ct.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&M)for(var n of M(t))e.indexOf(n)<0&&Nt.call(t,n)&&(r[n]=t[n]);return r};function Wt(t,e,r={}){const n=r,{throttle:a=0,trailing:l=!0,leading:u=!0}=n,c=Zr(n,["throttle","trailing","leading"]);return F(t,e,zr(kr({},c),{eventFilter:H(a,l,u)}))}var Jr=Object.defineProperty,Vr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,Ut=Object.getOwnPropertySymbols,qr=Object.prototype.hasOwnProperty,Kr=Object.prototype.propertyIsEnumerable,Bt=(t,e,r)=>e in t?Jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qr=(t,e)=>{for(var r in e||(e={}))qr.call(e,r)&&Bt(t,r,e[r]);if(Ut)for(var r of Ut(e))Kr.call(e,r)&&Bt(t,r,e[r]);return t},Dr=(t,e)=>Vr(t,Xr(e));function xr(t,e,r={}){let n;function a(){if(!n)return;const f=n;n=void 0,f()}function l(f){n=f}const u=(f,s)=>(a(),e(f,s,l)),c=z(t,u,r),{ignoreUpdates:p}=c,_=()=>{let f;return p(()=>{f=u(tn(t),en(t))}),f};return Dr(Qr({},c),{trigger:_})}function tn(t){return i.isReactive(t)?t:Array.isArray(t)?t.map(e=>Ht(e)):Ht(t)}function Ht(t){return typeof t=="function"?t():i.unref(t)}function en(t){return Array.isArray(t)?t.map(()=>{}):void 0}function rn(t,e,r){return i.watch(t,(n,a,l)=>{n&&e(n,a,l)},r)}o.__onlyVue3=x,o.assert=Zt,o.autoResetRef=it,o.bypassFilter=E,o.clamp=Dt,o.computedEager=V,o.computedWithControl=tt,o.containsProp=ae,o.controlledComputed=tt,o.controlledRef=be,o.createEventHook=ue,o.createFilterWrapper=T,o.createGlobalState=ce,o.createInjectionState=se,o.createReactiveFn=Y,o.createSharedComposable=fe,o.createSingletonPromise=ne,o.debounceFilter=B,o.debouncedRef=G,o.debouncedWatch=St,o.directiveHooks=ee,o.eagerComputed=V,o.extendRef=et,o.formatDate=dt,o.get=de,o.identity=re,o.ignorableWatch=z,o.increaseWithUnit=ie,o.invoke=oe,o.isBoolean=Jt,o.isClient=I,o.isDef=zt,o.isDefined=pe,o.isFunction=U,o.isIOS=te,o.isNumber=Vt,o.isObject=qt,o.isString=Xt,o.isWindow=Kt,o.makeDestructurable=Oe,o.noop=Q,o.normalizeDate=pt,o.now=Qt,o.objectPick=le,o.pausableFilter=D,o.pausableWatch=Rt,o.promiseTimeout=L,o.rand=xt,o.reactify=Y,o.reactifyObject=we,o.reactiveComputed=at,o.reactiveOmit=ge,o.reactivePick=Pe,o.refAutoReset=it,o.refDebounced=G,o.refDefault=me,o.refThrottled=k,o.refWithControl=ct,o.resolveRef=$e,o.resolveUnref=y,o.set=Se,o.syncRef=Ae,o.syncRefs=je,o.throttleFilter=H,o.throttledRef=k,o.throttledWatch=Wt,o.timestamp=K,o.toReactive=ot,o.toRefs=Me,o.tryOnBeforeMount=We,o.tryOnBeforeUnmount=Ue,o.tryOnMounted=Be,o.tryOnScopeDispose=$,o.tryOnUnmounted=He,o.until=Le,o.useArrayEvery=Ye,o.useArrayFilter=Ge,o.useArrayFind=ke,o.useArrayFindIndex=ze,o.useArrayJoin=Ze,o.useArrayMap=Je,o.useArrayReduce=Ve,o.useArraySome=Xe,o.useCounter=qe,o.useDateFormat=De,o.useDebounce=G,o.useDebounceFn=lt,o.useInterval=nr,o.useIntervalFn=yt,o.useLastChanged=or,o.useThrottle=k,o.useThrottleFn=ut,o.useTimeout=cr,o.useTimeoutFn=ht,o.useToNumber=sr,o.useToString=fr,o.useToggle=dr,o.watchArray=pr,o.watchAtMost=gr,o.watchDebounced=St,o.watchIgnorable=z,o.watchOnce=Cr,o.watchPausable=Rt,o.watchThrottled=Wt,o.watchTriggerable=xr,o.watchWithFilter=F,o.whenever=rn,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi);
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { shallowRef, watchEffect, readonly, unref, ref, isVue3, watch, customRef, effectScope, provide, inject, getCurrentScope, onScopeDispose, isRef, computed, reactive, toRefs as toRefs$1, toRef, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue-demi';
|
|
2
|
-
import { resolveUnref as resolveUnref$1 } from '@vueuse/shared';
|
|
3
2
|
|
|
4
3
|
var __defProp$9 = Object.defineProperty;
|
|
5
4
|
var __defProps$6 = Object.defineProperties;
|
|
@@ -477,7 +476,7 @@ function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
|
477
476
|
const resetAfter = () => setTimeout(() => {
|
|
478
477
|
value = defaultValue;
|
|
479
478
|
trigger();
|
|
480
|
-
}, resolveUnref
|
|
479
|
+
}, resolveUnref(afterMs));
|
|
481
480
|
tryOnScopeDispose(() => {
|
|
482
481
|
clearTimeout(timer);
|
|
483
482
|
});
|
|
@@ -821,39 +820,39 @@ function until(r) {
|
|
|
821
820
|
}
|
|
822
821
|
|
|
823
822
|
function useArrayEvery(list, fn) {
|
|
824
|
-
return computed(() => resolveUnref
|
|
823
|
+
return computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
825
824
|
}
|
|
826
825
|
|
|
827
826
|
function useArrayFilter(list, fn) {
|
|
828
|
-
return computed(() => resolveUnref
|
|
827
|
+
return computed(() => resolveUnref(list).map((i) => resolveUnref(i)).filter(fn));
|
|
829
828
|
}
|
|
830
829
|
|
|
831
830
|
function useArrayFind(list, fn) {
|
|
832
|
-
return computed(() => resolveUnref
|
|
831
|
+
return computed(() => resolveUnref(resolveUnref(list).find((element, index, array) => fn(resolveUnref(element), index, array))));
|
|
833
832
|
}
|
|
834
833
|
|
|
835
834
|
function useArrayFindIndex(list, fn) {
|
|
836
|
-
return computed(() => resolveUnref
|
|
835
|
+
return computed(() => resolveUnref(list).findIndex((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
837
836
|
}
|
|
838
837
|
|
|
839
838
|
function useArrayJoin(list, separator) {
|
|
840
|
-
return computed(() => resolveUnref
|
|
839
|
+
return computed(() => resolveUnref(list).map((i) => resolveUnref(i)).join(resolveUnref(separator)));
|
|
841
840
|
}
|
|
842
841
|
|
|
843
842
|
function useArrayMap(list, fn) {
|
|
844
|
-
return computed(() => resolveUnref
|
|
843
|
+
return computed(() => resolveUnref(list).map((i) => resolveUnref(i)).map(fn));
|
|
845
844
|
}
|
|
846
845
|
|
|
847
846
|
function useArrayReduce(list, reducer, ...args) {
|
|
848
|
-
const reduceCallback = (sum, value, index) => reducer(resolveUnref
|
|
847
|
+
const reduceCallback = (sum, value, index) => reducer(resolveUnref(sum), resolveUnref(value), index);
|
|
849
848
|
return computed(() => {
|
|
850
|
-
const resolved = resolveUnref
|
|
851
|
-
return args.length ? resolved.reduce(reduceCallback, resolveUnref
|
|
849
|
+
const resolved = resolveUnref(list);
|
|
850
|
+
return args.length ? resolved.reduce(reduceCallback, resolveUnref(args[0])) : resolved.reduce(reduceCallback);
|
|
852
851
|
});
|
|
853
852
|
}
|
|
854
853
|
|
|
855
854
|
function useArraySome(list, fn) {
|
|
856
|
-
return computed(() => resolveUnref
|
|
855
|
+
return computed(() => resolveUnref(list).some((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
857
856
|
}
|
|
858
857
|
|
|
859
858
|
function useCounter(initialValue = 0, options = {}) {
|
|
@@ -925,7 +924,7 @@ const normalizeDate = (date) => {
|
|
|
925
924
|
return new Date(date);
|
|
926
925
|
};
|
|
927
926
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
928
|
-
return computed(() => formatDate(normalizeDate(resolveUnref
|
|
927
|
+
return computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options == null ? void 0 : options.locales));
|
|
929
928
|
}
|
|
930
929
|
|
|
931
930
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1033,7 +1032,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1033
1032
|
isPending.value = false;
|
|
1034
1033
|
timer = null;
|
|
1035
1034
|
cb(...args);
|
|
1036
|
-
}, resolveUnref
|
|
1035
|
+
}, resolveUnref(interval));
|
|
1037
1036
|
}
|
|
1038
1037
|
if (immediate) {
|
|
1039
1038
|
isPending.value = true;
|
|
@@ -1079,6 +1078,26 @@ function useTimeout(interval = 1e3, options = {}) {
|
|
|
1079
1078
|
}
|
|
1080
1079
|
}
|
|
1081
1080
|
|
|
1081
|
+
function useToNumber(value, options = {}) {
|
|
1082
|
+
const {
|
|
1083
|
+
method = "parseFloat",
|
|
1084
|
+
radix,
|
|
1085
|
+
nanToZero
|
|
1086
|
+
} = options;
|
|
1087
|
+
return computed(() => {
|
|
1088
|
+
let resolved = resolveUnref(value);
|
|
1089
|
+
if (typeof resolved === "string")
|
|
1090
|
+
resolved = Number[method](resolved, radix);
|
|
1091
|
+
if (nanToZero && isNaN(resolved))
|
|
1092
|
+
resolved = 0;
|
|
1093
|
+
return resolved;
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
function useToString(value) {
|
|
1098
|
+
return computed(() => `${resolveUnref(value)}`);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1082
1101
|
function useToggle(initialValue = false, options = {}) {
|
|
1083
1102
|
const {
|
|
1084
1103
|
truthyValue = true,
|
|
@@ -1476,4 +1495,4 @@ function whenever(source, cb, options) {
|
|
|
1476
1495
|
}, options);
|
|
1477
1496
|
}
|
|
1478
1497
|
|
|
1479
|
-
export { __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
|
1498
|
+
export { __onlyVue3, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, makeDestructurable, noop, normalizeDate, now, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|