@vueuse/shared 9.2.0 → 9.3.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 +36 -18
- package/index.d.ts +22 -9
- package/index.iife.js +130 -71
- package/index.iife.min.js +1 -1
- package/index.mjs +36 -16
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var vueDemi = require('vue-demi');
|
|
6
4
|
|
|
7
5
|
var __defProp$9 = Object.defineProperty;
|
|
@@ -717,8 +715,7 @@ function tryOnUnmounted(fn) {
|
|
|
717
715
|
vueDemi.onUnmounted(fn);
|
|
718
716
|
}
|
|
719
717
|
|
|
720
|
-
function
|
|
721
|
-
let isNot = false;
|
|
718
|
+
function createUntil(r, isNot = false) {
|
|
722
719
|
function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
|
|
723
720
|
let stop = null;
|
|
724
721
|
const watcher = new Promise((resolve) => {
|
|
@@ -800,8 +797,7 @@ function until(r) {
|
|
|
800
797
|
changed,
|
|
801
798
|
changedTimes,
|
|
802
799
|
get not() {
|
|
803
|
-
|
|
804
|
-
return this;
|
|
800
|
+
return createUntil(r, !isNot);
|
|
805
801
|
}
|
|
806
802
|
};
|
|
807
803
|
return instance;
|
|
@@ -816,13 +812,15 @@ function until(r) {
|
|
|
816
812
|
changed,
|
|
817
813
|
changedTimes,
|
|
818
814
|
get not() {
|
|
819
|
-
|
|
820
|
-
return this;
|
|
815
|
+
return createUntil(r, !isNot);
|
|
821
816
|
}
|
|
822
817
|
};
|
|
823
818
|
return instance;
|
|
824
819
|
}
|
|
825
820
|
}
|
|
821
|
+
function until(r) {
|
|
822
|
+
return createUntil(r);
|
|
823
|
+
}
|
|
826
824
|
|
|
827
825
|
function useArrayEvery(list, fn) {
|
|
828
826
|
return vueDemi.computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
@@ -878,8 +876,15 @@ function useCounter(initialValue = 0, options = {}) {
|
|
|
878
876
|
}
|
|
879
877
|
|
|
880
878
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
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;
|
|
882
|
-
const
|
|
879
|
+
const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
880
|
+
const defaultMeridiem = (hours, minutes, isLowercase, hasPeriod) => {
|
|
881
|
+
let m = hours < 12 ? "AM" : "PM";
|
|
882
|
+
if (hasPeriod)
|
|
883
|
+
m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
|
|
884
|
+
return isLowercase ? m.toLowerCase() : m;
|
|
885
|
+
};
|
|
886
|
+
const formatDate = (date, formatStr, options = {}) => {
|
|
887
|
+
var _a;
|
|
883
888
|
const years = date.getFullYear();
|
|
884
889
|
const month = date.getMonth();
|
|
885
890
|
const days = date.getDate();
|
|
@@ -888,11 +893,14 @@ const formatDate = (date, formatStr, locales) => {
|
|
|
888
893
|
const seconds = date.getSeconds();
|
|
889
894
|
const milliseconds = date.getMilliseconds();
|
|
890
895
|
const day = date.getDay();
|
|
896
|
+
const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
|
|
891
897
|
const matches = {
|
|
892
898
|
YY: () => String(years).slice(-2),
|
|
893
899
|
YYYY: () => years,
|
|
894
900
|
M: () => month + 1,
|
|
895
901
|
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
902
|
+
MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
|
|
903
|
+
MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
|
|
896
904
|
D: () => String(days),
|
|
897
905
|
DD: () => `${days}`.padStart(2, "0"),
|
|
898
906
|
H: () => String(hours),
|
|
@@ -905,9 +913,13 @@ const formatDate = (date, formatStr, locales) => {
|
|
|
905
913
|
ss: () => `${seconds}`.padStart(2, "0"),
|
|
906
914
|
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
907
915
|
d: () => day,
|
|
908
|
-
dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
|
|
909
|
-
ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
|
|
910
|
-
dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
|
|
916
|
+
dd: () => date.toLocaleDateString(options.locales, { weekday: "narrow" }),
|
|
917
|
+
ddd: () => date.toLocaleDateString(options.locales, { weekday: "short" }),
|
|
918
|
+
dddd: () => date.toLocaleDateString(options.locales, { weekday: "long" }),
|
|
919
|
+
A: () => meridiem(hours, minutes),
|
|
920
|
+
AA: () => meridiem(hours, minutes, false, true),
|
|
921
|
+
a: () => meridiem(hours, minutes, true),
|
|
922
|
+
aa: () => meridiem(hours, minutes, true, true)
|
|
911
923
|
};
|
|
912
924
|
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
|
|
913
925
|
};
|
|
@@ -929,7 +941,7 @@ const normalizeDate = (date) => {
|
|
|
929
941
|
return new Date(date);
|
|
930
942
|
};
|
|
931
943
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
932
|
-
return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options
|
|
944
|
+
return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options));
|
|
933
945
|
}
|
|
934
946
|
|
|
935
947
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -994,10 +1006,15 @@ var __spreadValues$6 = (a, b) => {
|
|
|
994
1006
|
function useInterval(interval = 1e3, options = {}) {
|
|
995
1007
|
const {
|
|
996
1008
|
controls: exposeControls = false,
|
|
997
|
-
immediate = true
|
|
1009
|
+
immediate = true,
|
|
1010
|
+
callback
|
|
998
1011
|
} = options;
|
|
999
1012
|
const counter = vueDemi.ref(0);
|
|
1000
|
-
const
|
|
1013
|
+
const update = () => counter.value += 1;
|
|
1014
|
+
const controls = useIntervalFn(callback ? () => {
|
|
1015
|
+
update();
|
|
1016
|
+
callback(counter.value);
|
|
1017
|
+
} : update, interval, { immediate });
|
|
1001
1018
|
if (exposeControls) {
|
|
1002
1019
|
return __spreadValues$6({
|
|
1003
1020
|
counter
|
|
@@ -1070,9 +1087,10 @@ var __spreadValues$5 = (a, b) => {
|
|
|
1070
1087
|
};
|
|
1071
1088
|
function useTimeout(interval = 1e3, options = {}) {
|
|
1072
1089
|
const {
|
|
1073
|
-
controls: exposeControls = false
|
|
1090
|
+
controls: exposeControls = false,
|
|
1091
|
+
callback
|
|
1074
1092
|
} = options;
|
|
1075
|
-
const controls = useTimeoutFn(noop, interval, options);
|
|
1093
|
+
const controls = useTimeoutFn(callback != null ? callback : noop, interval, options);
|
|
1076
1094
|
const ready = vueDemi.computed(() => !controls.isPending.value);
|
|
1077
1095
|
if (exposeControls) {
|
|
1078
1096
|
return __spreadValues$5({
|
package/index.d.ts
CHANGED
|
@@ -76,11 +76,11 @@ interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
|
76
76
|
unwrap?: Unwrap;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Overload 1: Unwrap set to false
|
|
80
80
|
*/
|
|
81
81
|
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions<false>>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef$1<Extend> & R;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Overload 2: Unwrap unset or set to true
|
|
84
84
|
*/
|
|
85
85
|
declare function extendRef<R extends Ref<any>, Extend extends object, Options extends ExtendRefOptions>(ref: R, extend: Extend, options?: Options): Extend & R;
|
|
86
86
|
|
|
@@ -161,7 +161,7 @@ declare type Awaitable<T> = Promise<T> | T;
|
|
|
161
161
|
declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
162
162
|
interface Pausable {
|
|
163
163
|
/**
|
|
164
|
-
* A ref indicate whether a
|
|
164
|
+
* A ref indicate whether a pausable instance is active
|
|
165
165
|
*/
|
|
166
166
|
isActive: Ref<boolean>;
|
|
167
167
|
/**
|
|
@@ -430,7 +430,7 @@ interface ControlledRefOptions<T> {
|
|
|
430
430
|
/**
|
|
431
431
|
* Callback function after the ref changed
|
|
432
432
|
*
|
|
433
|
-
* This
|
|
433
|
+
* This happens synchronously, with less overhead compare to `watch`
|
|
434
434
|
*/
|
|
435
435
|
onChanged?: (value: T, oldValue: T) => void;
|
|
436
436
|
}
|
|
@@ -763,21 +763,26 @@ declare function useCounter(initialValue?: number, options?: UseCounterOptions):
|
|
|
763
763
|
declare type DateLike = Date | number | string | undefined;
|
|
764
764
|
interface UseDateFormatOptions {
|
|
765
765
|
/**
|
|
766
|
-
* The locale(s) to used for dd/ddd/dddd format
|
|
766
|
+
* The locale(s) to used for dd/ddd/dddd/MMM/MMMM format
|
|
767
767
|
*
|
|
768
768
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
|
|
769
769
|
*/
|
|
770
770
|
locales?: Intl.LocalesArgument;
|
|
771
|
+
/**
|
|
772
|
+
* A custom function to re-modify the way to display meridiem
|
|
773
|
+
*
|
|
774
|
+
*/
|
|
775
|
+
customMeridiem?: (hours: number, minutes: number, isLowercase?: boolean, hasPeriod?: boolean) => string;
|
|
771
776
|
}
|
|
772
|
-
declare const formatDate: (date: Date, formatStr: string,
|
|
777
|
+
declare const formatDate: (date: Date, formatStr: string, options?: UseDateFormatOptions) => string;
|
|
773
778
|
declare const normalizeDate: (date: DateLike) => Date;
|
|
774
779
|
/**
|
|
775
780
|
* Get the formatted date according to the string of tokens passed in.
|
|
776
781
|
*
|
|
777
782
|
* @see https://vueuse.org/useDateFormat
|
|
778
|
-
* @param date
|
|
779
|
-
* @param formatStr
|
|
780
|
-
* @param options
|
|
783
|
+
* @param date - The date to format, can either be a `Date` object, a timestamp, or a string
|
|
784
|
+
* @param formatStr - The combination of tokens to format the date
|
|
785
|
+
* @param options - UseDateFormatOptions
|
|
781
786
|
*/
|
|
782
787
|
declare function useDateFormat(date: MaybeComputedRef<DateLike>, formatStr?: MaybeComputedRef<string>, options?: UseDateFormatOptions): vue_demi.ComputedRef<string>;
|
|
783
788
|
declare type UseDateFormatReturn = ReturnType<typeof useDateFormat>;
|
|
@@ -807,6 +812,10 @@ interface UseIntervalOptions<Controls extends boolean> {
|
|
|
807
812
|
* @default true
|
|
808
813
|
*/
|
|
809
814
|
immediate?: boolean;
|
|
815
|
+
/**
|
|
816
|
+
* Callback on every interval
|
|
817
|
+
*/
|
|
818
|
+
callback?: (count: number) => void;
|
|
810
819
|
}
|
|
811
820
|
/**
|
|
812
821
|
* Reactive counter increases on every interval
|
|
@@ -895,6 +904,10 @@ interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOption
|
|
|
895
904
|
* @default false
|
|
896
905
|
*/
|
|
897
906
|
controls?: Controls;
|
|
907
|
+
/**
|
|
908
|
+
* Callback on timeout
|
|
909
|
+
*/
|
|
910
|
+
callback?: Fn;
|
|
898
911
|
}
|
|
899
912
|
/**
|
|
900
913
|
* Update value after a given time with controls.
|
package/index.iife.js
CHANGED
|
@@ -1,74 +1,115 @@
|
|
|
1
|
-
|
|
1
|
+
var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
2
2
|
if (VueDemi.install) {
|
|
3
3
|
return VueDemi
|
|
4
4
|
}
|
|
5
|
-
if (Vue) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
if (!Vue) {
|
|
6
|
+
console.error('[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.')
|
|
7
|
+
return VueDemi
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Vue 2.7
|
|
11
|
+
if (Vue.version.slice(0, 4) === '2.7.') {
|
|
12
|
+
for (var key in Vue) {
|
|
13
|
+
VueDemi[key] = Vue[key]
|
|
14
|
+
}
|
|
15
|
+
VueDemi.isVue2 = true
|
|
16
|
+
VueDemi.isVue3 = false
|
|
17
|
+
VueDemi.install = function () {}
|
|
18
|
+
VueDemi.Vue = Vue
|
|
19
|
+
VueDemi.Vue2 = Vue
|
|
20
|
+
VueDemi.version = Vue.version
|
|
21
|
+
VueDemi.warn = Vue.util.warn
|
|
22
|
+
function createApp(rootComponent, rootProps) {
|
|
23
|
+
var vm
|
|
24
|
+
var provide = {}
|
|
25
|
+
var app = {
|
|
26
|
+
config: Vue.config,
|
|
27
|
+
use: Vue.use.bind(Vue),
|
|
28
|
+
mixin: Vue.mixin.bind(Vue),
|
|
29
|
+
component: Vue.component.bind(Vue),
|
|
30
|
+
provide: function (key, value) {
|
|
31
|
+
provide[key] = value
|
|
32
|
+
return this
|
|
33
|
+
},
|
|
34
|
+
directive: function (name, dir) {
|
|
35
|
+
if (dir) {
|
|
36
|
+
Vue.directive(name, dir)
|
|
37
|
+
return app
|
|
38
|
+
} else {
|
|
39
|
+
return Vue.directive(name)
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
mount: function (el, hydrating) {
|
|
43
|
+
if (!vm) {
|
|
44
|
+
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
|
|
45
|
+
vm.$mount(el, hydrating)
|
|
46
|
+
return vm
|
|
47
|
+
} else {
|
|
48
|
+
return vm
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
unmount: function () {
|
|
52
|
+
if (vm) {
|
|
53
|
+
vm.$destroy()
|
|
54
|
+
vm = undefined
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
return app
|
|
59
|
+
}
|
|
60
|
+
VueDemi.createApp = createApp
|
|
61
|
+
}
|
|
62
|
+
// Vue 2.6.x
|
|
63
|
+
else if (Vue.version.slice(0, 2) === '2.') {
|
|
64
|
+
if (VueCompositionAPI) {
|
|
65
|
+
for (var key in VueCompositionAPI) {
|
|
66
|
+
VueDemi[key] = VueCompositionAPI[key]
|
|
9
67
|
}
|
|
10
68
|
VueDemi.isVue2 = true
|
|
11
69
|
VueDemi.isVue3 = false
|
|
12
|
-
VueDemi.install = function (){}
|
|
70
|
+
VueDemi.install = function () {}
|
|
13
71
|
VueDemi.Vue = Vue
|
|
14
72
|
VueDemi.Vue2 = Vue
|
|
15
73
|
VueDemi.version = Vue.version
|
|
74
|
+
} else {
|
|
75
|
+
console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.')
|
|
16
76
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
} else if (Vue.version.slice(0, 2) === '3.') {
|
|
34
|
-
for (var key in Vue) {
|
|
35
|
-
VueDemi[key] = Vue[key]
|
|
36
|
-
}
|
|
37
|
-
VueDemi.isVue2 = false
|
|
38
|
-
VueDemi.isVue3 = true
|
|
39
|
-
VueDemi.install = function (){}
|
|
40
|
-
VueDemi.Vue = Vue
|
|
41
|
-
VueDemi.Vue2 = undefined
|
|
42
|
-
VueDemi.version = Vue.version
|
|
43
|
-
VueDemi.set = function(target, key, val) {
|
|
44
|
-
if (Array.isArray(target)) {
|
|
45
|
-
target.length = Math.max(target.length, key)
|
|
46
|
-
target.splice(key, 1, val)
|
|
47
|
-
return val
|
|
48
|
-
}
|
|
49
|
-
target[key] = val
|
|
77
|
+
}
|
|
78
|
+
// Vue 3
|
|
79
|
+
else if (Vue.version.slice(0, 2) === '3.') {
|
|
80
|
+
for (var key in Vue) {
|
|
81
|
+
VueDemi[key] = Vue[key]
|
|
82
|
+
}
|
|
83
|
+
VueDemi.isVue2 = false
|
|
84
|
+
VueDemi.isVue3 = true
|
|
85
|
+
VueDemi.install = function () {}
|
|
86
|
+
VueDemi.Vue = Vue
|
|
87
|
+
VueDemi.Vue2 = undefined
|
|
88
|
+
VueDemi.version = Vue.version
|
|
89
|
+
VueDemi.set = function (target, key, val) {
|
|
90
|
+
if (Array.isArray(target)) {
|
|
91
|
+
target.length = Math.max(target.length, key)
|
|
92
|
+
target.splice(key, 1, val)
|
|
50
93
|
return val
|
|
51
94
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
95
|
+
target[key] = val
|
|
96
|
+
return val
|
|
97
|
+
}
|
|
98
|
+
VueDemi.del = function (target, key) {
|
|
99
|
+
if (Array.isArray(target)) {
|
|
100
|
+
target.splice(key, 1)
|
|
101
|
+
return
|
|
58
102
|
}
|
|
59
|
-
|
|
60
|
-
console.error('[vue-demi] Vue version ' + Vue.version + ' is unsupported.')
|
|
103
|
+
delete target[key]
|
|
61
104
|
}
|
|
62
105
|
} else {
|
|
63
|
-
console.error(
|
|
64
|
-
'[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.'
|
|
65
|
-
)
|
|
106
|
+
console.error('[vue-demi] Vue version ' + Vue.version + ' is unsupported.')
|
|
66
107
|
}
|
|
67
108
|
return VueDemi
|
|
68
109
|
})(
|
|
69
|
-
this.VueDemi = this.VueDemi || (typeof VueDemi !==
|
|
70
|
-
this.Vue || (typeof Vue !==
|
|
71
|
-
this.VueCompositionAPI || (typeof VueCompositionAPI !==
|
|
110
|
+
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
|
|
111
|
+
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
|
|
112
|
+
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
|
|
72
113
|
);
|
|
73
114
|
;
|
|
74
115
|
;(function (exports, vueDemi) {
|
|
@@ -787,8 +828,7 @@
|
|
|
787
828
|
vueDemi.onUnmounted(fn);
|
|
788
829
|
}
|
|
789
830
|
|
|
790
|
-
function
|
|
791
|
-
let isNot = false;
|
|
831
|
+
function createUntil(r, isNot = false) {
|
|
792
832
|
function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
|
|
793
833
|
let stop = null;
|
|
794
834
|
const watcher = new Promise((resolve) => {
|
|
@@ -870,8 +910,7 @@
|
|
|
870
910
|
changed,
|
|
871
911
|
changedTimes,
|
|
872
912
|
get not() {
|
|
873
|
-
|
|
874
|
-
return this;
|
|
913
|
+
return createUntil(r, !isNot);
|
|
875
914
|
}
|
|
876
915
|
};
|
|
877
916
|
return instance;
|
|
@@ -886,13 +925,15 @@
|
|
|
886
925
|
changed,
|
|
887
926
|
changedTimes,
|
|
888
927
|
get not() {
|
|
889
|
-
|
|
890
|
-
return this;
|
|
928
|
+
return createUntil(r, !isNot);
|
|
891
929
|
}
|
|
892
930
|
};
|
|
893
931
|
return instance;
|
|
894
932
|
}
|
|
895
933
|
}
|
|
934
|
+
function until(r) {
|
|
935
|
+
return createUntil(r);
|
|
936
|
+
}
|
|
896
937
|
|
|
897
938
|
function useArrayEvery(list, fn) {
|
|
898
939
|
return vueDemi.computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
@@ -948,8 +989,15 @@
|
|
|
948
989
|
}
|
|
949
990
|
|
|
950
991
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
951
|
-
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;
|
|
952
|
-
const
|
|
992
|
+
const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
993
|
+
const defaultMeridiem = (hours, minutes, isLowercase, hasPeriod) => {
|
|
994
|
+
let m = hours < 12 ? "AM" : "PM";
|
|
995
|
+
if (hasPeriod)
|
|
996
|
+
m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
|
|
997
|
+
return isLowercase ? m.toLowerCase() : m;
|
|
998
|
+
};
|
|
999
|
+
const formatDate = (date, formatStr, options = {}) => {
|
|
1000
|
+
var _a;
|
|
953
1001
|
const years = date.getFullYear();
|
|
954
1002
|
const month = date.getMonth();
|
|
955
1003
|
const days = date.getDate();
|
|
@@ -958,11 +1006,14 @@
|
|
|
958
1006
|
const seconds = date.getSeconds();
|
|
959
1007
|
const milliseconds = date.getMilliseconds();
|
|
960
1008
|
const day = date.getDay();
|
|
1009
|
+
const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
|
|
961
1010
|
const matches = {
|
|
962
1011
|
YY: () => String(years).slice(-2),
|
|
963
1012
|
YYYY: () => years,
|
|
964
1013
|
M: () => month + 1,
|
|
965
1014
|
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
1015
|
+
MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
|
|
1016
|
+
MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
|
|
966
1017
|
D: () => String(days),
|
|
967
1018
|
DD: () => `${days}`.padStart(2, "0"),
|
|
968
1019
|
H: () => String(hours),
|
|
@@ -975,9 +1026,13 @@
|
|
|
975
1026
|
ss: () => `${seconds}`.padStart(2, "0"),
|
|
976
1027
|
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
977
1028
|
d: () => day,
|
|
978
|
-
dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
|
|
979
|
-
ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
|
|
980
|
-
dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
|
|
1029
|
+
dd: () => date.toLocaleDateString(options.locales, { weekday: "narrow" }),
|
|
1030
|
+
ddd: () => date.toLocaleDateString(options.locales, { weekday: "short" }),
|
|
1031
|
+
dddd: () => date.toLocaleDateString(options.locales, { weekday: "long" }),
|
|
1032
|
+
A: () => meridiem(hours, minutes),
|
|
1033
|
+
AA: () => meridiem(hours, minutes, false, true),
|
|
1034
|
+
a: () => meridiem(hours, minutes, true),
|
|
1035
|
+
aa: () => meridiem(hours, minutes, true, true)
|
|
981
1036
|
};
|
|
982
1037
|
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
|
|
983
1038
|
};
|
|
@@ -999,7 +1054,7 @@
|
|
|
999
1054
|
return new Date(date);
|
|
1000
1055
|
};
|
|
1001
1056
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
1002
|
-
return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options
|
|
1057
|
+
return vueDemi.computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options));
|
|
1003
1058
|
}
|
|
1004
1059
|
|
|
1005
1060
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1064,10 +1119,15 @@
|
|
|
1064
1119
|
function useInterval(interval = 1e3, options = {}) {
|
|
1065
1120
|
const {
|
|
1066
1121
|
controls: exposeControls = false,
|
|
1067
|
-
immediate = true
|
|
1122
|
+
immediate = true,
|
|
1123
|
+
callback
|
|
1068
1124
|
} = options;
|
|
1069
1125
|
const counter = vueDemi.ref(0);
|
|
1070
|
-
const
|
|
1126
|
+
const update = () => counter.value += 1;
|
|
1127
|
+
const controls = useIntervalFn(callback ? () => {
|
|
1128
|
+
update();
|
|
1129
|
+
callback(counter.value);
|
|
1130
|
+
} : update, interval, { immediate });
|
|
1071
1131
|
if (exposeControls) {
|
|
1072
1132
|
return __spreadValues$6({
|
|
1073
1133
|
counter
|
|
@@ -1140,9 +1200,10 @@
|
|
|
1140
1200
|
};
|
|
1141
1201
|
function useTimeout(interval = 1e3, options = {}) {
|
|
1142
1202
|
const {
|
|
1143
|
-
controls: exposeControls = false
|
|
1203
|
+
controls: exposeControls = false,
|
|
1204
|
+
callback
|
|
1144
1205
|
} = options;
|
|
1145
|
-
const controls = useTimeoutFn(noop, interval, options);
|
|
1206
|
+
const controls = useTimeoutFn(callback != null ? callback : noop, interval, options);
|
|
1146
1207
|
const ready = vueDemi.computed(() => !controls.isPending.value);
|
|
1147
1208
|
if (exposeControls) {
|
|
1148
1209
|
return __spreadValues$5({
|
|
@@ -1679,6 +1740,4 @@
|
|
|
1679
1740
|
exports.watchWithFilter = watchWithFilter;
|
|
1680
1741
|
exports.whenever = whenever;
|
|
1681
1742
|
|
|
1682
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1683
|
-
|
|
1684
1743
|
})(this.VueUse = this.VueUse || {}, VueDemi);
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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),ee=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);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 re={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 ne(t){return t}function oe(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 ae(t){return t()}function ie(t,...e){return e.some(r=>r in t)}function le(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 ue(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 ce(){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 se(t){let e=!1,r;const n=i.effectScope(!0);return()=>(e||(r=n.run(t),e=!0),r)}function fe(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 de(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 pe(t,e){return e==null?i.unref(t):i.unref(t)[e]}function ye(t){return i.unref(t)!=null}var _e=Object.defineProperty,rt=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,nt=(t,e,r)=>e in t?_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oe=(t,e)=>{for(var r in e||(e={}))ve.call(e,r)&&nt(t,r,e[r]);if(rt)for(var r of rt(e))he.call(e,r)&&nt(t,r,e[r]);return t};function we(t,e){if(typeof Symbol!="undefined"){const r=Oe({},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 ge(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 Pe(t,...e){const r=e.flat();return at(()=>Object.fromEntries(Object.entries(i.toRefs(t)).filter(n=>!r.includes(n[0]))))}function me(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 be(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 $e=ct;function Se(t){return typeof t=="function"?i.computed(t):i.ref(t)}function Ae(...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 je(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 Ie(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 Te=Object.defineProperty,Fe=Object.defineProperties,Ee=Object.getOwnPropertyDescriptors,st=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,ft=(t,e,r)=>e in t?Te(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ne=(t,e)=>{for(var r in e||(e={}))Re.call(e,r)&&ft(t,r,e[r]);if(st)for(var r of st(e))Ce.call(e,r)&&ft(t,r,e[r]);return t},Me=(t,e)=>Fe(t,Ee(e));function We(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=Me(Ne({},t.value),{[r]:n});Object.setPrototypeOf(a,t.value),t.value=a}}}));return e}function Ue(t,e=!0){i.getCurrentInstance()?i.onBeforeMount(t):e?t():i.nextTick(t)}function Be(t){i.getCurrentInstance()&&i.onBeforeUnmount(t)}function He(t,e=!0){i.getCurrentInstance()?i.onMounted(t):e?t():i.nextTick(t)}function Le(t){i.getCurrentInstance()&&i.onUnmounted(t)}function Ye(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,on])=>{e!==(Lt===on)&&(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 Ge(t,e){return i.computed(()=>y(t).every((r,n,a)=>e(y(r),n,a)))}function ke(t,e){return i.computed(()=>y(t).map(r=>y(r)).filter(e))}function ze(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 Je(t,e){return i.computed(()=>y(t).map(r=>y(r)).join(y(e)))}function Ve(t,e){return i.computed(()=>y(t).map(r=>y(r)).map(e))}function Xe(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 qe(t,e){return i.computed(()=>y(t).some((r,n,a)=>e(y(r),n,a)))}function Ke(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 Qe=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,De=/\[([^\]]+)]|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(De,(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(Qe);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 xe(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 tr=Object.defineProperty,_t=Object.getOwnPropertySymbols,er=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,vt=(t,e,r)=>e in t?tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nr=(t,e)=>{for(var r in e||(e={}))er.call(e,r)&&vt(t,r,e[r]);if(_t)for(var r of _t(e))rr.call(e,r)&&vt(t,r,e[r]);return t};function or(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?nr({counter:a},l):a}function ar(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 ir=Object.defineProperty,Ot=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,ur=Object.prototype.propertyIsEnumerable,wt=(t,e,r)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cr=(t,e)=>{for(var r in e||(e={}))lr.call(e,r)&&wt(t,r,e[r]);if(Ot)for(var r of Ot(e))ur.call(e,r)&&wt(t,r,e[r]);return t};function sr(t=1e3,e={}){const{controls:r=!1}=e,n=ht(Q,t,e),a=i.computed(()=>!n.isPending.value);return r?cr({ready:a},n):a}function fr(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 dr(t){return i.computed(()=>`${y(t)}`)}function pr(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 yr(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,_r=Object.prototype.hasOwnProperty,vr=Object.prototype.propertyIsEnumerable,hr=(t,e)=>{var r={};for(var n in t)_r.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&>)for(var n of gt(t))e.indexOf(n)<0&&vr.call(t,n)&&(r[n]=t[n]);return r};function F(t,e,r={}){const n=r,{eventFilter:a=E}=n,l=hr(n,["eventFilter"]);return i.watch(t,T(a,e),l)}var Pt=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,wr=Object.prototype.propertyIsEnumerable,gr=(t,e)=>{var r={};for(var n in t)Or.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&&wr.call(t,n)&&(r[n]=t[n]);return r};function Pr(t,e,r){const n=r,{count:a}=n,l=gr(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 mr=Object.defineProperty,br=Object.defineProperties,$r=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable,$t=(t,e,r)=>e in t?mr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Sr=(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},Ar=(t,e)=>br(t,$r(e)),jr=(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=jr(n,["debounce","maxWait"]);return F(t,e,Ar(Sr({},u),{eventFilter:B(a,{maxWait:l})}))}var Ir=Object.defineProperty,Tr=Object.defineProperties,Fr=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,It=(t,e,r)=>e in t?Ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(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},Rr=(t,e)=>Tr(t,Fr(e)),Cr=(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=Cr(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++},Rr(Er({},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 Nr(t,e,r){const n=i.watch(t,(...a)=>(i.nextTick(()=>n()),e(...a)),r)}var Mr=Object.defineProperty,Wr=Object.defineProperties,Ur=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Tt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Et=(t,e,r)=>e in t?Mr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Br=(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},Hr=(t,e)=>Wr(t,Ur(e)),Lr=(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=Lr(n,["eventFilter"]),{eventFilter:u,pause:c,resume:p,isActive:_}=D(a);return{stop:F(t,e,Hr(Br({},l),{eventFilter:u})),pause:c,resume:p,isActive:_}}var Yr=Object.defineProperty,Gr=Object.defineProperties,kr=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable,Mt=(t,e,r)=>e in t?Yr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zr=(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)=>Gr(t,kr(e)),Jr=(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=Jr(n,["throttle","trailing","leading"]);return F(t,e,Zr(zr({},c),{eventFilter:H(a,l,u)}))}var Vr=Object.defineProperty,Xr=Object.defineProperties,qr=Object.getOwnPropertyDescriptors,Ut=Object.getOwnPropertySymbols,Kr=Object.prototype.hasOwnProperty,Qr=Object.prototype.propertyIsEnumerable,Bt=(t,e,r)=>e in t?Vr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dr=(t,e)=>{for(var r in e||(e={}))Kr.call(e,r)&&Bt(t,r,e[r]);if(Ut)for(var r of Ut(e))Qr.call(e,r)&&Bt(t,r,e[r]);return t},xr=(t,e)=>Xr(t,qr(e));function tn(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(en(t),rn(t))}),f};return xr(Dr({},c),{trigger:_})}function en(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 rn(t){return Array.isArray(t)?t.map(()=>{}):void 0}function nn(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=ie,o.controlledComputed=tt,o.controlledRef=$e,o.createEventHook=ce,o.createFilterWrapper=T,o.createGlobalState=se,o.createInjectionState=fe,o.createReactiveFn=Y,o.createSharedComposable=de,o.createSingletonPromise=oe,o.debounceFilter=B,o.debouncedRef=G,o.debouncedWatch=St,o.directiveHooks=re,o.eagerComputed=V,o.extendRef=et,o.formatDate=dt,o.get=pe,o.hasOwn=ee,o.identity=ne,o.ignorableWatch=z,o.increaseWithUnit=le,o.invoke=ae,o.isBoolean=Jt,o.isClient=I,o.isDef=zt,o.isDefined=ye,o.isFunction=U,o.isIOS=te,o.isNumber=Vt,o.isObject=qt,o.isString=Xt,o.isWindow=Kt,o.makeDestructurable=we,o.noop=Q,o.normalizeDate=pt,o.now=Qt,o.objectPick=ue,o.pausableFilter=D,o.pausableWatch=Rt,o.promiseTimeout=L,o.rand=xt,o.reactify=Y,o.reactifyObject=ge,o.reactiveComputed=at,o.reactiveOmit=Pe,o.reactivePick=me,o.refAutoReset=it,o.refDebounced=G,o.refDefault=be,o.refThrottled=k,o.refWithControl=ct,o.resolveRef=Se,o.resolveUnref=y,o.set=Ae,o.syncRef=je,o.syncRefs=Ie,o.throttleFilter=H,o.throttledRef=k,o.throttledWatch=Wt,o.timestamp=K,o.toReactive=ot,o.toRefs=We,o.tryOnBeforeMount=Ue,o.tryOnBeforeUnmount=Be,o.tryOnMounted=He,o.tryOnScopeDispose=$,o.tryOnUnmounted=Le,o.until=Ye,o.useArrayEvery=Ge,o.useArrayFilter=ke,o.useArrayFind=ze,o.useArrayFindIndex=Ze,o.useArrayJoin=Je,o.useArrayMap=Ve,o.useArrayReduce=Xe,o.useArraySome=qe,o.useCounter=Ke,o.useDateFormat=xe,o.useDebounce=G,o.useDebounceFn=lt,o.useInterval=or,o.useIntervalFn=yt,o.useLastChanged=ar,o.useThrottle=k,o.useThrottleFn=ut,o.useTimeout=sr,o.useTimeoutFn=ht,o.useToNumber=fr,o.useToString=dr,o.useToggle=pr,o.watchArray=yr,o.watchAtMost=Pr,o.watchDebounced=St,o.watchIgnorable=z,o.watchOnce=Nr,o.watchPausable=Rt,o.watchThrottled=Wt,o.watchTriggerable=tn,o.watchWithFilter=F,o.whenever=nn,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi);
|
|
1
|
+
var VueDemi=function(o,i,F){if(o.install)return o;if(!i)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),o;if(i.version.slice(0,4)==="2.7."){let O=function(w,A){var g,C={},N={config:i.config,use:i.use.bind(i),mixin:i.mixin.bind(i),component:i.component.bind(i),provide:function(b,$){return C[b]=$,this},directive:function(b,$){return $?(i.directive(b,$),N):i.directive(b)},mount:function(b,$){return g||(g=new i(Object.assign({propsData:A},w,{provide:Object.assign(C,w.provide)})),g.$mount(b,$),g)},unmount:function(){g&&(g.$destroy(),g=void 0)}};return N};var zt=O;for(var P in i)o[P]=i[P];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=i,o.Vue2=i,o.version=i.version,o.warn=i.util.warn,o.createApp=O}else if(i.version.slice(0,2)==="2.")if(F){for(var P in F)o[P]=F[P];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 P in i)o[P]=i[P];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=i,o.Vue2=void 0,o.version=i.version,o.set=function(O,w,A){return Array.isArray(O)?(O.length=Math.max(O.length,w),O.splice(w,1,A),A):(O[w]=A,A)},o.del=function(O,w){if(Array.isArray(O)){O.splice(w,1);return}delete O[w]}}else console.error("[vue-demi] Vue version "+i.version+" is unsupported.");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 F=Object.defineProperty,P=Object.defineProperties,zt=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,g=(t,e,r)=>e in t?F(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,C=(t,e)=>{for(var r in e||(e={}))w.call(e,r)&&g(t,r,e[r]);if(O)for(var r of O(e))A.call(e,r)&&g(t,r,e[r]);return t},N=(t,e)=>P(t,zt(e));function b(t,e){var r;const n=i.shallowRef();return i.watchEffect(()=>{n.value=t()},N(C({},e),{flush:(r=e==null?void 0:e.flush)!=null?r:"sync"})),i.readonly(n)}var $;const E=typeof window!="undefined",Zt=t=>typeof t!="undefined",Jt=(t,...e)=>{t||console.warn(...e)},D=Object.prototype.toString,Xt=t=>typeof t=="boolean",G=t=>typeof t=="function",qt=t=>typeof t=="number",Kt=t=>typeof t=="string",Qt=t=>D.call(t)==="[object Object]",Vt=t=>typeof window!="undefined"&&D.call(t)==="[object Window]",Dt=()=>Date.now(),x=()=>+Date.now(),xt=(t,e,r)=>Math.min(r,Math.max(e,t)),tt=()=>{},te=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),ee=E&&(($=window==null?void 0:window.navigator)==null?void 0:$.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent),re=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function y(t){return typeof t=="function"?t():i.unref(t)}function M(t,e){function r(...n){t(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})}return r}const W=t=>t();function k(t,e={}){let r,n;return l=>{const c=y(t),u=y(e.maxWait);if(r&&clearTimeout(r),c<=0||u!==void 0&&u<=0)return n&&(clearTimeout(n),n=null),l();u&&!n&&(n=setTimeout(()=>{r&&clearTimeout(r),n=null,l()},u)),r=setTimeout(()=>{n&&clearTimeout(n),n=null,l()},c)}}function z(t,e=!0,r=!0){let n=0,a,l=!0;const c=()=>{a&&(clearTimeout(a),a=void 0)};return d=>{const _=y(t),f=Date.now()-n;if(c(),_<=0)return n=Date.now(),d();f>_&&(r||!l)?(n=Date.now(),d()):e&&(a=setTimeout(()=>{n=Date.now(),l=!0,c(),d()},_)),!r&&!a&&(a=setTimeout(()=>l=!0,_)),l=!1}}function et(t=W){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 rt(t="this function"){if(!i.isVue3)throw new Error(`[VueUse] ${t} is only works on Vue 3.`)}const ne={mounted:i.isVue3?"mounted":"inserted",updated:i.isVue3?"updated":"componentUpdated",unmounted:i.isVue3?"unmounted":"unbind"};function Z(t,e=!1,r="Timeout"){return new Promise((n,a)=>{setTimeout(e?()=>a(r):n,t)})}function oe(t){return t}function ae(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 ie(t){return t()}function le(t,...e){return e.some(r=>r in t)}function ce(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 ue(t,e,r=!1){return e.reduce((n,a)=>(a in t&&(!r||t[a]!==void 0)&&(n[a]=t[a]),n),{})}function nt(t,e){let r,n,a;const l=i.ref(!0),c=()=>{l.value=!0,a()};i.watch(t,c,{flush:"sync"});const u=G(e)?e:e.get,d=G(e)?void 0:e.set,_=i.customRef((f,s)=>(n=f,a=s,{get(){return l.value&&(r=u(),l.value=!1),n(),r},set(p){d==null||d(p)}}));return Object.isExtensible(_)&&(_.trigger=c),_}function se(){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 fe(t){let e=!1,r;const n=i.effectScope(!0);return()=>(e||(r=n.run(t),e=!0),r)}function de(t){const e=Symbol("InjectionState");return[(...a)=>{i.provide(e,t(...a))},()=>i.inject(e)]}function j(t){return i.getCurrentScope()?(i.onScopeDispose(t),!0):!1}function pe(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))),j(a),r)}function ot(t,e,{enumerable:r=!1,unwrap:n=!0}={}){rt();for(const[a,l]of Object.entries(e))a!=="value"&&(i.isRef(l)&&n?Object.defineProperty(t,a,{get(){return l.value},set(c){l.value=c},enumerable:r}):Object.defineProperty(t,a,{value:l,enumerable:r}));return t}function ye(t,e){return e==null?i.unref(t):i.unref(t)[e]}function _e(t){return i.unref(t)!=null}var ve=Object.defineProperty,at=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,it=(t,e,r)=>e in t?ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,we=(t,e)=>{for(var r in e||(e={}))he.call(e,r)&&it(t,r,e[r]);if(at)for(var r of at(e))Oe.call(e,r)&&it(t,r,e[r]);return t};function ge(t,e){if(typeof Symbol!="undefined"){const r=we({},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 J(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 Pe(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"?J(l.bind(t),n):l]}))}function lt(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 ct(t){return lt(i.computed(t))}function me(t,...e){const r=e.flat();return ct(()=>Object.fromEntries(Object.entries(i.toRefs(t)).filter(n=>!r.includes(n[0]))))}function be(t,...e){const r=e.flat();return i.reactive(Object.fromEntries(r.map(n=>[n,i.toRef(t,n)])))}function ut(t,e=1e4){return i.customRef((r,n)=>{let a=t,l;const c=()=>setTimeout(()=>{a=t,n()},y(e));return j(()=>{clearTimeout(l)}),{get(){return r(),a},set(u){a=u,n(),clearTimeout(l),l=c()}}})}function st(t,e=200,r={}){return M(k(e,r),t)}function X(t,e=200,r={}){if(e<=0)return t;const n=i.ref(t.value),a=st(()=>{n.value=t.value},e,r);return i.watch(t,()=>a()),n}function $e(t,e){return i.computed({get(){var r;return(r=t.value)!=null?r:e},set(r){t.value=r}})}function ft(t,e=200,r=!1,n=!0){return M(z(e,r,n),t)}function q(t,e=200,r=!0,n=!0){if(e<=0)return t;const a=i.ref(t.value),l=ft(()=>{a.value=t.value},e,r,n);return i.watch(t,()=>l()),a}function dt(t,e={}){let r=t,n,a;const l=i.customRef((p,h)=>(n=p,a=h,{get(){return c()},set(v){u(v)}}));function c(p=!0){return p&&n(),r}function u(p,h=!0){var v,S;if(p===r)return;const m=r;((v=e.onBeforeChange)==null?void 0:v.call(e,p,m))!==!1&&(r=p,(S=e.onChanged)==null||S.call(e,p,m),h&&a())}return ot(l,{get:c,set:u,untrackedGet:()=>c(!1),silentSet:p=>u(p,!1),peek:()=>c(!1),lay:p=>u(p,!1)},{enumerable:!0})}const Se=dt;function Ae(t){return typeof t=="function"?i.computed(t):i.ref(t)}function je(...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 Ie(t,e,r={}){var n,a;const{flush:l="sync",deep:c=!1,immediate:u=!0,direction:d="both",transform:_={}}=r;let f,s;const p=(n=_.ltr)!=null?n:v=>v,h=(a=_.rtl)!=null?a:v=>v;return(d==="both"||d==="ltr")&&(f=i.watch(t,v=>e.value=p(v),{flush:l,deep:c,immediate:u})),(d==="both"||d==="rtl")&&(s=i.watch(e,v=>t.value=h(v),{flush:l,deep:c,immediate:u})),()=>{f==null||f(),s==null||s()}}function Te(t,e,r={}){const{flush:n="sync",deep:a=!1,immediate:l=!0}=r;return Array.isArray(e)||(e=[e]),i.watch(t,c=>e.forEach(u=>u.value=c),{flush:n,deep:a,immediate:l})}var Fe=Object.defineProperty,Ee=Object.defineProperties,Me=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,yt=(t,e,r)=>e in t?Fe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ne=(t,e)=>{for(var r in e||(e={}))Re.call(e,r)&&yt(t,r,e[r]);if(pt)for(var r of pt(e))Ce.call(e,r)&&yt(t,r,e[r]);return t},We=(t,e)=>Ee(t,Me(e));function Ue(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=We(Ne({},t.value),{[r]:n});Object.setPrototypeOf(a,t.value),t.value=a}}}));return e}function Be(t,e=!0){i.getCurrentInstance()?i.onBeforeMount(t):e?t():i.nextTick(t)}function Le(t){i.getCurrentInstance()&&i.onBeforeUnmount(t)}function He(t,e=!0){i.getCurrentInstance()?i.onMounted(t):e?t():i.nextTick(t)}function Ye(t){i.getCurrentInstance()&&i.onUnmounted(t)}function K(t,e=!1){function r(s,{flush:p="sync",deep:h=!1,timeout:v,throwOnTimeout:S}={}){let m=null;const V=[new Promise(Y=>{m=i.watch(t,T=>{s(T)!==e&&(m==null||m(),Y(T))},{flush:p,deep:h,immediate:!0})})];return v!=null&&V.push(Z(v,S).then(()=>y(t)).finally(()=>m==null?void 0:m())),Promise.race(V)}function n(s,p){if(!i.isRef(s))return r(T=>T===s,p);const{flush:h="sync",deep:v=!1,timeout:S,throwOnTimeout:m}=p??{};let I=null;const Y=[new Promise(T=>{I=i.watch([t,s],([kt,ln])=>{e!==(kt===ln)&&(I==null||I(),T(kt))},{flush:h,deep:v,immediate:!0})})];return S!=null&&Y.push(Z(S,m).then(()=>y(t)).finally(()=>(I==null||I(),y(t)))),Promise.race(Y)}function a(s){return r(p=>Boolean(p),s)}function l(s){return n(null,s)}function c(s){return n(void 0,s)}function u(s){return r(Number.isNaN,s)}function d(s,p){return r(h=>{const v=Array.from(h);return v.includes(s)||v.includes(y(s))},p)}function _(s){return f(1,s)}function f(s=1,p){let h=-1;return r(()=>(h+=1,h>=s),p)}return Array.isArray(y(t))?{toMatch:r,toContains:d,changed:_,changedTimes:f,get not(){return K(t,!e)}}:{toMatch:r,toBe:n,toBeTruthy:a,toBeNull:l,toBeNaN:u,toBeUndefined:c,changed:_,changedTimes:f,get not(){return K(t,!e)}}}function Ge(t){return K(t)}function ke(t,e){return i.computed(()=>y(t).every((r,n,a)=>e(y(r),n,a)))}function ze(t,e){return i.computed(()=>y(t).map(r=>y(r)).filter(e))}function Ze(t,e){return i.computed(()=>y(y(t).find((r,n,a)=>e(y(r),n,a))))}function Je(t,e){return i.computed(()=>y(t).findIndex((r,n,a)=>e(y(r),n,a)))}function Xe(t,e){return i.computed(()=>y(t).map(r=>y(r)).join(y(e)))}function qe(t,e){return i.computed(()=>y(t).map(r=>y(r)).map(e))}function Ke(t,e,...r){const n=(a,l,c)=>e(y(a),y(l),c);return i.computed(()=>{const a=y(t);return r.length?a.reduce(n,y(r[0])):a.reduce(n)})}function Qe(t,e){return i.computed(()=>y(t).some((r,n,a)=>e(y(r),n,a)))}function Ve(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),c=(f=1)=>r.value=Math.max(a,r.value-f),u=()=>r.value,d=f=>r.value=f;return{count:r,inc:l,dec:c,get:u,set:d,reset:(f=t)=>(t=f,d(f))}}const De=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,xe=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g,tr=(t,e,r,n)=>{let a=t<12?"AM":"PM";return n&&(a=a.split("").reduce((l,c)=>l+=`${c}.`,"")),r?a.toLowerCase():a},_t=(t,e,r={})=>{var n;const a=t.getFullYear(),l=t.getMonth(),c=t.getDate(),u=t.getHours(),d=t.getMinutes(),_=t.getSeconds(),f=t.getMilliseconds(),s=t.getDay(),p=(n=r.customMeridiem)!=null?n:tr,h={YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>l+1,MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(r.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(r.locales,{month:"long"}),D:()=>String(c),DD:()=>`${c}`.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(d),mm:()=>`${d}`.padStart(2,"0"),s:()=>String(_),ss:()=>`${_}`.padStart(2,"0"),SSS:()=>`${f}`.padStart(3,"0"),d:()=>s,dd:()=>t.toLocaleDateString(r.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(r.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(r.locales,{weekday:"long"}),A:()=>p(u,d),AA:()=>p(u,d,!1,!0),a:()=>p(u,d,!0),aa:()=>p(u,d,!0,!0)};return e.replace(xe,(v,S)=>S||h[v]())},vt=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(De);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 er(t,e="HH:mm:ss",r={}){return i.computed(()=>_t(vt(y(t)),y(e),r))}function ht(t,e=1e3,r={}){const{immediate:n=!0,immediateCallback:a=!1}=r;let l=null;const c=i.ref(!1);function u(){l&&(clearInterval(l),l=null)}function d(){c.value=!1,u()}function _(){i.unref(e)<=0||(c.value=!0,a&&t(),u(),l=setInterval(t,y(e)))}if(n&&E&&_(),i.isRef(e)){const f=i.watch(e,()=>{c.value&&E&&_()});j(f)}return j(d),{isActive:c,pause:d,resume:_}}var rr=Object.defineProperty,Ot=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,or=Object.prototype.propertyIsEnumerable,wt=(t,e,r)=>e in t?rr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ar=(t,e)=>{for(var r in e||(e={}))nr.call(e,r)&&wt(t,r,e[r]);if(Ot)for(var r of Ot(e))or.call(e,r)&&wt(t,r,e[r]);return t};function ir(t=1e3,e={}){const{controls:r=!1,immediate:n=!0,callback:a}=e,l=i.ref(0),c=()=>l.value+=1,u=ht(a?()=>{c(),a(l.value)}:c,t,{immediate:n});return r?ar({counter:l},u):l}function lr(t,e={}){var r;const n=i.ref((r=e.initialValue)!=null?r:null);return i.watch(t,()=>n.value=x(),e),n}function gt(t,e,r={}){const{immediate:n=!0}=r,a=i.ref(!1);let l=null;function c(){l&&(clearTimeout(l),l=null)}function u(){a.value=!1,c()}function d(..._){c(),a.value=!0,l=setTimeout(()=>{a.value=!1,l=null,t(..._)},y(e))}return n&&(a.value=!0,E&&d()),j(u),{isPending:a,start:d,stop:u}}var cr=Object.defineProperty,Pt=Object.getOwnPropertySymbols,ur=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,mt=(t,e,r)=>e in t?cr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fr=(t,e)=>{for(var r in e||(e={}))ur.call(e,r)&&mt(t,r,e[r]);if(Pt)for(var r of Pt(e))sr.call(e,r)&&mt(t,r,e[r]);return t};function dr(t=1e3,e={}){const{controls:r=!1,callback:n}=e,a=gt(n??tt,t,e),l=i.computed(()=>!a.isPending.value);return r?fr({ready:l},a):l}function pr(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 yr(t){return i.computed(()=>`${y(t)}`)}function _r(t=!1,e={}){const{truthyValue:r=!0,falsyValue:n=!1}=e,a=i.isRef(t),l=i.ref(t);function c(u){if(arguments.length)return l.value=u,l.value;{const d=y(r);return l.value=l.value===d?y(n):d,l.value}}return a?c:[l,c]}function vr(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,c)=>{const u=new Array(n.length),d=[];for(const f of a){let s=!1;for(let p=0;p<n.length;p++)if(!u[p]&&f===n[p]){u[p]=!0,s=!0;break}s||d.push(f)}const _=n.filter((f,s)=>!u[s]);e(a,n,d,_,c),n=[...a]},r)}var bt=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&&bt)for(var n of bt(t))e.indexOf(n)<0&&Or.call(t,n)&&(r[n]=t[n]);return r};function R(t,e,r={}){const n=r,{eventFilter:a=W}=n,l=wr(n,["eventFilter"]);return i.watch(t,M(a,e),l)}var $t=Object.getOwnPropertySymbols,gr=Object.prototype.hasOwnProperty,Pr=Object.prototype.propertyIsEnumerable,mr=(t,e)=>{var r={};for(var n in t)gr.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&$t)for(var n of $t(t))e.indexOf(n)<0&&Pr.call(t,n)&&(r[n]=t[n]);return r};function br(t,e,r){const n=r,{count:a}=n,l=mr(n,["count"]),c=i.ref(0),u=R(t,(...d)=>{c.value+=1,c.value>=y(a)&&i.nextTick(()=>u()),e(...d)},l);return{count:c,stop:u}}var $r=Object.defineProperty,Sr=Object.defineProperties,Ar=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,jt=(t,e,r)=>e in t?$r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jr=(t,e)=>{for(var r in e||(e={}))St.call(e,r)&&jt(t,r,e[r]);if(U)for(var r of U(e))At.call(e,r)&&jt(t,r,e[r]);return t},Ir=(t,e)=>Sr(t,Ar(e)),Tr=(t,e)=>{var r={};for(var n in t)St.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&U)for(var n of U(t))e.indexOf(n)<0&&At.call(t,n)&&(r[n]=t[n]);return r};function It(t,e,r={}){const n=r,{debounce:a=0,maxWait:l=void 0}=n,c=Tr(n,["debounce","maxWait"]);return R(t,e,Ir(jr({},c),{eventFilter:k(a,{maxWait:l})}))}var Fr=Object.defineProperty,Er=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,Tt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Et=(t,e,r)=>e in t?Fr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rr=(t,e)=>{for(var r in e||(e={}))Tt.call(e,r)&&Et(t,r,e[r]);if(B)for(var r of B(e))Ft.call(e,r)&&Et(t,r,e[r]);return t},Cr=(t,e)=>Er(t,Mr(e)),Nr=(t,e)=>{var r={};for(var n in t)Tt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&B)for(var n of B(t))e.indexOf(n)<0&&Ft.call(t,n)&&(r[n]=t[n]);return r};function Q(t,e,r={}){const n=r,{eventFilter:a=W}=n,l=Nr(n,["eventFilter"]),c=M(a,e);let u,d,_;if(l.flush==="sync"){const f=i.ref(!1);d=()=>{},u=s=>{f.value=!0,s(),f.value=!1},_=i.watch(t,(...s)=>{f.value||c(...s)},l)}else{const f=[],s=i.ref(0),p=i.ref(0);d=()=>{s.value=p.value},f.push(i.watch(t,()=>{p.value++},Cr(Rr({},l),{flush:"sync"}))),u=h=>{const v=p.value;h(),s.value+=p.value-v},f.push(i.watch(t,(...h)=>{const v=s.value>0&&s.value===p.value;s.value=0,p.value=0,!v&&c(...h)},l)),_=()=>{f.forEach(h=>h())}}return{stop:_,ignoreUpdates:u,ignorePrevAsyncUpdates:d}}function Wr(t,e,r){const n=i.watch(t,(...a)=>(i.nextTick(()=>n()),e(...a)),r)}var Ur=Object.defineProperty,Br=Object.defineProperties,Lr=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,Ct=(t,e,r)=>e in t?Ur(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hr=(t,e)=>{for(var r in e||(e={}))Mt.call(e,r)&&Ct(t,r,e[r]);if(L)for(var r of L(e))Rt.call(e,r)&&Ct(t,r,e[r]);return t},Yr=(t,e)=>Br(t,Lr(e)),Gr=(t,e)=>{var r={};for(var n in t)Mt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&L)for(var n of L(t))e.indexOf(n)<0&&Rt.call(t,n)&&(r[n]=t[n]);return r};function Nt(t,e,r={}){const n=r,{eventFilter:a}=n,l=Gr(n,["eventFilter"]),{eventFilter:c,pause:u,resume:d,isActive:_}=et(a);return{stop:R(t,e,Yr(Hr({},l),{eventFilter:c})),pause:u,resume:d,isActive:_}}var kr=Object.defineProperty,zr=Object.defineProperties,Zr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Wt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,Bt=(t,e,r)=>e in t?kr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jr=(t,e)=>{for(var r in e||(e={}))Wt.call(e,r)&&Bt(t,r,e[r]);if(H)for(var r of H(e))Ut.call(e,r)&&Bt(t,r,e[r]);return t},Xr=(t,e)=>zr(t,Zr(e)),qr=(t,e)=>{var r={};for(var n in t)Wt.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&H)for(var n of H(t))e.indexOf(n)<0&&Ut.call(t,n)&&(r[n]=t[n]);return r};function Lt(t,e,r={}){const n=r,{throttle:a=0,trailing:l=!0,leading:c=!0}=n,u=qr(n,["throttle","trailing","leading"]);return R(t,e,Xr(Jr({},u),{eventFilter:z(a,l,c)}))}var Kr=Object.defineProperty,Qr=Object.defineProperties,Vr=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,Dr=Object.prototype.hasOwnProperty,xr=Object.prototype.propertyIsEnumerable,Yt=(t,e,r)=>e in t?Kr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))Dr.call(e,r)&&Yt(t,r,e[r]);if(Ht)for(var r of Ht(e))xr.call(e,r)&&Yt(t,r,e[r]);return t},en=(t,e)=>Qr(t,Vr(e));function rn(t,e,r={}){let n;function a(){if(!n)return;const f=n;n=void 0,f()}function l(f){n=f}const c=(f,s)=>(a(),e(f,s,l)),u=Q(t,c,r),{ignoreUpdates:d}=u,_=()=>{let f;return d(()=>{f=c(nn(t),on(t))}),f};return en(tn({},u),{trigger:_})}function nn(t){return i.isReactive(t)?t:Array.isArray(t)?t.map(e=>Gt(e)):Gt(t)}function Gt(t){return typeof t=="function"?t():i.unref(t)}function on(t){return Array.isArray(t)?t.map(()=>{}):void 0}function an(t,e,r){return i.watch(t,(n,a,l)=>{n&&e(n,a,l)},r)}o.__onlyVue3=rt,o.assert=Jt,o.autoResetRef=ut,o.bypassFilter=W,o.clamp=xt,o.computedEager=b,o.computedWithControl=nt,o.containsProp=le,o.controlledComputed=nt,o.controlledRef=Se,o.createEventHook=se,o.createFilterWrapper=M,o.createGlobalState=fe,o.createInjectionState=de,o.createReactiveFn=J,o.createSharedComposable=pe,o.createSingletonPromise=ae,o.debounceFilter=k,o.debouncedRef=X,o.debouncedWatch=It,o.directiveHooks=ne,o.eagerComputed=b,o.extendRef=ot,o.formatDate=_t,o.get=ye,o.hasOwn=re,o.identity=oe,o.ignorableWatch=Q,o.increaseWithUnit=ce,o.invoke=ie,o.isBoolean=Xt,o.isClient=E,o.isDef=Zt,o.isDefined=_e,o.isFunction=G,o.isIOS=ee,o.isNumber=qt,o.isObject=Qt,o.isString=Kt,o.isWindow=Vt,o.makeDestructurable=ge,o.noop=tt,o.normalizeDate=vt,o.now=Dt,o.objectPick=ue,o.pausableFilter=et,o.pausableWatch=Nt,o.promiseTimeout=Z,o.rand=te,o.reactify=J,o.reactifyObject=Pe,o.reactiveComputed=ct,o.reactiveOmit=me,o.reactivePick=be,o.refAutoReset=ut,o.refDebounced=X,o.refDefault=$e,o.refThrottled=q,o.refWithControl=dt,o.resolveRef=Ae,o.resolveUnref=y,o.set=je,o.syncRef=Ie,o.syncRefs=Te,o.throttleFilter=z,o.throttledRef=q,o.throttledWatch=Lt,o.timestamp=x,o.toReactive=lt,o.toRefs=Ue,o.tryOnBeforeMount=Be,o.tryOnBeforeUnmount=Le,o.tryOnMounted=He,o.tryOnScopeDispose=j,o.tryOnUnmounted=Ye,o.until=Ge,o.useArrayEvery=ke,o.useArrayFilter=ze,o.useArrayFind=Ze,o.useArrayFindIndex=Je,o.useArrayJoin=Xe,o.useArrayMap=qe,o.useArrayReduce=Ke,o.useArraySome=Qe,o.useCounter=Ve,o.useDateFormat=er,o.useDebounce=X,o.useDebounceFn=st,o.useInterval=ir,o.useIntervalFn=ht,o.useLastChanged=lr,o.useThrottle=q,o.useThrottleFn=ft,o.useTimeout=dr,o.useTimeoutFn=gt,o.useToNumber=pr,o.useToString=yr,o.useToggle=_r,o.watchArray=vr,o.watchAtMost=br,o.watchDebounced=It,o.watchIgnorable=Q,o.watchOnce=Wr,o.watchPausable=Nt,o.watchThrottled=Lt,o.watchTriggerable=rn,o.watchWithFilter=R,o.whenever=an})(this.VueUse=this.VueUse||{},VueDemi);
|
package/index.mjs
CHANGED
|
@@ -713,8 +713,7 @@ function tryOnUnmounted(fn) {
|
|
|
713
713
|
onUnmounted(fn);
|
|
714
714
|
}
|
|
715
715
|
|
|
716
|
-
function
|
|
717
|
-
let isNot = false;
|
|
716
|
+
function createUntil(r, isNot = false) {
|
|
718
717
|
function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
|
|
719
718
|
let stop = null;
|
|
720
719
|
const watcher = new Promise((resolve) => {
|
|
@@ -796,8 +795,7 @@ function until(r) {
|
|
|
796
795
|
changed,
|
|
797
796
|
changedTimes,
|
|
798
797
|
get not() {
|
|
799
|
-
|
|
800
|
-
return this;
|
|
798
|
+
return createUntil(r, !isNot);
|
|
801
799
|
}
|
|
802
800
|
};
|
|
803
801
|
return instance;
|
|
@@ -812,13 +810,15 @@ function until(r) {
|
|
|
812
810
|
changed,
|
|
813
811
|
changedTimes,
|
|
814
812
|
get not() {
|
|
815
|
-
|
|
816
|
-
return this;
|
|
813
|
+
return createUntil(r, !isNot);
|
|
817
814
|
}
|
|
818
815
|
};
|
|
819
816
|
return instance;
|
|
820
817
|
}
|
|
821
818
|
}
|
|
819
|
+
function until(r) {
|
|
820
|
+
return createUntil(r);
|
|
821
|
+
}
|
|
822
822
|
|
|
823
823
|
function useArrayEvery(list, fn) {
|
|
824
824
|
return computed(() => resolveUnref(list).every((element, index, array) => fn(resolveUnref(element), index, array)));
|
|
@@ -874,8 +874,15 @@ function useCounter(initialValue = 0, options = {}) {
|
|
|
874
874
|
}
|
|
875
875
|
|
|
876
876
|
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
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;
|
|
878
|
-
const
|
|
877
|
+
const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
878
|
+
const defaultMeridiem = (hours, minutes, isLowercase, hasPeriod) => {
|
|
879
|
+
let m = hours < 12 ? "AM" : "PM";
|
|
880
|
+
if (hasPeriod)
|
|
881
|
+
m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
|
|
882
|
+
return isLowercase ? m.toLowerCase() : m;
|
|
883
|
+
};
|
|
884
|
+
const formatDate = (date, formatStr, options = {}) => {
|
|
885
|
+
var _a;
|
|
879
886
|
const years = date.getFullYear();
|
|
880
887
|
const month = date.getMonth();
|
|
881
888
|
const days = date.getDate();
|
|
@@ -884,11 +891,14 @@ const formatDate = (date, formatStr, locales) => {
|
|
|
884
891
|
const seconds = date.getSeconds();
|
|
885
892
|
const milliseconds = date.getMilliseconds();
|
|
886
893
|
const day = date.getDay();
|
|
894
|
+
const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
|
|
887
895
|
const matches = {
|
|
888
896
|
YY: () => String(years).slice(-2),
|
|
889
897
|
YYYY: () => years,
|
|
890
898
|
M: () => month + 1,
|
|
891
899
|
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
900
|
+
MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
|
|
901
|
+
MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
|
|
892
902
|
D: () => String(days),
|
|
893
903
|
DD: () => `${days}`.padStart(2, "0"),
|
|
894
904
|
H: () => String(hours),
|
|
@@ -901,9 +911,13 @@ const formatDate = (date, formatStr, locales) => {
|
|
|
901
911
|
ss: () => `${seconds}`.padStart(2, "0"),
|
|
902
912
|
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
903
913
|
d: () => day,
|
|
904
|
-
dd: () => date.toLocaleDateString(locales, { weekday: "narrow" }),
|
|
905
|
-
ddd: () => date.toLocaleDateString(locales, { weekday: "short" }),
|
|
906
|
-
dddd: () => date.toLocaleDateString(locales, { weekday: "long" })
|
|
914
|
+
dd: () => date.toLocaleDateString(options.locales, { weekday: "narrow" }),
|
|
915
|
+
ddd: () => date.toLocaleDateString(options.locales, { weekday: "short" }),
|
|
916
|
+
dddd: () => date.toLocaleDateString(options.locales, { weekday: "long" }),
|
|
917
|
+
A: () => meridiem(hours, minutes),
|
|
918
|
+
AA: () => meridiem(hours, minutes, false, true),
|
|
919
|
+
a: () => meridiem(hours, minutes, true),
|
|
920
|
+
aa: () => meridiem(hours, minutes, true, true)
|
|
907
921
|
};
|
|
908
922
|
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]());
|
|
909
923
|
};
|
|
@@ -925,7 +939,7 @@ const normalizeDate = (date) => {
|
|
|
925
939
|
return new Date(date);
|
|
926
940
|
};
|
|
927
941
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
928
|
-
return computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options
|
|
942
|
+
return computed(() => formatDate(normalizeDate(resolveUnref(date)), resolveUnref(formatStr), options));
|
|
929
943
|
}
|
|
930
944
|
|
|
931
945
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -990,10 +1004,15 @@ var __spreadValues$6 = (a, b) => {
|
|
|
990
1004
|
function useInterval(interval = 1e3, options = {}) {
|
|
991
1005
|
const {
|
|
992
1006
|
controls: exposeControls = false,
|
|
993
|
-
immediate = true
|
|
1007
|
+
immediate = true,
|
|
1008
|
+
callback
|
|
994
1009
|
} = options;
|
|
995
1010
|
const counter = ref(0);
|
|
996
|
-
const
|
|
1011
|
+
const update = () => counter.value += 1;
|
|
1012
|
+
const controls = useIntervalFn(callback ? () => {
|
|
1013
|
+
update();
|
|
1014
|
+
callback(counter.value);
|
|
1015
|
+
} : update, interval, { immediate });
|
|
997
1016
|
if (exposeControls) {
|
|
998
1017
|
return __spreadValues$6({
|
|
999
1018
|
counter
|
|
@@ -1066,9 +1085,10 @@ var __spreadValues$5 = (a, b) => {
|
|
|
1066
1085
|
};
|
|
1067
1086
|
function useTimeout(interval = 1e3, options = {}) {
|
|
1068
1087
|
const {
|
|
1069
|
-
controls: exposeControls = false
|
|
1088
|
+
controls: exposeControls = false,
|
|
1089
|
+
callback
|
|
1070
1090
|
} = options;
|
|
1071
|
-
const controls = useTimeoutFn(noop, interval, options);
|
|
1091
|
+
const controls = useTimeoutFn(callback != null ? callback : noop, interval, options);
|
|
1072
1092
|
const ready = computed(() => !controls.isPending.value);
|
|
1073
1093
|
if (exposeControls) {
|
|
1074
1094
|
return __spreadValues$5({
|