{"version":3,"sources":["webpack:///./node_modules/@vueuse/shared/dist/index.esm.js","webpack:///./node_modules/@vueuse/core/dist/index.esm.js"],"names":["isClient","window","isString","Object","prototype","toString","val","tryOnMounted","fn","sync","tryOnUnmounted","defaultWindow","undefined","document","navigator","useEventListener","args","target","event","listener","options","stopped","addEventListener","stop","removeEventListener","useCssVar","prop","el","varRef","elRef","documentElement","value","getComputedStyle","getPropertyValue","_a","style","setProperty","useWindowSize","initialWidth","Infinity","initialHeight","width","height","innerWidth","innerHeight","passive"],"mappings":"8MAqEA,MAAMA,EAA6B,qBAAXC,OAUlBC,GAJWC,OAAOC,UAAUC,SAIhBC,GAAuB,kBAARA,GAwQjC,SAASC,EAAaC,EAAIC,GAAO,GACzB,iBACA,eAAUD,GACLC,EACLD,IAEA,eAASA,GAQjB,SAASE,EAAeF,GAChB,kBACA,eAAYA,GCzQpB,MAAMG,EAAgCX,EAAWC,YAASW,EAClBZ,GAAWC,OAAOY,SACjBb,GAAWC,OAAOa,UAE3D,SAASC,KAAoBC,GACzB,IAAIC,EACAC,EACAC,EACAC,EAQJ,GAPIlB,EAASc,EAAK,MACbE,EAAOC,EAAUC,GAAWJ,EAC7BC,EAASN,IAGRM,EAAQC,EAAOC,EAAUC,GAAWJ,GAEpCC,EACD,OACJ,IAAII,GAAU,EACdJ,EAAOK,iBAAiBJ,EAAOC,EAAUC,GACzC,MAAMG,EAAO,KACLF,IAEJJ,EAAOO,oBAAoBN,EAAOC,EAAUC,GAC5CC,GAAU,IAGd,OADAX,EAAea,GACRA,EAiOX,SAASE,EAAUC,EAAMC,GAAI,OAAE1B,EAASU,GAAkB,IACtD,IAAKV,EACD,OAAO,eAAI,IACf,MAAM2B,EAAS,eAAI,IACbC,EAAQ,eAAI,eAAMF,IAAO1B,EAAOY,SAASiB,iBAS/C,OARAvB,EAAa,KACTqB,EAAOG,MAAQ9B,EAAO+B,iBAAiBH,EAAME,OAAOE,iBAAiBP,KAEzE,eAAME,EAAStB,IACX,IAAI4B,GACuB,QAAtBA,EAAKL,EAAME,aAA0B,IAAPG,OAAgB,EAASA,EAAGC,QAC3DN,EAAME,MAAMI,MAAMC,YAAYV,EAAMpB,KAErCsB,EAwtDX,SAASS,GAAc,OAAEpC,EAASU,EAAa,aAAE2B,EAAeC,IAAQ,cAAEC,EAAgBD,KAAa,IACnG,IAAKtC,EACD,MAAO,CACHwC,MAAO,eAAIH,GACXI,OAAQ,eAAIF,IAGpB,MAAMC,EAAQ,eAAIxC,EAAO0C,YACnBD,EAAS,eAAIzC,EAAO2C,aAK1B,OAJA7B,EAAiB,SAAU,KACvB0B,EAAMV,MAAQ9B,EAAO0C,WACrBD,EAAOX,MAAQ9B,EAAO2C,aACvB,CAAEC,SAAS,IACP,CAAEJ,QAAOC","file":"js/chunk-vendors~eb26399a.7c6fbb0a.js","sourcesContent":["import { watch, ref, computed, isRef, getCurrentInstance, onMounted, nextTick, onUnmounted, unref } from 'vue-demi';\n\n/**\r\n * Two-way refs synchronization.\r\n *\r\n * @param a\r\n * @param b\r\n */\r\nfunction biSyncRef(a, b) {\r\n const flush = 'sync';\r\n const stop1 = watch(a, (newValue) => {\r\n b.value = newValue;\r\n }, {\r\n flush,\r\n immediate: true,\r\n });\r\n const stop2 = watch(b, (newValue) => {\r\n a.value = newValue;\r\n }, {\r\n flush,\r\n immediate: true,\r\n });\r\n return () => {\r\n stop1();\r\n stop2();\r\n };\r\n}\n\n/**\r\n * Explicitly define the deps of computed.\r\n *\r\n * @param source\r\n * @param fn\r\n */\r\nfunction controlledComputed(source, fn) {\r\n const v = ref(fn());\r\n watch(source, () => v.value = fn(), {\r\n flush: 'sync',\r\n });\r\n return computed(() => v.value);\r\n}\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\n\nconst isClient = typeof window !== 'undefined';\r\nconst isDef = (val) => typeof val !== 'undefined';\r\nconst assert = (condition, ...infos) => {\r\n if (!condition)\r\n console.warn(...infos);\r\n};\r\nconst toString = Object.prototype.toString;\r\nconst isBoolean = (val) => typeof val === 'boolean';\r\nconst isFunction = (val) => typeof val === 'function';\r\nconst isNumber = (val) => typeof val === 'number';\r\nconst isString = (val) => typeof val === 'string';\r\nconst isObject = (val) => toString.call(val) === '[object Object]';\r\nconst isWindow = (val) => typeof window !== 'undefined' && toString.call(val) === '[object Window]';\r\nconst now = () => Date.now();\r\nconst timestamp = () => +Date.now();\r\nconst clamp = (n, min, max) => Math.min(max, Math.max(min, n));\r\nconst noop = () => { };\n\n/**\r\n * @internal\r\n */\r\nfunction createFilterWrapper(filter, fn) {\r\n function wrapper(...args) {\r\n filter(() => fn.apply(this, args), { fn, thisArg: this, args });\r\n }\r\n return wrapper;\r\n}\r\nconst bypassFilter = (invoke) => {\r\n return invoke();\r\n};\r\n/**\r\n * Create an EventFilter that debounce the events\r\n *\r\n * @param ms\r\n */\r\nfunction debounceFilter(ms) {\r\n if (ms <= 0)\r\n return bypassFilter;\r\n let timer;\r\n const filter = (invoke) => {\r\n if (timer)\r\n clearTimeout(timer);\r\n timer = setTimeout(invoke, ms);\r\n };\r\n return filter;\r\n}\r\n/**\r\n * Create an EventFilter that throttle the events\r\n *\r\n * @param ms\r\n * @param [trailing=true]\r\n */\r\nfunction throttleFilter(ms, trailing = true) {\r\n if (ms <= 0)\r\n return bypassFilter;\r\n let lastExec = 0;\r\n let timer;\r\n const clear = () => {\r\n if (timer) {\r\n clearTimeout(timer);\r\n timer = undefined;\r\n }\r\n };\r\n const filter = (invoke) => {\r\n const elapsed = Date.now() - lastExec;\r\n clear();\r\n if (elapsed > ms) {\r\n lastExec = Date.now();\r\n invoke();\r\n }\r\n else if (trailing) {\r\n timer = setTimeout(() => {\r\n clear();\r\n invoke();\r\n }, ms);\r\n }\r\n };\r\n return filter;\r\n}\r\n/**\r\n * EventFilter that gives extra controls to pause and resume the filter\r\n *\r\n * @param extendFilter Extra filter to apply when the PauseableFilter is active, default to none\r\n *\r\n */\r\nfunction pausableFilter(extendFilter = bypassFilter) {\r\n const isActive = ref(true);\r\n function pause() {\r\n isActive.value = false;\r\n }\r\n function resume() {\r\n isActive.value = true;\r\n }\r\n const eventFilter = (...args) => {\r\n if (isActive.value)\r\n extendFilter(...args);\r\n };\r\n return { isActive, pause, resume, eventFilter };\r\n}\n\nfunction promiseTimeout(ms, throwOnTimeout = false, reason = 'Timeout') {\r\n return new Promise((resolve, reject) => {\r\n if (throwOnTimeout)\r\n setTimeout(() => reject(reason), ms);\r\n else\r\n setTimeout(resolve, ms);\r\n });\r\n}\r\nfunction invoke(fn) {\r\n return fn();\r\n}\n\n// implementation\r\nfunction watchWithFilter(source, cb, options = {}) {\r\n const { eventFilter = bypassFilter } = options, watchOptions = __rest(options, [\"eventFilter\"]);\r\n return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);\r\n}\n\n// implementation\r\nfunction debouncedWatch(source, cb, options = {}) {\r\n const { debounce = 0 } = options, watchOptions = __rest(options, [\"debounce\"]);\r\n return watchWithFilter(source, cb, Object.assign(Object.assign({}, watchOptions), { eventFilter: debounceFilter(debounce) }));\r\n}\n\n// implementation\r\nfunction extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {\r\n for (const [key, value] of Object.entries(extend)) {\r\n if (key === 'value')\r\n continue;\r\n if (isRef(value) && unwrap) {\r\n Object.defineProperty(ref, key, {\r\n get() {\r\n return value.value;\r\n },\r\n set(v) {\r\n value.value = v;\r\n },\r\n enumerable,\r\n });\r\n }\r\n else {\r\n Object.defineProperty(ref, key, { value, enumerable });\r\n }\r\n }\r\n return ref;\r\n}\n\nfunction ignorableWatch(source, cb, options = {}) {\r\n const { eventFilter = bypassFilter } = options, watchOptions = __rest(options, [\"eventFilter\"]);\r\n const filteredCb = createFilterWrapper(eventFilter, cb);\r\n let ignoreUpdates;\r\n let ignorePrevAsyncUpdates;\r\n let stop;\r\n if (watchOptions.flush === 'sync') {\r\n const ignore = ref(false);\r\n // no op for flush: sync\r\n ignorePrevAsyncUpdates = () => { };\r\n ignoreUpdates = (updater) => {\r\n // Call the updater function and count how many sync updates are performed,\r\n // then add them to the ignore count\r\n ignore.value = true;\r\n updater();\r\n ignore.value = false;\r\n };\r\n stop = watch(source, (...args) => {\r\n if (!ignore.value)\r\n filteredCb(...args);\r\n }, watchOptions);\r\n }\r\n else {\r\n // flush 'pre' and 'post'\r\n const disposables = [];\r\n // counters for how many following changes to be ignored\r\n // ignoreCounter is incremented before there is a history operation\r\n // affecting the source ref value (undo, redo, revert).\r\n // syncCounter is incremented in sync with every change to the\r\n // source ref value. This let us know how many times the ref\r\n // was modified and support chained sync operations. If there\r\n // are more sync triggers than the ignore count, the we now\r\n // there are modifications in the source ref value that we\r\n // need to commit\r\n const ignoreCounter = ref(0);\r\n const syncCounter = ref(0);\r\n ignorePrevAsyncUpdates = () => {\r\n ignoreCounter.value = syncCounter.value;\r\n };\r\n // Sync watch to count modifications to the source\r\n disposables.push(watch(source, () => {\r\n syncCounter.value++;\r\n }, Object.assign(Object.assign({}, watchOptions), { flush: 'sync' })));\r\n ignoreUpdates = (updater) => {\r\n // Call the updater function and count how many sync updates are performed,\r\n // then add them to the ignore count\r\n const syncCounterPrev = syncCounter.value;\r\n updater();\r\n ignoreCounter.value += syncCounter.value - syncCounterPrev;\r\n };\r\n disposables.push(watch(source, (...args) => {\r\n // If a history operation was performed (ignoreCounter > 0) and there are\r\n // no other changes to the source ref value afterwards, then ignore this commit\r\n const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;\r\n ignoreCounter.value = 0;\r\n syncCounter.value = 0;\r\n if (ignore)\r\n return;\r\n filteredCb(...args);\r\n }, watchOptions));\r\n stop = () => {\r\n disposables.forEach(fn => fn());\r\n };\r\n }\r\n return { stop, ignoreUpdates, ignorePrevAsyncUpdates };\r\n}\n\nfunction makeDestructurable(obj, arr) {\r\n if (typeof Symbol !== 'undefined') {\r\n const clone = Object.assign({}, obj);\r\n Object.defineProperty(clone, Symbol.iterator, {\r\n enumerable: false,\r\n value() {\r\n let index = 0;\r\n return {\r\n next: () => ({\r\n value: arr[index++],\r\n done: index > arr.length,\r\n }),\r\n };\r\n },\r\n });\r\n return clone;\r\n }\r\n else {\r\n return Object.assign([...arr], obj);\r\n }\r\n}\n\n// implementation\r\nfunction pausableWatch(source, cb, options = {}) {\r\n const { eventFilter: filter } = options, watchOptions = __rest(options, [\"eventFilter\"]);\r\n const { eventFilter, pause, resume, isActive } = pausableFilter(filter);\r\n const stop = watchWithFilter(source, cb, Object.assign(Object.assign({}, watchOptions), { eventFilter }));\r\n return { stop, pause, resume, isActive };\r\n}\n\n/**\r\n * Keep target ref(s) in sync with the source ref\r\n *\r\n * @param source source ref\r\n * @param targets\r\n */\r\nfunction syncRef(source, targets, { flush = 'sync', deep = false, immediate = true, } = {}) {\r\n if (!Array.isArray(targets))\r\n targets = [targets];\r\n return watch(source, (newValue) => {\r\n targets.forEach(target => target.value = newValue);\r\n }, {\r\n flush,\r\n deep,\r\n immediate,\r\n });\r\n}\n\n// implementation\r\nfunction throttledWatch(source, cb, options = {}) {\r\n const { throttle = 0 } = options, watchOptions = __rest(options, [\"throttle\"]);\r\n return watchWithFilter(source, cb, Object.assign(Object.assign({}, watchOptions), { eventFilter: throttleFilter(throttle) }));\r\n}\n\n/**\r\n * Call onMounted() if it's inside a component lifecycle, if not, run just call the function\r\n *\r\n * @param fn\r\n * @param sync if set to false, it will run in the nextTick() of Vue\r\n */\r\nfunction tryOnMounted(fn, sync = true) {\r\n if (getCurrentInstance())\r\n onMounted(fn);\r\n else if (sync)\r\n fn();\r\n else\r\n nextTick(fn);\r\n}\n\n/**\r\n * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing\r\n *\r\n * @param fn\r\n */\r\nfunction tryOnUnmounted(fn) {\r\n if (getCurrentInstance())\r\n onUnmounted(fn);\r\n}\n\n/**\r\n * Basic counter with utility functions.\r\n *\r\n * @see {@link https://vueuse.js.org/useCounter}\r\n * @param [initialValue=0]\r\n */\r\nfunction useCounter(initialValue = 0) {\r\n const count = ref(initialValue);\r\n const inc = (delta = 1) => (count.value += delta);\r\n const dec = (delta = 1) => (count.value -= delta);\r\n const get = () => count.value;\r\n const set = (val) => (count.value = val);\r\n const reset = (val = initialValue) => {\r\n initialValue = val;\r\n return set(val);\r\n };\r\n return { count, inc, dec, get, set, reset };\r\n}\n\n/**\r\n * Debounce execution of a function.\r\n *\r\n * @param fn A function to be executed after delay milliseconds debounced.\r\n * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\r\n *\r\n * @return A new, debounce, function.\r\n */\r\nfunction useDebounceFn(fn, ms = 200) {\r\n return createFilterWrapper(debounceFilter(ms), fn);\r\n}\n\nfunction useDebounce(value, ms = 200) {\r\n if (ms <= 0)\r\n return value;\r\n const debounced = ref(value.value);\r\n const updater = useDebounceFn(() => {\r\n debounced.value = value.value;\r\n }, ms);\r\n watch(value, () => updater());\r\n return debounced;\r\n}\n\n/**\r\n * Wrapper for `setInterval` with controls\r\n *\r\n * @param cb\r\n * @param interval\r\n * @param immediate\r\n */\r\nfunction useIntervalFn(cb, interval = 1000, immediate = true) {\r\n let timer = null;\r\n const isActive = ref(false);\r\n function clean() {\r\n if (timer) {\r\n clearInterval(timer);\r\n timer = null;\r\n }\r\n }\r\n function pause() {\r\n isActive.value = false;\r\n clean();\r\n }\r\n function resume() {\r\n isActive.value = true;\r\n clean();\r\n timer = setInterval(cb, interval);\r\n }\r\n if (immediate)\r\n resume();\r\n tryOnUnmounted(pause);\r\n return {\r\n isActive,\r\n pause,\r\n resume,\r\n start: resume,\r\n stop: pause,\r\n };\r\n}\n\nfunction useInterval(interval = 1000, immediate = true) {\r\n const counter = ref(0);\r\n return Object.assign({ counter }, useIntervalFn(() => counter.value += 1, interval, immediate));\r\n}\n\n/**\r\n * Throttle execution of a function. Especially useful for rate limiting\r\n * execution of handlers on events like resize and scroll.\r\n *\r\n * @param fn A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\r\n * to `callback` when the throttled-function is executed.\r\n * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\r\n *\r\n * @return A new, throttled, function.\r\n */\r\nfunction useThrottleFn(fn, ms = 200, trailing = true) {\r\n return createFilterWrapper(throttleFilter(ms, trailing), fn);\r\n}\n\n/**\r\n * Throttle execution of a function. Especially useful for rate limiting\r\n * execution of handlers on events like resize and scroll.\r\n *\r\n * @param delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\r\n */\r\nfunction useThrottle(value, delay = 200) {\r\n if (delay <= 0)\r\n return value;\r\n const throttled = ref(value.value);\r\n const updater = useThrottleFn(() => {\r\n throttled.value = value.value;\r\n }, delay);\r\n watch(value, () => updater());\r\n return throttled;\r\n}\n\n/**\r\n * Wrapper for `setTimeout` with controls.\r\n *\r\n * @param cb\r\n * @param interval\r\n * @param immediate\r\n */\r\nfunction useTimeoutFn(cb, interval, immediate) {\r\n const isActive = ref(false);\r\n let timer = null;\r\n function clear() {\r\n if (timer) {\r\n clearTimeout(timer);\r\n timer = null;\r\n }\r\n }\r\n function stop() {\r\n isActive.value = false;\r\n clear();\r\n }\r\n function start() {\r\n clear();\r\n isActive.value = true;\r\n timer = setTimeout(() => {\r\n timer = null;\r\n cb();\r\n }, interval);\r\n }\r\n if (immediate)\r\n start();\r\n tryOnUnmounted(stop);\r\n return {\r\n isActive,\r\n start,\r\n stop,\r\n };\r\n}\n\n/**\r\n * Update value after a given time with controls.\r\n *\r\n * @param interval\r\n * @param immediate\r\n */\r\nfunction useTimeout(interval = 1000, immediate = true) {\r\n const ready = ref(false);\r\n const controls = useTimeoutFn(() => ready.value = true, interval, immediate);\r\n function stop() {\r\n ready.value = false;\r\n controls.stop();\r\n }\r\n function start() {\r\n ready.value = false;\r\n controls.start();\r\n }\r\n return {\r\n ready,\r\n isActive: controls.isActive,\r\n start,\r\n stop,\r\n };\r\n}\n\n/**\r\n * A boolean ref with a toggler\r\n *\r\n * @see {@link https://vueuse.js.org/useToggle}\r\n * @param [initialValue=false]\r\n */\r\nfunction useToggle(initialValue = false) {\r\n const boolean = ref(initialValue);\r\n const toggle = () => (boolean.value = !boolean.value);\r\n return [boolean, toggle];\r\n}\n\nfunction when(r) {\r\n let isNot = false;\r\n function toMatch(condition, { flush = 'sync', deep = false, timeout, throwOnTimeout } = {}) {\r\n let stop = null;\r\n const watcher = new Promise((resolve) => {\r\n stop = watch(r, (v) => {\r\n if (condition(v) === !isNot) {\r\n stop === null || stop === void 0 ? void 0 : stop();\r\n resolve();\r\n }\r\n }, {\r\n flush,\r\n deep,\r\n immediate: true,\r\n });\r\n });\r\n const promises = [watcher];\r\n if (timeout) {\r\n promises.push(promiseTimeout(timeout, throwOnTimeout).finally(() => {\r\n stop === null || stop === void 0 ? void 0 : stop();\r\n }));\r\n }\r\n return Promise.race(promises);\r\n }\r\n function toBe(value, options) {\r\n return toMatch(v => v === unref(value), options);\r\n }\r\n function toBeTruthy(options) {\r\n return toMatch(v => Boolean(v), options);\r\n }\r\n function toBeNull(options) {\r\n return toBe(null, options);\r\n }\r\n function toBeUndefined(options) {\r\n return toBe(undefined, options);\r\n }\r\n function toBeNaN(options) {\r\n return toMatch(Number.isNaN, options);\r\n }\r\n function toContains(value, options) {\r\n return toMatch((v) => {\r\n const array = Array.from(v);\r\n return array.includes(value) || array.includes(unref(value));\r\n }, options);\r\n }\r\n function changed(options) {\r\n return changedTimes(1, options);\r\n }\r\n function changedTimes(n = 1, options) {\r\n let count = -1; // skip the immediate check\r\n return toMatch(() => {\r\n count += 1;\r\n return count >= n;\r\n }, options);\r\n }\r\n if (Array.isArray(unref(r))) {\r\n const instance = {\r\n toMatch,\r\n toContains,\r\n changed,\r\n changedTimes,\r\n get not() {\r\n isNot = !isNot;\r\n return this;\r\n },\r\n };\r\n return instance;\r\n }\r\n else {\r\n const instance = {\r\n toMatch,\r\n toBe,\r\n toBeTruthy,\r\n toBeNull,\r\n toBeNaN,\r\n toBeUndefined,\r\n changed,\r\n changedTimes,\r\n get not() {\r\n isNot = !isNot;\r\n return this;\r\n },\r\n };\r\n return instance;\r\n }\r\n}\n\nexport { assert, biSyncRef, bypassFilter, clamp, controlledComputed, createFilterWrapper, debounceFilter, debouncedWatch, extendRef, ignorableWatch, invoke, isBoolean, isClient, isDef, isFunction, isNumber, isObject, isString, isWindow, makeDestructurable, noop, now, pausableFilter, pausableWatch, promiseTimeout, syncRef, throttleFilter, throttledWatch, timestamp, tryOnMounted, tryOnUnmounted, useCounter, useDebounce, useDebounceFn, useInterval, useIntervalFn, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchWithFilter, when };\n","import { isRef, ref, watchEffect, computed, createApp, reactive, unref, watch, markRaw, getCurrentInstance, isVue3 } from 'vue-demi';\nimport { isClient, isString, tryOnUnmounted, tryOnMounted, createFilterWrapper, bypassFilter, throttleFilter, timestamp, watchWithFilter, isFunction, noop, pausableFilter, ignorableWatch, clamp } from '@vueuse/shared';\nexport * from '@vueuse/shared';\n\n/**\r\n * Create an asynchronous computed dependency.\r\n *\r\n * @see {@link https://vueuse.js.org/asyncComputed}\r\n * @param evaluationCallback The promise-returning callback which generates the computed value\r\n * @param initialState The initial state, used until the first evaluation finishes\r\n * @param optionsOrRef Additional options or a ref passed to receive the updates of the async evaluation\r\n */\r\nfunction asyncComputed(evaluationCallback, initialState, optionsOrRef) {\r\n let options;\r\n if (isRef(optionsOrRef)) {\r\n options = {\r\n evaluating: optionsOrRef,\r\n };\r\n }\r\n else {\r\n options = optionsOrRef !== null && optionsOrRef !== void 0 ? optionsOrRef : {};\r\n }\r\n const { lazy = false, evaluating = undefined, } = options;\r\n const started = ref(!lazy);\r\n const current = ref(initialState);\r\n let counter = 0;\r\n watchEffect(async (onInvalidate) => {\r\n if (!started.value)\r\n return;\r\n counter++;\r\n const counterAtBeginning = counter;\r\n let hasFinished = false;\r\n try {\r\n // Defer initial setting of `evaluating` ref\r\n // to avoid having it as a dependency\r\n if (evaluating) {\r\n Promise.resolve().then(() => {\r\n evaluating.value = true;\r\n });\r\n }\r\n const result = await evaluationCallback((cancelCallback) => {\r\n onInvalidate(() => {\r\n if (evaluating)\r\n evaluating.value = false;\r\n if (!hasFinished)\r\n cancelCallback();\r\n });\r\n });\r\n if (counterAtBeginning === counter)\r\n current.value = result;\r\n }\r\n finally {\r\n if (evaluating)\r\n evaluating.value = false;\r\n hasFinished = true;\r\n }\r\n });\r\n if (lazy) {\r\n return computed(() => {\r\n started.value = true;\r\n return current.value;\r\n });\r\n }\r\n else {\r\n return current;\r\n }\r\n}\n\nfunction withScope(factory) {\r\n const container = document.createElement('div');\r\n let state = null;\r\n createApp({\r\n setup() {\r\n state = reactive(factory());\r\n },\r\n render: () => null,\r\n }).mount(container);\r\n return state;\r\n}\r\n/**\r\n * Keep states in the global scope to be reusable across Vue instances.\r\n *\r\n * @see {@link https://vueuse.js.org/createGlobalState}\r\n * @param stateFactory A factory function to create the state\r\n */\r\nfunction createGlobalState(stateFactory) {\r\n let state;\r\n return () => {\r\n if (state == null)\r\n state = withScope(stateFactory);\r\n return state;\r\n };\r\n}\n\nconst defaultWindow = /* #__PURE__ */ isClient ? window : undefined;\r\nconst defaultDocument = /* #__PURE__ */ isClient ? window.document : undefined;\r\nconst defaultNavigator = /* #__PURE__ */ isClient ? window.navigator : undefined;\n\nfunction useEventListener(...args) {\r\n let target;\r\n let event;\r\n let listener;\r\n let options;\r\n if (isString(args[0])) {\r\n [event, listener, options] = args;\r\n target = defaultWindow;\r\n }\r\n else {\r\n [target, event, listener, options] = args;\r\n }\r\n if (!target)\r\n return;\r\n let stopped = false;\r\n target.addEventListener(event, listener, options);\r\n const stop = () => {\r\n if (stopped)\r\n return;\r\n target.removeEventListener(event, listener, options);\r\n stopped = true;\r\n };\r\n tryOnUnmounted(stop);\r\n return stop;\r\n}\n\nconst events = ['mousedown', 'touchstart'];\r\n/**\r\n * Listen for clicks outside of an element.\r\n *\r\n * @see {@link https://vueuse.js.org/onClickOutside}\r\n * @param target\r\n * @param handler\r\n * @param options\r\n */\r\nfunction onClickOutside(target, handler, options = {}) {\r\n const { window = defaultWindow } = options;\r\n if (!window)\r\n return;\r\n const targetRef = ref(target);\r\n const listener = (event) => {\r\n if (!targetRef.value)\r\n return;\r\n const elements = event.composedPath();\r\n if (targetRef.value === event.target || elements.includes(targetRef.value))\r\n return;\r\n handler(event);\r\n };\r\n let disposables = events\r\n .map(event => useEventListener(window, event, listener, { passive: true }));\r\n const stop = () => {\r\n disposables.forEach(stop => stop());\r\n disposables = [];\r\n };\r\n tryOnUnmounted(stop);\r\n return stop;\r\n}\n\n/* this implementation is original ported from https://github.com/streamich/react-use by Vadim Dalecky */\r\nconst isFocusedElementEditable = () => {\r\n const { activeElement, body } = document;\r\n if (!activeElement)\r\n return false;\r\n // If not element has focus, we assume it is not editable, too.\r\n if (activeElement === body)\r\n return false;\r\n // Assume and