@vueuse/shared 10.4.0 → 10.4.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 CHANGED
@@ -3,12 +3,13 @@
3
3
  var vueDemi = require('vue-demi');
4
4
 
5
5
  function computedEager(fn, options) {
6
+ var _a;
6
7
  const result = vueDemi.shallowRef();
7
8
  vueDemi.watchEffect(() => {
8
9
  result.value = fn();
9
10
  }, {
10
11
  ...options,
11
- flush: options?.flush ?? "sync"
12
+ flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
12
13
  });
13
14
  return vueDemi.readonly(result);
14
15
  }
@@ -38,7 +39,7 @@ function computedWithControl(source, fn) {
38
39
  return v;
39
40
  },
40
41
  set(v2) {
41
- set?.(v2);
42
+ set == null ? void 0 : set(v2);
42
43
  }
43
44
  };
44
45
  });
@@ -188,7 +189,7 @@ function toValue(r) {
188
189
  const resolveUnref = toValue;
189
190
 
190
191
  function reactify(fn, options) {
191
- const unrefFn = options?.computedGetter === false ? vueDemi.unref : toValue;
192
+ const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? vueDemi.unref : toValue;
192
193
  return function(...args) {
193
194
  return vueDemi.computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
194
195
  };
@@ -284,7 +285,8 @@ const rand = (min, max) => {
284
285
  const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
285
286
  const isIOS = /* @__PURE__ */ getIsIOS();
286
287
  function getIsIOS() {
287
- return isClient && window?.navigator?.userAgent && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
288
+ var _a;
289
+ return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
288
290
  }
289
291
 
290
292
  function createFilterWrapper(filter, fn) {
@@ -455,9 +457,10 @@ function containsProp(obj, ...props) {
455
457
  return props.some((k) => k in obj);
456
458
  }
457
459
  function increaseWithUnit(target, delta) {
460
+ var _a;
458
461
  if (typeof target === "number")
459
462
  return target + delta;
460
- const value = target.match(/^-?[0-9]+\.?[0-9]*/)?.[0] || "";
463
+ const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
461
464
  const unit = target.slice(value.length);
462
465
  const result = Number.parseFloat(value) + delta;
463
466
  if (Number.isNaN(result))
@@ -541,7 +544,8 @@ function refDebounced(value, ms = 200, options = {}) {
541
544
  function refDefault(source, defaultValue) {
542
545
  return vueDemi.computed({
543
546
  get() {
544
- return source.value ?? defaultValue;
547
+ var _a;
548
+ return (_a = source.value) != null ? _a : defaultValue;
545
549
  },
546
550
  set(value) {
547
551
  source.value = value;
@@ -589,13 +593,14 @@ function refWithControl(initial, options = {}) {
589
593
  return source;
590
594
  }
591
595
  function set(value, triggering = true) {
596
+ var _a, _b;
592
597
  if (value === source)
593
598
  return;
594
599
  const old = source;
595
- if (options.onBeforeChange?.(value, old) === false)
600
+ if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)
596
601
  return;
597
602
  source = value;
598
- options.onChanged?.(value, old);
603
+ (_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);
599
604
  if (triggering)
600
605
  trigger();
601
606
  }
@@ -666,6 +671,7 @@ function watchPausable(source, cb, options = {}) {
666
671
  }
667
672
 
668
673
  function syncRef(left, right, options = {}) {
674
+ var _a, _b;
669
675
  const {
670
676
  flush = "sync",
671
677
  deep = false,
@@ -674,8 +680,8 @@ function syncRef(left, right, options = {}) {
674
680
  transform = {}
675
681
  } = options;
676
682
  const watchers = [];
677
- const transformLTR = transform.ltr ?? ((v) => v);
678
- const transformRTL = transform.rtl ?? ((v) => v);
683
+ const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
684
+ const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
679
685
  if (direction === "both" || direction === "ltr") {
680
686
  watchers.push(watchPausable(
681
687
  left,
@@ -729,7 +735,8 @@ function toRefs(objectRef, options = {}) {
729
735
  return objectRef.value[key];
730
736
  },
731
737
  set(v) {
732
- const replaceRef = toValue(options.replaceRef) ?? true;
738
+ var _a;
739
+ const replaceRef = (_a = toValue(options.replaceRef)) != null ? _a : true;
733
740
  if (replaceRef) {
734
741
  if (Array.isArray(objectRef.value)) {
735
742
  const copy = [...objectRef.value];
@@ -785,7 +792,7 @@ function createUntil(r, isNot = false) {
785
792
  r,
786
793
  (v) => {
787
794
  if (condition(v) !== isNot) {
788
- stop?.();
795
+ stop == null ? void 0 : stop();
789
796
  resolve(v);
790
797
  }
791
798
  },
@@ -799,7 +806,7 @@ function createUntil(r, isNot = false) {
799
806
  const promises = [watcher];
800
807
  if (timeout != null) {
801
808
  promises.push(
802
- promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop?.())
809
+ promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop == null ? void 0 : stop())
803
810
  );
804
811
  }
805
812
  return Promise.race(promises);
@@ -807,14 +814,14 @@ function createUntil(r, isNot = false) {
807
814
  function toBe(value, options) {
808
815
  if (!vueDemi.isRef(value))
809
816
  return toMatch((v) => v === value, options);
810
- const { flush = "sync", deep = false, timeout, throwOnTimeout } = options ?? {};
817
+ const { flush = "sync", deep = false, timeout, throwOnTimeout } = options != null ? options : {};
811
818
  let stop = null;
812
819
  const watcher = new Promise((resolve) => {
813
820
  stop = vueDemi.watch(
814
821
  [r, value],
815
822
  ([v1, v2]) => {
816
823
  if (isNot !== (v1 === v2)) {
817
- stop?.();
824
+ stop == null ? void 0 : stop();
818
825
  resolve(v1);
819
826
  }
820
827
  },
@@ -829,7 +836,7 @@ function createUntil(r, isNot = false) {
829
836
  if (timeout != null) {
830
837
  promises.push(
831
838
  promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
832
- stop?.();
839
+ stop == null ? void 0 : stop();
833
840
  return toValue(r);
834
841
  })
835
842
  );
@@ -900,9 +907,10 @@ function defaultComparator(value, othVal) {
900
907
  return value === othVal;
901
908
  }
902
909
  function useArrayDifference(...args) {
910
+ var _a;
903
911
  const list = args[0];
904
912
  const values = args[1];
905
- let compareFn = args[2] ?? defaultComparator;
913
+ let compareFn = (_a = args[2]) != null ? _a : defaultComparator;
906
914
  if (typeof compareFn === "string") {
907
915
  const key = compareFn;
908
916
  compareFn = (value, othVal) => value[key] === othVal[key];
@@ -950,19 +958,20 @@ function isArrayIncludesOptions(obj) {
950
958
  return isObject(obj) && containsProp(obj, "formIndex", "comparator");
951
959
  }
952
960
  function useArrayIncludes(...args) {
961
+ var _a;
953
962
  const list = args[0];
954
963
  const value = args[1];
955
964
  let comparator = args[2];
956
965
  let formIndex = 0;
957
966
  if (isArrayIncludesOptions(comparator)) {
958
- formIndex = comparator.fromIndex ?? 0;
967
+ formIndex = (_a = comparator.fromIndex) != null ? _a : 0;
959
968
  comparator = comparator.comparator;
960
969
  }
961
970
  if (typeof comparator === "string") {
962
971
  const key = comparator;
963
972
  comparator = (element, value2) => element[key] === toValue(value2);
964
973
  }
965
- comparator = comparator ?? ((element, value2) => element === toValue(value2));
974
+ comparator = comparator != null ? comparator : (element, value2) => element === toValue(value2);
966
975
  return vueDemi.computed(
967
976
  () => toValue(list).slice(formIndex).some(
968
977
  (element, index, array) => comparator(toValue(element), toValue(value), index, toValue(array))
@@ -1034,6 +1043,7 @@ function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
1034
1043
  return isLowercase ? m.toLowerCase() : m;
1035
1044
  }
1036
1045
  function formatDate(date, formatStr, options = {}) {
1046
+ var _a;
1037
1047
  const years = date.getFullYear();
1038
1048
  const month = date.getMonth();
1039
1049
  const days = date.getDate();
@@ -1042,7 +1052,7 @@ function formatDate(date, formatStr, options = {}) {
1042
1052
  const seconds = date.getSeconds();
1043
1053
  const milliseconds = date.getMilliseconds();
1044
1054
  const day = date.getDay();
1045
- const meridiem = options.customMeridiem ?? defaultMeridiem;
1055
+ const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
1046
1056
  const matches = {
1047
1057
  YY: () => String(years).slice(-2),
1048
1058
  YYYY: () => years,
@@ -1070,7 +1080,10 @@ function formatDate(date, formatStr, options = {}) {
1070
1080
  a: () => meridiem(hours, minutes, true),
1071
1081
  aa: () => meridiem(hours, minutes, true, true)
1072
1082
  };
1073
- return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 ?? matches[match]?.() ?? match);
1083
+ return formatStr.replace(REGEX_FORMAT, (match, $1) => {
1084
+ var _a2, _b;
1085
+ return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? void 0 : _a2.call(matches)) != null ? _b : match;
1086
+ });
1074
1087
  }
1075
1088
  function normalizeDate(date) {
1076
1089
  if (date === null)
@@ -1168,7 +1181,8 @@ function useInterval(interval = 1e3, options = {}) {
1168
1181
  }
1169
1182
 
1170
1183
  function useLastChanged(source, options = {}) {
1171
- const ms = vueDemi.ref(options.initialValue ?? null);
1184
+ var _a;
1185
+ const ms = vueDemi.ref((_a = options.initialValue) != null ? _a : null);
1172
1186
  vueDemi.watch(
1173
1187
  source,
1174
1188
  () => ms.value = timestamp(),
@@ -1221,7 +1235,7 @@ function useTimeout(interval = 1e3, options = {}) {
1221
1235
  callback
1222
1236
  } = options;
1223
1237
  const controls = useTimeoutFn(
1224
- callback ?? noop,
1238
+ callback != null ? callback : noop,
1225
1239
  interval,
1226
1240
  options
1227
1241
  );
@@ -1280,7 +1294,7 @@ function useToggle(initialValue = false, options = {}) {
1280
1294
  }
1281
1295
 
1282
1296
  function watchArray(source, cb, options) {
1283
- let oldList = options?.immediate ? [] : [
1297
+ let oldList = (options == null ? void 0 : options.immediate) ? [] : [
1284
1298
  ...source instanceof Function ? source() : Array.isArray(source) ? source : toValue(source)
1285
1299
  ];
1286
1300
  return vueDemi.watch(source, (newList, _, onCleanup) => {
package/index.iife.js CHANGED
@@ -118,12 +118,13 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
118
118
  'use strict';
119
119
 
120
120
  function computedEager(fn, options) {
121
+ var _a;
121
122
  const result = vueDemi.shallowRef();
122
123
  vueDemi.watchEffect(() => {
123
124
  result.value = fn();
124
125
  }, {
125
126
  ...options,
126
- flush: options?.flush ?? "sync"
127
+ flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
127
128
  });
128
129
  return vueDemi.readonly(result);
129
130
  }
@@ -153,7 +154,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
153
154
  return v;
154
155
  },
155
156
  set(v2) {
156
- set?.(v2);
157
+ set == null ? void 0 : set(v2);
157
158
  }
158
159
  };
159
160
  });
@@ -303,7 +304,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
303
304
  const resolveUnref = toValue;
304
305
 
305
306
  function reactify(fn, options) {
306
- const unrefFn = options?.computedGetter === false ? vueDemi.unref : toValue;
307
+ const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? vueDemi.unref : toValue;
307
308
  return function(...args) {
308
309
  return vueDemi.computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
309
310
  };
@@ -399,7 +400,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
399
400
  const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
400
401
  const isIOS = /* @__PURE__ */ getIsIOS();
401
402
  function getIsIOS() {
402
- return isClient && window?.navigator?.userAgent && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
403
+ var _a;
404
+ return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
403
405
  }
404
406
 
405
407
  function createFilterWrapper(filter, fn) {
@@ -570,9 +572,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
570
572
  return props.some((k) => k in obj);
571
573
  }
572
574
  function increaseWithUnit(target, delta) {
575
+ var _a;
573
576
  if (typeof target === "number")
574
577
  return target + delta;
575
- const value = target.match(/^-?[0-9]+\.?[0-9]*/)?.[0] || "";
578
+ const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
576
579
  const unit = target.slice(value.length);
577
580
  const result = Number.parseFloat(value) + delta;
578
581
  if (Number.isNaN(result))
@@ -656,7 +659,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
656
659
  function refDefault(source, defaultValue) {
657
660
  return vueDemi.computed({
658
661
  get() {
659
- return source.value ?? defaultValue;
662
+ var _a;
663
+ return (_a = source.value) != null ? _a : defaultValue;
660
664
  },
661
665
  set(value) {
662
666
  source.value = value;
@@ -704,13 +708,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
704
708
  return source;
705
709
  }
706
710
  function set(value, triggering = true) {
711
+ var _a, _b;
707
712
  if (value === source)
708
713
  return;
709
714
  const old = source;
710
- if (options.onBeforeChange?.(value, old) === false)
715
+ if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)
711
716
  return;
712
717
  source = value;
713
- options.onChanged?.(value, old);
718
+ (_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);
714
719
  if (triggering)
715
720
  trigger();
716
721
  }
@@ -781,6 +786,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
781
786
  }
782
787
 
783
788
  function syncRef(left, right, options = {}) {
789
+ var _a, _b;
784
790
  const {
785
791
  flush = "sync",
786
792
  deep = false,
@@ -789,8 +795,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
789
795
  transform = {}
790
796
  } = options;
791
797
  const watchers = [];
792
- const transformLTR = transform.ltr ?? ((v) => v);
793
- const transformRTL = transform.rtl ?? ((v) => v);
798
+ const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
799
+ const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
794
800
  if (direction === "both" || direction === "ltr") {
795
801
  watchers.push(watchPausable(
796
802
  left,
@@ -844,7 +850,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
844
850
  return objectRef.value[key];
845
851
  },
846
852
  set(v) {
847
- const replaceRef = toValue(options.replaceRef) ?? true;
853
+ var _a;
854
+ const replaceRef = (_a = toValue(options.replaceRef)) != null ? _a : true;
848
855
  if (replaceRef) {
849
856
  if (Array.isArray(objectRef.value)) {
850
857
  const copy = [...objectRef.value];
@@ -900,7 +907,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
900
907
  r,
901
908
  (v) => {
902
909
  if (condition(v) !== isNot) {
903
- stop?.();
910
+ stop == null ? void 0 : stop();
904
911
  resolve(v);
905
912
  }
906
913
  },
@@ -914,7 +921,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
914
921
  const promises = [watcher];
915
922
  if (timeout != null) {
916
923
  promises.push(
917
- promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop?.())
924
+ promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop == null ? void 0 : stop())
918
925
  );
919
926
  }
920
927
  return Promise.race(promises);
@@ -922,14 +929,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
922
929
  function toBe(value, options) {
923
930
  if (!vueDemi.isRef(value))
924
931
  return toMatch((v) => v === value, options);
925
- const { flush = "sync", deep = false, timeout, throwOnTimeout } = options ?? {};
932
+ const { flush = "sync", deep = false, timeout, throwOnTimeout } = options != null ? options : {};
926
933
  let stop = null;
927
934
  const watcher = new Promise((resolve) => {
928
935
  stop = vueDemi.watch(
929
936
  [r, value],
930
937
  ([v1, v2]) => {
931
938
  if (isNot !== (v1 === v2)) {
932
- stop?.();
939
+ stop == null ? void 0 : stop();
933
940
  resolve(v1);
934
941
  }
935
942
  },
@@ -944,7 +951,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
944
951
  if (timeout != null) {
945
952
  promises.push(
946
953
  promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
947
- stop?.();
954
+ stop == null ? void 0 : stop();
948
955
  return toValue(r);
949
956
  })
950
957
  );
@@ -1015,9 +1022,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1015
1022
  return value === othVal;
1016
1023
  }
1017
1024
  function useArrayDifference(...args) {
1025
+ var _a;
1018
1026
  const list = args[0];
1019
1027
  const values = args[1];
1020
- let compareFn = args[2] ?? defaultComparator;
1028
+ let compareFn = (_a = args[2]) != null ? _a : defaultComparator;
1021
1029
  if (typeof compareFn === "string") {
1022
1030
  const key = compareFn;
1023
1031
  compareFn = (value, othVal) => value[key] === othVal[key];
@@ -1065,19 +1073,20 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1065
1073
  return isObject(obj) && containsProp(obj, "formIndex", "comparator");
1066
1074
  }
1067
1075
  function useArrayIncludes(...args) {
1076
+ var _a;
1068
1077
  const list = args[0];
1069
1078
  const value = args[1];
1070
1079
  let comparator = args[2];
1071
1080
  let formIndex = 0;
1072
1081
  if (isArrayIncludesOptions(comparator)) {
1073
- formIndex = comparator.fromIndex ?? 0;
1082
+ formIndex = (_a = comparator.fromIndex) != null ? _a : 0;
1074
1083
  comparator = comparator.comparator;
1075
1084
  }
1076
1085
  if (typeof comparator === "string") {
1077
1086
  const key = comparator;
1078
1087
  comparator = (element, value2) => element[key] === toValue(value2);
1079
1088
  }
1080
- comparator = comparator ?? ((element, value2) => element === toValue(value2));
1089
+ comparator = comparator != null ? comparator : (element, value2) => element === toValue(value2);
1081
1090
  return vueDemi.computed(
1082
1091
  () => toValue(list).slice(formIndex).some(
1083
1092
  (element, index, array) => comparator(toValue(element), toValue(value), index, toValue(array))
@@ -1149,6 +1158,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1149
1158
  return isLowercase ? m.toLowerCase() : m;
1150
1159
  }
1151
1160
  function formatDate(date, formatStr, options = {}) {
1161
+ var _a;
1152
1162
  const years = date.getFullYear();
1153
1163
  const month = date.getMonth();
1154
1164
  const days = date.getDate();
@@ -1157,7 +1167,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1157
1167
  const seconds = date.getSeconds();
1158
1168
  const milliseconds = date.getMilliseconds();
1159
1169
  const day = date.getDay();
1160
- const meridiem = options.customMeridiem ?? defaultMeridiem;
1170
+ const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
1161
1171
  const matches = {
1162
1172
  YY: () => String(years).slice(-2),
1163
1173
  YYYY: () => years,
@@ -1185,7 +1195,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1185
1195
  a: () => meridiem(hours, minutes, true),
1186
1196
  aa: () => meridiem(hours, minutes, true, true)
1187
1197
  };
1188
- return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 ?? matches[match]?.() ?? match);
1198
+ return formatStr.replace(REGEX_FORMAT, (match, $1) => {
1199
+ var _a2, _b;
1200
+ return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? void 0 : _a2.call(matches)) != null ? _b : match;
1201
+ });
1189
1202
  }
1190
1203
  function normalizeDate(date) {
1191
1204
  if (date === null)
@@ -1283,7 +1296,8 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1283
1296
  }
1284
1297
 
1285
1298
  function useLastChanged(source, options = {}) {
1286
- const ms = vueDemi.ref(options.initialValue ?? null);
1299
+ var _a;
1300
+ const ms = vueDemi.ref((_a = options.initialValue) != null ? _a : null);
1287
1301
  vueDemi.watch(
1288
1302
  source,
1289
1303
  () => ms.value = timestamp(),
@@ -1336,7 +1350,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1336
1350
  callback
1337
1351
  } = options;
1338
1352
  const controls = useTimeoutFn(
1339
- callback ?? noop,
1353
+ callback != null ? callback : noop,
1340
1354
  interval,
1341
1355
  options
1342
1356
  );
@@ -1395,7 +1409,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1395
1409
  }
1396
1410
 
1397
1411
  function watchArray(source, cb, options) {
1398
- let oldList = options?.immediate ? [] : [
1412
+ let oldList = (options == null ? void 0 : options.immediate) ? [] : [
1399
1413
  ...source instanceof Function ? source() : Array.isArray(source) ? source : toValue(source)
1400
1414
  ];
1401
1415
  return vueDemi.watch(source, (newList, _, onCleanup) => {
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- var VueDemi=function(c,u,C){if(c.install)return c;if(!u)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),c;if(u.version.slice(0,4)==="2.7."){let w=function(A,S){var O,E={},U={config:u.config,use:u.use.bind(u),mixin:u.mixin.bind(u),component:u.component.bind(u),provide:function(T,F){return E[T]=F,this},directive:function(T,F){return F?(u.directive(T,F),U):u.directive(T)},mount:function(T,F){return O||(O=new u(Object.assign({propsData:S},A,{provide:Object.assign(E,A.provide)})),O.$mount(T,F),O)},unmount:function(){O&&(O.$destroy(),O=void 0)}};return U};var v=w;for(var b in u)c[b]=u[b];c.isVue2=!0,c.isVue3=!1,c.install=function(){},c.Vue=u,c.Vue2=u,c.version=u.version,c.warn=u.util.warn,c.hasInjectionContext=()=>!!c.getCurrentInstance(),c.createApp=w}else if(u.version.slice(0,2)==="2.")if(C){for(var b in C)c[b]=C[b];c.isVue2=!0,c.isVue3=!1,c.install=function(){},c.Vue=u,c.Vue2=u,c.version=u.version,c.hasInjectionContext=()=>!!c.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(u.version.slice(0,2)==="3."){for(var b in u)c[b]=u[b];c.isVue2=!1,c.isVue3=!0,c.install=function(){},c.Vue=u,c.Vue2=void 0,c.version=u.version,c.set=function(w,A,S){return Array.isArray(w)?(w.length=Math.max(w.length,A),w.splice(A,1,S),S):(w[A]=S,S)},c.del=function(w,A){if(Array.isArray(w)){w.splice(A,1);return}delete w[A]}}else console.error("[vue-demi] Vue version "+u.version+" is unsupported.");return c}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(c,u){"use strict";function C(t,e){const n=u.shallowRef();return u.watchEffect(()=>{n.value=t()},{...e,flush:e?.flush??"sync"}),u.readonly(n)}function b(t,e){let n,r,o;const i=u.ref(!0),a=()=>{i.value=!0,o()};u.watch(t,a,{flush:"sync"});const l=typeof e=="function"?e:e.get,h=typeof e=="function"?void 0:e.set,g=u.customRef((y,f)=>(r=y,o=f,{get(){return i.value&&(n=l(),i.value=!1),r(),n},set(d){h?.(d)}}));return Object.isExtensible(g)&&(g.trigger=a),g}function v(t){return u.getCurrentScope()?(u.onScopeDispose(t),!0):!1}function w(){const t=new Set,e=o=>{t.delete(o)};return{on:o=>{t.add(o);const i=()=>e(o);return v(i),{off:i}},off:e,trigger:o=>Promise.all(Array.from(t).map(i=>i(o)))}}function A(t){let e=!1,n;const r=u.effectScope(!0);return(...o)=>(e||(n=r.run(()=>t(...o)),e=!0),n)}function S(t){const e=Symbol("InjectionState");return[(...o)=>{const i=t(...o);return u.provide(e,i),i},()=>u.inject(e)]}function O(t){let e=0,n,r;const o=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...i)=>(e+=1,n||(r=u.effectScope(!0),n=r.run(()=>t(...i))),v(o),n)}function E(t,e,{enumerable:n=!1,unwrap:r=!0}={}){if(!u.isVue3&&!u.version.startsWith("2.7.")){if(process.env.NODE_ENV!=="production")throw new Error("[VueUse] extendRef only works in Vue 2.7 or above.");return}for(const[o,i]of Object.entries(e))o!=="value"&&(u.isRef(i)&&r?Object.defineProperty(t,o,{get(){return i.value},set(a){i.value=a},enumerable:n}):Object.defineProperty(t,o,{value:i,enumerable:n}));return t}function U(t,e){return e==null?u.unref(t):u.unref(t)[e]}function T(t){return u.unref(t)!=null}function F(t,e){if(typeof Symbol<"u"){const n={...t};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function s(t){return typeof t=="function"?t():u.unref(t)}const yt=s;function $(t,e){const n=e?.computedGetter===!1?u.unref:s;return function(...r){return u.computed(()=>t.apply(this,r.map(o=>n(o))))}}function gt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:o=!0}=e;n.push(...Object.keys(t)),o&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(o=>{const i=t[o];return[o,typeof i=="function"?$(i.bind(t),r):i]}))}function V(t){if(!u.isRef(t))return u.reactive(t);const e=new Proxy({},{get(n,r,o){return u.unref(Reflect.get(t.value,r,o))},set(n,r,o){return u.isRef(t.value[r])&&!u.isRef(o)?t.value[r].value=o:t.value[r]=o,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return u.reactive(e)}function H(t){return V(u.computed(t))}function mt(t,...e){const n=e.flat(),r=n[0];return H(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,i])=>!r(s(i),o)):Object.entries(u.toRefs(t)).filter(o=>!n.includes(o[0]))))}const k=typeof window<"u"&&typeof document<"u",pt=t=>typeof t<"u",wt=t=>t!=null,bt=(t,...e)=>{t||console.warn(...e)},At=Object.prototype.toString,x=t=>At.call(t)==="[object Object]",Ot=()=>Date.now(),D=()=>+Date.now(),vt=(t,e,n)=>Math.min(n,Math.max(e,t)),I=()=>{},St=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),Tt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ft=It();function It(){return k&&window?.navigator?.userAgent&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function N(t,e){function n(...r){return new Promise((o,i)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(o).catch(i)})}return n}const W=t=>t();function Y(t,e={}){let n,r,o=I;const i=l=>{clearTimeout(l),o(),o=I};return l=>{const h=s(t),g=s(e.maxWait);return n&&i(n),h<=0||g!==void 0&&g<=0?(r&&(i(r),r=null),Promise.resolve(l())):new Promise((y,f)=>{o=e.rejectOnCancel?f:y,g&&!r&&(r=setTimeout(()=>{n&&i(n),r=null,y(l())},g)),n=setTimeout(()=>{r&&i(r),r=null,y(l())},h)})}}function G(t,e=!0,n=!0,r=!1){let o=0,i,a=!0,l=I,h;const g=()=>{i&&(clearTimeout(i),i=void 0,l(),l=I)};return f=>{const d=s(t),m=Date.now()-o,p=()=>h=f();return g(),d<=0?(o=Date.now(),p()):(m>d&&(n||!a)?(o=Date.now(),p()):e&&(h=new Promise((P,R)=>{l=r?R:P,i=setTimeout(()=>{o=Date.now(),a=!0,P(p()),g()},Math.max(0,d-m))})),!n&&!i&&(i=setTimeout(()=>a=!0,d)),a=!1,h)}}function tt(t=W){const e=u.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const o=(...i)=>{e.value&&t(...i)};return{isActive:u.readonly(e),pause:n,resume:r,eventFilter:o}}const Pt={mounted:u.isVue3?"mounted":"inserted",updated:u.isVue3?"updated":"componentUpdated",unmounted:u.isVue3?"unmounted":"unbind"};function et(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const Rt=/\B([A-Z])/g,Ct=et(t=>t.replace(Rt,"-$1").toLowerCase()),Mt=/-(\w)/g,Et=et(t=>t.replace(Mt,(e,n)=>n?n.toUpperCase():""));function z(t,e=!1,n="Timeout"){return new Promise((r,o)=>{setTimeout(e?()=>o(n):r,t)})}function kt(t){return t}function Nt(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function jt(t){return t()}function nt(t,...e){return e.some(n=>n in t)}function Ut(t,e){if(typeof t=="number")return t+e;const n=t.match(/^-?[0-9]+\.?[0-9]*/)?.[0]||"",r=t.slice(n.length),o=Number.parseFloat(n)+e;return Number.isNaN(o)?t:o+r}function Wt(t,e,n=!1){return e.reduce((r,o)=>(o in t&&(!n||t[o]!==void 0)&&(r[o]=t[o]),r),{})}function Lt(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,o])=>(!n||o!==void 0)&&!e.includes(r)))}function _t(t){return Object.entries(t)}function q(...t){if(t.length!==1)return u.toRef(...t);const e=t[0];return typeof e=="function"?u.readonly(u.customRef(()=>({get:e,set:I}))):u.ref(e)}const Bt=q;function $t(t,...e){const n=e.flat(),r=n[0];return H(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,i])=>r(s(i),o)):n.map(o=>[o,q(t,o)])))}function rt(t,e=1e4){return u.customRef((n,r)=>{let o=s(t),i;const a=()=>setTimeout(()=>{o=s(t),r()},s(e));return v(()=>{clearTimeout(i)}),{get(){return n(),o},set(l){o=l,r(),clearTimeout(i),i=a()}}})}function ot(t,e=200,n={}){return N(Y(e,n),t)}function Z(t,e=200,n={}){const r=u.ref(t.value),o=ot(()=>{r.value=t.value},e,n);return u.watch(t,()=>o()),r}function Ht(t,e){return u.computed({get(){return t.value??e},set(n){t.value=n}})}function ct(t,e=200,n=!1,r=!0,o=!1){return N(G(e,n,r,o),t)}function J(t,e=200,n=!0,r=!0){if(e<=0)return t;const o=u.ref(t.value),i=ct(()=>{o.value=t.value},e,n,r);return u.watch(t,()=>i()),o}function ut(t,e={}){let n=t,r,o;const i=u.customRef((d,m)=>(r=d,o=m,{get(){return a()},set(p){l(p)}}));function a(d=!0){return d&&r(),n}function l(d,m=!0){if(d===n)return;const p=n;e.onBeforeChange?.(d,p)!==!1&&(n=d,e.onChanged?.(d,p),m&&o())}return E(i,{get:a,set:l,untrackedGet:()=>a(!1),silentSet:d=>l(d,!1),peek:()=>a(!1),lay:d=>l(d,!1)},{enumerable:!0})}const Yt=ut;function Gt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3)if(u.isVue2)u.set(...t);else{const[e,n,r]=t;e[n]=r}}function j(t,e,n={}){const{eventFilter:r=W,...o}=n;return u.watch(t,N(r,e),o)}function L(t,e,n={}){const{eventFilter:r,...o}=n,{eventFilter:i,pause:a,resume:l,isActive:h}=tt(r);return{stop:j(t,e,{...o,eventFilter:i}),pause:a,resume:l,isActive:h}}function zt(t,e,n={}){const{flush:r="sync",deep:o=!1,immediate:i=!0,direction:a="both",transform:l={}}=n,h=[],g=l.ltr??(d=>d),y=l.rtl??(d=>d);return(a==="both"||a==="ltr")&&h.push(L(t,d=>{h.forEach(m=>m.pause()),e.value=g(d),h.forEach(m=>m.resume())},{flush:r,deep:o,immediate:i})),(a==="both"||a==="rtl")&&h.push(L(e,d=>{h.forEach(m=>m.pause()),t.value=y(d),h.forEach(m=>m.resume())},{flush:r,deep:o,immediate:i})),()=>{h.forEach(d=>d.stop())}}function qt(t,e,n={}){const{flush:r="sync",deep:o=!1,immediate:i=!0}=n;return Array.isArray(e)||(e=[e]),u.watch(t,a=>e.forEach(l=>l.value=a),{flush:r,deep:o,immediate:i})}function Zt(t,e={}){if(!u.isRef(t))return u.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=u.customRef(()=>({get(){return t.value[r]},set(o){if(s(e.replaceRef)??!0)if(Array.isArray(t.value)){const a=[...t.value];a[r]=o,t.value=a}else{const a={...t.value,[r]:o};Object.setPrototypeOf(a,Object.getPrototypeOf(t.value)),t.value=a}else t.value[r]=o}}));return n}function Jt(t,e=!0){u.getCurrentInstance()?u.onBeforeMount(t):e?t():u.nextTick(t)}function Xt(t){u.getCurrentInstance()&&u.onBeforeUnmount(t)}function Kt(t,e=!0){u.getCurrentInstance()?u.onMounted(t):e?t():u.nextTick(t)}function Qt(t){u.getCurrentInstance()&&u.onUnmounted(t)}function X(t,e=!1){function n(f,{flush:d="sync",deep:m=!1,timeout:p,throwOnTimeout:P}={}){let R=null;const Q=[new Promise(B=>{R=u.watch(t,M=>{f(M)!==e&&(R?.(),B(M))},{flush:d,deep:m,immediate:!0})})];return p!=null&&Q.push(z(p,P).then(()=>s(t)).finally(()=>R?.())),Promise.race(Q)}function r(f,d){if(!u.isRef(f))return n(M=>M===f,d);const{flush:m="sync",deep:p=!1,timeout:P,throwOnTimeout:R}=d??{};let _=null;const B=[new Promise(M=>{_=u.watch([t,f],([ht,Ue])=>{e!==(ht===Ue)&&(_?.(),M(ht))},{flush:m,deep:p,immediate:!0})})];return P!=null&&B.push(z(P,R).then(()=>s(t)).finally(()=>(_?.(),s(t)))),Promise.race(B)}function o(f){return n(d=>!!d,f)}function i(f){return r(null,f)}function a(f){return r(void 0,f)}function l(f){return n(Number.isNaN,f)}function h(f,d){return n(m=>{const p=Array.from(m);return p.includes(f)||p.includes(s(f))},d)}function g(f){return y(1,f)}function y(f=1,d){let m=-1;return n(()=>(m+=1,m>=f),d)}return Array.isArray(s(t))?{toMatch:n,toContains:h,changed:g,changedTimes:y,get not(){return X(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:o,toBeNull:i,toBeNaN:l,toBeUndefined:a,changed:g,changedTimes:y,get not(){return X(t,!e)}}}function Vt(t){return X(t)}function xt(t,e){return t===e}function Dt(...t){const e=t[0],n=t[1];let r=t[2]??xt;if(typeof r=="string"){const o=r;r=(i,a)=>i[o]===a[o]}return u.computed(()=>s(e).filter(o=>s(n).findIndex(i=>r(o,i))===-1))}function te(t,e){return u.computed(()=>s(t).every((n,r,o)=>e(s(n),r,o)))}function ee(t,e){return u.computed(()=>s(t).map(n=>s(n)).filter(e))}function ne(t,e){return u.computed(()=>s(s(t).find((n,r,o)=>e(s(n),r,o))))}function re(t,e){return u.computed(()=>s(t).findIndex((n,r,o)=>e(s(n),r,o)))}function oe(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function ce(t,e){return u.computed(()=>s(Array.prototype.findLast?s(t).findLast((n,r,o)=>e(s(n),r,o)):oe(s(t),(n,r,o)=>e(s(n),r,o))))}function ue(t){return x(t)&&nt(t,"formIndex","comparator")}function ie(...t){const e=t[0],n=t[1];let r=t[2],o=0;if(ue(r)&&(o=r.fromIndex??0,r=r.comparator),typeof r=="string"){const i=r;r=(a,l)=>a[i]===s(l)}return r=r??((i,a)=>i===s(a)),u.computed(()=>s(e).slice(o).some((i,a,l)=>r(s(i),s(n),a,s(l))))}function ae(t,e){return u.computed(()=>s(t).map(n=>s(n)).join(s(e)))}function se(t,e){return u.computed(()=>s(t).map(n=>s(n)).map(e))}function le(t,e,...n){const r=(o,i,a)=>e(s(o),s(i),a);return u.computed(()=>{const o=s(t);return n.length?o.reduce(r,s(n[0])):o.reduce(r)})}function fe(t,e){return u.computed(()=>s(t).some((n,r,o)=>e(s(n),r,o)))}function de(t){return Array.from(new Set(t))}function he(t,e){return t.reduce((n,r)=>(n.some(o=>e(r,o,t))||n.push(r),n),[])}function ye(t,e){return u.computed(()=>{const n=s(t).map(r=>s(r));return e?he(n,e):de(n)})}function ge(t=0,e={}){let n=u.unref(t);const r=u.ref(t),{max:o=Number.POSITIVE_INFINITY,min:i=Number.NEGATIVE_INFINITY}=e,a=(f=1)=>r.value=Math.min(o,r.value+f),l=(f=1)=>r.value=Math.max(i,r.value-f),h=()=>r.value,g=f=>r.value=Math.max(i,Math.min(o,f));return{count:r,inc:a,dec:l,get:h,set:g,reset:(f=n)=>(n=f,g(f))}}const me=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,pe=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function we(t,e,n,r){let o=t<12?"AM":"PM";return r&&(o=o.split("").reduce((i,a)=>i+=`${a}.`,"")),n?o.toLowerCase():o}function it(t,e,n={}){const r=t.getFullYear(),o=t.getMonth(),i=t.getDate(),a=t.getHours(),l=t.getMinutes(),h=t.getSeconds(),g=t.getMilliseconds(),y=t.getDay(),f=n.customMeridiem??we,d={YY:()=>String(r).slice(-2),YYYY:()=>r,M:()=>o+1,MM:()=>`${o+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(n.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(n.locales,{month:"long"}),D:()=>String(i),DD:()=>`${i}`.padStart(2,"0"),H:()=>String(a),HH:()=>`${a}`.padStart(2,"0"),h:()=>`${a%12||12}`.padStart(1,"0"),hh:()=>`${a%12||12}`.padStart(2,"0"),m:()=>String(l),mm:()=>`${l}`.padStart(2,"0"),s:()=>String(h),ss:()=>`${h}`.padStart(2,"0"),SSS:()=>`${g}`.padStart(3,"0"),d:()=>y,dd:()=>t.toLocaleDateString(n.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(n.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(n.locales,{weekday:"long"}),A:()=>f(a,l),AA:()=>f(a,l,!1,!0),a:()=>f(a,l,!0),aa:()=>f(a,l,!0,!0)};return e.replace(pe,(m,p)=>p??d[m]?.()??m)}function at(t){if(t===null)return new Date(Number.NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(me);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)}function be(t,e="HH:mm:ss",n={}){return u.computed(()=>it(at(s(t)),s(e),n))}function st(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:o=!1}=n;let i=null;const a=u.ref(!1);function l(){i&&(clearInterval(i),i=null)}function h(){a.value=!1,l()}function g(){const y=s(e);y<=0||(a.value=!0,o&&t(),l(),i=setInterval(t,y))}if(r&&k&&g(),u.isRef(e)||typeof e=="function"){const y=u.watch(e,()=>{a.value&&k&&g()});v(y)}return v(h),{isActive:a,pause:h,resume:g}}function Ae(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:o}=e,i=u.ref(0),a=()=>i.value+=1,l=()=>{i.value=0},h=st(o?()=>{a(),o(i.value)}:a,t,{immediate:r});return n?{counter:i,reset:l,...h}:i}function Oe(t,e={}){const n=u.ref(e.initialValue??null);return u.watch(t,()=>n.value=D(),e),n}function lt(t,e,n={}){const{immediate:r=!0}=n,o=u.ref(!1);let i=null;function a(){i&&(clearTimeout(i),i=null)}function l(){o.value=!1,a()}function h(...g){a(),o.value=!0,i=setTimeout(()=>{o.value=!1,i=null,t(...g)},s(e))}return r&&(o.value=!0,k&&h()),v(l),{isPending:u.readonly(o),start:h,stop:l}}function ve(t=1e3,e={}){const{controls:n=!1,callback:r}=e,o=lt(r??I,t,e),i=u.computed(()=>!o.isPending.value);return n?{ready:i,...o}:i}function Se(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:o}=e;return u.computed(()=>{let i=s(t);return typeof i=="string"&&(i=Number[n](i,r)),o&&Number.isNaN(i)&&(i=0),i})}function Te(t){return u.computed(()=>`${s(t)}`)}function Fe(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,o=u.isRef(t),i=u.ref(t);function a(l){if(arguments.length)return i.value=l,i.value;{const h=s(n);return i.value=i.value===h?s(r):h,i.value}}return o?a:[i,a]}function Ie(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:s(t)];return u.watch(t,(o,i,a)=>{const l=Array.from({length:r.length}),h=[];for(const y of o){let f=!1;for(let d=0;d<r.length;d++)if(!l[d]&&y===r[d]){l[d]=!0,f=!0;break}f||h.push(y)}const g=r.filter((y,f)=>!l[f]);e(o,r,h,g,a),r=[...o]},n)}function Pe(t,e,n){const{count:r,...o}=n,i=u.ref(0),a=j(t,(...l)=>{i.value+=1,i.value>=s(r)&&u.nextTick(()=>a()),e(...l)},o);return{count:i,stop:a}}function ft(t,e,n={}){const{debounce:r=0,maxWait:o=void 0,...i}=n;return j(t,e,{...i,eventFilter:Y(r,{maxWait:o})})}function Re(t,e,n){return u.watch(t,e,{...n,deep:!0})}function K(t,e,n={}){const{eventFilter:r=W,...o}=n,i=N(r,e);let a,l,h;if(o.flush==="sync"){const g=u.ref(!1);l=()=>{},a=y=>{g.value=!0,y(),g.value=!1},h=u.watch(t,(...y)=>{g.value||i(...y)},o)}else{const g=[],y=u.ref(0),f=u.ref(0);l=()=>{y.value=f.value},g.push(u.watch(t,()=>{f.value++},{...o,flush:"sync"})),a=d=>{const m=f.value;d(),y.value+=f.value-m},g.push(u.watch(t,(...d)=>{const m=y.value>0&&y.value===f.value;y.value=0,f.value=0,!m&&i(...d)},o)),h=()=>{g.forEach(d=>d())}}return{stop:h,ignoreUpdates:a,ignorePrevAsyncUpdates:l}}function Ce(t,e,n){return u.watch(t,e,{...n,immediate:!0})}function Me(t,e,n){const r=u.watch(t,(...o)=>(u.nextTick(()=>r()),e(...o)),n)}function dt(t,e,n={}){const{throttle:r=0,trailing:o=!0,leading:i=!0,...a}=n;return j(t,e,{...a,eventFilter:G(r,o,i)})}function Ee(t,e,n={}){let r;function o(){if(!r)return;const y=r;r=void 0,y()}function i(y){r=y}const a=(y,f)=>(o(),e(y,f,i)),l=K(t,a,n),{ignoreUpdates:h}=l;return{...l,trigger:()=>{let y;return h(()=>{y=a(ke(t),Ne(t))}),y}}}function ke(t){return u.isReactive(t)?t:Array.isArray(t)?t.map(e=>s(e)):s(t)}function Ne(t){return Array.isArray(t)?t.map(()=>{}):void 0}function je(t,e,n){return u.watch(t,(r,o,i)=>{r&&e(r,o,i)},n)}c.assert=bt,c.autoResetRef=rt,c.bypassFilter=W,c.camelize=Et,c.clamp=vt,c.computedEager=C,c.computedWithControl=b,c.containsProp=nt,c.controlledComputed=b,c.controlledRef=Yt,c.createEventHook=w,c.createFilterWrapper=N,c.createGlobalState=A,c.createInjectionState=S,c.createReactiveFn=$,c.createSharedComposable=O,c.createSingletonPromise=Nt,c.debounceFilter=Y,c.debouncedRef=Z,c.debouncedWatch=ft,c.directiveHooks=Pt,c.eagerComputed=C,c.extendRef=E,c.formatDate=it,c.get=U,c.hasOwn=Tt,c.hyphenate=Ct,c.identity=kt,c.ignorableWatch=K,c.increaseWithUnit=Ut,c.invoke=jt,c.isClient=k,c.isDef=pt,c.isDefined=T,c.isIOS=Ft,c.isObject=x,c.makeDestructurable=F,c.noop=I,c.normalizeDate=at,c.notNullish=wt,c.now=Ot,c.objectEntries=_t,c.objectOmit=Lt,c.objectPick=Wt,c.pausableFilter=tt,c.pausableWatch=L,c.promiseTimeout=z,c.rand=St,c.reactify=$,c.reactifyObject=gt,c.reactiveComputed=H,c.reactiveOmit=mt,c.reactivePick=$t,c.refAutoReset=rt,c.refDebounced=Z,c.refDefault=Ht,c.refThrottled=J,c.refWithControl=ut,c.resolveRef=Bt,c.resolveUnref=yt,c.set=Gt,c.syncRef=zt,c.syncRefs=qt,c.throttleFilter=G,c.throttledRef=J,c.throttledWatch=dt,c.timestamp=D,c.toReactive=V,c.toRef=q,c.toRefs=Zt,c.toValue=s,c.tryOnBeforeMount=Jt,c.tryOnBeforeUnmount=Xt,c.tryOnMounted=Kt,c.tryOnScopeDispose=v,c.tryOnUnmounted=Qt,c.until=Vt,c.useArrayDifference=Dt,c.useArrayEvery=te,c.useArrayFilter=ee,c.useArrayFind=ne,c.useArrayFindIndex=re,c.useArrayFindLast=ce,c.useArrayIncludes=ie,c.useArrayJoin=ae,c.useArrayMap=se,c.useArrayReduce=le,c.useArraySome=fe,c.useArrayUnique=ye,c.useCounter=ge,c.useDateFormat=be,c.useDebounce=Z,c.useDebounceFn=ot,c.useInterval=Ae,c.useIntervalFn=st,c.useLastChanged=Oe,c.useThrottle=J,c.useThrottleFn=ct,c.useTimeout=ve,c.useTimeoutFn=lt,c.useToNumber=Se,c.useToString=Te,c.useToggle=Fe,c.watchArray=Ie,c.watchAtMost=Pe,c.watchDebounced=ft,c.watchDeep=Re,c.watchIgnorable=K,c.watchImmediate=Ce,c.watchOnce=Me,c.watchPausable=L,c.watchThrottled=dt,c.watchTriggerable=Ee,c.watchWithFilter=j,c.whenever=je})(this.VueUse=this.VueUse||{},VueDemi);
1
+ var VueDemi=function(u,c,M){if(u.install)return u;if(!c)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),u;if(c.version.slice(0,4)==="2.7."){let b=function(O,I){var S,_={},U={config:c.config,use:c.use.bind(c),mixin:c.mixin.bind(c),component:c.component.bind(c),provide:function(P,R){return _[P]=R,this},directive:function(P,R){return R?(c.directive(P,R),U):c.directive(P)},mount:function(P,R){return S||(S=new c(Object.assign({propsData:I},O,{provide:Object.assign(_,O.provide)})),S.$mount(P,R),S)},unmount:function(){S&&(S.$destroy(),S=void 0)}};return U};var F=b;for(var A in c)u[A]=c[A];u.isVue2=!0,u.isVue3=!1,u.install=function(){},u.Vue=c,u.Vue2=c,u.version=c.version,u.warn=c.util.warn,u.hasInjectionContext=()=>!!u.getCurrentInstance(),u.createApp=b}else if(c.version.slice(0,2)==="2.")if(M){for(var A in M)u[A]=M[A];u.isVue2=!0,u.isVue3=!1,u.install=function(){},u.Vue=c,u.Vue2=c,u.version=c.version,u.hasInjectionContext=()=>!!u.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(c.version.slice(0,2)==="3."){for(var A in c)u[A]=c[A];u.isVue2=!1,u.isVue3=!0,u.install=function(){},u.Vue=c,u.Vue2=void 0,u.version=c.version,u.set=function(b,O,I){return Array.isArray(b)?(b.length=Math.max(b.length,O),b.splice(O,1,I),I):(b[O]=I,I)},u.del=function(b,O){if(Array.isArray(b)){b.splice(O,1);return}delete b[O]}}else console.error("[vue-demi] Vue version "+c.version+" is unsupported.");return u}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(u,c){"use strict";function M(t,e){var n;const r=c.shallowRef();return c.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),c.readonly(r)}function A(t,e){let n,r,o;const a=c.ref(!0),l=()=>{a.value=!0,o()};c.watch(t,l,{flush:"sync"});const i=typeof e=="function"?e:e.get,d=typeof e=="function"?void 0:e.set,g=c.customRef((h,f)=>(r=h,o=f,{get(){return a.value&&(n=i(),a.value=!1),r(),n},set(y){d?.(y)}}));return Object.isExtensible(g)&&(g.trigger=l),g}function F(t){return c.getCurrentScope()?(c.onScopeDispose(t),!0):!1}function b(){const t=new Set,e=o=>{t.delete(o)};return{on:o=>{t.add(o);const a=()=>e(o);return F(a),{off:a}},off:e,trigger:o=>Promise.all(Array.from(t).map(a=>a(o)))}}function O(t){let e=!1,n;const r=c.effectScope(!0);return(...o)=>(e||(n=r.run(()=>t(...o)),e=!0),n)}function I(t){const e=Symbol("InjectionState");return[(...o)=>{const a=t(...o);return c.provide(e,a),a},()=>c.inject(e)]}function S(t){let e=0,n,r;const o=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...a)=>(e+=1,n||(r=c.effectScope(!0),n=r.run(()=>t(...a))),F(o),n)}function _(t,e,{enumerable:n=!1,unwrap:r=!0}={}){if(!c.isVue3&&!c.version.startsWith("2.7.")){if(process.env.NODE_ENV!=="production")throw new Error("[VueUse] extendRef only works in Vue 2.7 or above.");return}for(const[o,a]of Object.entries(e))o!=="value"&&(c.isRef(a)&&r?Object.defineProperty(t,o,{get(){return a.value},set(l){a.value=l},enumerable:n}):Object.defineProperty(t,o,{value:a,enumerable:n}));return t}function U(t,e){return e==null?c.unref(t):c.unref(t)[e]}function P(t){return c.unref(t)!=null}function R(t,e){if(typeof Symbol<"u"){const n={...t};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function s(t){return typeof t=="function"?t():c.unref(t)}const yt=s;function $(t,e){const n=e?.computedGetter===!1?c.unref:s;return function(...r){return c.computed(()=>t.apply(this,r.map(o=>n(o))))}}function gt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:o=!0}=e;n.push(...Object.keys(t)),o&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(o=>{const a=t[o];return[o,typeof a=="function"?$(a.bind(t),r):a]}))}function V(t){if(!c.isRef(t))return c.reactive(t);const e=new Proxy({},{get(n,r,o){return c.unref(Reflect.get(t.value,r,o))},set(n,r,o){return c.isRef(t.value[r])&&!c.isRef(o)?t.value[r].value=o:t.value[r]=o,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return c.reactive(e)}function H(t){return V(c.computed(t))}function mt(t,...e){const n=e.flat(),r=n[0];return H(()=>Object.fromEntries(typeof r=="function"?Object.entries(c.toRefs(t)).filter(([o,a])=>!r(s(a),o)):Object.entries(c.toRefs(t)).filter(o=>!n.includes(o[0]))))}const k=typeof window<"u"&&typeof document<"u",wt=t=>typeof t<"u",pt=t=>t!=null,vt=(t,...e)=>{t||console.warn(...e)},bt=Object.prototype.toString,x=t=>bt.call(t)==="[object Object]",At=()=>Date.now(),D=()=>+Date.now(),Ot=(t,e,n)=>Math.min(n,Math.max(e,t)),C=()=>{},St=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),Tt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ft=It();function It(){var t;return k&&((t=window?.navigator)==null?void 0:t.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function N(t,e){function n(...r){return new Promise((o,a)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(o).catch(a)})}return n}const W=t=>t();function Y(t,e={}){let n,r,o=C;const a=i=>{clearTimeout(i),o(),o=C};return i=>{const d=s(t),g=s(e.maxWait);return n&&a(n),d<=0||g!==void 0&&g<=0?(r&&(a(r),r=null),Promise.resolve(i())):new Promise((h,f)=>{o=e.rejectOnCancel?f:h,g&&!r&&(r=setTimeout(()=>{n&&a(n),r=null,h(i())},g)),n=setTimeout(()=>{r&&a(r),r=null,h(i())},d)})}}function G(t,e=!0,n=!0,r=!1){let o=0,a,l=!0,i=C,d;const g=()=>{a&&(clearTimeout(a),a=void 0,i(),i=C)};return f=>{const y=s(t),w=Date.now()-o,m=()=>d=f();return g(),y<=0?(o=Date.now(),m()):(w>y&&(n||!l)?(o=Date.now(),m()):e&&(d=new Promise((p,v)=>{i=r?v:p,a=setTimeout(()=>{o=Date.now(),l=!0,p(m()),g()},Math.max(0,y-w))})),!n&&!a&&(a=setTimeout(()=>l=!0,y)),l=!1,d)}}function tt(t=W){const e=c.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const o=(...a)=>{e.value&&t(...a)};return{isActive:c.readonly(e),pause:n,resume:r,eventFilter:o}}const Pt={mounted:c.isVue3?"mounted":"inserted",updated:c.isVue3?"updated":"componentUpdated",unmounted:c.isVue3?"unmounted":"unbind"};function et(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const Rt=/\B([A-Z])/g,Ct=et(t=>t.replace(Rt,"-$1").toLowerCase()),Mt=/-(\w)/g,Et=et(t=>t.replace(Mt,(e,n)=>n?n.toUpperCase():""));function z(t,e=!1,n="Timeout"){return new Promise((r,o)=>{setTimeout(e?()=>o(n):r,t)})}function _t(t){return t}function kt(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function Nt(t){return t()}function nt(t,...e){return e.some(n=>n in t)}function jt(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?[0-9]+\.?[0-9]*/))==null?void 0:n[0])||"",o=t.slice(r.length),a=Number.parseFloat(r)+e;return Number.isNaN(a)?t:a+o}function Ut(t,e,n=!1){return e.reduce((r,o)=>(o in t&&(!n||t[o]!==void 0)&&(r[o]=t[o]),r),{})}function Wt(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,o])=>(!n||o!==void 0)&&!e.includes(r)))}function Lt(t){return Object.entries(t)}function q(...t){if(t.length!==1)return c.toRef(...t);const e=t[0];return typeof e=="function"?c.readonly(c.customRef(()=>({get:e,set:C}))):c.ref(e)}const Bt=q;function $t(t,...e){const n=e.flat(),r=n[0];return H(()=>Object.fromEntries(typeof r=="function"?Object.entries(c.toRefs(t)).filter(([o,a])=>r(s(a),o)):n.map(o=>[o,q(t,o)])))}function rt(t,e=1e4){return c.customRef((n,r)=>{let o=s(t),a;const l=()=>setTimeout(()=>{o=s(t),r()},s(e));return F(()=>{clearTimeout(a)}),{get(){return n(),o},set(i){o=i,r(),clearTimeout(a),a=l()}}})}function ot(t,e=200,n={}){return N(Y(e,n),t)}function Z(t,e=200,n={}){const r=c.ref(t.value),o=ot(()=>{r.value=t.value},e,n);return c.watch(t,()=>o()),r}function Ht(t,e){return c.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function ut(t,e=200,n=!1,r=!0,o=!1){return N(G(e,n,r,o),t)}function J(t,e=200,n=!0,r=!0){if(e<=0)return t;const o=c.ref(t.value),a=ut(()=>{o.value=t.value},e,n,r);return c.watch(t,()=>a()),o}function ct(t,e={}){let n=t,r,o;const a=c.customRef((y,w)=>(r=y,o=w,{get(){return l()},set(m){i(m)}}));function l(y=!0){return y&&r(),n}function i(y,w=!0){var m,p;if(y===n)return;const v=n;((m=e.onBeforeChange)==null?void 0:m.call(e,y,v))!==!1&&(n=y,(p=e.onChanged)==null||p.call(e,y,v),w&&o())}return _(a,{get:l,set:i,untrackedGet:()=>l(!1),silentSet:y=>i(y,!1),peek:()=>l(!1),lay:y=>i(y,!1)},{enumerable:!0})}const Yt=ct;function Gt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3)if(c.isVue2)c.set(...t);else{const[e,n,r]=t;e[n]=r}}function j(t,e,n={}){const{eventFilter:r=W,...o}=n;return c.watch(t,N(r,e),o)}function L(t,e,n={}){const{eventFilter:r,...o}=n,{eventFilter:a,pause:l,resume:i,isActive:d}=tt(r);return{stop:j(t,e,{...o,eventFilter:a}),pause:l,resume:i,isActive:d}}function zt(t,e,n={}){var r,o;const{flush:a="sync",deep:l=!1,immediate:i=!0,direction:d="both",transform:g={}}=n,h=[],f=(r=g.ltr)!=null?r:m=>m,y=(o=g.rtl)!=null?o:m=>m;return(d==="both"||d==="ltr")&&h.push(L(t,m=>{h.forEach(p=>p.pause()),e.value=f(m),h.forEach(p=>p.resume())},{flush:a,deep:l,immediate:i})),(d==="both"||d==="rtl")&&h.push(L(e,m=>{h.forEach(p=>p.pause()),t.value=y(m),h.forEach(p=>p.resume())},{flush:a,deep:l,immediate:i})),()=>{h.forEach(m=>m.stop())}}function qt(t,e,n={}){const{flush:r="sync",deep:o=!1,immediate:a=!0}=n;return Array.isArray(e)||(e=[e]),c.watch(t,l=>e.forEach(i=>i.value=l),{flush:r,deep:o,immediate:a})}function Zt(t,e={}){if(!c.isRef(t))return c.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=c.customRef(()=>({get(){return t.value[r]},set(o){var a;if((a=s(e.replaceRef))!=null?a:!0)if(Array.isArray(t.value)){const i=[...t.value];i[r]=o,t.value=i}else{const i={...t.value,[r]:o};Object.setPrototypeOf(i,Object.getPrototypeOf(t.value)),t.value=i}else t.value[r]=o}}));return n}function Jt(t,e=!0){c.getCurrentInstance()?c.onBeforeMount(t):e?t():c.nextTick(t)}function Xt(t){c.getCurrentInstance()&&c.onBeforeUnmount(t)}function Kt(t,e=!0){c.getCurrentInstance()?c.onMounted(t):e?t():c.nextTick(t)}function Qt(t){c.getCurrentInstance()&&c.onUnmounted(t)}function X(t,e=!1){function n(f,{flush:y="sync",deep:w=!1,timeout:m,throwOnTimeout:p}={}){let v=null;const Q=[new Promise(B=>{v=c.watch(t,E=>{f(E)!==e&&(v?.(),B(E))},{flush:y,deep:w,immediate:!0})})];return m!=null&&Q.push(z(m,p).then(()=>s(t)).finally(()=>v?.())),Promise.race(Q)}function r(f,y){if(!c.isRef(f))return n(E=>E===f,y);const{flush:w="sync",deep:m=!1,timeout:p,throwOnTimeout:v}=y??{};let T=null;const B=[new Promise(E=>{T=c.watch([t,f],([ht,je])=>{e!==(ht===je)&&(T?.(),E(ht))},{flush:w,deep:m,immediate:!0})})];return p!=null&&B.push(z(p,v).then(()=>s(t)).finally(()=>(T?.(),s(t)))),Promise.race(B)}function o(f){return n(y=>!!y,f)}function a(f){return r(null,f)}function l(f){return r(void 0,f)}function i(f){return n(Number.isNaN,f)}function d(f,y){return n(w=>{const m=Array.from(w);return m.includes(f)||m.includes(s(f))},y)}function g(f){return h(1,f)}function h(f=1,y){let w=-1;return n(()=>(w+=1,w>=f),y)}return Array.isArray(s(t))?{toMatch:n,toContains:d,changed:g,changedTimes:h,get not(){return X(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:o,toBeNull:a,toBeNaN:i,toBeUndefined:l,changed:g,changedTimes:h,get not(){return X(t,!e)}}}function Vt(t){return X(t)}function xt(t,e){return t===e}function Dt(...t){var e;const n=t[0],r=t[1];let o=(e=t[2])!=null?e:xt;if(typeof o=="string"){const a=o;o=(l,i)=>l[a]===i[a]}return c.computed(()=>s(n).filter(a=>s(r).findIndex(l=>o(a,l))===-1))}function te(t,e){return c.computed(()=>s(t).every((n,r,o)=>e(s(n),r,o)))}function ee(t,e){return c.computed(()=>s(t).map(n=>s(n)).filter(e))}function ne(t,e){return c.computed(()=>s(s(t).find((n,r,o)=>e(s(n),r,o))))}function re(t,e){return c.computed(()=>s(t).findIndex((n,r,o)=>e(s(n),r,o)))}function oe(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function ue(t,e){return c.computed(()=>s(Array.prototype.findLast?s(t).findLast((n,r,o)=>e(s(n),r,o)):oe(s(t),(n,r,o)=>e(s(n),r,o))))}function ce(t){return x(t)&&nt(t,"formIndex","comparator")}function ae(...t){var e;const n=t[0],r=t[1];let o=t[2],a=0;if(ce(o)&&(a=(e=o.fromIndex)!=null?e:0,o=o.comparator),typeof o=="string"){const l=o;o=(i,d)=>i[l]===s(d)}return o=o??((l,i)=>l===s(i)),c.computed(()=>s(n).slice(a).some((l,i,d)=>o(s(l),s(r),i,s(d))))}function ie(t,e){return c.computed(()=>s(t).map(n=>s(n)).join(s(e)))}function le(t,e){return c.computed(()=>s(t).map(n=>s(n)).map(e))}function se(t,e,...n){const r=(o,a,l)=>e(s(o),s(a),l);return c.computed(()=>{const o=s(t);return n.length?o.reduce(r,s(n[0])):o.reduce(r)})}function fe(t,e){return c.computed(()=>s(t).some((n,r,o)=>e(s(n),r,o)))}function de(t){return Array.from(new Set(t))}function he(t,e){return t.reduce((n,r)=>(n.some(o=>e(r,o,t))||n.push(r),n),[])}function ye(t,e){return c.computed(()=>{const n=s(t).map(r=>s(r));return e?he(n,e):de(n)})}function ge(t=0,e={}){let n=c.unref(t);const r=c.ref(t),{max:o=Number.POSITIVE_INFINITY,min:a=Number.NEGATIVE_INFINITY}=e,l=(f=1)=>r.value=Math.min(o,r.value+f),i=(f=1)=>r.value=Math.max(a,r.value-f),d=()=>r.value,g=f=>r.value=Math.max(a,Math.min(o,f));return{count:r,inc:l,dec:i,get:d,set:g,reset:(f=n)=>(n=f,g(f))}}const me=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,we=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function pe(t,e,n,r){let o=t<12?"AM":"PM";return r&&(o=o.split("").reduce((a,l)=>a+=`${l}.`,"")),n?o.toLowerCase():o}function at(t,e,n={}){var r;const o=t.getFullYear(),a=t.getMonth(),l=t.getDate(),i=t.getHours(),d=t.getMinutes(),g=t.getSeconds(),h=t.getMilliseconds(),f=t.getDay(),y=(r=n.customMeridiem)!=null?r:pe,w={YY:()=>String(o).slice(-2),YYYY:()=>o,M:()=>a+1,MM:()=>`${a+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(n.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(n.locales,{month:"long"}),D:()=>String(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(i),HH:()=>`${i}`.padStart(2,"0"),h:()=>`${i%12||12}`.padStart(1,"0"),hh:()=>`${i%12||12}`.padStart(2,"0"),m:()=>String(d),mm:()=>`${d}`.padStart(2,"0"),s:()=>String(g),ss:()=>`${g}`.padStart(2,"0"),SSS:()=>`${h}`.padStart(3,"0"),d:()=>f,dd:()=>t.toLocaleDateString(n.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(n.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(n.locales,{weekday:"long"}),A:()=>y(i,d),AA:()=>y(i,d,!1,!0),a:()=>y(i,d,!0),aa:()=>y(i,d,!0,!0)};return e.replace(we,(m,p)=>{var v,T;return(T=p??((v=w[m])==null?void 0:v.call(w)))!=null?T:m})}function it(t){if(t===null)return new Date(Number.NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(me);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)}function ve(t,e="HH:mm:ss",n={}){return c.computed(()=>at(it(s(t)),s(e),n))}function lt(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:o=!1}=n;let a=null;const l=c.ref(!1);function i(){a&&(clearInterval(a),a=null)}function d(){l.value=!1,i()}function g(){const h=s(e);h<=0||(l.value=!0,o&&t(),i(),a=setInterval(t,h))}if(r&&k&&g(),c.isRef(e)||typeof e=="function"){const h=c.watch(e,()=>{l.value&&k&&g()});F(h)}return F(d),{isActive:l,pause:d,resume:g}}function be(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:o}=e,a=c.ref(0),l=()=>a.value+=1,i=()=>{a.value=0},d=lt(o?()=>{l(),o(a.value)}:l,t,{immediate:r});return n?{counter:a,reset:i,...d}:a}function Ae(t,e={}){var n;const r=c.ref((n=e.initialValue)!=null?n:null);return c.watch(t,()=>r.value=D(),e),r}function st(t,e,n={}){const{immediate:r=!0}=n,o=c.ref(!1);let a=null;function l(){a&&(clearTimeout(a),a=null)}function i(){o.value=!1,l()}function d(...g){l(),o.value=!0,a=setTimeout(()=>{o.value=!1,a=null,t(...g)},s(e))}return r&&(o.value=!0,k&&d()),F(i),{isPending:c.readonly(o),start:d,stop:i}}function Oe(t=1e3,e={}){const{controls:n=!1,callback:r}=e,o=st(r??C,t,e),a=c.computed(()=>!o.isPending.value);return n?{ready:a,...o}:a}function Se(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:o}=e;return c.computed(()=>{let a=s(t);return typeof a=="string"&&(a=Number[n](a,r)),o&&Number.isNaN(a)&&(a=0),a})}function Te(t){return c.computed(()=>`${s(t)}`)}function Fe(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,o=c.isRef(t),a=c.ref(t);function l(i){if(arguments.length)return a.value=i,a.value;{const d=s(n);return a.value=a.value===d?s(r):d,a.value}}return o?l:[a,l]}function Ie(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:s(t)];return c.watch(t,(o,a,l)=>{const i=Array.from({length:r.length}),d=[];for(const h of o){let f=!1;for(let y=0;y<r.length;y++)if(!i[y]&&h===r[y]){i[y]=!0,f=!0;break}f||d.push(h)}const g=r.filter((h,f)=>!i[f]);e(o,r,d,g,l),r=[...o]},n)}function Pe(t,e,n){const{count:r,...o}=n,a=c.ref(0),l=j(t,(...i)=>{a.value+=1,a.value>=s(r)&&c.nextTick(()=>l()),e(...i)},o);return{count:a,stop:l}}function ft(t,e,n={}){const{debounce:r=0,maxWait:o=void 0,...a}=n;return j(t,e,{...a,eventFilter:Y(r,{maxWait:o})})}function Re(t,e,n){return c.watch(t,e,{...n,deep:!0})}function K(t,e,n={}){const{eventFilter:r=W,...o}=n,a=N(r,e);let l,i,d;if(o.flush==="sync"){const g=c.ref(!1);i=()=>{},l=h=>{g.value=!0,h(),g.value=!1},d=c.watch(t,(...h)=>{g.value||a(...h)},o)}else{const g=[],h=c.ref(0),f=c.ref(0);i=()=>{h.value=f.value},g.push(c.watch(t,()=>{f.value++},{...o,flush:"sync"})),l=y=>{const w=f.value;y(),h.value+=f.value-w},g.push(c.watch(t,(...y)=>{const w=h.value>0&&h.value===f.value;h.value=0,f.value=0,!w&&a(...y)},o)),d=()=>{g.forEach(y=>y())}}return{stop:d,ignoreUpdates:l,ignorePrevAsyncUpdates:i}}function Ce(t,e,n){return c.watch(t,e,{...n,immediate:!0})}function Me(t,e,n){const r=c.watch(t,(...o)=>(c.nextTick(()=>r()),e(...o)),n)}function dt(t,e,n={}){const{throttle:r=0,trailing:o=!0,leading:a=!0,...l}=n;return j(t,e,{...l,eventFilter:G(r,o,a)})}function Ee(t,e,n={}){let r;function o(){if(!r)return;const h=r;r=void 0,h()}function a(h){r=h}const l=(h,f)=>(o(),e(h,f,a)),i=K(t,l,n),{ignoreUpdates:d}=i;return{...i,trigger:()=>{let h;return d(()=>{h=l(_e(t),ke(t))}),h}}}function _e(t){return c.isReactive(t)?t:Array.isArray(t)?t.map(e=>s(e)):s(t)}function ke(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Ne(t,e,n){return c.watch(t,(r,o,a)=>{r&&e(r,o,a)},n)}u.assert=vt,u.autoResetRef=rt,u.bypassFilter=W,u.camelize=Et,u.clamp=Ot,u.computedEager=M,u.computedWithControl=A,u.containsProp=nt,u.controlledComputed=A,u.controlledRef=Yt,u.createEventHook=b,u.createFilterWrapper=N,u.createGlobalState=O,u.createInjectionState=I,u.createReactiveFn=$,u.createSharedComposable=S,u.createSingletonPromise=kt,u.debounceFilter=Y,u.debouncedRef=Z,u.debouncedWatch=ft,u.directiveHooks=Pt,u.eagerComputed=M,u.extendRef=_,u.formatDate=at,u.get=U,u.hasOwn=Tt,u.hyphenate=Ct,u.identity=_t,u.ignorableWatch=K,u.increaseWithUnit=jt,u.invoke=Nt,u.isClient=k,u.isDef=wt,u.isDefined=P,u.isIOS=Ft,u.isObject=x,u.makeDestructurable=R,u.noop=C,u.normalizeDate=it,u.notNullish=pt,u.now=At,u.objectEntries=Lt,u.objectOmit=Wt,u.objectPick=Ut,u.pausableFilter=tt,u.pausableWatch=L,u.promiseTimeout=z,u.rand=St,u.reactify=$,u.reactifyObject=gt,u.reactiveComputed=H,u.reactiveOmit=mt,u.reactivePick=$t,u.refAutoReset=rt,u.refDebounced=Z,u.refDefault=Ht,u.refThrottled=J,u.refWithControl=ct,u.resolveRef=Bt,u.resolveUnref=yt,u.set=Gt,u.syncRef=zt,u.syncRefs=qt,u.throttleFilter=G,u.throttledRef=J,u.throttledWatch=dt,u.timestamp=D,u.toReactive=V,u.toRef=q,u.toRefs=Zt,u.toValue=s,u.tryOnBeforeMount=Jt,u.tryOnBeforeUnmount=Xt,u.tryOnMounted=Kt,u.tryOnScopeDispose=F,u.tryOnUnmounted=Qt,u.until=Vt,u.useArrayDifference=Dt,u.useArrayEvery=te,u.useArrayFilter=ee,u.useArrayFind=ne,u.useArrayFindIndex=re,u.useArrayFindLast=ue,u.useArrayIncludes=ae,u.useArrayJoin=ie,u.useArrayMap=le,u.useArrayReduce=se,u.useArraySome=fe,u.useArrayUnique=ye,u.useCounter=ge,u.useDateFormat=ve,u.useDebounce=Z,u.useDebounceFn=ot,u.useInterval=be,u.useIntervalFn=lt,u.useLastChanged=Ae,u.useThrottle=J,u.useThrottleFn=ut,u.useTimeout=Oe,u.useTimeoutFn=st,u.useToNumber=Se,u.useToString=Te,u.useToggle=Fe,u.watchArray=Ie,u.watchAtMost=Pe,u.watchDebounced=ft,u.watchDeep=Re,u.watchIgnorable=K,u.watchImmediate=Ce,u.watchOnce=Me,u.watchPausable=L,u.watchThrottled=dt,u.watchTriggerable=Ee,u.watchWithFilter=j,u.whenever=Ne})(this.VueUse=this.VueUse||{},VueDemi);
package/index.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, provide, inject, isVue3, version, isRef, unref, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue-demi';
2
2
 
3
3
  function computedEager(fn, options) {
4
+ var _a;
4
5
  const result = shallowRef();
5
6
  watchEffect(() => {
6
7
  result.value = fn();
7
8
  }, {
8
9
  ...options,
9
- flush: options?.flush ?? "sync"
10
+ flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
10
11
  });
11
12
  return readonly(result);
12
13
  }
@@ -36,7 +37,7 @@ function computedWithControl(source, fn) {
36
37
  return v;
37
38
  },
38
39
  set(v2) {
39
- set?.(v2);
40
+ set == null ? void 0 : set(v2);
40
41
  }
41
42
  };
42
43
  });
@@ -186,7 +187,7 @@ function toValue(r) {
186
187
  const resolveUnref = toValue;
187
188
 
188
189
  function reactify(fn, options) {
189
- const unrefFn = options?.computedGetter === false ? unref : toValue;
190
+ const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : toValue;
190
191
  return function(...args) {
191
192
  return computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
192
193
  };
@@ -282,7 +283,8 @@ const rand = (min, max) => {
282
283
  const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
283
284
  const isIOS = /* @__PURE__ */ getIsIOS();
284
285
  function getIsIOS() {
285
- return isClient && window?.navigator?.userAgent && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
286
+ var _a;
287
+ return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
286
288
  }
287
289
 
288
290
  function createFilterWrapper(filter, fn) {
@@ -453,9 +455,10 @@ function containsProp(obj, ...props) {
453
455
  return props.some((k) => k in obj);
454
456
  }
455
457
  function increaseWithUnit(target, delta) {
458
+ var _a;
456
459
  if (typeof target === "number")
457
460
  return target + delta;
458
- const value = target.match(/^-?[0-9]+\.?[0-9]*/)?.[0] || "";
461
+ const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
459
462
  const unit = target.slice(value.length);
460
463
  const result = Number.parseFloat(value) + delta;
461
464
  if (Number.isNaN(result))
@@ -539,7 +542,8 @@ function refDebounced(value, ms = 200, options = {}) {
539
542
  function refDefault(source, defaultValue) {
540
543
  return computed({
541
544
  get() {
542
- return source.value ?? defaultValue;
545
+ var _a;
546
+ return (_a = source.value) != null ? _a : defaultValue;
543
547
  },
544
548
  set(value) {
545
549
  source.value = value;
@@ -587,13 +591,14 @@ function refWithControl(initial, options = {}) {
587
591
  return source;
588
592
  }
589
593
  function set(value, triggering = true) {
594
+ var _a, _b;
590
595
  if (value === source)
591
596
  return;
592
597
  const old = source;
593
- if (options.onBeforeChange?.(value, old) === false)
598
+ if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)
594
599
  return;
595
600
  source = value;
596
- options.onChanged?.(value, old);
601
+ (_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);
597
602
  if (triggering)
598
603
  trigger();
599
604
  }
@@ -664,6 +669,7 @@ function watchPausable(source, cb, options = {}) {
664
669
  }
665
670
 
666
671
  function syncRef(left, right, options = {}) {
672
+ var _a, _b;
667
673
  const {
668
674
  flush = "sync",
669
675
  deep = false,
@@ -672,8 +678,8 @@ function syncRef(left, right, options = {}) {
672
678
  transform = {}
673
679
  } = options;
674
680
  const watchers = [];
675
- const transformLTR = transform.ltr ?? ((v) => v);
676
- const transformRTL = transform.rtl ?? ((v) => v);
681
+ const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
682
+ const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
677
683
  if (direction === "both" || direction === "ltr") {
678
684
  watchers.push(watchPausable(
679
685
  left,
@@ -727,7 +733,8 @@ function toRefs(objectRef, options = {}) {
727
733
  return objectRef.value[key];
728
734
  },
729
735
  set(v) {
730
- const replaceRef = toValue(options.replaceRef) ?? true;
736
+ var _a;
737
+ const replaceRef = (_a = toValue(options.replaceRef)) != null ? _a : true;
731
738
  if (replaceRef) {
732
739
  if (Array.isArray(objectRef.value)) {
733
740
  const copy = [...objectRef.value];
@@ -783,7 +790,7 @@ function createUntil(r, isNot = false) {
783
790
  r,
784
791
  (v) => {
785
792
  if (condition(v) !== isNot) {
786
- stop?.();
793
+ stop == null ? void 0 : stop();
787
794
  resolve(v);
788
795
  }
789
796
  },
@@ -797,7 +804,7 @@ function createUntil(r, isNot = false) {
797
804
  const promises = [watcher];
798
805
  if (timeout != null) {
799
806
  promises.push(
800
- promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop?.())
807
+ promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop == null ? void 0 : stop())
801
808
  );
802
809
  }
803
810
  return Promise.race(promises);
@@ -805,14 +812,14 @@ function createUntil(r, isNot = false) {
805
812
  function toBe(value, options) {
806
813
  if (!isRef(value))
807
814
  return toMatch((v) => v === value, options);
808
- const { flush = "sync", deep = false, timeout, throwOnTimeout } = options ?? {};
815
+ const { flush = "sync", deep = false, timeout, throwOnTimeout } = options != null ? options : {};
809
816
  let stop = null;
810
817
  const watcher = new Promise((resolve) => {
811
818
  stop = watch(
812
819
  [r, value],
813
820
  ([v1, v2]) => {
814
821
  if (isNot !== (v1 === v2)) {
815
- stop?.();
822
+ stop == null ? void 0 : stop();
816
823
  resolve(v1);
817
824
  }
818
825
  },
@@ -827,7 +834,7 @@ function createUntil(r, isNot = false) {
827
834
  if (timeout != null) {
828
835
  promises.push(
829
836
  promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
830
- stop?.();
837
+ stop == null ? void 0 : stop();
831
838
  return toValue(r);
832
839
  })
833
840
  );
@@ -898,9 +905,10 @@ function defaultComparator(value, othVal) {
898
905
  return value === othVal;
899
906
  }
900
907
  function useArrayDifference(...args) {
908
+ var _a;
901
909
  const list = args[0];
902
910
  const values = args[1];
903
- let compareFn = args[2] ?? defaultComparator;
911
+ let compareFn = (_a = args[2]) != null ? _a : defaultComparator;
904
912
  if (typeof compareFn === "string") {
905
913
  const key = compareFn;
906
914
  compareFn = (value, othVal) => value[key] === othVal[key];
@@ -948,19 +956,20 @@ function isArrayIncludesOptions(obj) {
948
956
  return isObject(obj) && containsProp(obj, "formIndex", "comparator");
949
957
  }
950
958
  function useArrayIncludes(...args) {
959
+ var _a;
951
960
  const list = args[0];
952
961
  const value = args[1];
953
962
  let comparator = args[2];
954
963
  let formIndex = 0;
955
964
  if (isArrayIncludesOptions(comparator)) {
956
- formIndex = comparator.fromIndex ?? 0;
965
+ formIndex = (_a = comparator.fromIndex) != null ? _a : 0;
957
966
  comparator = comparator.comparator;
958
967
  }
959
968
  if (typeof comparator === "string") {
960
969
  const key = comparator;
961
970
  comparator = (element, value2) => element[key] === toValue(value2);
962
971
  }
963
- comparator = comparator ?? ((element, value2) => element === toValue(value2));
972
+ comparator = comparator != null ? comparator : (element, value2) => element === toValue(value2);
964
973
  return computed(
965
974
  () => toValue(list).slice(formIndex).some(
966
975
  (element, index, array) => comparator(toValue(element), toValue(value), index, toValue(array))
@@ -1032,6 +1041,7 @@ function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
1032
1041
  return isLowercase ? m.toLowerCase() : m;
1033
1042
  }
1034
1043
  function formatDate(date, formatStr, options = {}) {
1044
+ var _a;
1035
1045
  const years = date.getFullYear();
1036
1046
  const month = date.getMonth();
1037
1047
  const days = date.getDate();
@@ -1040,7 +1050,7 @@ function formatDate(date, formatStr, options = {}) {
1040
1050
  const seconds = date.getSeconds();
1041
1051
  const milliseconds = date.getMilliseconds();
1042
1052
  const day = date.getDay();
1043
- const meridiem = options.customMeridiem ?? defaultMeridiem;
1053
+ const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
1044
1054
  const matches = {
1045
1055
  YY: () => String(years).slice(-2),
1046
1056
  YYYY: () => years,
@@ -1068,7 +1078,10 @@ function formatDate(date, formatStr, options = {}) {
1068
1078
  a: () => meridiem(hours, minutes, true),
1069
1079
  aa: () => meridiem(hours, minutes, true, true)
1070
1080
  };
1071
- return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 ?? matches[match]?.() ?? match);
1081
+ return formatStr.replace(REGEX_FORMAT, (match, $1) => {
1082
+ var _a2, _b;
1083
+ return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? void 0 : _a2.call(matches)) != null ? _b : match;
1084
+ });
1072
1085
  }
1073
1086
  function normalizeDate(date) {
1074
1087
  if (date === null)
@@ -1166,7 +1179,8 @@ function useInterval(interval = 1e3, options = {}) {
1166
1179
  }
1167
1180
 
1168
1181
  function useLastChanged(source, options = {}) {
1169
- const ms = ref(options.initialValue ?? null);
1182
+ var _a;
1183
+ const ms = ref((_a = options.initialValue) != null ? _a : null);
1170
1184
  watch(
1171
1185
  source,
1172
1186
  () => ms.value = timestamp(),
@@ -1219,7 +1233,7 @@ function useTimeout(interval = 1e3, options = {}) {
1219
1233
  callback
1220
1234
  } = options;
1221
1235
  const controls = useTimeoutFn(
1222
- callback ?? noop,
1236
+ callback != null ? callback : noop,
1223
1237
  interval,
1224
1238
  options
1225
1239
  );
@@ -1278,7 +1292,7 @@ function useToggle(initialValue = false, options = {}) {
1278
1292
  }
1279
1293
 
1280
1294
  function watchArray(source, cb, options) {
1281
- let oldList = options?.immediate ? [] : [
1295
+ let oldList = (options == null ? void 0 : options.immediate) ? [] : [
1282
1296
  ...source instanceof Function ? source() : Array.isArray(source) ? source : toValue(source)
1283
1297
  ];
1284
1298
  return watch(source, (newList, _, onCleanup) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/shared",
3
- "version": "10.4.0",
3
+ "version": "10.4.1",
4
4
  "author": "Anthony Fu <https://github.com/antfu>",
5
5
  "license": "MIT",
6
6
  "funding": "https://github.com/sponsors/antfu",