UNPKG

@varlet/ui

Version:

A Vue3 component library based on Material Design 2 and 3, supporting mobile and desktop.

1,789 lines (1,788 loc) • 1.08 MB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const vue = require("vue"); function default2(n2) { return { all: n2 = n2 || /* @__PURE__ */ new Map(), on: function(t2, e) { var i = n2.get(t2); i ? i.push(e) : n2.set(t2, [e]); }, off: function(t2, e) { var i = n2.get(t2); i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n2.set(t2, [])); }, emit: function(t2, e) { var i = n2.get(t2); i && i.slice().map(function(n3) { n3(e); }), (i = n2.get("*")) && i.slice().map(function(n3) { n3(t2, e); }); } }; } const mitt_star = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: default2 }, Symbol.toStringTag, { value: "Module" })); var __defProp$B = Object.defineProperty; var __defProps$e = Object.defineProperties; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropSymbols$B = Object.getOwnPropertySymbols; var __hasOwnProp$B = Object.prototype.hasOwnProperty; var __propIsEnum$B = Object.prototype.propertyIsEnumerable; var __defNormalProp$B = (obj, key3, value) => key3 in obj ? __defProp$B(obj, key3, { enumerable: true, configurable: true, writable: true, value }) : obj[key3] = value; var __spreadValues$B = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$B.call(b, prop)) __defNormalProp$B(a, prop, b[prop]); if (__getOwnPropSymbols$B) for (var prop of __getOwnPropSymbols$B(b)) { if (__propIsEnum$B.call(b, prop)) __defNormalProp$B(a, prop, b[prop]); } return a; }; var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b)); var __export = (target, all) => { for (var name2 in all) __defProp$B(target, name2, { get: all[name2], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key3 of __getOwnPropNames(from)) if (!__hasOwnProp$B.call(to, key3) && key3 !== except) __defProp$B(to, key3, { get: () => from[key3], enumerable: !(desc = __getOwnPropDesc(from, key3)) || desc.enumerable }); } return to; }; var __reExport = (target, mod2, secondTarget) => (__copyProps(target, mod2, "default"), secondTarget); var src_exports = {}; __export(src_exports, { NOOP: () => NOOP, assert: () => assert$1, at: () => at, baseRound: () => baseRound, call: () => call, camelize: () => camelize, cancelAnimationFrame: () => cancelAnimationFrame, ceil: () => ceil$1, chunk: () => chunk, clamp: () => clamp$1, clampArrayRange: () => clampArrayRange, classes: () => classes$1d, cloneDeep: () => cloneDeep, cloneDeepWith: () => cloneDeepWith, copyText: () => copyText, createNamespaceFn: () => createNamespaceFn, createStorage: () => createStorage, debounce: () => debounce$1, delay: () => delay, difference: () => difference, differenceWith: () => differenceWith, doubleRaf: () => doubleRaf, download: () => download, ensurePrefix: () => ensurePrefix, ensureSuffix: () => ensureSuffix, find: () => find, floor: () => floor$1, genNumberKey: () => genNumberKey, genStringKey: () => genStringKey, getAllParentScroller: () => getAllParentScroller$1, getGlobalThis: () => getGlobalThis, getParentScroller: () => getParentScroller$1, getRect: () => getRect, getScrollLeft: () => getScrollLeft, getScrollTop: () => getScrollTop, getStyle: () => getStyle$1, groupBy: () => groupBy, hasOwn: () => hasOwn, inBrowser: () => inBrowser, inMobile: () => inMobile, inViewport: () => inViewport, intersection: () => intersection, intersectionWith: () => intersectionWith, isArray: () => isArray, isArrayBuffer: () => isArrayBuffer, isBlob: () => isBlob, isBoolean: () => isBoolean, isDOMException: () => isDOMException, isDataView: () => isDataView, isDate: () => isDate, isEmpty: () => isEmpty, isEmptyPlainObject: () => isEmptyPlainObject, isEqual: () => isEqual, isEqualWith: () => isEqualWith, isError: () => isError, isFile: () => isFile, isFunction: () => isFunction, isMap: () => isMap, isNonEmptyArray: () => isNonEmptyArray, isNullish: () => isNullish, isNumber: () => isNumber, isNumeric: () => isNumeric, isObject: () => isObject, isPlainObject: () => isPlainObject, isPrimitive: () => isPrimitive, isPromise: () => isPromise, isRegExp: () => isRegExp, isSet: () => isSet, isString: () => isString, isSymbol: () => isSymbol, isTruthy: () => isTruthy, isTypedArray: () => isTypedArray, isWeakMap: () => isWeakMap, isWeakSet: () => isWeakSet, isWindow: () => isWindow, kebabCase: () => kebabCase, localStorage: () => localStorage, lowerFirst: () => lowerFirst, mapObject: () => mapObject, maxBy: () => maxBy, mean: () => mean, meanBy: () => meanBy, merge: () => merge$1, mergeWith: () => mergeWith, minBy: () => minBy, mitt: () => default2, motion: () => motion, normalizeToArray: () => normalizeToArray, objectToString: () => objectToString, omit: () => omit, omitBy: () => omitBy, once: () => once, pascalCase: () => pascalCase, pick: () => pick, pickBy: () => pickBy, prettyJSONObject: () => prettyJSONObject, preventDefault: () => preventDefault, promiseWithResolvers: () => promiseWithResolvers, raf: () => raf, randomColor: () => randomColor, randomNumber: () => randomNumber, randomString: () => randomString, removeArrayBlank: () => removeArrayBlank, removeArrayEmpty: () => removeArrayEmpty, removeItem: () => removeItem, requestAnimationFrame: () => requestAnimationFrame$1, round: () => round$2, sample: () => sample, sessionStorage: () => sessionStorage, shuffle: () => shuffle, slash: () => slash, sum: () => sum$1, sumBy: () => sumBy, sumHash: () => sumHash, supportTouch: () => supportTouch, throttle: () => throttle, times: () => times, toArrayBuffer: () => toArrayBuffer, toDataURL: () => toDataURL, toNumber: () => toNumber, toRawType: () => toRawType, toText: () => toText, toTypeString: () => toTypeString, toggleItem: () => toggleItem, tryParseJSON: () => tryParseJSON, uniq: () => uniq, uniqBy: () => uniqBy, upperFirst: () => upperFirst, xor: () => xor, xorWith: () => xorWith }); function at(arr, index) { if (!arr.length) { return; } if (index < 0) { index += arr.length; } return arr[index]; } function clamp$1(num, min2, max2) { return Math.min(max2, Math.max(min2, num)); } function clampArrayRange(index, arr) { return clamp$1(index, 0, arr.length - 1); } function delay(time) { return new Promise((resolve) => { setTimeout(resolve, time); }); } function randomNumber(min2 = 0, max2 = 100) { return Math.floor(Math.random() * (max2 - min2 + 1)) + min2; } function times(num, fn2) { return Array.from({ length: num }, (_, index) => fn2(index)); } function inBrowser() { return typeof window !== "undefined"; } function getGlobalThis() { if (typeof globalThis !== "undefined") { return globalThis; } if (inBrowser()) { return window; } return typeof global !== "undefined" ? global : self; } var { hasOwnProperty } = Object.prototype; function hasOwn(val, key3) { return hasOwnProperty.call(val, key3); } function inMobile() { return inBrowser() && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); } function isArray(val) { return Array.isArray(val); } var objectToString = Object.prototype.toString; function toTypeString(value) { return objectToString.call(value); } function toRawType(value) { return toTypeString(value).slice(8, -1); } function isArrayBuffer(val) { return toRawType(val) === "ArrayBuffer"; } function isBoolean(val) { return typeof val === "boolean"; } function isDataView(val) { return toRawType(val) === "DataView"; } function isDate(val) { return toRawType(val) === "Date"; } function isDOMException(val) { return toRawType(val) === "DOMException"; } function isEmpty(val) { return val === void 0 || val === null || val === "" || isArray(val) && !val.length; } function isMap(val) { return toRawType(val) === "Map"; } function isPlainObject(val) { return toRawType(val) === "Object"; } function isSet(val) { return toRawType(val) === "Set"; } function isObject(val) { return typeof val === "object" && val !== null; } function isRegExp(val) { return toRawType(val) === "RegExp"; } function isError(val) { return toRawType(val) === "Error"; } function isTypedArray(val) { return [ "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "BigInt64Array", "BigUint64Array" ].includes(toRawType(val)); } function isEqualWith(value, other, fn2) { const valueStack = /* @__PURE__ */ new WeakMap(); const otherStack = /* @__PURE__ */ new WeakMap(); function baseIsEqual(value2, other2, valueStack2, otherStack2) { const customEqual = fn2(value2, other2); if (customEqual === true) { return true; } if (value2 === other2) { return true; } if (value2 !== value2 && other2 !== other2) { return true; } if (!isObject(value2) || !isObject(other2)) { return value2 === other2; } if (value2.constructor !== other2.constructor) { return false; } if (toRawType(value2) === "String" && toRawType(other2) === "String" || toRawType(value2) === "Number" && toRawType(other2) === "Number" || toRawType(value2) === "Boolean" && toRawType(other2) === "Boolean" || toRawType(value2) === "BigInt" && toRawType(other2) === "BigInt" || toRawType(value2) === "Symbol" && toRawType(other2) === "Symbol") { return value2.valueOf() === other2.valueOf(); } if (isDate(value2) && isDate(other2)) { return value2.getTime() === other2.getTime(); } if (isRegExp(value2) && isRegExp(other2)) { return value2.source === other2.source && value2.flags === other2.flags; } if (isError(value2) && isError(other2)) { return value2.name === other2.name && value2.message === other2.message && value2.cause === other2.cause; } if (isDOMException(value2) && isDOMException(other2)) { return value2.name === other2.name && value2.message === other2.message; } if (isTypedArray(value2) && isTypedArray(other2) || isDataView(value2) && isDataView(other2)) { if (value2.byteLength !== other2.byteLength) { return false; } const valueTypedArray = new Uint8Array(value2.buffer); const otherTypedArray = new Uint8Array(other2.buffer); return valueTypedArray.every((v, i) => v === otherTypedArray[i]); } if (isArrayBuffer(value2) && isArrayBuffer(other2)) { if (value2.byteLength !== other2.byteLength) { return false; } const valueTypedArray = new Uint8Array(value2); const otherTypedArray = new Uint8Array(other2); return valueTypedArray.every((v, i) => v === otherTypedArray[i]); } if (valueStack2.get(value2) === other2 && otherStack2.get(other2) === value2) { return true; } valueStack2.set(value2, other2); otherStack2.set(other2, value2); if (isMap(value2) && isMap(other2) || isSet(value2) && isSet(other2)) { if (value2.size !== other2.size) { return false; } const valueArray = [...value2]; const otherArray = [...other2]; const result = valueArray.every((v, i) => baseIsEqual(v, otherArray[i], valueStack2, otherStack2)); valueStack2.delete(value2); otherStack2.delete(other2); return result; } if (isArray(value2) && isArray(other2)) { if (value2.length !== other2.length) { return false; } const result = value2.every((v, i) => baseIsEqual(v, other2[i], valueStack2, otherStack2)); valueStack2.delete(value2); otherStack2.delete(other2); return result; } if (isPlainObject(value2) && isPlainObject(other2)) { const valueOwnKeys = [...Object.keys(value2), ...Object.getOwnPropertySymbols(value2)]; const otherOwnKeys = [...Object.keys(other2), ...Object.getOwnPropertySymbols(other2)]; if (valueOwnKeys.length !== otherOwnKeys.length) { return false; } const result = valueOwnKeys.every( (k) => baseIsEqual(value2[k], other2[k], valueStack2, otherStack2) ); valueStack2.delete(value2); otherStack2.delete(other2); return result; } return false; } return baseIsEqual(value, other, valueStack, otherStack); } function isEqual(value, other) { return isEqualWith(value, other, () => void 0); } function isFunction(val) { return typeof val === "function"; } function isNonEmptyArray(val) { return isArray(val) && !!val.length; } function isNullish(val) { return val == null; } function isNumber(val) { return typeof val === "number"; } function isString(val) { return typeof val === "string"; } function isNumeric(val) { return isNumber(val) || isString(val) && /^[-+]?\d+$/.test(val); } function isPromise(val) { return isObject(val) && isFunction(val.then) && isFunction(val.catch); } function isSymbol(val) { return typeof val === "symbol"; } function isTruthy(v) { return Boolean(v); } function isWeakMap(val) { return toRawType(val) === "WeakMap"; } function isWeakSet(val) { return toRawType(val) === "WeakSet"; } function isWindow(val) { return val === window; } function supportTouch() { return inBrowser() && "ontouchstart" in window; } function isFile(val) { return toRawType(val) === "File"; } function isBlob(val) { return toRawType(val) === "Blob"; } function isPrimitive(val) { return val == null || typeof val !== "object" && typeof val !== "function"; } function isEmptyPlainObject(val) { return isPlainObject(val) && Object.keys(val).length === 0 && Object.getOwnPropertySymbols(val).length === 0; } function assert$1(condition, message) { if (!condition) { throw new Error(message); } } function toNumber(val) { if (val == null) { return 0; } if (isString(val)) { val = parseFloat(val); val = Number.isNaN(val) ? 0 : val; return val; } if (isBoolean(val)) { return Number(val); } return val; } var key = 0; function genNumberKey() { return key++; } function chunk(arr, size = 1) { size = clamp$1(size, 1, arr.length); const result = []; let index = 0; while (index < arr.length) { result.push(arr.slice(index, index + size)); index += size; } return result; } function removeItem(arr, item) { if (arr.length) { const index = arr.indexOf(item); if (index > -1) { return arr.splice(index, 1); } } } function toggleItem(arr, item) { arr.includes(item) ? removeItem(arr, item) : arr.push(item); return arr; } function uniq(arr) { return [...new Set(arr)]; } function uniqBy(arr, fn2) { return arr.reduce((ret, i) => { const index = ret.findIndex((j) => fn2(i, j)); if (index === -1) { ret.push(i); } return ret; }, []); } function find(arr, fn2, from = "start") { let i = from === "start" ? 0 : arr.length - 1; while (arr.length > 0 && i >= 0 && i <= arr.length - 1) { const flag = fn2(arr[i], i, arr); if (flag) { return [arr[i], i]; } from === "start" ? i++ : i--; } return [null, -1]; } function shuffle(arr) { for (let i = arr.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [arr[i], arr[j]] = [arr[j], arr[i]]; } return arr; } function removeArrayBlank(arr) { return arr.filter((item) => item != null); } function removeArrayEmpty(arr) { return arr.filter((item) => item != null && item !== ""); } function normalizeToArray(value) { return isArray(value) ? value : [value]; } function differenceWith(arr, ...values) { const fn2 = at(values, -1); const targets = values.slice(0, -1).reduce((targets2, value) => [...targets2, ...value], []); return arr.filter((item) => !targets.some((value) => fn2(item, value))); } function difference(arr, ...values) { return differenceWith(arr, ...values, (a, b) => a === b); } function intersectionWith(...values) { const fn2 = at(values, -1); const targets = values.slice(0, -1); if (targets.length === 0) { return []; } if (targets.length === 1) { return uniqBy(targets[0], fn2); } function baseIntersectionWith(arr1, arr2) { return arr1.filter((item) => arr2.some((value) => fn2(item, value))); } return uniqBy( targets.reduce((result, target) => baseIntersectionWith(result, target)), fn2 ); } function intersection(...values) { return intersectionWith(...values, (a, b) => a === b); } function groupBy(arr, fn2) { return arr.reduce( (result, item) => { var _a; const key3 = fn2(item); ((_a = result[key3]) != null ? _a : result[key3] = []).push(item); return result; }, {} ); } function xorWith(...values) { const fn2 = at(values, -1); const targets = values.slice(0, -1); return uniqBy( targets.reduce((result, target) => { return [...differenceWith(result, target, fn2), ...differenceWith(target, result, fn2)]; }), fn2 ); } function xor(...values) { return xorWith(...values, (a, b) => a === b); } function pick(object, keys) { return keys.reduce( (result, key3) => { result[key3] = object[key3]; return result; }, {} ); } function pickBy(object, fn2) { const ownKeys = [...Object.keys(object), ...Object.getOwnPropertySymbols(object)]; return ownKeys.reduce((result, key3) => { const value = object[key3]; if (fn2(value, key3)) { result[key3] = value; } return result; }, {}); } function omit(object, keys) { const ownKeys = [...Object.keys(object), ...Object.getOwnPropertySymbols(object)]; return ownKeys.reduce( (result, key3) => { if (!keys.includes(key3)) { result[key3] = object[key3]; } return result; }, {} ); } function omitBy(object, fn2) { const ownKeys = [...Object.keys(object), ...Object.getOwnPropertySymbols(object)]; return ownKeys.reduce((result, key3) => { const value = object[key3]; if (!fn2(value, key3)) { result[key3] = value; } return result; }, {}); } function mapObject(object, fn2) { return Object.entries(object).reduce( (result, [key3, value]) => { const entry = fn2(key3, value); if (isArray(entry)) { const [newKey, newValue] = entry; result[newKey] = newValue; } return result; }, {} ); } function promiseWithResolvers() { let resolve; let reject; const promise = new Promise((_resolver, _reject) => { resolve = _resolver; reject = _reject; }); return { promise, resolve, reject }; } var util_exports = {}; __export(util_exports, { cancelAnimationFrame: () => cancelAnimationFrame, classes: () => classes$1d, copyText: () => copyText, createNamespaceFn: () => createNamespaceFn, createStorage: () => createStorage, doubleRaf: () => doubleRaf, download: () => download, getAllParentScroller: () => getAllParentScroller$1, getParentScroller: () => getParentScroller$1, getRect: () => getRect, getScrollLeft: () => getScrollLeft, getScrollTop: () => getScrollTop, getStyle: () => getStyle$1, inViewport: () => inViewport, localStorage: () => localStorage, mitt: () => default2, motion: () => motion, prettyJSONObject: () => prettyJSONObject, preventDefault: () => preventDefault, raf: () => raf, requestAnimationFrame: () => requestAnimationFrame$1, sessionStorage: () => sessionStorage, tryParseJSON: () => tryParseJSON }); function cancelAnimationFrame(handle) { const globalThis2 = getGlobalThis(); globalThis2.cancelAnimationFrame ? globalThis2.cancelAnimationFrame(handle) : globalThis2.clearTimeout(handle); } function classes$1d(...classes2) { return classes2.map((className) => { if (isArray(className)) { const [condition, truthy, falsy = null] = className; return condition ? truthy : falsy; } return className; }); } function copyText(value) { if (!value) { return; } const textArea = document.createElement("textarea"); textArea.value = value; textArea.style.position = "fixed"; textArea.style.opacity = "0"; document.body.appendChild(textArea); textArea.select(); document.execCommand("copy"); document.body.removeChild(textArea); } function camelize(s) { s = s.replace(/-(\w)/g, (_, p) => p.toUpperCase()); return s.replace(s.charAt(0), s.charAt(0).toLowerCase()); } function ensurePrefix(s, prefix) { return s.startsWith(prefix) ? s : prefix + s; } function ensureSuffix(s, suffix) { return s.endsWith(suffix) ? s : s + suffix; } var key2 = 0; function genStringKey() { return `generated-key-${key2++}`; } function kebabCase(s) { const ret = s.replace(/([A-Z])/g, " $1").trim(); return ret.split(" ").join("-").toLowerCase(); } function pascalCase(s) { return camelize(s).replace(s.charAt(0), s.charAt(0).toUpperCase()); } function lowerFirst(s) { return s.charAt(0).toLowerCase() + s.slice(1); } function upperFirst(s) { return s.charAt(0).toUpperCase() + s.slice(1); } function randomColor() { const letters = "0123456789abcdef"; let color = "#"; for (let i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; } function randomString(length = 10) { let str = baseRandomString(); while (str.length < length) { str += baseRandomString(); } function baseRandomString() { return Math.random().toString(36).slice(2); } return str.slice(0, length); } function slash(path) { const isExtendedLengthPath = path.startsWith("\\\\?\\"); if (isExtendedLengthPath) { return path; } return path.replace(/\\/g, "/"); } function createNamespaceFn(namespace) { return (name2) => { const componentName = `${namespace}-${name2}`; const createBEM = (suffix) => { if (!suffix) { return componentName; } if (suffix[0] === "$") { return suffix.replace("$", namespace); } return suffix.startsWith("--") ? `${componentName}${suffix}` : `${componentName}__${suffix}`; }; return { name: pascalCase(componentName), n: createBEM, classes: classes$1d }; }; } function requestAnimationFrame$1(fn2) { const globalThis2 = getGlobalThis(); return globalThis2.requestAnimationFrame ? globalThis2.requestAnimationFrame(fn2) : globalThis2.setTimeout(fn2); } function doubleRaf() { return new Promise((resolve) => { requestAnimationFrame$1(() => { requestAnimationFrame$1(resolve); }); }); } function getStyle$1(element) { return window.getComputedStyle(element); } function getParentScroller$1(el) { let element = el; while (element) { if (!element.parentNode) { break; } element = element.parentNode; if (element === document.body || element === document.documentElement) { break; } const scrollRE = /(scroll|auto)/; const { overflowY, overflow } = getStyle$1(element); if (scrollRE.test(overflowY) || scrollRE.test(overflow)) { return element; } } return window; } function getAllParentScroller$1(el) { const allParentScroller = []; let element = el; while (!isWindow(element)) { element = getParentScroller$1(element); allParentScroller.push(element); } return allParentScroller; } function getRect(element) { if (isWindow(element)) { const width = element.innerWidth; const height = element.innerHeight; const rect = { x: 0, y: 0, top: 0, left: 0, right: width, bottom: height, width, height }; return __spreadProps$e(__spreadValues$B({}, rect), { toJSON: () => rect }); } return element.getBoundingClientRect(); } function getScrollLeft(element) { const left2 = "scrollLeft" in element ? element.scrollLeft : element.scrollX; return Math.max(left2, 0); } function getScrollTop(element) { const top2 = "scrollTop" in element ? element.scrollTop : element.scrollY; return Math.max(top2, 0); } function inViewport(element) { const { top: top2, bottom: bottom2, left: left2, right: right2 } = getRect(element); const { width, height } = getRect(window); const xInViewport = left2 <= width && right2 >= 0; const yInViewport = top2 <= height && bottom2 >= 0; return xInViewport && yInViewport; } function prettyJSONObject(jsonObject) { return JSON.stringify(jsonObject, null, 2); } function preventDefault(event) { if (event.cancelable === false) { return; } event.preventDefault(); } function raf() { return new Promise((resolve) => { requestAnimationFrame$1(resolve); }); } function createStorage(storage) { return __spreadProps$e(__spreadValues$B({}, storage), { set(key3, value) { if (value == null) { return; } if (!isString(value)) { value = JSON.stringify(value); } storage.setItem(key3, value); }, get(key3) { const data = storage.getItem(key3); try { return JSON.parse(data); } catch (err) { return data; } }, remove(key3) { storage.removeItem(key3); } }); } var sessionStorage = createStorage(getGlobalThis().sessionStorage); var localStorage = createStorage(getGlobalThis().localStorage); function tryParseJSON(json) { try { return JSON.parse(json); } catch (e) { return void 0; } } function download(val, filename = "file") { const a = document.createElement("a"); a.style.display = "none"; a.href = isString(val) ? val : URL.createObjectURL(val); a.download = filename; document.body.appendChild(a); a.click(); URL.revokeObjectURL(a.href); document.body.removeChild(a); } function motion(options) { const { from, to, duration = 300, frame = () => { }, timingFunction = (value2) => value2, onStateChange = () => { } } = options; let state = "pending"; let value = from; const distance = to - from; let ticker = void 0; let startTime = void 0; let pausedTime = void 0; let sleepTime = 0; function start2() { if (state === "running" || state === "finished") { return; } setState("running"); const now = performance.now(); startTime = startTime != null ? startTime : now; sleepTime += pausedTime != null ? now - pausedTime : 0; pausedTime = void 0; tick2(); function tick2() { ticker = requestAnimationFrame$1(() => { const now2 = performance.now(); const executionTime = now2 - startTime - sleepTime; const progress = clamp$1(executionTime / duration, 0, 1); value = distance * timingFunction(progress) + from; if (progress >= 1) { setState("finished"); frame({ value: to, done: true }); return; } frame({ value, done: false }); tick2(); }); } } function pause() { if (state !== "running") { return; } cancelAnimationFrame(ticker); setState("paused"); pausedTime = performance.now(); } function reset() { cancelAnimationFrame(ticker); setState("pending"); value = from; ticker = void 0; startTime = void 0; pausedTime = void 0; sleepTime = 0; } function getState() { return state; } function setState(_state) { state = _state; onStateChange(_state); } return { start: start2, pause, reset, getState }; } __reExport(util_exports, mitt_star); __reExport(src_exports, util_exports); function call(fn2, ...args) { if (isArray(fn2)) { return fn2.map((f) => f(...args)); } if (fn2) { return fn2(...args); } } function once(fn2) { let called = false; let result; return function(...args) { if (called) { return result; } called = true; result = fn2.apply(this, args); return result; }; } function debounce$1(fn2, delay2 = 0) { let timer; return function(...args) { if (timer) { clearTimeout(timer); } timer = setTimeout(() => { fn2.apply(this, args); }, delay2); }; } function throttle(fn2, delay2 = 200) { let timer; let start2 = 0; return function loop(...args) { const now = performance.now(); const elapsed = now - start2; if (!start2) { start2 = now; } if (timer) { clearTimeout(timer); } if (elapsed >= delay2) { fn2.apply(this, args); start2 = now; } else { timer = setTimeout(() => { loop.apply(this, args); }, delay2 - elapsed); } }; } function NOOP() { } function cloneDeepWith(value, fn2) { const cache = /* @__PURE__ */ new WeakMap(); function baseCloneDeep(value2, cache2) { const customResult = fn2(value2); if (customResult !== void 0) { return customResult; } if (!isObject(value2)) { return value2; } if (cache2.has(value2)) { return cache2.get(value2); } if (isDate(value2)) { return new Date(value2); } if (isRegExp(value2)) { return new RegExp(value2); } if (isMap(value2)) { const result = /* @__PURE__ */ new Map(); cache2.set(value2, result); value2.forEach((val, key3) => { result.set(baseCloneDeep(key3, cache2), baseCloneDeep(val, cache2)); }); return result; } if (isSet(value2)) { const result = /* @__PURE__ */ new Set(); cache2.set(value2, result); value2.forEach((val) => { result.add(baseCloneDeep(val, cache2)); }); return result; } if (toRawType(value2) === "String" || toRawType(value2) === "Number" || toRawType(value2) === "Boolean") { return newConstructor(value2, value2.valueOf()); } if (isWeakMap(value2) || isWeakSet(value2) || isError(value2) || isDOMException(value2)) { return {}; } if (isTypedArray(value2)) { return newConstructor(value2, baseCloneArrayBuffer(value2.buffer), value2.byteOffset, value2.length); } if (isDataView(value2)) { return newConstructor(value2, baseCloneArrayBuffer(value2.buffer), value2.byteOffset, value2.byteLength); } if (isArrayBuffer(value2)) { return baseCloneArrayBuffer(value2); } if (isArray(value2)) { const result = []; cache2.set(value2, result); value2.forEach((value3, index) => { result[index] = baseCloneDeep(value3, cache2); }); return result; } if (isPlainObject(value2)) { const result = Object.create(Reflect.getPrototypeOf(value2)); cache2.set(value2, result); const ownKeys = [...Object.keys(value2), ...Object.getOwnPropertySymbols(value2)]; ownKeys.forEach((key3) => { result[key3] = baseCloneDeep(value2[key3], cache2); }); return result; } return value2; } function baseCloneArrayBuffer(value2) { const result = new ArrayBuffer(value2.byteLength); new Uint8Array(result).set(new Uint8Array(value2)); return result; } function newConstructor(value2, ...args) { return new value2.constructor(...args); } return baseCloneDeep(value, cache); } function cloneDeep(value) { return cloneDeepWith(value, () => void 0); } function mergeWith(object, ...sources) { const fn2 = at(sources, -1); const targets = [object, ...sources.slice(0, -1)]; let len = targets.length - 1; let result = targets[len]; while (len) { result = baseMergeWith(targets[len - 1], result, fn2); len--; } function baseMergeWith(object2, source, fn22) { function baseMerge(target, src) { for (const key3 in src) { if (hasOwn(src, key3)) { const srcValue = src[key3]; const targetValue = target[key3]; const customResult = fn22(targetValue, srcValue, key3, object2, source); if (customResult !== void 0) { target[key3] = customResult; } else if (isObject(srcValue)) { if (isObject(targetValue)) { target[key3] = baseMerge(targetValue, srcValue); } else { target[key3] = baseMerge(isArray(srcValue) ? [] : {}, srcValue); } } else { target[key3] = srcValue; } } } return target; } return baseMerge(object2, source); } return result; } function merge$1(object, ...sources) { return mergeWith(object, ...sources, () => void 0); } function toArrayBuffer(file) { return new Promise((resolve) => { const fileReader = new FileReader(); fileReader.onload = () => { resolve(fileReader.result); }; fileReader.readAsArrayBuffer(file); }); } function toDataURL(file) { return new Promise((resolve) => { const fileReader = new FileReader(); fileReader.onload = () => { resolve(fileReader.result); }; fileReader.readAsDataURL(file); }); } function toText(file) { return new Promise((resolve) => { const fileReader = new FileReader(); fileReader.onload = () => { resolve(fileReader.result); }; fileReader.readAsText(file); }); } function maxBy(arr, fn2) { if (!arr.length) { return; } return arr.reduce((result, item) => fn2(result) > fn2(item) ? result : item, arr[0]); } function minBy(arr, fn2) { if (!arr.length) { return; } return arr.reduce((result, item) => fn2(result) < fn2(item) ? result : item, arr[0]); } function sum$1(arr) { return arr.reduce((ret, val) => ret + val, 0); } function sumBy(arr, fn2) { return arr.reduce((ret, val) => ret + fn2(val), 0); } function sumHash(value) { function sum2(hash2, value2) { for (let i = 0; i < value2.length; i++) { const chr = value2.charCodeAt(i); hash2 = (hash2 << 5) - hash2 + chr; hash2 |= 0; } return hash2 < 0 ? hash2 * -2 : hash2; } function baseSumHash(hash2, value2, key3, seen) { hash2 = sum2(hash2, key3); hash2 = sum2(hash2, toTypeString(value2)); hash2 = sum2(hash2, typeof value2); if (value2 === null) { return sum2(hash2, "null"); } if (value2 === void 0) { return sum2(hash2, "undefined"); } if (isObject(value2) || isFunction(value2)) { if (seen.includes(value2)) { return sum2(hash2, `[Circular]${key3}`); } seen.push(value2); hash2 = Object.keys(value2).sort().reduce((hash22, key4) => baseSumHash(hash22, value2[key4], key4, seen), hash2); if (isFunction(value2.valueOf)) { return sum2(hash2, String(value2.valueOf())); } return hash2; } return sum2(hash2, value2.toString()); } return baseSumHash(0, value, "", []).toString(16).padStart(8, "0"); } function mean(arr) { return sum$1(arr) / arr.length; } function meanBy(arr, fn2) { return sumBy(arr, fn2) / arr.length; } function sample(arr) { if (!arr.length) { return; } return arr[randomNumber(0, arr.length - 1)]; } function round$2(val, precision = 0) { return baseRound(val, precision, Math.round); } function baseRound(val, precision = 0, fn2) { precision = clamp$1(precision, -292, 292); if (!precision) { return fn2(val); } const value = fn2(`${val}e${precision}`); return +`${value}e${-precision}`; } function floor$1(val, precision = 0) { return baseRound(val, precision, Math.floor); } function ceil$1(val, precision = 0) { return baseRound(val, precision, Math.ceil); } function assert(condition, source, message) { return assert$1(condition, `Varlet [${source}]: ${message}`); } function warn(source, message) { console.warn(`Varlet [${source}]: ${message}`); } function error$1(source, message) { console.error(`Varlet [${source}]: ${message}`); } var isURL = (val) => { if (!val) { return false; } return /^(http)|(\.*\/)/.test(val); }; var __defProp$A = Object.defineProperty; var __getOwnPropSymbols$A = Object.getOwnPropertySymbols; var __hasOwnProp$A = Object.prototype.hasOwnProperty; var __propIsEnum$A = Object.prototype.propertyIsEnumerable; var __defNormalProp$A = (obj, key3, value) => key3 in obj ? __defProp$A(obj, key3, { enumerable: true, configurable: true, writable: true, value }) : obj[key3] = value; var __spreadValues$A = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$A.call(b, prop)) __defNormalProp$A(a, prop, b[prop]); if (__getOwnPropSymbols$A) for (var prop of __getOwnPropSymbols$A(b)) { if (__propIsEnum$A.call(b, prop)) __defNormalProp$A(a, prop, b[prop]); } return a; }; var __objRest = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$A) for (var prop of __getOwnPropSymbols$A(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop)) target[prop] = source[prop]; } return target; }; function onSmartMounted(hook) { let isMounted = false; vue.onMounted(() => { hook(); vue.nextTick(() => { isMounted = true; }); }); vue.onActivated(() => { if (!isMounted) { return; } hook(); }); } function useEventListener(target, type, listener, options = {}) { if (!inBrowser()) { return; } const { passive: passive2 = false, capture = false } = options; let listening = false; let cleaned = false; const getElement = (target2) => isFunction(target2) ? target2() : vue.unref(target2); const add2 = (target2) => { if (listening || cleaned) { return; } const element = getElement(target2); if (element) { element.addEventListener(type, listener, { passive: passive2, capture }); listening = true; } }; const remove = (target2) => { if (!listening || cleaned) { return; } const element = getElement(target2); if (element) { element.removeEventListener(type, listener, { capture }); listening = false; } }; let watchStopHandle; if (vue.isRef(target)) { watchStopHandle = vue.watch( () => target.value, (newValue, oldValue) => { remove(oldValue); add2(newValue); } ); } const cleanup = () => { watchStopHandle == null ? void 0 : watchStopHandle(); remove(target); cleaned = true; }; onSmartMounted(() => { add2(target); }); vue.onBeforeUnmount(() => { remove(target); }); vue.onDeactivated(() => { remove(target); }); return cleanup; } function useClickOutside(target, type, listener) { if (!inBrowser()) { return; } const handler = (event) => { const element = isFunction(target) ? target() : vue.unref(target); if (element && !element.contains(event.target)) { listener(event); } }; useEventListener(document, type, handler); } function onSmartUnmounted(hook) { let keepalive = false; vue.onDeactivated(() => { keepalive = true; hook(); }); vue.onUnmounted(() => { if (keepalive) { return; } hook(); }); } function keyInProvides(key3) { const instance = vue.getCurrentInstance(); return key3 in instance.provides; } function useParent(key3) { if (!keyInProvides(key3)) { return { index: null, parentProvider: null, bindParent: null }; } const provider = vue.inject(key3); const _a = provider, { childInstances, collect, clear: clear2 } = _a, parentProvider = __objRest(_a, ["childInstances", "collect", "clear"]); const childInstance = vue.getCurrentInstance(); const index = vue.computed(() => childInstances.indexOf(childInstance)); const bindParent = (childProvider) => { vue.onMounted(() => { vue.nextTick().then(() => { collect(childInstance, childProvider); }); }); vue.onBeforeUnmount(() => { vue.nextTick().then(() => { clear2(childInstance, childProvider); }); }); }; return { index, parentProvider, bindParent }; } function flatVNodes(subTree) { const vNodes = []; const flat = (subTree2) => { if (subTree2 == null ? void 0 : subTree2.component) { flat(subTree2 == null ? void 0 : subTree2.component.subTree); return; } if (isArray(subTree2 == null ? void 0 : subTree2.children)) { subTree2.children.forEach((child) => { if (vue.isVNode(child)) { vNodes.push(child); flat(child); } }); } }; flat(subTree); return vNodes; } function useChildren(key3) { const parentInstance = vue.getCurrentInstance(); const childInstances = vue.reactive([]); const childProviders = []; const length = vue.computed(() => childInstances.length); const sortInstances = () => { const vNodes = flatVNodes(parentInstance.subTree); childInstances.sort((a, b) => vNodes.indexOf(a.vnode) - vNodes.indexOf(b.vnode)); }; const collect = (childInstance, childProvider) => { childInstances.push(childInstance); childProviders.push(childProvider); sortInstances(); }; const clear2 = (childInstance, childProvider) => { removeItem(childInstances, childInstance); removeItem(childProviders, childProvider); }; const bindChildren = (parentProvider) => { vue.provide(key3, __spreadValues$A({ childInstances, collect, clear: clear2 }, parentProvider)); }; return { length, childProviders, bindChildren }; } function onWindowResize(listener) { useEventListener(() => window, "resize", listener, { passive: true }); useEventListener(() => window, "orientationchange", listener, { passive: true }); } function useInitialized(source, value) { const initialized = vue.ref(false); vue.watch( source, (newValue) => { if (value === newValue) { initialized.value = true; } }, { immediate: true } ); return initialized; } function getDirection(x, y) { if (x > y) { return "horizontal"; } if (y > x) { return "vertical"; } } function useTouch() { const startX = vue.ref(0); const startY = vue.ref(0); const deltaX = vue.ref(0); const deltaY = vue.ref(0); const offsetX = vue.ref(0); const offsetY = vue.ref(0); const prevX = vue.ref(0); const prevY = vue.ref(0); const moveX = vue.ref(0); const moveY = vue.ref(0); const direction = vue.ref(); const touching = vue.ref(false); const dragging = vue.ref(false); const startTime = vue.ref(0); const distance = vue.ref(0); let draggingAnimationFrame = null; const resetTouch = () => { startX.value = 0; startY.value = 0; deltaX.value = 0; deltaY.value = 0; offsetX.value = 0; offsetY.value = 0; prevX.value = 0; prevY.value = 0; moveX.value = 0; moveY.value = 0; direction.value = void 0; touching.value = false; dragging.value = false; startTime.value = 0; distance.value = 0; }; const startTouch = (event) => { resetTouch(); const { clientX: x, clientY: y } = event.touches[0]; startX.value = x; startY.value = y; prevX.value = x; prevY.value = y; touching.value = true; startTime.value = performance.now(); dragging.value = false; if (draggingAnimationFrame) { window.cancelAnimationFrame(draggingAnimationFrame); } }; const moveTouch = (event) => { const { clientX: x, clientY: y } = event.touches[0]; dragging.value = true; deltaX.value = x - startX.value; deltaY.value = y - startY.value; offsetX.value = Math.abs(deltaX.value); offsetY.value = Math.abs(deltaY.value); distance.value = Math.sqrt(offsetX.value ** 2 + offsetY.value ** 2); moveX.value = x - prevX.value; moveY.value = y - prevY.value; if (!direction.value) { direction.value = getDirection(offsetX.value, offsetY.value); } prevX.value = x; prevY.value = y; }; const endTouch = () => { touching.value = false; draggingAnimationFrame = window.requestAnimationFrame(() => { dragging.value = false; }); }; const isReachTop = (element) => { const scrollTop = getScrollTop(element); return scrollTop === 0 && deltaY.value > 0; }; const isReachBottom = (element, offset2 = 1) => { const { scrollHeight, clientHeight, scrollTop } = element; const offsetBottom = Math.abs(scrollHeight - scrollTop - clientHeight); return deltaY.value < 0 && offsetBottom <= offset2; }; return { startX, startY, deltaX, deltaY, offsetX, offsetY, prevX, prevY, moveX, moveY, direction, touching, dragging, startTime, distance, resetTouch, startTouch, moveTouch, endTouch, isReachTop, isReachBottom }; } function useClientId() { const instance = vue.getCurrentInstance(); const name2 = kebabCase(instance.type.name); const id = vue.ref(process.env.NODE_ENV === "test" ? `${name2}-mock-id` : void 0); vue.onMounted(() => { if (process.env.NODE_ENV !== "test") { id.value = `${name2}-${instance.uid}`; } }); return id; } function useWindowSize(options = {}) { const { initialWidth = 0, initialHeight = 0 } = options; const width = vue.ref(initialWidth); const height = vue.ref(initialHeight); const update = () => { if (!inBrowser()) { return; } width.value = window.innerWidth; height.value = window.innerHeight; }; onSmartMounted(update); onWindowResize(update); return { width, height }; } function useVModel(props2, key3, options = {}) { const { passive: passive2 = true, eventName, defaultValue, emit } = options; const event = eventName != null ? eventName : `onUpdate:${key3.toString()}`; const getValue = () => { var _a; return (_a = props2[key3]) != null ? _a : defaultValue; }; if (!passive2) { return vue.computed({ get() { return getValue(); }, set(value) { emit ? emit(event, value) : call(props2[event], value); } }); } const proxy = vue.ref(getValue()); let shouldEmit = true; vue.watch( () => props2[key3], () => { shouldEmit = false; proxy.value = getValue(); vue.nextTick(() => { shouldEmit = true; }); } ); vue.watch( () => proxy.value, (newValue) => { if (!shouldEmit) { return; } emit ? emit(event, newValue) : call(props2[event], newValue); } ); return proxy; } function useMotion(options) { const value = vue.ref(getter(options.from)); const state = vue.ref("pending"); let ctx2 = createMotionContext(); function getter(value2) { return isFunction(value2) ? value2() : value2; } function reset() { ctx2.reset(); value.value = getter(options.from); state.value = "pending"; ctx2 = createMotionContext(); } function start2() { ctx2.start(); } function pause() { ctx2.pause(); } function createMotionContext() { return motion({ from: getter(options.from), to: getter(options.to), duration: options.duration ? getter(options.duration) : 300, timingFunction: options.timingFunction, onStateChange(newState) { state.value = newState; }, frame({ value: newValue, done }) { var _a; value.value = newValue; if (done) { (_a = options.onFinished) == null ? void 0 : _a.call(options, value.value); } } }); } return { value, state, start: start2, pause, reset }; } var __defProp$z = Object.defineProperty; var __defProps$d = Object.defineProperties; var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$z = Object.getOwnPropertySymbols; var __hasOwnProp$z = Object.prototype.hasOwnProperty; var __propIsEnum$z = Object.prototype.propertyIsEnumerable; var __defNormalProp$z = (obj, key3, value) => key3 in obj ? __defProp$z(obj, key3, { enumerable: true, configurable: true, writable: true, value }) : obj[key3] = value; var __spreadValues$z = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$z.call(b, prop)) __defNormalProp$z(a, prop, b[prop]); if (__getOwnPropSymbols$z) for (var prop of __getOwnPropSymbols$z(b)) { if (__propIsEnum$z.call(b, prop)) __defNormalProp$z(a, prop, b[prop]); } return a; }; var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b)); var __async$l = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; function pickProps(props2, propsKey) { return isArray(propsKey) ? propsKey.reduce((pickedProps, key3) => { pickedProps[key3] = props2[key3]; return pickedProps; }, {}) : props2[propsKey]; } function withInstall(component, target) { const componentWithInstall = target != null ? target : component; componentWithInstall.install = function(app) { const { name: name2 } = component; if (name2) { app.component(name2, component); } }; return componentWithInstall; } function withPropsDefaultsSetter(target, props2) { target.setPropsDefaults = function(defaults) { Object.entries(defaults).forEach(([key3, value]) => { const prop = props2[key3]; if (prop == null) { return; }