mechanica 1.0.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.js","sources":["../../../node_modules/vuesix/src/utils/findParent.ts","../../../node_modules/vuesix/src/hooks/useClickOutside.ts","../../../node_modules/vuesix/src/utils/handleMove.ts","../../../node_modules/vuesix/src/hooks/useDraggableItem.ts","../../../node_modules/vuesix/src/utils/object.ts","../../../node_modules/vuesix/src/utils/multimap.ts","../../../node_modules/vuesix/src/hooks/useKeyDownLayer.ts","../../common/types.ts","../../common/components/BlocksList.vue","../../common/utils/passDefaultValue.ts","../../common/utils/blocks.ts","../../../node_modules/@vueuse/shared/index.mjs","../../../node_modules/@vueuse/core/index.mjs","../../common/components/VPopover.vue","../../common/components/VContextMenu.vue","../../common/components/ContentHierarchy.vue","../../common/components/HoverFrame.vue","../../common/components/VTabs.vue","../../common/components/VTabsPages.vue","../../common/components/VFormControl.vue","../../common/components/VInput.vue","../../common/components/icons/CollapseArrowIcon.vue","../../common/components/VCollapse.vue","../../common/components/icons/ArrowDownIcon.vue","../../common/components/VSelect.vue","../../common/components/JsonEditorArray.vue","../../common/components/icons/EmptyFileIcon.vue","../../common/components/icons/CloseMinIcon.vue","../../common/components/VImageUploader.vue","../../common/utils/lang.ts","../../common/components/JsonEditor.vue","../../common/components/icons/ChevronLeftIcon.vue","../../common/components/icons/ChevronRightIcon.vue","../../common/utils/controlComponent.ts","../src/editor/processState.ts","../src/editor/PageSelector.vue","../src/editor/EditorApp.vue","../src/editor/editor.ts"],"sourcesContent":["export const findParent = (el: HTMLElement, callback: (el: HTMLElement) => boolean): HTMLElement | null => {\r\n if (callback(el)) return el\r\n if (!el.parentElement) return null\r\n return findParent(el.parentElement, callback)\r\n}","import { Ref, ShallowRef, WatchSource, watch } from \"vue\"\r\nimport { findParent } from \"../utils/findParent\"\r\n\r\ntype Item = Ref<HTMLElement | undefined> | ShallowRef<HTMLElement | undefined>\r\n\r\nconst clickOnIgnore = (target: HTMLElement, ignoreEl?: Item | Item[]) => {\r\n if (!ignoreEl) return false\r\n return !!findParent(target, (el) => {\r\n if (!Array.isArray(ignoreEl)) return el === ignoreEl.value\r\n for (const item of ignoreEl) {\r\n if (item.value === el) return true\r\n }\r\n return false\r\n })\r\n}\r\n\r\n/** Listen click outside element if condition true */\r\nexport const useClickOutside = (condition: WatchSource, onClick: () => void, ignoreEl?: Item | Item[]) => {\r\n\r\n const clickOutside = (e: MouseEvent) => {\r\n if (clickOnIgnore(e.target as HTMLElement, ignoreEl)) return\r\n\r\n document.addEventListener(\"mouseup\", (e) => {\r\n if (clickOnIgnore(e.target as HTMLElement, ignoreEl)) return \r\n onClick()\r\n }, { once: true })\r\n }\r\n \r\n watch(condition, value => {\r\n setTimeout(() => {\r\n if (value) {\r\n document.addEventListener(\"mousedown\", clickOutside)\r\n } else {\r\n document.removeEventListener(\"mousedown\", clickOutside)\r\n }\r\n }, 50)\r\n }, { flush: \"post\" })\r\n}\r\n\r\nexport const useMouseDownOutside = (condition: WatchSource, onMouseDown: () => void, ignoreEl?: Item | Item[]) => {\r\n\r\n const clickOutside = (e: MouseEvent) => {\r\n if (e.defaultPrevented) return\r\n if (clickOnIgnore(e.target as HTMLElement, ignoreEl)) return\r\n onMouseDown()\r\n }\r\n\r\n watch(condition, value => {\r\n setTimeout(() => {\r\n if (value) {\r\n document.addEventListener(\"mousedown\", clickOutside)\r\n } else {\r\n document.removeEventListener(\"mousedown\", clickOutside)\r\n }\r\n }, 50)\r\n }, { flush: \"post\" })\r\n\r\n}","export const isTouchEvent = (e: MouseEvent | TouchEvent | Touch): e is TouchEvent => {\r\n return \"touches\" in e\r\n}\r\n\r\nexport function getPos(_e: MouseEvent | TouchEvent | Touch, relativeRect?: DOMRect, type?: MoveType, touchIndex = -1) {\r\n const e = isTouchEvent(_e)? _e.touches[touchIndex < 0? _e.touches.length-1: touchIndex]: _e\r\n if (!e) return { x: 0, y: 0 }\r\n\r\n if (relativeRect && type !== \"absolute\") {\r\n if (type === \"threejs\") {\r\n const _x = (e.clientX-relativeRect.left)/relativeRect.width * 2 - 1\r\n const _y = -(e.clientY-relativeRect.top)/relativeRect.height * 2 + 1\r\n return { x: _x, y: _y }\r\n } else {\r\n return { x: e.clientX - relativeRect.x, y: e.clientY - relativeRect.y }\r\n }\r\n } else {\r\n return { x: e.clientX, y: e.clientY }\r\n }\r\n}\r\n\r\nconst getTouch = (e: MouseEvent | TouchEvent, touchId: number | null) => {\r\n if (isTouchEvent(e) && touchId !== null) {\r\n for (let touch of e.touches) {\r\n if (touch.identifier === touchId) return touch\r\n }\r\n }\r\n return e\r\n}\r\n\r\nexport const clamp = (val: number, min: number, max: number) => {\r\n if (val > max) return max\r\n if (val < min) return min\r\n return val\r\n}\r\n\r\ntype HandleCallbackProps = {\r\n e: MouseEvent | TouchEvent\r\n pos: { x: number, y: number },\r\n deltaPos: { x: number, y: number },\r\n startPos: { x: number, y: number }\r\n}\r\n\r\ntype MoveType = \"relative\" | \"absolute\" | \"threejs\"\r\n\r\ntype HandleEventOpts = {\r\n onStart?: (props: HandleCallbackProps) => void\r\n onMove?: (props: HandleCallbackProps) => void,\r\n onEnd?: (props: HandleCallbackProps) => void,\r\n type?: MoveType,\r\n prevent?: boolean,\r\n threshold?: number,\r\n relativeRect?: DOMRect\r\n}\r\n\r\n/** Add document listener to track mouse move */\r\nexport function handleMove(e: TouchEvent | MouseEvent, { onStart, onMove, onEnd, relativeRect, type, prevent, threshold }: HandleEventOpts = {}) {\r\n\r\n const box = relativeRect ?? (e.currentTarget as HTMLElement).getBoundingClientRect()\r\n const touchId = isTouchEvent(e)? ((e.changedTouches[0] ?? e.touches[e.touches.length-1]).identifier): null\r\n\r\n const startPos = getPos(getTouch(e, touchId), box, type ?? \"absolute\")\r\n let lastPos = startPos\r\n\r\n let moving = false\r\n const move = (e: MouseEvent | TouchEvent) => {\r\n const pos = getPos(getTouch(e, touchId), box, type ?? \"absolute\")\r\n if (moving === false && threshold && Math.abs(pos.x - startPos.x) < threshold) {\r\n return\r\n }\r\n if (moving === false && threshold) {\r\n startPos.x = pos.x\r\n startPos.y = pos.y\r\n moving = true\r\n }\r\n if (!e.defaultPrevented && prevent !== false) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n }\r\n if (onMove){\r\n const deltaPos = { x: pos.x - lastPos.x, y: pos.y - lastPos.y}\r\n onMove({ e, pos, deltaPos, startPos })\r\n }\r\n lastPos = pos\r\n }\r\n\r\n const end = (e: MouseEvent | TouchEvent) => {\r\n if (isTouchEvent(e) && e.touches.length > 0 && e.changedTouches[0].identifier !== touchId) return\r\n if (!e.defaultPrevented && prevent !== false) {\r\n e.preventDefault()\r\n e.stopImmediatePropagation()\r\n }\r\n dispose(e)\r\n }\r\n\r\n\r\n const dispose = (e: MouseEvent | TouchEvent) => {\r\n\r\n document.removeEventListener(\"touchmove\", move)\r\n document.removeEventListener(\"mousemove\", move)\r\n document.removeEventListener(\"touchend\", end)\r\n document.removeEventListener(\"touchcancel\", end)\r\n document.removeEventListener(\"mouseup\", end)\r\n\r\n if (onEnd){\r\n const pos = getPos(getTouch(e, touchId), box, type ?? \"absolute\")\r\n if (pos.x === 0 && pos.y === 0) {\r\n onEnd({ e, pos: lastPos, startPos, deltaPos: { x: 0, y: 0 }})\r\n return\r\n }\r\n const deltaPos = { x: pos.x - lastPos.x, y: pos.y - lastPos.y}\r\n onEnd({ e, pos, startPos, deltaPos })\r\n }\r\n }\r\n\r\n if (onStart){\r\n onStart({ e, pos: startPos, deltaPos: { x: 0, y: 0 }, startPos })\r\n }\r\n move(e)\r\n \r\n if (isTouchEvent(e)) {\r\n document.addEventListener(\"touchmove\", move, { passive: prevent !== true })\r\n document.addEventListener(\"touchend\", end, { passive: prevent !== true })\r\n document.addEventListener(\"touchcancel\", end, { passive: prevent !== true })\r\n } else {\r\n document.addEventListener(\"mousemove\", move)\r\n document.addEventListener(\"mouseup\", end)\r\n }\r\n}\r\n\r\ntype HandleRotateCallbackProps = {\r\n angle: number\r\n deltaAngle: number,\r\n e: MouseEvent\r\n}\r\n\r\ntype HandleRotateEventOpts = {\r\n onStart?: (props: HandleRotateCallbackProps) => void\r\n onMove?: (props: HandleRotateCallbackProps) => void,\r\n onEnd?: (props: HandleRotateCallbackProps) => void\r\n}\r\n\r\nexport function handleAngleMove(e: any, center: { x: number, y: number }, { onStart, onMove, onEnd }: HandleRotateEventOpts = {}) {\r\n\r\n const startPos = getPos(e)\r\n let startAngle = Math.atan2(startPos.y - center.y, startPos.x - center.x) \r\n\r\n let lastAngle = 0\r\n const move = (e: any) => {\r\n const pos = getPos(e)\r\n const angle = (Math.atan2(pos.y - center.y, pos.x - center.x) - startAngle) / Math.PI * 180\r\n if (onMove)\r\n onMove({ angle, deltaAngle: angle-lastAngle, e })\r\n lastAngle = angle\r\n }\r\n\r\n const end = (e: any) => {\r\n const pos = getPos(e)\r\n const angle = (Math.atan2(pos.y - center.y, pos.x - center.x) - startAngle) / Math.PI * 180\r\n document.removeEventListener(\"touchmove\", move)\r\n document.removeEventListener(\"mousemove\", move)\r\n if (onEnd)\r\n onEnd({ angle, deltaAngle: angle-lastAngle, e })\r\n }\r\n\r\n move(e)\r\n if (onStart)\r\n onStart({ angle: 0, deltaAngle: 0, e })\r\n\r\n if (e.touches) {\r\n document.addEventListener(\"touchmove\", move)\r\n document.addEventListener(\"touchend\", end, { once: true })\r\n } else {\r\n document.addEventListener(\"mousemove\", move)\r\n document.addEventListener(\"mouseup\", end, { once: true })\r\n }\r\n}\r\n\r\n\r\ntype HandleScaleCallbackProps = {\r\n scale: number\r\n deltaScale: number\r\n}\r\n\r\ntype HandleScaleEventOpts = {\r\n onStart?: (props: HandleScaleCallbackProps) => void\r\n onMove?: (props: HandleScaleCallbackProps) => void,\r\n onEnd?: (props: HandleScaleCallbackProps) => void\r\n}\r\n\r\nexport function handleScaleMove(e: any, center: { x: number, y: number }, { onStart, onMove, onEnd }: HandleScaleEventOpts = {}) {\r\n\r\n const startPos = getPos(e)\r\n let startScale = Math.hypot(startPos.y - center.y, startPos.x - center.x)\r\n\r\n let lastScale = 1\r\n const move = (e: any) => {\r\n const pos = getPos(e)\r\n const scale = Math.hypot(pos.y - center.y, pos.x - center.x) / startScale\r\n if (onMove)\r\n onMove({ scale, deltaScale: scale/lastScale })\r\n lastScale = scale\r\n }\r\n\r\n const end = (e: any) => {\r\n const pos = getPos(e)\r\n const scale = Math.hypot(pos.y - center.y, pos.x - center.x) / startScale\r\n document.removeEventListener(\"touchmove\", move)\r\n document.removeEventListener(\"mousemove\", move)\r\n if (onEnd)\r\n onEnd({ scale, deltaScale: scale/lastScale })\r\n }\r\n\r\n move(e)\r\n if (onStart)\r\n onStart({ scale: 1, deltaScale: 1 })\r\n\r\n if (e.touches) {\r\n document.addEventListener(\"touchmove\", move)\r\n document.addEventListener(\"touchend\", end, { once: true })\r\n } else {\r\n document.addEventListener(\"mousemove\", move)\r\n document.addEventListener(\"mouseup\", end, { once: true })\r\n }\r\n}","import { handleMove } from \"../utils/handleMove\"\r\n\r\ntype DraggableOptions = {\r\n onStart?: (item: HTMLElement) => void,\r\n onMove?: (e: MouseEvent, item: HTMLElement) => void,\r\n onEnd?: (e: MouseEvent) => void,\r\n threshold?: number\r\n}\r\n\r\n/** Clone element and move it follow mouse */\r\nexport const useDraggableItem = () => {\r\n let clonedItem: HTMLElement | null\r\n\r\n const drag = (e: MouseEvent, options: DraggableOptions) => {\r\n if (clonedItem) {\r\n clonedItem.remove()\r\n clonedItem = null\r\n }\r\n \r\n const el = (e.currentTarget as HTMLButtonElement)\r\n const rect = el.getBoundingClientRect()\r\n const offset = { left: rect.left - e.clientX, top: rect.top - e.clientY }\r\n const width = el.clientWidth\r\n \r\n const onStart = () => {\r\n clonedItem = el.cloneNode(true) as HTMLElement\r\n clonedItem.setAttribute(\"style\", \"position: fixed; pointer-events: none;\")\r\n document.body.append(clonedItem)\r\n options.onStart?.(clonedItem)\r\n }\r\n const threshold = options.threshold ?? 10\r\n\r\n handleMove(e, {\r\n onMove({ e, pos, startPos }) {\r\n if (!clonedItem) {\r\n if (Math.abs(pos.x - startPos.x) > threshold || Math.abs(pos.y - startPos.y) > threshold) {\r\n onStart()\r\n }\r\n return\r\n }\r\n clonedItem.setAttribute(\r\n \"style\", \r\n `position: fixed; top: ${pos.y + offset.top}px; left: ${pos.x + offset.left}px; width: ${width}px; pointer-events: none;`\r\n )\r\n options.onMove?.(e as MouseEvent, clonedItem)\r\n },\r\n onEnd({ e }) {\r\n if (!clonedItem) return\r\n clonedItem.remove()\r\n clonedItem = null\r\n options.onEnd?.(e as MouseEvent)\r\n },\r\n type: \"absolute\"\r\n })\r\n }\r\n\r\n return drag\r\n}","\r\nexport const cloneDeep = <T>(obj: T): T => {\r\n if (typeof obj !== \"object\" || obj === null) return obj\r\n if (Array.isArray(obj)) {\r\n return [ ...obj.map(cloneDeep) ] as T\r\n }\r\n return Object.fromEntries(Object.entries(obj).map(([ key, value ]) => [ key, cloneDeep(value) ])) as T\r\n}\r\n\r\n/** Simple deep comparsion. If b has'n keys from a its equals */\r\nexport const isEqual = (a: any, b: any) => {\r\n if (a === b) return true\r\n if (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) return false\r\n\r\n if (Array.isArray(a)) {\r\n if (!Array.isArray(b) || a.length !== b.length) return false\r\n for (let i = 0; i < a.length; i++) {\r\n if (!isEqual(a[i], b[i])) return false\r\n }\r\n return true\r\n }\r\n\r\n for (let key in a) {\r\n if (!isEqual(a[key], b[key])) return false\r\n }\r\n return true\r\n}","/** Class for create two dimensial Map */\r\nexport class MultiMap<T, K> {\r\n _map = new Map<T, K[]>()\r\n\r\n get size() {\r\n return this._map.size\r\n }\r\n\r\n add(key: T, value: K) {\r\n const arr = this._map.get(key)\r\n if (!arr) {\r\n this._map.set(key, [ value ])\r\n } else {\r\n arr.push(value)\r\n }\r\n }\r\n\r\n remove(key: T, value: K) {\r\n const arr = this._map.get(key)\r\n if (!arr) return false\r\n const newArr = arr.filter(item => item !== value)\r\n if (newArr.length === arr.length) return false\r\n if (newArr.length === 0) {\r\n this._map.delete(key)\r\n } else {\r\n this._map.set(key, newArr)\r\n }\r\n return true\r\n }\r\n\r\n has(key: T) {\r\n return this._map.has(key)\r\n }\r\n\r\n get(key: T) {\r\n return this._map.get(key) || []\r\n }\r\n\r\n forEach(key: T, callback: (val: K) => void) {\r\n const arr = this._map.get(key)\r\n if (!arr) return\r\n arr.forEach(callback)\r\n }\r\n\r\n clear() {\r\n this._map.clear()\r\n }\r\n}\r\n","import { WatchSource, watch } from \"vue\";\r\nimport { MultiMap } from \"../utils/multimap\";\r\n\r\nconst listeners = new MultiMap<string, (e: KeyboardEvent) => void>()\r\nlet hasEvent = false\r\n\r\n/** Add layout for keydown event */\r\nexport const useKeyDownLayer = (key: string, watcher: WatchSource<boolean>, callback: () => void) => {\r\n\r\n const onKeyDown = (e: KeyboardEvent) => {\r\n if (!listeners.has(e.code)) return\r\n const _listeners = listeners.get(e.code)\r\n e.preventDefault()\r\n const callback = _listeners[_listeners.length-1]\r\n callback(e)\r\n }\r\n\r\n watch(watcher, (value) => {\r\n if (value) {\r\n listeners.add(key, callback)\r\n } else {\r\n listeners.remove(key, callback)\r\n }\r\n if (listeners.size > 0 && !hasEvent) {\r\n document.addEventListener(\"keydown\", onKeyDown)\r\n hasEvent = true\r\n }\r\n if (listeners.size === 0) {\r\n document.removeEventListener(\"keydown\", onKeyDown)\r\n hasEvent = false\r\n }\r\n }, { immediate: true })\r\n}","\r\nexport type Block = {\r\n id: string,\r\n name: string,\r\n isDev?: boolean,\r\n hidden?: boolean,\r\n group?: string,\r\n order?: number,\r\n props?: any,\r\n slots?: Record<string, any> \r\n}\r\n\r\nexport type ContentBlock = {\r\n id: string,\r\n blockId: string,\r\n data: any,\r\n children?: ContentBlock[] | Record<string, ContentBlock[]>\r\n}\r\n\r\nexport class BlockDropEvent extends Event {\r\n content: ContentBlock | null = null\r\n block: Block\r\n constructor(block: Block, content: ContentBlock | null = null) {\r\n super(\"blockdrop\", { bubbles: true })\r\n this.block = block\r\n this.content = content\r\n }\r\n}\r\n","<template>\r\n <div class=\"blocks-list\">\r\n <div v-for=\"group in groupBlocks\" class=\"page-editor-blocks__group\">\r\n <div class=\"title\">{{ groupNames[group.name] ?? group.name }}</div>\r\n <div class=\"blocks-list__blocks\">\r\n <button \r\n v-for=\"item in group.blocks\" \r\n class=\"blocks-list__block editor-component\" \r\n :key=\"item.id\" \r\n @mousedown=\"onItemMouseDown($event, item)\"\r\n >\r\n {{ item.name }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { computed, inject, Ref } from 'vue'\r\nimport { MultiMap, useDraggableItem } from 'vuesix'\r\nimport { Block, BlockDropEvent } from '../types'\r\n\r\nconst props = defineProps<{ blocks: Block[] }>()\r\n\r\nconst groupBlocks = computed(() => {\r\n const groups = new MultiMap<string, Block>()\r\n for (let block of props.blocks) {\r\n if (block.hidden || block.isDev) continue\r\n groups.add(block.group ?? 'default', block)\r\n }\r\n const output: Array<{ name: string, blocks: Block[] }> = []\r\n for (let [ groupName, blocks ] of groups._map) {\r\n blocks.sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\r\n output.push({ name: groupName, blocks: blocks })\r\n }\r\n return output\r\n})\r\nconst groupNames: Record<string, string> = {\r\n default: \"Доступные блоки\",\r\n layout: \"Макет\"\r\n}\r\n\r\nconst drag = useDraggableItem()\r\nconst dragMode = inject(\"dragMode\") as Ref<boolean>\r\n\r\nconst onItemMouseDown = (e: MouseEvent, item: any) => {\r\n drag(e, {\r\n onStart(item) {\r\n item.classList.add(\"drag\")\r\n document.body.classList.add(\"mousedrag\")\r\n dragMode.value = true\r\n },\r\n onEnd(e) {\r\n document.body.classList.remove(\"mousedrag\")\r\n e.target?.dispatchEvent(new BlockDropEvent(item))\r\n dragMode.value = false\r\n }\r\n })\r\n}\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.blocks-list\r\n .title\r\n font-size: 13px\r\n font-weight: 500\r\n color: var(--text-secondary-color)\r\n\r\n.blocks-list__blocks\r\n display: grid\r\n grid-template-columns: repeat(2, 1fr)\r\n margin-top: 6px\r\n gap: 8px\r\n margin-bottom: 16px\r\n\r\n.blocks-list__block.editor-component\r\n height: 60px\r\n background: none\r\n border: 1px solid var(--border-color)\r\n border-radius: 6px\r\n background-color: var(--blocks-color)\r\n font-size: 13px\r\n cursor: pointer\r\n z-index: 10000\r\n color: var(--text-secondary-color)\r\n font-weight: 500\r\n padding: 0 8px\r\n\r\n &:hover\r\n color: var(--text-color)\r\n\r\n &.drag\r\n color: var(--text-color)\r\n\r\n</style>","// import defaultImageSrc from '../assets/image-blob.png'\r\n\r\n// export { defaultImageSrc }\r\n\r\nexport const defaultImageSrc = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAAAUVBMVEUAAADy8vLy8vLy8vLy8vLv7+/v7+/x8fHz8/Py8vJtbW2fn5/h4eGvr6+wsLDq6uqoqKh+fn7Jycm4uLiOjo51dXWGhoaWlpbZ2dnAwMDY2NgSuPoLAAAACXRSTlMA38+/XyAQgH+A/hFhAAABBUlEQVRIx+3X3YqDMBCG4ala3XwxJv5E273/C90RlLAodBxPWup7IFF80BwYCRGVP7k5XFbQ3P1mVN3ujNkqdUmFUVdRpsc5mRNd+MLfhDu7LTxF2A/YbfQCbIHBbpqAIMBAb3ZyiP4lroF6I5frn4DrE9jBqXEPwCnxA2hZq3DdovUNawX2bPnOVff9ETwBD2NW7fgoxxbgZ626A+fEGGh4sOqIsWEtxlM6DZinz9oKcevT6YjIZtZC/Pvvwd3y/oc/DJemHyTYx7RkdEhjBwhWkpCWoQjYpYGHAuxH7DZ40dL7DHZb9/Z/jAtf+F1wrrcZVXpcUKnfGp3clHFFdpzmVUn0B/oSge0dVY8uAAAAAElFTkSuQmCC\"\r\n\r\nexport const getDefaultValue = (schema: any) => {\r\n if (schema.default) return schema.default\r\n if (schema.nullable) return null\r\n if (schema.type === 'object' && schema.format === 'image') {\r\n return { src: defaultImageSrc, previewSrc: defaultImageSrc }\r\n }\r\n if (schema.type === 'number' || schema.type === 'integer') return 0\r\n if (schema.type === 'object') return {}\r\n if (schema.type === 'array') return []\r\n if (schema.type === 'boolean') return false\r\n return \"\"\r\n}\r\n\r\n\r\nexport const passDefaultValue = (state: any, schema: any) => {\r\n if (!schema) return state\r\n if (schema.type === 'object' && state) {\r\n for (let key in schema.properties) {\r\n if (!(key in state) && !schema.required.includes(key)) continue\r\n state[key] = passDefaultValue(state[key], schema.properties[key])\r\n }\r\n }\r\n return state ?? getDefaultValue(schema)\r\n}","import { ContentBlock, Block } from \"../types\"\r\nimport { passDefaultValue } from \"./passDefaultValue\"\r\n\r\nexport const walkTree = (blocks: ContentBlock[], callback: (block: ContentBlock) => void) => {\r\n for (let block of blocks) {\r\n callback(block)\r\n if (!block.children) continue\r\n if (Array.isArray(block.children)) {\r\n walkTree(block.children, callback)\r\n } else {\r\n for (let value of Object.values(block.children)) {\r\n walkTree(value, callback)\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport const walkSchema = (\r\n obj: any, \r\n schema: Block[\"props\"], \r\n callback: (value: any, schema: any, key?: string, parent?: any, isRequired?: boolean) => void, \r\n) => { \r\n if (schema.type === \"object\") {\r\n if (!obj) {\r\n return\r\n }\r\n for (let [ key, value ] of Object.entries(obj)) {\r\n const childSchema = schema.properties[key]\r\n if (!childSchema) continue\r\n \r\n const isRequired = schema.required.includes(key)\r\n callback(value, childSchema, key, obj, isRequired)\r\n\r\n if (childSchema.type === 'array' || childSchema.type === 'object') {\r\n walkSchema(value, childSchema, callback)\r\n }\r\n }\r\n }\r\n\r\n if (schema.type === \"array\" && schema.items) {\r\n for (let value of obj) {\r\n callback(value, schema.items)\r\n if (schema.items.type === 'array' || schema.items.type === 'object') {\r\n walkSchema(value, schema.items, callback)\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport const findBlock = (blocks: ContentBlock[], callback: (block: ContentBlock) => boolean): ContentBlock | null => {\r\n for (let block of blocks) {\r\n if (callback(block)) {\r\n return block\r\n }\r\n if (!block.children) continue\r\n if (Array.isArray(block.children)) {\r\n const result = findBlock(block.children, callback)\r\n if (result) return result\r\n } else {\r\n for (let value of Object.values(block.children)) {\r\n const result = findBlock(value, callback)\r\n if (result) return result\r\n }\r\n }\r\n }\r\n return null\r\n}\r\n\r\nexport const hasSlots = (block: Block) => {\r\n return !!block.slots && Object.keys(block.slots).length > 0\r\n}\r\n\r\nexport const hasMultipleSlots = (block: Block) => {\r\n if (!block.slots || Object.keys(block.slots).length === 0) return false\r\n return Object.keys(block.slots).length > 1 || Object.keys(block.slots)[0] !== 'default'\r\n}\r\n\r\nexport const forEachChildren = (block: Block, content: ContentBlock, callback: (blocks: ContentBlock[]) => void) => {\r\n if (!hasSlots(block)) {\r\n /** ToDo - remove this delete method */\r\n if (content.children) {\r\n delete content.children\r\n }\r\n return\r\n }\r\n if (hasMultipleSlots(block)) {\r\n if (!content.children) content.children = {}\r\n if (Array.isArray(content.children)) content.children = { default: content.children }\r\n for (let key in block.slots) {\r\n if (!content.children[key]) content.children[key] = []\r\n callback(content.children[key])\r\n }\r\n } else {\r\n if (!content.children) content.children = []\r\n if (!Array.isArray(content.children)) content.children = content.children.default ?? []\r\n callback(content.children)\r\n }\r\n}\r\n\r\n\r\n/** Delete content block */\r\nexport const deleteBlock = (blocks: ContentBlock[], target: ContentBlock) => {\r\n\r\n let isDeleted = false\r\n walkTree(blocks, block => {\r\n if (!block.children) return\r\n if (Array.isArray(block.children)) {\r\n if (deleteFromArray(block.children, target)) {\r\n isDeleted = true\r\n }\r\n } else {\r\n for (let children of Object.values(block.children)) {\r\n if (deleteFromArray(children, target)) {\r\n isDeleted = true\r\n }\r\n }\r\n }\r\n })\r\n\r\n if (!isDeleted) {\r\n deleteFromArray(blocks, target)\r\n }\r\n}\r\n\r\nexport const createContentBlockChild = (blocksMap: Map<string, Block>, contentBlock: ContentBlock, parent: ContentBlock, index: number = -1) => {\r\n const parentBlock = blocksMap.get(parent.blockId)!\r\n if (!parentBlock.slots) return\r\n\r\n if (Object.keys(parentBlock.slots).length === 1 && Object.keys(parentBlock.slots)[0] === 'default') {\r\n if (!parent.children) parent.children = []\r\n if (!Array.isArray(parent.children)) parent.children = parent.children.default ?? []\r\n if (index < 0) {\r\n parent.children.push(contentBlock)\r\n } else {\r\n parent.children.splice(index, 0, contentBlock)\r\n }\r\n } else {\r\n if (!parent.children || Array.isArray(parent.children)) parent.children = {}\r\n if (index < 0) {\r\n const key = 'default' in parentBlock.slots? 'default': Object.keys(parentBlock.slots)[0]\r\n if (!parent.children[key]) parent.children[key] = []\r\n parent.children[key].push(contentBlock)\r\n } else {\r\n let startIndex = 0\r\n for (let children of Object.values(parent.children)) {\r\n if (index-startIndex <= children.length) {\r\n children.splice(index-startIndex, 0, contentBlock)\r\n }\r\n startIndex += children.length\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport const getBlockIndex = (parent: ContentBlock, target: ContentBlock) => {\r\n if (!parent.children) return -1\r\n if (Array.isArray(parent.children)) {\r\n return parent.children.indexOf(target)\r\n } else {\r\n let startIndex = 0\r\n for (let children of Object.values(parent.children)) {\r\n const index = children.indexOf(target)\r\n if (index >= 0) {\r\n return startIndex + index\r\n }\r\n startIndex += children.length\r\n }\r\n return -1\r\n }\r\n}\r\n\r\nexport const createContentBlock = (block: Block) => {\r\n const id = uid()\r\n return {\r\n id,\r\n blockId: block.id, \r\n data: {\r\n ...passDefaultValue({}, block.props),\r\n \"data-block-id\": id\r\n }\r\n }\r\n}\r\n\r\nconst deleteFromArray = <T>(arr: T[], item: T) => {\r\n const index = arr.indexOf(item)\r\n if (index < 0) return false\r\n arr.splice(index, 1)\r\n return true\r\n}\r\n\r\nexport const uid = () => {\r\n return Math.trunc(Math.random() * 100000).toString(16)\r\n}","import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, hasInjectionContext, inject, provide, isRef, unref, toValue as toValue$1, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue';\n\nfunction computedEager(fn, options) {\n var _a;\n const result = shallowRef();\n watchEffect(() => {\n result.value = fn();\n }, {\n ...options,\n flush: (_a = options == null ? undefined : options.flush) != null ? _a : \"sync\"\n });\n return readonly(result);\n}\n\nfunction computedWithControl(source, fn) {\n let v = undefined;\n let track;\n let trigger;\n const dirty = ref(true);\n const update = () => {\n dirty.value = true;\n trigger();\n };\n watch(source, update, { flush: \"sync\" });\n const get = typeof fn === \"function\" ? fn : fn.get;\n const set = typeof fn === \"function\" ? undefined : fn.set;\n const result = customRef((_track, _trigger) => {\n track = _track;\n trigger = _trigger;\n return {\n get() {\n if (dirty.value) {\n v = get(v);\n dirty.value = false;\n }\n track();\n return v;\n },\n set(v2) {\n set == null ? undefined : set(v2);\n }\n };\n });\n if (Object.isExtensible(result))\n result.trigger = update;\n return result;\n}\n\nfunction tryOnScopeDispose(fn) {\n if (getCurrentScope()) {\n onScopeDispose(fn);\n return true;\n }\n return false;\n}\n\nfunction createEventHook() {\n const fns = /* @__PURE__ */ new Set();\n const off = (fn) => {\n fns.delete(fn);\n };\n const clear = () => {\n fns.clear();\n };\n const on = (fn) => {\n fns.add(fn);\n const offFn = () => off(fn);\n tryOnScopeDispose(offFn);\n return {\n off: offFn\n };\n };\n const trigger = (...args) => {\n return Promise.all(Array.from(fns).map((fn) => fn(...args)));\n };\n return {\n on,\n off,\n trigger,\n clear\n };\n}\n\nfunction createGlobalState(stateFactory) {\n let initialized = false;\n let state;\n const scope = effectScope(true);\n return (...args) => {\n if (!initialized) {\n state = scope.run(() => stateFactory(...args));\n initialized = true;\n }\n return state;\n };\n}\n\nconst localProvidedStateMap = /* @__PURE__ */ new WeakMap();\n\nconst injectLocal = (...args) => {\n var _a;\n const key = args[0];\n const instance = (_a = getCurrentInstance()) == null ? undefined : _a.proxy;\n if (instance == null && !hasInjectionContext())\n throw new Error(\"injectLocal must be called in setup\");\n if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))\n return localProvidedStateMap.get(instance)[key];\n return inject(...args);\n};\n\nconst provideLocal = (key, value) => {\n var _a;\n const instance = (_a = getCurrentInstance()) == null ? undefined : _a.proxy;\n if (instance == null)\n throw new Error(\"provideLocal must be called in setup\");\n if (!localProvidedStateMap.has(instance))\n localProvidedStateMap.set(instance, /* @__PURE__ */ Object.create(null));\n const localProvidedState = localProvidedStateMap.get(instance);\n localProvidedState[key] = value;\n provide(key, value);\n};\n\nfunction createInjectionState(composable, options) {\n const key = (options == null ? undefined : options.injectionKey) || Symbol(composable.name || \"InjectionState\");\n const defaultValue = options == null ? undefined : options.defaultValue;\n const useProvidingState = (...args) => {\n const state = composable(...args);\n provideLocal(key, state);\n return state;\n };\n const useInjectedState = () => injectLocal(key, defaultValue);\n return [useProvidingState, useInjectedState];\n}\n\nfunction createSharedComposable(composable) {\n let subscribers = 0;\n let state;\n let scope;\n const dispose = () => {\n subscribers -= 1;\n if (scope && subscribers <= 0) {\n scope.stop();\n state = undefined;\n scope = undefined;\n }\n };\n return (...args) => {\n subscribers += 1;\n if (!scope) {\n scope = effectScope(true);\n state = scope.run(() => composable(...args));\n }\n tryOnScopeDispose(dispose);\n return state;\n };\n}\n\nfunction extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {\n for (const [key, value] of Object.entries(extend)) {\n if (key === \"value\")\n continue;\n if (isRef(value) && unwrap) {\n Object.defineProperty(ref, key, {\n get() {\n return value.value;\n },\n set(v) {\n value.value = v;\n },\n enumerable\n });\n } else {\n Object.defineProperty(ref, key, { value, enumerable });\n }\n }\n return ref;\n}\n\nfunction get(obj, key) {\n if (key == null)\n return unref(obj);\n return unref(obj)[key];\n}\n\nfunction isDefined(v) {\n return unref(v) != null;\n}\n\nfunction makeDestructurable(obj, arr) {\n if (typeof Symbol !== \"undefined\") {\n const clone = { ...obj };\n Object.defineProperty(clone, Symbol.iterator, {\n enumerable: false,\n value() {\n let index = 0;\n return {\n next: () => ({\n value: arr[index++],\n done: index > arr.length\n })\n };\n }\n });\n return clone;\n } else {\n return Object.assign([...arr], obj);\n }\n}\n\nfunction reactify(fn, options) {\n const unrefFn = (options == null ? undefined : options.computedGetter) === false ? unref : toValue$1;\n return function(...args) {\n return computed(() => fn.apply(this, args.map((i) => unrefFn(i))));\n };\n}\n\nfunction reactifyObject(obj, optionsOrKeys = {}) {\n let keys = [];\n let options;\n if (Array.isArray(optionsOrKeys)) {\n keys = optionsOrKeys;\n } else {\n options = optionsOrKeys;\n const { includeOwnProperties = true } = optionsOrKeys;\n keys.push(...Object.keys(obj));\n if (includeOwnProperties)\n keys.push(...Object.getOwnPropertyNames(obj));\n }\n return Object.fromEntries(\n keys.map((key) => {\n const value = obj[key];\n return [\n key,\n typeof value === \"function\" ? reactify(value.bind(obj), options) : value\n ];\n })\n );\n}\n\nfunction toReactive(objectRef) {\n if (!isRef(objectRef))\n return reactive(objectRef);\n const proxy = new Proxy({}, {\n get(_, p, receiver) {\n return unref(Reflect.get(objectRef.value, p, receiver));\n },\n set(_, p, value) {\n if (isRef(objectRef.value[p]) && !isRef(value))\n objectRef.value[p].value = value;\n else\n objectRef.value[p] = value;\n return true;\n },\n deleteProperty(_, p) {\n return Reflect.deleteProperty(objectRef.value, p);\n },\n has(_, p) {\n return Reflect.has(objectRef.value, p);\n },\n ownKeys() {\n return Object.keys(objectRef.value);\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true\n };\n }\n });\n return reactive(proxy);\n}\n\nfunction reactiveComputed(fn) {\n return toReactive(computed(fn));\n}\n\nfunction reactiveOmit(obj, ...keys) {\n const flatKeys = keys.flat();\n const predicate = flatKeys[0];\n return reactiveComputed(() => typeof predicate === \"function\" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => !predicate(toValue$1(v), k))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));\n}\n\nconst isClient = typeof window !== \"undefined\" && typeof document !== \"undefined\";\nconst isWorker = typeof WorkerGlobalScope !== \"undefined\" && globalThis instanceof WorkerGlobalScope;\nconst isDef = (val) => typeof val !== \"undefined\";\nconst notNullish = (val) => val != null;\nconst assert = (condition, ...infos) => {\n if (!condition)\n console.warn(...infos);\n};\nconst toString = Object.prototype.toString;\nconst isObject = (val) => toString.call(val) === \"[object Object]\";\nconst now = () => Date.now();\nconst timestamp = () => +Date.now();\nconst clamp = (n, min, max) => Math.min(max, Math.max(min, n));\nconst noop = () => {\n};\nconst rand = (min, max) => {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n};\nconst hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);\nconst isIOS = /* @__PURE__ */ getIsIOS();\nfunction getIsIOS() {\n var _a, _b;\n return isClient && ((_a = window == null ? undefined : window.navigator) == null ? undefined : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? undefined : window.navigator) == null ? undefined : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? undefined : window.navigator.userAgent));\n}\n\nfunction createFilterWrapper(filter, fn) {\n function wrapper(...args) {\n return new Promise((resolve, reject) => {\n Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);\n });\n }\n return wrapper;\n}\nconst bypassFilter = (invoke) => {\n return invoke();\n};\nfunction debounceFilter(ms, options = {}) {\n let timer;\n let maxTimer;\n let lastRejector = noop;\n const _clearTimeout = (timer2) => {\n clearTimeout(timer2);\n lastRejector();\n lastRejector = noop;\n };\n const filter = (invoke) => {\n const duration = toValue$1(ms);\n const maxDuration = toValue$1(options.maxWait);\n if (timer)\n _clearTimeout(timer);\n if (duration <= 0 || maxDuration !== undefined && maxDuration <= 0) {\n if (maxTimer) {\n _clearTimeout(maxTimer);\n maxTimer = null;\n }\n return Promise.resolve(invoke());\n }\n return new Promise((resolve, reject) => {\n lastRejector = options.rejectOnCancel ? reject : resolve;\n if (maxDuration && !maxTimer) {\n maxTimer = setTimeout(() => {\n if (timer)\n _clearTimeout(timer);\n maxTimer = null;\n resolve(invoke());\n }, maxDuration);\n }\n timer = setTimeout(() => {\n if (maxTimer)\n _clearTimeout(maxTimer);\n maxTimer = null;\n resolve(invoke());\n }, duration);\n });\n };\n return filter;\n}\nfunction throttleFilter(...args) {\n let lastExec = 0;\n let timer;\n let isLeading = true;\n let lastRejector = noop;\n let lastValue;\n let ms;\n let trailing;\n let leading;\n let rejectOnCancel;\n if (!isRef(args[0]) && typeof args[0] === \"object\")\n ({ delay: ms, trailing = true, leading = true, rejectOnCancel = false } = args[0]);\n else\n [ms, trailing = true, leading = true, rejectOnCancel = false] = args;\n const clear = () => {\n if (timer) {\n clearTimeout(timer);\n timer = undefined;\n lastRejector();\n lastRejector = noop;\n }\n };\n const filter = (_invoke) => {\n const duration = toValue$1(ms);\n const elapsed = Date.now() - lastExec;\n const invoke = () => {\n return lastValue = _invoke();\n };\n clear();\n if (duration <= 0) {\n lastExec = Date.now();\n return invoke();\n }\n if (elapsed > duration && (leading || !isLeading)) {\n lastExec = Date.now();\n invoke();\n } else if (trailing) {\n lastValue = new Promise((resolve, reject) => {\n lastRejector = rejectOnCancel ? reject : resolve;\n timer = setTimeout(() => {\n lastExec = Date.now();\n isLeading = true;\n resolve(invoke());\n clear();\n }, Math.max(0, duration - elapsed));\n });\n }\n if (!leading && !timer)\n timer = setTimeout(() => isLeading = true, duration);\n isLeading = false;\n return lastValue;\n };\n return filter;\n}\nfunction pausableFilter(extendFilter = bypassFilter) {\n const isActive = ref(true);\n function pause() {\n isActive.value = false;\n }\n function resume() {\n isActive.value = true;\n }\n const eventFilter = (...args) => {\n if (isActive.value)\n extendFilter(...args);\n };\n return { isActive: readonly(isActive), pause, resume, eventFilter };\n}\n\nfunction cacheStringFunction(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (str) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n };\n}\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, \"-$1\").toLowerCase());\nconst camelizeRE = /-(\\w)/g;\nconst camelize = cacheStringFunction((str) => {\n return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : \"\");\n});\n\nfunction promiseTimeout(ms, throwOnTimeout = false, reason = \"Timeout\") {\n return new Promise((resolve, reject) => {\n if (throwOnTimeout)\n setTimeout(() => reject(reason), ms);\n else\n setTimeout(resolve, ms);\n });\n}\nfunction identity(arg) {\n return arg;\n}\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = undefined;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction containsProp(obj, ...props) {\n return props.some((k) => k in obj);\n}\nfunction increaseWithUnit(target, delta) {\n var _a;\n if (typeof target === \"number\")\n return target + delta;\n const value = ((_a = target.match(/^-?\\d+\\.?\\d*/)) == null ? undefined : _a[0]) || \"\";\n const unit = target.slice(value.length);\n const result = Number.parseFloat(value) + delta;\n if (Number.isNaN(result))\n return target;\n return result + unit;\n}\nfunction pxValue(px) {\n return px.endsWith(\"rem\") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== undefined)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction objectOmit(obj, keys, omitUndefined = false) {\n return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {\n return (!omitUndefined || value !== undefined) && !keys.includes(key);\n }));\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction getLifeCycleTarget(target) {\n return target || getCurrentInstance();\n}\nfunction toArray(value) {\n return Array.isArray(value) ? value : [value];\n}\n\nfunction toRef(...args) {\n if (args.length !== 1)\n return toRef$1(...args);\n const r = args[0];\n return typeof r === \"function\" ? readonly(customRef(() => ({ get: r, set: noop }))) : ref(r);\n}\nconst resolveRef = toRef;\n\nfunction reactivePick(obj, ...keys) {\n const flatKeys = keys.flat();\n const predicate = flatKeys[0];\n return reactiveComputed(() => typeof predicate === \"function\" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue$1(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));\n}\n\nfunction refAutoReset(defaultValue, afterMs = 1e4) {\n return customRef((track, trigger) => {\n let value = toValue$1(defaultValue);\n let timer;\n const resetAfter = () => setTimeout(() => {\n value = toValue$1(defaultValue);\n trigger();\n }, toValue$1(afterMs));\n tryOnScopeDispose(() => {\n clearTimeout(timer);\n });\n return {\n get() {\n track();\n return value;\n },\n set(newValue) {\n value = newValue;\n trigger();\n clearTimeout(timer);\n timer = resetAfter();\n }\n };\n });\n}\n\nfunction useDebounceFn(fn, ms = 200, options = {}) {\n return createFilterWrapper(\n debounceFilter(ms, options),\n fn\n );\n}\n\nfunction refDebounced(value, ms = 200, options = {}) {\n const debounced = ref(value.value);\n const updater = useDebounceFn(() => {\n debounced.value = value.value;\n }, ms, options);\n watch(value, () => updater());\n return debounced;\n}\n\nfunction refDefault(source, defaultValue) {\n return computed({\n get() {\n var _a;\n return (_a = source.value) != null ? _a : defaultValue;\n },\n set(value) {\n source.value = value;\n }\n });\n}\n\nfunction useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {\n return createFilterWrapper(\n throttleFilter(ms, trailing, leading, rejectOnCancel),\n fn\n );\n}\n\nfunction refThrottled(value, delay = 200, trailing = true, leading = true) {\n if (delay <= 0)\n return value;\n const throttled = ref(value.value);\n const updater = useThrottleFn(() => {\n throttled.value = value.value;\n }, delay, trailing, leading);\n watch(value, () => updater());\n return throttled;\n}\n\nfunction refWithControl(initial, options = {}) {\n let source = initial;\n let track;\n let trigger;\n const ref = customRef((_track, _trigger) => {\n track = _track;\n trigger = _trigger;\n return {\n get() {\n return get();\n },\n set(v) {\n set(v);\n }\n };\n });\n function get(tracking = true) {\n if (tracking)\n track();\n return source;\n }\n function set(value, triggering = true) {\n var _a, _b;\n if (value === source)\n return;\n const old = source;\n if (((_a = options.onBeforeChange) == null ? undefined : _a.call(options, value, old)) === false)\n return;\n source = value;\n (_b = options.onChanged) == null ? undefined : _b.call(options, value, old);\n if (triggering)\n trigger();\n }\n const untrackedGet = () => get(false);\n const silentSet = (v) => set(v, false);\n const peek = () => get(false);\n const lay = (v) => set(v, false);\n return extendRef(\n ref,\n {\n get,\n set,\n untrackedGet,\n silentSet,\n peek,\n lay\n },\n { enumerable: true }\n );\n}\nconst controlledRef = refWithControl;\n\nfunction set(...args) {\n if (args.length === 2) {\n const [ref, value] = args;\n ref.value = value;\n }\n if (args.length === 3) {\n const [target, key, value] = args;\n target[key] = value;\n }\n}\n\nfunction watchWithFilter(source, cb, options = {}) {\n const {\n eventFilter = bypassFilter,\n ...watchOptions\n } = options;\n return watch(\n source,\n createFilterWrapper(\n eventFilter,\n cb\n ),\n watchOptions\n );\n}\n\nfunction watchPausable(source, cb, options = {}) {\n const {\n eventFilter: filter,\n ...watchOptions\n } = options;\n const { eventFilter, pause, resume, isActive } = pausableFilter(filter);\n const stop = watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter\n }\n );\n return { stop, pause, resume, isActive };\n}\n\nfunction syncRef(left, right, ...[options]) {\n const {\n flush = \"sync\",\n deep = false,\n immediate = true,\n direction = \"both\",\n transform = {}\n } = options || {};\n const watchers = [];\n const transformLTR = \"ltr\" in transform && transform.ltr || ((v) => v);\n const transformRTL = \"rtl\" in transform && transform.rtl || ((v) => v);\n if (direction === \"both\" || direction === \"ltr\") {\n watchers.push(watchPausable(\n left,\n (newValue) => {\n watchers.forEach((w) => w.pause());\n right.value = transformLTR(newValue);\n watchers.forEach((w) => w.resume());\n },\n { flush, deep, immediate }\n ));\n }\n if (direction === \"both\" || direction === \"rtl\") {\n watchers.push(watchPausable(\n right,\n (newValue) => {\n watchers.forEach((w) => w.pause());\n left.value = transformRTL(newValue);\n watchers.forEach((w) => w.resume());\n },\n { flush, deep, immediate }\n ));\n }\n const stop = () => {\n watchers.forEach((w) => w.stop());\n };\n return stop;\n}\n\nfunction syncRefs(source, targets, options = {}) {\n const {\n flush = \"sync\",\n deep = false,\n immediate = true\n } = options;\n targets = toArray(targets);\n return watch(\n source,\n (newValue) => targets.forEach((target) => target.value = newValue),\n { flush, deep, immediate }\n );\n}\n\nfunction toRefs(objectRef, options = {}) {\n if (!isRef(objectRef))\n return toRefs$1(objectRef);\n const result = Array.isArray(objectRef.value) ? Array.from({ length: objectRef.value.length }) : {};\n for (const key in objectRef.value) {\n result[key] = customRef(() => ({\n get() {\n return objectRef.value[key];\n },\n set(v) {\n var _a;\n const replaceRef = (_a = toValue$1(options.replaceRef)) != null ? _a : true;\n if (replaceRef) {\n if (Array.isArray(objectRef.value)) {\n const copy = [...objectRef.value];\n copy[key] = v;\n objectRef.value = copy;\n } else {\n const newObject = { ...objectRef.value, [key]: v };\n Object.setPrototypeOf(newObject, Object.getPrototypeOf(objectRef.value));\n objectRef.value = newObject;\n }\n } else {\n objectRef.value[key] = v;\n }\n }\n }));\n }\n return result;\n}\n\nconst toValue = toValue$1;\nconst resolveUnref = toValue$1;\n\nfunction tryOnBeforeMount(fn, sync = true, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onBeforeMount(fn, target);\n else if (sync)\n fn();\n else\n nextTick(fn);\n}\n\nfunction tryOnBeforeUnmount(fn, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onBeforeUnmount(fn, target);\n}\n\nfunction tryOnMounted(fn, sync = true, target) {\n const instance = getLifeCycleTarget();\n if (instance)\n onMounted(fn, target);\n else if (sync)\n fn();\n else\n nextTick(fn);\n}\n\nfunction tryOnUnmounted(fn, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onUnmounted(fn, target);\n}\n\nfunction createUntil(r, isNot = false) {\n function toMatch(condition, { flush = \"sync\", deep = false, timeout, throwOnTimeout } = {}) {\n let stop = null;\n const watcher = new Promise((resolve) => {\n stop = watch(\n r,\n (v) => {\n if (condition(v) !== isNot) {\n if (stop)\n stop();\n else\n nextTick(() => stop == null ? undefined : stop());\n resolve(v);\n }\n },\n {\n flush,\n deep,\n immediate: true\n }\n );\n });\n const promises = [watcher];\n if (timeout != null) {\n promises.push(\n promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => stop == null ? undefined : stop())\n );\n }\n return Promise.race(promises);\n }\n function toBe(value, options) {\n if (!isRef(value))\n return toMatch((v) => v === value, options);\n const { flush = \"sync\", deep = false, timeout, throwOnTimeout } = options != null ? options : {};\n let stop = null;\n const watcher = new Promise((resolve) => {\n stop = watch(\n [r, value],\n ([v1, v2]) => {\n if (isNot !== (v1 === v2)) {\n if (stop)\n stop();\n else\n nextTick(() => stop == null ? undefined : stop());\n resolve(v1);\n }\n },\n {\n flush,\n deep,\n immediate: true\n }\n );\n });\n const promises = [watcher];\n if (timeout != null) {\n promises.push(\n promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => {\n stop == null ? undefined : stop();\n return toValue$1(r);\n })\n );\n }\n return Promise.race(promises);\n }\n function toBeTruthy(options) {\n return toMatch((v) => Boolean(v), options);\n }\n function toBeNull(options) {\n return toBe(null, options);\n }\n function toBeUndefined(options) {\n return toBe(undefined, options);\n }\n function toBeNaN(options) {\n return toMatch(Number.isNaN, options);\n }\n function toContains(value, options) {\n return toMatch((v) => {\n const array = Array.from(v);\n return array.includes(value) || array.includes(toValue$1(value));\n }, options);\n }\n function changed(options) {\n return changedTimes(1, options);\n }\n function changedTimes(n = 1, options) {\n let count = -1;\n return toMatch(() => {\n count += 1;\n return count >= n;\n }, options);\n }\n if (Array.isArray(toValue$1(r))) {\n const instance = {\n toMatch,\n toContains,\n changed,\n changedTimes,\n get not() {\n return createUntil(r, !isNot);\n }\n };\n return instance;\n } else {\n const instance = {\n toMatch,\n toBe,\n toBeTruthy,\n toBeNull,\n toBeNaN,\n toBeUndefined,\n changed,\n changedTimes,\n get not() {\n return createUntil(r, !isNot);\n }\n };\n return instance;\n }\n}\nfunction until(r) {\n return createUntil(r);\n}\n\nfunction defaultComparator(value, othVal) {\n return value === othVal;\n}\nfunction useArrayDifference(...args) {\n var _a, _b;\n const list = args[0];\n const values = args[1];\n let compareFn = (_a = args[2]) != null ? _a : defaultComparator;\n const {\n symmetric = false\n } = (_b = args[3]) != null ? _b : {};\n if (typeof compareFn === \"string\") {\n const key = compareFn;\n compareFn = (value, othVal) => value[key] === othVal[key];\n }\n const diff1 = computed(() => toValue$1(list).filter((x) => toValue$1(values).findIndex((y) => compareFn(x, y)) === -1));\n if (symmetric) {\n const diff2 = computed(() => toValue$1(values).filter((x) => toValue$1(list).findIndex((y) => compareFn(x, y)) === -1));\n return computed(() => symmetric ? [...toValue$1(diff1), ...toValue$1(diff2)] : toValue$1(diff1));\n } else {\n return diff1;\n }\n}\n\nfunction useArrayEvery(list, fn) {\n return computed(() => toValue$1(list).every((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction useArrayFilter(list, fn) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).filter(fn));\n}\n\nfunction useArrayFind(list, fn) {\n return computed(() => toValue$1(\n toValue$1(list).find((element, index, array) => fn(toValue$1(element), index, array))\n ));\n}\n\nfunction useArrayFindIndex(list, fn) {\n return computed(() => toValue$1(list).findIndex((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction findLast(arr, cb) {\n let index = arr.length;\n while (index-- > 0) {\n if (cb(arr[index], index, arr))\n return arr[index];\n }\n return undefined;\n}\nfunction useArrayFindLast(list, fn) {\n return computed(() => toValue$1(\n !Array.prototype.findLast ? findLast(toValue$1(list), (element, index, array) => fn(toValue$1(element), index, array)) : toValue$1(list).findLast((element, index, array) => fn(toValue$1(element), index, array))\n ));\n}\n\nfunction isArrayIncludesOptions(obj) {\n return isObject(obj) && containsProp(obj, \"formIndex\", \"comparator\");\n}\nfunction useArrayIncludes(...args) {\n var _a;\n const list = args[0];\n const value = args[1];\n let comparator = args[2];\n let formIndex = 0;\n if (isArrayIncludesOptions(comparator)) {\n formIndex = (_a = comparator.fromIndex) != null ? _a : 0;\n comparator = comparator.comparator;\n }\n if (typeof comparator === \"string\") {\n const key = comparator;\n comparator = (element, value2) => element[key] === toValue$1(value2);\n }\n comparator = comparator != null ? comparator : (element, value2) => element === toValue$1(value2);\n return computed(() => toValue$1(list).slice(formIndex).some((element, index, array) => comparator(\n toValue$1(element),\n toValue$1(value),\n index,\n toValue$1(array)\n )));\n}\n\nfunction useArrayJoin(list, separator) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).join(toValue$1(separator)));\n}\n\nfunction useArrayMap(list, fn) {\n return computed(() => toValue$1(list).map((i) => toValue$1(i)).map(fn));\n}\n\nfunction useArrayReduce(list, reducer, ...args) {\n const reduceCallback = (sum, value, index) => reducer(toValue$1(sum), toValue$1(value), index);\n return computed(() => {\n const resolved = toValue$1(list);\n return args.length ? resolved.reduce(reduceCallback, typeof args[0] === \"function\" ? toValue$1(args[0]()) : toValue$1(args[0])) : resolved.reduce(reduceCallback);\n });\n}\n\nfunction useArraySome(list, fn) {\n return computed(() => toValue$1(list).some((element, index, array) => fn(toValue$1(element), index, array)));\n}\n\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueElementsBy(array, fn) {\n return array.reduce((acc, v) => {\n if (!acc.some((x) => fn(v, x, array)))\n acc.push(v);\n return acc;\n }, []);\n}\nfunction useArrayUnique(list, compareFn) {\n return computed(() => {\n const resolvedList = toValue$1(list).map((element) => toValue$1(element));\n return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);\n });\n}\n\nfunction useCounter(initialValue = 0, options = {}) {\n let _initialValue = unref(initialValue);\n const count = ref(initialValue);\n const {\n max = Number.POSITIVE_INFINITY,\n min = Number.NEGATIVE_INFINITY\n } = options;\n const inc = (delta = 1) => count.value = Math.max(Math.min(max, count.value + delta), min);\n const dec = (delta = 1) => count.value = Math.min(Math.max(min, count.value - delta), max);\n const get = () => count.value;\n const set = (val) => count.value = Math.max(min, Math.min(max, val));\n const reset = (val = _initialValue) => {\n _initialValue = val;\n return set(val);\n };\n return { count, inc, dec, get, set, reset };\n}\n\nconst REGEX_PARSE = /^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[T\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/i;\nconst 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;\nfunction defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {\n let m = hours < 12 ? \"AM\" : \"PM\";\n if (hasPeriod)\n m = m.split(\"\").reduce((acc, curr) => acc += `${curr}.`, \"\");\n return isLowercase ? m.toLowerCase() : m;\n}\nfunction formatOrdinal(num) {\n const suffixes = [\"th\", \"st\", \"nd\", \"rd\"];\n const v = num % 100;\n return num + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);\n}\nfunction formatDate(date, formatStr, options = {}) {\n var _a;\n const years = date.getFullYear();\n const month = date.getMonth();\n const days = date.getDate();\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n const milliseconds = date.getMilliseconds();\n const day = date.getDay();\n const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;\n const matches = {\n Yo: () => formatOrdinal(years),\n YY: () => String(years).slice(-2),\n YYYY: () => years,\n M: () => month + 1,\n Mo: () => formatOrdinal(month + 1),\n MM: () => `${month + 1}`.padStart(2, \"0\"),\n MMM: () => date.toLocaleDateString(toValue$1(options.locales), { month: \"short\" }),\n MMMM: () => date.toLocaleDateString(toValue$1(options.locales), { month: \"long\" }),\n D: () => String(days),\n Do: () => formatOrdinal(days),\n DD: () => `${days}`.padStart(2, \"0\"),\n H: () => String(hours),\n Ho: () => formatOrdinal(hours),\n HH: () => `${hours}`.padStart(2, \"0\"),\n h: () => `${hours % 12 || 12}`.padStart(1, \"0\"),\n ho: () => formatOrdinal(hours % 12 || 12),\n hh: () => `${hours % 12 || 12}`.padStart(2, \"0\"),\n m: () => String(minutes),\n mo: () => formatOrdinal(minutes),\n mm: () => `${minutes}`.padStart(2, \"0\"),\n s: () => String(seconds),\n so: () => formatOrdinal(seconds),\n ss: () => `${seconds}`.padStart(2, \"0\"),\n SSS: () => `${milliseconds}`.padStart(3, \"0\"),\n d: () => day,\n dd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"narrow\" }),\n ddd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"short\" }),\n dddd: () => date.toLocaleDateString(toValue$1(options.locales), { weekday: \"long\" }),\n A: () => meridiem(hours, minutes),\n AA: () => meridiem(hours, minutes, false, true),\n a: () => meridiem(hours, minutes, true),\n aa: () => meridiem(hours, minutes, true, true)\n };\n return formatStr.replace(REGEX_FORMAT, (match, $1) => {\n var _a2, _b;\n return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? undefined : _a2.call(matches)) != null ? _b : match;\n });\n}\nfunction normalizeDate(date) {\n if (date === null)\n return new Date(Number.NaN);\n if (date === undefined)\n return /* @__PURE__ */ new Date();\n if (date instanceof Date)\n return new Date(date);\n if (typeof date === \"string\" && !/Z$/i.test(date)) {\n const d = date.match(REGEX_PARSE);\n if (d) {\n const m = d[2] - 1 || 0;\n const ms = (d[7] || \"0\").substring(0, 3);\n return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);\n }\n }\n return new Date(date);\n}\nfunction useDateFormat(date, formatStr = \"HH:mm:ss\", options = {}) {\n return computed(() => formatDate(normalizeDate(toValue$1(date)), toValue$1(formatStr), options));\n}\n\nfunction useIntervalFn(cb, interval = 1e3, options = {}) {\n const {\n immediate = true,\n immediateCallback = false\n } = options;\n let timer = null;\n const isActive = ref(false);\n function clean() {\n if (timer) {\n clearInterval(timer);\n timer = null;\n }\n }\n function pause() {\n isActive.value = false;\n clean();\n }\n function resume() {\n const intervalValue = toValue$1(interval);\n if (intervalValue <= 0)\n return;\n isActive.value = true;\n if (immediateCallback)\n cb();\n clean();\n if (isActive.value)\n timer = setInterval(cb, intervalValue);\n }\n if (immediate && isClient)\n resume();\n if (isRef(interval) || typeof interval === \"function\") {\n const stopWatch = watch(interval, () => {\n if (isActive.value && isClient)\n resume();\n });\n tryOnScopeDispose(stopWatch);\n }\n tryOnScopeDispose(pause);\n return {\n isActive,\n pause,\n resume\n };\n}\n\nfunction useInterval(interval = 1e3, options = {}) {\n const {\n controls: exposeControls = false,\n immediate = true,\n callback\n } = options;\n const counter = ref(0);\n const update = () => counter.value += 1;\n const reset = () => {\n counter.value = 0;\n };\n const controls = useIntervalFn(\n callback ? () => {\n update();\n callback(counter.value);\n } : update,\n interval,\n { immediate }\n );\n if (exposeControls) {\n return {\n counter,\n reset,\n ...controls\n };\n } else {\n return counter;\n }\n}\n\nfunction useLastChanged(source, options = {}) {\n var _a;\n const ms = ref((_a = options.initialValue) != null ? _a : null);\n watch(\n source,\n () => ms.value = timestamp(),\n options\n );\n return ms;\n}\n\nfunction useTimeoutFn(cb, interval, options = {}) {\n const {\n immediate = true\n } = options;\n const isPending = ref(false);\n let timer = null;\n function clear() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n }\n function stop() {\n isPending.value = false;\n clear();\n }\n function start(...args) {\n clear();\n isPending.value = true;\n timer = setTimeout(() => {\n isPending.value = false;\n timer = null;\n cb(...args);\n }, toValue$1(interval));\n }\n if (immediate) {\n isPending.value = true;\n if (isClient)\n start();\n }\n tryOnScopeDispose(stop);\n return {\n isPending: readonly(isPending),\n start,\n stop\n };\n}\n\nfunction useTimeout(interval = 1e3, options = {}) {\n const {\n controls: exposeControls = false,\n callback\n } = options;\n const controls = useTimeoutFn(\n callback != null ? callback : noop,\n interval,\n options\n );\n const ready = computed(() => !controls.isPending.value);\n if (exposeControls) {\n return {\n ready,\n ...controls\n };\n } else {\n return ready;\n }\n}\n\nfunction useToNumber(value, options = {}) {\n const {\n method = \"parseFloat\",\n radix,\n nanToZero\n } = options;\n return computed(() => {\n let resolved = toValue$1(value);\n if (typeof method === \"function\")\n resolved = method(resolved);\n else if (typeof resolved === \"string\")\n resolved = Number[method](resolved, radix);\n if (nanToZero && Number.isNaN(resolved))\n resolved = 0;\n return resolved;\n });\n}\n\nfunction useToString(value) {\n return computed(() => `${toValue$1(value)}`);\n}\n\nfunction useToggle(initialValue = false, options = {}) {\n const {\n truthyValue = true,\n falsyValue = false\n } = options;\n const valueIsRef = isRef(initialValue);\n const _value = ref(initialValue);\n function toggle(value) {\n if (arguments.length) {\n _value.value = value;\n return _value.value;\n } else {\n const truthy = toValue$1(truthyValue);\n _value.value = _value.value === truthy ? toValue$1(falsyValue) : truthy;\n return _value.value;\n }\n }\n if (valueIsRef)\n return toggle;\n else\n return [_value, toggle];\n}\n\nfunction watchArray(source, cb, options) {\n let oldList = (options == null ? undefined : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : toValue$1(source)];\n return watch(source, (newList, _, onCleanup) => {\n const oldListRemains = Array.from({ length: oldList.length });\n const added = [];\n for (const obj of newList) {\n let found = false;\n for (let i = 0; i < oldList.length; i++) {\n if (!oldListRemains[i] && obj === oldList[i]) {\n oldListRemains[i] = true;\n found = true;\n break;\n }\n }\n if (!found)\n added.push(obj);\n }\n const removed = oldList.filter((_2, i) => !oldListRemains[i]);\n cb(newList, oldList, added, removed, onCleanup);\n oldList = [...newList];\n }, options);\n}\n\nfunction watchAtMost(source, cb, options) {\n const {\n count,\n ...watchOptions\n } = options;\n const current = ref(0);\n const stop = watchWithFilter(\n source,\n (...args) => {\n current.value += 1;\n if (current.value >= toValue$1(count))\n nextTick(() => stop());\n cb(...args);\n },\n watchOptions\n );\n return { count: current, stop };\n}\n\nfunction watchDebounced(source, cb, options = {}) {\n const {\n debounce = 0,\n maxWait = undefined,\n ...watchOptions\n } = options;\n return watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter: debounceFilter(debounce, { maxWait })\n }\n );\n}\n\nfunction watchDeep(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n deep: true\n }\n );\n}\n\nfunction watchIgnorable(source, cb, options = {}) {\n const {\n eventFilter = bypassFilter,\n ...watchOptions\n } = options;\n const filteredCb = createFilterWrapper(\n eventFilter,\n cb\n );\n let ignoreUpdates;\n let ignorePrevAsyncUpdates;\n let stop;\n if (watchOptions.flush === \"sync\") {\n const ignore = ref(false);\n ignorePrevAsyncUpdates = () => {\n };\n ignoreUpdates = (updater) => {\n ignore.value = true;\n updater();\n ignore.value = false;\n };\n stop = watch(\n source,\n (...args) => {\n if (!ignore.value)\n filteredCb(...args);\n },\n watchOptions\n );\n } else {\n const disposables = [];\n const ignoreCounter = ref(0);\n const syncCounter = ref(0);\n ignorePrevAsyncUpdates = () => {\n ignoreCounter.value = syncCounter.value;\n };\n disposables.push(\n watch(\n source,\n () => {\n syncCounter.value++;\n },\n { ...watchOptions, flush: \"sync\" }\n )\n );\n ignoreUpdates = (updater) => {\n const syncCounterPrev = syncCounter.value;\n updater();\n ignoreCounter.value += syncCounter.value - syncCounterPrev;\n };\n disposables.push(\n watch(\n source,\n (...args) => {\n const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;\n ignoreCounter.value = 0;\n syncCounter.value = 0;\n if (ignore)\n return;\n filteredCb(...args);\n },\n watchOptions\n )\n );\n stop = () => {\n disposables.forEach((fn) => fn());\n };\n }\n return { stop, ignoreUpdates, ignorePrevAsyncUpdates };\n}\n\nfunction watchImmediate(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n immediate: true\n }\n );\n}\n\nfunction watchOnce(source, cb, options) {\n const stop = watch(source, (...args) => {\n nextTick(() => stop());\n return cb(...args);\n }, options);\n return stop;\n}\n\nfunction watchThrottled(source, cb, options = {}) {\n const {\n throttle = 0,\n trailing = true,\n leading = true,\n ...watchOptions\n } = options;\n return watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter: throttleFilter(throttle, trailing, leading)\n }\n );\n}\n\nfunction watchTriggerable(source, cb, options = {}) {\n let cleanupFn;\n function onEffect() {\n if (!cleanupFn)\n return;\n const fn = cleanupFn;\n cleanupFn = undefined;\n fn();\n }\n function onCleanup(callback) {\n cleanupFn = callback;\n }\n const _cb = (value, oldValue) => {\n onEffect();\n return cb(value, oldValue, onCleanup);\n };\n const res = watchIgnorable(source, _cb, options);\n const { ignoreUpdates } = res;\n const trigger = () => {\n let res2;\n ignoreUpdates(() => {\n res2 = _cb(getWatchSources(source), getOldValue(source));\n });\n return res2;\n };\n return {\n ...res,\n trigger\n };\n}\nfunction getWatchSources(sources) {\n if (isReactive(sources))\n return sources;\n if (Array.isArray(sources))\n return sources.map((item) => toValue$1(item));\n return toValue$1(sources);\n}\nfunction getOldValue(source) {\n return Array.isArray(source) ? source.map(() => undefined) : undefined;\n}\n\nfunction whenever(source, cb, options) {\n const stop = watch(\n source,\n (v, ov, onInvalidate) => {\n if (v) {\n if (options == null ? undefined : options.once)\n nextTick(() => stop());\n cb(v, ov, onInvalidate);\n }\n },\n {\n ...options,\n once: false\n }\n );\n return stop;\n}\n\nexport { 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, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, 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, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toArray, 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 };\n","import { noop, makeDestructurable, camelize, isClient, toArray, isObject, tryOnScopeDispose, isIOS, notNullish, tryOnMounted, objectOmit, promiseTimeout, until, injectLocal, provideLocal, pxValue, increaseWithUnit, objectEntries, createSingletonPromise, useTimeoutFn, pausableWatch, toRef, createEventHook, computedWithControl, timestamp, pausableFilter, watchIgnorable, debounceFilter, bypassFilter, createFilterWrapper, toRefs, useIntervalFn, containsProp, hasOwn, throttleFilter, useDebounceFn, useThrottleFn, tryOnUnmounted, clamp, syncRef, objectPick, watchWithFilter, tryOnBeforeUnmount, identity, isDef, whenever, isWorker } from '@vueuse/shared';\nexport * from '@vueuse/shared';\nimport { isRef, ref, shallowRef, watchEffect, computed, inject, defineComponent, h, TransitionGroup, shallowReactive, Fragment, toValue, watch, getCurrentInstance, onMounted, customRef, onUpdated, readonly, reactive, hasInjectionContext, toRaw, nextTick, markRaw, unref, getCurrentScope, isReadonly, onBeforeUpdate } from 'vue';\n\nfunction computedAsync(evaluationCallback, initialState, optionsOrRef) {\n let options;\n if (isRef(optionsOrRef)) {\n options = {\n evaluating: optionsOrRef\n };\n } else {\n options = optionsOrRef || {};\n }\n const {\n lazy = false,\n evaluating = undefined,\n shallow = true,\n onError = noop\n } = options;\n const started = ref(!lazy);\n const current = shallow ? shallowRef(initialState) : ref(initialState);\n let counter = 0;\n watchEffect(async (onInvalidate) => {\n if (!started.value)\n return;\n counter++;\n const counterAtBeginning = counter;\n let hasFinished = false;\n if (evaluating) {\n Promise.resolve().then(() => {\n evaluating.value = true;\n });\n }\n try {\n const result = await evaluationCallback((cancelCallback) => {\n onInvalidate(() => {\n if (evaluating)\n evaluating.value = false;\n if (!hasFinished)\n cancelCallback();\n });\n });\n if (counterAtBeginning === counter)\n current.value = result;\n } catch (e) {\n onError(e);\n } finally {\n if (evaluating && counterAtBeginning === counter)\n evaluating.value = false;\n hasFinished = true;\n }\n });\n if (lazy) {\n return computed(() => {\n started.value = true;\n return current.value;\n });\n } else {\n return current;\n }\n}\n\nfunction computedInject(key, options, defaultSource, treatDefaultAsFactory) {\n let source = inject(key);\n if (defaultSource)\n source = inject(key, defaultSource);\n if (treatDefaultAsFactory)\n source = inject(key, defaultSource, treatDefaultAsFactory);\n if (typeof options === \"function\") {\n return computed((ctx) => options(source, ctx));\n } else {\n return computed({\n get: (ctx) => options.get(source, ctx),\n set: options.set\n });\n }\n}\n\nfunction createReusableTemplate(options = {}) {\n const {\n inheritAttrs = true\n } = options;\n const render = shallowRef();\n const define = /* #__PURE__ */ defineComponent({\n setup(_, { slots }) {\n return () => {\n render.value = slots.default;\n };\n }\n });\n const reuse = /* #__PURE__ */ defineComponent({\n inheritAttrs,\n setup(_, { attrs, slots }) {\n return () => {\n var _a;\n if (!render.value && process.env.NODE_ENV !== \"production\")\n throw new Error(\"[VueUse] Failed to find the definition of reusable template\");\n const vnode = (_a = render.value) == null ? undefined : _a.call(render, { ...keysToCamelKebabCase(attrs), $slots: slots });\n return inheritAttrs && (vnode == null ? undefined : vnode.length) === 1 ? vnode[0] : vnode;\n };\n }\n });\n return makeDestructurable(\n { define, reuse },\n [define, reuse]\n );\n}\nfunction keysToCamelKebabCase(obj) {\n const newObj = {};\n for (const key in obj)\n newObj[camelize(key)] = obj[key];\n return newObj;\n}\n\nfunction createTemplatePromise(options = {}) {\n let index = 0;\n const instances = ref([]);\n function create(...args) {\n const props = shallowReactive({\n key: index++,\n args,\n promise: undefined,\n resolve: () => {\n },\n reject: () => {\n },\n isResolving: false,\n options\n });\n instances.value.push(props);\n props.promise = new Promise((_resolve, _reject) => {\n props.resolve = (v) => {\n props.isResolving = true;\n return _resolve(v);\n };\n props.reject = _reject;\n }).finally(() => {\n props.promise = undefined;\n const index2 = instances.value.indexOf(props);\n if (index2 !== -1)\n instances.value.splice(index2, 1);\n });\n return props.promise;\n }\n function start(...args) {\n if (options.singleton && instances.value.length > 0)\n return instances.value[0].promise;\n return create(...args);\n }\n const component = /* #__PURE__ */ defineComponent((_, { slots }) => {\n const renderList = () => instances.value.map((props) => {\n var _a;\n return h(Fragment, { key: props.key }, (_a = slots.default) == null ? undefined : _a.call(slots, props));\n });\n if (options.transition)\n return () => h(TransitionGroup, options.transition, renderList);\n return renderList;\n });\n component.start = start;\n return component;\n}\n\nfunction createUnrefFn(fn) {\n return function(...args) {\n return fn.apply(this, args.map((i) => toValue(i)));\n };\n}\n\nconst defaultWindow = isClient ? window : undefined;\nconst defaultDocument = isClient ? window.document : undefined;\nconst defaultNavigator = isClient ? window.navigator : undefined;\nconst defaultLocation = isClient ? window.location : undefined;\n\nfunction unrefElement(elRef) {\n var _a;\n const plain = toValue(elRef);\n return (_a = plain == null ? undefined : plain.$el) != null ? _a : plain;\n}\n\nfunction useEventListener(...args) {\n let target;\n let events;\n let listeners;\n let options;\n if (typeof args[0] === \"string\" || Array.isArray(args[0])) {\n [events, listeners, options] = args;\n target = defaultWindow;\n } else {\n [target, events, listeners, options] = args;\n }\n if (!target)\n return noop;\n events = toArray(events);\n listeners = toArray(listeners);\n const cleanups = [];\n const cleanup = () => {\n cleanups.forEach((fn) => fn());\n cleanups.length = 0;\n };\n const register = (el, event, listener, options2) => {\n el.addEventListener(event, listener, options2);\n return () => el.removeEventListener(event, listener, options2);\n };\n const stopWatch = watch(\n () => [unrefElement(target), toValue(options)],\n ([el, options2]) => {\n cleanup();\n if (!el)\n return;\n const optionsClone = isObject(options2) ? { ...options2 } : options2;\n cleanups.push(\n ...events.flatMap((event) => {\n return listeners.map((listener) => register(el, event, listener, optionsClone));\n })\n );\n },\n { immediate: true, flush: \"post\" }\n );\n const stop = () => {\n stopWatch();\n cleanup();\n };\n tryOnScopeDispose(stop);\n return stop;\n}\n\nlet _iOSWorkaround = false;\nfunction onClickOutside(target, handler, options = {}) {\n const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;\n if (!window)\n return noop;\n if (isIOS && !_iOSWorkaround) {\n _iOSWorkaround = true;\n Array.from(window.document.body.children).forEach((el) => el.addEventListener(\"click\", noop));\n window.document.documentElement.addEventListener(\"click\", noop);\n }\n let shouldListen = true;\n const shouldIgnore = (event) => {\n return toValue(ignore).some((target2) => {\n if (typeof target2 === \"string\") {\n return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));\n } else {\n const el = unrefElement(target2);\n return el && (event.target === el || event.composedPath().includes(el));\n }\n });\n };\n function hasMultipleRoots(target2) {\n const vm = toValue(target2);\n return vm && vm.$.subTree.shapeFlag === 16;\n }\n function checkMultipleRoots(target2, event) {\n const vm = toValue(target2);\n const children = vm.$.subTree && vm.$.subTree.children;\n if (children == null || !Array.isArray(children))\n return false;\n return children.some((child) => child.el === event.target || event.composedPath().includes(child.el));\n }\n const listener = (event) => {\n const el = unrefElement(target);\n if (event.target == null)\n return;\n if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event))\n return;\n if (!el || el === event.target || event.composedPath().includes(el))\n return;\n if (event.detail === 0)\n shouldListen = !shouldIgnore(event);\n if (!shouldListen) {\n shouldListen = true;\n return;\n }\n handler(event);\n };\n let isProcessingClick = false;\n const cleanup = [\n useEventListener(window, \"click\", (event) => {\n if (!isProcessingClick) {\n isProcessingClick = true;\n setTimeout(() => {\n isProcessingClick = false;\n }, 0);\n listener(event);\n }\n }, { passive: true, capture }),\n useEventListener(window, \"pointerdown\", (e) => {\n const el = unrefElement(target);\n shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));\n }, { passive: true }),\n detectIframe && useEventListener(window, \"blur\", (event) => {\n setTimeout(() => {\n var _a;\n const el = unrefElement(target);\n if (((_a = window.document.activeElement) == null ? undefined : _a.tagName) === \"IFRAME\" && !(el == null ? undefined : el.contains(window.document.activeElement))) {\n handler(event);\n }\n }, 0);\n }, { passive: true })\n ].filter(Boolean);\n const stop = () => cleanup.forEach((fn) => fn());\n return stop;\n}\n\nfunction useMounted() {\n const isMounted = ref(false);\n const instance = getCurrentInstance();\n if (instance) {\n onMounted(() => {\n isMounted.value = true;\n }, instance);\n }\n return isMounted;\n}\n\nfunction useSupported(callback) {\n const isMounted = useMounted();\n return computed(() => {\n isMounted.value;\n return Boolean(callback());\n });\n}\n\nfunction useMutationObserver(target, callback, options = {}) {\n const { window = defaultWindow, ...mutationOptions } = options;\n let observer;\n const isSupported = useSupported(() => window && \"MutationObserver\" in window);\n const cleanup = () => {\n if (observer) {\n observer.disconnect();\n observer = undefined;\n }\n };\n const targets = computed(() => {\n const value = toValue(target);\n const items = toArray(value).map(unrefElement).filter(notNullish);\n return new Set(items);\n });\n const stopWatch = watch(\n () => targets.value,\n (targets2) => {\n cleanup();\n if (isSupported.value && targets2.size) {\n observer = new MutationObserver(callback);\n targets2.forEach((el) => observer.observe(el, mutationOptions));\n }\n },\n { immediate: true, flush: \"post\" }\n );\n const takeRecords = () => {\n return observer == null ? undefined : observer.takeRecords();\n };\n const stop = () => {\n stopWatch();\n cleanup();\n };\n tryOnScopeDispose(stop);\n return {\n isSupported,\n stop,\n takeRecords\n };\n}\n\nfunction onElementRemoval(target, callback, options = {}) {\n const {\n window = defaultWindow,\n document = window == null ? undefined : window.document,\n flush = \"sync\"\n } = options;\n if (!window || !document)\n return noop;\n let stopFn;\n const cleanupAndUpdate = (fn) => {\n stopFn == null ? undefined : stopFn();\n stopFn = fn;\n };\n const stopWatch = watchEffect(() => {\n const el = unrefElement(target);\n if (el) {\n const { stop } = useMutationObserver(\n document,\n (mutationsList) => {\n const targetRemoved = mutationsList.map((mutation) => [...mutation.removedNodes]).flat().some((node) => node === el || node.contains(el));\n if (targetRemoved) {\n callback(mutationsList);\n }\n },\n {\n window,\n childList: true,\n subtree: true\n }\n );\n cleanupAndUpdate(stop);\n }\n }, { flush });\n const stopHandle = () => {\n stopWatch();\n cleanupAndUpdate();\n };\n tryOnScopeDispose(stopHandle);\n return stopHandle;\n}\n\nfunction createKeyPredicate(keyFilter) {\n if (typeof keyFilter === \"function\")\n return keyFilter;\n else if (typeof keyFilter === \"string\")\n return (event) => event.key === keyFilter;\n else if (Array.isArray(keyFilter))\n return (event) => keyFilter.includes(event.key);\n return () => true;\n}\nfunction onKeyStroke(...args) {\n let key;\n let handler;\n let options = {};\n if (args.length === 3) {\n key = args[0];\n handler = args[1];\n options = args[2];\n } else if (args.length === 2) {\n if (typeof args[1] === \"object\") {\n key = true;\n handler = args[0];\n options = args[1];\n } else {\n key = args[0];\n handler = args[1];\n }\n } else {\n key = true;\n handler = args[0];\n }\n const {\n target = defaultWindow,\n eventName = \"keydown\",\n passive = false,\n dedupe = false\n } = options;\n const predicate = createKeyPredicate(key);\n const listener = (e) => {\n if (e.repeat && toValue(dedupe))\n return;\n if (predicate(e))\n handler(e);\n };\n return useEventListener(target, eventName, listener, passive);\n}\nfunction onKeyDown(key, handler, options = {}) {\n return onKeyStroke(key, handler, { ...options, eventName: \"keydown\" });\n}\nfunction onKeyPressed(key, handler, options = {}) {\n return onKeyStroke(key, handler, { ...options, eventName: \"keypress\" });\n}\nfunction onKeyUp(key, handler, options = {}) {\n return onKeyStroke(key, handler, { ...options, eventName: \"keyup\" });\n}\n\nconst DEFAULT_DELAY = 500;\nconst DEFAULT_THRESHOLD = 10;\nfunction onLongPress(target, handler, options) {\n var _a, _b;\n const elementRef = computed(() => unrefElement(target));\n let timeout;\n let posStart;\n let startTimestamp;\n let hasLongPressed = false;\n function clear() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n posStart = undefined;\n startTimestamp = undefined;\n hasLongPressed = false;\n }\n function onRelease(ev) {\n var _a2, _b2, _c;\n const [_startTimestamp, _posStart, _hasLongPressed] = [startTimestamp, posStart, hasLongPressed];\n clear();\n if (!(options == null ? undefined : options.onMouseUp) || !_posStart || !_startTimestamp)\n return;\n if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)\n return;\n if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)\n ev.preventDefault();\n if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)\n ev.stopPropagation();\n const dx = ev.x - _posStart.x;\n const dy = ev.y - _posStart.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n options.onMouseUp(ev.timeStamp - _startTimestamp, distance, _hasLongPressed);\n }\n function onDown(ev) {\n var _a2, _b2, _c, _d;\n if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)\n return;\n clear();\n if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)\n ev.preventDefault();\n if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)\n ev.stopPropagation();\n posStart = {\n x: ev.x,\n y: ev.y\n };\n startTimestamp = ev.timeStamp;\n timeout = setTimeout(\n () => {\n hasLongPressed = true;\n handler(ev);\n },\n (_d = options == null ? undefined : options.delay) != null ? _d : DEFAULT_DELAY\n );\n }\n function onMove(ev) {\n var _a2, _b2, _c, _d;\n if (((_a2 = options == null ? undefined : options.modifiers) == null ? undefined : _a2.self) && ev.target !== elementRef.value)\n return;\n if (!posStart || (options == null ? undefined : options.distanceThreshold) === false)\n return;\n if ((_b2 = options == null ? undefined : options.modifiers) == null ? undefined : _b2.prevent)\n ev.preventDefault();\n if ((_c = options == null ? undefined : options.modifiers) == null ? undefined : _c.stop)\n ev.stopPropagation();\n const dx = ev.x - posStart.x;\n const dy = ev.y - posStart.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n if (distance >= ((_d = options == null ? undefined : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))\n clear();\n }\n const listenerOptions = {\n capture: (_a = options == null ? undefined : options.modifiers) == null ? undefined : _a.capture,\n once: (_b = options == null ? undefined : options.modifiers) == null ? undefined : _b.once\n };\n const cleanup = [\n useEventListener(elementRef, \"pointerdown\", onDown, listenerOptions),\n useEventListener(elementRef, \"pointermove\", onMove, listenerOptions),\n useEventListener(elementRef, [\"pointerup\", \"pointerleave\"], onRelease, listenerOptions)\n ];\n const stop = () => cleanup.forEach((fn) => fn());\n return stop;\n}\n\nfunction isFocusedElementEditable() {\n const { activeElement, body } = document;\n if (!activeElement)\n return false;\n if (activeElement === body)\n return false;\n switch (activeElement.tagName) {\n case \"INPUT\":\n case \"TEXTAREA\":\n return true;\n }\n return activeElement.hasAttribute(\"contenteditable\");\n}\nfunction isTypedCharValid({\n keyCode,\n metaKey,\n ctrlKey,\n altKey\n}) {\n if (metaKey || ctrlKey || altKey)\n return false;\n if (keyCode >= 48 && keyCode <= 57)\n return true;\n if (keyCode >= 65 && keyCode <= 90)\n return true;\n if (keyCode >= 97 && keyCode <= 122)\n return true;\n return false;\n}\nfunction onStartTyping(callback, options = {}) {\n const { document: document2 = defaultDocument } = options;\n const keydown = (event) => {\n if (!isFocusedElementEditable() && isTypedCharValid(event)) {\n callback(event);\n }\n };\n if (document2)\n useEventListener(document2, \"keydown\", keydown, { passive: true });\n}\n\nfunction templateRef(key, initialValue = null) {\n const instance = getCurrentInstance();\n let _trigger = () => {\n };\n const element = customRef((track, trigger) => {\n _trigger = trigger;\n return {\n get() {\n var _a, _b;\n track();\n return (_b = (_a = instance == null ? undefined : instance.proxy) == null ? undefined : _a.$refs[key]) != null ? _b : initialValue;\n },\n set() {\n }\n };\n });\n tryOnMounted(_trigger);\n onUpdated(_trigger);\n return element;\n}\n\nfunction useActiveElement(options = {}) {\n var _a;\n const {\n window = defaultWindow,\n deep = true,\n triggerOnRemoval = false\n } = options;\n const document = (_a = options.document) != null ? _a : window == null ? undefined : window.document;\n const getDeepActiveElement = () => {\n var _a2;\n let element = document == null ? undefined : document.activeElement;\n if (deep) {\n while (element == null ? undefined : element.shadowRoot)\n element = (_a2 = element == null ? undefined : element.shadowRoot) == null ? undefined : _a2.activeElement;\n }\n return element;\n };\n const activeElement = ref();\n const trigger = () => {\n activeElement.value = getDeepActiveElement();\n };\n if (window) {\n const listenerOptions = {\n capture: true,\n passive: true\n };\n useEventListener(\n window,\n \"blur\",\n (event) => {\n if (event.relatedTarget !== null)\n return;\n trigger();\n },\n listenerOptions\n );\n useEventListener(\n window,\n \"focus\",\n trigger,\n listenerOptions\n );\n }\n if (triggerOnRemoval) {\n onElementRemoval(activeElement, trigger, { document });\n }\n trigger();\n return activeElement;\n}\n\nfunction useRafFn(fn, options = {}) {\n const {\n immediate = true,\n fpsLimit = undefined,\n window = defaultWindow\n } = options;\n const isActive = ref(false);\n const intervalLimit = computed(() => {\n return fpsLimit ? 1e3 / toValue(fpsLimit) : null;\n });\n let previousFrameTimestamp = 0;\n let rafId = null;\n function loop(timestamp) {\n if (!isActive.value || !window)\n return;\n if (!previousFrameTimestamp)\n previousFrameTimestamp = timestamp;\n const delta = timestamp - previousFrameTimestamp;\n if (intervalLimit.value && delta < intervalLimit.value) {\n rafId = window.requestAnimationFrame(loop);\n return;\n }\n previousFrameTimestamp = timestamp;\n fn({ delta, timestamp });\n rafId = window.requestAnimationFrame(loop);\n }\n function resume() {\n if (!isActive.value && window) {\n isActive.value = true;\n previousFrameTimestamp = 0;\n rafId = window.requestAnimationFrame(loop);\n }\n }\n function pause() {\n isActive.value = false;\n if (rafId != null && window) {\n window.cancelAnimationFrame(rafId);\n rafId = null;\n }\n }\n if (immediate)\n resume();\n tryOnScopeDispose(pause);\n return {\n isActive: readonly(isActive),\n pause,\n resume\n };\n}\n\nfunction useAnimate(target, keyframes, options) {\n let config;\n let animateOptions;\n if (isObject(options)) {\n config = options;\n animateOptions = objectOmit(options, [\"window\", \"immediate\", \"commitStyles\", \"persist\", \"onReady\", \"onError\"]);\n } else {\n config = { duration: options };\n animateOptions = options;\n }\n const {\n window = defaultWindow,\n immediate = true,\n commitStyles,\n persist,\n playbackRate: _playbackRate = 1,\n onReady,\n onError = (e) => {\n console.error(e);\n }\n } = config;\n const isSupported = useSupported(() => window && HTMLElement && \"animate\" in HTMLElement.prototype);\n const animate = shallowRef(undefined);\n const store = shallowReactive({\n startTime: null,\n currentTime: null,\n timeline: null,\n playbackRate: _playbackRate,\n pending: false,\n playState: immediate ? \"idle\" : \"paused\",\n replaceState: \"active\"\n });\n const pending = computed(() => store.pending);\n const playState = computed(() => store.playState);\n const replaceState = computed(() => store.replaceState);\n const startTime = computed({\n get() {\n return store.startTime;\n },\n set(value) {\n store.startTime = value;\n if (animate.value)\n animate.value.startTime = value;\n }\n });\n const currentTime = computed({\n get() {\n return store.currentTime;\n },\n set(value) {\n store.currentTime = value;\n if (animate.value) {\n animate.value.currentTime = value;\n syncResume();\n }\n }\n });\n const timeline = computed({\n get() {\n return store.timeline;\n },\n set(value) {\n store.timeline = value;\n if (animate.value)\n animate.value.timeline = value;\n }\n });\n const playbackRate = computed({\n get() {\n return store.playbackRate;\n },\n set(value) {\n store.playbackRate = value;\n if (animate.value)\n animate.value.playbackRate = value;\n }\n });\n const play = () => {\n if (animate.value) {\n try {\n animate.value.play();\n syncResume();\n } catch (e) {\n syncPause();\n onError(e);\n }\n } else {\n update();\n }\n };\n const pause = () => {\n var _a;\n try {\n (_a = animate.value) == null ? void 0 : _a.pause();\n syncPause();\n } catch (e) {\n onError(e);\n }\n };\n const reverse = () => {\n var _a;\n if (!animate.value)\n update();\n try {\n (_a = animate.value) == null ? void 0 : _a.reverse();\n syncResume();\n } catch (e) {\n syncPause();\n onError(e);\n }\n };\n const finish = () => {\n var _a;\n try {\n (_a = animate.value) == null ? void 0 : _a.finish();\n syncPause();\n } catch (e) {\n onError(e);\n }\n };\n const cancel = () => {\n var _a;\n try {\n (_a = animate.value) == null ? void 0 : _a.cancel();\n syncPause();\n } catch (e) {\n onError(e);\n }\n };\n watch(() => unrefElement(target), (el) => {\n if (el)\n update();\n });\n watch(() => keyframes, (value) => {\n if (animate.value)\n update();\n if (!unrefElement(target) && animate.value) {\n animate.value.effect = new KeyframeEffect(\n unrefElement(target),\n toValue(value),\n animateOptions\n );\n }\n }, { deep: true });\n tryOnMounted(() => update(true), false);\n tryOnScopeDispose(cancel);\n function update(init) {\n const el = unrefElement(target);\n if (!isSupported.value || !el)\n return;\n if (!animate.value)\n animate.value = el.animate(toValue(keyframes), animateOptions);\n if (persist)\n animate.value.persist();\n if (_playbackRate !== 1)\n animate.value.playbackRate = _playbackRate;\n if (init && !immediate)\n animate.value.pause();\n else\n syncResume();\n onReady == null ? undefined : onReady(animate.value);\n }\n useEventListener(animate, [\"cancel\", \"finish\", \"remove\"], syncPause);\n useEventListener(animate, \"finish\", () => {\n var _a;\n if (commitStyles)\n (_a = animate.value) == null ? undefined : _a.commitStyles();\n });\n const { resume: resumeRef, pause: pauseRef } = useRafFn(() => {\n if (!animate.value)\n return;\n store.pending = animate.value.pending;\n store.playState = animate.value.playState;\n store.replaceState = animate.value.replaceState;\n store.startTime = animate.value.startTime;\n store.currentTime = animate.value.currentTime;\n store.timeline = animate.value.timeline;\n store.playbackRate = animate.value.playbackRate;\n }, { immediate: false });\n function syncResume() {\n if (isSupported.value)\n resumeRef();\n }\n function syncPause() {\n if (isSupported.value && window)\n window.requestAnimationFrame(pauseRef);\n }\n return {\n isSupported,\n animate,\n // actions\n play,\n pause,\n reverse,\n finish,\n cancel,\n // state\n pending,\n playState,\n replaceState,\n startTime,\n currentTime,\n timeline,\n playbackRate\n };\n}\n\nfunction useAsyncQueue(tasks, options) {\n const {\n interrupt = true,\n onError = noop,\n onFinished = noop,\n signal\n } = options || {};\n const promiseState = {\n aborted: \"aborted\",\n fulfilled: \"fulfilled\",\n pending: \"pending\",\n rejected: \"rejected\"\n };\n const initialResult = Array.from(Array.from({ length: tasks.length }), () => ({ state: promiseState.pending, data: null }));\n const result = reactive(initialResult);\n const activeIndex = ref(-1);\n if (!tasks || tasks.length === 0) {\n onFinished();\n return {\n activeIndex,\n result\n };\n }\n function updateResult(state, res) {\n activeIndex.value++;\n result[activeIndex.value].data = res;\n result[activeIndex.value].state = state;\n }\n tasks.reduce((prev, curr) => {\n return prev.then((prevRes) => {\n var _a;\n if (signal == null ? undefined : signal.aborted) {\n updateResult(promiseState.aborted, new Error(\"aborted\"));\n return;\n }\n if (((_a = result[activeIndex.value]) == null ? undefined : _a.state) === promiseState.rejected && interrupt) {\n onFinished();\n return;\n }\n const done = curr(prevRes).then((currentRes) => {\n updateResult(promiseState.fulfilled, currentRes);\n if (activeIndex.value === tasks.length - 1)\n onFinished();\n return currentRes;\n });\n if (!signal)\n return done;\n return Promise.race([done, whenAborted(signal)]);\n }).catch((e) => {\n if (signal == null ? undefined : signal.aborted) {\n updateResult(promiseState.aborted, e);\n return e;\n }\n updateResult(promiseState.rejected, e);\n onError();\n return e;\n });\n }, Promise.resolve());\n return {\n activeIndex,\n result\n };\n}\nfunction whenAborted(signal) {\n return new Promise((resolve, reject) => {\n const error = new Error(\"aborted\");\n if (signal.aborted)\n reject(error);\n else\n signal.addEventListener(\"abort\", () => reject(error), { once: true });\n });\n}\n\nfunction useAsyncState(promise, initialState, options) {\n const {\n immediate = true,\n delay = 0,\n onError = noop,\n onSuccess = noop,\n resetOnExecute = true,\n shallow = true,\n throwError\n } = options != null ? options : {};\n const state = shallow ? shallowRef(initialState) : ref(initialState);\n const isReady = ref(false);\n const isLoading = ref(false);\n const error = shallowRef(undefined);\n async function execute(delay2 = 0, ...args) {\n if (resetOnExecute)\n state.value = initialState;\n error.value = undefined;\n isReady.value = false;\n isLoading.value = true;\n if (delay2 > 0)\n await promiseTimeout(delay2);\n const _promise = typeof promise === \"function\" ? promise(...args) : promise;\n try {\n const data = await _promise;\n state.value = data;\n isReady.value = true;\n onSuccess(data);\n } catch (e) {\n error.value = e;\n onError(e);\n if (throwError)\n throw e;\n } finally {\n isLoading.value = false;\n }\n return state.value;\n }\n if (immediate) {\n execute(delay);\n }\n const shell = {\n state,\n isReady,\n isLoading,\n error,\n execute\n };\n function waitUntilIsLoaded() {\n return new Promise((resolve, reject) => {\n until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);\n });\n }\n return {\n ...shell,\n then(onFulfilled, onRejected) {\n return waitUntilIsLoaded().then(onFulfilled, onRejected);\n }\n };\n}\n\nconst defaults = {\n array: (v) => JSON.stringify(v),\n object: (v) => JSON.stringify(v),\n set: (v) => JSON.stringify(Array.from(v)),\n map: (v) => JSON.stringify(Object.fromEntries(v)),\n null: () => \"\"\n};\nfunction getDefaultSerialization(target) {\n if (!target)\n return defaults.null;\n if (target instanceof Map)\n return defaults.map;\n else if (target instanceof Set)\n return defaults.set;\n else if (Array.isArray(target))\n return defaults.array;\n else\n return defaults.object;\n}\n\nfunction useBase64(target, options) {\n const base64 = ref(\"\");\n const promise = ref();\n function execute() {\n if (!isClient)\n return;\n promise.value = new Promise((resolve, reject) => {\n try {\n const _target = toValue(target);\n if (_target == null) {\n resolve(\"\");\n } else if (typeof _target === \"string\") {\n resolve(blobToBase64(new Blob([_target], { type: \"text/plain\" })));\n } else if (_target instanceof Blob) {\n resolve(blobToBase64(_target));\n } else if (_target instanceof ArrayBuffer) {\n resolve(window.btoa(String.fromCharCode(...new Uint8Array(_target))));\n } else if (_target instanceof HTMLCanvasElement) {\n resolve(_target.toDataURL(options == null ? void 0 : options.type, options == null ? void 0 : options.quality));\n } else if (_target instanceof HTMLImageElement) {\n const img = _target.cloneNode(false);\n img.crossOrigin = \"Anonymous\";\n imgLoaded(img).then(() => {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n canvas.width = img.width;\n canvas.height = img.height;\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n resolve(canvas.toDataURL(options == null ? void 0 : options.type, options == null ? void 0 : options.quality));\n }).catch(reject);\n } else if (typeof _target === \"object\") {\n const _serializeFn = (options == null ? void 0 : options.serializer) || getDefaultSerialization(_target);\n const serialized = _serializeFn(_target);\n return resolve(blobToBase64(new Blob([serialized], { type: \"application/json\" })));\n } else {\n reject(new Error(\"target is unsupported types\"));\n }\n } catch (error) {\n reject(error);\n }\n });\n promise.value.then((res) => {\n base64.value = (options == null ? undefined : options.dataUrl) === false ? res.replace(/^data:.*?;base64,/, \"\") : res;\n });\n return promise.value;\n }\n if (isRef(target) || typeof target === \"function\")\n watch(target, execute, { immediate: true });\n else\n execute();\n return {\n base64,\n promise,\n execute\n };\n}\nfunction imgLoaded(img) {\n return new Promise((resolve, reject) => {\n if (!img.complete) {\n img.onload = () => {\n resolve();\n };\n img.onerror = reject;\n } else {\n resolve();\n }\n });\n}\nfunction blobToBase64(blob) {\n return new Promise((resolve, reject) => {\n const fr = new FileReader();\n fr.onload = (e) => {\n resolve(e.target.result);\n };\n fr.onerror = reject;\n fr.readAsDataURL(blob);\n });\n}\n\nfunction useBattery(options = {}) {\n const { navigator = defaultNavigator } = options;\n const events = [\"chargingchange\", \"chargingtimechange\", \"dischargingtimechange\", \"levelchange\"];\n const isSupported = useSupported(() => navigator && \"getBattery\" in navigator && typeof navigator.getBattery === \"function\");\n const charging = ref(false);\n const chargingTime = ref(0);\n const dischargingTime = ref(0);\n const level = ref(1);\n let battery;\n function updateBatteryInfo() {\n charging.value = this.charging;\n chargingTime.value = this.chargingTime || 0;\n dischargingTime.value = this.dischargingTime || 0;\n level.value = this.level;\n }\n if (isSupported.value) {\n navigator.getBattery().then((_battery) => {\n battery = _battery;\n updateBatteryInfo.call(battery);\n useEventListener(battery, events, updateBatteryInfo, { passive: true });\n });\n }\n return {\n isSupported,\n charging,\n chargingTime,\n dischargingTime,\n level\n };\n}\n\nfunction useBluetooth(options) {\n let {\n acceptAllDevices = false\n } = options || {};\n const {\n filters = undefined,\n optionalServices = undefined,\n navigator = defaultNavigator\n } = options || {};\n const isSupported = useSupported(() => navigator && \"bluetooth\" in navigator);\n const device = shallowRef();\n const error = shallowRef(null);\n watch(device, () => {\n connectToBluetoothGATTServer();\n });\n async function requestDevice() {\n if (!isSupported.value)\n return;\n error.value = null;\n if (filters && filters.length > 0)\n acceptAllDevices = false;\n try {\n device.value = await (navigator == null ? void 0 : navigator.bluetooth.requestDevice({\n acceptAllDevices,\n filters,\n optionalServices\n }));\n } catch (err) {\n error.value = err;\n }\n }\n const server = shallowRef();\n const isConnected = shallowRef(false);\n function reset() {\n isConnected.value = false;\n device.value = undefined;\n server.value = undefined;\n }\n async function connectToBluetoothGATTServer() {\n error.value = null;\n if (device.value && device.value.gatt) {\n device.value.addEventListener(\"gattserverdisconnected\", reset);\n try {\n server.value = await device.value.gatt.connect();\n isConnected.value = server.value.connected;\n } catch (err) {\n error.value = err;\n }\n }\n }\n tryOnMounted(() => {\n var _a;\n if (device.value)\n (_a = device.value.gatt) == null ? undefined : _a.connect();\n });\n tryOnScopeDispose(() => {\n var _a;\n if (device.value)\n (_a = device.value.gatt) == null ? undefined : _a.disconnect();\n });\n return {\n isSupported,\n isConnected: readonly(isConnected),\n // Device:\n device,\n requestDevice,\n // Server:\n server,\n // Errors:\n error\n };\n}\n\nconst ssrWidthSymbol = Symbol(\"vueuse-ssr-width\");\nfunction useSSRWidth() {\n const ssrWidth = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null;\n return typeof ssrWidth === \"number\" ? ssrWidth : undefined;\n}\nfunction provideSSRWidth(width, app) {\n if (app !== undefined) {\n app.provide(ssrWidthSymbol, width);\n } else {\n provideLocal(ssrWidthSymbol, width);\n }\n}\n\nfunction useMediaQuery(query, options = {}) {\n const { window = defaultWindow, ssrWidth = useSSRWidth() } = options;\n const isSupported = useSupported(() => window && \"matchMedia\" in window && typeof window.matchMedia === \"function\");\n const ssrSupport = ref(typeof ssrWidth === \"number\");\n let mediaQuery;\n const matches = ref(false);\n const handler = (event) => {\n matches.value = event.matches;\n };\n const cleanup = () => {\n if (!mediaQuery)\n return;\n if (\"removeEventListener\" in mediaQuery)\n mediaQuery.removeEventListener(\"change\", handler);\n else\n mediaQuery.removeListener(handler);\n };\n const stopWatch = watchEffect(() => {\n if (ssrSupport.value) {\n ssrSupport.value = !isSupported.value;\n const queryStrings = toValue(query).split(\",\");\n matches.value = queryStrings.some((queryString) => {\n const not = queryString.includes(\"not all\");\n const minWidth = queryString.match(/\\(\\s*min-width:\\s*(-?\\d+(?:\\.\\d*)?[a-z]+\\s*)\\)/);\n const maxWidth = queryString.match(/\\(\\s*max-width:\\s*(-?\\d+(?:\\.\\d*)?[a-z]+\\s*)\\)/);\n let res = Boolean(minWidth || maxWidth);\n if (minWidth && res) {\n res = ssrWidth >= pxValue(minWidth[1]);\n }\n if (maxWidth && res) {\n res = ssrWidth <= pxValue(maxWidth[1]);\n }\n return not ? !res : res;\n });\n return;\n }\n if (!isSupported.value)\n return;\n cleanup();\n mediaQuery = window.matchMedia(toValue(query));\n if (\"addEventListener\" in mediaQuery)\n mediaQuery.addEventListener(\"change\", handler);\n else\n mediaQuery.addListener(handler);\n matches.value = mediaQuery.matches;\n });\n tryOnScopeDispose(() => {\n stopWatch();\n cleanup();\n mediaQuery = undefined;\n });\n return computed(() => matches.value);\n}\n\nconst breakpointsTailwind = {\n \"sm\": 640,\n \"md\": 768,\n \"lg\": 1024,\n \"xl\": 1280,\n \"2xl\": 1536\n};\nconst breakpointsBootstrapV5 = {\n xs: 0,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n xxl: 1400\n};\nconst breakpointsVuetifyV2 = {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1264,\n xl: 1904\n};\nconst breakpointsVuetifyV3 = {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920,\n xxl: 2560\n};\nconst breakpointsVuetify = breakpointsVuetifyV2;\nconst breakpointsAntDesign = {\n xs: 480,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n xxl: 1600\n};\nconst breakpointsQuasar = {\n xs: 0,\n sm: 600,\n md: 1024,\n lg: 1440,\n xl: 1920\n};\nconst breakpointsSematic = {\n mobileS: 320,\n mobileM: 375,\n mobileL: 425,\n tablet: 768,\n laptop: 1024,\n laptopL: 1440,\n desktop4K: 2560\n};\nconst breakpointsMasterCss = {\n \"3xs\": 360,\n \"2xs\": 480,\n \"xs\": 600,\n \"sm\": 768,\n \"md\": 1024,\n \"lg\": 1280,\n \"xl\": 1440,\n \"2xl\": 1600,\n \"3xl\": 1920,\n \"4xl\": 2560\n};\nconst breakpointsPrimeFlex = {\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200\n};\nconst breakpointsElement = {\n xs: 0,\n sm: 768,\n md: 992,\n lg: 1200,\n xl: 1920\n};\n\nfunction useBreakpoints(breakpoints, options = {}) {\n function getValue(k, delta) {\n let v = toValue(breakpoints[toValue(k)]);\n if (delta != null)\n v = increaseWithUnit(v, delta);\n if (typeof v === \"number\")\n v = `${v}px`;\n return v;\n }\n const { window = defaultWindow, strategy = \"min-width\", ssrWidth = useSSRWidth() } = options;\n const ssrSupport = typeof ssrWidth === \"number\";\n const mounted = ssrSupport ? ref(false) : { value: true };\n if (ssrSupport) {\n tryOnMounted(() => mounted.value = !!window);\n }\n function match(query, size) {\n if (!mounted.value && ssrSupport) {\n return query === \"min\" ? ssrWidth >= pxValue(size) : ssrWidth <= pxValue(size);\n }\n if (!window)\n return false;\n return window.matchMedia(`(${query}-width: ${size})`).matches;\n }\n const greaterOrEqual = (k) => {\n return useMediaQuery(() => `(min-width: ${getValue(k)})`, options);\n };\n const smallerOrEqual = (k) => {\n return useMediaQuery(() => `(max-width: ${getValue(k)})`, options);\n };\n const shortcutMethods = Object.keys(breakpoints).reduce((shortcuts, k) => {\n Object.defineProperty(shortcuts, k, {\n get: () => strategy === \"min-width\" ? greaterOrEqual(k) : smallerOrEqual(k),\n enumerable: true,\n configurable: true\n });\n return shortcuts;\n }, {});\n function current() {\n const points = Object.keys(breakpoints).map((k) => [k, shortcutMethods[k], pxValue(getValue(k))]).sort((a, b) => a[2] - b[2]);\n return computed(() => points.filter(([, v]) => v.value).map(([k]) => k));\n }\n return Object.assign(shortcutMethods, {\n greaterOrEqual,\n smallerOrEqual,\n greater(k) {\n return useMediaQuery(() => `(min-width: ${getValue(k, 0.1)})`, options);\n },\n smaller(k) {\n return useMediaQuery(() => `(max-width: ${getValue(k, -0.1)})`, options);\n },\n between(a, b) {\n return useMediaQuery(() => `(min-width: ${getValue(a)}) and (max-width: ${getValue(b, -0.1)})`, options);\n },\n isGreater(k) {\n return match(\"min\", getValue(k, 0.1));\n },\n isGreaterOrEqual(k) {\n return match(\"min\", getValue(k));\n },\n isSmaller(k) {\n return match(\"max\", getValue(k, -0.1));\n },\n isSmallerOrEqual(k) {\n return match(\"max\", getValue(k));\n },\n isInBetween(a, b) {\n return match(\"min\", getValue(a)) && match(\"max\", getValue(b, -0.1));\n },\n current,\n active() {\n const bps = current();\n return computed(() => bps.value.length === 0 ? \"\" : bps.value.at(strategy === \"min-width\" ? -1 : 0));\n }\n });\n}\n\nfunction useBroadcastChannel(options) {\n const {\n name,\n window = defaultWindow\n } = options;\n const isSupported = useSupported(() => window && \"BroadcastChannel\" in window);\n const isClosed = ref(false);\n const channel = ref();\n const data = ref();\n const error = shallowRef(null);\n const post = (data2) => {\n if (channel.value)\n channel.value.postMessage(data2);\n };\n const close = () => {\n if (channel.value)\n channel.value.close();\n isClosed.value = true;\n };\n if (isSupported.value) {\n tryOnMounted(() => {\n error.value = null;\n channel.value = new BroadcastChannel(name);\n channel.value.addEventListener(\"message\", (e) => {\n data.value = e.data;\n }, { passive: true });\n channel.value.addEventListener(\"messageerror\", (e) => {\n error.value = e;\n }, { passive: true });\n channel.value.addEventListener(\"close\", () => {\n isClosed.value = true;\n });\n });\n }\n tryOnScopeDispose(() => {\n close();\n });\n return {\n isSupported,\n channel,\n data,\n post,\n close,\n error,\n isClosed\n };\n}\n\nconst WRITABLE_PROPERTIES = [\n \"hash\",\n \"host\",\n \"hostname\",\n \"href\",\n \"pathname\",\n \"port\",\n \"protocol\",\n \"search\"\n];\nfunction useBrowserLocation(options = {}) {\n const { window = defaultWindow } = options;\n const refs = Object.fromEntries(\n WRITABLE_PROPERTIES.map((key) => [key, ref()])\n );\n for (const [key, ref2] of objectEntries(refs)) {\n watch(ref2, (value) => {\n if (!(window == null ? undefined : window.location) || window.location[key] === value)\n return;\n window.location[key] = value;\n });\n }\n const buildState = (trigger) => {\n var _a;\n const { state: state2, length } = (window == null ? undefined : window.history) || {};\n const { origin } = (window == null ? undefined : window.location) || {};\n for (const key of WRITABLE_PROPERTIES)\n refs[key].value = (_a = window == null ? undefined : window.location) == null ? undefined : _a[key];\n return reactive({\n trigger,\n state: state2,\n length,\n origin,\n ...refs\n });\n };\n const state = ref(buildState(\"load\"));\n if (window) {\n useEventListener(window, \"popstate\", () => state.value = buildState(\"popstate\"), { passive: true });\n useEventListener(window, \"hashchange\", () => state.value = buildState(\"hashchange\"), { passive: true });\n }\n return state;\n}\n\nfunction useCached(refValue, comparator = (a, b) => a === b, watchOptions) {\n const cachedValue = ref(refValue.value);\n watch(() => refValue.value, (value) => {\n if (!comparator(value, cachedValue.value))\n cachedValue.value = value;\n }, watchOptions);\n return cachedValue;\n}\n\nfunction usePermission(permissionDesc, options = {}) {\n const {\n controls = false,\n navigator = defaultNavigator\n } = options;\n const isSupported = useSupported(() => navigator && \"permissions\" in navigator);\n const permissionStatus = shallowRef();\n const desc = typeof permissionDesc === \"string\" ? { name: permissionDesc } : permissionDesc;\n const state = shallowRef();\n const update = () => {\n var _a, _b;\n state.value = (_b = (_a = permissionStatus.value) == null ? undefined : _a.state) != null ? _b : \"prompt\";\n };\n useEventListener(permissionStatus, \"change\", update, { passive: true });\n const query = createSingletonPromise(async () => {\n if (!isSupported.value)\n return;\n if (!permissionStatus.value) {\n try {\n permissionStatus.value = await navigator.permissions.query(desc);\n } catch (e) {\n permissionStatus.value = undefined;\n } finally {\n update();\n }\n }\n if (controls)\n return toRaw(permissionStatus.value);\n });\n query();\n if (controls) {\n return {\n state,\n isSupported,\n query\n };\n } else {\n return state;\n }\n}\n\nfunction useClipboard(options = {}) {\n const {\n navigator = defaultNavigator,\n read = false,\n source,\n copiedDuring = 1500,\n legacy = false\n } = options;\n const isClipboardApiSupported = useSupported(() => navigator && \"clipboard\" in navigator);\n const permissionRead = usePermission(\"clipboard-read\");\n const permissionWrite = usePermission(\"clipboard-write\");\n const isSupported = computed(() => isClipboardApiSupported.value || legacy);\n const text = ref(\"\");\n const copied = ref(false);\n const timeout = useTimeoutFn(() => copied.value = false, copiedDuring, { immediate: false });\n function updateText() {\n if (isClipboardApiSupported.value && isAllowed(permissionRead.value)) {\n navigator.clipboard.readText().then((value) => {\n text.value = value;\n });\n } else {\n text.value = legacyRead();\n }\n }\n if (isSupported.value && read)\n useEventListener([\"copy\", \"cut\"], updateText, { passive: true });\n async function copy(value = toValue(source)) {\n if (isSupported.value && value != null) {\n if (isClipboardApiSupported.value && isAllowed(permissionWrite.value))\n await navigator.clipboard.writeText(value);\n else\n legacyCopy(value);\n text.value = value;\n copied.value = true;\n timeout.start();\n }\n }\n function legacyCopy(value) {\n const ta = document.createElement(\"textarea\");\n ta.value = value != null ? value : \"\";\n ta.style.position = \"absolute\";\n ta.style.opacity = \"0\";\n document.body.appendChild(ta);\n ta.select();\n document.execCommand(\"copy\");\n ta.remove();\n }\n function legacyRead() {\n var _a, _b, _c;\n return (_c = (_b = (_a = document == null ? undefined : document.getSelection) == null ? undefined : _a.call(document)) == null ? undefined : _b.toString()) != null ? _c : \"\";\n }\n function isAllowed(status) {\n return status === \"granted\" || status === \"prompt\";\n }\n return {\n isSupported,\n text,\n copied,\n copy\n };\n}\n\nfunction useClipboardItems(options = {}) {\n const {\n navigator = defaultNavigator,\n read = false,\n source,\n copiedDuring = 1500\n } = options;\n const isSupported = useSupported(() => navigator && \"clipboard\" in navigator);\n const content = ref([]);\n const copied = ref(false);\n const timeout = useTimeoutFn(() => copied.value = false, copiedDuring, { immediate: false });\n function updateContent() {\n if (isSupported.value) {\n navigator.clipboard.read().then((items) => {\n content.value = items;\n });\n }\n }\n if (isSupported.value && read)\n useEventListener([\"copy\", \"cut\"], updateContent, { passive: true });\n async function copy(value = toValue(source)) {\n if (isSupported.value && value != null) {\n await navigator.clipboard.write(value);\n content.value = value;\n copied.value = true;\n timeout.start();\n }\n }\n return {\n isSupported,\n content,\n copied,\n copy\n };\n}\n\nfunction cloneFnJSON(source) {\n return JSON.parse(JSON.stringify(source));\n}\nfunction useCloned(source, options = {}) {\n const cloned = ref({});\n const isModified = ref(false);\n let _lastSync = false;\n const {\n manual,\n clone = cloneFnJSON,\n // watch options\n deep = true,\n immediate = true\n } = options;\n watch(cloned, () => {\n if (_lastSync) {\n _lastSync = false;\n return;\n }\n isModified.value = true;\n }, {\n deep: true,\n flush: \"sync\"\n });\n function sync() {\n _lastSync = true;\n isModified.value = false;\n cloned.value = clone(toValue(source));\n }\n if (!manual && (isRef(source) || typeof source === \"function\")) {\n watch(source, sync, {\n ...options,\n deep,\n immediate\n });\n } else {\n sync();\n }\n return { cloned, isModified, sync };\n}\n\nconst _global = typeof globalThis !== \"undefined\" ? globalThis : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : {};\nconst globalKey = \"__vueuse_ssr_handlers__\";\nconst handlers = /* @__PURE__ */ getHandlers();\nfunction getHandlers() {\n if (!(globalKey in _global))\n _global[globalKey] = _global[globalKey] || {};\n return _global[globalKey];\n}\nfunction getSSRHandler(key, fallback) {\n return handlers[key] || fallback;\n}\nfunction setSSRHandler(key, fn) {\n handlers[key] = fn;\n}\n\nfunction usePreferredDark(options) {\n return useMediaQuery(\"(prefers-color-scheme: dark)\", options);\n}\n\nfunction guessSerializerType(rawInit) {\n return rawInit == null ? \"any\" : rawInit instanceof Set ? \"set\" : rawInit instanceof Map ? \"map\" : rawInit instanceof Date ? \"date\" : typeof rawInit === \"boolean\" ? \"boolean\" : typeof rawInit === \"string\" ? \"string\" : typeof rawInit === \"object\" ? \"object\" : !Number.isNaN(rawInit) ? \"number\" : \"any\";\n}\n\nconst StorageSerializers = {\n boolean: {\n read: (v) => v === \"true\",\n write: (v) => String(v)\n },\n object: {\n read: (v) => JSON.parse(v),\n write: (v) => JSON.stringify(v)\n },\n number: {\n read: (v) => Number.parseFloat(v),\n write: (v) => String(v)\n },\n any: {\n read: (v) => v,\n write: (v) => String(v)\n },\n string: {\n read: (v) => v,\n write: (v) => String(v)\n },\n map: {\n read: (v) => new Map(JSON.parse(v)),\n write: (v) => JSON.stringify(Array.from(v.entries()))\n },\n set: {\n read: (v) => new Set(JSON.parse(v)),\n write: (v) => JSON.stringify(Array.from(v))\n },\n date: {\n read: (v) => new Date(v),\n write: (v) => v.toISOString()\n }\n};\nconst customStorageEventName = \"vueuse-storage\";\nfunction useStorage(key, defaults, storage, options = {}) {\n var _a;\n const {\n flush = \"pre\",\n deep = true,\n listenToStorageChanges = true,\n writeDefaults = true,\n mergeDefaults = false,\n shallow,\n window = defaultWindow,\n eventFilter,\n onError = (e) => {\n console.error(e);\n },\n initOnMounted\n } = options;\n const data = (shallow ? shallowRef : ref)(typeof defaults === \"function\" ? defaults() : defaults);\n const keyComputed = computed(() => toValue(key));\n if (!storage) {\n try {\n storage = getSSRHandler(\"getDefaultStorage\", () => {\n var _a2;\n return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;\n })();\n } catch (e) {\n onError(e);\n }\n }\n if (!storage)\n return data;\n const rawInit = toValue(defaults);\n const type = guessSerializerType(rawInit);\n const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];\n const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(\n data,\n () => write(data.value),\n { flush, deep, eventFilter }\n );\n watch(keyComputed, () => update(), { flush });\n if (window && listenToStorageChanges) {\n tryOnMounted(() => {\n if (storage instanceof Storage)\n useEventListener(window, \"storage\", update, { passive: true });\n else\n useEventListener(window, customStorageEventName, updateFromCustomEvent);\n if (initOnMounted)\n update();\n });\n }\n if (!initOnMounted)\n update();\n function dispatchWriteEvent(oldValue, newValue) {\n if (window) {\n const payload = {\n key: keyComputed.value,\n oldValue,\n newValue,\n storageArea: storage\n };\n window.dispatchEvent(storage instanceof Storage ? new StorageEvent(\"storage\", payload) : new CustomEvent(customStorageEventName, {\n detail: payload\n }));\n }\n }\n function write(v) {\n try {\n const oldValue = storage.getItem(keyComputed.value);\n if (v == null) {\n dispatchWriteEvent(oldValue, null);\n storage.removeItem(keyComputed.value);\n } else {\n const serialized = serializer.write(v);\n if (oldValue !== serialized) {\n storage.setItem(keyComputed.value, serialized);\n dispatchWriteEvent(oldValue, serialized);\n }\n }\n } catch (e) {\n onError(e);\n }\n }\n function read(event) {\n const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);\n if (rawValue == null) {\n if (writeDefaults && rawInit != null)\n storage.setItem(keyComputed.value, serializer.write(rawInit));\n return rawInit;\n } else if (!event && mergeDefaults) {\n const value = serializer.read(rawValue);\n if (typeof mergeDefaults === \"function\")\n return mergeDefaults(value, rawInit);\n else if (type === \"object\" && !Array.isArray(value))\n return { ...rawInit, ...value };\n return value;\n } else if (typeof rawValue !== \"string\") {\n return rawValue;\n } else {\n return serializer.read(rawValue);\n }\n }\n function update(event) {\n if (event && event.storageArea !== storage)\n return;\n if (event && event.key == null) {\n data.value = rawInit;\n return;\n }\n if (event && event.key !== keyComputed.value)\n return;\n pauseWatch();\n try {\n if ((event == null ? void 0 : event.newValue) !== serializer.write(data.value))\n data.value = read(event);\n } catch (e) {\n onError(e);\n } finally {\n if (event)\n nextTick(resumeWatch);\n else\n resumeWatch();\n }\n }\n function updateFromCustomEvent(event) {\n update(event.detail);\n }\n return data;\n}\n\nconst CSS_DISABLE_TRANS = \"*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}\";\nfunction useColorMode(options = {}) {\n const {\n selector = \"html\",\n attribute = \"class\",\n initialValue = \"auto\",\n window = defaultWindow,\n storage,\n storageKey = \"vueuse-color-scheme\",\n listenToStorageChanges = true,\n storageRef,\n emitAuto,\n disableTransition = true\n } = options;\n const modes = {\n auto: \"\",\n light: \"light\",\n dark: \"dark\",\n ...options.modes || {}\n };\n const preferredDark = usePreferredDark({ window });\n const system = computed(() => preferredDark.value ? \"dark\" : \"light\");\n const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));\n const state = computed(() => store.value === \"auto\" ? system.value : store.value);\n const updateHTMLAttrs = getSSRHandler(\n \"updateHTMLAttrs\",\n (selector2, attribute2, value) => {\n const el = typeof selector2 === \"string\" ? window == null ? undefined : window.document.querySelector(selector2) : unrefElement(selector2);\n if (!el)\n return;\n const classesToAdd = /* @__PURE__ */ new Set();\n const classesToRemove = /* @__PURE__ */ new Set();\n let attributeToChange = null;\n if (attribute2 === \"class\") {\n const current = value.split(/\\s/g);\n Object.values(modes).flatMap((i) => (i || \"\").split(/\\s/g)).filter(Boolean).forEach((v) => {\n if (current.includes(v))\n classesToAdd.add(v);\n else\n classesToRemove.add(v);\n });\n } else {\n attributeToChange = { key: attribute2, value };\n }\n if (classesToAdd.size === 0 && classesToRemove.size === 0 && attributeToChange === null)\n return;\n let style;\n if (disableTransition) {\n style = window.document.createElement(\"style\");\n style.appendChild(document.createTextNode(CSS_DISABLE_TRANS));\n window.document.head.appendChild(style);\n }\n for (const c of classesToAdd) {\n el.classList.add(c);\n }\n for (const c of classesToRemove) {\n el.classList.remove(c);\n }\n if (attributeToChange) {\n el.setAttribute(attributeToChange.key, attributeToChange.value);\n }\n if (disableTransition) {\n window.getComputedStyle(style).opacity;\n document.head.removeChild(style);\n }\n }\n );\n function defaultOnChanged(mode) {\n var _a;\n updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);\n }\n function onChanged(mode) {\n if (options.onChanged)\n options.onChanged(mode, defaultOnChanged);\n else\n defaultOnChanged(mode);\n }\n watch(state, onChanged, { flush: \"post\", immediate: true });\n tryOnMounted(() => onChanged(state.value));\n const auto = computed({\n get() {\n return emitAuto ? store.value : state.value;\n },\n set(v) {\n store.value = v;\n }\n });\n return Object.assign(auto, { store, system, state });\n}\n\nfunction useConfirmDialog(revealed = ref(false)) {\n const confirmHook = createEventHook();\n const cancelHook = createEventHook();\n const revealHook = createEventHook();\n let _resolve = noop;\n const reveal = (data) => {\n revealHook.trigger(data);\n revealed.value = true;\n return new Promise((resolve) => {\n _resolve = resolve;\n });\n };\n const confirm = (data) => {\n revealed.value = false;\n confirmHook.trigger(data);\n _resolve({ data, isCanceled: false });\n };\n const cancel = (data) => {\n revealed.value = false;\n cancelHook.trigger(data);\n _resolve({ data, isCanceled: true });\n };\n return {\n isRevealed: computed(() => revealed.value),\n reveal,\n confirm,\n cancel,\n onReveal: revealHook.on,\n onConfirm: confirmHook.on,\n onCancel: cancelHook.on\n };\n}\n\nfunction useCssVar(prop, target, options = {}) {\n const { window = defaultWindow, initialValue, observe = false } = options;\n const variable = ref(initialValue);\n const elRef = computed(() => {\n var _a;\n return unrefElement(target) || ((_a = window == null ? undefined : window.document) == null ? undefined : _a.documentElement);\n });\n function updateCssVar() {\n var _a;\n const key = toValue(prop);\n const el = toValue(elRef);\n if (el && window && key) {\n const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? undefined : _a.trim();\n variable.value = value || initialValue;\n }\n }\n if (observe) {\n useMutationObserver(elRef, updateCssVar, {\n attributeFilter: [\"style\", \"class\"],\n window\n });\n }\n watch(\n [elRef, () => toValue(prop)],\n (_, old) => {\n if (old[0] && old[1])\n old[0].style.removeProperty(old[1]);\n updateCssVar();\n },\n { immediate: true }\n );\n watch(\n variable,\n (val) => {\n var _a;\n const raw_prop = toValue(prop);\n if (((_a = elRef.value) == null ? undefined : _a.style) && raw_prop) {\n if (val == null)\n elRef.value.style.removeProperty(raw_prop);\n else\n elRef.value.style.setProperty(raw_prop, val);\n }\n }\n );\n return variable;\n}\n\nfunction useCurrentElement(rootComponent) {\n const vm = getCurrentInstance();\n const currentElement = computedWithControl(\n () => null,\n () => rootComponent ? unrefElement(rootComponent) : vm.proxy.$el\n );\n onUpdated(currentElement.trigger);\n onMounted(currentElement.trigger);\n return currentElement;\n}\n\nfunction useCycleList(list, options) {\n const state = shallowRef(getInitialValue());\n const listRef = toRef(list);\n const index = computed({\n get() {\n var _a;\n const targetList = listRef.value;\n let index2 = (options == null ? undefined : options.getIndexOf) ? options.getIndexOf(state.value, targetList) : targetList.indexOf(state.value);\n if (index2 < 0)\n index2 = (_a = options == null ? undefined : options.fallbackIndex) != null ? _a : 0;\n return index2;\n },\n set(v) {\n set(v);\n }\n });\n function set(i) {\n const targetList = listRef.value;\n const length = targetList.length;\n const index2 = (i % length + length) % length;\n const value = targetList[index2];\n state.value = value;\n return value;\n }\n function shift(delta = 1) {\n return set(index.value + delta);\n }\n function next(n = 1) {\n return shift(n);\n }\n function prev(n = 1) {\n return shift(-n);\n }\n function getInitialValue() {\n var _a, _b;\n return (_b = toValue((_a = options == null ? undefined : options.initialValue) != null ? _a : toValue(list)[0])) != null ? _b : undefined;\n }\n watch(listRef, () => set(index.value));\n return {\n state,\n index,\n next,\n prev,\n go: set\n };\n}\n\nfunction useDark(options = {}) {\n const {\n valueDark = \"dark\",\n valueLight = \"\"\n } = options;\n const mode = useColorMode({\n ...options,\n onChanged: (mode2, defaultHandler) => {\n var _a;\n if (options.onChanged)\n (_a = options.onChanged) == null ? undefined : _a.call(options, mode2 === \"dark\", defaultHandler, mode2);\n else\n defaultHandler(mode2);\n },\n modes: {\n dark: valueDark,\n light: valueLight\n }\n });\n const system = computed(() => mode.system.value);\n const isDark = computed({\n get() {\n return mode.value === \"dark\";\n },\n set(v) {\n const modeVal = v ? \"dark\" : \"light\";\n if (system.value === modeVal)\n mode.value = \"auto\";\n else\n mode.value = modeVal;\n }\n });\n return isDark;\n}\n\nfunction fnBypass(v) {\n return v;\n}\nfunction fnSetSource(source, value) {\n return source.value = value;\n}\nfunction defaultDump(clone) {\n return clone ? typeof clone === \"function\" ? clone : cloneFnJSON : fnBypass;\n}\nfunction defaultParse(clone) {\n return clone ? typeof clone === \"function\" ? clone : cloneFnJSON : fnBypass;\n}\nfunction useManualRefHistory(source, options = {}) {\n const {\n clone = false,\n dump = defaultDump(clone),\n parse = defaultParse(clone),\n setSource = fnSetSource\n } = options;\n function _createHistoryRecord() {\n return markRaw({\n snapshot: dump(source.value),\n timestamp: timestamp()\n });\n }\n const last = ref(_createHistoryRecord());\n const undoStack = ref([]);\n const redoStack = ref([]);\n const _setSource = (record) => {\n setSource(source, parse(record.snapshot));\n last.value = record;\n };\n const commit = () => {\n undoStack.value.unshift(last.value);\n last.value = _createHistoryRecord();\n if (options.capacity && undoStack.value.length > options.capacity)\n undoStack.value.splice(options.capacity, Number.POSITIVE_INFINITY);\n if (redoStack.value.length)\n redoStack.value.splice(0, redoStack.value.length);\n };\n const clear = () => {\n undoStack.value.splice(0, undoStack.value.length);\n redoStack.value.splice(0, redoStack.value.length);\n };\n const undo = () => {\n const state = undoStack.value.shift();\n if (state) {\n redoStack.value.unshift(last.value);\n _setSource(state);\n }\n };\n const redo = () => {\n const state = redoStack.value.shift();\n if (state) {\n undoStack.value.unshift(last.value);\n _setSource(state);\n }\n };\n const reset = () => {\n _setSource(last.value);\n };\n const history = computed(() => [last.value, ...undoStack.value]);\n const canUndo = computed(() => undoStack.value.length > 0);\n const canRedo = computed(() => redoStack.value.length > 0);\n return {\n source,\n undoStack,\n redoStack,\n last,\n history,\n canUndo,\n canRedo,\n clear,\n commit,\n reset,\n undo,\n redo\n };\n}\n\nfunction useRefHistory(source, options = {}) {\n const {\n deep = false,\n flush = \"pre\",\n eventFilter\n } = options;\n const {\n eventFilter: composedFilter,\n pause,\n resume: resumeTracking,\n isActive: isTracking\n } = pausableFilter(eventFilter);\n const {\n ignoreUpdates,\n ignorePrevAsyncUpdates,\n stop\n } = watchIgnorable(\n source,\n commit,\n { deep, flush, eventFilter: composedFilter }\n );\n function setSource(source2, value) {\n ignorePrevAsyncUpdates();\n ignoreUpdates(() => {\n source2.value = value;\n });\n }\n const manualHistory = useManualRefHistory(source, { ...options, clone: options.clone || deep, setSource });\n const { clear, commit: manualCommit } = manualHistory;\n function commit() {\n ignorePrevAsyncUpdates();\n manualCommit();\n }\n function resume(commitNow) {\n resumeTracking();\n if (commitNow)\n commit();\n }\n function batch(fn) {\n let canceled = false;\n const cancel = () => canceled = true;\n ignoreUpdates(() => {\n fn(cancel);\n });\n if (!canceled)\n commit();\n }\n function dispose() {\n stop();\n clear();\n }\n return {\n ...manualHistory,\n isTracking,\n pause,\n resume,\n commit,\n batch,\n dispose\n };\n}\n\nfunction useDebouncedRefHistory(source, options = {}) {\n const filter = options.debounce ? debounceFilter(options.debounce) : undefined;\n const history = useRefHistory(source, { ...options, eventFilter: filter });\n return {\n ...history\n };\n}\n\nfunction useDeviceMotion(options = {}) {\n const {\n window = defaultWindow,\n requestPermissions = false,\n eventFilter = bypassFilter\n } = options;\n const isSupported = useSupported(() => typeof DeviceMotionEvent !== \"undefined\");\n const requirePermissions = useSupported(() => isSupported.value && \"requestPermission\" in DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\");\n const permissionGranted = ref(false);\n const acceleration = ref({ x: null, y: null, z: null });\n const rotationRate = ref({ alpha: null, beta: null, gamma: null });\n const interval = ref(0);\n const accelerationIncludingGravity = ref({\n x: null,\n y: null,\n z: null\n });\n function init() {\n if (window) {\n const onDeviceMotion = createFilterWrapper(\n eventFilter,\n (event) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _i;\n acceleration.value = {\n x: ((_a = event.acceleration) == null ? undefined : _a.x) || null,\n y: ((_b = event.acceleration) == null ? undefined : _b.y) || null,\n z: ((_c = event.acceleration) == null ? undefined : _c.z) || null\n };\n accelerationIncludingGravity.value = {\n x: ((_d = event.accelerationIncludingGravity) == null ? undefined : _d.x) || null,\n y: ((_e = event.accelerationIncludingGravity) == null ? undefined : _e.y) || null,\n z: ((_f = event.accelerationIncludingGravity) == null ? undefined : _f.z) || null\n };\n rotationRate.value = {\n alpha: ((_g = event.rotationRate) == null ? undefined : _g.alpha) || null,\n beta: ((_h = event.rotationRate) == null ? undefined : _h.beta) || null,\n gamma: ((_i = event.rotationRate) == null ? undefined : _i.gamma) || null\n };\n interval.value = event.interval;\n }\n );\n useEventListener(window, \"devicemotion\", onDeviceMotion, { passive: true });\n }\n }\n const ensurePermissions = async () => {\n if (!requirePermissions.value)\n permissionGranted.value = true;\n if (permissionGranted.value)\n return;\n if (requirePermissions.value) {\n const requestPermission = DeviceMotionEvent.requestPermission;\n try {\n const response = await requestPermission();\n if (response === \"granted\") {\n permissionGranted.value = true;\n init();\n }\n } catch (error) {\n console.error(error);\n }\n }\n };\n if (isSupported.value) {\n if (requestPermissions && requirePermissions.value) {\n ensurePermissions().then(() => init());\n } else {\n init();\n }\n }\n return {\n acceleration,\n accelerationIncludingGravity,\n rotationRate,\n interval,\n isSupported,\n requirePermissions,\n ensurePermissions,\n permissionGranted\n };\n}\n\nfunction useDeviceOrientation(options = {}) {\n const { window = defaultWindow } = options;\n const isSupported = useSupported(() => window && \"DeviceOrientationEvent\" in window);\n const isAbsolute = ref(false);\n const alpha = ref(null);\n const beta = ref(null);\n const gamma = ref(null);\n if (window && isSupported.value) {\n useEventListener(window, \"deviceorientation\", (event) => {\n isAbsolute.value = event.absolute;\n alpha.value = event.alpha;\n beta.value = event.beta;\n gamma.value = event.gamma;\n }, { passive: true });\n }\n return {\n isSupported,\n isAbsolute,\n alpha,\n beta,\n gamma\n };\n}\n\nfunction useDevicePixelRatio(options = {}) {\n const {\n window = defaultWindow\n } = options;\n const pixelRatio = ref(1);\n if (window) {\n let observe2 = function() {\n pixelRatio.value = window.devicePixelRatio;\n cleanup2();\n media = window.matchMedia(`(resolution: ${pixelRatio.value}dppx)`);\n media.addEventListener(\"change\", observe2, { once: true });\n }, cleanup2 = function() {\n media == null ? undefined : media.removeEventListener(\"change\", observe2);\n };\n let media;\n observe2();\n tryOnScopeDispose(cleanup2);\n }\n return { pixelRatio };\n}\n\nfunction useDevicesList(options = {}) {\n const {\n navigator = defaultNavigator,\n requestPermissions = false,\n constraints = { audio: true, video: true },\n onUpdated\n } = options;\n const devices = ref([]);\n const videoInputs = computed(() => devices.value.filter((i) => i.kind === \"videoinput\"));\n const audioInputs = computed(() => devices.value.filter((i) => i.kind === \"audioinput\"));\n const audioOutputs = computed(() => devices.value.filter((i) => i.kind === \"audiooutput\"));\n const isSupported = useSupported(() => navigator && navigator.mediaDevices && navigator.mediaDevices.enumerateDevices);\n const permissionGranted = ref(false);\n let stream;\n async function update() {\n if (!isSupported.value)\n return;\n devices.value = await navigator.mediaDevices.enumerateDevices();\n onUpdated == null ? undefined : onUpdated(devices.value);\n if (stream) {\n stream.getTracks().forEach((t) => t.stop());\n stream = null;\n }\n }\n async function ensurePermissions() {\n if (!isSupported.value)\n return false;\n if (permissionGranted.value)\n return true;\n const { state, query } = usePermission(\"camera\", { controls: true });\n await query();\n if (state.value !== \"granted\") {\n let granted = true;\n try {\n stream = await navigator.mediaDevices.getUserMedia(constraints);\n } catch (e) {\n stream = null;\n granted = false;\n }\n update();\n permissionGranted.value = granted;\n } else {\n permissionGranted.value = true;\n }\n return permissionGranted.value;\n }\n if (isSupported.value) {\n if (requestPermissions)\n ensurePermissions();\n useEventListener(navigator.mediaDevices, \"devicechange\", update, { passive: true });\n update();\n }\n return {\n devices,\n ensurePermissions,\n permissionGranted,\n videoInputs,\n audioInputs,\n audioOutputs,\n isSupported\n };\n}\n\nfunction useDisplayMedia(options = {}) {\n var _a;\n const enabled = ref((_a = options.enabled) != null ? _a : false);\n const video = options.video;\n const audio = options.audio;\n const { navigator = defaultNavigator } = options;\n const isSupported = useSupported(() => {\n var _a2;\n return (_a2 = navigator == null ? undefined : navigator.mediaDevices) == null ? undefined : _a2.getDisplayMedia;\n });\n const constraint = { audio, video };\n const stream = shallowRef();\n async function _start() {\n var _a2;\n if (!isSupported.value || stream.value)\n return;\n stream.value = await navigator.mediaDevices.getDisplayMedia(constraint);\n (_a2 = stream.value) == null ? undefined : _a2.getTracks().forEach((t) => t.addEventListener(\"ended\", stop));\n return stream.value;\n }\n async function _stop() {\n var _a2;\n (_a2 = stream.value) == null ? undefined : _a2.getTracks().forEach((t) => t.stop());\n stream.value = undefined;\n }\n function stop() {\n _stop();\n enabled.value = false;\n }\n async function start() {\n await _start();\n if (stream.value)\n enabled.value = true;\n return stream.value;\n }\n watch(\n enabled,\n (v) => {\n if (v)\n _start();\n else\n _stop();\n },\n { immediate: true }\n );\n return {\n isSupported,\n stream,\n start,\n stop,\n enabled\n };\n}\n\nfunction useDocumentVisibility(options = {}) {\n const { document = defaultDocument } = options;\n if (!document)\n return ref(\"visible\");\n const visibility = ref(document.visibilityState);\n useEventListener(document, \"visibilitychange\", () => {\n visibility.value = document.visibilityState;\n }, { passive: true });\n return visibility;\n}\n\nfunction useDraggable(target, options = {}) {\n var _a;\n const {\n pointerTypes,\n preventDefault,\n stopPropagation,\n exact,\n onMove,\n onEnd,\n onStart,\n initialValue,\n axis = \"both\",\n draggingElement = defaultWindow,\n containerElement,\n handle: draggingHandle = target,\n buttons = [0]\n } = options;\n const position = ref(\n (_a = toValue(initialValue)) != null ? _a : { x: 0, y: 0 }\n );\n const pressedDelta = ref();\n const filterEvent = (e) => {\n if (pointerTypes)\n return pointerTypes.includes(e.pointerType);\n return true;\n };\n const handleEvent = (e) => {\n if (toValue(preventDefault))\n e.preventDefault();\n if (toValue(stopPropagation))\n e.stopPropagation();\n };\n const start = (e) => {\n var _a2;\n if (!toValue(buttons).includes(e.button))\n return;\n if (toValue(options.disabled) || !filterEvent(e))\n return;\n if (toValue(exact) && e.target !== toValue(target))\n return;\n const container = toValue(containerElement);\n const containerRect = (_a2 = container == null ? undefined : container.getBoundingClientRect) == null ? undefined : _a2.call(container);\n const targetRect = toValue(target).getBoundingClientRect();\n const pos = {\n x: e.clientX - (container ? targetRect.left - containerRect.left + container.scrollLeft : targetRect.left),\n y: e.clientY - (container ? targetRect.top - containerRect.top + container.scrollTop : targetRect.top)\n };\n if ((onStart == null ? undefined : onStart(pos, e)) === false)\n return;\n pressedDelta.value = pos;\n handleEvent(e);\n };\n const move = (e) => {\n if (toValue(options.disabled) || !filterEvent(e))\n return;\n if (!pressedDelta.value)\n return;\n const container = toValue(containerElement);\n const targetRect = toValue(target).getBoundingClientRect();\n let { x, y } = position.value;\n if (axis === \"x\" || axis === \"both\") {\n x = e.clientX - pressedDelta.value.x;\n if (container)\n x = Math.min(Math.max(0, x), container.scrollWidth - targetRect.width);\n }\n if (axis === \"y\" || axis === \"both\") {\n y = e.clientY - pressedDelta.value.y;\n if (container)\n y = Math.min(Math.max(0, y), container.scrollHeight - targetRect.height);\n }\n position.value = {\n x,\n y\n };\n onMove == null ? undefined : onMove(position.value, e);\n handleEvent(e);\n };\n const end = (e) => {\n if (toValue(options.disabled) || !filterEvent(e))\n return;\n if (!pressedDelta.value)\n return;\n pressedDelta.value = undefined;\n onEnd == null ? undefined : onEnd(position.value, e);\n handleEvent(e);\n };\n if (isClient) {\n const config = () => {\n var _a2;\n return {\n capture: (_a2 = options.capture) != null ? _a2 : true,\n passive: !toValue(preventDefault)\n };\n };\n useEventListener(draggingHandle, \"pointerdown\", start, config);\n useEventListener(draggingElement, \"pointermove\", move, config);\n useEventListener(draggingElement, \"pointerup\", end, config);\n }\n return {\n ...toRefs(position),\n position,\n isDragging: computed(() => !!pressedDelta.value),\n style: computed(\n () => `left:${position.value.x}px;top:${position.value.y}px;`\n )\n };\n}\n\nfunction useDropZone(target, options = {}) {\n var _a, _b;\n const isOverDropZone = ref(false);\n const files = shallowRef(null);\n let counter = 0;\n let isValid = true;\n if (isClient) {\n const _options = typeof options === \"function\" ? { onDrop: options } : options;\n const multiple = (_a = _options.multiple) != null ? _a : true;\n const preventDefaultForUnhandled = (_b = _options.preventDefaultForUnhandled) != null ? _b : false;\n const getFiles = (event) => {\n var _a2, _b2;\n const list = Array.from((_b2 = (_a2 = event.dataTransfer) == null ? undefined : _a2.files) != null ? _b2 : []);\n return list.length === 0 ? null : multiple ? list : [list[0]];\n };\n const checkDataTypes = (types) => {\n const dataTypes = unref(_options.dataTypes);\n if (typeof dataTypes === \"function\")\n return dataTypes(types);\n if (!(dataTypes == null ? undefined : dataTypes.length))\n return true;\n if (types.length === 0)\n return false;\n return types.every(\n (type) => dataTypes.some((allowedType) => type.includes(allowedType))\n );\n };\n const checkValidity = (items) => {\n const types = Array.from(items != null ? items : []).map((item) => item.type);\n const dataTypesValid = checkDataTypes(types);\n const multipleFilesValid = multiple || items.length <= 1;\n return dataTypesValid && multipleFilesValid;\n };\n const isSafari = () => /^(?:(?!chrome|android).)*safari/i.test(navigator.userAgent) && !(\"chrome\" in window);\n const handleDragEvent = (event, eventType) => {\n var _a2, _b2, _c, _d, _e, _f;\n const dataTransferItemList = (_a2 = event.dataTransfer) == null ? undefined : _a2.items;\n isValid = (_b2 = dataTransferItemList && checkValidity(dataTransferItemList)) != null ? _b2 : false;\n if (preventDefaultForUnhandled) {\n event.preventDefault();\n }\n if (!isSafari() && !isValid) {\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = \"none\";\n }\n return;\n }\n event.preventDefault();\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = \"copy\";\n }\n const currentFiles = getFiles(event);\n switch (eventType) {\n case \"enter\":\n counter += 1;\n isOverDropZone.value = true;\n (_c = _options.onEnter) == null ? undefined : _c.call(_options, null, event);\n break;\n case \"over\":\n (_d = _options.onOver) == null ? undefined : _d.call(_options, null, event);\n break;\n case \"leave\":\n counter -= 1;\n if (counter === 0)\n isOverDropZone.value = false;\n (_e = _options.onLeave) == null ? undefined : _e.call(_options, null, event);\n break;\n case \"drop\":\n counter = 0;\n isOverDropZone.value = false;\n if (isValid) {\n files.value = currentFiles;\n (_f = _options.onDrop) == null ? undefined : _f.call(_options, currentFiles, event);\n }\n break;\n }\n };\n useEventListener(target, \"dragenter\", (event) => handleDragEvent(event, \"enter\"));\n useEventListener(target, \"dragover\", (event) => handleDragEvent(event, \"over\"));\n useEventListener(target, \"dragleave\", (event) => handleDragEvent(event, \"leave\"));\n useEventListener(target, \"drop\", (event) => handleDragEvent(event, \"drop\"));\n }\n return {\n files,\n isOverDropZone\n };\n}\n\nfunction useResizeObserver(target, callback, options = {}) {\n const { window = defaultWindow, ...observerOptions } = options;\n let observer;\n const isSupported = useSupported(() => window && \"ResizeObserver\" in window);\n const cleanup = () => {\n if (observer) {\n observer.disconnect();\n observer = undefined;\n }\n };\n const targets = computed(() => {\n const _targets = toValue(target);\n return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];\n });\n const stopWatch = watch(\n targets,\n (els) => {\n cleanup();\n if (isSupported.value && window) {\n observer = new ResizeObserver(callback);\n for (const _el of els) {\n if (_el)\n observer.observe(_el, observerOptions);\n }\n }\n },\n { immediate: true, flush: \"post\" }\n );\n const stop = () => {\n cleanup();\n stopWatch();\n };\n tryOnScopeDispose(stop);\n return {\n isSupported,\n stop\n };\n}\n\nfunction useElementBounding(target, options = {}) {\n const {\n reset = true,\n windowResize = true,\n windowScroll = true,\n immediate = true,\n updateTiming = \"sync\"\n } = options;\n const height = ref(0);\n const bottom = ref(0);\n const left = ref(0);\n const right = ref(0);\n const top = ref(0);\n const width = ref(0);\n const x = ref(0);\n const y = ref(0);\n function recalculate() {\n const el = unrefElement(target);\n if (!el) {\n if (reset) {\n height.value = 0;\n bottom.value = 0;\n left.value = 0;\n right.value = 0;\n top.value = 0;\n width.value = 0;\n x.value = 0;\n y.value = 0;\n }\n return;\n }\n const rect = el.getBoundingClientRect();\n height.value = rect.height;\n bottom.value = rect.bottom;\n left.value = rect.left;\n right.value = rect.right;\n top.value = rect.top;\n width.value = rect.width;\n x.value = rect.x;\n y.value = rect.y;\n }\n function update() {\n if (updateTiming === \"sync\")\n recalculate();\n else if (updateTiming === \"next-frame\")\n requestAnimationFrame(() => recalculate());\n }\n useResizeObserver(target, update);\n watch(() => unrefElement(target), (ele) => !ele && update());\n useMutationObserver(target, update, {\n attributeFilter: [\"style\", \"class\"]\n });\n if (windowScroll)\n useEventListener(\"scroll\", update, { capture: true, passive: true });\n if (windowResize)\n useEventListener(\"resize\", update, { passive: true });\n tryOnMounted(() => {\n if (immediate)\n update();\n });\n return {\n height,\n bottom,\n left,\n right,\n top,\n width,\n x,\n y,\n update\n };\n}\n\nfunction useElementByPoint(options) {\n const {\n x,\n y,\n document = defaultDocument,\n multiple,\n interval = \"requestAnimationFrame\",\n immediate = true\n } = options;\n const isSupported = useSupported(() => {\n if (toValue(multiple))\n return document && \"elementsFromPoint\" in document;\n return document && \"elementFromPoint\" in document;\n });\n const element = ref(null);\n const cb = () => {\n var _a, _b;\n element.value = toValue(multiple) ? (_a = document == null ? undefined : document.elementsFromPoint(toValue(x), toValue(y))) != null ? _a : [] : (_b = document == null ? undefined : document.elementFromPoint(toValue(x), toValue(y))) != null ? _b : null;\n };\n const controls = interval === \"requestAnimationFrame\" ? useRafFn(cb, { immediate }) : useIntervalFn(cb, interval, { immediate });\n return {\n isSupported,\n element,\n ...controls\n };\n}\n\nfunction useElementHover(el, options = {}) {\n const {\n delayEnter = 0,\n delayLeave = 0,\n triggerOnRemoval = false,\n window = defaultWindow\n } = options;\n const isHovered = ref(false);\n let timer;\n const toggle = (entering) => {\n const delay = entering ? delayEnter : delayLeave;\n if (timer) {\n clearTimeout(timer);\n timer = undefined;\n }\n if (delay)\n timer = setTimeout(() => isHovered.value = entering, delay);\n else\n isHovered.value = entering;\n };\n if (!window)\n return isHovered;\n useEventListener(el, \"mouseenter\", () => toggle(true), { passive: true });\n useEventListener(el, \"mouseleave\", () => toggle(false), { passive: true });\n if (triggerOnRemoval) {\n onElementRemoval(\n computed(() => unrefElement(el)),\n () => toggle(false)\n );\n }\n return isHovered;\n}\n\nfunction useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {\n const { window = defaultWindow, box = \"content-box\" } = options;\n const isSVG = computed(() => {\n var _a, _b;\n return (_b = (_a = unrefElement(target)) == null ? undefined : _a.namespaceURI) == null ? undefined : _b.includes(\"svg\");\n });\n const width = ref(initialSize.width);\n const height = ref(initialSize.height);\n const { stop: stop1 } = useResizeObserver(\n target,\n ([entry]) => {\n const boxSize = box === \"border-box\" ? entry.borderBoxSize : box === \"content-box\" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;\n if (window && isSVG.value) {\n const $elem = unrefElement(target);\n if ($elem) {\n const rect = $elem.getBoundingClientRect();\n width.value = rect.width;\n height.value = rect.height;\n }\n } else {\n if (boxSize) {\n const formatBoxSize = toArray(boxSize);\n width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);\n height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);\n } else {\n width.value = entry.contentRect.width;\n height.value = entry.contentRect.height;\n }\n }\n },\n options\n );\n tryOnMounted(() => {\n const ele = unrefElement(target);\n if (ele) {\n width.value = \"offsetWidth\" in ele ? ele.offsetWidth : initialSize.width;\n height.value = \"offsetHeight\" in ele ? ele.offsetHeight : initialSize.height;\n }\n });\n const stop2 = watch(\n () => unrefElement(target),\n (ele) => {\n width.value = ele ? initialSize.width : 0;\n height.value = ele ? initialSize.height : 0;\n }\n );\n function stop() {\n stop1();\n stop2();\n }\n return {\n width,\n height,\n stop\n };\n}\n\nfunction useIntersectionObserver(target, callback, options = {}) {\n const {\n root,\n rootMargin = \"0px\",\n threshold = 0,\n window = defaultWindow,\n immediate = true\n } = options;\n const isSupported = useSupported(() => window && \"IntersectionObserver\" in window);\n const targets = computed(() => {\n const _target = toValue(target);\n return toArray(_target).map(unrefElement).filter(notNullish);\n });\n let cleanup = noop;\n const isActive = ref(immediate);\n const stopWatch = isSupported.value ? watch(\n () => [targets.value, unrefElement(root), isActive.value],\n ([targets2, root2]) => {\n cleanup();\n if (!isActive.value)\n return;\n if (!targets2.length)\n return;\n const observer = new IntersectionObserver(\n callback,\n {\n root: unrefElement(root2),\n rootMargin,\n threshold\n }\n );\n targets2.forEach((el) => el && observer.observe(el));\n cleanup = () => {\n observer.disconnect();\n cleanup = noop;\n };\n },\n { immediate, flush: \"post\" }\n ) : noop;\n const stop = () => {\n cleanup();\n stopWatch();\n isActive.value = false;\n };\n tryOnScopeDispose(stop);\n return {\n isSupported,\n isActive,\n pause() {\n cleanup();\n isActive.value = false;\n },\n resume() {\n isActive.value = true;\n },\n stop\n };\n}\n\nfunction useElementVisibility(element, options = {}) {\n const {\n window = defaultWindow,\n scrollTarget,\n threshold = 0,\n rootMargin\n } = options;\n const elementIsVisible = ref(false);\n useIntersectionObserver(\n element,\n (intersectionObserverEntries) => {\n let isIntersecting = elementIsVisible.value;\n let latestTime = 0;\n for (const entry of intersectionObserverEntries) {\n if (entry.time >= latestTime) {\n latestTime = entry.time;\n isIntersecting = entry.isIntersecting;\n }\n }\n elementIsVisible.value = isIntersecting;\n },\n {\n root: scrollTarget,\n window,\n threshold,\n rootMargin: toValue(rootMargin)\n }\n );\n return elementIsVisible;\n}\n\nconst events = /* @__PURE__ */ new Map();\n\nfunction useEventBus(key) {\n const scope = getCurrentScope();\n function on(listener) {\n var _a;\n const listeners = events.get(key) || /* @__PURE__ */ new Set();\n listeners.add(listener);\n events.set(key, listeners);\n const _off = () => off(listener);\n (_a = scope == null ? undefined : scope.cleanups) == null ? undefined : _a.push(_off);\n return _off;\n }\n function once(listener) {\n function _listener(...args) {\n off(_listener);\n listener(...args);\n }\n return on(_listener);\n }\n function off(listener) {\n const listeners = events.get(key);\n if (!listeners)\n return;\n listeners.delete(listener);\n if (!listeners.size)\n reset();\n }\n function reset() {\n events.delete(key);\n }\n function emit(event, payload) {\n var _a;\n (_a = events.get(key)) == null ? undefined : _a.forEach((v) => v(event, payload));\n }\n return { on, once, off, emit, reset };\n}\n\nfunction resolveNestedOptions$1(options) {\n if (options === true)\n return {};\n return options;\n}\nfunction useEventSource(url, events = [], options = {}) {\n const event = ref(null);\n const data = ref(null);\n const status = ref(\"CONNECTING\");\n const eventSource = ref(null);\n const error = shallowRef(null);\n const urlRef = toRef(url);\n const lastEventId = shallowRef(null);\n let explicitlyClosed = false;\n let retried = 0;\n const {\n withCredentials = false,\n immediate = true,\n autoConnect = true,\n autoReconnect\n } = options;\n const close = () => {\n if (isClient && eventSource.value) {\n eventSource.value.close();\n eventSource.value = null;\n status.value = \"CLOSED\";\n explicitlyClosed = true;\n }\n };\n const _init = () => {\n if (explicitlyClosed || typeof urlRef.value === \"undefined\")\n return;\n const es = new EventSource(urlRef.value, { withCredentials });\n status.value = \"CONNECTING\";\n eventSource.value = es;\n es.onopen = () => {\n status.value = \"OPEN\";\n error.value = null;\n };\n es.onerror = (e) => {\n status.value = \"CLOSED\";\n error.value = e;\n if (es.readyState === 2 && !explicitlyClosed && autoReconnect) {\n es.close();\n const {\n retries = -1,\n delay = 1e3,\n onFailed\n } = resolveNestedOptions$1(autoReconnect);\n retried += 1;\n if (typeof retries === \"number\" && (retries < 0 || retried < retries))\n setTimeout(_init, delay);\n else if (typeof retries === \"function\" && retries())\n setTimeout(_init, delay);\n else\n onFailed == null ? undefined : onFailed();\n }\n };\n es.onmessage = (e) => {\n event.value = null;\n data.value = e.data;\n lastEventId.value = e.lastEventId;\n };\n for (const event_name of events) {\n useEventListener(es, event_name, (e) => {\n event.value = event_name;\n data.value = e.data || null;\n });\n }\n };\n const open = () => {\n if (!isClient)\n return;\n close();\n explicitlyClosed = false;\n retried = 0;\n _init();\n };\n if (immediate)\n open();\n if (autoConnect)\n watch(urlRef, open);\n tryOnScopeDispose(close);\n return {\n eventSource,\n event,\n data,\n status,\n error,\n open,\n close,\n lastEventId\n };\n}\n\nfunction useEyeDropper(options = {}) {\n const { initialValue = \"\" } = options;\n const isSupported = useSupported(() => typeof window !== \"undefined\" && \"EyeDropper\" in window);\n const sRGBHex = ref(initialValue);\n async function open(openOptions) {\n if (!isSupported.value)\n return;\n const eyeDropper = new window.EyeDropper();\n const result = await eyeDropper.open(openOptions);\n sRGBHex.value = result.sRGBHex;\n return result;\n }\n return { isSupported, sRGBHex, open };\n}\n\nfunction useFavicon(newIcon = null, options = {}) {\n const {\n baseUrl = \"\",\n rel = \"icon\",\n document = defaultDocument\n } = options;\n const favicon = toRef(newIcon);\n const applyIcon = (icon) => {\n const elements = document == null ? undefined : document.head.querySelectorAll(`link[rel*=\"${rel}\"]`);\n if (!elements || elements.length === 0) {\n const link = document == null ? undefined : document.createElement(\"link\");\n if (link) {\n link.rel = rel;\n link.href = `${baseUrl}${icon}`;\n link.type = `image/${icon.split(\".\").pop()}`;\n document == null ? undefined : document.head.append(link);\n }\n return;\n }\n elements == null ? undefined : elements.forEach((el) => el.href = `${baseUrl}${icon}`);\n };\n watch(\n favicon,\n (i, o) => {\n if (typeof i === \"string\" && i !== o)\n applyIcon(i);\n },\n { immediate: true }\n );\n return favicon;\n}\n\nconst payloadMapping = {\n json: \"application/json\",\n text: \"text/plain\"\n};\nfunction isFetchOptions(obj) {\n return obj && containsProp(obj, \"immediate\", \"refetch\", \"initialData\", \"timeout\", \"beforeFetch\", \"afterFetch\", \"onFetchError\", \"fetch\", \"updateDataOnError\");\n}\nconst reAbsolute = /^(?:[a-z][a-z\\d+\\-.]*:)?\\/\\//i;\nfunction isAbsoluteURL(url) {\n return reAbsolute.test(url);\n}\nfunction headersToObject(headers) {\n if (typeof Headers !== \"undefined\" && headers instanceof Headers)\n return Object.fromEntries(headers.entries());\n return headers;\n}\nfunction combineCallbacks(combination, ...callbacks) {\n if (combination === \"overwrite\") {\n return async (ctx) => {\n const callback = callbacks[callbacks.length - 1];\n if (callback)\n return { ...ctx, ...await callback(ctx) };\n return ctx;\n };\n } else {\n return async (ctx) => {\n for (const callback of callbacks) {\n if (callback)\n ctx = { ...ctx, ...await callback(ctx) };\n }\n return ctx;\n };\n }\n}\nfunction createFetch(config = {}) {\n const _combination = config.combination || \"chain\";\n const _options = config.options || {};\n const _fetchOptions = config.fetchOptions || {};\n function useFactoryFetch(url, ...args) {\n const computedUrl = computed(() => {\n const baseUrl = toValue(config.baseUrl);\n const targetUrl = toValue(url);\n return baseUrl && !isAbsoluteURL(targetUrl) ? joinPaths(baseUrl, targetUrl) : targetUrl;\n });\n let options = _options;\n let fetchOptions = _fetchOptions;\n if (args.length > 0) {\n if (isFetchOptions(args[0])) {\n options = {\n ...options,\n ...args[0],\n beforeFetch: combineCallbacks(_combination, _options.beforeFetch, args[0].beforeFetch),\n afterFetch: combineCallbacks(_combination, _options.afterFetch, args[0].afterFetch),\n onFetchError: combineCallbacks(_combination, _options.onFetchError, args[0].onFetchError)\n };\n } else {\n fetchOptions = {\n ...fetchOptions,\n ...args[0],\n headers: {\n ...headersToObject(fetchOptions.headers) || {},\n ...headersToObject(args[0].headers) || {}\n }\n };\n }\n }\n if (args.length > 1 && isFetchOptions(args[1])) {\n options = {\n ...options,\n ...args[1],\n beforeFetch: combineCallbacks(_combination, _options.beforeFetch, args[1].beforeFetch),\n afterFetch: combineCallbacks(_combination, _options.afterFetch, args[1].afterFetch),\n onFetchError: combineCallbacks(_combination, _options.onFetchError, args[1].onFetchError)\n };\n }\n return useFetch(computedUrl, fetchOptions, options);\n }\n return useFactoryFetch;\n}\nfunction useFetch(url, ...args) {\n var _a;\n const supportsAbort = typeof AbortController === \"function\";\n let fetchOptions = {};\n let options = {\n immediate: true,\n refetch: false,\n timeout: 0,\n updateDataOnError: false\n };\n const config = {\n method: \"GET\",\n type: \"text\",\n payload: undefined\n };\n if (args.length > 0) {\n if (isFetchOptions(args[0]))\n options = { ...options, ...args[0] };\n else\n fetchOptions = args[0];\n }\n if (args.length > 1) {\n if (isFetchOptions(args[1]))\n options = { ...options, ...args[1] };\n }\n const {\n fetch = (_a = defaultWindow) == null ? undefined : _a.fetch,\n initialData,\n timeout\n } = options;\n const responseEvent = createEventHook();\n const errorEvent = createEventHook();\n const finallyEvent = createEventHook();\n const isFinished = ref(false);\n const isFetching = ref(false);\n const aborted = ref(false);\n const statusCode = ref(null);\n const response = shallowRef(null);\n const error = shallowRef(null);\n const data = shallowRef(initialData || null);\n const canAbort = computed(() => supportsAbort && isFetching.value);\n let controller;\n let timer;\n const abort = () => {\n if (supportsAbort) {\n controller == null ? undefined : controller.abort();\n controller = new AbortController();\n controller.signal.onabort = () => aborted.value = true;\n fetchOptions = {\n ...fetchOptions,\n signal: controller.signal\n };\n }\n };\n const loading = (isLoading) => {\n isFetching.value = isLoading;\n isFinished.value = !isLoading;\n };\n if (timeout)\n timer = useTimeoutFn(abort, timeout, { immediate: false });\n let executeCounter = 0;\n const execute = async (throwOnFailed = false) => {\n var _a2, _b;\n abort();\n loading(true);\n error.value = null;\n statusCode.value = null;\n aborted.value = false;\n executeCounter += 1;\n const currentExecuteCounter = executeCounter;\n const defaultFetchOptions = {\n method: config.method,\n headers: {}\n };\n const payload = toValue(config.payload);\n if (payload) {\n const headers = headersToObject(defaultFetchOptions.headers);\n const proto = Object.getPrototypeOf(payload);\n if (!config.payloadType && payload && (proto === Object.prototype || Array.isArray(proto)) && !(payload instanceof FormData))\n config.payloadType = \"json\";\n if (config.payloadType)\n headers[\"Content-Type\"] = (_a2 = payloadMapping[config.payloadType]) != null ? _a2 : config.payloadType;\n defaultFetchOptions.body = config.payloadType === \"json\" ? JSON.stringify(payload) : payload;\n }\n let isCanceled = false;\n const context = {\n url: toValue(url),\n options: {\n ...defaultFetchOptions,\n ...fetchOptions\n },\n cancel: () => {\n isCanceled = true;\n }\n };\n if (options.beforeFetch)\n Object.assign(context, await options.beforeFetch(context));\n if (isCanceled || !fetch) {\n loading(false);\n return Promise.resolve(null);\n }\n let responseData = null;\n if (timer)\n timer.start();\n return fetch(\n context.url,\n {\n ...defaultFetchOptions,\n ...context.options,\n headers: {\n ...headersToObject(defaultFetchOptions.headers),\n ...headersToObject((_b = context.options) == null ? undefined : _b.headers)\n }\n }\n ).then(async (fetchResponse) => {\n response.value = fetchResponse;\n statusCode.value = fetchResponse.status;\n responseData = await fetchResponse.clone()[config.type]();\n if (!fetchResponse.ok) {\n data.value = initialData || null;\n throw new Error(fetchResponse.statusText);\n }\n if (options.afterFetch) {\n ({ data: responseData } = await options.afterFetch({\n data: responseData,\n response: fetchResponse\n }));\n }\n data.value = responseData;\n responseEvent.trigger(fetchResponse);\n return fetchResponse;\n }).catch(async (fetchError) => {\n let errorData = fetchError.message || fetchError.name;\n if (options.onFetchError) {\n ({ error: errorData, data: responseData } = await options.onFetchError({\n data: responseData,\n error: fetchError,\n response: response.value\n }));\n }\n error.value = errorData;\n if (options.updateDataOnError)\n data.value = responseData;\n errorEvent.trigger(fetchError);\n if (throwOnFailed)\n throw fetchError;\n return null;\n }).finally(() => {\n if (currentExecuteCounter === executeCounter)\n loading(false);\n if (timer)\n timer.stop();\n finallyEvent.trigger(null);\n });\n };\n const refetch = toRef(options.refetch);\n watch(\n [\n refetch,\n toRef(url)\n ],\n ([refetch2]) => refetch2 && execute(),\n { deep: true }\n );\n const shell = {\n isFinished: readonly(isFinished),\n isFetching: readonly(isFetching),\n statusCode,\n response,\n error,\n data,\n canAbort,\n aborted,\n abort,\n execute,\n onFetchResponse: responseEvent.on,\n onFetchError: errorEvent.on,\n onFetchFinally: finallyEvent.on,\n // method\n get: setMethod(\"GET\"),\n put: setMethod(\"PUT\"),\n post: setMethod(\"POST\"),\n delete: setMethod(\"DELETE\"),\n patch: setMethod(\"PATCH\"),\n head: setMethod(\"HEAD\"),\n options: setMethod(\"OPTIONS\"),\n // type\n json: setType(\"json\"),\n text: setType(\"text\"),\n blob: setType(\"blob\"),\n arrayBuffer: setType(\"arrayBuffer\"),\n formData: setType(\"formData\")\n };\n function setMethod(method) {\n return (payload, payloadType) => {\n if (!isFetching.value) {\n config.method = method;\n config.payload = payload;\n config.payloadType = payloadType;\n if (isRef(config.payload)) {\n watch(\n [\n refetch,\n toRef(config.payload)\n ],\n ([refetch2]) => refetch2 && execute(),\n { deep: true }\n );\n }\n return {\n ...shell,\n then(onFulfilled, onRejected) {\n return waitUntilFinished().then(onFulfilled, onRejected);\n }\n };\n }\n return undefined;\n };\n }\n function waitUntilFinished() {\n return new Promise((resolve, reject) => {\n until(isFinished).toBe(true).then(() => resolve(shell)).catch(reject);\n });\n }\n function setType(type) {\n return () => {\n if (!isFetching.value) {\n config.type = type;\n return {\n ...shell,\n then(onFulfilled, onRejected) {\n return waitUntilFinished().then(onFulfilled, onRejected);\n }\n };\n }\n return undefined;\n };\n }\n if (options.immediate)\n Promise.resolve().then(() => execute());\n return {\n ...shell,\n then(onFulfilled, onRejected) {\n return waitUntilFinished().then(onFulfilled, onRejected);\n }\n };\n}\nfunction joinPaths(start, end) {\n if (!start.endsWith(\"/\") && !end.startsWith(\"/\")) {\n return `${start}/${end}`;\n }\n if (start.endsWith(\"/\") && end.startsWith(\"/\")) {\n return `${start.slice(0, -1)}${end}`;\n }\n return `${start}${end}`;\n}\n\nconst DEFAULT_OPTIONS = {\n multiple: true,\n accept: \"*\",\n reset: false,\n directory: false\n};\nfunction useFileDialog(options = {}) {\n const {\n document = defaultDocument\n } = options;\n const files = ref(null);\n const { on: onChange, trigger: changeTrigger } = createEventHook();\n const { on: onCancel, trigger: cancelTrigger } = createEventHook();\n let input;\n if (document) {\n input = document.createElement(\"input\");\n input.type = \"file\";\n input.onchange = (event) => {\n const result = event.target;\n files.value = result.files;\n changeTrigger(files.value);\n };\n input.oncancel = () => {\n cancelTrigger();\n };\n }\n const reset = () => {\n files.value = null;\n if (input && input.value) {\n input.value = \"\";\n changeTrigger(null);\n }\n };\n const open = (localOptions) => {\n if (!input)\n return;\n const _options = {\n ...DEFAULT_OPTIONS,\n ...options,\n ...localOptions\n };\n input.multiple = _options.multiple;\n input.accept = _options.accept;\n input.webkitdirectory = _options.directory;\n if (hasOwn(_options, \"capture\"))\n input.capture = _options.capture;\n if (_options.reset)\n reset();\n input.click();\n };\n return {\n files: readonly(files),\n open,\n reset,\n onCancel,\n onChange\n };\n}\n\nfunction useFileSystemAccess(options = {}) {\n const {\n window: _window = defaultWindow,\n dataType = \"Text\"\n } = options;\n const window = _window;\n const isSupported = useSupported(() => window && \"showSaveFilePicker\" in window && \"showOpenFilePicker\" in window);\n const fileHandle = ref();\n const data = ref();\n const file = ref();\n const fileName = computed(() => {\n var _a, _b;\n return (_b = (_a = file.value) == null ? undefined : _a.name) != null ? _b : \"\";\n });\n const fileMIME = computed(() => {\n var _a, _b;\n return (_b = (_a = file.value) == null ? undefined : _a.type) != null ? _b : \"\";\n });\n const fileSize = computed(() => {\n var _a, _b;\n return (_b = (_a = file.value) == null ? undefined : _a.size) != null ? _b : 0;\n });\n const fileLastModified = computed(() => {\n var _a, _b;\n return (_b = (_a = file.value) == null ? undefined : _a.lastModified) != null ? _b : 0;\n });\n async function open(_options = {}) {\n if (!isSupported.value)\n return;\n const [handle] = await window.showOpenFilePicker({ ...toValue(options), ..._options });\n fileHandle.value = handle;\n await updateData();\n }\n async function create(_options = {}) {\n if (!isSupported.value)\n return;\n fileHandle.value = await window.showSaveFilePicker({ ...options, ..._options });\n data.value = undefined;\n await updateData();\n }\n async function save(_options = {}) {\n if (!isSupported.value)\n return;\n if (!fileHandle.value)\n return saveAs(_options);\n if (data.value) {\n const writableStream = await fileHandle.value.createWritable();\n await writableStream.write(data.value);\n await writableStream.close();\n }\n await updateFile();\n }\n async function saveAs(_options = {}) {\n if (!isSupported.value)\n return;\n fileHandle.value = await window.showSaveFilePicker({ ...options, ..._options });\n if (data.value) {\n const writableStream = await fileHandle.value.createWritable();\n await writableStream.write(data.value);\n await writableStream.close();\n }\n await updateFile();\n }\n async function updateFile() {\n var _a;\n file.value = await ((_a = fileHandle.value) == null ? undefined : _a.getFile());\n }\n async function updateData() {\n var _a, _b;\n await updateFile();\n const type = toValue(dataType);\n if (type === \"Text\")\n data.value = await ((_a = file.value) == null ? undefined : _a.text());\n else if (type === \"ArrayBuffer\")\n data.value = await ((_b = file.value) == null ? undefined : _b.arrayBuffer());\n else if (type === \"Blob\")\n data.value = file.value;\n }\n watch(() => toValue(dataType), updateData);\n return {\n isSupported,\n data,\n file,\n fileName,\n fileMIME,\n fileSize,\n fileLastModified,\n open,\n create,\n save,\n saveAs,\n updateData\n };\n}\n\nfunction useFocus(target, options = {}) {\n const { initialValue = false, focusVisible = false, preventScroll = false } = options;\n const innerFocused = ref(false);\n const targetElement = computed(() => unrefElement(target));\n const listenerOptions = { passive: true };\n useEventListener(targetElement, \"focus\", (event) => {\n var _a, _b;\n if (!focusVisible || ((_b = (_a = event.target).matches) == null ? undefined : _b.call(_a, \":focus-visible\")))\n innerFocused.value = true;\n }, listenerOptions);\n useEventListener(targetElement, \"blur\", () => innerFocused.value = false, listenerOptions);\n const focused = computed({\n get: () => innerFocused.value,\n set(value) {\n var _a, _b;\n if (!value && innerFocused.value)\n (_a = targetElement.value) == null ? undefined : _a.blur();\n else if (value && !innerFocused.value)\n (_b = targetElement.value) == null ? undefined : _b.focus({ preventScroll });\n }\n });\n watch(\n targetElement,\n () => {\n focused.value = initialValue;\n },\n { immediate: true, flush: \"post\" }\n );\n return { focused };\n}\n\nconst EVENT_FOCUS_IN = \"focusin\";\nconst EVENT_FOCUS_OUT = \"focusout\";\nconst PSEUDO_CLASS_FOCUS_WITHIN = \":focus-within\";\nfunction useFocusWithin(target, options = {}) {\n const { window = defaultWindow } = options;\n const targetElement = computed(() => unrefElement(target));\n const _focused = ref(false);\n const focused = computed(() => _focused.value);\n const activeElement = useActiveElement(options);\n if (!window || !activeElement.value) {\n return { focused };\n }\n const listenerOptions = { passive: true };\n useEventListener(targetElement, EVENT_FOCUS_IN, () => _focused.value = true, listenerOptions);\n useEventListener(targetElement, EVENT_FOCUS_OUT, () => {\n var _a, _b, _c;\n return _focused.value = (_c = (_b = (_a = targetElement.value) == null ? undefined : _a.matches) == null ? undefined : _b.call(_a, PSEUDO_CLASS_FOCUS_WITHIN)) != null ? _c : false;\n }, listenerOptions);\n return { focused };\n}\n\nfunction useFps(options) {\n var _a;\n const fps = ref(0);\n if (typeof performance === \"undefined\")\n return fps;\n const every = (_a = options == null ? undefined : options.every) != null ? _a : 10;\n let last = performance.now();\n let ticks = 0;\n useRafFn(() => {\n ticks += 1;\n if (ticks >= every) {\n const now = performance.now();\n const diff = now - last;\n fps.value = Math.round(1e3 / (diff / ticks));\n last = now;\n ticks = 0;\n }\n });\n return fps;\n}\n\nconst eventHandlers = [\n \"fullscreenchange\",\n \"webkitfullscreenchange\",\n \"webkitendfullscreen\",\n \"mozfullscreenchange\",\n \"MSFullscreenChange\"\n];\nfunction useFullscreen(target, options = {}) {\n const {\n document = defaultDocument,\n autoExit = false\n } = options;\n const targetRef = computed(() => {\n var _a;\n return (_a = unrefElement(target)) != null ? _a : document == null ? undefined : document.querySelector(\"html\");\n });\n const isFullscreen = ref(false);\n const requestMethod = computed(() => {\n return [\n \"requestFullscreen\",\n \"webkitRequestFullscreen\",\n \"webkitEnterFullscreen\",\n \"webkitEnterFullScreen\",\n \"webkitRequestFullScreen\",\n \"mozRequestFullScreen\",\n \"msRequestFullscreen\"\n ].find((m) => document && m in document || targetRef.value && m in targetRef.value);\n });\n const exitMethod = computed(() => {\n return [\n \"exitFullscreen\",\n \"webkitExitFullscreen\",\n \"webkitExitFullScreen\",\n \"webkitCancelFullScreen\",\n \"mozCancelFullScreen\",\n \"msExitFullscreen\"\n ].find((m) => document && m in document || targetRef.value && m in targetRef.value);\n });\n const fullscreenEnabled = computed(() => {\n return [\n \"fullScreen\",\n \"webkitIsFullScreen\",\n \"webkitDisplayingFullscreen\",\n \"mozFullScreen\",\n \"msFullscreenElement\"\n ].find((m) => document && m in document || targetRef.value && m in targetRef.value);\n });\n const fullscreenElementMethod = [\n \"fullscreenElement\",\n \"webkitFullscreenElement\",\n \"mozFullScreenElement\",\n \"msFullscreenElement\"\n ].find((m) => document && m in document);\n const isSupported = useSupported(() => targetRef.value && document && requestMethod.value !== undefined && exitMethod.value !== undefined && fullscreenEnabled.value !== undefined);\n const isCurrentElementFullScreen = () => {\n if (fullscreenElementMethod)\n return (document == null ? undefined : document[fullscreenElementMethod]) === targetRef.value;\n return false;\n };\n const isElementFullScreen = () => {\n if (fullscreenEnabled.value) {\n if (document && document[fullscreenEnabled.value] != null) {\n return document[fullscreenEnabled.value];\n } else {\n const target2 = targetRef.value;\n if ((target2 == null ? undefined : target2[fullscreenEnabled.value]) != null) {\n return Boolean(target2[fullscreenEnabled.value]);\n }\n }\n }\n return false;\n };\n async function exit() {\n if (!isSupported.value || !isFullscreen.value)\n return;\n if (exitMethod.value) {\n if ((document == null ? undefined : document[exitMethod.value]) != null) {\n await document[exitMethod.value]();\n } else {\n const target2 = targetRef.value;\n if ((target2 == null ? undefined : target2[exitMethod.value]) != null)\n await target2[exitMethod.value]();\n }\n }\n isFullscreen.value = false;\n }\n async function enter() {\n if (!isSupported.value || isFullscreen.value)\n return;\n if (isElementFullScreen())\n await exit();\n const target2 = targetRef.value;\n if (requestMethod.value && (target2 == null ? undefined : target2[requestMethod.value]) != null) {\n await target2[requestMethod.value]();\n isFullscreen.value = true;\n }\n }\n async function toggle() {\n await (isFullscreen.value ? exit() : enter());\n }\n const handlerCallback = () => {\n const isElementFullScreenValue = isElementFullScreen();\n if (!isElementFullScreenValue || isElementFullScreenValue && isCurrentElementFullScreen())\n isFullscreen.value = isElementFullScreenValue;\n };\n const listenerOptions = { capture: false, passive: true };\n useEventListener(document, eventHandlers, handlerCallback, listenerOptions);\n useEventListener(() => unrefElement(targetRef), eventHandlers, handlerCallback, listenerOptions);\n if (autoExit)\n tryOnScopeDispose(exit);\n return {\n isSupported,\n isFullscreen,\n enter,\n exit,\n toggle\n };\n}\n\nfunction mapGamepadToXbox360Controller(gamepad) {\n return computed(() => {\n if (gamepad.value) {\n return {\n buttons: {\n a: gamepad.value.buttons[0],\n b: gamepad.value.buttons[1],\n x: gamepad.value.buttons[2],\n y: gamepad.value.buttons[3]\n },\n bumper: {\n left: gamepad.value.buttons[4],\n right: gamepad.value.buttons[5]\n },\n triggers: {\n left: gamepad.value.buttons[6],\n right: gamepad.value.buttons[7]\n },\n stick: {\n left: {\n horizontal: gamepad.value.axes[0],\n vertical: gamepad.value.axes[1],\n button: gamepad.value.buttons[10]\n },\n right: {\n horizontal: gamepad.value.axes[2],\n vertical: gamepad.value.axes[3],\n button: gamepad.value.buttons[11]\n }\n },\n dpad: {\n up: gamepad.value.buttons[12],\n down: gamepad.value.buttons[13],\n left: gamepad.value.buttons[14],\n right: gamepad.value.buttons[15]\n },\n back: gamepad.value.buttons[8],\n start: gamepad.value.buttons[9]\n };\n }\n return null;\n });\n}\nfunction useGamepad(options = {}) {\n const {\n navigator = defaultNavigator\n } = options;\n const isSupported = useSupported(() => navigator && \"getGamepads\" in navigator);\n const gamepads = ref([]);\n const onConnectedHook = createEventHook();\n const onDisconnectedHook = createEventHook();\n const stateFromGamepad = (gamepad) => {\n const hapticActuators = [];\n const vibrationActuator = \"vibrationActuator\" in gamepad ? gamepad.vibrationActuator : null;\n if (vibrationActuator)\n hapticActuators.push(vibrationActuator);\n if (gamepad.hapticActuators)\n hapticActuators.push(...gamepad.hapticActuators);\n return {\n id: gamepad.id,\n index: gamepad.index,\n connected: gamepad.connected,\n mapping: gamepad.mapping,\n timestamp: gamepad.timestamp,\n vibrationActuator: gamepad.vibrationActuator,\n hapticActuators,\n axes: gamepad.axes.map((axes) => axes),\n buttons: gamepad.buttons.map((button) => ({ pressed: button.pressed, touched: button.touched, value: button.value }))\n };\n };\n const updateGamepadState = () => {\n const _gamepads = (navigator == null ? undefined : navigator.getGamepads()) || [];\n for (const gamepad of _gamepads) {\n if (gamepad && gamepads.value[gamepad.index])\n gamepads.value[gamepad.index] = stateFromGamepad(gamepad);\n }\n };\n const { isActive, pause, resume } = useRafFn(updateGamepadState);\n const onGamepadConnected = (gamepad) => {\n if (!gamepads.value.some(({ index }) => index === gamepad.index)) {\n gamepads.value.push(stateFromGamepad(gamepad));\n onConnectedHook.trigger(gamepad.index);\n }\n resume();\n };\n const onGamepadDisconnected = (gamepad) => {\n gamepads.value = gamepads.value.filter((x) => x.index !== gamepad.index);\n onDisconnectedHook.trigger(gamepad.index);\n };\n const listenerOptions = { passive: true };\n useEventListener(\"gamepadconnected\", (e) => onGamepadConnected(e.gamepad), listenerOptions);\n useEventListener(\"gamepaddisconnected\", (e) => onGamepadDisconnected(e.gamepad), listenerOptions);\n tryOnMounted(() => {\n const _gamepads = (navigator == null ? undefined : navigator.getGamepads()) || [];\n for (const gamepad of _gamepads) {\n if (gamepad && gamepads.value[gamepad.index])\n onGamepadConnected(gamepad);\n }\n });\n pause();\n return {\n isSupported,\n onConnected: onConnectedHook.on,\n onDisconnected: onDisconnectedHook.on,\n gamepads,\n pause,\n resume,\n isActive\n };\n}\n\nfunction useGeolocation(options = {}) {\n const {\n enableHighAccuracy = true,\n maximumAge = 3e4,\n timeout = 27e3,\n navigator = defaultNavigator,\n immediate = true\n } = options;\n const isSupported = useSupported(() => navigator && \"geolocation\" in navigator);\n const locatedAt = ref(null);\n const error = shallowRef(null);\n const coords = ref({\n accuracy: 0,\n latitude: Number.POSITIVE_INFINITY,\n longitude: Number.POSITIVE_INFINITY,\n altitude: null,\n altitudeAccuracy: null,\n heading: null,\n speed: null\n });\n function updatePosition(position) {\n locatedAt.value = position.timestamp;\n coords.value = position.coords;\n error.value = null;\n }\n let watcher;\n function resume() {\n if (isSupported.value) {\n watcher = navigator.geolocation.watchPosition(\n updatePosition,\n (err) => error.value = err,\n {\n enableHighAccuracy,\n maximumAge,\n timeout\n }\n );\n }\n }\n if (immediate)\n resume();\n function pause() {\n if (watcher && navigator)\n navigator.geolocation.clearWatch(watcher);\n }\n tryOnScopeDispose(() => {\n pause();\n });\n return {\n isSupported,\n coords,\n locatedAt,\n error,\n resume,\n pause\n };\n}\n\nconst defaultEvents$1 = [\"mousemove\", \"mousedown\", \"resize\", \"keydown\", \"touchstart\", \"wheel\"];\nconst oneMinute = 6e4;\nfunction useIdle(timeout = oneMinute, options = {}) {\n const {\n initialState = false,\n listenForVisibilityChange = true,\n events = defaultEvents$1,\n window = defaultWindow,\n eventFilter = throttleFilter(50)\n } = options;\n const idle = ref(initialState);\n const lastActive = ref(timestamp());\n let timer;\n const reset = () => {\n idle.value = false;\n clearTimeout(timer);\n timer = setTimeout(() => idle.value = true, timeout);\n };\n const onEvent = createFilterWrapper(\n eventFilter,\n () => {\n lastActive.value = timestamp();\n reset();\n }\n );\n if (window) {\n const document = window.document;\n const listenerOptions = { passive: true };\n for (const event of events)\n useEventListener(window, event, onEvent, listenerOptions);\n if (listenForVisibilityChange) {\n useEventListener(document, \"visibilitychange\", () => {\n if (!document.hidden)\n onEvent();\n }, listenerOptions);\n }\n reset();\n }\n return {\n idle,\n lastActive,\n reset\n };\n}\n\nasync function loadImage(options) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n const { src, srcset, sizes, class: clazz, loading, crossorigin, referrerPolicy, width, height, decoding, fetchPriority, ismap, usemap } = options;\n img.src = src;\n if (srcset != null)\n img.srcset = srcset;\n if (sizes != null)\n img.sizes = sizes;\n if (clazz != null)\n img.className = clazz;\n if (loading != null)\n img.loading = loading;\n if (crossorigin != null)\n img.crossOrigin = crossorigin;\n if (referrerPolicy != null)\n img.referrerPolicy = referrerPolicy;\n if (width != null)\n img.width = width;\n if (height != null)\n img.height = height;\n if (decoding != null)\n img.decoding = decoding;\n if (fetchPriority != null)\n img.fetchPriority = fetchPriority;\n if (ismap != null)\n img.isMap = ismap;\n if (usemap != null)\n img.useMap = usemap;\n img.onload = () => resolve(img);\n img.onerror = reject;\n });\n}\nfunction useImage(options, asyncStateOptions = {}) {\n const state = useAsyncState(\n () => loadImage(toValue(options)),\n undefined,\n {\n resetOnExecute: true,\n ...asyncStateOptions\n }\n );\n watch(\n () => toValue(options),\n () => state.execute(asyncStateOptions.delay),\n { deep: true }\n );\n return state;\n}\n\nfunction resolveElement(el) {\n if (typeof Window !== \"undefined\" && el instanceof Window)\n return el.document.documentElement;\n if (typeof Document !== \"undefined\" && el instanceof Document)\n return el.documentElement;\n return el;\n}\n\nconst ARRIVED_STATE_THRESHOLD_PIXELS = 1;\nfunction useScroll(element, options = {}) {\n const {\n throttle = 0,\n idle = 200,\n onStop = noop,\n onScroll = noop,\n offset = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n },\n eventListenerOptions = {\n capture: false,\n passive: true\n },\n behavior = \"auto\",\n window = defaultWindow,\n onError = (e) => {\n console.error(e);\n }\n } = options;\n const internalX = ref(0);\n const internalY = ref(0);\n const x = computed({\n get() {\n return internalX.value;\n },\n set(x2) {\n scrollTo(x2, undefined);\n }\n });\n const y = computed({\n get() {\n return internalY.value;\n },\n set(y2) {\n scrollTo(undefined, y2);\n }\n });\n function scrollTo(_x, _y) {\n var _a, _b, _c, _d;\n if (!window)\n return;\n const _element = toValue(element);\n if (!_element)\n return;\n (_c = _element instanceof Document ? window.document.body : _element) == null ? undefined : _c.scrollTo({\n top: (_a = toValue(_y)) != null ? _a : y.value,\n left: (_b = toValue(_x)) != null ? _b : x.value,\n behavior: toValue(behavior)\n });\n const scrollContainer = ((_d = _element == null ? undefined : _element.document) == null ? undefined : _d.documentElement) || (_element == null ? undefined : _element.documentElement) || _element;\n if (x != null)\n internalX.value = scrollContainer.scrollLeft;\n if (y != null)\n internalY.value = scrollContainer.scrollTop;\n }\n const isScrolling = ref(false);\n const arrivedState = reactive({\n left: true,\n right: false,\n top: true,\n bottom: false\n });\n const directions = reactive({\n left: false,\n right: false,\n top: false,\n bottom: false\n });\n const onScrollEnd = (e) => {\n if (!isScrolling.value)\n return;\n isScrolling.value = false;\n directions.left = false;\n directions.right = false;\n directions.top = false;\n directions.bottom = false;\n onStop(e);\n };\n const onScrollEndDebounced = useDebounceFn(onScrollEnd, throttle + idle);\n const setArrivedState = (target) => {\n var _a;\n if (!window)\n return;\n const el = ((_a = target == null ? undefined : target.document) == null ? undefined : _a.documentElement) || (target == null ? undefined : target.documentElement) || unrefElement(target);\n const { display, flexDirection, direction } = getComputedStyle(el);\n const directionMultipler = direction === \"rtl\" ? -1 : 1;\n const scrollLeft = el.scrollLeft;\n directions.left = scrollLeft < internalX.value;\n directions.right = scrollLeft > internalX.value;\n const left = scrollLeft * directionMultipler <= (offset.left || 0);\n const right = scrollLeft * directionMultipler + el.clientWidth >= el.scrollWidth - (offset.right || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;\n if (display === \"flex\" && flexDirection === \"row-reverse\") {\n arrivedState.left = right;\n arrivedState.right = left;\n } else {\n arrivedState.left = left;\n arrivedState.right = right;\n }\n internalX.value = scrollLeft;\n let scrollTop = el.scrollTop;\n if (target === window.document && !scrollTop)\n scrollTop = window.document.body.scrollTop;\n directions.top = scrollTop < internalY.value;\n directions.bottom = scrollTop > internalY.value;\n const top = scrollTop <= (offset.top || 0);\n const bottom = scrollTop + el.clientHeight >= el.scrollHeight - (offset.bottom || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;\n if (display === \"flex\" && flexDirection === \"column-reverse\") {\n arrivedState.top = bottom;\n arrivedState.bottom = top;\n } else {\n arrivedState.top = top;\n arrivedState.bottom = bottom;\n }\n internalY.value = scrollTop;\n };\n const onScrollHandler = (e) => {\n var _a;\n if (!window)\n return;\n const eventTarget = (_a = e.target.documentElement) != null ? _a : e.target;\n setArrivedState(eventTarget);\n isScrolling.value = true;\n onScrollEndDebounced(e);\n onScroll(e);\n };\n useEventListener(\n element,\n \"scroll\",\n throttle ? useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler,\n eventListenerOptions\n );\n tryOnMounted(() => {\n try {\n const _element = toValue(element);\n if (!_element)\n return;\n setArrivedState(_element);\n } catch (e) {\n onError(e);\n }\n });\n useEventListener(\n element,\n \"scrollend\",\n onScrollEnd,\n eventListenerOptions\n );\n return {\n x,\n y,\n isScrolling,\n arrivedState,\n directions,\n measure() {\n const _element = toValue(element);\n if (window && _element)\n setArrivedState(_element);\n }\n };\n}\n\nfunction useInfiniteScroll(element, onLoadMore, options = {}) {\n var _a;\n const {\n direction = \"bottom\",\n interval = 100,\n canLoadMore = () => true\n } = options;\n const state = reactive(useScroll(\n element,\n {\n ...options,\n offset: {\n [direction]: (_a = options.distance) != null ? _a : 0,\n ...options.offset\n }\n }\n ));\n const promise = ref();\n const isLoading = computed(() => !!promise.value);\n const observedElement = computed(() => {\n return resolveElement(toValue(element));\n });\n const isElementVisible = useElementVisibility(observedElement);\n function checkAndLoad() {\n state.measure();\n if (!observedElement.value || !isElementVisible.value || !canLoadMore(observedElement.value))\n return;\n const { scrollHeight, clientHeight, scrollWidth, clientWidth } = observedElement.value;\n const isNarrower = direction === \"bottom\" || direction === \"top\" ? scrollHeight <= clientHeight : scrollWidth <= clientWidth;\n if (state.arrivedState[direction] || isNarrower) {\n if (!promise.value) {\n promise.value = Promise.all([\n onLoadMore(state),\n new Promise((resolve) => setTimeout(resolve, interval))\n ]).finally(() => {\n promise.value = null;\n nextTick(() => checkAndLoad());\n });\n }\n }\n }\n const stop = watch(\n () => [state.arrivedState[direction], isElementVisible.value],\n checkAndLoad,\n { immediate: true }\n );\n tryOnUnmounted(stop);\n return {\n isLoading,\n reset() {\n nextTick(() => checkAndLoad());\n }\n };\n}\n\nconst defaultEvents = [\"mousedown\", \"mouseup\", \"keydown\", \"keyup\"];\nfunction useKeyModifier(modifier, options = {}) {\n const {\n events = defaultEvents,\n document = defaultDocument,\n initial = null\n } = options;\n const state = ref(initial);\n if (document) {\n events.forEach((listenerEvent) => {\n useEventListener(document, listenerEvent, (evt) => {\n if (typeof evt.getModifierState === \"function\")\n state.value = evt.getModifierState(modifier);\n });\n });\n }\n return state;\n}\n\nfunction useLocalStorage(key, initialValue, options = {}) {\n const { window = defaultWindow } = options;\n return useStorage(key, initialValue, window == null ? undefined : window.localStorage, options);\n}\n\nconst DefaultMagicKeysAliasMap = {\n ctrl: \"control\",\n command: \"meta\",\n cmd: \"meta\",\n option: \"alt\",\n up: \"arrowup\",\n down: \"arrowdown\",\n left: \"arrowleft\",\n right: \"arrowright\"\n};\n\nfunction useMagicKeys(options = {}) {\n const {\n reactive: useReactive = false,\n target = defaultWindow,\n aliasMap = DefaultMagicKeysAliasMap,\n passive = true,\n onEventFired = noop\n } = options;\n const current = reactive(/* @__PURE__ */ new Set());\n const obj = {\n toJSON() {\n return {};\n },\n current\n };\n const refs = useReactive ? reactive(obj) : obj;\n const metaDeps = /* @__PURE__ */ new Set();\n const usedKeys = /* @__PURE__ */ new Set();\n function setRefs(key, value) {\n if (key in refs) {\n if (useReactive)\n refs[key] = value;\n else\n refs[key].value = value;\n }\n }\n function reset() {\n current.clear();\n for (const key of usedKeys)\n setRefs(key, false);\n }\n function updateRefs(e, value) {\n var _a, _b;\n const key = (_a = e.key) == null ? undefined : _a.toLowerCase();\n const code = (_b = e.code) == null ? undefined : _b.toLowerCase();\n const values = [code, key].filter(Boolean);\n if (key) {\n if (value)\n current.add(key);\n else\n current.delete(key);\n }\n for (const key2 of values) {\n usedKeys.add(key2);\n setRefs(key2, value);\n }\n if (key === \"meta\" && !value) {\n metaDeps.forEach((key2) => {\n current.delete(key2);\n setRefs(key2, false);\n });\n metaDeps.clear();\n } else if (typeof e.getModifierState === \"function\" && e.getModifierState(\"Meta\") && value) {\n [...current, ...values].forEach((key2) => metaDeps.add(key2));\n }\n }\n useEventListener(target, \"keydown\", (e) => {\n updateRefs(e, true);\n return onEventFired(e);\n }, { passive });\n useEventListener(target, \"keyup\", (e) => {\n updateRefs(e, false);\n return onEventFired(e);\n }, { passive });\n useEventListener(\"blur\", reset, { passive });\n useEventListener(\"focus\", reset, { passive });\n const proxy = new Proxy(\n refs,\n {\n get(target2, prop, rec) {\n if (typeof prop !== \"string\")\n return Reflect.get(target2, prop, rec);\n prop = prop.toLowerCase();\n if (prop in aliasMap)\n prop = aliasMap[prop];\n if (!(prop in refs)) {\n if (/[+_-]/.test(prop)) {\n const keys = prop.split(/[+_-]/g).map((i) => i.trim());\n refs[prop] = computed(() => keys.every((key) => toValue(proxy[key])));\n } else {\n refs[prop] = ref(false);\n }\n }\n const r = Reflect.get(target2, prop, rec);\n return useReactive ? toValue(r) : r;\n }\n }\n );\n return proxy;\n}\n\nfunction usingElRef(source, cb) {\n if (toValue(source))\n cb(toValue(source));\n}\nfunction timeRangeToArray(timeRanges) {\n let ranges = [];\n for (let i = 0; i < timeRanges.length; ++i)\n ranges = [...ranges, [timeRanges.start(i), timeRanges.end(i)]];\n return ranges;\n}\nfunction tracksToArray(tracks) {\n return Array.from(tracks).map(({ label, kind, language, mode, activeCues, cues, inBandMetadataTrackDispatchType }, id) => ({ id, label, kind, language, mode, activeCues, cues, inBandMetadataTrackDispatchType }));\n}\nconst defaultOptions = {\n src: \"\",\n tracks: []\n};\nfunction useMediaControls(target, options = {}) {\n target = toRef(target);\n options = {\n ...defaultOptions,\n ...options\n };\n const {\n document = defaultDocument\n } = options;\n const currentTime = ref(0);\n const duration = ref(0);\n const seeking = ref(false);\n const volume = ref(1);\n const waiting = ref(false);\n const ended = ref(false);\n const playing = ref(false);\n const rate = ref(1);\n const stalled = ref(false);\n const buffered = ref([]);\n const tracks = ref([]);\n const selectedTrack = ref(-1);\n const isPictureInPicture = ref(false);\n const muted = ref(false);\n const supportsPictureInPicture = document && \"pictureInPictureEnabled\" in document;\n const sourceErrorEvent = createEventHook();\n const playbackErrorEvent = createEventHook();\n const disableTrack = (track) => {\n usingElRef(target, (el) => {\n if (track) {\n const id = typeof track === \"number\" ? track : track.id;\n el.textTracks[id].mode = \"disabled\";\n } else {\n for (let i = 0; i < el.textTracks.length; ++i)\n el.textTracks[i].mode = \"disabled\";\n }\n selectedTrack.value = -1;\n });\n };\n const enableTrack = (track, disableTracks = true) => {\n usingElRef(target, (el) => {\n const id = typeof track === \"number\" ? track : track.id;\n if (disableTracks)\n disableTrack();\n el.textTracks[id].mode = \"showing\";\n selectedTrack.value = id;\n });\n };\n const togglePictureInPicture = () => {\n return new Promise((resolve, reject) => {\n usingElRef(target, async (el) => {\n if (supportsPictureInPicture) {\n if (!isPictureInPicture.value) {\n el.requestPictureInPicture().then(resolve).catch(reject);\n } else {\n document.exitPictureInPicture().then(resolve).catch(reject);\n }\n }\n });\n });\n };\n watchEffect(() => {\n if (!document)\n return;\n const el = toValue(target);\n if (!el)\n return;\n const src = toValue(options.src);\n let sources = [];\n if (!src)\n return;\n if (typeof src === \"string\")\n sources = [{ src }];\n else if (Array.isArray(src))\n sources = src;\n else if (isObject(src))\n sources = [src];\n el.querySelectorAll(\"source\").forEach((e) => {\n e.removeEventListener(\"error\", sourceErrorEvent.trigger);\n e.remove();\n });\n sources.forEach(({ src: src2, type, media }) => {\n const source = document.createElement(\"source\");\n source.setAttribute(\"src\", src2);\n source.setAttribute(\"type\", type || \"\");\n source.setAttribute(\"media\", media || \"\");\n source.addEventListener(\"error\", sourceErrorEvent.trigger);\n el.appendChild(source);\n });\n el.load();\n });\n tryOnScopeDispose(() => {\n const el = toValue(target);\n if (!el)\n return;\n el.querySelectorAll(\"source\").forEach((e) => e.removeEventListener(\"error\", sourceErrorEvent.trigger));\n });\n watch([target, volume], () => {\n const el = toValue(target);\n if (!el)\n return;\n el.volume = volume.value;\n });\n watch([target, muted], () => {\n const el = toValue(target);\n if (!el)\n return;\n el.muted = muted.value;\n });\n watch([target, rate], () => {\n const el = toValue(target);\n if (!el)\n return;\n el.playbackRate = rate.value;\n });\n watchEffect(() => {\n if (!document)\n return;\n const textTracks = toValue(options.tracks);\n const el = toValue(target);\n if (!textTracks || !textTracks.length || !el)\n return;\n el.querySelectorAll(\"track\").forEach((e) => e.remove());\n textTracks.forEach(({ default: isDefault, kind, label, src, srcLang }, i) => {\n const track = document.createElement(\"track\");\n track.default = isDefault || false;\n track.kind = kind;\n track.label = label;\n track.src = src;\n track.srclang = srcLang;\n if (track.default)\n selectedTrack.value = i;\n el.appendChild(track);\n });\n });\n const { ignoreUpdates: ignoreCurrentTimeUpdates } = watchIgnorable(currentTime, (time) => {\n const el = toValue(target);\n if (!el)\n return;\n el.currentTime = time;\n });\n const { ignoreUpdates: ignorePlayingUpdates } = watchIgnorable(playing, (isPlaying) => {\n const el = toValue(target);\n if (!el)\n return;\n if (isPlaying) {\n el.play().catch((e) => {\n playbackErrorEvent.trigger(e);\n throw e;\n });\n } else {\n el.pause();\n }\n });\n const listenerOptions = { passive: true };\n useEventListener(\n target,\n \"timeupdate\",\n () => ignoreCurrentTimeUpdates(() => currentTime.value = toValue(target).currentTime),\n listenerOptions\n );\n useEventListener(\n target,\n \"durationchange\",\n () => duration.value = toValue(target).duration,\n listenerOptions\n );\n useEventListener(\n target,\n \"progress\",\n () => buffered.value = timeRangeToArray(toValue(target).buffered),\n listenerOptions\n );\n useEventListener(\n target,\n \"seeking\",\n () => seeking.value = true,\n listenerOptions\n );\n useEventListener(\n target,\n \"seeked\",\n () => seeking.value = false,\n listenerOptions\n );\n useEventListener(\n target,\n [\"waiting\", \"loadstart\"],\n () => {\n waiting.value = true;\n ignorePlayingUpdates(() => playing.value = false);\n },\n listenerOptions\n );\n useEventListener(\n target,\n \"loadeddata\",\n () => waiting.value = false,\n listenerOptions\n );\n useEventListener(\n target,\n \"playing\",\n () => {\n waiting.value = false;\n ended.value = false;\n ignorePlayingUpdates(() => playing.value = true);\n },\n listenerOptions\n );\n useEventListener(\n target,\n \"ratechange\",\n () => rate.value = toValue(target).playbackRate,\n listenerOptions\n );\n useEventListener(\n target,\n \"stalled\",\n () => stalled.value = true,\n listenerOptions\n );\n useEventListener(\n target,\n \"ended\",\n () => ended.value = true,\n listenerOptions\n );\n useEventListener(\n target,\n \"pause\",\n () => ignorePlayingUpdates(() => playing.value = false),\n listenerOptions\n );\n useEventListener(\n target,\n \"play\",\n () => ignorePlayingUpdates(() => playing.value = true),\n listenerOptions\n );\n useEventListener(\n target,\n \"enterpictureinpicture\",\n () => isPictureInPicture.value = true,\n listenerOptions\n );\n useEventListener(\n target,\n \"leavepictureinpicture\",\n () => isPictureInPicture.value = false,\n listenerOptions\n );\n useEventListener(\n target,\n \"volumechange\",\n () => {\n const el = toValue(target);\n if (!el)\n return;\n volume.value = el.volume;\n muted.value = el.muted;\n },\n listenerOptions\n );\n const listeners = [];\n const stop = watch([target], () => {\n const el = toValue(target);\n if (!el)\n return;\n stop();\n listeners[0] = useEventListener(el.textTracks, \"addtrack\", () => tracks.value = tracksToArray(el.textTracks), listenerOptions);\n listeners[1] = useEventListener(el.textTracks, \"removetrack\", () => tracks.value = tracksToArray(el.textTracks), listenerOptions);\n listeners[2] = useEventListener(el.textTracks, \"change\", () => tracks.value = tracksToArray(el.textTracks), listenerOptions);\n });\n tryOnScopeDispose(() => listeners.forEach((listener) => listener()));\n return {\n currentTime,\n duration,\n waiting,\n seeking,\n ended,\n stalled,\n buffered,\n playing,\n rate,\n // Volume\n volume,\n muted,\n // Tracks\n tracks,\n selectedTrack,\n enableTrack,\n disableTrack,\n // Picture in Picture\n supportsPictureInPicture,\n togglePictureInPicture,\n isPictureInPicture,\n // Events\n onSourceError: sourceErrorEvent.on,\n onPlaybackError: playbackErrorEvent.on\n };\n}\n\nfunction useMemoize(resolver, options) {\n const initCache = () => {\n if (options == null ? undefined : options.cache)\n return shallowReactive(options.cache);\n return shallowReactive(/* @__PURE__ */ new Map());\n };\n const cache = initCache();\n const generateKey = (...args) => (options == null ? undefined : options.getKey) ? options.getKey(...args) : JSON.stringify(args);\n const _loadData = (key, ...args) => {\n cache.set(key, resolver(...args));\n return cache.get(key);\n };\n const loadData = (...args) => _loadData(generateKey(...args), ...args);\n const deleteData = (...args) => {\n cache.delete(generateKey(...args));\n };\n const clearData = () => {\n cache.clear();\n };\n const memoized = (...args) => {\n const key = generateKey(...args);\n if (cache.has(key))\n return cache.get(key);\n return _loadData(key, ...args);\n };\n memoized.load = loadData;\n memoized.delete = deleteData;\n memoized.clear = clearData;\n memoized.generateKey = generateKey;\n memoized.cache = cache;\n return memoized;\n}\n\nfunction useMemory(options = {}) {\n const memory = ref();\n const isSupported = useSupported(() => typeof performance !== \"undefined\" && \"memory\" in performance);\n if (isSupported.value) {\n const { interval = 1e3 } = options;\n useIntervalFn(() => {\n memory.value = performance.memory;\n }, interval, { immediate: options.immediate, immediateCallback: options.immediateCallback });\n }\n return { isSupported, memory };\n}\n\nconst UseMouseBuiltinExtractors = {\n page: (event) => [event.pageX, event.pageY],\n client: (event) => [event.clientX, event.clientY],\n screen: (event) => [event.screenX, event.screenY],\n movement: (event) => event instanceof Touch ? null : [event.movementX, event.movementY]\n};\nfunction useMouse(options = {}) {\n const {\n type = \"page\",\n touch = true,\n resetOnTouchEnds = false,\n initialValue = { x: 0, y: 0 },\n window = defaultWindow,\n target = window,\n scroll = true,\n eventFilter\n } = options;\n let _prevMouseEvent = null;\n let _prevScrollX = 0;\n let _prevScrollY = 0;\n const x = ref(initialValue.x);\n const y = ref(initialValue.y);\n const sourceType = ref(null);\n const extractor = typeof type === \"function\" ? type : UseMouseBuiltinExtractors[type];\n const mouseHandler = (event) => {\n const result = extractor(event);\n _prevMouseEvent = event;\n if (result) {\n [x.value, y.value] = result;\n sourceType.value = \"mouse\";\n }\n if (window) {\n _prevScrollX = window.scrollX;\n _prevScrollY = window.scrollY;\n }\n };\n const touchHandler = (event) => {\n if (event.touches.length > 0) {\n const result = extractor(event.touches[0]);\n if (result) {\n [x.value, y.value] = result;\n sourceType.value = \"touch\";\n }\n }\n };\n const scrollHandler = () => {\n if (!_prevMouseEvent || !window)\n return;\n const pos = extractor(_prevMouseEvent);\n if (_prevMouseEvent instanceof MouseEvent && pos) {\n x.value = pos[0] + window.scrollX - _prevScrollX;\n y.value = pos[1] + window.scrollY - _prevScrollY;\n }\n };\n const reset = () => {\n x.value = initialValue.x;\n y.value = initialValue.y;\n };\n const mouseHandlerWrapper = eventFilter ? (event) => eventFilter(() => mouseHandler(event), {}) : (event) => mouseHandler(event);\n const touchHandlerWrapper = eventFilter ? (event) => eventFilter(() => touchHandler(event), {}) : (event) => touchHandler(event);\n const scrollHandlerWrapper = eventFilter ? () => eventFilter(() => scrollHandler(), {}) : () => scrollHandler();\n if (target) {\n const listenerOptions = { passive: true };\n useEventListener(target, [\"mousemove\", \"dragover\"], mouseHandlerWrapper, listenerOptions);\n if (touch && type !== \"movement\") {\n useEventListener(target, [\"touchstart\", \"touchmove\"], touchHandlerWrapper, listenerOptions);\n if (resetOnTouchEnds)\n useEventListener(target, \"touchend\", reset, listenerOptions);\n }\n if (scroll && type === \"page\")\n useEventListener(window, \"scroll\", scrollHandlerWrapper, listenerOptions);\n }\n return {\n x,\n y,\n sourceType\n };\n}\n\nfunction useMouseInElement(target, options = {}) {\n const {\n handleOutside = true,\n window = defaultWindow\n } = options;\n const type = options.type || \"page\";\n const { x, y, sourceType } = useMouse(options);\n const targetRef = ref(target != null ? target : window == null ? undefined : window.document.body);\n const elementX = ref(0);\n const elementY = ref(0);\n const elementPositionX = ref(0);\n const elementPositionY = ref(0);\n const elementHeight = ref(0);\n const elementWidth = ref(0);\n const isOutside = ref(true);\n let stop = () => {\n };\n if (window) {\n stop = watch(\n [targetRef, x, y],\n () => {\n const el = unrefElement(targetRef);\n if (!el || !(el instanceof Element))\n return;\n const {\n left,\n top,\n width,\n height\n } = el.getBoundingClientRect();\n elementPositionX.value = left + (type === \"page\" ? window.pageXOffset : 0);\n elementPositionY.value = top + (type === \"page\" ? window.pageYOffset : 0);\n elementHeight.value = height;\n elementWidth.value = width;\n const elX = x.value - elementPositionX.value;\n const elY = y.value - elementPositionY.value;\n isOutside.value = width === 0 || height === 0 || elX < 0 || elY < 0 || elX > width || elY > height;\n if (handleOutside || !isOutside.value) {\n elementX.value = elX;\n elementY.value = elY;\n }\n },\n { immediate: true }\n );\n useEventListener(\n document,\n \"mouseleave\",\n () => isOutside.value = true,\n { passive: true }\n );\n }\n return {\n x,\n y,\n sourceType,\n elementX,\n elementY,\n elementPositionX,\n elementPositionY,\n elementHeight,\n elementWidth,\n isOutside,\n stop\n };\n}\n\nfunction useMousePressed(options = {}) {\n const {\n touch = true,\n drag = true,\n capture = false,\n initialValue = false,\n window = defaultWindow\n } = options;\n const pressed = ref(initialValue);\n const sourceType = ref(null);\n if (!window) {\n return {\n pressed,\n sourceType\n };\n }\n const onPressed = (srcType) => (event) => {\n var _a;\n pressed.value = true;\n sourceType.value = srcType;\n (_a = options.onPressed) == null ? undefined : _a.call(options, event);\n };\n const onReleased = (event) => {\n var _a;\n pressed.value = false;\n sourceType.value = null;\n (_a = options.onReleased) == null ? undefined : _a.call(options, event);\n };\n const target = computed(() => unrefElement(options.target) || window);\n const listenerOptions = { passive: true, capture };\n useEventListener(target, \"mousedown\", onPressed(\"mouse\"), listenerOptions);\n useEventListener(window, \"mouseleave\", onReleased, listenerOptions);\n useEventListener(window, \"mouseup\", onReleased, listenerOptions);\n if (drag) {\n useEventListener(target, \"dragstart\", onPressed(\"mouse\"), listenerOptions);\n useEventListener(window, \"drop\", onReleased, listenerOptions);\n useEventListener(window, \"dragend\", onReleased, listenerOptions);\n }\n if (touch) {\n useEventListener(target, \"touchstart\", onPressed(\"touch\"), listenerOptions);\n useEventListener(window, \"touchend\", onReleased, listenerOptions);\n useEventListener(window, \"touchcancel\", onReleased, listenerOptions);\n }\n return {\n pressed,\n sourceType\n };\n}\n\nfunction useNavigatorLanguage(options = {}) {\n const { window = defaultWindow } = options;\n const navigator = window == null ? undefined : window.navigator;\n const isSupported = useSupported(() => navigator && \"language\" in navigator);\n const language = ref(navigator == null ? undefined : navigator.language);\n useEventListener(window, \"languagechange\", () => {\n if (navigator)\n language.value = navigator.language;\n }, { passive: true });\n return {\n isSupported,\n language\n };\n}\n\nfunction useNetwork(options = {}) {\n const { window = defaultWindow } = options;\n const navigator = window == null ? undefined : window.navigator;\n const isSupported = useSupported(() => navigator && \"connection\" in navigator);\n const isOnline = ref(true);\n const saveData = ref(false);\n const offlineAt = ref(undefined);\n const onlineAt = ref(undefined);\n const downlink = ref(undefined);\n const downlinkMax = ref(undefined);\n const rtt = ref(undefined);\n const effectiveType = ref(undefined);\n const type = ref(\"unknown\");\n const connection = isSupported.value && navigator.connection;\n function updateNetworkInformation() {\n if (!navigator)\n return;\n isOnline.value = navigator.onLine;\n offlineAt.value = isOnline.value ? undefined : Date.now();\n onlineAt.value = isOnline.value ? Date.now() : undefined;\n if (connection) {\n downlink.value = connection.downlink;\n downlinkMax.value = connection.downlinkMax;\n effectiveType.value = connection.effectiveType;\n rtt.value = connection.rtt;\n saveData.value = connection.saveData;\n type.value = connection.type;\n }\n }\n const listenerOptions = { passive: true };\n if (window) {\n useEventListener(window, \"offline\", () => {\n isOnline.value = false;\n offlineAt.value = Date.now();\n }, listenerOptions);\n useEventListener(window, \"online\", () => {\n isOnline.value = true;\n onlineAt.value = Date.now();\n }, listenerOptions);\n }\n if (connection)\n useEventListener(connection, \"change\", updateNetworkInformation, listenerOptions);\n updateNetworkInformation();\n return {\n isSupported,\n isOnline: readonly(isOnline),\n saveData: readonly(saveData),\n offlineAt: readonly(offlineAt),\n onlineAt: readonly(onlineAt),\n downlink: readonly(downlink),\n downlinkMax: readonly(downlinkMax),\n effectiveType: readonly(effectiveType),\n rtt: readonly(rtt),\n type: readonly(type)\n };\n}\n\nfunction useNow(options = {}) {\n const {\n controls: exposeControls = false,\n interval = \"requestAnimationFrame\"\n } = options;\n const now = ref(/* @__PURE__ */ new Date());\n const update = () => now.value = /* @__PURE__ */ new Date();\n const controls = interval === \"requestAnimationFrame\" ? useRafFn(update, { immediate: true }) : useIntervalFn(update, interval, { immediate: true });\n if (exposeControls) {\n return {\n now,\n ...controls\n };\n } else {\n return now;\n }\n}\n\nfunction useObjectUrl(object) {\n const url = ref();\n const release = () => {\n if (url.value)\n URL.revokeObjectURL(url.value);\n url.value = undefined;\n };\n watch(\n () => toValue(object),\n (newObject) => {\n release();\n if (newObject)\n url.value = URL.createObjectURL(newObject);\n },\n { immediate: true }\n );\n tryOnScopeDispose(release);\n return readonly(url);\n}\n\nfunction useClamp(value, min, max) {\n if (typeof value === \"function\" || isReadonly(value))\n return computed(() => clamp(toValue(value), toValue(min), toValue(max)));\n const _value = ref(value);\n return computed({\n get() {\n return _value.value = clamp(_value.value, toValue(min), toValue(max));\n },\n set(value2) {\n _value.value = clamp(value2, toValue(min), toValue(max));\n }\n });\n}\n\nfunction useOffsetPagination(options) {\n const {\n total = Number.POSITIVE_INFINITY,\n pageSize = 10,\n page = 1,\n onPageChange = noop,\n onPageSizeChange = noop,\n onPageCountChange = noop\n } = options;\n const currentPageSize = useClamp(pageSize, 1, Number.POSITIVE_INFINITY);\n const pageCount = computed(() => Math.max(\n 1,\n Math.ceil(toValue(total) / toValue(currentPageSize))\n ));\n const currentPage = useClamp(page, 1, pageCount);\n const isFirstPage = computed(() => currentPage.value === 1);\n const isLastPage = computed(() => currentPage.value === pageCount.value);\n if (isRef(page)) {\n syncRef(page, currentPage, {\n direction: isReadonly(page) ? \"ltr\" : \"both\"\n });\n }\n if (isRef(pageSize)) {\n syncRef(pageSize, currentPageSize, {\n direction: isReadonly(pageSize) ? \"ltr\" : \"both\"\n });\n }\n function prev() {\n currentPage.value--;\n }\n function next() {\n currentPage.value++;\n }\n const returnValue = {\n currentPage,\n currentPageSize,\n pageCount,\n isFirstPage,\n isLastPage,\n prev,\n next\n };\n watch(currentPage, () => {\n onPageChange(reactive(returnValue));\n });\n watch(currentPageSize, () => {\n onPageSizeChange(reactive(returnValue));\n });\n watch(pageCount, () => {\n onPageCountChange(reactive(returnValue));\n });\n return returnValue;\n}\n\nfunction useOnline(options = {}) {\n const { isOnline } = useNetwork(options);\n return isOnline;\n}\n\nfunction usePageLeave(options = {}) {\n const { window = defaultWindow } = options;\n const isLeft = ref(false);\n const handler = (event) => {\n if (!window)\n return;\n event = event || window.event;\n const from = event.relatedTarget || event.toElement;\n isLeft.value = !from;\n };\n if (window) {\n const listenerOptions = { passive: true };\n useEventListener(window, \"mouseout\", handler, listenerOptions);\n useEventListener(window.document, \"mouseleave\", handler, listenerOptions);\n useEventListener(window.document, \"mouseenter\", handler, listenerOptions);\n }\n return isLeft;\n}\n\nfunction useScreenOrientation(options = {}) {\n const {\n window = defaultWindow\n } = options;\n const isSupported = useSupported(() => window && \"screen\" in window && \"orientation\" in window.screen);\n const screenOrientation = isSupported.value ? window.screen.orientation : {};\n const orientation = ref(screenOrientation.type);\n const angle = ref(screenOrientation.angle || 0);\n if (isSupported.value) {\n useEventListener(window, \"orientationchange\", () => {\n orientation.value = screenOrientation.type;\n angle.value = screenOrientation.angle;\n }, { passive: true });\n }\n const lockOrientation = (type) => {\n if (isSupported.value && typeof screenOrientation.lock === \"function\")\n return screenOrientation.lock(type);\n return Promise.reject(new Error(\"Not supported\"));\n };\n const unlockOrientation = () => {\n if (isSupported.value && typeof screenOrientation.unlock === \"function\")\n screenOrientation.unlock();\n };\n return {\n isSupported,\n orientation,\n angle,\n lockOrientation,\n unlockOrientation\n };\n}\n\nfunction useParallax(target, options = {}) {\n const {\n deviceOrientationTiltAdjust = (i) => i,\n deviceOrientationRollAdjust = (i) => i,\n mouseTiltAdjust = (i) => i,\n mouseRollAdjust = (i) => i,\n window = defaultWindow\n } = options;\n const orientation = reactive(useDeviceOrientation({ window }));\n const screenOrientation = reactive(useScreenOrientation({ window }));\n const {\n elementX: x,\n elementY: y,\n elementWidth: width,\n elementHeight: height\n } = useMouseInElement(target, { handleOutside: false, window });\n const source = computed(() => {\n if (orientation.isSupported && (orientation.alpha != null && orientation.alpha !== 0 || orientation.gamma != null && orientation.gamma !== 0)) {\n return \"deviceOrientation\";\n }\n return \"mouse\";\n });\n const roll = computed(() => {\n if (source.value === \"deviceOrientation\") {\n let value;\n switch (screenOrientation.orientation) {\n case \"landscape-primary\":\n value = orientation.gamma / 90;\n break;\n case \"landscape-secondary\":\n value = -orientation.gamma / 90;\n break;\n case \"portrait-primary\":\n value = -orientation.beta / 90;\n break;\n case \"portrait-secondary\":\n value = orientation.beta / 90;\n break;\n default:\n value = -orientation.beta / 90;\n }\n return deviceOrientationRollAdjust(value);\n } else {\n const value = -(y.value - height.value / 2) / height.value;\n return mouseRollAdjust(value);\n }\n });\n const tilt = computed(() => {\n if (source.value === \"deviceOrientation\") {\n let value;\n switch (screenOrientation.orientation) {\n case \"landscape-primary\":\n value = orientation.beta / 90;\n break;\n case \"landscape-secondary\":\n value = -orientation.beta / 90;\n break;\n case \"portrait-primary\":\n value = orientation.gamma / 90;\n break;\n case \"portrait-secondary\":\n value = -orientation.gamma / 90;\n break;\n default:\n value = orientation.gamma / 90;\n }\n return deviceOrientationTiltAdjust(value);\n } else {\n const value = (x.value - width.value / 2) / width.value;\n return mouseTiltAdjust(value);\n }\n });\n return { roll, tilt, source };\n}\n\nfunction useParentElement(element = useCurrentElement()) {\n const parentElement = shallowRef();\n const update = () => {\n const el = unrefElement(element);\n if (el)\n parentElement.value = el.parentElement;\n };\n tryOnMounted(update);\n watch(() => toValue(element), update);\n return parentElement;\n}\n\nfunction usePerformanceObserver(options, callback) {\n const {\n window = defaultWindow,\n immediate = true,\n ...performanceOptions\n } = options;\n const isSupported = useSupported(() => window && \"PerformanceObserver\" in window);\n let observer;\n const stop = () => {\n observer == null ? undefined : observer.disconnect();\n };\n const start = () => {\n if (isSupported.value) {\n stop();\n observer = new PerformanceObserver(callback);\n observer.observe(performanceOptions);\n }\n };\n tryOnScopeDispose(stop);\n if (immediate)\n start();\n return {\n isSupported,\n start,\n stop\n };\n}\n\nconst defaultState = {\n x: 0,\n y: 0,\n pointerId: 0,\n pressure: 0,\n tiltX: 0,\n tiltY: 0,\n width: 0,\n height: 0,\n twist: 0,\n pointerType: null\n};\nconst keys = /* @__PURE__ */ Object.keys(defaultState);\nfunction usePointer(options = {}) {\n const {\n target = defaultWindow\n } = options;\n const isInside = ref(false);\n const state = ref(options.initialValue || {});\n Object.assign(state.value, defaultState, state.value);\n const handler = (event) => {\n isInside.value = true;\n if (options.pointerTypes && !options.pointerTypes.includes(event.pointerType))\n return;\n state.value = objectPick(event, keys, false);\n };\n if (target) {\n const listenerOptions = { passive: true };\n useEventListener(target, [\"pointerdown\", \"pointermove\", \"pointerup\"], handler, listenerOptions);\n useEventListener(target, \"pointerleave\", () => isInside.value = false, listenerOptions);\n }\n return {\n ...toRefs(state),\n isInside\n };\n}\n\nfunction usePointerLock(target, options = {}) {\n const { document = defaultDocument } = options;\n const isSupported = useSupported(() => document && \"pointerLockElement\" in document);\n const element = ref();\n const triggerElement = ref();\n let targetElement;\n if (isSupported.value) {\n const listenerOptions = { passive: true };\n useEventListener(document, \"pointerlockchange\", () => {\n var _a;\n const currentElement = (_a = document.pointerLockElement) != null ? _a : element.value;\n if (targetElement && currentElement === targetElement) {\n element.value = document.pointerLockElement;\n if (!element.value)\n targetElement = triggerElement.value = null;\n }\n }, listenerOptions);\n useEventListener(document, \"pointerlockerror\", () => {\n var _a;\n const currentElement = (_a = document.pointerLockElement) != null ? _a : element.value;\n if (targetElement && currentElement === targetElement) {\n const action = document.pointerLockElement ? \"release\" : \"acquire\";\n throw new Error(`Failed to ${action} pointer lock.`);\n }\n }, listenerOptions);\n }\n async function lock(e) {\n var _a;\n if (!isSupported.value)\n throw new Error(\"Pointer Lock API is not supported by your browser.\");\n triggerElement.value = e instanceof Event ? e.currentTarget : null;\n targetElement = e instanceof Event ? (_a = unrefElement(target)) != null ? _a : triggerElement.value : unrefElement(e);\n if (!targetElement)\n throw new Error(\"Target element undefined.\");\n targetElement.requestPointerLock();\n return await until(element).toBe(targetElement);\n }\n async function unlock() {\n if (!element.value)\n return false;\n document.exitPointerLock();\n await until(element).toBeNull();\n return true;\n }\n return {\n isSupported,\n element,\n triggerElement,\n lock,\n unlock\n };\n}\n\nfunction usePointerSwipe(target, options = {}) {\n const targetRef = toRef(target);\n const {\n threshold = 50,\n onSwipe,\n onSwipeEnd,\n onSwipeStart,\n disableTextSelect = false\n } = options;\n const posStart = reactive({ x: 0, y: 0 });\n const updatePosStart = (x, y) => {\n posStart.x = x;\n posStart.y = y;\n };\n const posEnd = reactive({ x: 0, y: 0 });\n const updatePosEnd = (x, y) => {\n posEnd.x = x;\n posEnd.y = y;\n };\n const distanceX = computed(() => posStart.x - posEnd.x);\n const distanceY = computed(() => posStart.y - posEnd.y);\n const { max, abs } = Math;\n const isThresholdExceeded = computed(() => max(abs(distanceX.value), abs(distanceY.value)) >= threshold);\n const isSwiping = ref(false);\n const isPointerDown = ref(false);\n const direction = computed(() => {\n if (!isThresholdExceeded.value)\n return \"none\";\n if (abs(distanceX.value) > abs(distanceY.value)) {\n return distanceX.value > 0 ? \"left\" : \"right\";\n } else {\n return distanceY.value > 0 ? \"up\" : \"down\";\n }\n });\n const eventIsAllowed = (e) => {\n var _a, _b, _c;\n const isReleasingButton = e.buttons === 0;\n const isPrimaryButton = e.buttons === 1;\n return (_c = (_b = (_a = options.pointerTypes) == null ? undefined : _a.includes(e.pointerType)) != null ? _b : isReleasingButton || isPrimaryButton) != null ? _c : true;\n };\n const listenerOptions = { passive: true };\n const stops = [\n useEventListener(target, \"pointerdown\", (e) => {\n if (!eventIsAllowed(e))\n return;\n isPointerDown.value = true;\n const eventTarget = e.target;\n eventTarget == null ? undefined : eventTarget.setPointerCapture(e.pointerId);\n const { clientX: x, clientY: y } = e;\n updatePosStart(x, y);\n updatePosEnd(x, y);\n onSwipeStart == null ? undefined : onSwipeStart(e);\n }, listenerOptions),\n useEventListener(target, \"pointermove\", (e) => {\n if (!eventIsAllowed(e))\n return;\n if (!isPointerDown.value)\n return;\n const { clientX: x, clientY: y } = e;\n updatePosEnd(x, y);\n if (!isSwiping.value && isThresholdExceeded.value)\n isSwiping.value = true;\n if (isSwiping.value)\n onSwipe == null ? undefined : onSwipe(e);\n }, listenerOptions),\n useEventListener(target, \"pointerup\", (e) => {\n if (!eventIsAllowed(e))\n return;\n if (isSwiping.value)\n onSwipeEnd == null ? undefined : onSwipeEnd(e, direction.value);\n isPointerDown.value = false;\n isSwiping.value = false;\n }, listenerOptions)\n ];\n tryOnMounted(() => {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n (_b = (_a = targetRef.value) == null ? undefined : _a.style) == null ? undefined : _b.setProperty(\"touch-action\", \"none\");\n if (disableTextSelect) {\n (_d = (_c = targetRef.value) == null ? undefined : _c.style) == null ? undefined : _d.setProperty(\"-webkit-user-select\", \"none\");\n (_f = (_e = targetRef.value) == null ? undefined : _e.style) == null ? undefined : _f.setProperty(\"-ms-user-select\", \"none\");\n (_h = (_g = targetRef.value) == null ? undefined : _g.style) == null ? undefined : _h.setProperty(\"user-select\", \"none\");\n }\n });\n const stop = () => stops.forEach((s) => s());\n return {\n isSwiping: readonly(isSwiping),\n direction: readonly(direction),\n posStart: readonly(posStart),\n posEnd: readonly(posEnd),\n distanceX,\n distanceY,\n stop\n };\n}\n\nfunction usePreferredColorScheme(options) {\n const isLight = useMediaQuery(\"(prefers-color-scheme: light)\", options);\n const isDark = useMediaQuery(\"(prefers-color-scheme: dark)\", options);\n return computed(() => {\n if (isDark.value)\n return \"dark\";\n if (isLight.value)\n return \"light\";\n return \"no-preference\";\n });\n}\n\nfunction usePreferredContrast(options) {\n const isMore = useMediaQuery(\"(prefers-contrast: more)\", options);\n const isLess = useMediaQuery(\"(prefers-contrast: less)\", options);\n const isCustom = useMediaQuery(\"(prefers-contrast: custom)\", options);\n return computed(() => {\n if (isMore.value)\n return \"more\";\n if (isLess.value)\n return \"less\";\n if (isCustom.value)\n return \"custom\";\n return \"no-preference\";\n });\n}\n\nfunction usePreferredLanguages(options = {}) {\n const { window = defaultWindow } = options;\n if (!window)\n return ref([\"en\"]);\n const navigator = window.navigator;\n const value = ref(navigator.languages);\n useEventListener(window, \"languagechange\", () => {\n value.value = navigator.languages;\n }, { passive: true });\n return value;\n}\n\nfunction usePreferredReducedMotion(options) {\n const isReduced = useMediaQuery(\"(prefers-reduced-motion: reduce)\", options);\n return computed(() => {\n if (isReduced.value)\n return \"reduce\";\n return \"no-preference\";\n });\n}\n\nfunction usePreferredReducedTransparency(options) {\n const isReduced = useMediaQuery(\"(prefers-reduced-transparency: reduce)\", options);\n return computed(() => {\n if (isReduced.value)\n return \"reduce\";\n return \"no-preference\";\n });\n}\n\nfunction usePrevious(value, initialValue) {\n const previous = shallowRef(initialValue);\n watch(\n toRef(value),\n (_, oldValue) => {\n previous.value = oldValue;\n },\n { flush: \"sync\" }\n );\n return readonly(previous);\n}\n\nconst topVarName = \"--vueuse-safe-area-top\";\nconst rightVarName = \"--vueuse-safe-area-right\";\nconst bottomVarName = \"--vueuse-safe-area-bottom\";\nconst leftVarName = \"--vueuse-safe-area-left\";\nfunction useScreenSafeArea() {\n const top = ref(\"\");\n const right = ref(\"\");\n const bottom = ref(\"\");\n const left = ref(\"\");\n if (isClient) {\n const topCssVar = useCssVar(topVarName);\n const rightCssVar = useCssVar(rightVarName);\n const bottomCssVar = useCssVar(bottomVarName);\n const leftCssVar = useCssVar(leftVarName);\n topCssVar.value = \"env(safe-area-inset-top, 0px)\";\n rightCssVar.value = \"env(safe-area-inset-right, 0px)\";\n bottomCssVar.value = \"env(safe-area-inset-bottom, 0px)\";\n leftCssVar.value = \"env(safe-area-inset-left, 0px)\";\n update();\n useEventListener(\"resize\", useDebounceFn(update), { passive: true });\n }\n function update() {\n top.value = getValue(topVarName);\n right.value = getValue(rightVarName);\n bottom.value = getValue(bottomVarName);\n left.value = getValue(leftVarName);\n }\n return {\n top,\n right,\n bottom,\n left,\n update\n };\n}\nfunction getValue(position) {\n return getComputedStyle(document.documentElement).getPropertyValue(position);\n}\n\nfunction useScriptTag(src, onLoaded = noop, options = {}) {\n const {\n immediate = true,\n manual = false,\n type = \"text/javascript\",\n async = true,\n crossOrigin,\n referrerPolicy,\n noModule,\n defer,\n document = defaultDocument,\n attrs = {}\n } = options;\n const scriptTag = ref(null);\n let _promise = null;\n const loadScript = (waitForScriptLoad) => new Promise((resolve, reject) => {\n const resolveWithElement = (el2) => {\n scriptTag.value = el2;\n resolve(el2);\n return el2;\n };\n if (!document) {\n resolve(false);\n return;\n }\n let shouldAppend = false;\n let el = document.querySelector(`script[src=\"${toValue(src)}\"]`);\n if (!el) {\n el = document.createElement(\"script\");\n el.type = type;\n el.async = async;\n el.src = toValue(src);\n if (defer)\n el.defer = defer;\n if (crossOrigin)\n el.crossOrigin = crossOrigin;\n if (noModule)\n el.noModule = noModule;\n if (referrerPolicy)\n el.referrerPolicy = referrerPolicy;\n Object.entries(attrs).forEach(([name, value]) => el == null ? undefined : el.setAttribute(name, value));\n shouldAppend = true;\n } else if (el.hasAttribute(\"data-loaded\")) {\n resolveWithElement(el);\n }\n el.addEventListener(\"error\", (event) => reject(event));\n el.addEventListener(\"abort\", (event) => reject(event));\n el.addEventListener(\"load\", () => {\n el.setAttribute(\"data-loaded\", \"true\");\n onLoaded(el);\n resolveWithElement(el);\n });\n if (shouldAppend)\n el = document.head.appendChild(el);\n if (!waitForScriptLoad)\n resolveWithElement(el);\n });\n const load = (waitForScriptLoad = true) => {\n if (!_promise)\n _promise = loadScript(waitForScriptLoad);\n return _promise;\n };\n const unload = () => {\n if (!document)\n return;\n _promise = null;\n if (scriptTag.value)\n scriptTag.value = null;\n const el = document.querySelector(`script[src=\"${toValue(src)}\"]`);\n if (el)\n document.head.removeChild(el);\n };\n if (immediate && !manual)\n tryOnMounted(load);\n if (!manual)\n tryOnUnmounted(unload);\n return { scriptTag, load, unload };\n}\n\nfunction checkOverflowScroll(ele) {\n const style = window.getComputedStyle(ele);\n if (style.overflowX === \"scroll\" || style.overflowY === \"scroll\" || style.overflowX === \"auto\" && ele.clientWidth < ele.scrollWidth || style.overflowY === \"auto\" && ele.clientHeight < ele.scrollHeight) {\n return true;\n } else {\n const parent = ele.parentNode;\n if (!parent || parent.tagName === \"BODY\")\n return false;\n return checkOverflowScroll(parent);\n }\n}\nfunction preventDefault(rawEvent) {\n const e = rawEvent || window.event;\n const _target = e.target;\n if (checkOverflowScroll(_target))\n return false;\n if (e.touches.length > 1)\n return true;\n if (e.preventDefault)\n e.preventDefault();\n return false;\n}\nconst elInitialOverflow = /* @__PURE__ */ new WeakMap();\nfunction useScrollLock(element, initialState = false) {\n const isLocked = ref(initialState);\n let stopTouchMoveListener = null;\n let initialOverflow = \"\";\n watch(toRef(element), (el) => {\n const target = resolveElement(toValue(el));\n if (target) {\n const ele = target;\n if (!elInitialOverflow.get(ele))\n elInitialOverflow.set(ele, ele.style.overflow);\n if (ele.style.overflow !== \"hidden\")\n initialOverflow = ele.style.overflow;\n if (ele.style.overflow === \"hidden\")\n return isLocked.value = true;\n if (isLocked.value)\n return ele.style.overflow = \"hidden\";\n }\n }, {\n immediate: true\n });\n const lock = () => {\n const el = resolveElement(toValue(element));\n if (!el || isLocked.value)\n return;\n if (isIOS) {\n stopTouchMoveListener = useEventListener(\n el,\n \"touchmove\",\n (e) => {\n preventDefault(e);\n },\n { passive: false }\n );\n }\n el.style.overflow = \"hidden\";\n isLocked.value = true;\n };\n const unlock = () => {\n const el = resolveElement(toValue(element));\n if (!el || !isLocked.value)\n return;\n if (isIOS)\n stopTouchMoveListener == null ? undefined : stopTouchMoveListener();\n el.style.overflow = initialOverflow;\n elInitialOverflow.delete(el);\n isLocked.value = false;\n };\n tryOnScopeDispose(unlock);\n return computed({\n get() {\n return isLocked.value;\n },\n set(v) {\n if (v)\n lock();\n else unlock();\n }\n });\n}\n\nfunction useSessionStorage(key, initialValue, options = {}) {\n const { window = defaultWindow } = options;\n return useStorage(key, initialValue, window == null ? undefined : window.sessionStorage, options);\n}\n\nfunction useShare(shareOptions = {}, options = {}) {\n const { navigator = defaultNavigator } = options;\n const _navigator = navigator;\n const isSupported = useSupported(() => _navigator && \"canShare\" in _navigator);\n const share = async (overrideOptions = {}) => {\n if (isSupported.value) {\n const data = {\n ...toValue(shareOptions),\n ...toValue(overrideOptions)\n };\n let granted = true;\n if (data.files && _navigator.canShare)\n granted = _navigator.canShare({ files: data.files });\n if (granted)\n return _navigator.share(data);\n }\n };\n return {\n isSupported,\n share\n };\n}\n\nconst defaultSortFn = (source, compareFn) => source.sort(compareFn);\nconst defaultCompare = (a, b) => a - b;\nfunction useSorted(...args) {\n var _a, _b, _c, _d;\n const [source] = args;\n let compareFn = defaultCompare;\n let options = {};\n if (args.length === 2) {\n if (typeof args[1] === \"object\") {\n options = args[1];\n compareFn = (_a = options.compareFn) != null ? _a : defaultCompare;\n } else {\n compareFn = (_b = args[1]) != null ? _b : defaultCompare;\n }\n } else if (args.length > 2) {\n compareFn = (_c = args[1]) != null ? _c : defaultCompare;\n options = (_d = args[2]) != null ? _d : {};\n }\n const {\n dirty = false,\n sortFn = defaultSortFn\n } = options;\n if (!dirty)\n return computed(() => sortFn([...toValue(source)], compareFn));\n watchEffect(() => {\n const result = sortFn(toValue(source), compareFn);\n if (isRef(source))\n source.value = result;\n else\n source.splice(0, source.length, ...result);\n });\n return source;\n}\n\nfunction useSpeechRecognition(options = {}) {\n const {\n interimResults = true,\n continuous = true,\n maxAlternatives = 1,\n window = defaultWindow\n } = options;\n const lang = toRef(options.lang || \"en-US\");\n const isListening = ref(false);\n const isFinal = ref(false);\n const result = ref(\"\");\n const error = shallowRef(undefined);\n let recognition;\n const start = () => {\n if (!isListening.value)\n recognition == null ? undefined : recognition.start();\n };\n const stop = () => {\n if (isListening.value)\n recognition == null ? undefined : recognition.stop();\n };\n const toggle = (value = !isListening.value) => {\n if (value) {\n start();\n } else {\n stop();\n }\n };\n const SpeechRecognition = window && (window.SpeechRecognition || window.webkitSpeechRecognition);\n const isSupported = useSupported(() => SpeechRecognition);\n if (isSupported.value) {\n recognition = new SpeechRecognition();\n recognition.continuous = continuous;\n recognition.interimResults = interimResults;\n recognition.lang = toValue(lang);\n recognition.maxAlternatives = maxAlternatives;\n recognition.onstart = () => {\n isListening.value = true;\n isFinal.value = false;\n };\n watch(lang, (lang2) => {\n if (recognition && !isListening.value)\n recognition.lang = lang2;\n });\n recognition.onresult = (event) => {\n const currentResult = event.results[event.resultIndex];\n const { transcript } = currentResult[0];\n isFinal.value = currentResult.isFinal;\n result.value = transcript;\n error.value = undefined;\n };\n recognition.onerror = (event) => {\n error.value = event;\n };\n recognition.onend = () => {\n isListening.value = false;\n recognition.lang = toValue(lang);\n };\n watch(isListening, () => {\n if (isListening.value)\n recognition.start();\n else\n recognition.stop();\n });\n }\n tryOnScopeDispose(() => {\n stop();\n });\n return {\n isSupported,\n isListening,\n isFinal,\n recognition,\n result,\n error,\n toggle,\n start,\n stop\n };\n}\n\nfunction useSpeechSynthesis(text, options = {}) {\n const {\n pitch = 1,\n rate = 1,\n volume = 1,\n window = defaultWindow\n } = options;\n const synth = window && window.speechSynthesis;\n const isSupported = useSupported(() => synth);\n const isPlaying = ref(false);\n const status = ref(\"init\");\n const spokenText = toRef(text || \"\");\n const lang = toRef(options.lang || \"en-US\");\n const error = shallowRef(undefined);\n const toggle = (value = !isPlaying.value) => {\n isPlaying.value = value;\n };\n const bindEventsForUtterance = (utterance2) => {\n utterance2.lang = toValue(lang);\n utterance2.voice = toValue(options.voice) || null;\n utterance2.pitch = toValue(pitch);\n utterance2.rate = toValue(rate);\n utterance2.volume = volume;\n utterance2.onstart = () => {\n isPlaying.value = true;\n status.value = \"play\";\n };\n utterance2.onpause = () => {\n isPlaying.value = false;\n status.value = \"pause\";\n };\n utterance2.onresume = () => {\n isPlaying.value = true;\n status.value = \"play\";\n };\n utterance2.onend = () => {\n isPlaying.value = false;\n status.value = \"end\";\n };\n utterance2.onerror = (event) => {\n error.value = event;\n };\n };\n const utterance = computed(() => {\n isPlaying.value = false;\n status.value = \"init\";\n const newUtterance = new SpeechSynthesisUtterance(spokenText.value);\n bindEventsForUtterance(newUtterance);\n return newUtterance;\n });\n const speak = () => {\n synth.cancel();\n if (utterance)\n synth.speak(utterance.value);\n };\n const stop = () => {\n synth.cancel();\n isPlaying.value = false;\n };\n if (isSupported.value) {\n bindEventsForUtterance(utterance.value);\n watch(lang, (lang2) => {\n if (utterance.value && !isPlaying.value)\n utterance.value.lang = lang2;\n });\n if (options.voice) {\n watch(options.voice, () => {\n synth.cancel();\n });\n }\n watch(isPlaying, () => {\n if (isPlaying.value)\n synth.resume();\n else\n synth.pause();\n });\n }\n tryOnScopeDispose(() => {\n isPlaying.value = false;\n });\n return {\n isSupported,\n isPlaying,\n status,\n utterance,\n error,\n stop,\n toggle,\n speak\n };\n}\n\nfunction useStepper(steps, initialStep) {\n const stepsRef = ref(steps);\n const stepNames = computed(() => Array.isArray(stepsRef.value) ? stepsRef.value : Object.keys(stepsRef.value));\n const index = ref(stepNames.value.indexOf(initialStep != null ? initialStep : stepNames.value[0]));\n const current = computed(() => at(index.value));\n const isFirst = computed(() => index.value === 0);\n const isLast = computed(() => index.value === stepNames.value.length - 1);\n const next = computed(() => stepNames.value[index.value + 1]);\n const previous = computed(() => stepNames.value[index.value - 1]);\n function at(index2) {\n if (Array.isArray(stepsRef.value))\n return stepsRef.value[index2];\n return stepsRef.value[stepNames.value[index2]];\n }\n function get(step) {\n if (!stepNames.value.includes(step))\n return;\n return at(stepNames.value.indexOf(step));\n }\n function goTo(step) {\n if (stepNames.value.includes(step))\n index.value = stepNames.value.indexOf(step);\n }\n function goToNext() {\n if (isLast.value)\n return;\n index.value++;\n }\n function goToPrevious() {\n if (isFirst.value)\n return;\n index.value--;\n }\n function goBackTo(step) {\n if (isAfter(step))\n goTo(step);\n }\n function isNext(step) {\n return stepNames.value.indexOf(step) === index.value + 1;\n }\n function isPrevious(step) {\n return stepNames.value.indexOf(step) === index.value - 1;\n }\n function isCurrent(step) {\n return stepNames.value.indexOf(step) === index.value;\n }\n function isBefore(step) {\n return index.value < stepNames.value.indexOf(step);\n }\n function isAfter(step) {\n return index.value > stepNames.value.indexOf(step);\n }\n return {\n steps: stepsRef,\n stepNames,\n index,\n current,\n next,\n previous,\n isFirst,\n isLast,\n at,\n get,\n goTo,\n goToNext,\n goToPrevious,\n goBackTo,\n isNext,\n isPrevious,\n isCurrent,\n isBefore,\n isAfter\n };\n}\n\nfunction useStorageAsync(key, initialValue, storage, options = {}) {\n var _a;\n const {\n flush = \"pre\",\n deep = true,\n listenToStorageChanges = true,\n writeDefaults = true,\n mergeDefaults = false,\n shallow,\n window = defaultWindow,\n eventFilter,\n onError = (e) => {\n console.error(e);\n }\n } = options;\n const rawInit = toValue(initialValue);\n const type = guessSerializerType(rawInit);\n const data = (shallow ? shallowRef : ref)(toValue(initialValue));\n const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];\n if (!storage) {\n try {\n storage = getSSRHandler(\"getDefaultStorageAsync\", () => {\n var _a2;\n return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;\n })();\n } catch (e) {\n onError(e);\n }\n }\n async function read(event) {\n if (!storage || event && event.key !== key)\n return;\n try {\n const rawValue = event ? event.newValue : await storage.getItem(key);\n if (rawValue == null) {\n data.value = rawInit;\n if (writeDefaults && rawInit !== null)\n await storage.setItem(key, await serializer.write(rawInit));\n } else if (mergeDefaults) {\n const value = await serializer.read(rawValue);\n if (typeof mergeDefaults === \"function\")\n data.value = mergeDefaults(value, rawInit);\n else if (type === \"object\" && !Array.isArray(value))\n data.value = { ...rawInit, ...value };\n else data.value = value;\n } else {\n data.value = await serializer.read(rawValue);\n }\n } catch (e) {\n onError(e);\n }\n }\n read();\n if (window && listenToStorageChanges)\n useEventListener(window, \"storage\", (e) => Promise.resolve().then(() => read(e)), { passive: true });\n if (storage) {\n watchWithFilter(\n data,\n async () => {\n try {\n if (data.value == null)\n await storage.removeItem(key);\n else\n await storage.setItem(key, await serializer.write(data.value));\n } catch (e) {\n onError(e);\n }\n },\n {\n flush,\n deep,\n eventFilter\n }\n );\n }\n return data;\n}\n\nlet _id = 0;\nfunction useStyleTag(css, options = {}) {\n const isLoaded = ref(false);\n const {\n document = defaultDocument,\n immediate = true,\n manual = false,\n id = `vueuse_styletag_${++_id}`\n } = options;\n const cssRef = ref(css);\n let stop = () => {\n };\n const load = () => {\n if (!document)\n return;\n const el = document.getElementById(id) || document.createElement(\"style\");\n if (!el.isConnected) {\n el.id = id;\n if (options.media)\n el.media = options.media;\n document.head.appendChild(el);\n }\n if (isLoaded.value)\n return;\n stop = watch(\n cssRef,\n (value) => {\n el.textContent = value;\n },\n { immediate: true }\n );\n isLoaded.value = true;\n };\n const unload = () => {\n if (!document || !isLoaded.value)\n return;\n stop();\n document.head.removeChild(document.getElementById(id));\n isLoaded.value = false;\n };\n if (immediate && !manual)\n tryOnMounted(load);\n if (!manual)\n tryOnScopeDispose(unload);\n return {\n id,\n css: cssRef,\n unload,\n load,\n isLoaded: readonly(isLoaded)\n };\n}\n\nfunction useSwipe(target, options = {}) {\n const {\n threshold = 50,\n onSwipe,\n onSwipeEnd,\n onSwipeStart,\n passive = true\n } = options;\n const coordsStart = reactive({ x: 0, y: 0 });\n const coordsEnd = reactive({ x: 0, y: 0 });\n const diffX = computed(() => coordsStart.x - coordsEnd.x);\n const diffY = computed(() => coordsStart.y - coordsEnd.y);\n const { max, abs } = Math;\n const isThresholdExceeded = computed(() => max(abs(diffX.value), abs(diffY.value)) >= threshold);\n const isSwiping = ref(false);\n const direction = computed(() => {\n if (!isThresholdExceeded.value)\n return \"none\";\n if (abs(diffX.value) > abs(diffY.value)) {\n return diffX.value > 0 ? \"left\" : \"right\";\n } else {\n return diffY.value > 0 ? \"up\" : \"down\";\n }\n });\n const getTouchEventCoords = (e) => [e.touches[0].clientX, e.touches[0].clientY];\n const updateCoordsStart = (x, y) => {\n coordsStart.x = x;\n coordsStart.y = y;\n };\n const updateCoordsEnd = (x, y) => {\n coordsEnd.x = x;\n coordsEnd.y = y;\n };\n const listenerOptions = { passive, capture: !passive };\n const onTouchEnd = (e) => {\n if (isSwiping.value)\n onSwipeEnd == null ? undefined : onSwipeEnd(e, direction.value);\n isSwiping.value = false;\n };\n const stops = [\n useEventListener(target, \"touchstart\", (e) => {\n if (e.touches.length !== 1)\n return;\n const [x, y] = getTouchEventCoords(e);\n updateCoordsStart(x, y);\n updateCoordsEnd(x, y);\n onSwipeStart == null ? undefined : onSwipeStart(e);\n }, listenerOptions),\n useEventListener(target, \"touchmove\", (e) => {\n if (e.touches.length !== 1)\n return;\n const [x, y] = getTouchEventCoords(e);\n updateCoordsEnd(x, y);\n if (listenerOptions.capture && !listenerOptions.passive && Math.abs(diffX.value) > Math.abs(diffY.value))\n e.preventDefault();\n if (!isSwiping.value && isThresholdExceeded.value)\n isSwiping.value = true;\n if (isSwiping.value)\n onSwipe == null ? undefined : onSwipe(e);\n }, listenerOptions),\n useEventListener(target, [\"touchend\", \"touchcancel\"], onTouchEnd, listenerOptions)\n ];\n const stop = () => stops.forEach((s) => s());\n return {\n isSwiping,\n direction,\n coordsStart,\n coordsEnd,\n lengthX: diffX,\n lengthY: diffY,\n stop,\n // TODO: Remove in the next major version\n isPassiveEventSupported: true\n };\n}\n\nfunction useTemplateRefsList() {\n const refs = ref([]);\n refs.value.set = (el) => {\n if (el)\n refs.value.push(el);\n };\n onBeforeUpdate(() => {\n refs.value.length = 0;\n });\n return refs;\n}\n\nfunction useTextDirection(options = {}) {\n const {\n document = defaultDocument,\n selector = \"html\",\n observe = false,\n initialValue = \"ltr\"\n } = options;\n function getValue() {\n var _a, _b;\n return (_b = (_a = document == null ? undefined : document.querySelector(selector)) == null ? undefined : _a.getAttribute(\"dir\")) != null ? _b : initialValue;\n }\n const dir = ref(getValue());\n tryOnMounted(() => dir.value = getValue());\n if (observe && document) {\n useMutationObserver(\n document.querySelector(selector),\n () => dir.value = getValue(),\n { attributes: true }\n );\n }\n return computed({\n get() {\n return dir.value;\n },\n set(v) {\n var _a, _b;\n dir.value = v;\n if (!document)\n return;\n if (dir.value)\n (_a = document.querySelector(selector)) == null ? undefined : _a.setAttribute(\"dir\", dir.value);\n else\n (_b = document.querySelector(selector)) == null ? undefined : _b.removeAttribute(\"dir\");\n }\n });\n}\n\nfunction getRangesFromSelection(selection) {\n var _a;\n const rangeCount = (_a = selection.rangeCount) != null ? _a : 0;\n return Array.from({ length: rangeCount }, (_, i) => selection.getRangeAt(i));\n}\nfunction useTextSelection(options = {}) {\n const {\n window = defaultWindow\n } = options;\n const selection = ref(null);\n const text = computed(() => {\n var _a, _b;\n return (_b = (_a = selection.value) == null ? undefined : _a.toString()) != null ? _b : \"\";\n });\n const ranges = computed(() => selection.value ? getRangesFromSelection(selection.value) : []);\n const rects = computed(() => ranges.value.map((range) => range.getBoundingClientRect()));\n function onSelectionChange() {\n selection.value = null;\n if (window)\n selection.value = window.getSelection();\n }\n if (window)\n useEventListener(window.document, \"selectionchange\", onSelectionChange, { passive: true });\n return {\n text,\n rects,\n ranges,\n selection\n };\n}\n\nfunction useTextareaAutosize(options) {\n var _a, _b;\n const textarea = toRef(options == null ? undefined : options.element);\n const input = toRef((_a = options == null ? undefined : options.input) != null ? _a : \"\");\n const styleProp = (_b = options == null ? undefined : options.styleProp) != null ? _b : \"height\";\n const textareaScrollHeight = ref(1);\n const textareaOldWidth = ref(0);\n function triggerResize() {\n var _a2;\n if (!textarea.value)\n return;\n let height = \"\";\n textarea.value.style[styleProp] = \"1px\";\n textareaScrollHeight.value = (_a2 = textarea.value) == null ? undefined : _a2.scrollHeight;\n const _styleTarget = toValue(options == null ? undefined : options.styleTarget);\n if (_styleTarget)\n _styleTarget.style[styleProp] = `${textareaScrollHeight.value}px`;\n else\n height = `${textareaScrollHeight.value}px`;\n textarea.value.style[styleProp] = height;\n }\n watch([input, textarea], () => nextTick(triggerResize), { immediate: true });\n watch(textareaScrollHeight, () => {\n var _a2;\n return (_a2 = options == null ? undefined : options.onResize) == null ? undefined : _a2.call(options);\n });\n useResizeObserver(textarea, ([{ contentRect }]) => {\n if (textareaOldWidth.value === contentRect.width)\n return;\n textareaOldWidth.value = contentRect.width;\n triggerResize();\n });\n if (options == null ? undefined : options.watch)\n watch(options.watch, triggerResize, { immediate: true, deep: true });\n return {\n textarea,\n input,\n triggerResize\n };\n}\n\nfunction useThrottledRefHistory(source, options = {}) {\n const { throttle = 200, trailing = true } = options;\n const filter = throttleFilter(throttle, trailing);\n const history = useRefHistory(source, { ...options, eventFilter: filter });\n return {\n ...history\n };\n}\n\nconst DEFAULT_UNITS = [\n { max: 6e4, value: 1e3, name: \"second\" },\n { max: 276e4, value: 6e4, name: \"minute\" },\n { max: 72e6, value: 36e5, name: \"hour\" },\n { max: 5184e5, value: 864e5, name: \"day\" },\n { max: 24192e5, value: 6048e5, name: \"week\" },\n { max: 28512e6, value: 2592e6, name: \"month\" },\n { max: Number.POSITIVE_INFINITY, value: 31536e6, name: \"year\" }\n];\nconst DEFAULT_MESSAGES = {\n justNow: \"just now\",\n past: (n) => n.match(/\\d/) ? `${n} ago` : n,\n future: (n) => n.match(/\\d/) ? `in ${n}` : n,\n month: (n, past) => n === 1 ? past ? \"last month\" : \"next month\" : `${n} month${n > 1 ? \"s\" : \"\"}`,\n year: (n, past) => n === 1 ? past ? \"last year\" : \"next year\" : `${n} year${n > 1 ? \"s\" : \"\"}`,\n day: (n, past) => n === 1 ? past ? \"yesterday\" : \"tomorrow\" : `${n} day${n > 1 ? \"s\" : \"\"}`,\n week: (n, past) => n === 1 ? past ? \"last week\" : \"next week\" : `${n} week${n > 1 ? \"s\" : \"\"}`,\n hour: (n) => `${n} hour${n > 1 ? \"s\" : \"\"}`,\n minute: (n) => `${n} minute${n > 1 ? \"s\" : \"\"}`,\n second: (n) => `${n} second${n > 1 ? \"s\" : \"\"}`,\n invalid: \"\"\n};\nfunction DEFAULT_FORMATTER(date) {\n return date.toISOString().slice(0, 10);\n}\nfunction useTimeAgo(time, options = {}) {\n const {\n controls: exposeControls = false,\n updateInterval = 3e4\n } = options;\n const { now, ...controls } = useNow({ interval: updateInterval, controls: true });\n const timeAgo = computed(() => formatTimeAgo(new Date(toValue(time)), options, toValue(now)));\n if (exposeControls) {\n return {\n timeAgo,\n ...controls\n };\n } else {\n return timeAgo;\n }\n}\nfunction formatTimeAgo(from, options = {}, now = Date.now()) {\n var _a;\n const {\n max,\n messages = DEFAULT_MESSAGES,\n fullDateFormatter = DEFAULT_FORMATTER,\n units = DEFAULT_UNITS,\n showSecond = false,\n rounding = \"round\"\n } = options;\n const roundFn = typeof rounding === \"number\" ? (n) => +n.toFixed(rounding) : Math[rounding];\n const diff = +now - +from;\n const absDiff = Math.abs(diff);\n function getValue(diff2, unit) {\n return roundFn(Math.abs(diff2) / unit.value);\n }\n function format(diff2, unit) {\n const val = getValue(diff2, unit);\n const past = diff2 > 0;\n const str = applyFormat(unit.name, val, past);\n return applyFormat(past ? \"past\" : \"future\", str, past);\n }\n function applyFormat(name, val, isPast) {\n const formatter = messages[name];\n if (typeof formatter === \"function\")\n return formatter(val, isPast);\n return formatter.replace(\"{0}\", val.toString());\n }\n if (absDiff < 6e4 && !showSecond)\n return messages.justNow;\n if (typeof max === \"number\" && absDiff > max)\n return fullDateFormatter(new Date(from));\n if (typeof max === \"string\") {\n const unitMax = (_a = units.find((i) => i.name === max)) == null ? undefined : _a.max;\n if (unitMax && absDiff > unitMax)\n return fullDateFormatter(new Date(from));\n }\n for (const [idx, unit] of units.entries()) {\n const val = getValue(diff, unit);\n if (val <= 0 && units[idx - 1])\n return format(diff, units[idx - 1]);\n if (absDiff < unit.max)\n return format(diff, unit);\n }\n return messages.invalid;\n}\n\nfunction useTimeoutPoll(fn, interval, options = {}) {\n const {\n immediate = true\n } = options;\n const { start } = useTimeoutFn(loop, interval, { immediate: false });\n const isActive = ref(false);\n async function loop() {\n if (!isActive.value)\n return;\n await fn();\n start();\n }\n function resume() {\n if (!isActive.value) {\n isActive.value = true;\n loop();\n }\n }\n function pause() {\n isActive.value = false;\n }\n if (immediate && isClient)\n resume();\n tryOnScopeDispose(pause);\n return {\n isActive,\n pause,\n resume\n };\n}\n\nfunction useTimestamp(options = {}) {\n const {\n controls: exposeControls = false,\n offset = 0,\n immediate = true,\n interval = \"requestAnimationFrame\",\n callback\n } = options;\n const ts = ref(timestamp() + offset);\n const update = () => ts.value = timestamp() + offset;\n const cb = callback ? () => {\n update();\n callback(ts.value);\n } : update;\n const controls = interval === \"requestAnimationFrame\" ? useRafFn(cb, { immediate }) : useIntervalFn(cb, interval, { immediate });\n if (exposeControls) {\n return {\n timestamp: ts,\n ...controls\n };\n } else {\n return ts;\n }\n}\n\nfunction useTitle(newTitle = null, options = {}) {\n var _a, _b, _c;\n const {\n document = defaultDocument,\n restoreOnUnmount = (t) => t\n } = options;\n const originalTitle = (_a = document == null ? undefined : document.title) != null ? _a : \"\";\n const title = toRef((_b = newTitle != null ? newTitle : document == null ? undefined : document.title) != null ? _b : null);\n const isReadonly = newTitle && typeof newTitle === \"function\";\n function format(t) {\n if (!(\"titleTemplate\" in options))\n return t;\n const template = options.titleTemplate || \"%s\";\n return typeof template === \"function\" ? template(t) : toValue(template).replace(/%s/g, t);\n }\n watch(\n title,\n (t, o) => {\n if (t !== o && document)\n document.title = format(typeof t === \"string\" ? t : \"\");\n },\n { immediate: true }\n );\n if (options.observe && !options.titleTemplate && document && !isReadonly) {\n useMutationObserver(\n (_c = document.head) == null ? undefined : _c.querySelector(\"title\"),\n () => {\n if (document && document.title !== title.value)\n title.value = format(document.title);\n },\n { childList: true }\n );\n }\n tryOnBeforeUnmount(() => {\n if (restoreOnUnmount) {\n const restoredTitle = restoreOnUnmount(originalTitle, title.value || \"\");\n if (restoredTitle != null && document)\n document.title = restoredTitle;\n }\n });\n return title;\n}\n\nconst _TransitionPresets = {\n easeInSine: [0.12, 0, 0.39, 0],\n easeOutSine: [0.61, 1, 0.88, 1],\n easeInOutSine: [0.37, 0, 0.63, 1],\n easeInQuad: [0.11, 0, 0.5, 0],\n easeOutQuad: [0.5, 1, 0.89, 1],\n easeInOutQuad: [0.45, 0, 0.55, 1],\n easeInCubic: [0.32, 0, 0.67, 0],\n easeOutCubic: [0.33, 1, 0.68, 1],\n easeInOutCubic: [0.65, 0, 0.35, 1],\n easeInQuart: [0.5, 0, 0.75, 0],\n easeOutQuart: [0.25, 1, 0.5, 1],\n easeInOutQuart: [0.76, 0, 0.24, 1],\n easeInQuint: [0.64, 0, 0.78, 0],\n easeOutQuint: [0.22, 1, 0.36, 1],\n easeInOutQuint: [0.83, 0, 0.17, 1],\n easeInExpo: [0.7, 0, 0.84, 0],\n easeOutExpo: [0.16, 1, 0.3, 1],\n easeInOutExpo: [0.87, 0, 0.13, 1],\n easeInCirc: [0.55, 0, 1, 0.45],\n easeOutCirc: [0, 0.55, 0.45, 1],\n easeInOutCirc: [0.85, 0, 0.15, 1],\n easeInBack: [0.36, 0, 0.66, -0.56],\n easeOutBack: [0.34, 1.56, 0.64, 1],\n easeInOutBack: [0.68, -0.6, 0.32, 1.6]\n};\nconst TransitionPresets = /* @__PURE__ */ Object.assign({}, { linear: identity }, _TransitionPresets);\nfunction createEasingFunction([p0, p1, p2, p3]) {\n const a = (a1, a2) => 1 - 3 * a2 + 3 * a1;\n const b = (a1, a2) => 3 * a2 - 6 * a1;\n const c = (a1) => 3 * a1;\n const calcBezier = (t, a1, a2) => ((a(a1, a2) * t + b(a1, a2)) * t + c(a1)) * t;\n const getSlope = (t, a1, a2) => 3 * a(a1, a2) * t * t + 2 * b(a1, a2) * t + c(a1);\n const getTforX = (x) => {\n let aGuessT = x;\n for (let i = 0; i < 4; ++i) {\n const currentSlope = getSlope(aGuessT, p0, p2);\n if (currentSlope === 0)\n return aGuessT;\n const currentX = calcBezier(aGuessT, p0, p2) - x;\n aGuessT -= currentX / currentSlope;\n }\n return aGuessT;\n };\n return (x) => p0 === p1 && p2 === p3 ? x : calcBezier(getTforX(x), p1, p3);\n}\nfunction lerp(a, b, alpha) {\n return a + alpha * (b - a);\n}\nfunction toVec(t) {\n return (typeof t === \"number\" ? [t] : t) || [];\n}\nfunction executeTransition(source, from, to, options = {}) {\n var _a, _b;\n const fromVal = toValue(from);\n const toVal = toValue(to);\n const v1 = toVec(fromVal);\n const v2 = toVec(toVal);\n const duration = (_a = toValue(options.duration)) != null ? _a : 1e3;\n const startedAt = Date.now();\n const endAt = Date.now() + duration;\n const trans = typeof options.transition === \"function\" ? options.transition : (_b = toValue(options.transition)) != null ? _b : identity;\n const ease = typeof trans === \"function\" ? trans : createEasingFunction(trans);\n return new Promise((resolve) => {\n source.value = fromVal;\n const tick = () => {\n var _a2;\n if ((_a2 = options.abort) == null ? undefined : _a2.call(options)) {\n resolve();\n return;\n }\n const now = Date.now();\n const alpha = ease((now - startedAt) / duration);\n const arr = toVec(source.value).map((n, i) => lerp(v1[i], v2[i], alpha));\n if (Array.isArray(source.value))\n source.value = arr.map((n, i) => {\n var _a3, _b2;\n return lerp((_a3 = v1[i]) != null ? _a3 : 0, (_b2 = v2[i]) != null ? _b2 : 0, alpha);\n });\n else if (typeof source.value === \"number\")\n source.value = arr[0];\n if (now < endAt) {\n requestAnimationFrame(tick);\n } else {\n source.value = toVal;\n resolve();\n }\n };\n tick();\n });\n}\nfunction useTransition(source, options = {}) {\n let currentId = 0;\n const sourceVal = () => {\n const v = toValue(source);\n return typeof v === \"number\" ? v : v.map(toValue);\n };\n const outputRef = ref(sourceVal());\n watch(sourceVal, async (to) => {\n var _a, _b;\n if (toValue(options.disabled))\n return;\n const id = ++currentId;\n if (options.delay)\n await promiseTimeout(toValue(options.delay));\n if (id !== currentId)\n return;\n const toVal = Array.isArray(to) ? to.map(toValue) : toValue(to);\n (_a = options.onStarted) == null ? undefined : _a.call(options);\n await executeTransition(outputRef, outputRef.value, toVal, {\n ...options,\n abort: () => {\n var _a2;\n return id !== currentId || ((_a2 = options.abort) == null ? undefined : _a2.call(options));\n }\n });\n (_b = options.onFinished) == null ? undefined : _b.call(options);\n }, { deep: true });\n watch(() => toValue(options.disabled), (disabled) => {\n if (disabled) {\n currentId++;\n outputRef.value = sourceVal();\n }\n });\n tryOnScopeDispose(() => {\n currentId++;\n });\n return computed(() => toValue(options.disabled) ? sourceVal() : outputRef.value);\n}\n\nfunction useUrlSearchParams(mode = \"history\", options = {}) {\n const {\n initialValue = {},\n removeNullishValues = true,\n removeFalsyValues = false,\n write: enableWrite = true,\n writeMode = \"replace\",\n window = defaultWindow\n } = options;\n if (!window)\n return reactive(initialValue);\n const state = reactive({});\n function getRawParams() {\n if (mode === \"history\") {\n return window.location.search || \"\";\n } else if (mode === \"hash\") {\n const hash = window.location.hash || \"\";\n const index = hash.indexOf(\"?\");\n return index > 0 ? hash.slice(index) : \"\";\n } else {\n return (window.location.hash || \"\").replace(/^#/, \"\");\n }\n }\n function constructQuery(params) {\n const stringified = params.toString();\n if (mode === \"history\")\n return `${stringified ? `?${stringified}` : \"\"}${window.location.hash || \"\"}`;\n if (mode === \"hash-params\")\n return `${window.location.search || \"\"}${stringified ? `#${stringified}` : \"\"}`;\n const hash = window.location.hash || \"#\";\n const index = hash.indexOf(\"?\");\n if (index > 0)\n return `${window.location.search || \"\"}${hash.slice(0, index)}${stringified ? `?${stringified}` : \"\"}`;\n return `${window.location.search || \"\"}${hash}${stringified ? `?${stringified}` : \"\"}`;\n }\n function read() {\n return new URLSearchParams(getRawParams());\n }\n function updateState(params) {\n const unusedKeys = new Set(Object.keys(state));\n for (const key of params.keys()) {\n const paramsForKey = params.getAll(key);\n state[key] = paramsForKey.length > 1 ? paramsForKey : params.get(key) || \"\";\n unusedKeys.delete(key);\n }\n Array.from(unusedKeys).forEach((key) => delete state[key]);\n }\n const { pause, resume } = pausableWatch(\n state,\n () => {\n const params = new URLSearchParams(\"\");\n Object.keys(state).forEach((key) => {\n const mapEntry = state[key];\n if (Array.isArray(mapEntry))\n mapEntry.forEach((value) => params.append(key, value));\n else if (removeNullishValues && mapEntry == null)\n params.delete(key);\n else if (removeFalsyValues && !mapEntry)\n params.delete(key);\n else\n params.set(key, mapEntry);\n });\n write(params, false);\n },\n { deep: true }\n );\n function write(params, shouldUpdate) {\n pause();\n if (shouldUpdate)\n updateState(params);\n if (writeMode === \"replace\") {\n window.history.replaceState(\n window.history.state,\n window.document.title,\n window.location.pathname + constructQuery(params)\n );\n } else {\n window.history.pushState(\n window.history.state,\n window.document.title,\n window.location.pathname + constructQuery(params)\n );\n }\n resume();\n }\n function onChanged() {\n if (!enableWrite)\n return;\n write(read(), true);\n }\n const listenerOptions = { passive: true };\n useEventListener(window, \"popstate\", onChanged, listenerOptions);\n if (mode !== \"history\")\n useEventListener(window, \"hashchange\", onChanged, listenerOptions);\n const initial = read();\n if (initial.keys().next().value)\n updateState(initial);\n else\n Object.assign(state, initialValue);\n return state;\n}\n\nfunction useUserMedia(options = {}) {\n var _a, _b;\n const enabled = ref((_a = options.enabled) != null ? _a : false);\n const autoSwitch = ref((_b = options.autoSwitch) != null ? _b : true);\n const constraints = ref(options.constraints);\n const { navigator = defaultNavigator } = options;\n const isSupported = useSupported(() => {\n var _a2;\n return (_a2 = navigator == null ? undefined : navigator.mediaDevices) == null ? undefined : _a2.getUserMedia;\n });\n const stream = shallowRef();\n function getDeviceOptions(type) {\n switch (type) {\n case \"video\": {\n if (constraints.value)\n return constraints.value.video || false;\n break;\n }\n case \"audio\": {\n if (constraints.value)\n return constraints.value.audio || false;\n break;\n }\n }\n }\n async function _start() {\n if (!isSupported.value || stream.value)\n return;\n stream.value = await navigator.mediaDevices.getUserMedia({\n video: getDeviceOptions(\"video\"),\n audio: getDeviceOptions(\"audio\")\n });\n return stream.value;\n }\n function _stop() {\n var _a2;\n (_a2 = stream.value) == null ? undefined : _a2.getTracks().forEach((t) => t.stop());\n stream.value = undefined;\n }\n function stop() {\n _stop();\n enabled.value = false;\n }\n async function start() {\n await _start();\n if (stream.value)\n enabled.value = true;\n return stream.value;\n }\n async function restart() {\n _stop();\n return await start();\n }\n watch(\n enabled,\n (v) => {\n if (v)\n _start();\n else _stop();\n },\n { immediate: true }\n );\n watch(\n constraints,\n () => {\n if (autoSwitch.value && stream.value)\n restart();\n },\n { immediate: true }\n );\n tryOnScopeDispose(() => {\n stop();\n });\n return {\n isSupported,\n stream,\n start,\n stop,\n restart,\n constraints,\n enabled,\n autoSwitch\n };\n}\n\nfunction useVModel(props, key, emit, options = {}) {\n var _a, _b, _c;\n const {\n clone = false,\n passive = false,\n eventName,\n deep = false,\n defaultValue,\n shouldEmit\n } = options;\n const vm = getCurrentInstance();\n const _emit = emit || (vm == null ? undefined : vm.emit) || ((_a = vm == null ? undefined : vm.$emit) == null ? undefined : _a.bind(vm)) || ((_c = (_b = vm == null ? undefined : vm.proxy) == null ? undefined : _b.$emit) == null ? undefined : _c.bind(vm == null ? undefined : vm.proxy));\n let event = eventName;\n if (!key) {\n key = \"modelValue\";\n }\n event = event || `update:${key.toString()}`;\n const cloneFn = (val) => !clone ? val : typeof clone === \"function\" ? clone(val) : cloneFnJSON(val);\n const getValue = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;\n const triggerEmit = (value) => {\n if (shouldEmit) {\n if (shouldEmit(value))\n _emit(event, value);\n } else {\n _emit(event, value);\n }\n };\n if (passive) {\n const initialValue = getValue();\n const proxy = ref(initialValue);\n let isUpdating = false;\n watch(\n () => props[key],\n (v) => {\n if (!isUpdating) {\n isUpdating = true;\n proxy.value = cloneFn(v);\n nextTick(() => isUpdating = false);\n }\n }\n );\n watch(\n proxy,\n (v) => {\n if (!isUpdating && (v !== props[key] || deep))\n triggerEmit(v);\n },\n { deep }\n );\n return proxy;\n } else {\n return computed({\n get() {\n return getValue();\n },\n set(value) {\n triggerEmit(value);\n }\n });\n }\n}\n\nfunction useVModels(props, emit, options = {}) {\n const ret = {};\n for (const key in props) {\n ret[key] = useVModel(\n props,\n key,\n emit,\n options\n );\n }\n return ret;\n}\n\nfunction useVibrate(options) {\n const {\n pattern = [],\n interval = 0,\n navigator = defaultNavigator\n } = options || {};\n const isSupported = useSupported(() => typeof navigator !== \"undefined\" && \"vibrate\" in navigator);\n const patternRef = toRef(pattern);\n let intervalControls;\n const vibrate = (pattern2 = patternRef.value) => {\n if (isSupported.value)\n navigator.vibrate(pattern2);\n };\n const stop = () => {\n if (isSupported.value)\n navigator.vibrate(0);\n intervalControls == null ? undefined : intervalControls.pause();\n };\n if (interval > 0) {\n intervalControls = useIntervalFn(\n vibrate,\n interval,\n {\n immediate: false,\n immediateCallback: false\n }\n );\n }\n return {\n isSupported,\n pattern,\n intervalControls,\n vibrate,\n stop\n };\n}\n\nfunction useVirtualList(list, options) {\n const { containerStyle, wrapperProps, scrollTo, calculateRange, currentList, containerRef } = \"itemHeight\" in options ? useVerticalVirtualList(options, list) : useHorizontalVirtualList(options, list);\n return {\n list: currentList,\n scrollTo,\n containerProps: {\n ref: containerRef,\n onScroll: () => {\n calculateRange();\n },\n style: containerStyle\n },\n wrapperProps\n };\n}\nfunction useVirtualListResources(list) {\n const containerRef = ref(null);\n const size = useElementSize(containerRef);\n const currentList = ref([]);\n const source = shallowRef(list);\n const state = ref({ start: 0, end: 10 });\n return { state, source, currentList, size, containerRef };\n}\nfunction createGetViewCapacity(state, source, itemSize) {\n return (containerSize) => {\n if (typeof itemSize === \"number\")\n return Math.ceil(containerSize / itemSize);\n const { start = 0 } = state.value;\n let sum = 0;\n let capacity = 0;\n for (let i = start; i < source.value.length; i++) {\n const size = itemSize(i);\n sum += size;\n capacity = i;\n if (sum > containerSize)\n break;\n }\n return capacity - start;\n };\n}\nfunction createGetOffset(source, itemSize) {\n return (scrollDirection) => {\n if (typeof itemSize === \"number\")\n return Math.floor(scrollDirection / itemSize) + 1;\n let sum = 0;\n let offset = 0;\n for (let i = 0; i < source.value.length; i++) {\n const size = itemSize(i);\n sum += size;\n if (sum >= scrollDirection) {\n offset = i;\n break;\n }\n }\n return offset + 1;\n };\n}\nfunction createCalculateRange(type, overscan, getOffset, getViewCapacity, { containerRef, state, currentList, source }) {\n return () => {\n const element = containerRef.value;\n if (element) {\n const offset = getOffset(type === \"vertical\" ? element.scrollTop : element.scrollLeft);\n const viewCapacity = getViewCapacity(type === \"vertical\" ? element.clientHeight : element.clientWidth);\n const from = offset - overscan;\n const to = offset + viewCapacity + overscan;\n state.value = {\n start: from < 0 ? 0 : from,\n end: to > source.value.length ? source.value.length : to\n };\n currentList.value = source.value.slice(state.value.start, state.value.end).map((ele, index) => ({\n data: ele,\n index: index + state.value.start\n }));\n }\n };\n}\nfunction createGetDistance(itemSize, source) {\n return (index) => {\n if (typeof itemSize === \"number\") {\n const size2 = index * itemSize;\n return size2;\n }\n const size = source.value.slice(0, index).reduce((sum, _, i) => sum + itemSize(i), 0);\n return size;\n };\n}\nfunction useWatchForSizes(size, list, containerRef, calculateRange) {\n watch([size.width, size.height, list, containerRef], () => {\n calculateRange();\n });\n}\nfunction createComputedTotalSize(itemSize, source) {\n return computed(() => {\n if (typeof itemSize === \"number\")\n return source.value.length * itemSize;\n return source.value.reduce((sum, _, index) => sum + itemSize(index), 0);\n });\n}\nconst scrollToDictionaryForElementScrollKey = {\n horizontal: \"scrollLeft\",\n vertical: \"scrollTop\"\n};\nfunction createScrollTo(type, calculateRange, getDistance, containerRef) {\n return (index) => {\n if (containerRef.value) {\n containerRef.value[scrollToDictionaryForElementScrollKey[type]] = getDistance(index);\n calculateRange();\n }\n };\n}\nfunction useHorizontalVirtualList(options, list) {\n const resources = useVirtualListResources(list);\n const { state, source, currentList, size, containerRef } = resources;\n const containerStyle = { overflowX: \"auto\" };\n const { itemWidth, overscan = 5 } = options;\n const getViewCapacity = createGetViewCapacity(state, source, itemWidth);\n const getOffset = createGetOffset(source, itemWidth);\n const calculateRange = createCalculateRange(\"horizontal\", overscan, getOffset, getViewCapacity, resources);\n const getDistanceLeft = createGetDistance(itemWidth, source);\n const offsetLeft = computed(() => getDistanceLeft(state.value.start));\n const totalWidth = createComputedTotalSize(itemWidth, source);\n useWatchForSizes(size, list, containerRef, calculateRange);\n const scrollTo = createScrollTo(\"horizontal\", calculateRange, getDistanceLeft, containerRef);\n const wrapperProps = computed(() => {\n return {\n style: {\n height: \"100%\",\n width: `${totalWidth.value - offsetLeft.value}px`,\n marginLeft: `${offsetLeft.value}px`,\n display: \"flex\"\n }\n };\n });\n return {\n scrollTo,\n calculateRange,\n wrapperProps,\n containerStyle,\n currentList,\n containerRef\n };\n}\nfunction useVerticalVirtualList(options, list) {\n const resources = useVirtualListResources(list);\n const { state, source, currentList, size, containerRef } = resources;\n const containerStyle = { overflowY: \"auto\" };\n const { itemHeight, overscan = 5 } = options;\n const getViewCapacity = createGetViewCapacity(state, source, itemHeight);\n const getOffset = createGetOffset(source, itemHeight);\n const calculateRange = createCalculateRange(\"vertical\", overscan, getOffset, getViewCapacity, resources);\n const getDistanceTop = createGetDistance(itemHeight, source);\n const offsetTop = computed(() => getDistanceTop(state.value.start));\n const totalHeight = createComputedTotalSize(itemHeight, source);\n useWatchForSizes(size, list, containerRef, calculateRange);\n const scrollTo = createScrollTo(\"vertical\", calculateRange, getDistanceTop, containerRef);\n const wrapperProps = computed(() => {\n return {\n style: {\n width: \"100%\",\n height: `${totalHeight.value - offsetTop.value}px`,\n marginTop: `${offsetTop.value}px`\n }\n };\n });\n return {\n calculateRange,\n scrollTo,\n containerStyle,\n wrapperProps,\n currentList,\n containerRef\n };\n}\n\nfunction useWakeLock(options = {}) {\n const {\n navigator = defaultNavigator,\n document = defaultDocument\n } = options;\n const requestedType = ref(false);\n const sentinel = shallowRef(null);\n const documentVisibility = useDocumentVisibility({ document });\n const isSupported = useSupported(() => navigator && \"wakeLock\" in navigator);\n const isActive = computed(() => !!sentinel.value && documentVisibility.value === \"visible\");\n if (isSupported.value) {\n useEventListener(sentinel, \"release\", () => {\n var _a, _b;\n requestedType.value = (_b = (_a = sentinel.value) == null ? undefined : _a.type) != null ? _b : false;\n }, { passive: true });\n whenever(\n () => documentVisibility.value === \"visible\" && (document == null ? undefined : document.visibilityState) === \"visible\" && requestedType.value,\n (type) => {\n requestedType.value = false;\n forceRequest(type);\n }\n );\n }\n async function forceRequest(type) {\n var _a;\n await ((_a = sentinel.value) == null ? undefined : _a.release());\n sentinel.value = isSupported.value ? await navigator.wakeLock.request(type) : null;\n }\n async function request(type) {\n if (documentVisibility.value === \"visible\")\n await forceRequest(type);\n else\n requestedType.value = type;\n }\n async function release() {\n requestedType.value = false;\n const s = sentinel.value;\n sentinel.value = null;\n await (s == null ? undefined : s.release());\n }\n return {\n sentinel,\n isSupported,\n isActive,\n request,\n forceRequest,\n release\n };\n}\n\nfunction useWebNotification(options = {}) {\n const {\n window = defaultWindow,\n requestPermissions: _requestForPermissions = true\n } = options;\n const defaultWebNotificationOptions = options;\n const isSupported = useSupported(() => {\n if (!window || !(\"Notification\" in window))\n return false;\n if (Notification.permission === \"granted\")\n return true;\n try {\n const notification2 = new Notification(\"\");\n notification2.onshow = () => {\n notification2.close();\n };\n } catch (e) {\n if (e.name === \"TypeError\")\n return false;\n }\n return true;\n });\n const permissionGranted = ref(isSupported.value && \"permission\" in Notification && Notification.permission === \"granted\");\n const notification = ref(null);\n const ensurePermissions = async () => {\n if (!isSupported.value)\n return;\n if (!permissionGranted.value && Notification.permission !== \"denied\") {\n const result = await Notification.requestPermission();\n if (result === \"granted\")\n permissionGranted.value = true;\n }\n return permissionGranted.value;\n };\n const { on: onClick, trigger: clickTrigger } = createEventHook();\n const { on: onShow, trigger: showTrigger } = createEventHook();\n const { on: onError, trigger: errorTrigger } = createEventHook();\n const { on: onClose, trigger: closeTrigger } = createEventHook();\n const show = async (overrides) => {\n if (!isSupported.value || !permissionGranted.value)\n return;\n const options2 = Object.assign({}, defaultWebNotificationOptions, overrides);\n notification.value = new Notification(options2.title || \"\", options2);\n notification.value.onclick = clickTrigger;\n notification.value.onshow = showTrigger;\n notification.value.onerror = errorTrigger;\n notification.value.onclose = closeTrigger;\n return notification.value;\n };\n const close = () => {\n if (notification.value)\n notification.value.close();\n notification.value = null;\n };\n if (_requestForPermissions)\n tryOnMounted(ensurePermissions);\n tryOnScopeDispose(close);\n if (isSupported.value && window) {\n const document = window.document;\n useEventListener(document, \"visibilitychange\", (e) => {\n e.preventDefault();\n if (document.visibilityState === \"visible\") {\n close();\n }\n });\n }\n return {\n isSupported,\n notification,\n ensurePermissions,\n permissionGranted,\n show,\n close,\n onClick,\n onShow,\n onError,\n onClose\n };\n}\n\nconst DEFAULT_PING_MESSAGE = \"ping\";\nfunction resolveNestedOptions(options) {\n if (options === true)\n return {};\n return options;\n}\nfunction useWebSocket(url, options = {}) {\n const {\n onConnected,\n onDisconnected,\n onError,\n onMessage,\n immediate = true,\n autoConnect = true,\n autoClose = true,\n protocols = []\n } = options;\n const data = ref(null);\n const status = ref(\"CLOSED\");\n const wsRef = ref();\n const urlRef = toRef(url);\n let heartbeatPause;\n let heartbeatResume;\n let explicitlyClosed = false;\n let retried = 0;\n let bufferedData = [];\n let retryTimeout;\n let pongTimeoutWait;\n const _sendBuffer = () => {\n if (bufferedData.length && wsRef.value && status.value === \"OPEN\") {\n for (const buffer of bufferedData)\n wsRef.value.send(buffer);\n bufferedData = [];\n }\n };\n const resetRetry = () => {\n if (retryTimeout != null) {\n clearTimeout(retryTimeout);\n retryTimeout = undefined;\n }\n };\n const resetHeartbeat = () => {\n clearTimeout(pongTimeoutWait);\n pongTimeoutWait = undefined;\n };\n const close = (code = 1e3, reason) => {\n resetRetry();\n if (!isClient && !isWorker || !wsRef.value)\n return;\n explicitlyClosed = true;\n resetHeartbeat();\n heartbeatPause == null ? undefined : heartbeatPause();\n wsRef.value.close(code, reason);\n wsRef.value = undefined;\n };\n const send = (data2, useBuffer = true) => {\n if (!wsRef.value || status.value !== \"OPEN\") {\n if (useBuffer)\n bufferedData.push(data2);\n return false;\n }\n _sendBuffer();\n wsRef.value.send(data2);\n return true;\n };\n const _init = () => {\n if (explicitlyClosed || typeof urlRef.value === \"undefined\")\n return;\n const ws = new WebSocket(urlRef.value, protocols);\n wsRef.value = ws;\n status.value = \"CONNECTING\";\n ws.onopen = () => {\n status.value = \"OPEN\";\n retried = 0;\n onConnected == null ? undefined : onConnected(ws);\n heartbeatResume == null ? undefined : heartbeatResume();\n _sendBuffer();\n };\n ws.onclose = (ev) => {\n status.value = \"CLOSED\";\n onDisconnected == null ? undefined : onDisconnected(ws, ev);\n if (!explicitlyClosed && options.autoReconnect && (wsRef.value == null || ws === wsRef.value)) {\n const {\n retries = -1,\n delay = 1e3,\n onFailed\n } = resolveNestedOptions(options.autoReconnect);\n if (typeof retries === \"number\" && (retries < 0 || retried < retries)) {\n retried += 1;\n retryTimeout = setTimeout(_init, delay);\n } else if (typeof retries === \"function\" && retries()) {\n retryTimeout = setTimeout(_init, delay);\n } else {\n onFailed == null ? undefined : onFailed();\n }\n }\n };\n ws.onerror = (e) => {\n onError == null ? undefined : onError(ws, e);\n };\n ws.onmessage = (e) => {\n if (options.heartbeat) {\n resetHeartbeat();\n const {\n message = DEFAULT_PING_MESSAGE,\n responseMessage = message\n } = resolveNestedOptions(options.heartbeat);\n if (e.data === toValue(responseMessage))\n return;\n }\n data.value = e.data;\n onMessage == null ? undefined : onMessage(ws, e);\n };\n };\n if (options.heartbeat) {\n const {\n message = DEFAULT_PING_MESSAGE,\n interval = 1e3,\n pongTimeout = 1e3\n } = resolveNestedOptions(options.heartbeat);\n const { pause, resume } = useIntervalFn(\n () => {\n send(toValue(message), false);\n if (pongTimeoutWait != null)\n return;\n pongTimeoutWait = setTimeout(() => {\n close();\n explicitlyClosed = false;\n }, pongTimeout);\n },\n interval,\n { immediate: false }\n );\n heartbeatPause = pause;\n heartbeatResume = resume;\n }\n if (autoClose) {\n if (isClient)\n useEventListener(\"beforeunload\", () => close(), { passive: true });\n tryOnScopeDispose(close);\n }\n const open = () => {\n if (!isClient && !isWorker)\n return;\n close();\n explicitlyClosed = false;\n retried = 0;\n _init();\n };\n if (immediate)\n open();\n if (autoConnect)\n watch(urlRef, open);\n return {\n data,\n status,\n close,\n send,\n open,\n ws: wsRef\n };\n}\n\nfunction useWebWorker(arg0, workerOptions, options) {\n const {\n window = defaultWindow\n } = options != null ? options : {};\n const data = ref(null);\n const worker = shallowRef();\n const post = (...args) => {\n if (!worker.value)\n return;\n worker.value.postMessage(...args);\n };\n const terminate = function terminate2() {\n if (!worker.value)\n return;\n worker.value.terminate();\n };\n if (window) {\n if (typeof arg0 === \"string\")\n worker.value = new Worker(arg0, workerOptions);\n else if (typeof arg0 === \"function\")\n worker.value = arg0();\n else\n worker.value = arg0;\n worker.value.onmessage = (e) => {\n data.value = e.data;\n };\n tryOnScopeDispose(() => {\n if (worker.value)\n worker.value.terminate();\n });\n }\n return {\n data,\n post,\n terminate,\n worker\n };\n}\n\nfunction depsParser(deps, localDeps) {\n if (deps.length === 0 && localDeps.length === 0)\n return \"\";\n const depsString = deps.map((dep) => `'${dep}'`).toString();\n const depsFunctionString = localDeps.filter((dep) => typeof dep === \"function\").map((fn) => {\n const str = fn.toString();\n if (str.trim().startsWith(\"function\")) {\n return str;\n } else {\n const name = fn.name;\n return `const ${name} = ${str}`;\n }\n }).join(\";\");\n const importString = `importScripts(${depsString});`;\n return `${depsString.trim() === \"\" ? \"\" : importString} ${depsFunctionString}`;\n}\n\nfunction jobRunner(userFunc) {\n return (e) => {\n const userFuncArgs = e.data[0];\n return Promise.resolve(userFunc.apply(undefined, userFuncArgs)).then((result) => {\n postMessage([\"SUCCESS\", result]);\n }).catch((error) => {\n postMessage([\"ERROR\", error]);\n });\n };\n}\n\nfunction createWorkerBlobUrl(fn, deps, localDeps) {\n const blobCode = `${depsParser(deps, localDeps)}; onmessage=(${jobRunner})(${fn})`;\n const blob = new Blob([blobCode], { type: \"text/javascript\" });\n const url = URL.createObjectURL(blob);\n return url;\n}\n\nfunction useWebWorkerFn(fn, options = {}) {\n const {\n dependencies = [],\n localDependencies = [],\n timeout,\n window = defaultWindow\n } = options;\n const worker = ref();\n const workerStatus = ref(\"PENDING\");\n const promise = ref({});\n const timeoutId = ref();\n const workerTerminate = (status = \"PENDING\") => {\n if (worker.value && worker.value._url && window) {\n worker.value.terminate();\n URL.revokeObjectURL(worker.value._url);\n promise.value = {};\n worker.value = undefined;\n window.clearTimeout(timeoutId.value);\n workerStatus.value = status;\n }\n };\n workerTerminate();\n tryOnScopeDispose(workerTerminate);\n const generateWorker = () => {\n const blobUrl = createWorkerBlobUrl(fn, dependencies, localDependencies);\n const newWorker = new Worker(blobUrl);\n newWorker._url = blobUrl;\n newWorker.onmessage = (e) => {\n const { resolve = () => {\n }, reject = () => {\n } } = promise.value;\n const [status, result] = e.data;\n switch (status) {\n case \"SUCCESS\":\n resolve(result);\n workerTerminate(status);\n break;\n default:\n reject(result);\n workerTerminate(\"ERROR\");\n break;\n }\n };\n newWorker.onerror = (e) => {\n const { reject = () => {\n } } = promise.value;\n e.preventDefault();\n reject(e);\n workerTerminate(\"ERROR\");\n };\n if (timeout) {\n timeoutId.value = setTimeout(\n () => workerTerminate(\"TIMEOUT_EXPIRED\"),\n timeout\n );\n }\n return newWorker;\n };\n const callWorker = (...fnArgs) => new Promise((resolve, reject) => {\n var _a;\n promise.value = {\n resolve,\n reject\n };\n (_a = worker.value) == null ? undefined : _a.postMessage([[...fnArgs]]);\n workerStatus.value = \"RUNNING\";\n });\n const workerFn = (...fnArgs) => {\n if (workerStatus.value === \"RUNNING\") {\n console.error(\n \"[useWebWorkerFn] You can only run one instance of the worker at a time.\"\n );\n return Promise.reject();\n }\n worker.value = generateWorker();\n return callWorker(...fnArgs);\n };\n return {\n workerFn,\n workerStatus,\n workerTerminate\n };\n}\n\nfunction useWindowFocus(options = {}) {\n const { window = defaultWindow } = options;\n if (!window)\n return ref(false);\n const focused = ref(window.document.hasFocus());\n const listenerOptions = { passive: true };\n useEventListener(window, \"blur\", () => {\n focused.value = false;\n }, listenerOptions);\n useEventListener(window, \"focus\", () => {\n focused.value = true;\n }, listenerOptions);\n return focused;\n}\n\nfunction useWindowScroll(options = {}) {\n const { window = defaultWindow, ...rest } = options;\n return useScroll(window, rest);\n}\n\nfunction useWindowSize(options = {}) {\n const {\n window = defaultWindow,\n initialWidth = Number.POSITIVE_INFINITY,\n initialHeight = Number.POSITIVE_INFINITY,\n listenOrientation = true,\n includeScrollbar = true,\n type = \"inner\"\n } = options;\n const width = ref(initialWidth);\n const height = ref(initialHeight);\n const update = () => {\n if (window) {\n if (type === \"outer\") {\n width.value = window.outerWidth;\n height.value = window.outerHeight;\n } else if (type === \"visual\" && window.visualViewport) {\n const { width: visualViewportWidth, height: visualViewportHeight, scale } = window.visualViewport;\n width.value = Math.round(visualViewportWidth * scale);\n height.value = Math.round(visualViewportHeight * scale);\n } else if (includeScrollbar) {\n width.value = window.innerWidth;\n height.value = window.innerHeight;\n } else {\n width.value = window.document.documentElement.clientWidth;\n height.value = window.document.documentElement.clientHeight;\n }\n }\n };\n update();\n tryOnMounted(update);\n const listenerOptions = { passive: true };\n useEventListener(\"resize\", update, listenerOptions);\n if (window && type === \"visual\" && window.visualViewport) {\n useEventListener(window.visualViewport, \"resize\", update, listenerOptions);\n }\n if (listenOrientation) {\n const matches = useMediaQuery(\"(orientation: portrait)\");\n watch(matches, () => update());\n }\n return { width, height };\n}\n\nexport { DefaultMagicKeysAliasMap, StorageSerializers, TransitionPresets, computedAsync as asyncComputed, breakpointsAntDesign, breakpointsBootstrapV5, breakpointsElement, breakpointsMasterCss, breakpointsPrimeFlex, breakpointsQuasar, breakpointsSematic, breakpointsTailwind, breakpointsVuetify, breakpointsVuetifyV2, breakpointsVuetifyV3, cloneFnJSON, computedAsync, computedInject, createFetch, createReusableTemplate, createTemplatePromise, createUnrefFn, customStorageEventName, defaultDocument, defaultLocation, defaultNavigator, defaultWindow, executeTransition, formatTimeAgo, getSSRHandler, mapGamepadToXbox360Controller, onClickOutside, onElementRemoval, onKeyDown, onKeyPressed, onKeyStroke, onKeyUp, onLongPress, onStartTyping, provideSSRWidth, setSSRHandler, templateRef, unrefElement, useActiveElement, useAnimate, useAsyncQueue, useAsyncState, useBase64, useBattery, useBluetooth, useBreakpoints, useBroadcastChannel, useBrowserLocation, useCached, useClipboard, useClipboardItems, useCloned, useColorMode, useConfirmDialog, useCssVar, useCurrentElement, useCycleList, useDark, useDebouncedRefHistory, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDisplayMedia, useDocumentVisibility, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementHover, useElementSize, useElementVisibility, useEventBus, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetch, useFileDialog, useFileSystemAccess, useFocus, useFocusWithin, useFps, useFullscreen, useGamepad, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useKeyModifier, useLocalStorage, useMagicKeys, useManualRefHistory, useMediaControls, useMediaQuery, useMemoize, useMemory, useMounted, useMouse, useMouseInElement, useMousePressed, useMutationObserver, useNavigatorLanguage, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, useParallax, useParentElement, usePerformanceObserver, usePermission, usePointer, usePointerLock, usePointerSwipe, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePreferredReducedTransparency, usePrevious, useRafFn, useRefHistory, useResizeObserver, useSSRWidth, useScreenOrientation, useScreenSafeArea, useScriptTag, useScroll, useScrollLock, useSessionStorage, useShare, useSorted, useSpeechRecognition, useSpeechSynthesis, useStepper, useStorage, useStorageAsync, useStyleTag, useSupported, useSwipe, useTemplateRefsList, useTextDirection, useTextSelection, useTextareaAutosize, useThrottledRefHistory, useTimeAgo, useTimeoutPoll, useTimestamp, useTitle, useTransition, useUrlSearchParams, useUserMedia, useVModel, useVModels, useVibrate, useVirtualList, useWakeLock, useWebNotification, useWebSocket, useWebWorker, useWebWorkerFn, useWindowFocus, useWindowScroll, useWindowSize };\n","<template>\r\n <Teleport to=\"body\">\r\n <Transition>\r\n <div \r\n v-if=\"open\"\r\n v-bind=\"$attrs\"\r\n class=\"v-popover editor-component\" \r\n :class=\"[ isHorizontal? 'horizontal': 'vertical', props.fitAnchor && 'fit-anchor', props.class ]\"\r\n :style=\"style\"\r\n ref=\"popoverRef\"\r\n @mousedown.stop\r\n >\r\n <slot></slot>\r\n </div>\r\n </Transition>\r\n </Teleport>\r\n <slot name=\"activator\" :props=\"activatorProps\"></slot>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { computed, ref, watch } from 'vue';\r\nimport { useEventListener, useResizeObserver, useVModel } from '@vueuse/core'\r\nimport { useMouseDownOutside } from 'vuesix/src/hooks/useClickOutside';\r\nimport { useKeyDownLayer } from 'vuesix/src/hooks/useKeyDownLayer';\r\n\r\nexport type Placement = \r\n \"top-start\" | \"top\" | \"top-end\" |\r\n \"right-start\" | \"right\" | \"right-end\" |\r\n \"bottom-start\" | \"bottom\" | \"bottom-end\" |\r\n \"left-start\" | \"left\" | \"left-end\"\r\n\r\nconst props = defineProps<{ \r\n open?: boolean, \r\n element?: HTMLElement,\r\n placement: Placement,\r\n offset?: number,\r\n fitAnchor?: boolean,\r\n class?: string,\r\n anchorPosition?: { x: number, y: number }\r\n}>()\r\n\r\ndefineOptions({\r\n inheritAttrs: false\r\n})\r\n\r\nconst emit = defineEmits([ \"update:open\" ])\r\n\r\nconst popoverRef = ref<HTMLDivElement>()\r\nconst position = ref<{ top: number, left: number, width?: number, height?: number }>({ top: 0, left: 0 })\r\nconst origin = ref(\"center\")\r\n\r\nconst open = useVModel(props, \"open\", emit, { passive: true })\r\nconst activatorElement = ref<HTMLElement>()\r\n\r\nconst clamp = (value: number, min: number, max: number) => {\r\n if (value < min) return min\r\n if (value > max) return max\r\n return value\r\n}\r\n\r\nconst calcPrimary = (pos: \"start\" | \"end\", start: number, end: number, size: number, min: number, max: number) => {\r\n const fitStart = start-size >= min\r\n const fitEnd = end + size <= max\r\n\r\n if ((!fitEnd || pos === \"start\") && fitStart) return start - size\r\n if ((!fitStart || pos === \"end\") && fitEnd) return end\r\n return pos === \"start\"? min: (max-size)\r\n}\r\n\r\nconst calcSub = (pos: string | undefined, start: number, end: number, size: number, min: number, max: number) => {\r\n if (pos === \"start\") return clamp(start, min, max-size)\r\n if (pos === \"end\") return clamp(end - size, min, max-size)\r\n\r\n return clamp((start+end)/2 - size/2, min, max-size)\r\n}\r\n\r\nconst calcOrigin = (start: number, end: number, point: number) => {\r\n return clamp(Math.round((point-start) / (end-start) * 100), 0, 100) + \"%\"\r\n}\r\n\r\nconst getRect = () => {\r\n if (props.anchorPosition) {\r\n return {\r\n top: props.anchorPosition.y, bottom: props.anchorPosition.y,\r\n left: props.anchorPosition.x, right: props.anchorPosition.x,\r\n width: 0, height: 0\r\n }\r\n }\r\n const element = props.element ?? activatorElement.value\r\n if (!element) return null\r\n return element.getBoundingClientRect()\r\n}\r\n\r\nconst isHorizontal = computed(() => props.placement.startsWith(\"left\") || props.placement.startsWith(\"right\"))\r\n\r\nconst margin = 8\r\nconst calcPosition = () => {\r\n if (!popoverRef.value) return\r\n const rect = getRect()\r\n if (!rect) return\r\n\r\n const placement = props.placement.split(\"-\")\r\n\r\n const offset = props.offset ?? 0\r\n const width = popoverRef.value.clientWidth\r\n const height = popoverRef.value.clientHeight\r\n\r\n if (placement[0] === \"top\" || placement[0] === \"bottom\") {\r\n const top = calcPrimary(placement[0] === \"top\"? \"start\": \"end\", rect.top-offset, rect.bottom+offset, height, margin, window.innerHeight - margin)\r\n if (props.fitAnchor) {\r\n position.value = { \r\n top, \r\n left: calcSub('start', rect.left, rect.right, rect.width, margin, window.innerWidth - margin),\r\n width: rect.width\r\n }\r\n } else {\r\n position.value = { top, left: calcSub(placement[1], rect.left, rect.right, width, margin, window.innerWidth - margin) }\r\n }\r\n } else {\r\n const left = calcPrimary(placement[0] === \"left\"? \"start\": \"end\", rect.left-offset, rect.right+offset, width, margin, window.innerWidth - margin)\r\n if (props.fitAnchor) {\r\n position.value = { \r\n left, \r\n top: calcSub('start', rect.top, rect.bottom, rect.height, margin, window.innerHeight - margin),\r\n height: rect.height\r\n }\r\n } else {\r\n position.value = { left, top: calcSub(placement[1], rect.top, rect.bottom, height, margin, window.innerHeight - margin) }\r\n }\r\n }\r\n origin.value = \r\n calcOrigin(position.value.left, position.value.left + width, rect.left + rect.width/2) +\r\n calcOrigin(position.value.top, position.value.top + height, rect.top + rect.height/2)\r\n}\r\n\r\nwatch([() => props.element, () => props.anchorPosition], () => {\r\n calcPosition()\r\n})\r\n\r\nuseResizeObserver(popoverRef, calcPosition)\r\nuseEventListener(window, \"resize\", calcPosition)\r\n\r\nconst close = () => {\r\n open.value = false\r\n}\r\nconst closeDelayed = () => {\r\n setTimeout(close, 0)\r\n}\r\n\r\nuseKeyDownLayer(\"Escape\", open, close)\r\nuseMouseDownOutside(open, closeDelayed, popoverRef)\r\n\r\nwatch(open, (open) => {\r\n if (!props.element) return\r\n if (open) {\r\n props.element.classList.add(\"popoverHover\")\r\n } else {\r\n props.element.classList.remove(\"popoverHover\")\r\n }\r\n})\r\n\r\nconst activatorProps = {\r\n onMousedown: (e: MouseEvent) => {\r\n open.value = !open.value\r\n if (open.value) {\r\n activatorElement.value = e.currentTarget as HTMLElement\r\n }\r\n },\r\n onTouchstart: (e: TouchEvent) => {\r\n open.value = !open.value\r\n if (open.value) {\r\n activatorElement.value = e.currentTarget as HTMLElement\r\n }\r\n }\r\n}\r\n\r\nconst style = computed(() => {\r\n return { \r\n left: position.value.left + 'px', \r\n top: position.value.top +'px', \r\n width: position.value.width? (position.value.width + 'px'): undefined,\r\n height: position.value.height? (position.value.height + 'px'): undefined,\r\n transformOrigin: origin.value \r\n }\r\n})\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.v-popover\r\n position: fixed\r\n background-color: var(--popover-color)\r\n box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2)\r\n border-radius: 12px\r\n min-width: 40px\r\n min-height: 40px\r\n transform: none\r\n z-index: 1000\r\n box-sizing: border-box\r\n\r\n &.v-enter-active, &.v-leave-active \r\n transition: opacity 0.12s, transform 0.12s cubic-bezier(0.4, 0, 0.2, 1)\r\n\r\n &.v-enter-from, &.v-leave-to\r\n opacity: 0\r\n\r\n &.vertical\r\n transform: scale(0.9, 0.7)\r\n\r\n &.fit-anchor\r\n transform: scale(1, 0.7)\r\n\r\n &.horizontal\r\n transform: scale(0.7, 0.9)\r\n\r\n &.fit-anchor\r\n transform: scale(0.7, 1)\r\n\r\n</style>","<template>\r\n <slot name=\"activator\" :props=\"activatorProps\"></slot>\r\n <VPopover\r\n v-model:open=\"open\" \r\n :element=\"activatorElement\" \r\n :anchorPosition=\"props.anchorPosition\"\r\n :placement=\"props.placement ?? 'bottom-start'\" \r\n :offset=\"offset\" \r\n class=\"v-context-menu\"\r\n >\r\n <VButton \r\n v-for=\"item in items\" \r\n v-bind=\"item.props\"\r\n class=\"v-context-menu__item\" \r\n @click=\"onItemClick(item)\"\r\n >\r\n {{ item.title }}\r\n </VButton>\r\n </VPopover>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { useVModel } from '@vueuse/core';\r\nimport VPopover, { Placement } from './VPopover.vue';\r\nimport { reactive, ref, shallowRef, watch } from 'vue';\r\nimport VButton from './VButton.vue';\r\n\r\ntype NullableItem = (Item | undefined | null | false)\r\n\r\nconst props = defineProps<{\r\n open?: boolean,\r\n placement?: Placement,\r\n anchorPosition?: { x: number, y: number },\r\n offset?: number,\r\n items: NullableItem[] | (() => NullableItem[]),\r\n}>()\r\n\r\nconst activatorElement = ref<HTMLElement>()\r\n\r\nconst emit = defineEmits([ \"update:open\" ])\r\nconst open = useVModel(props, \"open\", emit, { passive: true })\r\n\r\nconst items = shallowRef<Item[]>([])\r\n\r\nwatch(open, (open) => {\r\n if (!open) return\r\n const _items = typeof props.items === \"function\"? props.items(): props.items\r\n items.value = _items.filter(item => !!item) as Item[]\r\n})\r\n\r\nconst activatorProps = {\r\n onClick: (e: MouseEvent) => {\r\n open.value = true\r\n activatorElement.value = e.currentTarget as HTMLElement\r\n }\r\n}\r\n\r\nconst onItemClick = (item: Item) => {\r\n if (item.onClick) {\r\n item.onClick()\r\n open.value = false\r\n }\r\n if (item.props?.to || item.props?.href) {\r\n open.value = false\r\n }\r\n}\r\n\r\n</script>\r\n\r\n<script lang=\"ts\">\r\nexport type Item = {\r\n title?: string,\r\n onClick?: () => void,\r\n props?: Record<string, any>,\r\n children?: Item[],\r\n}\r\n\r\nexport type NullableItem = (Item | undefined | null | false)\r\n\r\nexport const useContextMenu = <T extends Array<any>>(creator: (...args: T) => NullableItem[]) => {\r\n\r\n let target: HTMLElement | null = null\r\n const props = reactive({\r\n items: [] as NullableItem[],\r\n open: false,\r\n anchorPosition: { x: 0, y: 0 },\r\n \"onUpdate:open\": (value: boolean) => {\r\n if (value === false && target !== null) {\r\n target.removeAttribute(\"data-popover-target\")\r\n target = null\r\n }\r\n props.open = value\r\n }\r\n })\r\n \r\n const open = (e: MouseEvent, ...args: T) => {\r\n e.preventDefault()\r\n props.items = creator(...args)\r\n props.anchorPosition = { x: e.clientX, y: e.clientY }\r\n props.open = true\r\n\r\n if (target !== null) {\r\n target.removeAttribute(\"data-popover-target\")\r\n target = null\r\n }\r\n target = e.currentTarget as HTMLElement\r\n target.setAttribute(\"data-popover-target\", \"true\")\r\n }\r\n\r\n return {\r\n props,\r\n open\r\n }\r\n}\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n\r\n.v-context-menu\r\n padding: 6px 0\r\n display: flex\r\n flex-direction: column\r\n\r\n.v-context-menu__item\r\n height: 40px\r\n display: flex\r\n align-items: center\r\n background: none\r\n border: none\r\n outline: none\r\n cursor: pointer\r\n padding: 0 16px\r\n padding-right: 32px\r\n text-decoration: none\r\n min-width: 150px\r\n box-sizing: border-box\r\n color: var(--text-color)\r\n border-radius: 0\r\n text-align: start\r\n font-weight: 500\r\n justify-content: flex-start\r\n\r\n &:hover, &.hover\r\n background-color: var(--hover-color)\r\n\r\n</style>","<template>\r\n <div ref=\"containerRef\" class=\"page-editor-hierarchy\" @click.self=\"emit('update:activeBlockId', null)\">\r\n <div \r\n v-for=\"item in flatBlocks\" \r\n class=\"page-editor-hierarchy__item\" \r\n :class=\"{ active: props.activeBlockId === item.content.id, hover: props.hoverBlockId === item.content.id }\"\r\n :style=\"{ paddingLeft: `${16 + item.intent*16}px` }\"\r\n @blockdrop=\"onItemBlockDrop($event, item)\"\r\n @mousedown=\"onItemMouseDown($event, item)\"\r\n @mouseenter=\"emit('update:hoverBlockId', item.content.id)\"\r\n @mouseleave=\"emit('update:hoverBlockId', null)\"\r\n @click=\"emit('update:activeBlockId', item.content.id)\"\r\n @contextmenu.stop=\"contextMenu.open($event, item.content)\"\r\n >\r\n {{ item.block.name }}\r\n </div>\r\n\r\n <div \r\n v-for=\"item in places\" \r\n class=\"page-editor-hierarhy__place\" \r\n :style=\"item.style\"\r\n @blockdrop=\"onPlaceBlockDrop($event, item.index)\"\r\n >\r\n </div>\r\n <VContextMenu v-bind=\"contextMenu.props\" />\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { computed, CSSProperties, inject, Ref, ref, shallowReactive, watch } from 'vue';\r\nimport { Block, BlockDropEvent, ContentBlock } from '../../common/types'\r\nimport { hasSlots, hasMultipleSlots, forEachChildren, uid, deleteBlock, createContentBlockChild, getBlockIndex, createContentBlock } from '../utils/blocks';\r\nimport { cloneDeep, useDraggableItem } from 'vuesix'\r\nimport VContextMenu, { useContextMenu } from './VContextMenu.vue'\r\n\r\ntype FlatBlockEntry = { \r\n content: ContentBlock, \r\n parent: ContentBlock | null,\r\n block: Block, \r\n key: string, \r\n intent: number, \r\n hasSlots: boolean,\r\n hasMultipleSlots: boolean\r\n}\r\n\r\nconst props = defineProps<{ contentBlocks: ContentBlock[], blocksMap: Map<string, Block>, hoverBlockId: string | null, activeBlockId: string | null }>()\r\nconst emit = defineEmits([ \"update:hoverBlockId\", \"update:activeBlockId\" ])\r\n\r\nconst flatBlocks = computed(() => {\r\n const arr: Array<FlatBlockEntry> = []\r\n\r\n const collectBlocks = (items: ContentBlock[], intent = 0, parent: ContentBlock | null = null) => {\r\n for (let i = 0; i < items.length; i++) {\r\n const data = items[i]\r\n const block = props.blocksMap.get(data.blockId)\r\n if (!block) {\r\n arr.push({\r\n content: data, key: data.id, intent, hasSlots: false, hasMultipleSlots: false, block: {} as Block, parent\r\n })\r\n continue\r\n }\r\n arr.push({ \r\n content: data, \r\n key: data.id, \r\n intent, \r\n hasSlots: hasSlots(block),\r\n hasMultipleSlots: hasMultipleSlots(block),\r\n block: block,\r\n parent\r\n })\r\n forEachChildren(block, data, blocks => {\r\n collectBlocks(blocks, intent+1, data)\r\n })\r\n }\r\n }\r\n\r\n collectBlocks(props.contentBlocks)\r\n return arr\r\n})\r\n\r\nconst drag = useDraggableItem()\r\nconst dragMode = inject(\"dragMode\") as Ref<boolean>\r\n\r\nconst onItemMouseDown = (e: MouseEvent, item: FlatBlockEntry) => {\r\n if (e.button !== 0) return\r\n const target = e.currentTarget as HTMLElement\r\n drag(e, {\r\n onStart(item) {\r\n target.setAttribute(\"data-source-drag\", \"\")\r\n item.classList.add(\"drag\")\r\n document.body.classList.add(\"mousedrag\")\r\n dragMode.value = true\r\n },\r\n onEnd(e) {\r\n document.body.classList.remove(\"mousedrag\")\r\n target.removeAttribute(\"data-source-drag\")\r\n if (e.target !== target) {\r\n e.target?.dispatchEvent(new BlockDropEvent(item.block, item.content))\r\n }\r\n dragMode.value = false\r\n }\r\n })\r\n}\r\n\r\nconst containerRef = ref<HTMLElement>()\r\nconst places = shallowReactive<{ style: CSSProperties, index: number }[]>([])\r\n\r\nwatch(dragMode, (dragMode) => {\r\n if (!dragMode || !containerRef.value) {\r\n places.length = 0\r\n return\r\n }\r\n const containerRect = containerRef.value.getBoundingClientRect()\r\n\r\n places.length = 0\r\n\r\n const children = Array.from(containerRef.value.children).filter(child => child.classList.contains(\"page-editor-hierarchy__item\"))\r\n let lastRectHeight = 0\r\n let lastRectBottom = containerRect.top\r\n for (let i = 0; i < children.length+1; i++) {\r\n const child = children[i]\r\n const rect = i === children.length? \r\n { top: lastRectBottom, height: containerRect.bottom - lastRectBottom, bottom: 0 }: \r\n child.getBoundingClientRect()\r\n\r\n let top = lastRectHeight * 0.2\r\n let bottom = rect.height * 0.2\r\n\r\n if (i > 0 && !flatBlocks.value[i-1].hasSlots) {\r\n top = lastRectHeight * 0.5\r\n } \r\n if (i === children.length) {\r\n bottom = rect.height\r\n } else if (!flatBlocks.value[i].hasSlots) {\r\n bottom = rect.height * 0.5\r\n }\r\n\r\n places.push({\r\n index: i,\r\n style: {\r\n top: rect.top - containerRect.top + containerRef.value.scrollTop - top + \"px\",\r\n paddingTop: top - 1 + \"px\",\r\n height: (top+bottom) + \"px\"\r\n }\r\n })\r\n\r\n lastRectHeight = rect.height\r\n lastRectBottom = rect.bottom\r\n }\r\n})\r\n\r\nconst onItemBlockDrop = (e: BlockDropEvent, item: FlatBlockEntry) => {\r\n if (e.content) {\r\n deleteBlock(props.contentBlocks, e.content)\r\n }\r\n if (item.hasSlots) {\r\n const contentBlock: ContentBlock = e.content ?? { id: uid(), blockId: e.block.id, data: {} }\r\n createContentBlockChild(props.blocksMap, contentBlock, item.content, -1)\r\n }\r\n}\r\n\r\nconst onPlaceBlockDrop = (e: BlockDropEvent, _index: number, dublicate = false) => {\r\n e.stopPropagation()\r\n let index = _index\r\n \r\n let content = e.content\r\n if (content && !dublicate) {\r\n const sourceIndex = flatBlocks.value.findIndex(item => item.content === content)!\r\n if (sourceIndex === index || sourceIndex === index-1) return\r\n if (index > sourceIndex && sourceIndex !== -1) index--\r\n deleteBlock(props.contentBlocks, content)\r\n }\r\n if (content && dublicate) {\r\n content = cloneDeep(content)\r\n content.id = uid()\r\n content.data[\"data-block-id\"] = content.id\r\n forEachChildren(e.block, content, contents => {\r\n for (let content of contents) {\r\n content.id = uid()\r\n }\r\n })\r\n }\r\n\r\n const contentBlock: ContentBlock = content ?? createContentBlock(e.block)\r\n\r\n if (index >= flatBlocks.value.length) {\r\n props.contentBlocks.push(contentBlock)\r\n } else {\r\n const blockEntry = flatBlocks.value[index]\r\n if (blockEntry.parent === null) {\r\n const index = props.contentBlocks.indexOf(blockEntry.content)\r\n props.contentBlocks.splice(index, 0, contentBlock)\r\n } else {\r\n const index = getBlockIndex(blockEntry.parent, blockEntry.content)\r\n createContentBlockChild(props.blocksMap, contentBlock, blockEntry.parent, index)\r\n }\r\n }\r\n}\r\n\r\nconst contextMenu = useContextMenu((content: ContentBlock | null) => [\r\n content !== null && { title: \"Дублировать блок\", onClick() {\r\n const index = flatBlocks.value.findIndex(item => item.content === content)\r\n const block = props.blocksMap.get(content.blockId)!\r\n onPlaceBlockDrop(new BlockDropEvent(block, content), index, true)\r\n } },\r\n content !== null && { title: \"Копировать блок\", async onClick() {\r\n const blob = new Blob([ JSON.stringify(content) ], { type: \"text/plain\" })\r\n await navigator.clipboard.write([\r\n new ClipboardItem({ \"text/plain\": blob })\r\n ])\r\n }},\r\n { \r\n title: \"Вставить блок\",\r\n onClick: () => placeBlockFromClipboard(content)\r\n },\r\n content !== null && { \r\n title: \"Удалить блок\", \r\n onClick: () => deleteBlock(props.contentBlocks, content) \r\n },\r\n])\r\n\r\n\r\nconst placeBlockFromClipboard = async (content: ContentBlock | null) => {\r\n const resp = await navigator.clipboard.read()\r\n if (!resp[0].types.includes(\"text/plain\")) return\r\n const entry = await resp[0].getType(\"text/plain\")\r\n const text = await entry.text()\r\n if (!text.startsWith(\"{\")) return\r\n try {\r\n const contentData = JSON.parse(text)\r\n contentData.id = uid()\r\n const block = props.blocksMap.get(contentData.blockId)\r\n if (!block) return\r\n if (content !== null) {\r\n const index = flatBlocks.value.findIndex(item => item.content === content)\r\n if (flatBlocks.value[index].hasSlots) {\r\n onItemBlockDrop(new BlockDropEvent(block, contentData), flatBlocks.value[index])\r\n } else {\r\n onPlaceBlockDrop(new BlockDropEvent(block, contentData), index)\r\n }\r\n } else {\r\n onPlaceBlockDrop(new BlockDropEvent(block, contentData), flatBlocks.value.length)\r\n }\r\n } catch(e) {\r\n console.warn(e)\r\n }\r\n}\r\n\r\n</script>\r\n\r\n<script lang=\"ts\">\r\n\r\n\r\n\r\n</script>\r\n\r\n\r\n<style lang=\"sass\">\r\n.page-editor-hierarchy\r\n background-color: var(--paper-color)\r\n flex-shrink: 0\r\n position: relative\r\n height: 100%\r\n\r\n.page-editor-hierarchy__item\r\n display: flex\r\n align-items: center\r\n height: 42px\r\n padding: 0 16px\r\n font-size: 13px\r\n cursor: pointer\r\n font-weight: 500\r\n box-sizing: border-box\r\n\r\n &:hover, &.hover, &[data-popover-target]\r\n background-color: var(--hover-color)\r\n\r\n &.active, &[data-source-drag]\r\n background-color: var(--background-active-color)\r\n color: var(--text-active-color)\r\n\r\n &.hoverBlock\r\n box-shadow: inset 0 0 0 2px var(--primary-color)\r\n\r\n &.drag\r\n display: none\r\n\r\n.page-editor-hierarhy__place\r\n position: absolute\r\n left: 0\r\n right: 0\r\n box-sizing: border-box\r\n // border: 1px solid var(--primary-color)\r\n\r\n &::after\r\n content: \"\"\r\n width: 100%\r\n display: block\r\n height: 2px\r\n\r\n &:hover::after\r\n background-color: var(--primary-color)\r\n\r\n</style>","<template>\r\n <div class=\"editor-component editor-hover-frame\" :style=\"style\">\r\n\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { CSSProperties, ref, watch } from 'vue';\r\n\r\nconst props = defineProps<{ element?: HTMLElement | null, resizable?: boolean }>()\r\n\r\nconst style = ref<CSSProperties>({ display: \"none\" })\r\n\r\nconst updateStyle = () => {\r\n if (props.element) {\r\n const rect = props.element.getBoundingClientRect()\r\n style.value = { \r\n top: rect.top + document.documentElement.scrollTop +\"px\", \r\n left: rect.left + document.documentElement.scrollLeft +\"px\", \r\n width: rect.width+\"px\", \r\n height: rect.height+\"px\" \r\n }\r\n } else {\r\n style.value = { display: \"none\" }\r\n }\r\n}\r\nconst resizeObserver = new ResizeObserver(updateStyle)\r\n\r\nwatch(() => props.element, (element, lastElement) => {\r\n updateStyle()\r\n if (element) {\r\n resizeObserver.observe(element)\r\n } else if (lastElement) {\r\n resizeObserver.unobserve(lastElement)\r\n }\r\n}, { immediate: true })\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.editor-hover-frame\r\n position: absolute\r\n border: 2px solid var(--primary-color)\r\n pointer-events: none\r\n box-sizing: border-box\r\n</style>","<template>\r\n <div ref=\"tabsRef\" class=\"v-tabs\">\r\n <TransitionGroup>\r\n <button v-for=\"item in props.items\" :key=\"item.id\" class=\"v-tabs__tab\" :class=\"{ active: model === item.id }\" @click=\"model = item.id\">\r\n {{ item.title }}\r\n </button>\r\n </TransitionGroup>\r\n <div class=\"v-tabs__marker\" :style=\"markerStyle\"></div>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup generic=\"K extends number | string\">\r\nimport { useVModel } from '@vueuse/core';\r\nimport { CSSProperties, Ref, nextTick, onMounted, ref, watch } from 'vue';\r\n\r\ntype Item = { id: K, title: string }\r\nconst props = defineProps<{ items: Item[], modelValue?: K }>()\r\nconst emit = defineEmits([ \"update:modelValue\" ])\r\n\r\nconst model = useVModel(props, \"modelValue\", emit, { passive: true }) as Ref<K>\r\n\r\nwatch(() => props.items, (items) => {\r\n if ((model.value === undefined || model.value === null) && items.length > 0) {\r\n model.value = items[0].id\r\n }\r\n}, { immediate: true })\r\n\r\nconst tabsRef = ref<HTMLDivElement>()\r\nconst markerStyle = ref<CSSProperties>({})\r\n\r\nconst placeMarker = () => {\r\n const id = model.value\r\n if (!tabsRef.value) return\r\n const index = props.items.findIndex(item => item.id === id)\r\n if (index < 0) {\r\n markerStyle.value = { width: \"0px\" }\r\n return\r\n }\r\n const child = tabsRef.value.children[index] as HTMLElement\r\n \r\n const p = 8\r\n markerStyle.value = { left: child.offsetLeft+p+\"px\", width: child.clientWidth-p*2+\"px\" }\r\n\r\n for (let child of tabsRef.value.children) {\r\n const item = child as HTMLElement\r\n item.style.left = item.offsetLeft + \"px\"\r\n }\r\n\r\n // setTimeout(() => {\r\n // tabsRef.value!.scrollTo(child.offsetLeft-60, child.offsetLeft + child.clientWidth+60)\r\n // }, 0)\r\n}\r\n\r\nonMounted(() => {\r\n placeMarker()\r\n})\r\nwatch(() => props.items, () => {\r\n placeMarker()\r\n}, { deep: true, flush: \"post\" })\r\n// useResizeObserver(tabsRef, () => {\r\n// placeMarker()\r\n// })\r\n\r\nwatch(model, placeMarker, { flush: \"post\" })\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.v-tabs\r\n border-bottom: 1px solid rgba(255, 255, 255, 0.1)\r\n overflow: hidden\r\n white-space: nowrap\r\n position: relative\r\n gap: 8px\r\n display: flex\r\n\r\n.v-tabs__tab\r\n background: none\r\n height: 36px\r\n padding: 0 8px\r\n font-size: 14px\r\n border: none\r\n font-weight: 500\r\n cursor: pointer\r\n color: var(--text-secondary-color)\r\n transition: color 0.2s\r\n outline: none\r\n\r\n &.v-enter-active, &.v-leave-active\r\n transition: transform 0.225s cubic-bezier(0, 0, 0.2, 1), opacity 0.225s\r\n\r\n &.v-enter-from, &.v-leave-to\r\n transform: translateY(-20px)\r\n opacity: 0\r\n\r\n &.v-leave-active\r\n position: absolute\r\n\r\n &.active\r\n color: var(--text-color)\r\n\r\n.v-tabs__marker\r\n position: absolute\r\n bottom: -1px\r\n height: 2px \r\n background-color: var(--button-color)\r\n border-radius: 1px\r\n transition: left 0.225s cubic-bezier(0.4, 0, 0.2, 1), width 0.225s cubic-bezier(0.4, 0, 0.2, 1)\r\n\r\n</style>","<template>\r\n <div class=\"v-tabs-pages\">\r\n <Transition :name=\"transitionClass\">\r\n <div :key=\"props.page\" class=\"v-tabs-pages__page\" :class=\"props['page:class']\">\r\n <slot :name=\"props.page\" />\r\n </div>\r\n </Transition>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { ref, useSlots, watch } from 'vue';\r\n\r\nconst props = defineProps<{ page: string, \"page:class\"?: string }>()\r\n\r\nconst slots = useSlots()\r\n\r\nconst transitionClass = ref(\"slide-right\")\r\nwatch(() => props.page, (value, lastValue) => {\r\n const keys = Object.keys(slots)\r\n if (keys.indexOf(value) > keys.indexOf(lastValue)) {\r\n transitionClass.value = \"slide-left\"\r\n } else {\r\n transitionClass.value = \"slide-right\"\r\n }\r\n})\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.v-tabs-pages\r\n position: relative\r\n overflow: hidden\r\n min-height: 100px\r\n\r\n.v-tabs-pages__page\r\n position: absolute\r\n inset: 0\r\n\r\n &.slide-left-enter-active, &.slide-left-leave-active, &.slide-right-enter-active, &.slide-right-leave-active\r\n transition: transform 0.225s cubic-bezier(0.8, 0, 0.2, 1)\r\n\r\n &.slide-left-enter-from, &.slide-right-leave-to\r\n transform: translateX(100%)\r\n\r\n &.slide-right-enter-from, &.slide-left-leave-to\r\n transform: translateX(-100%)\r\n\r\n\r\n</style>","<template>\r\n <div class=\"v-form-control\" :class=\"{ error: !!props.error, disabled: props.disabled }\">\r\n <label v-if=\"!!props.label\" class=\"v-form-control__label\">\r\n {{ props.label }}<span v-if=\"props.required\" class=\"v-form-control__required-marker\">*</span>\r\n </label>\r\n <div v-if=\"props.outline\" class=\"v-form-control__outline\">\r\n <slot></slot>\r\n </div>\r\n <slot v-else></slot>\r\n <div v-if=\"$slots.actions\" class=\"v-form-control__actions\">\r\n <slot name=\"actions\"></slot>\r\n </div>\r\n <Transition>\r\n <div v-if=\"!!props.error\" class=\"v-form-control__error\">\r\n {{ error }}\r\n </div>\r\n </Transition>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\">\r\n\r\nexport type VFormControlProps = {\r\n error?: { message?: string, code?: string },\r\n label?: string\r\n required?: boolean,\r\n disabled?: boolean\r\n}\r\n\r\n</script>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { computed } from 'vue';\r\n\r\nconst props = defineProps<VFormControlProps & { outline?: boolean }>()\r\n\r\nconst error = computed(() => {\r\n if (!props.error) return \"\"\r\n const code = props.error[\"code\"]\r\n if (code) {\r\n return props.error.message ?? \"\"\r\n }\r\n return props.error.message ?? \"Произошла ошибка\"\r\n})\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n\r\n.v-form-control\r\n display: flex\r\n flex-direction: column\r\n align-items: stretch\r\n position: relative\r\n transition: padding-bottom 0.12s cubic-bezier(0.4, 0, 0.2, 1)\r\n\r\n &.error\r\n &:not(.disablePadding)\r\n padding-bottom: 16px\r\n\r\n .v-form-control__label\r\n color: var(--error-color)\r\n\r\n .v-form-control__outline\r\n border-color: var(--error-color)\r\n\r\n &.disabled\r\n pointer-events: none\r\n opacity: 0.6\r\n\r\n.v-form-control__outline\r\n display: flex\r\n border-radius: 8px\r\n transition: border-color 0.12s\r\n font-size: 13px\r\n position: relative\r\n box-sizing: border-box\r\n background-color: var(--blocks-color)\r\n\r\n &:focus-within\r\n border-color: #AAAAAC\r\n\r\n.v-form-control__label\r\n font-size: 13px\r\n margin-bottom: 6px\r\n white-space: nowrap\r\n font-weight: 500\r\n user-select: none\r\n color: var(--text-secondary-color)\r\n\r\n.v-form-control__required-marker\r\n color: var(--primary-color)\r\n user-select: none\r\n margin-left: 0.15em\r\n\r\n.v-form-control__error\r\n position: absolute\r\n bottom: 0\r\n font-size: 12px\r\n color: var(--error-color)\r\n transition: opacity 0.12s, transform 0.12s cubic-bezier(0.4, 0, 0.2, 1)\r\n\r\n &.v-enter-from, &.v-leave-to\r\n opacity: 0\r\n\r\n.v-form-control.disablePadding .v-form-control__error\r\n bottom: -16px\r\n &.v-enter-from, &.v-leave-to\r\n transform: translateY(-16px)\r\n\r\n.v-form-control__actions\r\n position: absolute\r\n top: -4px\r\n right: 0\r\n display: flex\r\n align-items: center\r\n\r\n .v-icon-button\r\n width: 24px\r\n height: 24px\r\n color: var(--text-secondary-color)\r\n\r\n svg\r\n max-width: 16px\r\n max-height: 16px\r\n\r\n</style>","<template>\r\n <VFormControl class=\"v-input\" :error=\"error\" :label=\"label\" :required=\"required\" :disabled=\"disabled\" :class=\"{ large, multiline }\" outline>\r\n <template v-if=\"$slots.actions\" #actions><slot name=\"actions\"></slot></template>\r\n <slot name=\"start-adornment\"></slot>\r\n <div v-if=\"type === 'phone'\" class=\"v-input__start-adornment\">+7</div>\r\n <textarea \r\n v-if=\"props.multiline\" \r\n ref=\"inputRef\" \r\n v-model=\"model\" \r\n :placeholder=\"props.placeholder\" \r\n :rows=\"props.rows\" \r\n class=\"scroll\"\r\n :name=\"props.name\"\r\n ></textarea>\r\n <input \r\n v-else \r\n ref=\"inputRef\" \r\n v-model=\"model\" \r\n :placeholder=\"props.placeholder\" \r\n :type=\"inputType\"\r\n :name=\"props.name\"\r\n />\r\n <div v-if=\"props.maxLength\" class=\"v-input__max-length\">{{ model.length }} / {{ props.maxLength }}</div>\r\n <slot name=\"end-adornment\"></slot>\r\n </VFormControl>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { Ref, computed, onMounted, ref, watch } from 'vue';\r\nimport VFormControl, { VFormControlProps } from './VFormControl.vue';\r\nimport { useTextareaAutosize } from '@vueuse/core';\r\n\r\nconst props = defineProps<{ \r\n modelValue?: string | number | null,\r\n multiline?: boolean, \r\n autofocus?: boolean,\r\n rows?: number, \r\n placeholder?: string, \r\n type?: \"phone\" | \"number\" | \"integer\" | \"password\", \r\n name?: string,\r\n large?: boolean,\r\n maxLength?: number,\r\n validator?: (inputValue: string) => null | any\r\n} & VFormControlProps>()\r\n\r\nconst emit = defineEmits([\"update:modelValue\"])\r\n\r\nconst parse = (value: string) => {\r\n if (props.validator) {\r\n return props.validator(value)\r\n }\r\n if (props.type === \"number\") {\r\n const val = parseFloat(value)\r\n if (isNaN(val)) return null\r\n return val\r\n }\r\n if (props.type === \"integer\") {\r\n const val = parseInt(value)\r\n if (isNaN(val)) return null\r\n return val\r\n }\r\n return value\r\n}\r\n\r\nlet lastValue: number | null | string = \"\"\r\n\r\nconst model = ref(\"\")\r\nwatch(() => props.modelValue, (value) => {\r\n if (value === lastValue) return\r\n model.value = (value ?? \"\").toString()\r\n}, { immediate: true })\r\n\r\nwatch(() => model.value, (modelValue) => {\r\n const val = parse(modelValue)\r\n lastValue = val\r\n emit(\"update:modelValue\", val)\r\n})\r\n\r\nconst error = computed(() => {\r\n if ((props.type === \"number\" || props.type === \"integer\") && model.value && props.modelValue === null) {\r\n return { message: \"Введите числовое значение\" }\r\n }\r\n return props.error\r\n})\r\n\r\nconst inputType = computed(() => {\r\n if (props.type !== \"phone\" && props.type !== \"number\" && props.type !== \"integer\") return props.type\r\n return undefined\r\n})\r\n\r\nconst inputRef = ref<HTMLInputElement | HTMLTextAreaElement>()\r\nonMounted(() => {\r\n if (props.autofocus || props.error) {\r\n inputRef.value?.focus()\r\n }\r\n})\r\n\r\nif (props.multiline) {\r\n useTextareaAutosize({ element: inputRef as Ref<HTMLTextAreaElement>, input: model })\r\n}\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n\r\n.v-input\r\n min-width: 240px\r\n .v-form-control__outline\r\n height: 40px\r\n &>svg\r\n align-self: center\r\n color: #CED4DA\r\n\r\n input, textarea\r\n height: 100%\r\n flex-grow: 1\r\n background: none\r\n border: none\r\n padding: 0 14px\r\n outline: none\r\n position: relative\r\n z-index: 1\r\n width: 20px\r\n color: var(--text-color)\r\n font-size: 13px\r\n border-radius: 7px\r\n\r\n &::placeholder\r\n color: var(--placeholder-color)\r\n\r\n input\r\n padding-right: 4px\r\n\r\n &.multiline\r\n .v-form-control__outline\r\n height: auto\r\n\r\n textarea\r\n box-sizing: border-box\r\n line-height: 1.4em\r\n padding: 10px 14px\r\n resize: none\r\n min-height: 60px\r\n\r\n.v-input__start-adornment\r\n width: 46px\r\n border-right: 1px solid #CED4DA\r\n display: flex\r\n align-items: center\r\n justify-content: center\r\n\r\n @media(max-width: 800px)\r\n width: 32px\r\n\r\n.v-input__max-length\r\n position: absolute\r\n bottom: 2px\r\n right: 10px\r\n font-size: 12px\r\n color: #C8CCD0\r\n\r\n.v-input.disabled .v-input__input-wrapper\r\n background-color: #F2F2F4\r\n pointer-events: none\r\n\r\n\r\n\r\n</style>","<template>\n<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7.5001 14.1665C7.50013 14.3313 7.54902 14.4924 7.64059 14.6294C7.73217 14.7664 7.8623 14.8732 8.01455 14.9362C8.1668 14.9993 8.33433 15.0158 8.49596 14.9836C8.65758 14.9515 8.80605 14.8722 8.9226 14.7557L13.0893 10.589C13.2455 10.4327 13.3333 10.2208 13.3333 9.99982C13.3333 9.77885 13.2455 9.56693 13.0893 9.41066L8.9226 5.24399C8.80605 5.12748 8.65758 5.04814 8.49596 5.016C8.33433 4.98386 8.1668 5.00037 8.01455 5.06342C7.8623 5.12648 7.73217 5.23327 7.6406 5.37027C7.54902 5.50728 7.50013 5.66836 7.5001 5.83316L7.5001 14.1665Z\" fill=\"currentColor\"/>\r\n</svg>\n</template>\n","<template>\r\n <div class=\"v-collapse\" :class=\"{ open }\">\r\n <slot name=\"activator\" :props=\"{ onClick, open }\">\r\n <div \r\n class=\"v-collapse__activator\" \r\n :class=\"{ open }\"\r\n @mousedown=\"onClick\" \r\n @mouseenter=\"onMouseEnter\"\r\n >\r\n <CollapseArrowIcon/>\r\n <div>{{ props.label }}</div>\r\n </div>\r\n </slot>\r\n <div \r\n class=\"v-collapse__content\" \r\n :class=\"{ 'v-transition': transition, withPadding: props.withPadding }\" \r\n :style=\"transition? { height: `${height}px` }: undefined\"\r\n >\r\n <div v-if=\"transition || open\" ref=\"innerRef\" class=\"v-collapse__content-inner\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { useEventListener } from '@vueuse/core';\r\nimport { nextTick, ref, watch } from 'vue';\r\nimport CollapseArrowIcon from './icons/CollapseArrowIcon.vue'\r\n\r\nconst props = defineProps<{ open?: boolean, label?: string, withPadding?: boolean }>()\r\nconst emit = defineEmits([ \"update:open\" ])\r\n\r\nconst height = ref(0)\r\n\r\nconst open = ref(props.open ?? false)\r\nconst transition = ref(false)\r\nconst innerRef = ref<HTMLElement>()\r\n\r\nlet hideTimeout: ReturnType<typeof setTimeout> | null = null\r\nconst setOpen = async (value: boolean) => {\r\n open.value = value\r\n if (hideTimeout !== null) {\r\n clearTimeout(hideTimeout)\r\n hideTimeout = null\r\n }\r\n\r\n if (open.value === false && innerRef.value) {\r\n height.value = innerRef.value!.clientHeight\r\n }\r\n \r\n transition.value = true\r\n await nextTick()\r\n await new Promise(res => requestAnimationFrame(res))\r\n\r\n if (open.value) {\r\n height.value = innerRef.value!.clientHeight\r\n } else {\r\n height.value = 0\r\n }\r\n \r\n hideTimeout = setTimeout(() => {\r\n transition.value = false\r\n }, 200)\r\n\r\n setTimeout(() => mouseMove = true, 0)\r\n emit(\"update:open\", open.value)\r\n}\r\n\r\nconst onClick = async () => {\r\n setOpen(!open.value)\r\n}\r\nwatch(() => props.open, (value) => {\r\n if (typeof value !== 'boolean' || open.value === value) return\r\n setOpen(value) \r\n})\r\n\r\nlet mouseMove = false\r\nuseEventListener(\"mousedown\", () => mouseMove = false)\r\n\r\nconst onMouseEnter = (e: MouseEvent) => {\r\n if (e.buttons > 0 && !mouseMove && !document.body.classList.contains('mousedrag')) {\r\n mouseMove = true\r\n onClick()\r\n }\r\n}\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.v-collapse\r\n -webkit-user-drag: none\r\n\r\n.v-collapse__activator\r\n cursor: pointer\r\n user-select: none\r\n display: flex\r\n align-items: center\r\n gap: 4px\r\n height: 30px\r\n font-size: 14px\r\n\r\n svg\r\n margin-left: -4px\r\n transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)\r\n\r\n &.open\r\n svg\r\n transform: rotate(90deg)\r\n\r\n.v-collapse__content\r\n overflow: hidden\r\n\r\n &.v-transition\r\n transition: height 0.2s cubic-bezier(0.4, 0, 0.2, 1)\r\n\r\n &.withPadding\r\n padding: 4px\r\n margin: -4px\r\n\r\n</style>","<template>\n<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M14.364 5.293C14.1764 5.10553 13.9221 5.00021 13.657 5.00021C13.3918 5.00021 13.1375 5.10553 12.95 5.293L7.99995 10.243L3.04995 5.293C2.86135 5.11084 2.60875 5.01005 2.34655 5.01232C2.08435 5.0146 1.83354 5.11977 1.64813 5.30518C1.46272 5.49059 1.35756 5.7414 1.35528 6.0036C1.353 6.26579 1.45379 6.5184 1.63595 6.707L7.29295 12.364C7.48048 12.5515 7.73479 12.6568 7.99995 12.6568C8.26512 12.6568 8.51942 12.5515 8.70695 12.364L14.364 6.707C14.5514 6.51947 14.6567 6.26516 14.6567 6C14.6567 5.73483 14.5514 5.48053 14.364 5.293Z\" fill=\"currentColor\"/>\n</svg>\n</template>\n","<template>\r\n <VFormControl outline class=\"v-select\" :label=\"props.label\" :error=\"props.error\" :disabled=\"props.disabled\" :required=\"props.required\">\r\n <VPopover v-model:open=\"opened\" placement=\"bottom\" fit-anchor :offset=\"8\">\r\n <template #activator=\"{ props: activatorProps }\">\r\n <button class=\"v-select__activator\" :class=\"{ opened }\" v-bind=\"activatorProps\">\r\n <div v-if=\"currentItem\">{{ currentItem.title }}</div>\r\n <div v-else class=\"v-select__placeholder\">{{ props.placeholder ?? 'Выберите значение' }}</div>\r\n <ArrowDownIcon/>\r\n </button>\r\n </template>\r\n <div class=\"v-select__menu\">\r\n <button v-if=\"props.nullable\" class=\"nullable-item\" @click=\"resetValue\">\r\n Пустое значение\r\n </button>\r\n <template v-for=\"item in items\">\r\n <div v-if=\"typeof item === 'string'\" class=\"group-title\">{{ item }}</div>\r\n <button v-else @click=\"onItemClick(item)\" >\r\n <slot name=\"item\" :item=\"item\">\r\n {{ item.title }}\r\n </slot>\r\n </button>\r\n </template>\r\n \r\n </div>\r\n </VPopover>\r\n </VFormControl>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { Ref, computed, ref } from 'vue';\r\nimport VFormControl, { VFormControlProps } from './VFormControl.vue';\r\nimport VPopover from './VPopover.vue';\r\nimport { useVModel } from '@vueuse/core';\r\nimport ArrowDownIcon from './icons/ArrowDownIcon.vue'\r\n\r\ntype Item = { id: string | number, title: string } \r\n\r\nconst props = defineProps<{ \r\n items: (Item | string)[], \r\n modelValue?: string | number | null, \r\n placeholder?: string,\r\n nullable?: boolean\r\n} & VFormControlProps>()\r\nconst emit = defineEmits([ \"update:modelValue\" ])\r\n\r\nconst model = useVModel(props, \"modelValue\", emit, { passive: true, defaultValue: null }) as Ref<string | number | null>\r\n\r\nconst currentItem = computed<Item | null>(() => {\r\n if (model.value === null) return null\r\n return props.items.find(item => typeof item !== \"string\" && item.id === model.value) as Item ?? null\r\n})\r\n\r\nconst items = computed(() => {\r\n return props.items\r\n})\r\n\r\nconst opened = ref(false)\r\nconst onItemClick = (item: Item) => {\r\n model.value = item.id\r\n opened.value = false\r\n}\r\n\r\nconst resetValue = () => {\r\n model.value = null\r\n opened.value = false\r\n}\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.v-select\r\n .v-form-control__outline\r\n height: 40px\r\n\r\n.v-select__placeholder\r\n color: var(--text-secondary-color)\r\n\r\n.v-select__activator\r\n background: none\r\n border: none\r\n display: flex\r\n align-items: center\r\n padding: 0 16px\r\n width: 100%\r\n color: var(--text-color)\r\n text-align: left\r\n cursor: pointer\r\n outline: none\r\n &>div\r\n flex: 1 1 auto\r\n\r\n svg\r\n margin-right: -2px\r\n color: var(--text-secondary-color)\r\n width: 12px\r\n\r\n &.opened\r\n svg\r\n transform: rotate(180deg)\r\n\r\n.v-select__menu\r\n display: flex\r\n flex-direction: column\r\n padding: 6px 0\r\n\r\n &>button\r\n background: none\r\n border: none\r\n color: var(--text-color)\r\n height: 40px\r\n display: flex\r\n align-items: center\r\n padding: 0 16px\r\n cursor: pointer\r\n\r\n &:hover\r\n background-color: var(--hover-color)\r\n\r\n .group-title\r\n padding: 0 16px\r\n font-size: 13px\r\n color: var(--text-secondary-color)\r\n padding-top: 4px\r\n\r\n .nullable-item\r\n color: var(--text-secondary-color)\r\n\r\n</style>","<template>\r\n <div class=\"json-editor__array\">\r\n <VCollapse :label=\"label\" :open=\"props.expanded\">\r\n <VInput label=\"Количество элементов\" v-model=\"length\" type=\"number\"/>\r\n <JsonEditor \r\n v-for=\"index in length\"\r\n :key=\"index\"\r\n :schema=\"props.schema.items\" \r\n :name=\"`${props.schema.itemName ?? 'Элемент'} ${index}`\"\r\n v-model=\"tempArray[index-1]\" \r\n :expanded=\"childExpanded\"\r\n />\r\n </VCollapse>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { computed, ref, watch } from 'vue';\r\nimport JsonEditor from './JsonEditor.vue';\r\nimport VInput from './VInput.vue';\r\nimport VCollapse from './VCollapse.vue';\r\nimport { getDefaultValue } from '../utils/passDefaultValue'\r\n\r\nconst props = defineProps<{\r\n label?: string,\r\n schema: any,\r\n modelValue?: any,\r\n expanded?: boolean\r\n}>()\r\n\r\nconst emit = defineEmits([ \"update:modelValue\" ])\r\n\r\nconst childExpanded = props.schema.items?.type === 'object' && Object.keys(props.schema.items.properties).length < 2\r\n\r\nconst length = ref(0)\r\nconst tempArray = ref<any[]>([])\r\n\r\nif (props.schema.type === 'array' && props.modelValue) {\r\n length.value = props.modelValue.length ?? 0\r\n tempArray.value = [ ...props.modelValue ]\r\n}\r\n\r\nwatch(tempArray, () => {\r\n if (props.schema.items?.type === 'object' && props.modelValue[0] === tempArray.value[0]) return\r\n emit(\"update:modelValue\", tempArray.value.slice(0, length.value))\r\n}, { deep: true })\r\n\r\nwatch(length, (length) => {\r\n for (let i = tempArray.value.length; i < length; i++) {\r\n tempArray.value[i] = props.schema.items? getDefaultValue(props.schema.items): null\r\n }\r\n\r\n emit(\"update:modelValue\", tempArray.value.slice(0, length))\r\n})\r\n\r\nconst label = computed(() => {\r\n return `${props.label} (${length.value})`\r\n})\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.json-editor__array\r\n display: flex\r\n flex-direction: column\r\n gap: 8px\r\n</style>","<template>\r\n<svg width=\"46\" height=\"28\" viewBox=\"0 0 46 28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n<mask id=\"mask0_1044_6\" style=\"mask-type:luminance\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"46\" height=\"28\">\r\n<path d=\"M45.5 0H0.5V28H45.5V0Z\" fill=\"white\"/>\r\n</mask>\r\n<g mask=\"url(#mask0_1044_6)\">\r\n<path d=\"M23.5 27.8537C35.9264 27.8537 46 25.6664 46 22.9683C46 20.2702 35.9264 18.083 23.5 18.083C11.0736 18.083 1 20.2702 1 22.9683C1 25.6664 11.0736 27.8537 23.5 27.8537Z\" fill=\"#D7D7D7\"/>\r\n<path d=\"M39.6719 9.5459L32.538 1.51859C32.1955 0.971432 31.6956 0.640625 31.169 0.640625H15.831C15.3044 0.640625 14.8045 0.971432 14.462 1.51789L7.32812 9.5466V15.9946H39.6719V9.5459Z\" stroke=\"#A0A0A0\" stroke-width=\"0.703125\"/>\r\n<path d=\"M30.2591 11.7594C30.2591 10.6393 30.958 9.71457 31.825 9.71387H39.6719V22.3718C39.6719 23.8534 38.7437 25.0678 37.5977 25.0678H9.40234C8.25625 25.0678 7.32812 23.8527 7.32812 22.3718V9.71387H15.175C16.042 9.71387 16.7409 10.6372 16.7409 11.7573V11.7727C16.7409 12.8928 17.4475 13.7973 18.3138 13.7973H28.6862C29.5525 13.7973 30.2591 12.8845 30.2591 11.7643V11.7594Z\" fill=\"#FAFAFA\" stroke=\"#A0A0A0\" stroke-width=\"0.703125\"/>\r\n</g>\r\n</svg>\r\n</template>\r\n\r\n","<template>\n<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M9.31382 7.9L12.8488 4.364C12.9443 4.27176 13.0205 4.16141 13.0729 4.03941C13.1253 3.9174 13.1529 3.78618 13.1541 3.6534C13.1552 3.52062 13.1299 3.38894 13.0796 3.26605C13.0294 3.14315 12.9551 3.0315 12.8612 2.93761C12.7673 2.84371 12.6557 2.76946 12.5328 2.71918C12.4099 2.6689 12.2782 2.6436 12.1454 2.64475C12.0126 2.64591 11.8814 2.67349 11.7594 2.7259C11.6374 2.77831 11.5271 2.85449 11.4348 2.95L7.89882 6.485L4.36382 2.95C4.27157 2.85449 4.16123 2.77831 4.03922 2.7259C3.91722 2.67349 3.786 2.64591 3.65322 2.64475C3.52044 2.6436 3.38876 2.6689 3.26587 2.71918C3.14297 2.76946 3.03132 2.84371 2.93742 2.93761C2.84353 3.0315 2.76928 3.14315 2.719 3.26605C2.66872 3.38894 2.64342 3.52062 2.64457 3.6534C2.64572 3.78618 2.67331 3.9174 2.72572 4.03941C2.77813 4.16141 2.85431 4.27176 2.94982 4.364L6.48482 7.899L2.94982 11.435C2.85431 11.5273 2.77813 11.6376 2.72572 11.7596C2.67331 11.8816 2.64572 12.0128 2.64457 12.1456C2.64342 12.2784 2.66872 12.4101 2.719 12.533C2.76928 12.6559 2.84353 12.7675 2.93742 12.8614C3.03132 12.9553 3.14297 13.0295 3.26587 13.0798C3.38876 13.1301 3.52044 13.1554 3.65322 13.1543C3.786 13.1531 3.91722 13.1255 4.03922 13.0731C4.16123 13.0207 4.27157 12.9445 4.36382 12.849L7.89882 9.314L11.4348 12.849C11.5271 12.9445 11.6374 13.0207 11.7594 13.0731C11.8814 13.1255 12.0126 13.1531 12.1454 13.1543C12.2782 13.1554 12.4099 13.1301 12.5328 13.0798C12.6557 13.0295 12.7673 12.9553 12.8612 12.8614C12.9551 12.7675 13.0294 12.6559 13.0796 12.533C13.1299 12.4101 13.1552 12.2784 13.1541 12.1456C13.1529 12.0128 13.1253 11.8816 13.0729 11.7596C13.0205 11.6376 12.9443 11.5273 12.8488 11.435L9.31382 7.9Z\" fill=\"currentColor\"/>\n</svg>\n</template>\n","<template>\r\n <VFormControl \r\n class=\"v-image-uploader\" \r\n :class=\"{ drag }\"\r\n :error=\"error\" \r\n :label=\"label\" \r\n :required=\"required\" \r\n :disabled=\"disabled\" \r\n outline\r\n @drop=\"onDrop\"\r\n @dragover=\"onDragOver\" \r\n @dragleave=\"onDragLeave\"\r\n >\r\n <template v-if=\"drag\">\r\n <div class=\"v-image-uploader__drag-label\">Отпустите файл здесь</div>\r\n </template>\r\n <template v-else-if=\"!props.modelValue || props.modelValue.src === defaultImageSrc\">\r\n <EmptyFileIcon/>\r\n <div>\r\n <a @click=\"fileDialog.open()\">Загрузите изображение</a>\r\n <br/>или перетащите сюда\r\n </div>\r\n </template>\r\n <template v-else>\r\n <div class=\"v-image-uploader__image-preview\" >\r\n <img :src=\"props.modelValue.previewSrc ?? props.modelValue.src\" alt=\"Preview Image\" />\r\n <button @click=\"removeImage\"><CloseMinIcon/></button>\r\n </div>\r\n <div class=\"v-image-uploader__image-info\">\r\n <div>{{ props.modelValue.name }}</div>\r\n </div>\r\n </template>\r\n </VFormControl>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { inject, ref } from 'vue';\r\nimport VFormControl, { VFormControlProps } from './VFormControl.vue';\r\nimport EmptyFileIcon from './icons/EmptyFileIcon.vue'\r\nimport CloseMinIcon from './icons/CloseMinIcon.vue'\r\nimport { useFileDialog } from '@vueuse/core'\r\nimport { defaultImageSrc, getDefaultValue } from '../utils/passDefaultValue';\r\n\r\nconst props = defineProps<{ \r\n accept?: string,\r\n schema: any,\r\n modelValue?: { src: string, previewSrc?: string, name?: string, file?: File } | null,\r\n} & VFormControlProps>()\r\nconst emit = defineEmits([ \"update:modelValue\" ])\r\n\r\nconst fileUploader = inject(\"fileUploader\") as (file: File) => Promise<any>\r\n\r\nconst addFile = async (file: File) => {\r\n emit(\"update:modelValue\", { src: URL.createObjectURL(file), file, name: file.name })\r\n if (fileUploader) {\r\n const resp = await fileUploader(file)\r\n emit(\"update:modelValue\", { src: resp.src, previewSrc: resp.previewSrc, name: resp.name })\r\n }\r\n // emit(\"loadFile\", file)\r\n}\r\n\r\nconst drag = ref(false)\r\nconst onDragOver = (e: DragEvent) => {\r\n if (e.dataTransfer?.types?.[0]?.startsWith('text')) return\r\n e.preventDefault()\r\n drag.value = true\r\n}\r\n\r\nconst onDragLeave = (e: DragEvent) => {\r\n if (e.relatedTarget === e.currentTarget || (e.relatedTarget as HTMLElement)?.parentElement === e.currentTarget) return\r\n drag.value = false\r\n}\r\n\r\nconst onDrop = (e: DragEvent) => {\r\n e.preventDefault()\r\n drag.value = false\r\n\r\n for (const item of (e as any).dataTransfer.items) {\r\n if (item.kind !== 'file') continue\r\n const file = item.getAsFile() as File\r\n if (!file) continue\r\n\r\n addFile(file)\r\n }\r\n}\r\n\r\nconst fileDialog = useFileDialog({\r\n accept: props.accept ?? 'image/*',\r\n multiple: false\r\n})\r\n\r\nfileDialog.onChange((files) => {\r\n if (!files || files.length === 0) return\r\n for (const file of files) {\r\n addFile(file)\r\n }\r\n fileDialog.reset()\r\n})\r\n\r\nconst removeImage = () => {\r\n emit(\"update:modelValue\", getDefaultValue(props.schema))\r\n}\r\n\r\n</script>\r\n\r\n\r\n<style lang=\"sass\">\r\n.v-image-uploader .v-form-control__outline\r\n height: 80px\r\n display: flex\r\n align-items: center\r\n padding: 0 12px\r\n font-size: 13px\r\n color: var(--text-secondary-color)\r\n gap: 16px\r\n\r\n a\r\n color: var(--accent-color)\r\n font-weight: 500\r\n cursor: pointer\r\n &:hover\r\n text-decoration: underline\r\n\r\n.v-image-uploader__drag-label\r\n text-align: center\r\n flex: 1 1 auto\r\n color: var(--text-secondary-color)\r\n font-size: 13px\r\n pointer-events: none\r\n\r\n.v-image-uploader__image-preview\r\n width: fit-content\r\n position: relative\r\n img\r\n max-width: 90px\r\n max-height: 60px\r\n display: block\r\n border-radius: 4px\r\n\r\n button\r\n position: absolute\r\n top: -10px\r\n right: -10px\r\n width: 20px\r\n height: 20px\r\n display: flex\r\n align-items: center\r\n justify-content: center\r\n padding: 0\r\n color: white\r\n background-color: var(--placeholder-color)\r\n border: none\r\n border-radius: 9999px\r\n border: 2px solid var(--blocks-color)\r\n cursor: pointer\r\n svg\r\n width: 10px\r\n height: 10px\r\n\r\n\r\n.v-image-uploader__image-info\r\n color: var(--text-color)\r\n\r\n.v-image-uploader.drag .v-form-control__outline\r\n pointer-events: none\r\n box-shadow: inset 0 0 0 2px var(--primary-color)\r\n\r\n</style>","export const getBlockName = (path?: string) => {\r\n if (!path) return undefined\r\n const str = path.split(\"/\").at(-1)\r\n return str?.split(\".\", 1)[0].replace(/([A-Z])/g, \" $1\").trimStart() ?? \"Unnamed block\"\r\n}\r\n\r\nexport const capitalize = (text: string) => {\r\n return text[0].toUpperCase() + text.slice(1)\r\n}\r\n\r\nexport const spaceCamelCase = (str: string) => {\r\n return capitalize(str.replace(/([A-Z])/g, \" $1\").trimStart())\r\n}\r\n","<template>\r\n <VImageUploader \r\n v-if=\"props.schema.type === 'object' && props.schema.format === 'image'\" \r\n v-model=\"vModel\" \r\n :label=\"props.schema.name ?? props.name\"\r\n :schema=\"props.schema\"\r\n />\r\n <div v-else-if=\"props.schema.type === 'object'\" class=\"json-editor__object\">\r\n <template v-if=\"props.flat\">\r\n <JsonEditor \r\n v-for=\"(item, key) in (props.schema.properties as object)\" \r\n v-model=\"vModel[key]\"\r\n :key=\"key\" \r\n :schema=\"item\"\r\n :expanded=\"childExpanded\"\r\n :name=\"spaceCamelCase(key)\"\r\n />\r\n </template>\r\n <VCollapse v-else :label=\"props.schema.name ?? props.name\" :open=\"props.expanded\">\r\n <JsonEditor \r\n v-for=\"(item, key) in (props.schema.properties as object)\" \r\n v-model=\"vModel[key]\"\r\n :key=\"key\" \r\n :schema=\"item\"\r\n :expanded=\"childExpanded\"\r\n :name=\"spaceCamelCase(key)\"\r\n />\r\n </VCollapse>\r\n </div>\r\n <JsonEditorArray \r\n v-else-if=\"props.schema.type === 'array'\" \r\n v-model=\"vModel\" \r\n :schema=\"props.schema\"\r\n :label=\"props.schema.name ?? props.name\"\r\n :expanded=\"props.expanded\"\r\n />\r\n <VSelect \r\n v-else-if=\"props.schema.type === 'string' && props.schema.enum\" \r\n :items=\"getItems(props.schema)\"\r\n v-model=\"vModel\"\r\n :label=\"props.schema.name ?? props.name\"\r\n />\r\n <VInput \r\n v-else\r\n v-model=\"vModel\"\r\n :label=\"props.schema.name ?? props.name\"\r\n :multiline=\"props.schema.multiline\"\r\n >\r\n <!-- <template #actions><JsonEditorActions v-model=\"vModel\" :defaultValue=\"getDefaultValue(props.schema)\"/></template> -->\r\n </VInput>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport VInput from './VInput.vue';\r\nimport VCollapse from './VCollapse.vue'\r\nimport VSelect from './VSelect.vue'\r\nimport JsonEditorArray from './JsonEditorArray.vue'\r\nimport VImageUploader from './VImageUploader.vue'\r\nimport { spaceCamelCase } from '../utils/lang'\r\n\r\nconst props = defineProps<{ schema: any, name?: string, flat?: boolean, expanded?: boolean }>()\r\nconst childExpanded = props.schema.type === 'object' && Object.keys(props.schema.properties).length < 2\r\n\r\nconst vModel = defineModel<any>()\r\n\r\n// const onPropertyUpdate = (key: string, value: any) => {\r\n// if (!props.modelValue) {\r\n// emit(\"update:modelValue\", { [key]: value })\r\n// } else {\r\n// props.modelValue[key] = value\r\n// }\r\n// }\r\n\r\nconst getItems = (schema: { enum: string[], enumAlias?: string[] }) => {\r\n return schema.enum.map((item, index) => ({\r\n id: item,\r\n title: schema.enumAlias?.[index] ?? spaceCamelCase(item)\r\n }))\r\n}\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n.json-editor__object\r\n display: flex\r\n flex-direction: column\r\n gap: 12px\r\n\r\n .v-collapse.open>.v-collapse__content\r\n border-bottom: 1px solid var(--border-color)\r\n \r\n &>.v-collapse>.v-collapse__content>.v-collapse__content-inner\r\n display: flex\r\n flex-direction: column\r\n gap: 12px\r\n\r\n .v-collapse__content-inner\r\n padding-bottom: 12px\r\n padding-left: 2px\r\n padding-right: 2px\r\n\r\n .v-collapse__activator\r\n font-size: 13px\r\n font-weight: 500\r\n\r\n</style>","<template>\n<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M10.707 14.364C10.8945 14.1764 10.9998 13.9221 10.9998 13.657C10.9998 13.3918 10.8945 13.1375 10.707 12.95L5.75705 7.99995L10.707 3.04995C10.8892 2.86135 10.99 2.60875 10.9877 2.34655C10.9854 2.08435 10.8803 1.83354 10.6949 1.64813C10.5095 1.46272 10.2586 1.35756 9.99645 1.35528C9.73425 1.353 9.48165 1.45379 9.29305 1.63595L3.63605 7.29295C3.44858 7.48048 3.34326 7.73479 3.34326 7.99995C3.34326 8.26512 3.44858 8.51942 3.63605 8.70695L9.29305 14.364C9.48058 14.5514 9.73488 14.6567 10 14.6567C10.2652 14.6567 10.5195 14.5514 10.707 14.364Z\" fill=\"currentColor\"/>\n</svg>\n</template>\n","<template>\n<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.29295 1.63605C5.10548 1.82358 5.00017 2.07788 5.00017 2.34305C5.00017 2.60821 5.10548 2.86252 5.29295 3.05005L10.243 8.00005L5.29295 12.95C5.11079 13.1387 5.01 13.3913 5.01228 13.6534C5.01456 13.9156 5.11972 14.1665 5.30513 14.3519C5.49054 14.5373 5.74135 14.6424 6.00355 14.6447C6.26575 14.647 6.51835 14.5462 6.70695 14.364L12.364 8.70705C12.5514 8.51952 12.6567 8.26521 12.6567 8.00005C12.6567 7.73488 12.5514 7.48058 12.364 7.29305L6.70695 1.63605C6.51942 1.44858 6.26512 1.34326 5.99995 1.34326C5.73479 1.34326 5.48048 1.44858 5.29295 1.63605Z\" fill=\"currentColor\"/>\n</svg>\n</template>\n","import { Ref, shallowRef, watch } from \"vue\"\r\n\r\nexport const useControlComponent = (_activeBlockId?: string) => {\r\n\r\n let lastRoot: HTMLElement = document.body\r\n const hoverBlockId = shallowRef<string | null>(null)\r\n const activeBlockId = shallowRef<string | null>(_activeBlockId ?? null)\r\n\r\n const hoverBlockElement = shallowRef<HTMLElement | null>(null)\r\n const activeBlockElement = shallowRef<HTMLElement | null>(null)\r\n \r\n let lastStateKey = \"\" \r\n\r\n let blocksHover: HTMLElement[] = []\r\n const onIframeBlockMouseEnter = (e: MouseEvent) => {\r\n hoverBlockElement.value = e.currentTarget as HTMLElement\r\n const blockId = hoverBlockElement.value.getAttribute(\"data-block-id\") ?? null\r\n hoverBlockId.value = blockId\r\n\r\n blocksHover.push(e.currentTarget as HTMLElement)\r\n }\r\n\r\n const onIframeBlockMouseLeave = (e: MouseEvent) => {\r\n const el = e.currentTarget as HTMLElement\r\n if (el && blocksHover.indexOf(el) >= 0) {\r\n blocksHover = blocksHover.slice(0, blocksHover.indexOf(el))\r\n }\r\n setTimeout(() => {\r\n if (hoverBlockElement.value !== el) return\r\n hoverBlockElement.value = blocksHover[blocksHover.length-1] ?? null\r\n const blockId = hoverBlockElement.value?.getAttribute(\"data-block-id\") ?? null\r\n hoverBlockId.value = blockId\r\n }, 0) \r\n }\r\n\r\n const onIframeBlockClick = (e: MouseEvent) => {\r\n hoverBlockElement.value = e.currentTarget as HTMLElement\r\n const blockId = hoverBlockElement.value.getAttribute(\"data-block-id\") ?? null\r\n hoverBlockId.value = blockId\r\n\r\n activeBlockId.value = blockId\r\n\r\n if (!blockId) return\r\n\r\n activeBlockElement.value = hoverBlockElement.value\r\n\r\n e.stopPropagation()\r\n e.preventDefault()\r\n }\r\n \r\n const update = (root: HTMLElement) => {\r\n lastRoot = root\r\n const arr = Array.from(root.querySelectorAll<HTMLDivElement>(\"[data-block-id]\"))\r\n\r\n const key = arr.map(item => item.getAttribute(\"data-block-id\") ?? \"\").join(\",\")\r\n if (lastStateKey === key) return\r\n\r\n for (let item of arr) {\r\n if (item.hasAttribute(\"data-dev\")) continue\r\n item.addEventListener(\"mouseenter\", onIframeBlockMouseEnter)\r\n item.addEventListener(\"mouseleave\", onIframeBlockMouseLeave)\r\n item.addEventListener(\"click\", onIframeBlockClick)\r\n }\r\n } \r\n\r\n watch(hoverBlockId, (hoverBlockId) => {\r\n if (hoverBlockId === null) {\r\n hoverBlockElement.value = null\r\n return\r\n }\r\n if (hoverBlockId === hoverBlockElement.value?.getAttribute(\"data-block-id\")) {\r\n return\r\n }\r\n\r\n hoverBlockElement.value = lastRoot?.querySelector(`[data-block-id=\"${hoverBlockId}\"]`) ?? null\r\n })\r\n\r\n \r\n watch(activeBlockId, (activeBlockId) => {\r\n if (activeBlockId === null) {\r\n activeBlockElement.value = null\r\n return\r\n }\r\n if (activeBlockId === activeBlockElement.value?.getAttribute(\"data-block-id\")) {\r\n return\r\n }\r\n activeBlockElement.value = lastRoot.querySelector(`[data-block-id=\"${activeBlockId}\"]`) ?? null\r\n }, { immediate: true })\r\n\r\n return {\r\n update,\r\n hoverBlockElement,\r\n activeBlockElement,\r\n activeBlockId,\r\n hoverBlockId\r\n }\r\n}","import { uid, walkSchema, walkTree } from \"../../../common/utils/blocks\"\r\nimport { blocksList as _blocksList } from 'virtual:builder-blocks'\r\nimport { getBlockName } from '../../../common/utils/lang'\r\nimport { registerAlias, unfoldSchema } from 'compact-json-schema';\r\nimport { cloneDeep } from \"vuesix\";\r\nimport { defaultImageSrc, getDefaultValue } from \"../../../common/utils/passDefaultValue\";\r\n\r\nregisterAlias(\"image\", { type: \"object\", format: \"image\", properties: { src: \"string\", previewSrc: \"string?\" } })\r\nregisterAlias(\"file\", { type: \"object\", format: \"file\", properties: { src: \"string\" } })\r\n\r\nexport const blocksList = _blocksList.map(file => ({\r\n ...file.blockSchema,\r\n id: file.blockSchema.id ?? file.__name!,\r\n order: file.blockSchema.order,\r\n name: file.blockSchema.name ?? getBlockName(file.__name) ?? \"Unnamed block\",\r\n props: file.blockSchema.props? unfoldSchema(file.blockSchema.props): {}\r\n}))\r\n\r\nexport const blocksMap = new Map(blocksList.map(item => [ item.id, item ]))\r\n\r\nexport const processState = (state: any) => {\r\n walkTree(state.content, block => {\r\n if (block.id) {\r\n block.id = uid()\r\n }\r\n if (!block.data) {\r\n block.data = {}\r\n }\r\n block.data['data-block-id'] = block.id\r\n const schema = blocksMap.get(block.blockId)!\r\n if (!schema) return\r\n walkSchema(block.data, schema.props, (value, schema, key, parent, isRequired) => {\r\n if (key && isRequired && !schema.nullable && (value === null || value === undefined)) {\r\n parent[key] = getDefaultValue(schema)\r\n }\r\n })\r\n })\r\n\r\n return state\r\n}\r\n\r\nexport const saveState = (newState: any) => {\r\n \r\n const state = cloneDeep(newState)\r\n walkTree(state.content, (block) => {\r\n if (!block.data) return\r\n delete block.data['data-block-id']\r\n const schema = blocksMap.get(block.blockId)\r\n if (!schema) return\r\n walkSchema(block.data, schema.props, (value, schema, key, parent) => {\r\n if (schema.type === 'object' && schema.format === 'image' && value.src === defaultImageSrc && key && parent) {\r\n parent[key] = null\r\n }\r\n })\r\n })\r\n\r\n return state\r\n}","<template>\r\n <VSelect v-model=\"currentPage\" :items=\"pages\" />\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { ref, watch } from 'vue';\r\nimport VSelect from '../../../common/components/VSelect.vue';\r\nimport { processState } from './processState';\r\n\r\nconst currentPage = ref((window as any).state.dev.currentPage)\r\nconst availablePages: string[] = (window as any).state.dev.availablePages\r\nconst pages = availablePages.map((item: any) => ({\r\n id: item,\r\n title: item\r\n}))\r\n\r\nif (!availablePages.includes(currentPage.value)) {\r\n pages.push({\r\n id: currentPage.value,\r\n title: currentPage.value\r\n })\r\n}\r\n\r\nwatch(currentPage, async (newPage) => {\r\n const resp = await fetch(`/${newPage}`)\r\n const html = await resp.text()\r\n const _state = html.match(/window\\.state=({.+})/)?.[1]\r\n const state = _state && JSON.parse(_state)\r\n processState(state)\r\n\r\n Object.assign((window as any).state, state)\r\n window.history.pushState({}, \"\", newPage === 'index'? '/': `/${newPage}`)\r\n})\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n\r\n</style>","<template>\r\n <Transition>\r\n <div v-if=\"controlsOpened\" class=\"editor-sidebar-left editor-hierarchy editor-component\" @blockdrop.stop>\r\n <PageSelector/>\r\n <div class=\"title\">Блоки</div>\r\n <ContentHierarchy \r\n v-model:hover-block-id=\"control.hoverBlockId.value\"\r\n v-model:active-block-id=\"control.activeBlockId.value\"\r\n :content-blocks=\"contentBlocks\" \r\n :blocks-map=\"blocksMap\"\r\n />\r\n <button class=\"editor-sidebar__close-button\" @click=\"controlsOpened = false\"><ChevronLeftIcon/></button>\r\n </div>\r\n </Transition>\r\n <HoverFrame v-if=\"controlsOpened\" :element=\"control.hoverBlockElement.value\"/>\r\n <HoverFrame v-if=\"controlsOpened\" :element=\"control.activeBlockElement.value\" resizable/>\r\n <Transition>\r\n <div v-if=\"controlsOpened\" class=\"editor-sidebar-right editor-blocks-sidebar editor-component\" @blockdrop.stop>\r\n <button class=\"editor-sidebar__close-button right\" @click=\"controlsOpened = false\"><ChevronRightIcon/></button>\r\n <VTabs v-model=\"currentTab\" :items=\"tabs\"/>\r\n <VTabsPages :page=\"currentTab\">\r\n <template #blocks>\r\n <BlocksList :blocks=\"blocksList\"/>\r\n </template>\r\n <template #blockEdit>\r\n <JsonEditor \r\n v-if=\"currentBlock && currentContentBlock\" \r\n :key=\"currentContentBlock.id\" \r\n :schema=\"currentBlock.props\" \r\n v-model=\"currentContentBlock.data\" \r\n flat\r\n />\r\n <div v-else>Схема для блока не найдена</div>\r\n </template>\r\n </VTabsPages>\r\n </div>\r\n </Transition>\r\n <Transition>\r\n <div v-if=\"!controlsOpened\" class=\"editor-sidebar__close-button editor-component fixed\" @click=\"controlsOpened = true\"><ChevronRightIcon/></div>\r\n </Transition>\r\n <Transition>\r\n <div v-if=\"!controlsOpened\" class=\"editor-sidebar__close-button editor-component right fixed\" @click=\"controlsOpened = true\"><ChevronLeftIcon/></div>\r\n </Transition>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport BlocksList from '../../../common/components/BlocksList.vue'\r\nimport ContentHierarchy from '../../../common/components/ContentHierarchy.vue'\r\nimport HoverFrame from '../../../common/components/HoverFrame.vue'\r\nimport VTabs from '../../../common/components/VTabs.vue'\r\nimport VTabsPages from '../../../common/components/VTabsPages.vue'\r\nimport JsonEditor from '../../../common/components/JsonEditor.vue'\r\nimport ChevronLeftIcon from '../../../common/components/icons/ChevronLeftIcon.vue'\r\nimport ChevronRightIcon from '../../../common/components/icons/ChevronRightIcon.vue'\r\n\r\nimport { useEventListener, watchDebounced } from '@vueuse/core'\r\nimport { BlockDropEvent, ContentBlock } from '../../../common/types';\r\nimport { useControlComponent } from '../../../common/utils/controlComponent'\r\nimport { computed, onMounted, provide, ref, watch } from 'vue';\r\nimport { createContentBlock, findBlock, uid, walkSchema, walkTree } from '../../../common/utils/blocks'\r\nimport { useKeyDownLayer, cloneDeep } from 'vuesix'\r\nimport PageSelector from './PageSelector.vue'\r\nimport { defaultImageSrc } from '../../../common/utils/passDefaultValue'\r\nimport { blocksList, blocksMap, saveState } from './processState'\r\nimport CloseMinIcon from '../../../common/components/icons/CloseMinIcon.vue'\r\n\r\nconst controlsOpened = ref(true)\r\n\r\nconst dragMode = ref(false)\r\nprovide(\"dragMode\", dragMode)\r\n\r\nconst contentBlocks = computed(() => (window as any).state.content as ContentBlock[])\r\n\r\nuseEventListener(document, \"blockdrop\", (e: BlockDropEvent) => {\r\n if (e.content) {\r\n return\r\n }\r\n contentBlocks.value.push(createContentBlock(e.block))\r\n})\r\n\r\nconst control = useControlComponent(import.meta.hot?.data.activeBlockId)\r\n\r\nwatch(contentBlocks, () => {\r\n control.update(window.document.body)\r\n}, { deep: true, flush: \"post\" })\r\nonMounted(() => {\r\n control.update(window.document.body)\r\n})\r\n\r\nconst currentContentBlock = computed(() => {\r\n if (!control.activeBlockId.value) return null\r\n return findBlock(contentBlocks.value, block => block.id === control.activeBlockId.value)\r\n})\r\nconst currentBlock = computed(() => {\r\n if (!currentContentBlock.value) return null\r\n return blocksMap.get(currentContentBlock.value.blockId)\r\n})\r\n\r\nconst currentTab = ref(import.meta.hot?.data.currentTab ?? \"blocks\")\r\n\r\nconst tabs = computed(() => {\r\n const arr = [\r\n { id: \"blocks\", title: \"Блоки\" }\r\n ]\r\n if (currentContentBlock.value) {\r\n arr.push({\r\n id: \"blockEdit\",\r\n title: currentBlock.value?.name ?? \"Unknown Block\"\r\n })\r\n }\r\n return arr\r\n})\r\n\r\nwatch(currentContentBlock, (block) => {\r\n if (block) {\r\n currentTab.value = \"blockEdit\"\r\n } else {\r\n if (currentTab.value === \"blockEdit\") {\r\n currentTab.value = \"blocks\"\r\n }\r\n }\r\n})\r\n\r\nwatch(currentTab, (currentTab) => {\r\n Object.assign(import.meta.hot!.data, { currentTab })\r\n})\r\n\r\nwatch(control.activeBlockId, (activeBlockId) => {\r\n Object.assign(import.meta.hot!.data, { activeBlockId })\r\n})\r\n\r\nuseKeyDownLayer(\"Escape\", () => !!control.activeBlockId.value, () => control.activeBlockId.value = null)\r\n\r\nwatchDebounced((window as any).state, (newState, oldState) => {\r\n if (newState?.dev?.currentPage !== oldState?.dev?.currentPage) {\r\n return\r\n }\r\n\r\n const state = saveState(newState)\r\n // import.meta.hot!.send(\"mechanica:saveState\", JSON.stringify(state))\r\n fetch(\"/@mechanica/save\", {\r\n method: \"POST\",\r\n body: JSON.stringify(state),\r\n headers: { \"content-type\": \"application-json\" }\r\n })\r\n}, { debounce: 500 })\r\n\r\nprovide(\"fileUploader\", async (file: File) => {\r\n const resp = await fetch(\"/@mechanica/upload\", {\r\n method: \"POST\",\r\n body: file,\r\n headers: { \"x-file-name\": file.name, \"content-type\": \"application/octet-stream\" }\r\n })\r\n const obj = await resp.json()\r\n return obj\r\n})\r\n\r\n</script>\r\n\r\n<style lang=\"sass\">\r\n@import ../../../common/styles/variables\r\n@import ../../../common/styles/typography\r\n\r\n.editor-component\r\n @include variables\r\n @include typography\r\n\r\n.editor-blocks-sidebar\r\n position: fixed\r\n right: 0\r\n top: 0\r\n bottom: 0\r\n width: 340px\r\n border-left: 1px solid var(--border-color)\r\n background-color: white\r\n z-index: 1000\r\n display: flex\r\n flex-direction: column\r\n\r\n .v-tabs\r\n padding: 0 8px\r\n margin-top: 12px\r\n\r\n .v-tabs-pages\r\n flex: 1 1 auto\r\n\r\n .v-tabs-pages__page\r\n padding: 12px 16px\r\n\r\n.editor-hierarchy\r\n position: fixed\r\n left: 0\r\n top: 0\r\n bottom: 0\r\n width: 250px\r\n border-right: 1px solid var(--border-color)\r\n background-color: white\r\n z-index: 1000\r\n\r\n .title\r\n color: var(--text-secondary-color)\r\n padding: 0 16px\r\n font-size: 13px\r\n font-weight: 500\r\n\r\n &>.v-select\r\n margin: 12px 16px\r\n\r\n.editor-control-component\r\n position: absolute\r\n top: 0\r\n left: 0\r\n width: 300px\r\n height: 200px\r\n border: 2px solid var(--primary-color)\r\n\r\n.editor-sidebar__close-button\r\n position: absolute\r\n right: -12px\r\n top: calc(50% - 12px)\r\n width: 24px\r\n height: 24px\r\n display: flex\r\n align-items: center\r\n justify-content: center\r\n padding: 0\r\n background-color: var(--text-secondary-color)\r\n color: white\r\n border: none\r\n border-radius: 9999px\r\n cursor: pointer\r\n z-index: 1\r\n opacity: 0.2\r\n &:hover\r\n opacity: 1\r\n\r\n &.right\r\n right: auto\r\n left: -12px\r\n\r\n &.fixed\r\n right: auto\r\n left: 20px\r\n z-index: 100\r\n position: fixed\r\n\r\n &.fixed.right\r\n left: auto\r\n right: 20px\r\n\r\n &.v-enter-active\r\n transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)\r\n transition-delay: 0.4s\r\n\r\n &.v-enter-from\r\n transform: translateX(-60px)\r\n\r\n &.right\r\n &.v-enter-from\r\n transform: translateX(60px)\r\n\r\n\r\n.editor-sidebar-left, .editor-sidebar-right\r\n &.v-enter-active, &.v-leave-active \r\n transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)\r\n\r\n.editor-sidebar-left\r\n &.v-enter-from, &.v-leave-to\r\n transform: translateX(-100%)\r\n\r\n.editor-sidebar-right\r\n &.v-enter-from, &.v-leave-to\r\n transform: translateX(100%)\r\n\r\n// .editor-hierarchy:hover .editor-sidebar__close-button\r\n// opacity: 1\r\n\r\n// .editor-blocks-sidebar:hover .editor-sidebar__close-button\r\n// opacity: 1\r\n\r\n</style>","import { createApp, reactive } from 'vue'\r\nimport EditorApp from './EditorApp.vue'\r\nimport { processState } from './processState'\r\n\r\n(window as any).state = reactive(processState((window as any).state))\r\n\r\nconst mountDiv = document.createElement(\"div\")\r\nmountDiv.id = \"data-mechanics-editor\"\r\ndocument.body.append(mountDiv)\r\n\r\ndocument.addEventListener(\"DOMContentLoaded\", () => {\r\n createApp(EditorApp)\r\n .mount(mountDiv)\r\n})\r\n\r\n"],"names":["e","callback","item","blocksMap","toValue$1","listeners","window","document","open","dragMode","content","index","child","_hoisted_1","_sfc_render","_openBlock","_createElementBlock","_createElementVNode","_a","length","_useModel","hoverBlockId","activeBlockId","_blocksList","schema","currentTab","_b","EditorApp"],"mappings":";;;AAAa,MAAA,aAAa,CAAC,IAAiB,aAA+D;AACrG,MAAA,SAAS,EAAE,EAAU,QAAA;AACrB,MAAA,CAAC,GAAG,cAAsB,QAAA;AACvB,SAAA,WAAW,GAAG,eAAe,QAAQ;AAC9C;ACCA,MAAM,gBAAgB,CAAC,QAAqB,aAA6B;AACnE,MAAA,CAAC,SAAiB,QAAA;AACtB,SAAO,CAAC,CAAC,WAAW,QAAQ,CAAC,OAAO;AAClC,QAAI,CAAC,MAAM,QAAQ,QAAQ,EAAG,QAAO,OAAO,SAAS;AACrD,eAAW,QAAQ,UAAU;AACvB,UAAA,KAAK,UAAU,GAAW,QAAA;AAAA,IAAA;AAEzB,WAAA;AAAA,EAAA,CACR;AACH;AAyBO,MAAM,sBAAsB,CAAC,WAAwB,aAAyB,aAA6B;AAE1G,QAAA,eAAe,CAAC,MAAkB;AACtC,QAAI,EAAE,iBAAkB;AACxB,QAAI,cAAc,EAAE,QAAuB,QAAQ,EAAG;AAC1C,gBAAA;AAAA,EACd;AAEA,QAAM,WAAW,CAAS,UAAA;AACxB,eAAW,MAAM;AACf,UAAI,OAAO;AACA,iBAAA,iBAAiB,aAAa,YAAY;AAAA,MAAA,OAC9C;AACI,iBAAA,oBAAoB,aAAa,YAAY;AAAA,MAAA;AAAA,OAEvD,EAAE;AAAA,EAAA,GACJ,EAAE,OAAO,QAAQ;AAEtB;ACzDa,MAAA,eAAe,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