@vueuse/shared 10.5.0 → 10.6.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
@@ -70,7 +70,7 @@ function createEventHook() {
70
70
  };
71
71
  };
72
72
  const trigger = (param) => {
73
- return Promise.all(Array.from(fns).map((fn) => fn(param)));
73
+ return Promise.all(Array.from(fns).map((fn) => param ? fn(param) : fn()));
74
74
  };
75
75
  return {
76
76
  on,
@@ -287,6 +287,7 @@ function reactiveOmit(obj, ...keys) {
287
287
  }
288
288
 
289
289
  const isClient = typeof window !== "undefined" && typeof document !== "undefined";
290
+ const isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
290
291
  const isDef = (val) => typeof val !== "undefined";
291
292
  const notNullish = (val) => val != null;
292
293
  const assert = (condition, ...infos) => {
@@ -691,18 +692,17 @@ function watchPausable(source, cb, options = {}) {
691
692
  return { stop, pause, resume, isActive };
692
693
  }
693
694
 
694
- function syncRef(left, right, options = {}) {
695
- var _a, _b;
695
+ function syncRef(left, right, ...[options]) {
696
696
  const {
697
697
  flush = "sync",
698
698
  deep = false,
699
699
  immediate = true,
700
700
  direction = "both",
701
701
  transform = {}
702
- } = options;
702
+ } = options || {};
703
703
  const watchers = [];
704
- const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
705
- const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
704
+ const transformLTR = "ltr" in transform && transform.ltr || ((v) => v);
705
+ const transformRTL = "rtl" in transform && transform.rtl || ((v) => v);
706
706
  if (direction === "both" || direction === "ltr") {
707
707
  watchers.push(watchPausable(
708
708
  left,
@@ -1053,13 +1053,18 @@ function useCounter(initialValue = 0, options = {}) {
1053
1053
  }
1054
1054
 
1055
1055
  const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
1056
- 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;
1056
+ const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
1057
1057
  function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
1058
1058
  let m = hours < 12 ? "AM" : "PM";
1059
1059
  if (hasPeriod)
1060
1060
  m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
1061
1061
  return isLowercase ? m.toLowerCase() : m;
1062
1062
  }
1063
+ function formatOrdinal(num) {
1064
+ const suffixes = ["th", "st", "nd", "rd"];
1065
+ const v = num % 100;
1066
+ return num + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);
1067
+ }
1063
1068
  function formatDate(date, formatStr, options = {}) {
1064
1069
  var _a;
1065
1070
  const years = date.getFullYear();
@@ -1072,21 +1077,28 @@ function formatDate(date, formatStr, options = {}) {
1072
1077
  const day = date.getDay();
1073
1078
  const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
1074
1079
  const matches = {
1080
+ Yo: () => formatOrdinal(years),
1075
1081
  YY: () => String(years).slice(-2),
1076
1082
  YYYY: () => years,
1077
1083
  M: () => month + 1,
1084
+ Mo: () => formatOrdinal(month + 1),
1078
1085
  MM: () => `${month + 1}`.padStart(2, "0"),
1079
1086
  MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
1080
1087
  MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
1081
1088
  D: () => String(days),
1089
+ Do: () => formatOrdinal(days),
1082
1090
  DD: () => `${days}`.padStart(2, "0"),
1083
1091
  H: () => String(hours),
1092
+ Ho: () => formatOrdinal(hours),
1084
1093
  HH: () => `${hours}`.padStart(2, "0"),
1085
1094
  h: () => `${hours % 12 || 12}`.padStart(1, "0"),
1095
+ ho: () => formatOrdinal(hours % 12 || 12),
1086
1096
  hh: () => `${hours % 12 || 12}`.padStart(2, "0"),
1087
1097
  m: () => String(minutes),
1098
+ mo: () => formatOrdinal(minutes),
1088
1099
  mm: () => `${minutes}`.padStart(2, "0"),
1089
1100
  s: () => String(seconds),
1101
+ so: () => formatOrdinal(seconds),
1090
1102
  ss: () => `${seconds}`.padStart(2, "0"),
1091
1103
  SSS: () => `${milliseconds}`.padStart(3, "0"),
1092
1104
  d: () => day,
@@ -1467,6 +1479,7 @@ function watchOnce(source, cb, options) {
1467
1479
  vueDemi.nextTick(() => stop());
1468
1480
  return cb(...args);
1469
1481
  }, options);
1482
+ return stop;
1470
1483
  }
1471
1484
 
1472
1485
  function watchThrottled(source, cb, options = {}) {
@@ -1575,6 +1588,7 @@ exports.isDef = isDef;
1575
1588
  exports.isDefined = isDefined;
1576
1589
  exports.isIOS = isIOS;
1577
1590
  exports.isObject = isObject;
1591
+ exports.isWorker = isWorker;
1578
1592
  exports.makeDestructurable = makeDestructurable;
1579
1593
  exports.noop = noop;
1580
1594
  exports.normalizeDate = normalizeDate;
package/index.d.cts CHANGED
@@ -16,11 +16,12 @@ interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, Comp
16
16
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
17
17
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
18
18
 
19
- type EventHookOn<T = any> = (fn: (param: T) => void) => {
19
+ type Callback<T> = T extends void ? () => void : (param: T) => void;
20
+ type EventHookOn<T = any> = (fn: Callback<T>) => {
20
21
  off: () => void;
21
22
  };
22
- type EventHookOff<T = any> = (fn: (param: T) => void) => void;
23
- type EventHookTrigger<T = any> = (param: T) => Promise<unknown[]>;
23
+ type EventHookOff<T = any> = (fn: Callback<T>) => void;
24
+ type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
24
25
  interface EventHook<T = any> {
25
26
  on: EventHookOn<T>;
26
27
  off: EventHookOff<T>;
@@ -34,6 +35,7 @@ interface EventHook<T = any> {
34
35
  declare function createEventHook<T = any>(): EventHook<T>;
35
36
 
36
37
  declare const isClient: boolean;
38
+ declare const isWorker: boolean;
37
39
  declare const isDef: <T = any>(val?: T | undefined) => val is T;
38
40
  declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
39
41
  declare const assert: (condition: boolean, ...infos: any[]) => void;
@@ -479,7 +481,47 @@ declare const controlledRef: typeof refWithControl;
479
481
  declare function set<T>(ref: Ref<T>, value: T): void;
480
482
  declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
481
483
 
482
- interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
484
+ type Direction = 'ltr' | 'rtl' | 'both';
485
+ type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
486
+ /**
487
+ * A = B
488
+ */
489
+ type Equal<A, B> = A extends B ? (B extends A ? true : false) : false;
490
+ /**
491
+ * A ∩ B ≠ ∅
492
+ */
493
+ type IntersectButNotEqual<A, B> = Equal<A, B> extends true ? false : A & B extends never ? false : true;
494
+ /**
495
+ * A ⊆ B
496
+ */
497
+ type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ? true : false;
498
+ /**
499
+ * A ∩ B = ∅
500
+ */
501
+ type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
502
+ interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = D extends 'both' ? 'ltr' | 'rtl' : D> {
503
+ transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
504
+ }
505
+ type StrictIncludeMap<IncludeType extends 'LR' | 'RL', D extends Exclude<Direction, 'both'>, L, R> = (Equal<[IncludeType, D], ['LR', 'ltr']> & Equal<[IncludeType, D], ['RL', 'rtl']>) extends true ? {
506
+ transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
507
+ } : {
508
+ transform: Pick<Transform<L, R>, D>;
509
+ };
510
+ type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
511
+ transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
512
+ } : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
513
+ type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
514
+ transform: Transform<L, R>;
515
+ } : D extends Exclude<Direction, 'both'> ? {
516
+ transform: Pick<Transform<L, R>, D>;
517
+ } : never;
518
+ type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
519
+ interface Transform<L, R> {
520
+ ltr: (left: L) => R;
521
+ rtl: (right: R) => L;
522
+ }
523
+ type TransformType<D extends Direction, L, R> = Equal<L, R> extends true ? EqualType<D, L, R> : IncludeButNotEqual<L, R> extends true ? StrictIncludeType<'LR', D, L, R> : IncludeButNotEqual<R, L> extends true ? StrictIncludeType<'RL', D, L, R> : IntersectButNotEqual<L, R> extends true ? IntersectButNotEqualType<D, L, R> : NotIntersect<L, R> extends true ? NotIntersectType<D, L, R> : never;
524
+ type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
483
525
  /**
484
526
  * Watch deeply
485
527
  *
@@ -497,22 +539,18 @@ interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
497
539
  *
498
540
  * @default 'both'
499
541
  */
500
- direction?: 'ltr' | 'rtl' | 'both';
501
- /**
502
- * Custom transform function
503
- */
504
- transform?: {
505
- ltr?: (left: L) => R;
506
- rtl?: (right: R) => L;
507
- };
508
- }
542
+ direction?: D;
543
+ } & TransformType<D, L, R>;
509
544
  /**
510
545
  * Two-way refs synchronization.
511
- *
512
- * @param left
513
- * @param right
546
+ * From the set theory perspective to restrict the option's type
547
+ * Check in the following order:
548
+ * 1. L = R
549
+ * 2. L ∩ R ≠ ∅
550
+ * 3. L ⊆ R
551
+ * 4. L ∩ R = ∅
514
552
  */
515
- declare function syncRef<L, R = L>(left: Ref<L>, right: Ref<R>, options?: SyncRefOptions<L, R>): () => void;
553
+ declare function syncRef<L, R, D extends Direction>(left: Ref<L>, right: Ref<R>, ...[options]: Equal<L, R> extends true ? [options?: SyncRefOptions<L, R, D>] : [options: SyncRefOptions<L, R, D>]): () => void;
516
554
 
517
555
  interface SyncRefsOptions extends ConfigurableFlushSync {
518
556
  /**
@@ -1092,8 +1130,8 @@ declare function watchImmediate<T extends Readonly<MultiWatchSources>>(source: T
1092
1130
  declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
1093
1131
  declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
1094
1132
 
1095
- declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): void;
1096
- declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): void;
1133
+ declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
1134
+ declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
1097
1135
 
1098
1136
  interface WatchPausableReturn extends Pausable {
1099
1137
  stop: WatchStopHandle;
@@ -1128,4 +1166,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
1128
1166
  */
1129
1167
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
1130
1168
 
1131
- export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1169
+ export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/index.d.mts CHANGED
@@ -16,11 +16,12 @@ interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, Comp
16
16
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
17
17
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
18
18
 
19
- type EventHookOn<T = any> = (fn: (param: T) => void) => {
19
+ type Callback<T> = T extends void ? () => void : (param: T) => void;
20
+ type EventHookOn<T = any> = (fn: Callback<T>) => {
20
21
  off: () => void;
21
22
  };
22
- type EventHookOff<T = any> = (fn: (param: T) => void) => void;
23
- type EventHookTrigger<T = any> = (param: T) => Promise<unknown[]>;
23
+ type EventHookOff<T = any> = (fn: Callback<T>) => void;
24
+ type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
24
25
  interface EventHook<T = any> {
25
26
  on: EventHookOn<T>;
26
27
  off: EventHookOff<T>;
@@ -34,6 +35,7 @@ interface EventHook<T = any> {
34
35
  declare function createEventHook<T = any>(): EventHook<T>;
35
36
 
36
37
  declare const isClient: boolean;
38
+ declare const isWorker: boolean;
37
39
  declare const isDef: <T = any>(val?: T | undefined) => val is T;
38
40
  declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
39
41
  declare const assert: (condition: boolean, ...infos: any[]) => void;
@@ -479,7 +481,47 @@ declare const controlledRef: typeof refWithControl;
479
481
  declare function set<T>(ref: Ref<T>, value: T): void;
480
482
  declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
481
483
 
482
- interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
484
+ type Direction = 'ltr' | 'rtl' | 'both';
485
+ type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
486
+ /**
487
+ * A = B
488
+ */
489
+ type Equal<A, B> = A extends B ? (B extends A ? true : false) : false;
490
+ /**
491
+ * A ∩ B ≠ ∅
492
+ */
493
+ type IntersectButNotEqual<A, B> = Equal<A, B> extends true ? false : A & B extends never ? false : true;
494
+ /**
495
+ * A ⊆ B
496
+ */
497
+ type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ? true : false;
498
+ /**
499
+ * A ∩ B = ∅
500
+ */
501
+ type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
502
+ interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = D extends 'both' ? 'ltr' | 'rtl' : D> {
503
+ transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
504
+ }
505
+ type StrictIncludeMap<IncludeType extends 'LR' | 'RL', D extends Exclude<Direction, 'both'>, L, R> = (Equal<[IncludeType, D], ['LR', 'ltr']> & Equal<[IncludeType, D], ['RL', 'rtl']>) extends true ? {
506
+ transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
507
+ } : {
508
+ transform: Pick<Transform<L, R>, D>;
509
+ };
510
+ type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
511
+ transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
512
+ } : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
513
+ type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
514
+ transform: Transform<L, R>;
515
+ } : D extends Exclude<Direction, 'both'> ? {
516
+ transform: Pick<Transform<L, R>, D>;
517
+ } : never;
518
+ type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
519
+ interface Transform<L, R> {
520
+ ltr: (left: L) => R;
521
+ rtl: (right: R) => L;
522
+ }
523
+ type TransformType<D extends Direction, L, R> = Equal<L, R> extends true ? EqualType<D, L, R> : IncludeButNotEqual<L, R> extends true ? StrictIncludeType<'LR', D, L, R> : IncludeButNotEqual<R, L> extends true ? StrictIncludeType<'RL', D, L, R> : IntersectButNotEqual<L, R> extends true ? IntersectButNotEqualType<D, L, R> : NotIntersect<L, R> extends true ? NotIntersectType<D, L, R> : never;
524
+ type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
483
525
  /**
484
526
  * Watch deeply
485
527
  *
@@ -497,22 +539,18 @@ interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
497
539
  *
498
540
  * @default 'both'
499
541
  */
500
- direction?: 'ltr' | 'rtl' | 'both';
501
- /**
502
- * Custom transform function
503
- */
504
- transform?: {
505
- ltr?: (left: L) => R;
506
- rtl?: (right: R) => L;
507
- };
508
- }
542
+ direction?: D;
543
+ } & TransformType<D, L, R>;
509
544
  /**
510
545
  * Two-way refs synchronization.
511
- *
512
- * @param left
513
- * @param right
546
+ * From the set theory perspective to restrict the option's type
547
+ * Check in the following order:
548
+ * 1. L = R
549
+ * 2. L ∩ R ≠ ∅
550
+ * 3. L ⊆ R
551
+ * 4. L ∩ R = ∅
514
552
  */
515
- declare function syncRef<L, R = L>(left: Ref<L>, right: Ref<R>, options?: SyncRefOptions<L, R>): () => void;
553
+ declare function syncRef<L, R, D extends Direction>(left: Ref<L>, right: Ref<R>, ...[options]: Equal<L, R> extends true ? [options?: SyncRefOptions<L, R, D>] : [options: SyncRefOptions<L, R, D>]): () => void;
516
554
 
517
555
  interface SyncRefsOptions extends ConfigurableFlushSync {
518
556
  /**
@@ -1092,8 +1130,8 @@ declare function watchImmediate<T extends Readonly<MultiWatchSources>>(source: T
1092
1130
  declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
1093
1131
  declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
1094
1132
 
1095
- declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): void;
1096
- declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): void;
1133
+ declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
1134
+ declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
1097
1135
 
1098
1136
  interface WatchPausableReturn extends Pausable {
1099
1137
  stop: WatchStopHandle;
@@ -1128,4 +1166,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
1128
1166
  */
1129
1167
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
1130
1168
 
1131
- export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1169
+ export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/index.d.ts CHANGED
@@ -16,11 +16,12 @@ interface WritableComputedRefWithControl<T> extends WritableComputedRef<T>, Comp
16
16
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: ComputedGetter<T>): ComputedRefWithControl<T>;
17
17
  declare function computedWithControl<T, S>(source: WatchSource<S> | WatchSource<S>[], fn: WritableComputedOptions<T>): WritableComputedRefWithControl<T>;
18
18
 
19
- type EventHookOn<T = any> = (fn: (param: T) => void) => {
19
+ type Callback<T> = T extends void ? () => void : (param: T) => void;
20
+ type EventHookOn<T = any> = (fn: Callback<T>) => {
20
21
  off: () => void;
21
22
  };
22
- type EventHookOff<T = any> = (fn: (param: T) => void) => void;
23
- type EventHookTrigger<T = any> = (param: T) => Promise<unknown[]>;
23
+ type EventHookOff<T = any> = (fn: Callback<T>) => void;
24
+ type EventHookTrigger<T = any> = (param?: T) => Promise<unknown[]>;
24
25
  interface EventHook<T = any> {
25
26
  on: EventHookOn<T>;
26
27
  off: EventHookOff<T>;
@@ -34,6 +35,7 @@ interface EventHook<T = any> {
34
35
  declare function createEventHook<T = any>(): EventHook<T>;
35
36
 
36
37
  declare const isClient: boolean;
38
+ declare const isWorker: boolean;
37
39
  declare const isDef: <T = any>(val?: T | undefined) => val is T;
38
40
  declare const notNullish: <T = any>(val?: T | null | undefined) => val is T;
39
41
  declare const assert: (condition: boolean, ...infos: any[]) => void;
@@ -479,7 +481,47 @@ declare const controlledRef: typeof refWithControl;
479
481
  declare function set<T>(ref: Ref<T>, value: T): void;
480
482
  declare function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void;
481
483
 
482
- interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
484
+ type Direction = 'ltr' | 'rtl' | 'both';
485
+ type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
486
+ /**
487
+ * A = B
488
+ */
489
+ type Equal<A, B> = A extends B ? (B extends A ? true : false) : false;
490
+ /**
491
+ * A ∩ B ≠ ∅
492
+ */
493
+ type IntersectButNotEqual<A, B> = Equal<A, B> extends true ? false : A & B extends never ? false : true;
494
+ /**
495
+ * A ⊆ B
496
+ */
497
+ type IncludeButNotEqual<A, B> = Equal<A, B> extends true ? false : A extends B ? true : false;
498
+ /**
499
+ * A ∩ B = ∅
500
+ */
501
+ type NotIntersect<A, B> = Equal<A, B> extends true ? false : A & B extends never ? true : false;
502
+ interface EqualType<D extends Direction, L, R, O extends keyof Transform<L, R> = D extends 'both' ? 'ltr' | 'rtl' : D> {
503
+ transform?: SpecificFieldPartial<Pick<Transform<L, R>, O>, O>;
504
+ }
505
+ type StrictIncludeMap<IncludeType extends 'LR' | 'RL', D extends Exclude<Direction, 'both'>, L, R> = (Equal<[IncludeType, D], ['LR', 'ltr']> & Equal<[IncludeType, D], ['RL', 'rtl']>) extends true ? {
506
+ transform?: SpecificFieldPartial<Pick<Transform<L, R>, D>, D>;
507
+ } : {
508
+ transform: Pick<Transform<L, R>, D>;
509
+ };
510
+ type StrictIncludeType<IncludeType extends 'LR' | 'RL', D extends Direction, L, R> = D extends 'both' ? {
511
+ transform: SpecificFieldPartial<Transform<L, R>, IncludeType extends 'LR' ? 'ltr' : 'rtl'>;
512
+ } : D extends Exclude<Direction, 'both'> ? StrictIncludeMap<IncludeType, D, L, R> : never;
513
+ type IntersectButNotEqualType<D extends Direction, L, R> = D extends 'both' ? {
514
+ transform: Transform<L, R>;
515
+ } : D extends Exclude<Direction, 'both'> ? {
516
+ transform: Pick<Transform<L, R>, D>;
517
+ } : never;
518
+ type NotIntersectType<D extends Direction, L, R> = IntersectButNotEqualType<D, L, R>;
519
+ interface Transform<L, R> {
520
+ ltr: (left: L) => R;
521
+ rtl: (right: R) => L;
522
+ }
523
+ type TransformType<D extends Direction, L, R> = Equal<L, R> extends true ? EqualType<D, L, R> : IncludeButNotEqual<L, R> extends true ? StrictIncludeType<'LR', D, L, R> : IncludeButNotEqual<R, L> extends true ? StrictIncludeType<'RL', D, L, R> : IntersectButNotEqual<L, R> extends true ? IntersectButNotEqualType<D, L, R> : NotIntersect<L, R> extends true ? NotIntersectType<D, L, R> : never;
524
+ type SyncRefOptions<L, R, D extends Direction> = ConfigurableFlushSync & {
483
525
  /**
484
526
  * Watch deeply
485
527
  *
@@ -497,22 +539,18 @@ interface SyncRefOptions<L, R = L> extends ConfigurableFlushSync {
497
539
  *
498
540
  * @default 'both'
499
541
  */
500
- direction?: 'ltr' | 'rtl' | 'both';
501
- /**
502
- * Custom transform function
503
- */
504
- transform?: {
505
- ltr?: (left: L) => R;
506
- rtl?: (right: R) => L;
507
- };
508
- }
542
+ direction?: D;
543
+ } & TransformType<D, L, R>;
509
544
  /**
510
545
  * Two-way refs synchronization.
511
- *
512
- * @param left
513
- * @param right
546
+ * From the set theory perspective to restrict the option's type
547
+ * Check in the following order:
548
+ * 1. L = R
549
+ * 2. L ∩ R ≠ ∅
550
+ * 3. L ⊆ R
551
+ * 4. L ∩ R = ∅
514
552
  */
515
- declare function syncRef<L, R = L>(left: Ref<L>, right: Ref<R>, options?: SyncRefOptions<L, R>): () => void;
553
+ declare function syncRef<L, R, D extends Direction>(left: Ref<L>, right: Ref<R>, ...[options]: Equal<L, R> extends true ? [options?: SyncRefOptions<L, R, D>] : [options: SyncRefOptions<L, R, D>]): () => void;
516
554
 
517
555
  interface SyncRefsOptions extends ConfigurableFlushSync {
518
556
  /**
@@ -1092,8 +1130,8 @@ declare function watchImmediate<T extends Readonly<MultiWatchSources>>(source: T
1092
1130
  declare function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
1093
1131
  declare function watchImmediate<T extends object>(source: T, cb: WatchCallback<T, T | undefined>, options?: Omit<WatchOptions<true>, 'immediate'>): WatchStopHandle;
1094
1132
 
1095
- declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): void;
1096
- declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): void;
1133
+ declare function watchOnce<T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false>(source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
1134
+ declare function watchOnce<T, Immediate extends Readonly<boolean> = false>(sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
1097
1135
 
1098
1136
  interface WatchPausableReturn extends Pausable {
1099
1137
  stop: WatchStopHandle;
@@ -1128,4 +1166,4 @@ declare function watchTriggerable<T extends object, FnReturnT>(source: T, cb: Wa
1128
1166
  */
1129
1167
  declare function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions): vue_demi.WatchStopHandle;
1130
1168
 
1131
- export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1169
+ export { type AnyFn, type ArgumentsType, type Arrayable, type Awaitable, type Awaited, type ComputedRefWithControl, type ComputedWithControlRefExtra, type ConfigurableEventFilter, type ConfigurableFlush, type ConfigurableFlushSync, type ControlledRefOptions, type CreateInjectionStateOptions, type DateLike, type DebounceFilterOptions, type DeepMaybeRef, type ElementOf, type EventFilter, type EventHook, type EventHookOff, type EventHookOn, type EventHookTrigger, type ExtendRefOptions, type Fn, type FunctionArgs, type FunctionWrapperOptions, type IgnoredUpdater, type MapOldSources, type MapSources, type MaybeRef, type MaybeRefOrGetter, type MultiWatchSources, type Mutable, type Pausable, type Promisify, type PromisifyFn, type Reactified, type ReactifyNested, type ReactifyObjectOptions, type ReactifyOptions, type ReactiveOmitPredicate, type ReactivePickPredicate, type ReadonlyRefOrGetter, type RemovableRef, type ShallowUnwrapRef, type SingletonPromiseReturn, type Stoppable, type SyncRefOptions, type SyncRefsOptions, type ToRefsOptions, type UntilArrayInstance, type UntilBaseInstance, type UntilToMatchOptions, type UntilValueInstance, type UseArrayIncludesComparatorFn, type UseArrayIncludesOptions, type UseArrayReducer, type UseCounterOptions, type UseDateFormatOptions, type UseDateFormatReturn, type UseIntervalControls, type UseIntervalFnOptions, type UseIntervalOptions, type UseLastChangedOptions, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseToNumberOptions, type UseToggleOptions, type WatchArrayCallback, type WatchAtMostOptions, type WatchAtMostReturn, type WatchDebouncedOptions, type WatchIgnorableReturn, type WatchPausableReturn, type WatchThrottledOptions, type WatchTriggerableCallback, type WatchTriggerableReturn, type WatchWithFilterOptions, type WritableComputedRefWithControl, assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/index.iife.js CHANGED
@@ -185,7 +185,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
185
185
  };
186
186
  };
187
187
  const trigger = (param) => {
188
- return Promise.all(Array.from(fns).map((fn) => fn(param)));
188
+ return Promise.all(Array.from(fns).map((fn) => param ? fn(param) : fn()));
189
189
  };
190
190
  return {
191
191
  on,
@@ -402,6 +402,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
402
402
  }
403
403
 
404
404
  const isClient = typeof window !== "undefined" && typeof document !== "undefined";
405
+ const isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
405
406
  const isDef = (val) => typeof val !== "undefined";
406
407
  const notNullish = (val) => val != null;
407
408
  const assert = (condition, ...infos) => {
@@ -806,18 +807,17 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
806
807
  return { stop, pause, resume, isActive };
807
808
  }
808
809
 
809
- function syncRef(left, right, options = {}) {
810
- var _a, _b;
810
+ function syncRef(left, right, ...[options]) {
811
811
  const {
812
812
  flush = "sync",
813
813
  deep = false,
814
814
  immediate = true,
815
815
  direction = "both",
816
816
  transform = {}
817
- } = options;
817
+ } = options || {};
818
818
  const watchers = [];
819
- const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
820
- const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
819
+ const transformLTR = "ltr" in transform && transform.ltr || ((v) => v);
820
+ const transformRTL = "rtl" in transform && transform.rtl || ((v) => v);
821
821
  if (direction === "both" || direction === "ltr") {
822
822
  watchers.push(watchPausable(
823
823
  left,
@@ -1168,13 +1168,18 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1168
1168
  }
1169
1169
 
1170
1170
  const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
1171
- 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;
1171
+ const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
1172
1172
  function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
1173
1173
  let m = hours < 12 ? "AM" : "PM";
1174
1174
  if (hasPeriod)
1175
1175
  m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
1176
1176
  return isLowercase ? m.toLowerCase() : m;
1177
1177
  }
1178
+ function formatOrdinal(num) {
1179
+ const suffixes = ["th", "st", "nd", "rd"];
1180
+ const v = num % 100;
1181
+ return num + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);
1182
+ }
1178
1183
  function formatDate(date, formatStr, options = {}) {
1179
1184
  var _a;
1180
1185
  const years = date.getFullYear();
@@ -1187,21 +1192,28 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1187
1192
  const day = date.getDay();
1188
1193
  const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
1189
1194
  const matches = {
1195
+ Yo: () => formatOrdinal(years),
1190
1196
  YY: () => String(years).slice(-2),
1191
1197
  YYYY: () => years,
1192
1198
  M: () => month + 1,
1199
+ Mo: () => formatOrdinal(month + 1),
1193
1200
  MM: () => `${month + 1}`.padStart(2, "0"),
1194
1201
  MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
1195
1202
  MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
1196
1203
  D: () => String(days),
1204
+ Do: () => formatOrdinal(days),
1197
1205
  DD: () => `${days}`.padStart(2, "0"),
1198
1206
  H: () => String(hours),
1207
+ Ho: () => formatOrdinal(hours),
1199
1208
  HH: () => `${hours}`.padStart(2, "0"),
1200
1209
  h: () => `${hours % 12 || 12}`.padStart(1, "0"),
1210
+ ho: () => formatOrdinal(hours % 12 || 12),
1201
1211
  hh: () => `${hours % 12 || 12}`.padStart(2, "0"),
1202
1212
  m: () => String(minutes),
1213
+ mo: () => formatOrdinal(minutes),
1203
1214
  mm: () => `${minutes}`.padStart(2, "0"),
1204
1215
  s: () => String(seconds),
1216
+ so: () => formatOrdinal(seconds),
1205
1217
  ss: () => `${seconds}`.padStart(2, "0"),
1206
1218
  SSS: () => `${milliseconds}`.padStart(3, "0"),
1207
1219
  d: () => day,
@@ -1582,6 +1594,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1582
1594
  vueDemi.nextTick(() => stop());
1583
1595
  return cb(...args);
1584
1596
  }, options);
1597
+ return stop;
1585
1598
  }
1586
1599
 
1587
1600
  function watchThrottled(source, cb, options = {}) {
@@ -1690,6 +1703,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
1690
1703
  exports.isDefined = isDefined;
1691
1704
  exports.isIOS = isIOS;
1692
1705
  exports.isObject = isObject;
1706
+ exports.isWorker = isWorker;
1693
1707
  exports.makeDestructurable = makeDestructurable;
1694
1708
  exports.noop = noop;
1695
1709
  exports.normalizeDate = normalizeDate;
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- var VueDemi=function(c,u,R){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 b=function(S,A){var T,_={},L={config:u.config,use:u.use.bind(u),mixin:u.mixin.bind(u),component:u.component.bind(u),provide:function(C,I){return _[C]=I,this},directive:function(C,I){return I?(u.directive(C,I),L):u.directive(C)},mount:function(C,I){return T||(T=new u(Object.assign({propsData:A},S,{provide:Object.assign(_,S.provide)})),T.$mount(C,I),T)},unmount:function(){T&&(T.$destroy(),T=void 0)}};return L};var P=b;for(var O in u)c[O]=u[O];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=b}else if(u.version.slice(0,2)==="2.")if(R){for(var O in R)c[O]=R[O];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 O in u)c[O]=u[O];c.isVue2=!1,c.isVue3=!0,c.install=function(){},c.Vue=u,c.Vue2=void 0,c.version=u.version,c.set=function(b,S,A){return Array.isArray(b)?(b.length=Math.max(b.length,S),b.splice(S,1,A),A):(b[S]=A,A)},c.del=function(b,S){if(Array.isArray(b)){b.splice(S,1);return}delete b[S]}}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 R(t,e){var n;const r=u.shallowRef();return u.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),u.readonly(r)}function O(t,e){let n,r,o;const a=u.ref(!0),i=()=>{a.value=!0,o()};u.watch(t,i,{flush:"sync"});const l=typeof e=="function"?e:e.get,d=typeof e=="function"?void 0:e.set,g=u.customRef((h,f)=>(r=h,o=f,{get(){return a.value&&(n=l(),a.value=!1),r(),n},set(y){d?.(y)}}));return Object.isExtensible(g)&&(g.trigger=i),g}function P(t){return u.getCurrentScope()?(u.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 P(a),{off:a}},off:e,trigger:o=>Promise.all(Array.from(t).map(a=>a(o)))}}function S(t){let e=!1,n;const r=u.effectScope(!0);return(...o)=>(e||(n=r.run(()=>t(...o)),e=!0),n)}const A=new WeakMap,T=(t,e)=>{var n;const r=(n=u.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");A.has(r)||A.set(r,Object.create(null));const o=A.get(r);o[t]=e,u.provide(t,e)},_=(...t)=>{var e;const n=t[0],r=(e=u.getCurrentInstance())==null?void 0:e.proxy;if(r==null)throw new Error("injectLocal must be called in setup");return A.has(r)&&n in A.get(r)?A.get(r)[n]:u.inject(...t)};function L(t,e){const n=e?.injectionKey||Symbol("InjectionState");return[(...a)=>{const i=t(...a);return T(n,i),i},()=>_(n)]}function C(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=u.effectScope(!0),n=r.run(()=>t(...a))),P(o),n)}function I(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,a]of Object.entries(e))o!=="value"&&(u.isRef(a)&&r?Object.defineProperty(t,o,{get(){return a.value},set(i){a.value=i},enumerable:n}):Object.defineProperty(t,o,{value:a,enumerable:n}));return t}function yt(t,e){return e==null?u.unref(t):u.unref(t)[e]}function gt(t){return u.unref(t)!=null}function mt(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 wt=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 pt(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(!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 vt(t,...e){const n=e.flat(),r=n[0];return H(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,a])=>!r(s(a),o)):Object.entries(u.toRefs(t)).filter(o=>!n.includes(o[0]))))}const k=typeof window<"u"&&typeof document<"u",bt=t=>typeof t<"u",At=t=>t!=null,Ot=(t,...e)=>{t||console.warn(...e)},St=Object.prototype.toString,x=t=>St.call(t)==="[object Object]",Tt=()=>Date.now(),D=()=>+Date.now(),It=(t,e,n)=>Math.min(n,Math.max(e,t)),M=()=>{},Ft=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),Pt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ct=Mt();function Mt(){var t;return k&&((t=window?.navigator)==null?void 0:t.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function j(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 U=t=>t();function Y(t,e={}){let n,r,o=M;const a=l=>{clearTimeout(l),o(),o=M};return l=>{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(l())):new Promise((h,f)=>{o=e.rejectOnCancel?f:h,g&&!r&&(r=setTimeout(()=>{n&&a(n),r=null,h(l())},g)),n=setTimeout(()=>{r&&a(r),r=null,h(l())},d)})}}function G(t,e=!0,n=!0,r=!1){let o=0,a,i=!0,l=M,d;const g=()=>{a&&(clearTimeout(a),a=void 0,l(),l=M)};return f=>{const y=s(t),w=Date.now()-o,m=()=>d=f();return g(),y<=0?(o=Date.now(),m()):(w>y&&(n||!i)?(o=Date.now(),m()):e&&(d=new Promise((p,v)=>{l=r?v:p,a=setTimeout(()=>{o=Date.now(),i=!0,p(m()),g()},Math.max(0,y-w))})),!n&&!a&&(a=setTimeout(()=>i=!0,y)),i=!1,d)}}function tt(t=U){const e=u.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const o=(...a)=>{e.value&&t(...a)};return{isActive:u.readonly(e),pause:n,resume:r,eventFilter:o}}const Rt={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 Et=/\B([A-Z])/g,_t=et(t=>t.replace(Et,"-$1").toLowerCase()),kt=/-(\w)/g,jt=et(t=>t.replace(kt,(e,n)=>n?n.toUpperCase():""));function z(t,e=!1,n="Timeout"){return new Promise((r,o)=>{setTimeout(e?()=>o(n):r,t)})}function Nt(t){return t}function Lt(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 Ut(t){return t()}function nt(t,...e){return e.some(n=>n in t)}function Wt(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 Bt(t,e,n=!1){return e.reduce((r,o)=>(o in t&&(!n||t[o]!==void 0)&&(r[o]=t[o]),r),{})}function $t(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,o])=>(!n||o!==void 0)&&!e.includes(r)))}function Ht(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:M}))):u.ref(e)}const Yt=q;function Gt(t,...e){const n=e.flat(),r=n[0];return H(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,a])=>r(s(a),o)):n.map(o=>[o,q(t,o)])))}function rt(t,e=1e4){return u.customRef((n,r)=>{let o=s(t),a;const i=()=>setTimeout(()=>{o=s(t),r()},s(e));return P(()=>{clearTimeout(a)}),{get(){return n(),o},set(l){o=l,r(),clearTimeout(a),a=i()}}})}function ot(t,e=200,n={}){return j(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 zt(t,e){return u.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function ct(t,e=200,n=!1,r=!0,o=!1){return j(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),a=ct(()=>{o.value=t.value},e,n,r);return u.watch(t,()=>a()),o}function ut(t,e={}){let n=t,r,o;const a=u.customRef((y,w)=>(r=y,o=w,{get(){return i()},set(m){l(m)}}));function i(y=!0){return y&&r(),n}function l(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 I(a,{get:i,set:l,untrackedGet:()=>i(!1),silentSet:y=>l(y,!1),peek:()=>i(!1),lay:y=>l(y,!1)},{enumerable:!0})}const qt=ut;function Zt(...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 N(t,e,n={}){const{eventFilter:r=U,...o}=n;return u.watch(t,j(r,e),o)}function W(t,e,n={}){const{eventFilter:r,...o}=n,{eventFilter:a,pause:i,resume:l,isActive:d}=tt(r);return{stop:N(t,e,{...o,eventFilter:a}),pause:i,resume:l,isActive:d}}function Jt(t,e,n={}){var r,o;const{flush:a="sync",deep:i=!1,immediate:l=!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(W(t,m=>{h.forEach(p=>p.pause()),e.value=f(m),h.forEach(p=>p.resume())},{flush:a,deep:i,immediate:l})),(d==="both"||d==="rtl")&&h.push(W(e,m=>{h.forEach(p=>p.pause()),t.value=y(m),h.forEach(p=>p.resume())},{flush:a,deep:i,immediate:l})),()=>{h.forEach(m=>m.stop())}}function Xt(t,e,n={}){const{flush:r="sync",deep:o=!1,immediate:a=!0}=n;return Array.isArray(e)||(e=[e]),u.watch(t,i=>e.forEach(l=>l.value=i),{flush:r,deep:o,immediate:a})}function Kt(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){var a;if((a=s(e.replaceRef))!=null?a:!0)if(Array.isArray(t.value)){const l=[...t.value];l[r]=o,t.value=l}else{const l={...t.value,[r]:o};Object.setPrototypeOf(l,Object.getPrototypeOf(t.value)),t.value=l}else t.value[r]=o}}));return n}function Qt(t,e=!0){u.getCurrentInstance()?u.onBeforeMount(t):e?t():u.nextTick(t)}function Vt(t){u.getCurrentInstance()&&u.onBeforeUnmount(t)}function xt(t,e=!0){u.getCurrentInstance()?u.onMounted(t):e?t():u.nextTick(t)}function Dt(t){u.getCurrentInstance()&&u.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=u.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(!u.isRef(f))return n(E=>E===f,y);const{flush:w="sync",deep:m=!1,timeout:p,throwOnTimeout:v}=y??{};let F=null;const B=[new Promise(E=>{F=u.watch([t,f],([ht,We])=>{e!==(ht===We)&&(F?.(),E(ht))},{flush:w,deep:m,immediate:!0})})];return p!=null&&B.push(z(p,v).then(()=>s(t)).finally(()=>(F?.(),s(t)))),Promise.race(B)}function o(f){return n(y=>!!y,f)}function a(f){return r(null,f)}function i(f){return r(void 0,f)}function l(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:l,toBeUndefined:i,changed:g,changedTimes:h,get not(){return X(t,!e)}}}function te(t){return X(t)}function ee(t,e){return t===e}function ne(...t){var e;const n=t[0],r=t[1];let o=(e=t[2])!=null?e:ee;if(typeof o=="string"){const a=o;o=(i,l)=>i[a]===l[a]}return u.computed(()=>s(n).filter(a=>s(r).findIndex(i=>o(a,i))===-1))}function re(t,e){return u.computed(()=>s(t).every((n,r,o)=>e(s(n),r,o)))}function oe(t,e){return u.computed(()=>s(t).map(n=>s(n)).filter(e))}function ce(t,e){return u.computed(()=>s(s(t).find((n,r,o)=>e(s(n),r,o))))}function ue(t,e){return u.computed(()=>s(t).findIndex((n,r,o)=>e(s(n),r,o)))}function ae(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function ie(t,e){return u.computed(()=>s(Array.prototype.findLast?s(t).findLast((n,r,o)=>e(s(n),r,o)):ae(s(t),(n,r,o)=>e(s(n),r,o))))}function le(t){return x(t)&&nt(t,"formIndex","comparator")}function se(...t){var e;const n=t[0],r=t[1];let o=t[2],a=0;if(le(o)&&(a=(e=o.fromIndex)!=null?e:0,o=o.comparator),typeof o=="string"){const i=o;o=(l,d)=>l[i]===s(d)}return o=o??((i,l)=>i===s(l)),u.computed(()=>s(n).slice(a).some((i,l,d)=>o(s(i),s(r),l,s(d))))}function fe(t,e){return u.computed(()=>s(t).map(n=>s(n)).join(s(e)))}function de(t,e){return u.computed(()=>s(t).map(n=>s(n)).map(e))}function he(t,e,...n){const r=(o,a,i)=>e(s(o),s(a),i);return u.computed(()=>{const o=s(t);return n.length?o.reduce(r,s(n[0])):o.reduce(r)})}function ye(t,e){return u.computed(()=>s(t).some((n,r,o)=>e(s(n),r,o)))}function ge(t){return Array.from(new Set(t))}function me(t,e){return t.reduce((n,r)=>(n.some(o=>e(r,o,t))||n.push(r),n),[])}function we(t,e){return u.computed(()=>{const n=s(t).map(r=>s(r));return e?me(n,e):ge(n)})}function pe(t=0,e={}){let n=u.unref(t);const r=u.ref(t),{max:o=Number.POSITIVE_INFINITY,min:a=Number.NEGATIVE_INFINITY}=e,i=(f=1)=>r.value=Math.min(o,r.value+f),l=(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:i,dec:l,get:d,set:g,reset:(f=n)=>(n=f,g(f))}}const ve=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,be=/\[([^\]]+)]|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 Ae(t,e,n,r){let o=t<12?"AM":"PM";return r&&(o=o.split("").reduce((a,i)=>a+=`${i}.`,"")),n?o.toLowerCase():o}function at(t,e,n={}){var r;const o=t.getFullYear(),a=t.getMonth(),i=t.getDate(),l=t.getHours(),d=t.getMinutes(),g=t.getSeconds(),h=t.getMilliseconds(),f=t.getDay(),y=(r=n.customMeridiem)!=null?r:Ae,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(i),DD:()=>`${i}`.padStart(2,"0"),H:()=>String(l),HH:()=>`${l}`.padStart(2,"0"),h:()=>`${l%12||12}`.padStart(1,"0"),hh:()=>`${l%12||12}`.padStart(2,"0"),m:()=>String(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(l,d),AA:()=>y(l,d,!1,!0),a:()=>y(l,d,!0),aa:()=>y(l,d,!0,!0)};return e.replace(be,(m,p)=>{var v,F;return(F=p??((v=w[m])==null?void 0:v.call(w)))!=null?F: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(ve);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 Oe(t,e="HH:mm:ss",n={}){return u.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 i=u.ref(!1);function l(){a&&(clearInterval(a),a=null)}function d(){i.value=!1,l()}function g(){const h=s(e);h<=0||(i.value=!0,o&&t(),l(),a=setInterval(t,h))}if(r&&k&&g(),u.isRef(e)||typeof e=="function"){const h=u.watch(e,()=>{i.value&&k&&g()});P(h)}return P(d),{isActive:i,pause:d,resume:g}}function Se(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:o}=e,a=u.ref(0),i=()=>a.value+=1,l=()=>{a.value=0},d=lt(o?()=>{i(),o(a.value)}:i,t,{immediate:r});return n?{counter:a,reset:l,...d}:a}function Te(t,e={}){var n;const r=u.ref((n=e.initialValue)!=null?n:null);return u.watch(t,()=>r.value=D(),e),r}function st(t,e,n={}){const{immediate:r=!0}=n,o=u.ref(!1);let a=null;function i(){a&&(clearTimeout(a),a=null)}function l(){o.value=!1,i()}function d(...g){i(),o.value=!0,a=setTimeout(()=>{o.value=!1,a=null,t(...g)},s(e))}return r&&(o.value=!0,k&&d()),P(l),{isPending:u.readonly(o),start:d,stop:l}}function Ie(t=1e3,e={}){const{controls:n=!1,callback:r}=e,o=st(r??M,t,e),a=u.computed(()=>!o.isPending.value);return n?{ready:a,...o}:a}function Fe(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:o}=e;return u.computed(()=>{let a=s(t);return typeof a=="string"&&(a=Number[n](a,r)),o&&Number.isNaN(a)&&(a=0),a})}function Pe(t){return u.computed(()=>`${s(t)}`)}function Ce(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,o=u.isRef(t),a=u.ref(t);function i(l){if(arguments.length)return a.value=l,a.value;{const d=s(n);return a.value=a.value===d?s(r):d,a.value}}return o?i:[a,i]}function Me(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:s(t)];return u.watch(t,(o,a,i)=>{const l=Array.from({length:r.length}),d=[];for(const h of o){let f=!1;for(let y=0;y<r.length;y++)if(!l[y]&&h===r[y]){l[y]=!0,f=!0;break}f||d.push(h)}const g=r.filter((h,f)=>!l[f]);e(o,r,d,g,i),r=[...o]},n)}function Re(t,e,n){const{count:r,...o}=n,a=u.ref(0),i=N(t,(...l)=>{a.value+=1,a.value>=s(r)&&u.nextTick(()=>i()),e(...l)},o);return{count:a,stop:i}}function ft(t,e,n={}){const{debounce:r=0,maxWait:o=void 0,...a}=n;return N(t,e,{...a,eventFilter:Y(r,{maxWait:o})})}function Ee(t,e,n){return u.watch(t,e,{...n,deep:!0})}function K(t,e,n={}){const{eventFilter:r=U,...o}=n,a=j(r,e);let i,l,d;if(o.flush==="sync"){const g=u.ref(!1);l=()=>{},i=h=>{g.value=!0,h(),g.value=!1},d=u.watch(t,(...h)=>{g.value||a(...h)},o)}else{const g=[],h=u.ref(0),f=u.ref(0);l=()=>{h.value=f.value},g.push(u.watch(t,()=>{f.value++},{...o,flush:"sync"})),i=y=>{const w=f.value;y(),h.value+=f.value-w},g.push(u.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:i,ignorePrevAsyncUpdates:l}}function _e(t,e,n){return u.watch(t,e,{...n,immediate:!0})}function ke(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:a=!0,...i}=n;return N(t,e,{...i,eventFilter:G(r,o,a)})}function je(t,e,n={}){let r;function o(){if(!r)return;const h=r;r=void 0,h()}function a(h){r=h}const i=(h,f)=>(o(),e(h,f,a)),l=K(t,i,n),{ignoreUpdates:d}=l;return{...l,trigger:()=>{let h;return d(()=>{h=i(Ne(t),Le(t))}),h}}}function Ne(t){return u.isReactive(t)?t:Array.isArray(t)?t.map(e=>s(e)):s(t)}function Le(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Ue(t,e,n){return u.watch(t,(r,o,a)=>{r&&e(r,o,a)},n)}c.assert=Ot,c.autoResetRef=rt,c.bypassFilter=U,c.camelize=jt,c.clamp=It,c.computedEager=R,c.computedWithControl=O,c.containsProp=nt,c.controlledComputed=O,c.controlledRef=qt,c.createEventHook=b,c.createFilterWrapper=j,c.createGlobalState=S,c.createInjectionState=L,c.createReactiveFn=$,c.createSharedComposable=C,c.createSingletonPromise=Lt,c.debounceFilter=Y,c.debouncedRef=Z,c.debouncedWatch=ft,c.directiveHooks=Rt,c.eagerComputed=R,c.extendRef=I,c.formatDate=at,c.get=yt,c.hasOwn=Pt,c.hyphenate=_t,c.identity=Nt,c.ignorableWatch=K,c.increaseWithUnit=Wt,c.injectLocal=_,c.invoke=Ut,c.isClient=k,c.isDef=bt,c.isDefined=gt,c.isIOS=Ct,c.isObject=x,c.makeDestructurable=mt,c.noop=M,c.normalizeDate=it,c.notNullish=At,c.now=Tt,c.objectEntries=Ht,c.objectOmit=$t,c.objectPick=Bt,c.pausableFilter=tt,c.pausableWatch=W,c.promiseTimeout=z,c.provideLocal=T,c.rand=Ft,c.reactify=$,c.reactifyObject=pt,c.reactiveComputed=H,c.reactiveOmit=vt,c.reactivePick=Gt,c.refAutoReset=rt,c.refDebounced=Z,c.refDefault=zt,c.refThrottled=J,c.refWithControl=ut,c.resolveRef=Yt,c.resolveUnref=wt,c.set=Zt,c.syncRef=Jt,c.syncRefs=Xt,c.throttleFilter=G,c.throttledRef=J,c.throttledWatch=dt,c.timestamp=D,c.toReactive=V,c.toRef=q,c.toRefs=Kt,c.toValue=s,c.tryOnBeforeMount=Qt,c.tryOnBeforeUnmount=Vt,c.tryOnMounted=xt,c.tryOnScopeDispose=P,c.tryOnUnmounted=Dt,c.until=te,c.useArrayDifference=ne,c.useArrayEvery=re,c.useArrayFilter=oe,c.useArrayFind=ce,c.useArrayFindIndex=ue,c.useArrayFindLast=ie,c.useArrayIncludes=se,c.useArrayJoin=fe,c.useArrayMap=de,c.useArrayReduce=he,c.useArraySome=ye,c.useArrayUnique=we,c.useCounter=pe,c.useDateFormat=Oe,c.useDebounce=Z,c.useDebounceFn=ot,c.useInterval=Se,c.useIntervalFn=lt,c.useLastChanged=Te,c.useThrottle=J,c.useThrottleFn=ct,c.useTimeout=Ie,c.useTimeoutFn=st,c.useToNumber=Fe,c.useToString=Pe,c.useToggle=Ce,c.watchArray=Me,c.watchAtMost=Re,c.watchDebounced=ft,c.watchDeep=Ee,c.watchIgnorable=K,c.watchImmediate=_e,c.watchOnce=ke,c.watchPausable=W,c.watchThrottled=dt,c.watchTriggerable=je,c.watchWithFilter=N,c.whenever=Ue})(this.VueUse=this.VueUse||{},VueDemi);
1
+ var VueDemi=function(c,u,E){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 v=function(S,b){var T,_={},W={config:u.config,use:u.use.bind(u),mixin:u.mixin.bind(u),component:u.component.bind(u),provide:function(M,I){return _[M]=I,this},directive:function(M,I){return I?(u.directive(M,I),W):u.directive(M)},mount:function(M,I){return T||(T=new u(Object.assign({propsData:b},S,{provide:Object.assign(_,S.provide)})),T.$mount(M,I),T)},unmount:function(){T&&(T.$destroy(),T=void 0)}};return W};var P=v;for(var O in u)c[O]=u[O];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=v}else if(u.version.slice(0,2)==="2.")if(E){for(var O in E)c[O]=E[O];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 O in u)c[O]=u[O];c.isVue2=!1,c.isVue3=!0,c.install=function(){},c.Vue=u,c.Vue2=void 0,c.version=u.version,c.set=function(v,S,b){return Array.isArray(v)?(v.length=Math.max(v.length,S),v.splice(S,1,b),b):(v[S]=b,b)},c.del=function(v,S){if(Array.isArray(v)){v.splice(S,1);return}delete v[S]}}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 E(t,e){var n;const r=u.shallowRef();return u.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),u.readonly(r)}function O(t,e){let n,r,o;const a=u.ref(!0),i=()=>{a.value=!0,o()};u.watch(t,i,{flush:"sync"});const l=typeof e=="function"?e:e.get,d=typeof e=="function"?void 0:e.set,g=u.customRef((y,h)=>(r=y,o=h,{get(){return a.value&&(n=l(),a.value=!1),r(),n},set(f){d?.(f)}}));return Object.isExtensible(g)&&(g.trigger=i),g}function P(t){return u.getCurrentScope()?(u.onScopeDispose(t),!0):!1}function v(){const t=new Set,e=o=>{t.delete(o)};return{on:o=>{t.add(o);const a=()=>e(o);return P(a),{off:a}},off:e,trigger:o=>Promise.all(Array.from(t).map(a=>o?a(o):a()))}}function S(t){let e=!1,n;const r=u.effectScope(!0);return(...o)=>(e||(n=r.run(()=>t(...o)),e=!0),n)}const b=new WeakMap,T=(t,e)=>{var n;const r=(n=u.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");b.has(r)||b.set(r,Object.create(null));const o=b.get(r);o[t]=e,u.provide(t,e)},_=(...t)=>{var e;const n=t[0],r=(e=u.getCurrentInstance())==null?void 0:e.proxy;if(r==null)throw new Error("injectLocal must be called in setup");return b.has(r)&&n in b.get(r)?b.get(r)[n]:u.inject(...t)};function W(t,e){const n=e?.injectionKey||Symbol("InjectionState");return[(...a)=>{const i=t(...a);return T(n,i),i},()=>_(n)]}function M(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=u.effectScope(!0),n=r.run(()=>t(...a))),P(o),n)}function I(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,a]of Object.entries(e))o!=="value"&&(u.isRef(a)&&r?Object.defineProperty(t,o,{get(){return a.value},set(i){a.value=i},enumerable:n}):Object.defineProperty(t,o,{value:a,enumerable:n}));return t}function gt(t,e){return e==null?u.unref(t):u.unref(t)[e]}function mt(t){return u.unref(t)!=null}function wt(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 pt=s;function H(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 vt(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"?H(a.bind(t),r):a]}))}function x(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 Y(t){return x(u.computed(t))}function bt(t,...e){const n=e.flat(),r=n[0];return Y(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,a])=>!r(s(a),o)):Object.entries(u.toRefs(t)).filter(o=>!n.includes(o[0]))))}const j=typeof window<"u"&&typeof document<"u",At=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Ot=t=>typeof t<"u",St=t=>t!=null,Tt=(t,...e)=>{t||console.warn(...e)},It=Object.prototype.toString,D=t=>It.call(t)==="[object Object]",Ft=()=>Date.now(),tt=()=>+Date.now(),Pt=(t,e,n)=>Math.min(n,Math.max(e,t)),C=()=>{},Mt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),Ct=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Rt=Et();function Et(){var t;return j&&((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 U=t=>t();function G(t,e={}){let n,r,o=C;const a=l=>{clearTimeout(l),o(),o=C};return l=>{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(l())):new Promise((y,h)=>{o=e.rejectOnCancel?h:y,g&&!r&&(r=setTimeout(()=>{n&&a(n),r=null,y(l())},g)),n=setTimeout(()=>{r&&a(r),r=null,y(l())},d)})}}function z(t,e=!0,n=!0,r=!1){let o=0,a,i=!0,l=C,d;const g=()=>{a&&(clearTimeout(a),a=void 0,l(),l=C)};return h=>{const f=s(t),m=Date.now()-o,w=()=>d=h();return g(),f<=0?(o=Date.now(),w()):(m>f&&(n||!i)?(o=Date.now(),w()):e&&(d=new Promise((A,p)=>{l=r?p:A,a=setTimeout(()=>{o=Date.now(),i=!0,A(w()),g()},Math.max(0,f-m))})),!n&&!a&&(a=setTimeout(()=>i=!0,f)),i=!1,d)}}function et(t=U){const e=u.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const o=(...a)=>{e.value&&t(...a)};return{isActive:u.readonly(e),pause:n,resume:r,eventFilter:o}}const kt={mounted:u.isVue3?"mounted":"inserted",updated:u.isVue3?"updated":"componentUpdated",unmounted:u.isVue3?"unmounted":"unbind"};function nt(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const _t=/\B([A-Z])/g,jt=nt(t=>t.replace(_t,"-$1").toLowerCase()),Nt=/-(\w)/g,Lt=nt(t=>t.replace(Nt,(e,n)=>n?n.toUpperCase():""));function q(t,e=!1,n="Timeout"){return new Promise((r,o)=>{setTimeout(e?()=>o(n):r,t)})}function Wt(t){return t}function Ut(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 Bt(t){return t()}function rt(t,...e){return e.some(n=>n in t)}function $t(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 Ht(t,e,n=!1){return e.reduce((r,o)=>(o in t&&(!n||t[o]!==void 0)&&(r[o]=t[o]),r),{})}function Yt(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,o])=>(!n||o!==void 0)&&!e.includes(r)))}function Gt(t){return Object.entries(t)}function Z(...t){if(t.length!==1)return u.toRef(...t);const e=t[0];return typeof e=="function"?u.readonly(u.customRef(()=>({get:e,set:C}))):u.ref(e)}const zt=Z;function qt(t,...e){const n=e.flat(),r=n[0];return Y(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(t)).filter(([o,a])=>r(s(a),o)):n.map(o=>[o,Z(t,o)])))}function ot(t,e=1e4){return u.customRef((n,r)=>{let o=s(t),a;const i=()=>setTimeout(()=>{o=s(t),r()},s(e));return P(()=>{clearTimeout(a)}),{get(){return n(),o},set(l){o=l,r(),clearTimeout(a),a=i()}}})}function ct(t,e=200,n={}){return N(G(e,n),t)}function J(t,e=200,n={}){const r=u.ref(t.value),o=ct(()=>{r.value=t.value},e,n);return u.watch(t,()=>o()),r}function Zt(t,e){return u.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(z(e,n,r,o),t)}function X(t,e=200,n=!0,r=!0){if(e<=0)return t;const o=u.ref(t.value),a=ut(()=>{o.value=t.value},e,n,r);return u.watch(t,()=>a()),o}function at(t,e={}){let n=t,r,o;const a=u.customRef((f,m)=>(r=f,o=m,{get(){return i()},set(w){l(w)}}));function i(f=!0){return f&&r(),n}function l(f,m=!0){var w,A;if(f===n)return;const p=n;((w=e.onBeforeChange)==null?void 0:w.call(e,f,p))!==!1&&(n=f,(A=e.onChanged)==null||A.call(e,f,p),m&&o())}return I(a,{get:i,set:l,untrackedGet:()=>i(!1),silentSet:f=>l(f,!1),peek:()=>i(!1),lay:f=>l(f,!1)},{enumerable:!0})}const Jt=at;function Xt(...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 L(t,e,n={}){const{eventFilter:r=U,...o}=n;return u.watch(t,N(r,e),o)}function B(t,e,n={}){const{eventFilter:r,...o}=n,{eventFilter:a,pause:i,resume:l,isActive:d}=et(r);return{stop:L(t,e,{...o,eventFilter:a}),pause:i,resume:l,isActive:d}}function Kt(t,e,...[n]){const{flush:r="sync",deep:o=!1,immediate:a=!0,direction:i="both",transform:l={}}=n||{},d=[],g="ltr"in l&&l.ltr||(f=>f),y="rtl"in l&&l.rtl||(f=>f);return(i==="both"||i==="ltr")&&d.push(B(t,f=>{d.forEach(m=>m.pause()),e.value=g(f),d.forEach(m=>m.resume())},{flush:r,deep:o,immediate:a})),(i==="both"||i==="rtl")&&d.push(B(e,f=>{d.forEach(m=>m.pause()),t.value=y(f),d.forEach(m=>m.resume())},{flush:r,deep:o,immediate:a})),()=>{d.forEach(f=>f.stop())}}function Qt(t,e,n={}){const{flush:r="sync",deep:o=!1,immediate:a=!0}=n;return Array.isArray(e)||(e=[e]),u.watch(t,i=>e.forEach(l=>l.value=i),{flush:r,deep:o,immediate:a})}function Vt(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){var a;if((a=s(e.replaceRef))!=null?a:!0)if(Array.isArray(t.value)){const l=[...t.value];l[r]=o,t.value=l}else{const l={...t.value,[r]:o};Object.setPrototypeOf(l,Object.getPrototypeOf(t.value)),t.value=l}else t.value[r]=o}}));return n}function xt(t,e=!0){u.getCurrentInstance()?u.onBeforeMount(t):e?t():u.nextTick(t)}function Dt(t){u.getCurrentInstance()&&u.onBeforeUnmount(t)}function te(t,e=!0){u.getCurrentInstance()?u.onMounted(t):e?t():u.nextTick(t)}function ee(t){u.getCurrentInstance()&&u.onUnmounted(t)}function K(t,e=!1){function n(h,{flush:f="sync",deep:m=!1,timeout:w,throwOnTimeout:A}={}){let p=null;const V=[new Promise($=>{p=u.watch(t,k=>{h(k)!==e&&(p?.(),$(k))},{flush:f,deep:m,immediate:!0})})];return w!=null&&V.push(q(w,A).then(()=>s(t)).finally(()=>p?.())),Promise.race(V)}function r(h,f){if(!u.isRef(h))return n(k=>k===h,f);const{flush:m="sync",deep:w=!1,timeout:A,throwOnTimeout:p}=f??{};let F=null;const $=[new Promise(k=>{F=u.watch([t,h],([yt,$e])=>{e!==(yt===$e)&&(F?.(),k(yt))},{flush:m,deep:w,immediate:!0})})];return A!=null&&$.push(q(A,p).then(()=>s(t)).finally(()=>(F?.(),s(t)))),Promise.race($)}function o(h){return n(f=>!!f,h)}function a(h){return r(null,h)}function i(h){return r(void 0,h)}function l(h){return n(Number.isNaN,h)}function d(h,f){return n(m=>{const w=Array.from(m);return w.includes(h)||w.includes(s(h))},f)}function g(h){return y(1,h)}function y(h=1,f){let m=-1;return n(()=>(m+=1,m>=h),f)}return Array.isArray(s(t))?{toMatch:n,toContains:d,changed:g,changedTimes:y,get not(){return K(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:o,toBeNull:a,toBeNaN:l,toBeUndefined:i,changed:g,changedTimes:y,get not(){return K(t,!e)}}}function ne(t){return K(t)}function re(t,e){return t===e}function oe(...t){var e;const n=t[0],r=t[1];let o=(e=t[2])!=null?e:re;if(typeof o=="string"){const a=o;o=(i,l)=>i[a]===l[a]}return u.computed(()=>s(n).filter(a=>s(r).findIndex(i=>o(a,i))===-1))}function ce(t,e){return u.computed(()=>s(t).every((n,r,o)=>e(s(n),r,o)))}function ue(t,e){return u.computed(()=>s(t).map(n=>s(n)).filter(e))}function ae(t,e){return u.computed(()=>s(s(t).find((n,r,o)=>e(s(n),r,o))))}function ie(t,e){return u.computed(()=>s(t).findIndex((n,r,o)=>e(s(n),r,o)))}function le(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function se(t,e){return u.computed(()=>s(Array.prototype.findLast?s(t).findLast((n,r,o)=>e(s(n),r,o)):le(s(t),(n,r,o)=>e(s(n),r,o))))}function fe(t){return D(t)&&rt(t,"formIndex","comparator")}function de(...t){var e;const n=t[0],r=t[1];let o=t[2],a=0;if(fe(o)&&(a=(e=o.fromIndex)!=null?e:0,o=o.comparator),typeof o=="string"){const i=o;o=(l,d)=>l[i]===s(d)}return o=o??((i,l)=>i===s(l)),u.computed(()=>s(n).slice(a).some((i,l,d)=>o(s(i),s(r),l,s(d))))}function he(t,e){return u.computed(()=>s(t).map(n=>s(n)).join(s(e)))}function ye(t,e){return u.computed(()=>s(t).map(n=>s(n)).map(e))}function ge(t,e,...n){const r=(o,a,i)=>e(s(o),s(a),i);return u.computed(()=>{const o=s(t);return n.length?o.reduce(r,s(n[0])):o.reduce(r)})}function me(t,e){return u.computed(()=>s(t).some((n,r,o)=>e(s(n),r,o)))}function we(t){return Array.from(new Set(t))}function pe(t,e){return t.reduce((n,r)=>(n.some(o=>e(r,o,t))||n.push(r),n),[])}function ve(t,e){return u.computed(()=>{const n=s(t).map(r=>s(r));return e?pe(n,e):we(n)})}function be(t=0,e={}){let n=u.unref(t);const r=u.ref(t),{max:o=Number.POSITIVE_INFINITY,min:a=Number.NEGATIVE_INFINITY}=e,i=(h=1)=>r.value=Math.min(o,r.value+h),l=(h=1)=>r.value=Math.max(a,r.value-h),d=()=>r.value,g=h=>r.value=Math.max(a,Math.min(o,h));return{count:r,inc:i,dec:l,get:d,set:g,reset:(h=n)=>(n=h,g(h))}}const Ae=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Oe=/[YMDHhms]o|\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function Se(t,e,n,r){let o=t<12?"AM":"PM";return r&&(o=o.split("").reduce((a,i)=>a+=`${i}.`,"")),n?o.toLowerCase():o}function R(t){const e=["th","st","nd","rd"],n=t%100;return t+(e[(n-20)%10]||e[n]||e[0])}function it(t,e,n={}){var r;const o=t.getFullYear(),a=t.getMonth(),i=t.getDate(),l=t.getHours(),d=t.getMinutes(),g=t.getSeconds(),y=t.getMilliseconds(),h=t.getDay(),f=(r=n.customMeridiem)!=null?r:Se,m={Yo:()=>R(o),YY:()=>String(o).slice(-2),YYYY:()=>o,M:()=>a+1,Mo:()=>R(a+1),MM:()=>`${a+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(n.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(n.locales,{month:"long"}),D:()=>String(i),Do:()=>R(i),DD:()=>`${i}`.padStart(2,"0"),H:()=>String(l),Ho:()=>R(l),HH:()=>`${l}`.padStart(2,"0"),h:()=>`${l%12||12}`.padStart(1,"0"),ho:()=>R(l%12||12),hh:()=>`${l%12||12}`.padStart(2,"0"),m:()=>String(d),mo:()=>R(d),mm:()=>`${d}`.padStart(2,"0"),s:()=>String(g),so:()=>R(g),ss:()=>`${g}`.padStart(2,"0"),SSS:()=>`${y}`.padStart(3,"0"),d:()=>h,dd:()=>t.toLocaleDateString(n.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(n.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(n.locales,{weekday:"long"}),A:()=>f(l,d),AA:()=>f(l,d,!1,!0),a:()=>f(l,d,!0),aa:()=>f(l,d,!0,!0)};return e.replace(Oe,(w,A)=>{var p,F;return(F=A??((p=m[w])==null?void 0:p.call(m)))!=null?F:w})}function lt(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(Ae);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 Te(t,e="HH:mm:ss",n={}){return u.computed(()=>it(lt(s(t)),s(e),n))}function st(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:o=!1}=n;let a=null;const i=u.ref(!1);function l(){a&&(clearInterval(a),a=null)}function d(){i.value=!1,l()}function g(){const y=s(e);y<=0||(i.value=!0,o&&t(),l(),a=setInterval(t,y))}if(r&&j&&g(),u.isRef(e)||typeof e=="function"){const y=u.watch(e,()=>{i.value&&j&&g()});P(y)}return P(d),{isActive:i,pause:d,resume:g}}function Ie(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:o}=e,a=u.ref(0),i=()=>a.value+=1,l=()=>{a.value=0},d=st(o?()=>{i(),o(a.value)}:i,t,{immediate:r});return n?{counter:a,reset:l,...d}:a}function Fe(t,e={}){var n;const r=u.ref((n=e.initialValue)!=null?n:null);return u.watch(t,()=>r.value=tt(),e),r}function ft(t,e,n={}){const{immediate:r=!0}=n,o=u.ref(!1);let a=null;function i(){a&&(clearTimeout(a),a=null)}function l(){o.value=!1,i()}function d(...g){i(),o.value=!0,a=setTimeout(()=>{o.value=!1,a=null,t(...g)},s(e))}return r&&(o.value=!0,j&&d()),P(l),{isPending:u.readonly(o),start:d,stop:l}}function Pe(t=1e3,e={}){const{controls:n=!1,callback:r}=e,o=ft(r??C,t,e),a=u.computed(()=>!o.isPending.value);return n?{ready:a,...o}:a}function Me(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:o}=e;return u.computed(()=>{let a=s(t);return typeof a=="string"&&(a=Number[n](a,r)),o&&Number.isNaN(a)&&(a=0),a})}function Ce(t){return u.computed(()=>`${s(t)}`)}function Re(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,o=u.isRef(t),a=u.ref(t);function i(l){if(arguments.length)return a.value=l,a.value;{const d=s(n);return a.value=a.value===d?s(r):d,a.value}}return o?i:[a,i]}function Ee(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:s(t)];return u.watch(t,(o,a,i)=>{const l=Array.from({length:r.length}),d=[];for(const y of o){let h=!1;for(let f=0;f<r.length;f++)if(!l[f]&&y===r[f]){l[f]=!0,h=!0;break}h||d.push(y)}const g=r.filter((y,h)=>!l[h]);e(o,r,d,g,i),r=[...o]},n)}function ke(t,e,n){const{count:r,...o}=n,a=u.ref(0),i=L(t,(...l)=>{a.value+=1,a.value>=s(r)&&u.nextTick(()=>i()),e(...l)},o);return{count:a,stop:i}}function dt(t,e,n={}){const{debounce:r=0,maxWait:o=void 0,...a}=n;return L(t,e,{...a,eventFilter:G(r,{maxWait:o})})}function _e(t,e,n){return u.watch(t,e,{...n,deep:!0})}function Q(t,e,n={}){const{eventFilter:r=U,...o}=n,a=N(r,e);let i,l,d;if(o.flush==="sync"){const g=u.ref(!1);l=()=>{},i=y=>{g.value=!0,y(),g.value=!1},d=u.watch(t,(...y)=>{g.value||a(...y)},o)}else{const g=[],y=u.ref(0),h=u.ref(0);l=()=>{y.value=h.value},g.push(u.watch(t,()=>{h.value++},{...o,flush:"sync"})),i=f=>{const m=h.value;f(),y.value+=h.value-m},g.push(u.watch(t,(...f)=>{const m=y.value>0&&y.value===h.value;y.value=0,h.value=0,!m&&a(...f)},o)),d=()=>{g.forEach(f=>f())}}return{stop:d,ignoreUpdates:i,ignorePrevAsyncUpdates:l}}function je(t,e,n){return u.watch(t,e,{...n,immediate:!0})}function Ne(t,e,n){const r=u.watch(t,(...o)=>(u.nextTick(()=>r()),e(...o)),n);return r}function ht(t,e,n={}){const{throttle:r=0,trailing:o=!0,leading:a=!0,...i}=n;return L(t,e,{...i,eventFilter:z(r,o,a)})}function Le(t,e,n={}){let r;function o(){if(!r)return;const y=r;r=void 0,y()}function a(y){r=y}const i=(y,h)=>(o(),e(y,h,a)),l=Q(t,i,n),{ignoreUpdates:d}=l;return{...l,trigger:()=>{let y;return d(()=>{y=i(We(t),Ue(t))}),y}}}function We(t){return u.isReactive(t)?t:Array.isArray(t)?t.map(e=>s(e)):s(t)}function Ue(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Be(t,e,n){return u.watch(t,(r,o,a)=>{r&&e(r,o,a)},n)}c.assert=Tt,c.autoResetRef=ot,c.bypassFilter=U,c.camelize=Lt,c.clamp=Pt,c.computedEager=E,c.computedWithControl=O,c.containsProp=rt,c.controlledComputed=O,c.controlledRef=Jt,c.createEventHook=v,c.createFilterWrapper=N,c.createGlobalState=S,c.createInjectionState=W,c.createReactiveFn=H,c.createSharedComposable=M,c.createSingletonPromise=Ut,c.debounceFilter=G,c.debouncedRef=J,c.debouncedWatch=dt,c.directiveHooks=kt,c.eagerComputed=E,c.extendRef=I,c.formatDate=it,c.get=gt,c.hasOwn=Ct,c.hyphenate=jt,c.identity=Wt,c.ignorableWatch=Q,c.increaseWithUnit=$t,c.injectLocal=_,c.invoke=Bt,c.isClient=j,c.isDef=Ot,c.isDefined=mt,c.isIOS=Rt,c.isObject=D,c.isWorker=At,c.makeDestructurable=wt,c.noop=C,c.normalizeDate=lt,c.notNullish=St,c.now=Ft,c.objectEntries=Gt,c.objectOmit=Yt,c.objectPick=Ht,c.pausableFilter=et,c.pausableWatch=B,c.promiseTimeout=q,c.provideLocal=T,c.rand=Mt,c.reactify=H,c.reactifyObject=vt,c.reactiveComputed=Y,c.reactiveOmit=bt,c.reactivePick=qt,c.refAutoReset=ot,c.refDebounced=J,c.refDefault=Zt,c.refThrottled=X,c.refWithControl=at,c.resolveRef=zt,c.resolveUnref=pt,c.set=Xt,c.syncRef=Kt,c.syncRefs=Qt,c.throttleFilter=z,c.throttledRef=X,c.throttledWatch=ht,c.timestamp=tt,c.toReactive=x,c.toRef=Z,c.toRefs=Vt,c.toValue=s,c.tryOnBeforeMount=xt,c.tryOnBeforeUnmount=Dt,c.tryOnMounted=te,c.tryOnScopeDispose=P,c.tryOnUnmounted=ee,c.until=ne,c.useArrayDifference=oe,c.useArrayEvery=ce,c.useArrayFilter=ue,c.useArrayFind=ae,c.useArrayFindIndex=ie,c.useArrayFindLast=se,c.useArrayIncludes=de,c.useArrayJoin=he,c.useArrayMap=ye,c.useArrayReduce=ge,c.useArraySome=me,c.useArrayUnique=ve,c.useCounter=be,c.useDateFormat=Te,c.useDebounce=J,c.useDebounceFn=ct,c.useInterval=Ie,c.useIntervalFn=st,c.useLastChanged=Fe,c.useThrottle=X,c.useThrottleFn=ut,c.useTimeout=Pe,c.useTimeoutFn=ft,c.useToNumber=Me,c.useToString=Ce,c.useToggle=Re,c.watchArray=Ee,c.watchAtMost=ke,c.watchDebounced=dt,c.watchDeep=_e,c.watchIgnorable=Q,c.watchImmediate=je,c.watchOnce=Ne,c.watchPausable=B,c.watchThrottled=ht,c.watchTriggerable=Le,c.watchWithFilter=L,c.whenever=Be})(this.VueUse=this.VueUse||{},VueDemi);
package/index.mjs CHANGED
@@ -68,7 +68,7 @@ function createEventHook() {
68
68
  };
69
69
  };
70
70
  const trigger = (param) => {
71
- return Promise.all(Array.from(fns).map((fn) => fn(param)));
71
+ return Promise.all(Array.from(fns).map((fn) => param ? fn(param) : fn()));
72
72
  };
73
73
  return {
74
74
  on,
@@ -285,6 +285,7 @@ function reactiveOmit(obj, ...keys) {
285
285
  }
286
286
 
287
287
  const isClient = typeof window !== "undefined" && typeof document !== "undefined";
288
+ const isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
288
289
  const isDef = (val) => typeof val !== "undefined";
289
290
  const notNullish = (val) => val != null;
290
291
  const assert = (condition, ...infos) => {
@@ -689,18 +690,17 @@ function watchPausable(source, cb, options = {}) {
689
690
  return { stop, pause, resume, isActive };
690
691
  }
691
692
 
692
- function syncRef(left, right, options = {}) {
693
- var _a, _b;
693
+ function syncRef(left, right, ...[options]) {
694
694
  const {
695
695
  flush = "sync",
696
696
  deep = false,
697
697
  immediate = true,
698
698
  direction = "both",
699
699
  transform = {}
700
- } = options;
700
+ } = options || {};
701
701
  const watchers = [];
702
- const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
703
- const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
702
+ const transformLTR = "ltr" in transform && transform.ltr || ((v) => v);
703
+ const transformRTL = "rtl" in transform && transform.rtl || ((v) => v);
704
704
  if (direction === "both" || direction === "ltr") {
705
705
  watchers.push(watchPausable(
706
706
  left,
@@ -1051,13 +1051,18 @@ function useCounter(initialValue = 0, options = {}) {
1051
1051
  }
1052
1052
 
1053
1053
  const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
1054
- 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;
1054
+ const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
1055
1055
  function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
1056
1056
  let m = hours < 12 ? "AM" : "PM";
1057
1057
  if (hasPeriod)
1058
1058
  m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
1059
1059
  return isLowercase ? m.toLowerCase() : m;
1060
1060
  }
1061
+ function formatOrdinal(num) {
1062
+ const suffixes = ["th", "st", "nd", "rd"];
1063
+ const v = num % 100;
1064
+ return num + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);
1065
+ }
1061
1066
  function formatDate(date, formatStr, options = {}) {
1062
1067
  var _a;
1063
1068
  const years = date.getFullYear();
@@ -1070,21 +1075,28 @@ function formatDate(date, formatStr, options = {}) {
1070
1075
  const day = date.getDay();
1071
1076
  const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;
1072
1077
  const matches = {
1078
+ Yo: () => formatOrdinal(years),
1073
1079
  YY: () => String(years).slice(-2),
1074
1080
  YYYY: () => years,
1075
1081
  M: () => month + 1,
1082
+ Mo: () => formatOrdinal(month + 1),
1076
1083
  MM: () => `${month + 1}`.padStart(2, "0"),
1077
1084
  MMM: () => date.toLocaleDateString(options.locales, { month: "short" }),
1078
1085
  MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }),
1079
1086
  D: () => String(days),
1087
+ Do: () => formatOrdinal(days),
1080
1088
  DD: () => `${days}`.padStart(2, "0"),
1081
1089
  H: () => String(hours),
1090
+ Ho: () => formatOrdinal(hours),
1082
1091
  HH: () => `${hours}`.padStart(2, "0"),
1083
1092
  h: () => `${hours % 12 || 12}`.padStart(1, "0"),
1093
+ ho: () => formatOrdinal(hours % 12 || 12),
1084
1094
  hh: () => `${hours % 12 || 12}`.padStart(2, "0"),
1085
1095
  m: () => String(minutes),
1096
+ mo: () => formatOrdinal(minutes),
1086
1097
  mm: () => `${minutes}`.padStart(2, "0"),
1087
1098
  s: () => String(seconds),
1099
+ so: () => formatOrdinal(seconds),
1088
1100
  ss: () => `${seconds}`.padStart(2, "0"),
1089
1101
  SSS: () => `${milliseconds}`.padStart(3, "0"),
1090
1102
  d: () => day,
@@ -1465,6 +1477,7 @@ function watchOnce(source, cb, options) {
1465
1477
  nextTick(() => stop());
1466
1478
  return cb(...args);
1467
1479
  }, options);
1480
+ return stop;
1468
1481
  }
1469
1482
 
1470
1483
  function watchThrottled(source, cb, options = {}) {
@@ -1536,4 +1549,4 @@ function whenever(source, cb, options) {
1536
1549
  );
1537
1550
  }
1538
1551
 
1539
- export { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
1552
+ export { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/shared",
3
- "version": "10.5.0",
3
+ "version": "10.6.1",
4
4
  "author": "Anthony Fu <https://github.com/antfu>",
5
5
  "license": "MIT",
6
6
  "funding": "https://github.com/sponsors/antfu",