{"version":3,"file":"widgets-49zrwfC0.js","sources":["../../../node_modules/vue-demi/lib/index.mjs","../../../node_modules/@vueuse/shared/dist/index.esm.js","../../../node_modules/@vueuse/core/dist/index.esm.js","../../../app/javascript/widget/social-media-share.vue","../../../app/javascript/widget/event-card.vue","../../../app/javascript/widget/events-card-deck.vue","../../../app/javascript/widget/events-filter.vue","../../../app/javascript/widget/events-view.vue","../../../app/javascript/widget/events-wrapper.vue","../../../app/javascript/entrypoints/widgets.js"],"sourcesContent":["import Vue from 'vue'\nimport { getCurrentInstance } from 'vue'\n\nvar isVue2 = true\nvar isVue3 = false\nvar Vue2 = Vue\nvar warn = Vue.util.warn\n\nfunction install() {}\n\n// createApp polyfill\nexport function createApp(rootComponent, rootProps) {\n var vm\n var provide = {}\n var app = {\n config: Vue.config,\n use: Vue.use.bind(Vue),\n mixin: Vue.mixin.bind(Vue),\n component: Vue.component.bind(Vue),\n provide: function (key, value) {\n provide[key] = value\n return this\n },\n directive: function (name, dir) {\n if (dir) {\n Vue.directive(name, dir)\n return app\n } else {\n return Vue.directive(name)\n }\n },\n mount: function (el, hydrating) {\n if (!vm) {\n vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))\n vm.$mount(el, hydrating)\n return vm\n } else {\n return vm\n }\n },\n unmount: function () {\n if (vm) {\n vm.$destroy()\n vm = undefined\n }\n },\n }\n return app\n}\n\nexport {\n Vue,\n Vue2,\n isVue2,\n isVue3,\n install,\n warn\n}\n\n// Vue 3 components mock\nfunction createMockComponent(name) {\n return {\n setup() {\n throw new Error('[vue-demi] ' + name + ' is not supported in Vue 2. It\\'s provided to avoid compiler errors.')\n }\n }\n}\nexport var Fragment = /*#__PURE__*/ createMockComponent('Fragment')\nexport var Transition = /*#__PURE__*/ createMockComponent('Transition')\nexport var TransitionGroup = /*#__PURE__*/ createMockComponent('TransitionGroup')\nexport var Teleport = /*#__PURE__*/ createMockComponent('Teleport')\nexport var Suspense = /*#__PURE__*/ createMockComponent('Suspense')\nexport var KeepAlive = /*#__PURE__*/ createMockComponent('KeepAlive')\n\nexport * from 'vue'\n\n// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()\nexport function hasInjectionContext() {\n return !!getCurrentInstance()\n}\n","import { computed, unref, watch, ref, customRef, isVue3, isRef, reactive, toRef, isVue2, getCurrentInstance, onMounted, nextTick, onUnmounted } from 'vue-demi';\n\n/**\r\n * `AND` conditions for refs.\r\n *\r\n * @see https://vueuse.org/and\r\n */\r\nfunction and(...args) {\r\n return computed(() => args.every(i => unref(i)));\r\n}\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 let v = undefined;\r\n let track;\r\n let trigger;\r\n const dirty = ref(true);\r\n watch(source, () => {\r\n dirty.value = true;\r\n trigger();\r\n }, { flush: 'sync' });\r\n return customRef((_track, _trigger) => {\r\n track = _track;\r\n trigger = _trigger;\r\n return {\r\n get() {\r\n if (dirty.value) {\r\n v = fn();\r\n dirty.value = false;\r\n }\r\n track();\r\n return v;\r\n },\r\n set() { },\r\n };\r\n });\r\n}\n\nfunction __onlyVue3(name = 'this function') {\r\n if (isVue3)\r\n return;\r\n throw new Error(`[VueUse] ${name} is only works on Vue 3.`);\r\n}\n\n// implementation\r\nfunction extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {\r\n __onlyVue3();\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\n/**\r\n * Explicitly define the deps of computed.\r\n *\r\n * @param source\r\n * @param fn\r\n */\r\nfunction controlledRef(initial, options = {}) {\r\n let source = initial;\r\n let track;\r\n let trigger;\r\n const ref = customRef((_track, _trigger) => {\r\n track = _track;\r\n trigger = _trigger;\r\n return {\r\n get() {\r\n return get();\r\n },\r\n set(v) {\r\n set(v);\r\n },\r\n };\r\n });\r\n function get(tracking = true) {\r\n if (tracking)\r\n track();\r\n return source;\r\n }\r\n function set(value, triggering = true) {\r\n var _a, _b;\r\n if (value === source)\r\n return;\r\n const old = source;\r\n if (((_a = options.onBeforeChange) === null || _a === void 0 ? void 0 : _a.call(options, value, old)) === false)\r\n return; // dismissed\r\n source = value;\r\n (_b = options.onChanged) === null || _b === void 0 ? void 0 : _b.call(options, value, old);\r\n if (triggering)\r\n trigger();\r\n }\r\n /**\r\n * Get the value without tracked in the reactivity system\r\n */\r\n const untrackedGet = () => get(false);\r\n /**\r\n * Set the value without triggering the reactivity system\r\n */\r\n const silentSet = (v) => set(v, false);\r\n /**\r\n * Get the value without tracked in the reactivity system.\r\n *\r\n * Alias for `untrackedGet()`\r\n */\r\n const peek = () => get(false);\r\n /**\r\n * Set the value without triggering the reactivity system\r\n *\r\n * Alias for `silentSet(v)`\r\n */\r\n const lay = (v) => set(v, false);\r\n return extendRef(ref, {\r\n get,\r\n set,\r\n untrackedGet,\r\n silentSet,\r\n peek,\r\n lay,\r\n }, { enumerable: true });\r\n}\n\n/**\r\n * The source code for this function was inspired by vue-apollo's `useEventHook` util\r\n * https://github.com/vuejs/vue-apollo/blob/v4/packages/vue-apollo-composable/src/util/useEventHook.ts\r\n */\r\n/**\r\n * Utility for creating event hooks\r\n *\r\n * @see https://vueuse.org/createEventHook\r\n */\r\nfunction createEventHook() {\r\n const fns = [];\r\n const off = (fn) => {\r\n const index = fns.indexOf(fn);\r\n if (index !== -1)\r\n fns.splice(index, 1);\r\n };\r\n const on = (fn) => {\r\n fns.push(fn);\r\n return {\r\n off: () => off(fn),\r\n };\r\n };\r\n const trigger = (param) => {\r\n fns.forEach(fn => fn(param));\r\n };\r\n return {\r\n on,\r\n off,\r\n trigger,\r\n };\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 let timer;\r\n const filter = (invoke) => {\r\n const duration = unref(ms);\r\n if (timer)\r\n clearTimeout(timer);\r\n if (duration <= 0)\r\n return invoke();\r\n timer = setTimeout(invoke, duration);\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 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 duration = unref(ms);\r\n const elapsed = Date.now() - lastExec;\r\n clear();\r\n if (duration <= 0) {\r\n lastExec = Date.now();\r\n return invoke();\r\n }\r\n if (elapsed > duration) {\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 }, duration);\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\n/**\r\n * Create singleton promise function\r\n *\r\n * @example\r\n * ```\r\n * const promise = createSingletonPromise(async () => { ... })\r\n *\r\n * await promise()\r\n * await promise() // all of them will be bind to a single promise instance\r\n * await promise() // and be resolved together\r\n * ```\r\n */\r\nfunction createSingletonPromise(fn) {\r\n let _promise;\r\n function wrapper() {\r\n if (!_promise)\r\n _promise = fn();\r\n return _promise;\r\n }\r\n wrapper.reset = async () => {\r\n const _prev = _promise;\r\n _promise = undefined;\r\n if (_prev)\r\n await _prev;\r\n };\r\n return wrapper;\r\n}\r\nfunction invoke(fn) {\r\n return fn();\r\n}\r\nfunction containsProp(obj, ...props) {\r\n return props.some(k => k in obj);\r\n}\r\nfunction increaseWithUnit(target, delta) {\r\n var _a;\r\n if (typeof target === 'number')\r\n return target + delta;\r\n const value = ((_a = target.match(/^-?[0-9]+\\.?[0-9]*/)) === null || _a === void 0 ? void 0 : _a[0]) || '';\r\n const unit = target.slice(value.length);\r\n const result = (parseFloat(value) + delta);\r\n if (Number.isNaN(result))\r\n return target;\r\n return result + unit;\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\nfunction get(obj, key) {\r\n if (key == null)\r\n return unref(obj);\r\n return unref(obj)[key];\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/**\r\n * `NOT` conditions for refs.\r\n *\r\n * @see https://vueuse.org/not\r\n */\r\nfunction not(v) {\r\n return computed(() => !unref(v));\r\n}\n\n/**\r\n * `OR` conditions for refs.\r\n *\r\n * @see https://vueuse.org/or\r\n */\r\nfunction or(...args) {\r\n return computed(() => args.some(i => unref(i)));\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 * Converts plain function into a reactive function.\r\n * The converted function accepts refs as it's arguments\r\n * and returns a ComputedRef, with proper typing.\r\n *\r\n * @param fn - Source function\r\n */\r\nfunction reactify(fn) {\r\n return function (...args) {\r\n return computed(() => fn.apply(this, args.map(i => unref(i))));\r\n };\r\n}\n\nfunction reactifyObject(obj, optionsOrKeys = {}) {\r\n let keys = [];\r\n if (Array.isArray(optionsOrKeys)) {\r\n keys = optionsOrKeys;\r\n }\r\n else {\r\n const { includeOwnProperties = true } = optionsOrKeys;\r\n keys.push(...Object.keys(obj));\r\n if (includeOwnProperties)\r\n keys.push(...Object.getOwnPropertyNames(obj));\r\n }\r\n return Object.fromEntries(keys\r\n .map((key) => {\r\n const value = obj[key];\r\n return [\r\n key,\r\n typeof value === 'function'\r\n ? reactify(value.bind(obj))\r\n : value,\r\n ];\r\n }));\r\n}\n\n/**\r\n * Reactively pick fields from a reactive object\r\n *\r\n * @see https://vueuse.js.org/reactivePick\r\n */\r\nfunction reactivePick(obj, ...keys) {\r\n return reactive(Object.fromEntries(keys.map(k => [k, toRef(obj, k)])));\r\n}\n\n/**\r\n * Shorthand for `ref.value = x`\r\n */\r\nfunction set(...args) {\r\n if (args.length === 2) {\r\n const [ref, value] = args;\r\n ref.value = value;\r\n }\r\n if (args.length === 3) {\r\n if (isVue2) {\r\n // use @vue/composition-api's set API\r\n require('vue-demi').set(...args);\r\n }\r\n else {\r\n const [target, key, value] = args;\r\n target[key] = value;\r\n }\r\n }\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\nfunction until(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}\r\n/**\r\n * @deprecated `when` is renamed to `util`, use `until` instead. This will be removed in next major version.\r\n */\r\nconst when = until;\n\n/**\r\n * Basic counter with utility functions.\r\n *\r\n * @see https://vueuse.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 if (interval <= 0)\r\n return;\r\n isActive.value = true;\r\n clean();\r\n timer = setInterval(cb, interval);\r\n }\r\n if (immediate && isClient)\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\nfunction useLastChanged(source, options = {}) {\r\n var _a;\r\n const ms = ref((_a = options.initialValue) !== null && _a !== void 0 ? _a : null);\r\n watch(source, () => ms.value = timestamp(), options);\r\n return ms;\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 = true) {\r\n const isPending = 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 isPending.value = false;\r\n clear();\r\n }\r\n function start(...args) {\r\n clear();\r\n isPending.value = true;\r\n timer = setTimeout(() => {\r\n isPending.value = false;\r\n timer = null;\r\n // eslint-disable-next-line node/no-callback-literal\r\n cb(...args);\r\n }, interval);\r\n }\r\n if (immediate) {\r\n isPending.value = true;\r\n if (isClient)\r\n start();\r\n }\r\n tryOnUnmounted(stop);\r\n return {\r\n isPending,\r\n start,\r\n stop,\r\n isActive: isPending,\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\nfunction useToggle(initialValue = false) {\r\n if (isRef(initialValue)) {\r\n return () => (initialValue.value = !initialValue.value);\r\n }\r\n else {\r\n const boolean = ref(initialValue);\r\n const toggle = () => (boolean.value = !boolean.value);\r\n return [boolean, toggle];\r\n }\r\n}\n\n/**\r\n * Shorthand for watching value to be truthy\r\n *\r\n * @see https://vueuse.js.org/whenever\r\n */\r\nfunction whenever(source, cb, options) {\r\n return watch(source, (v) => { if (v)\r\n cb(); }, options);\r\n}\n\nexport { and, assert, biSyncRef, bypassFilter, clamp, containsProp, controlledComputed, controlledRef, createEventHook, createFilterWrapper, createSingletonPromise, debounceFilter, debouncedWatch, extendRef, get, ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isFunction, isNumber, isObject, isString, isWindow, makeDestructurable, noop, not, now, or, pausableFilter, pausableWatch, promiseTimeout, reactify, reactifyObject, reactivePick, set, syncRef, throttleFilter, throttledWatch, timestamp, tryOnMounted, tryOnUnmounted, until, useCounter, useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchWithFilter, when, whenever };\n","import { isRef, ref, watchEffect, computed, customRef, unref, createApp, reactive, watch, getCurrentInstance, onMounted, onUpdated, toRefs as toRefs$1, shallowRef, markRaw, readonly, isVue2 } from 'vue-demi';\nimport { isClient, isString, noop, tryOnUnmounted, promiseTimeout, increaseWithUnit, useTimeoutFn, watchWithFilter, tryOnMounted, createFilterWrapper, bypassFilter, createSingletonPromise, containsProp, createEventHook, throttleFilter, timestamp, isFunction, isObject, ignorableWatch, isNumber, useIntervalFn, pausableFilter, clamp, pausableWatch } from '@vueuse/shared';\nexport * from '@vueuse/shared';\n\n/**\r\n * Create an asynchronous computed dependency.\r\n *\r\n * @see https://vueuse.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 || {};\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\n/**\r\n * Create a ref which will be reset to the default value after some time.\r\n *\r\n * @see https://vueuse.org/autoResetRef\r\n * @param defaultValue The value which will be set.\r\n * @param afterMs A zero-or-greater delay in milliseconds.\r\n */\r\nfunction autoResetRef(defaultValue, afterMs = 10000) {\r\n return customRef((track, trigger) => {\r\n let value = defaultValue;\r\n let timer;\r\n const resetAfter = () => setTimeout(() => {\r\n value = defaultValue;\r\n trigger();\r\n }, unref(afterMs));\r\n return {\r\n get() {\r\n track();\r\n return value;\r\n },\r\n set(newValue) {\r\n value = newValue;\r\n trigger();\r\n clearTimeout(timer);\r\n timer = resetAfter();\r\n },\r\n };\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 withScope(factory) {\r\n let state = null;\r\n const document = defaultDocument;\r\n if (document) {\r\n const container = document.createElement('div');\r\n createApp({\r\n setup() {\r\n state = reactive(factory());\r\n },\r\n render: () => null,\r\n }).mount(container);\r\n }\r\n else {\r\n state = reactive(factory());\r\n }\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 https://vueuse.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\n/**\r\n * Get the dom element of a ref of element or Vue component instance\r\n *\r\n * @param elRef\r\n */\r\nfunction unrefElement(elRef) {\r\n var _a, _b;\r\n const plain = unref(elRef);\r\n return (_b = (_a = plain) === null || _a === void 0 ? void 0 : _a.$el) !== null && _b !== void 0 ? _b : plain;\r\n}\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 noop;\r\n let cleanup = noop;\r\n const stopWatch = watch(() => unref(target), (el) => {\r\n cleanup();\r\n if (!el)\r\n return;\r\n el.addEventListener(event, listener, options);\r\n cleanup = () => {\r\n el.removeEventListener(event, listener, options);\r\n cleanup = noop;\r\n };\r\n }, { immediate: true, flush: 'post' });\r\n const stop = () => {\r\n stopWatch();\r\n cleanup();\r\n };\r\n tryOnUnmounted(stop);\r\n return stop;\r\n}\n\n/**\r\n * Listen for clicks outside of an element.\r\n *\r\n * @see https://vueuse.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, event = 'pointerdown' } = options;\r\n if (!window)\r\n return;\r\n const listener = (event) => {\r\n const el = unrefElement(target);\r\n if (!el)\r\n return;\r\n if (el === event.target || event.composedPath().includes(el))\r\n return;\r\n handler(event);\r\n };\r\n return useEventListener(window, event, listener, { passive: true });\r\n}\n\nconst createKeyPredicate = (keyFilter) => typeof keyFilter === 'function'\r\n ? keyFilter\r\n : typeof keyFilter === 'string'\r\n ? (event) => event.key === keyFilter\r\n : keyFilter\r\n ? () => true\r\n : () => false;\r\n/**\r\n * Listen for keyboard keys being stroked.\r\n *\r\n * @see https://vueuse.org/onKeyStroke\r\n * @param key\r\n * @param handler\r\n * @param options\r\n */\r\nfunction onKeyStroke(key, handler, options = {}) {\r\n const { target = defaultWindow, eventName = 'keydown', passive = false } = options;\r\n const predicate = createKeyPredicate(key);\r\n const listener = (e) => {\r\n if (predicate(e))\r\n handler(e);\r\n };\r\n return useEventListener(target, eventName, listener, passive);\r\n}\r\n/**\r\n * Listen to the keydown event of the given key.\r\n *\r\n * @see https://vueuse.org/onKeyStroke\r\n * @param key\r\n * @param handler\r\n * @param options\r\n */\r\nfunction onKeyDown(key, handler, options = {}) {\r\n return onKeyStroke(key, handler, Object.assign(Object.assign({}, options), { eventName: 'keydown' }));\r\n}\r\n/**\r\n * Listen to the keypress event of the given key.\r\n *\r\n * @see https://vueuse.org/onKeyStroke\r\n * @param key\r\n * @param handler\r\n * @param options\r\n */\r\nfunction onKeyPressed(key, handler, options = {}) {\r\n return onKeyStroke(key, handler, Object.assign(Object.assign({}, options), { eventName: 'keypress' }));\r\n}\r\n/**\r\n * Listen to the keyup event of the given key.\r\n *\r\n * @see https://vueuse.org/onKeyStroke\r\n * @param key\r\n * @param handler\r\n * @param options\r\n */\r\nfunction onKeyUp(key, handler, options = {}) {\r\n return onKeyStroke(key, handler, Object.assign(Object.assign({}, options), { eventName: 'keyup' }));\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