@vueuse/shared 9.0.0-beta.1 → 9.0.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 +39 -26
- package/index.d.ts +115 -9
- package/index.iife.js +39 -26
- package/index.iife.min.js +1 -1
- package/index.mjs +39 -27
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -610,22 +610,27 @@ function set(...args) {
|
|
|
610
610
|
}
|
|
611
611
|
|
|
612
612
|
function syncRef(left, right, options = {}) {
|
|
613
|
+
var _a, _b;
|
|
613
614
|
const {
|
|
614
615
|
flush = "sync",
|
|
615
616
|
deep = false,
|
|
616
617
|
immediate = true,
|
|
617
|
-
direction = "both"
|
|
618
|
+
direction = "both",
|
|
619
|
+
transform = {}
|
|
618
620
|
} = options;
|
|
619
|
-
let
|
|
621
|
+
let watchLeft;
|
|
622
|
+
let watchRight;
|
|
623
|
+
const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
|
|
624
|
+
const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
|
|
620
625
|
if (direction === "both" || direction === "ltr") {
|
|
621
|
-
|
|
626
|
+
watchLeft = vueDemi.watch(left, (newValue) => right.value = transformLTR(newValue), { flush, deep, immediate });
|
|
622
627
|
}
|
|
623
628
|
if (direction === "both" || direction === "rtl") {
|
|
624
|
-
|
|
629
|
+
watchRight = vueDemi.watch(right, (newValue) => left.value = transformRTL(newValue), { flush, deep, immediate });
|
|
625
630
|
}
|
|
626
631
|
return () => {
|
|
627
|
-
|
|
628
|
-
|
|
632
|
+
watchLeft == null ? void 0 : watchLeft();
|
|
633
|
+
watchRight == null ? void 0 : watchRight();
|
|
629
634
|
};
|
|
630
635
|
}
|
|
631
636
|
|
|
@@ -831,6 +836,10 @@ function useArrayFind(list, fn) {
|
|
|
831
836
|
return vueDemi.computed(() => shared.resolveUnref(shared.resolveUnref(list).find((element, index, array) => fn(shared.resolveUnref(element), index, array))));
|
|
832
837
|
}
|
|
833
838
|
|
|
839
|
+
function useArrayFindIndex(list, fn) {
|
|
840
|
+
return vueDemi.computed(() => shared.resolveUnref(list).findIndex((element, index, array) => fn(shared.resolveUnref(element), index, array)));
|
|
841
|
+
}
|
|
842
|
+
|
|
834
843
|
function useArrayJoin(list, separator) {
|
|
835
844
|
return vueDemi.computed(() => shared.resolveUnref(list).map((i) => shared.resolveUnref(i)).join(shared.resolveUnref(separator)));
|
|
836
845
|
}
|
|
@@ -870,7 +879,7 @@ function useCounter(initialValue = 0, options = {}) {
|
|
|
870
879
|
|
|
871
880
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
872
881
|
const REGEX_FORMAT = /\[([^\]]+)]|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;
|
|
873
|
-
const formatDate = (date, formatStr) => {
|
|
882
|
+
const formatDate = (date, formatStr, locales) => {
|
|
874
883
|
const years = date.getFullYear();
|
|
875
884
|
const month = date.getMonth();
|
|
876
885
|
const days = date.getDate();
|
|
@@ -880,24 +889,27 @@ const formatDate = (date, formatStr) => {
|
|
|
880
889
|
const milliseconds = date.getMilliseconds();
|
|
881
890
|
const day = date.getDay();
|
|
882
891
|
const matches = {
|
|
883
|
-
YY: String(years).slice(-2),
|
|
884
|
-
YYYY: years,
|
|
885
|
-
M: month + 1,
|
|
886
|
-
MM: `${month + 1}`.padStart(2, "0"),
|
|
887
|
-
D: String(days),
|
|
888
|
-
DD: `${days}`.padStart(2, "0"),
|
|
889
|
-
H: String(hours),
|
|
890
|
-
HH: `${hours}`.padStart(2, "0"),
|
|
891
|
-
h: `${hours % 12 || 12}`.padStart(1, "0"),
|
|
892
|
-
hh: `${hours % 12 || 12}`.padStart(2, "0"),
|
|
893
|
-
m: String(minutes),
|
|
894
|
-
mm: `${minutes}`.padStart(2, "0"),
|
|
895
|
-
s: String(seconds),
|
|
896
|
-
ss: `${seconds}`.padStart(2, "0"),
|
|
897
|
-
SSS: `${milliseconds}`.padStart(3, "0"),
|
|
898
|
-
d: day
|
|
892
|
+
YY: () => String(years).slice(-2),
|
|
893
|
+
YYYY: () => years,
|
|
894
|
+
M: () => month + 1,
|
|
895
|
+
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
896
|
+
D: () => String(days),
|
|
897
|
+
DD: () => `${days}`.padStart(2, "0"),
|
|
898
|
+
H: () => String(hours),
|
|
899
|
+
HH: () => `${hours}`.padStart(2, "0"),
|
|
900
|
+
h: () => `${hours % 12 || 12}`.padStart(1, "0"),
|
|
901
|
+
hh: () => `${hours % 12 || 12}`.padStart(2, "0"),
|
|
902
|
+
m: () => String(minutes),
|
|
903
|
+
mm: () => `${minutes}`.padStart(2, "0"),
|
|
904
|
+
s: () => String(seconds),
|
|
905
|
+
ss: () => `${seconds}`.padStart(2, "0"),
|
|
906
|
+
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
907
|
+
d: () => day,
|
|
908
|
+
dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
|
|
909
|
+
ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
|
|
910
|
+
dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
|
|
899
911
|
};
|
|
900
|
-
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]);
|
|
912
|
+
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
|
|
901
913
|
};
|
|
902
914
|
const normalizeDate = (date) => {
|
|
903
915
|
if (date === null)
|
|
@@ -916,8 +928,8 @@ const normalizeDate = (date) => {
|
|
|
916
928
|
}
|
|
917
929
|
return new Date(date);
|
|
918
930
|
};
|
|
919
|
-
function useDateFormat(date, formatStr = "HH:mm:ss") {
|
|
920
|
-
return vueDemi.computed(() => formatDate(normalizeDate(shared.resolveUnref(date)), shared.resolveUnref(formatStr)));
|
|
931
|
+
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
932
|
+
return vueDemi.computed(() => formatDate(normalizeDate(shared.resolveUnref(date)), shared.resolveUnref(formatStr), options == null ? void 0 : options.locales));
|
|
921
933
|
}
|
|
922
934
|
|
|
923
935
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1546,6 +1558,7 @@ exports.until = until;
|
|
|
1546
1558
|
exports.useArrayEvery = useArrayEvery;
|
|
1547
1559
|
exports.useArrayFilter = useArrayFilter;
|
|
1548
1560
|
exports.useArrayFind = useArrayFind;
|
|
1561
|
+
exports.useArrayFindIndex = useArrayFindIndex;
|
|
1549
1562
|
exports.useArrayJoin = useArrayJoin;
|
|
1550
1563
|
exports.useArrayMap = useArrayMap;
|
|
1551
1564
|
exports.useArrayReduce = useArrayReduce;
|
package/index.d.ts
CHANGED
|
@@ -364,14 +364,14 @@ declare function reactiveComputed<T extends {}>(fn: () => T): T;
|
|
|
364
364
|
/**
|
|
365
365
|
* Reactively omit fields from a reactive object
|
|
366
366
|
*
|
|
367
|
-
* @see https://vueuse.
|
|
367
|
+
* @see https://vueuse.org/reactiveOmit
|
|
368
368
|
*/
|
|
369
369
|
declare function reactiveOmit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
370
370
|
|
|
371
371
|
/**
|
|
372
372
|
* Reactively pick fields from a reactive object
|
|
373
373
|
*
|
|
374
|
-
* @see https://vueuse.
|
|
374
|
+
* @see https://vueuse.org/reactivePick
|
|
375
375
|
*/
|
|
376
376
|
declare function reactivePick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): {
|
|
377
377
|
[S in K]: UnwrapRef<T[S]>;
|
|
@@ -460,7 +460,7 @@ declare function resolveUnref<T>(r: MaybeComputedRef<T>): T;
|
|
|
460
460
|
declare function set<T>(ref: Ref<T>, value: T): void;
|
|
461
461
|
declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
|
|
462
462
|
|
|
463
|
-
interface SyncRefOptions extends ConfigurableFlushSync {
|
|
463
|
+
interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
|
|
464
464
|
/**
|
|
465
465
|
* Watch deeply
|
|
466
466
|
*
|
|
@@ -474,11 +474,18 @@ interface SyncRefOptions extends ConfigurableFlushSync {
|
|
|
474
474
|
*/
|
|
475
475
|
immediate?: boolean;
|
|
476
476
|
/**
|
|
477
|
-
* Direction of syncing
|
|
477
|
+
* Direction of syncing. Value will be redefined if you define syncConvertors
|
|
478
478
|
*
|
|
479
479
|
* @default 'both'
|
|
480
480
|
*/
|
|
481
481
|
direction?: 'ltr' | 'rtl' | 'both';
|
|
482
|
+
/**
|
|
483
|
+
* Custom transform function
|
|
484
|
+
*/
|
|
485
|
+
transform?: {
|
|
486
|
+
ltr?: (left: L) => R;
|
|
487
|
+
rtl?: (right: R) => L;
|
|
488
|
+
};
|
|
482
489
|
}
|
|
483
490
|
/**
|
|
484
491
|
* Two-way refs synchronization.
|
|
@@ -486,7 +493,7 @@ interface SyncRefOptions extends ConfigurableFlushSync {
|
|
|
486
493
|
* @param left
|
|
487
494
|
* @param right
|
|
488
495
|
*/
|
|
489
|
-
declare function syncRef<R
|
|
496
|
+
declare function syncRef<L, R = L>(left: Ref<L>, right: Ref<R>, options?: SyncRefOptions<L, R>): () => void;
|
|
490
497
|
|
|
491
498
|
interface SyncRefsOptions extends ConfigurableFlushSync {
|
|
492
499
|
/**
|
|
@@ -625,20 +632,104 @@ interface UntilArrayInstance<T> extends UntilBaseInstance<T> {
|
|
|
625
632
|
declare function until<T extends unknown[]>(r: WatchSource<T> | MaybeComputedRef<T>): UntilArrayInstance<T>;
|
|
626
633
|
declare function until<T>(r: WatchSource<T> | MaybeComputedRef<T>): UntilValueInstance<T>;
|
|
627
634
|
|
|
635
|
+
/**
|
|
636
|
+
* Reactive `Array.every`
|
|
637
|
+
*
|
|
638
|
+
* @see https://vueuse.org/useArrayEvery
|
|
639
|
+
* @param {Array} list - the array was called upon.
|
|
640
|
+
* @param fn - a function to test each element.
|
|
641
|
+
*
|
|
642
|
+
* @returns {boolean} **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
|
|
643
|
+
*/
|
|
628
644
|
declare function useArrayEvery<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef$1<T>[]) => unknown): ComputedRef<boolean>;
|
|
629
645
|
|
|
646
|
+
/**
|
|
647
|
+
* Reactive `Array.filter`
|
|
648
|
+
*
|
|
649
|
+
* @see https://vueuse.org/useArrayFilter
|
|
650
|
+
* @param {Array} list - the array was called upon.
|
|
651
|
+
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
|
|
652
|
+
*
|
|
653
|
+
* @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
|
+
*/
|
|
630
655
|
declare function useArrayFilter<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: T[]) => boolean): ComputedRef<T[]>;
|
|
631
656
|
|
|
657
|
+
/**
|
|
658
|
+
* Reactive `Array.find`
|
|
659
|
+
*
|
|
660
|
+
* @see https://vueuse.org/useArrayFind
|
|
661
|
+
* @param {Array} list - the array was called upon.
|
|
662
|
+
* @param fn - a function to test each element.
|
|
663
|
+
*
|
|
664
|
+
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
665
|
+
*/
|
|
632
666
|
declare function useArrayFind<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef$1<T>[]) => boolean): ComputedRef<T | undefined>;
|
|
633
667
|
|
|
668
|
+
/**
|
|
669
|
+
* Reactive `Array.findIndex`
|
|
670
|
+
*
|
|
671
|
+
* @see https://vueuse.org/useArrayFindIndex
|
|
672
|
+
* @param {Array} list - the array was called upon.
|
|
673
|
+
* @param fn - a function to test each element.
|
|
674
|
+
*
|
|
675
|
+
* @returns {number} the index of the first element in the array that passes the test. Otherwise, "-1".
|
|
676
|
+
*/
|
|
677
|
+
declare function useArrayFindIndex<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef$1<T>[]) => unknown): ComputedRef<number>;
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Reactive `Array.join`
|
|
681
|
+
*
|
|
682
|
+
* @see https://vueuse.org/useArrayJoin
|
|
683
|
+
* @param {Array} list - the array was called upon.
|
|
684
|
+
* @param {string} separator - a string to separate each pair of adjacent elements of the array. If omitted, the array elements are separated with a comma (",").
|
|
685
|
+
*
|
|
686
|
+
* @returns {string} a string with all array elements joined. If arr.length is 0, the empty string is returned.
|
|
687
|
+
*/
|
|
634
688
|
declare function useArrayJoin(list: MaybeComputedRef$1<MaybeComputedRef$1<any>[]>, separator?: MaybeComputedRef$1<string>): ComputedRef<string>;
|
|
635
689
|
|
|
690
|
+
/**
|
|
691
|
+
* Reactive `Array.map`
|
|
692
|
+
*
|
|
693
|
+
* @see https://vueuse.org/useArrayMap
|
|
694
|
+
* @param {Array} list - the array was called upon.
|
|
695
|
+
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
|
|
696
|
+
*
|
|
697
|
+
* @returns {Array} a new array with each element being the result of the callback function.
|
|
698
|
+
*/
|
|
636
699
|
declare function useArrayMap<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: T[]) => T): ComputedRef<T[]>;
|
|
637
700
|
|
|
638
701
|
declare type UseArrayReducer<PV, CV, R> = (previousValue: PV, currentValue: CV, currentIndex: number) => R;
|
|
702
|
+
/**
|
|
703
|
+
* Reactive `Array.reduce`
|
|
704
|
+
*
|
|
705
|
+
* @see https://vueuse.org/useArrayReduce
|
|
706
|
+
* @param {Array} list - the array was called upon.
|
|
707
|
+
* @param reducer - a "reducer" function.
|
|
708
|
+
*
|
|
709
|
+
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
710
|
+
*/
|
|
639
711
|
declare function useArrayReduce<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, reducer: UseArrayReducer<T, T, T>): ComputedRef<T>;
|
|
712
|
+
/**
|
|
713
|
+
* Reactive `Array.reduce`
|
|
714
|
+
*
|
|
715
|
+
* @see https://vueuse.org/useArrayReduce
|
|
716
|
+
* @param {Array} list - the array was called upon.
|
|
717
|
+
* @param reducer - a "reducer" function.
|
|
718
|
+
* @param initialValue - a value to be initialized the first time when the callback is called.
|
|
719
|
+
*
|
|
720
|
+
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
721
|
+
*/
|
|
640
722
|
declare function useArrayReduce<T, U>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, reducer: UseArrayReducer<U, T, U>, initialValue: MaybeComputedRef$1<U>): ComputedRef<U>;
|
|
641
723
|
|
|
724
|
+
/**
|
|
725
|
+
* Reactive `Array.some`
|
|
726
|
+
*
|
|
727
|
+
* @see https://vueuse.org/useArraySome
|
|
728
|
+
* @param {Array} list - the array was called upon.
|
|
729
|
+
* @param fn - a function to test each element.
|
|
730
|
+
*
|
|
731
|
+
* @returns {boolean} **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
|
|
732
|
+
*/
|
|
642
733
|
declare function useArraySome<T>(list: MaybeComputedRef$1<MaybeComputedRef$1<T>[]>, fn: (element: T, index: number, array: MaybeComputedRef$1<T>[]) => unknown): ComputedRef<boolean>;
|
|
643
734
|
|
|
644
735
|
interface UseCounterOptions {
|
|
@@ -662,7 +753,15 @@ declare function useCounter(initialValue?: number, options?: UseCounterOptions):
|
|
|
662
753
|
};
|
|
663
754
|
|
|
664
755
|
declare type DateLike = Date | number | string | undefined;
|
|
665
|
-
|
|
756
|
+
interface UseDateFormatOptions {
|
|
757
|
+
/**
|
|
758
|
+
* The locale(s) to used for dd/ddd/dddd format
|
|
759
|
+
*
|
|
760
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
|
|
761
|
+
*/
|
|
762
|
+
locales?: Intl.LocalesArgument;
|
|
763
|
+
}
|
|
764
|
+
declare const formatDate: (date: Date, formatStr: string, locales?: Intl.LocalesArgument) => string;
|
|
666
765
|
declare const normalizeDate: (date: DateLike) => Date;
|
|
667
766
|
/**
|
|
668
767
|
* Get the formatted date according to the string of tokens passed in.
|
|
@@ -670,13 +769,15 @@ declare const normalizeDate: (date: DateLike) => Date;
|
|
|
670
769
|
* @see https://vueuse.org/useDateFormat
|
|
671
770
|
* @param date
|
|
672
771
|
* @param formatStr
|
|
772
|
+
* @param options
|
|
673
773
|
*/
|
|
674
|
-
declare function useDateFormat(date: MaybeComputedRef$1<DateLike>, formatStr?: MaybeComputedRef$1<string
|
|
774
|
+
declare function useDateFormat(date: MaybeComputedRef$1<DateLike>, formatStr?: MaybeComputedRef$1<string>, options?: UseDateFormatOptions): vue_demi.ComputedRef<string>;
|
|
675
775
|
declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
676
776
|
|
|
677
777
|
/**
|
|
678
778
|
* Debounce execution of a function.
|
|
679
779
|
*
|
|
780
|
+
* @see https://vueuse.org/useDebounceFn
|
|
680
781
|
* @param fn A function to be executed after delay milliseconds debounced.
|
|
681
782
|
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
682
783
|
* @param opts options
|
|
@@ -699,6 +800,11 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
699
800
|
*/
|
|
700
801
|
immediate?: boolean;
|
|
701
802
|
}
|
|
803
|
+
/**
|
|
804
|
+
* Reactive counter increases on every interval
|
|
805
|
+
*
|
|
806
|
+
* @see https://vueuse.org/useInterval
|
|
807
|
+
*/
|
|
702
808
|
declare function useInterval(interval?: MaybeComputedRef<number>, options?: UseIntervalOptions<false>): Ref<number>;
|
|
703
809
|
declare function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>): {
|
|
704
810
|
counter: Ref<number>;
|
|
@@ -872,8 +978,8 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
|
|
|
872
978
|
/**
|
|
873
979
|
* Shorthand for watching value to be truthy
|
|
874
980
|
*
|
|
875
|
-
* @see https://vueuse.
|
|
981
|
+
* @see https://vueuse.org/whenever
|
|
876
982
|
*/
|
|
877
983
|
declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
|
|
878
984
|
|
|
879
|
-
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, 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, 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 };
|
|
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 };
|
package/index.iife.js
CHANGED
|
@@ -679,22 +679,27 @@
|
|
|
679
679
|
}
|
|
680
680
|
|
|
681
681
|
function syncRef(left, right, options = {}) {
|
|
682
|
+
var _a, _b;
|
|
682
683
|
const {
|
|
683
684
|
flush = "sync",
|
|
684
685
|
deep = false,
|
|
685
686
|
immediate = true,
|
|
686
|
-
direction = "both"
|
|
687
|
+
direction = "both",
|
|
688
|
+
transform = {}
|
|
687
689
|
} = options;
|
|
688
|
-
let
|
|
690
|
+
let watchLeft;
|
|
691
|
+
let watchRight;
|
|
692
|
+
const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
|
|
693
|
+
const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
|
|
689
694
|
if (direction === "both" || direction === "ltr") {
|
|
690
|
-
|
|
695
|
+
watchLeft = vueDemi.watch(left, (newValue) => right.value = transformLTR(newValue), { flush, deep, immediate });
|
|
691
696
|
}
|
|
692
697
|
if (direction === "both" || direction === "rtl") {
|
|
693
|
-
|
|
698
|
+
watchRight = vueDemi.watch(right, (newValue) => left.value = transformRTL(newValue), { flush, deep, immediate });
|
|
694
699
|
}
|
|
695
700
|
return () => {
|
|
696
|
-
|
|
697
|
-
|
|
701
|
+
watchLeft == null ? void 0 : watchLeft();
|
|
702
|
+
watchRight == null ? void 0 : watchRight();
|
|
698
703
|
};
|
|
699
704
|
}
|
|
700
705
|
|
|
@@ -900,6 +905,10 @@
|
|
|
900
905
|
return vueDemi.computed(() => shared.resolveUnref(shared.resolveUnref(list).find((element, index, array) => fn(shared.resolveUnref(element), index, array))));
|
|
901
906
|
}
|
|
902
907
|
|
|
908
|
+
function useArrayFindIndex(list, fn) {
|
|
909
|
+
return vueDemi.computed(() => shared.resolveUnref(list).findIndex((element, index, array) => fn(shared.resolveUnref(element), index, array)));
|
|
910
|
+
}
|
|
911
|
+
|
|
903
912
|
function useArrayJoin(list, separator) {
|
|
904
913
|
return vueDemi.computed(() => shared.resolveUnref(list).map((i) => shared.resolveUnref(i)).join(shared.resolveUnref(separator)));
|
|
905
914
|
}
|
|
@@ -939,7 +948,7 @@
|
|
|
939
948
|
|
|
940
949
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
941
950
|
const REGEX_FORMAT = /\[([^\]]+)]|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;
|
|
942
|
-
const formatDate = (date, formatStr) => {
|
|
951
|
+
const formatDate = (date, formatStr, locales) => {
|
|
943
952
|
const years = date.getFullYear();
|
|
944
953
|
const month = date.getMonth();
|
|
945
954
|
const days = date.getDate();
|
|
@@ -949,24 +958,27 @@
|
|
|
949
958
|
const milliseconds = date.getMilliseconds();
|
|
950
959
|
const day = date.getDay();
|
|
951
960
|
const matches = {
|
|
952
|
-
YY: String(years).slice(-2),
|
|
953
|
-
YYYY: years,
|
|
954
|
-
M: month + 1,
|
|
955
|
-
MM: `${month + 1}`.padStart(2, "0"),
|
|
956
|
-
D: String(days),
|
|
957
|
-
DD: `${days}`.padStart(2, "0"),
|
|
958
|
-
H: String(hours),
|
|
959
|
-
HH: `${hours}`.padStart(2, "0"),
|
|
960
|
-
h: `${hours % 12 || 12}`.padStart(1, "0"),
|
|
961
|
-
hh: `${hours % 12 || 12}`.padStart(2, "0"),
|
|
962
|
-
m: String(minutes),
|
|
963
|
-
mm: `${minutes}`.padStart(2, "0"),
|
|
964
|
-
s: String(seconds),
|
|
965
|
-
ss: `${seconds}`.padStart(2, "0"),
|
|
966
|
-
SSS: `${milliseconds}`.padStart(3, "0"),
|
|
967
|
-
d: day
|
|
961
|
+
YY: () => String(years).slice(-2),
|
|
962
|
+
YYYY: () => years,
|
|
963
|
+
M: () => month + 1,
|
|
964
|
+
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
965
|
+
D: () => String(days),
|
|
966
|
+
DD: () => `${days}`.padStart(2, "0"),
|
|
967
|
+
H: () => String(hours),
|
|
968
|
+
HH: () => `${hours}`.padStart(2, "0"),
|
|
969
|
+
h: () => `${hours % 12 || 12}`.padStart(1, "0"),
|
|
970
|
+
hh: () => `${hours % 12 || 12}`.padStart(2, "0"),
|
|
971
|
+
m: () => String(minutes),
|
|
972
|
+
mm: () => `${minutes}`.padStart(2, "0"),
|
|
973
|
+
s: () => String(seconds),
|
|
974
|
+
ss: () => `${seconds}`.padStart(2, "0"),
|
|
975
|
+
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
976
|
+
d: () => day,
|
|
977
|
+
dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
|
|
978
|
+
ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
|
|
979
|
+
dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
|
|
968
980
|
};
|
|
969
|
-
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]);
|
|
981
|
+
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
|
|
970
982
|
};
|
|
971
983
|
const normalizeDate = (date) => {
|
|
972
984
|
if (date === null)
|
|
@@ -985,8 +997,8 @@
|
|
|
985
997
|
}
|
|
986
998
|
return new Date(date);
|
|
987
999
|
};
|
|
988
|
-
function useDateFormat(date, formatStr = "HH:mm:ss") {
|
|
989
|
-
return vueDemi.computed(() => formatDate(normalizeDate(shared.resolveUnref(date)), shared.resolveUnref(formatStr)));
|
|
1000
|
+
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
1001
|
+
return vueDemi.computed(() => formatDate(normalizeDate(shared.resolveUnref(date)), shared.resolveUnref(formatStr), options == null ? void 0 : options.locales));
|
|
990
1002
|
}
|
|
991
1003
|
|
|
992
1004
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1615,6 +1627,7 @@
|
|
|
1615
1627
|
exports.useArrayEvery = useArrayEvery;
|
|
1616
1628
|
exports.useArrayFilter = useArrayFilter;
|
|
1617
1629
|
exports.useArrayFind = useArrayFind;
|
|
1630
|
+
exports.useArrayFindIndex = useArrayFindIndex;
|
|
1618
1631
|
exports.useArrayJoin = useArrayJoin;
|
|
1619
1632
|
exports.useArrayMap = useArrayMap;
|
|
1620
1633
|
exports.useArrayReduce = useArrayReduce;
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(o,i,_){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(_){for(var g in _)o[g]=_[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(w,m,b){return Array.isArray(w)?(w.length=Math.max(w.length,m),w.splice(m,1,b),b):(w[m]=b,b)},o.del=function(w,m){if(Array.isArray(w)){w.splice(m,1);return}delete w[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,_){"use strict";var g=Object.defineProperty,w=Object.defineProperties,m=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,X=(e,t,r)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Le=(e,t)=>{for(var r in t||(t={}))Ge.call(t,r)&&X(e,r,t[r]);if(b)for(var r of b(t))ze.call(t,r)&&X(e,r,t[r]);return e},Ve=(e,t)=>w(e,m(t));function Z(e,t){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=e()},Ve(Le({},t),{flush:(r=t==null?void 0:t.flush)!=null?r:"sync"})),i.readonly(n)}var k;const I=typeof window!="undefined",Je=e=>typeof e!="undefined",Xe=(e,...t)=>{e||console.warn(...t)},q=Object.prototype.toString,Ze=e=>typeof e=="boolean",W=e=>typeof e=="function",ke=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&&((k=window==null?void 0:window.navigator)==null?void 0:k.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function h(e){return typeof e=="function"?e():i.unref(e)}function E(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=h(e),c=h(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=h(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 Y(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 _t=Object.defineProperty,re=Object.getOwnPropertySymbols,yt=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,ne=(e,t,r)=>t in e?_t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ht=(e,t)=>{for(var r in t||(t={}))yt.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 wt(e,t){if(typeof Symbol!="undefined"){const r=ht({},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 G(e,t){const r=(t==null?void 0:t.computedGetter)===!1?i.unref:h;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"?G(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()},_.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 E(B(t,r),e)}function z(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 E(H(t,r,n),e)}function L(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,y)=>(n=d,a=y,{get(){return u()},set(O){c(O)}}));function u(d=!0){return d&&n(),r}function c(d,y=!0){var O,$;if(d===r)return;const P=r;((O=t.onBeforeChange)==null?void 0:O.call(t,d,P))!==!1&&(r=d,($=t.onChanged)==null||$.call(t,d,P),y&&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={}){const{flush:n="sync",deep:a=!1,immediate:l=!0,direction:u="both"}=r;let c,p;return(u==="both"||u==="ltr")&&(c=i.watch(e,v=>t.value=v,{flush:n,deep:a,immediate:l})),(u==="both"||u==="rtl")&&(p=i.watch(t,v=>e.value=v,{flush:n,deep:a,immediate:l})),()=>{c==null||c(),p==null||p()}}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 Et=Object.defineProperty,Ft=Object.defineProperties,Tt=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertySymbols,Ut=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,fe=(e,t,r)=>t in e?Et(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)=>Ft(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 Yt(e){i.getCurrentInstance()&&i.onUnmounted(e)}function Gt(e){let t=!1;function r(s,{flush:d="sync",deep:y=!1,timeout:O,throwOnTimeout:$}={}){let P=null;const J=[new Promise(N=>{P=i.watch(e,j=>{s(j)!==t&&(P==null||P(),N(j))},{flush:d,deep:y,immediate:!0})})];return O!=null&&J.push(Y(O,$).then(()=>h(e)).finally(()=>P==null?void 0:P())),Promise.race(J)}function n(s,d){if(!i.isRef(s))return r(j=>j===s,d);const{flush:y="sync",deep:O=!1,timeout:$,throwOnTimeout:P}=d??{};let A=null;const N=[new Promise(j=>{A=i.watch([e,s],([Ye,tn])=>{t!==(Ye===tn)&&(A==null||A(),j(Ye))},{flush:y,deep:O,immediate:!0})})];return $!=null&&N.push(Y($,P).then(()=>h(e)).finally(()=>(A==null||A(),h(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(y=>{const O=Array.from(y);return O.includes(s)||O.includes(h(s))},d)}function v(s){return f(1,s)}function f(s=1,d){let y=-1;return r(()=>(y+=1,y>=s),d)}return Array.isArray(h(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 zt(e,t){return i.computed(()=>_.resolveUnref(e).every((r,n,a)=>t(_.resolveUnref(r),n,a)))}function Lt(e,t){return i.computed(()=>_.resolveUnref(e).map(r=>_.resolveUnref(r)).filter(t))}function Vt(e,t){return i.computed(()=>_.resolveUnref(_.resolveUnref(e).find((r,n,a)=>t(_.resolveUnref(r),n,a))))}function Jt(e,t){return i.computed(()=>_.resolveUnref(e).map(r=>_.resolveUnref(r)).join(_.resolveUnref(t)))}function Xt(e,t){return i.computed(()=>_.resolveUnref(e).map(r=>_.resolveUnref(r)).map(t))}function Zt(e,t,...r){const n=(a,l,u)=>t(_.resolveUnref(a),_.resolveUnref(l),u);return i.computed(()=>{const a=_.resolveUnref(e);return r.length?a.reduce(n,_.resolveUnref(r[0])):a.reduce(n)})}function kt(e,t){return i.computed(()=>_.resolveUnref(e).some((r,n,a)=>t(_.resolveUnref(r),n,a)))}function qt(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 Kt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Qt=/\[([^\]]+)]|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)=>{const r=e.getFullYear(),n=e.getMonth(),a=e.getDate(),l=e.getHours(),u=e.getMinutes(),c=e.getSeconds(),p=e.getMilliseconds(),v=e.getDay(),f={YY:String(r).slice(-2),YYYY:r,M:n+1,MM:`${n+1}`.padStart(2,"0"),D:String(a),DD:`${a}`.padStart(2,"0"),H:String(l),HH:`${l}`.padStart(2,"0"),h:`${l%12||12}`.padStart(1,"0"),hh:`${l%12||12}`.padStart(2,"0"),m:String(u),mm:`${u}`.padStart(2,"0"),s:String(c),ss:`${c}`.padStart(2,"0"),SSS:`${p}`.padStart(3,"0"),d:v};return t.replace(Qt,(s,d)=>d||f[s])},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(Kt);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 Dt(e,t="HH:mm:ss"){return i.computed(()=>de(pe(_.resolveUnref(e)),_.resolveUnref(t)))}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,h(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 xt=Object.defineProperty,_e=Object.getOwnPropertySymbols,er=Object.prototype.hasOwnProperty,tr=Object.prototype.propertyIsEnumerable,ye=(e,t,r)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rr=(e,t)=>{for(var r in t||(t={}))er.call(t,r)&&ye(e,r,t[r]);if(_e)for(var r of _e(t))tr.call(t,r)&&ye(e,r,t[r]);return e};function nr(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?rr({counter:a},l):a}function or(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)},_.resolveUnref(t))}return n&&(a.value=!0,I&&p()),S(c),{isPending:a,start:p,stop:c}}var ar=Object.defineProperty,he=Object.getOwnPropertySymbols,ir=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,we=(e,t,r)=>t in e?ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ur=(e,t)=>{for(var r in t||(t={}))ir.call(t,r)&&we(e,r,t[r]);if(he)for(var r of he(t))lr.call(t,r)&&we(e,r,t[r]);return e};function cr(e=1e3,t={}){const{controls:r=!1}=t,n=Oe(Q,e,t),a=i.computed(()=>!n.isPending.value);return r?ur({ready:a},n):a}function sr(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=h(r);return l.value=l.value===p?h(n):p,l.value}}return a?u:[l,u]}function fr(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,dr=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable,vr=(e,t)=>{var r={};for(var n in e)dr.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&&pr.call(e,n)&&(r[n]=e[n]);return r};function F(e,t,r={}){const n=r,{eventFilter:a=T}=n,l=vr(n,["eventFilter"]);return i.watch(e,E(a,t),l)}var Pe=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,yr=Object.prototype.propertyIsEnumerable,Or=(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&&yr.call(e,n)&&(r[n]=e[n]);return r};function hr(e,t,r){const n=r,{count:a}=n,l=Or(n,["count"]),u=i.ref(0),c=F(e,(...p)=>{u.value+=1,u.value>=h(a)&&i.nextTick(()=>c()),t(...p)},l);return{count:u,stop:c}}var wr=Object.defineProperty,gr=Object.defineProperties,Pr=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,$e=(e,t,r)=>t in e?wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mr=(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},br=(e,t)=>gr(e,Pr(t)),$r=(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=$r(n,["debounce","maxWait"]);return F(e,t,br(mr({},u),{eventFilter:B(a,{maxWait:l})}))}var Sr=Object.defineProperty,Ar=Object.defineProperties,jr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,Ie=(e,t,r)=>t in e?Sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ir=(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)=>Ar(e,jr(t)),Fr=(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 V(e,t,r={}){const n=r,{eventFilter:a=T}=n,l=Fr(n,["eventFilter"]),u=E(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(Ir({},l),{flush:"sync"}))),c=y=>{const O=d.value;y(),s.value+=d.value-O},f.push(i.watch(e,(...y)=>{const O=s.value>0&&s.value===d.value;s.value=0,d.value=0,!O&&u(...y)},l)),v=()=>{f.forEach(y=>y())}}return{stop:v,ignoreUpdates:c,ignorePrevAsyncUpdates:p}}function Tr(e,t,r){const n=i.watch(e,(...a)=>(i.nextTick(()=>n()),t(...a)),r)}var Ur=Object.defineProperty,Rr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,Te=(e,t,r)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mr=(e,t)=>{for(var r in t||(t={}))Ee.call(t,r)&&Te(e,r,t[r]);if(C)for(var r of C(t))Fe.call(t,r)&&Te(e,r,t[r]);return e},Nr=(e,t)=>Rr(e,Cr(t)),Wr=(e,t)=>{var r={};for(var n in e)Ee.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&&Fe.call(e,n)&&(r[n]=e[n]);return r};function Ue(e,t,r={}){const n=r,{eventFilter:a}=n,l=Wr(n,["eventFilter"]),{eventFilter:u,pause:c,resume:p,isActive:v}=D(a);return{stop:F(e,t,Nr(Mr({},l),{eventFilter:u})),pause:c,resume:p,isActive:v}}var Br=Object.defineProperty,Hr=Object.defineProperties,Yr=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,Me=(e,t,r)=>t in e?Br(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},zr=(e,t)=>Hr(e,Yr(t)),Lr=(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=Lr(n,["throttle","trailing","leading"]);return F(e,t,zr(Gr({},c),{eventFilter:H(a,l,u)}))}var Vr=Object.defineProperty,Jr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Be=(e,t,r)=>t in e?Vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,qr=(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))kr.call(t,r)&&Be(e,r,t[r]);return e},Kr=(e,t)=>Jr(e,Xr(t));function Qr(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=V(e,u,r),{ignoreUpdates:p}=c,v=()=>{let f;return p(()=>{f=u(Dr(e),xr(e))}),f};return Kr(qr({},c),{trigger:v})}function Dr(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 xr(e){return Array.isArray(e)?e.map(()=>{}):void 0}function en(e,t,r){return i.watch(e,(n,a,l)=>{n&&t(n,a,l)},r)}o.__onlyVue3=x,o.assert=Xe,o.autoResetRef=ie,o.bypassFilter=T,o.clamp=xe,o.computedEager=Z,o.computedWithControl=ee,o.containsProp=it,o.controlledComputed=ee,o.controlledRef=$t,o.createEventHook=ct,o.createFilterWrapper=E,o.createGlobalState=st,o.createInjectionState=ft,o.createReactiveFn=G,o.createSharedComposable=dt,o.createSingletonPromise=ot,o.debounceFilter=B,o.debouncedRef=z,o.debouncedWatch=Se,o.directiveHooks=rt,o.eagerComputed=Z,o.extendRef=te,o.formatDate=de,o.get=pt,o.identity=nt,o.ignorableWatch=V,o.increaseWithUnit=lt,o.invoke=at,o.isBoolean=Ze,o.isClient=I,o.isDef=Je,o.isDefined=vt,o.isFunction=W,o.isIOS=tt,o.isNumber=ke,o.isObject=Ke,o.isString=qe,o.isWindow=Qe,o.makeDestructurable=wt,o.noop=Q,o.normalizeDate=pe,o.now=De,o.objectPick=ut,o.pausableFilter=D,o.pausableWatch=Ue,o.promiseTimeout=Y,o.rand=et,o.reactify=G,o.reactifyObject=gt,o.reactiveComputed=ae,o.reactiveOmit=Pt,o.reactivePick=mt,o.refAutoReset=ie,o.refDebounced=z,o.refDefault=bt,o.refThrottled=L,o.refWithControl=ce,o.resolveRef=St,o.resolveUnref=h,o.set=At,o.syncRef=jt,o.syncRefs=It,o.throttleFilter=H,o.throttledRef=L,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=Yt,o.until=Gt,o.useArrayEvery=zt,o.useArrayFilter=Lt,o.useArrayFind=Vt,o.useArrayJoin=Jt,o.useArrayMap=Xt,o.useArrayReduce=Zt,o.useArraySome=kt,o.useCounter=qt,o.useDateFormat=Dt,o.useDebounce=z,o.useDebounceFn=le,o.useInterval=nr,o.useIntervalFn=ve,o.useLastChanged=or,o.useThrottle=L,o.useThrottleFn=ue,o.useTimeout=cr,o.useTimeoutFn=Oe,o.useToggle=sr,o.watchArray=fr,o.watchAtMost=hr,o.watchDebounced=Se,o.watchIgnorable=V,o.watchOnce=Tr,o.watchPausable=Ue,o.watchThrottled=Ne,o.watchTriggerable=Qr,o.watchWithFilter=F,o.whenever=en,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi,VueUse);
|
|
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);
|
package/index.mjs
CHANGED
|
@@ -606,22 +606,27 @@ function set(...args) {
|
|
|
606
606
|
}
|
|
607
607
|
|
|
608
608
|
function syncRef(left, right, options = {}) {
|
|
609
|
+
var _a, _b;
|
|
609
610
|
const {
|
|
610
611
|
flush = "sync",
|
|
611
612
|
deep = false,
|
|
612
613
|
immediate = true,
|
|
613
|
-
direction = "both"
|
|
614
|
+
direction = "both",
|
|
615
|
+
transform = {}
|
|
614
616
|
} = options;
|
|
615
|
-
let
|
|
617
|
+
let watchLeft;
|
|
618
|
+
let watchRight;
|
|
619
|
+
const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
|
|
620
|
+
const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
|
|
616
621
|
if (direction === "both" || direction === "ltr") {
|
|
617
|
-
|
|
622
|
+
watchLeft = watch(left, (newValue) => right.value = transformLTR(newValue), { flush, deep, immediate });
|
|
618
623
|
}
|
|
619
624
|
if (direction === "both" || direction === "rtl") {
|
|
620
|
-
|
|
625
|
+
watchRight = watch(right, (newValue) => left.value = transformRTL(newValue), { flush, deep, immediate });
|
|
621
626
|
}
|
|
622
627
|
return () => {
|
|
623
|
-
|
|
624
|
-
|
|
628
|
+
watchLeft == null ? void 0 : watchLeft();
|
|
629
|
+
watchRight == null ? void 0 : watchRight();
|
|
625
630
|
};
|
|
626
631
|
}
|
|
627
632
|
|
|
@@ -827,6 +832,10 @@ function useArrayFind(list, fn) {
|
|
|
827
832
|
return computed(() => resolveUnref$1(resolveUnref$1(list).find((element, index, array) => fn(resolveUnref$1(element), index, array))));
|
|
828
833
|
}
|
|
829
834
|
|
|
835
|
+
function useArrayFindIndex(list, fn) {
|
|
836
|
+
return computed(() => resolveUnref$1(list).findIndex((element, index, array) => fn(resolveUnref$1(element), index, array)));
|
|
837
|
+
}
|
|
838
|
+
|
|
830
839
|
function useArrayJoin(list, separator) {
|
|
831
840
|
return computed(() => resolveUnref$1(list).map((i) => resolveUnref$1(i)).join(resolveUnref$1(separator)));
|
|
832
841
|
}
|
|
@@ -866,7 +875,7 @@ function useCounter(initialValue = 0, options = {}) {
|
|
|
866
875
|
|
|
867
876
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
868
877
|
const REGEX_FORMAT = /\[([^\]]+)]|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;
|
|
869
|
-
const formatDate = (date, formatStr) => {
|
|
878
|
+
const formatDate = (date, formatStr, locales) => {
|
|
870
879
|
const years = date.getFullYear();
|
|
871
880
|
const month = date.getMonth();
|
|
872
881
|
const days = date.getDate();
|
|
@@ -876,24 +885,27 @@ const formatDate = (date, formatStr) => {
|
|
|
876
885
|
const milliseconds = date.getMilliseconds();
|
|
877
886
|
const day = date.getDay();
|
|
878
887
|
const matches = {
|
|
879
|
-
YY: String(years).slice(-2),
|
|
880
|
-
YYYY: years,
|
|
881
|
-
M: month + 1,
|
|
882
|
-
MM: `${month + 1}`.padStart(2, "0"),
|
|
883
|
-
D: String(days),
|
|
884
|
-
DD: `${days}`.padStart(2, "0"),
|
|
885
|
-
H: String(hours),
|
|
886
|
-
HH: `${hours}`.padStart(2, "0"),
|
|
887
|
-
h: `${hours % 12 || 12}`.padStart(1, "0"),
|
|
888
|
-
hh: `${hours % 12 || 12}`.padStart(2, "0"),
|
|
889
|
-
m: String(minutes),
|
|
890
|
-
mm: `${minutes}`.padStart(2, "0"),
|
|
891
|
-
s: String(seconds),
|
|
892
|
-
ss: `${seconds}`.padStart(2, "0"),
|
|
893
|
-
SSS: `${milliseconds}`.padStart(3, "0"),
|
|
894
|
-
d: day
|
|
888
|
+
YY: () => String(years).slice(-2),
|
|
889
|
+
YYYY: () => years,
|
|
890
|
+
M: () => month + 1,
|
|
891
|
+
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
892
|
+
D: () => String(days),
|
|
893
|
+
DD: () => `${days}`.padStart(2, "0"),
|
|
894
|
+
H: () => String(hours),
|
|
895
|
+
HH: () => `${hours}`.padStart(2, "0"),
|
|
896
|
+
h: () => `${hours % 12 || 12}`.padStart(1, "0"),
|
|
897
|
+
hh: () => `${hours % 12 || 12}`.padStart(2, "0"),
|
|
898
|
+
m: () => String(minutes),
|
|
899
|
+
mm: () => `${minutes}`.padStart(2, "0"),
|
|
900
|
+
s: () => String(seconds),
|
|
901
|
+
ss: () => `${seconds}`.padStart(2, "0"),
|
|
902
|
+
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
903
|
+
d: () => day,
|
|
904
|
+
dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
|
|
905
|
+
ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
|
|
906
|
+
dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
|
|
895
907
|
};
|
|
896
|
-
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]);
|
|
908
|
+
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
|
|
897
909
|
};
|
|
898
910
|
const normalizeDate = (date) => {
|
|
899
911
|
if (date === null)
|
|
@@ -912,8 +924,8 @@ const normalizeDate = (date) => {
|
|
|
912
924
|
}
|
|
913
925
|
return new Date(date);
|
|
914
926
|
};
|
|
915
|
-
function useDateFormat(date, formatStr = "HH:mm:ss") {
|
|
916
|
-
return computed(() => formatDate(normalizeDate(resolveUnref$1(date)), resolveUnref$1(formatStr)));
|
|
927
|
+
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
928
|
+
return computed(() => formatDate(normalizeDate(resolveUnref$1(date)), resolveUnref$1(formatStr), options == null ? void 0 : options.locales));
|
|
917
929
|
}
|
|
918
930
|
|
|
919
931
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1464,4 +1476,4 @@ function whenever(source, cb, options) {
|
|
|
1464
1476
|
}, options);
|
|
1465
1477
|
}
|
|
1466
1478
|
|
|
1467
|
-
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, 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 };
|
|
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 };
|