UNPKG

vue3-icon-picker

Version:
1,413 lines 90.7 kB
import { ref, defineComponent, useCssVars, unref, computed, onUnmounted, watch, openBlock, createElementBlock, onMounted, nextTick, getCurrentScope, onScopeDispose, getCurrentInstance, shallowRef, toValue, pushScopeId, popScopeId, createBlock, withScopeId, markRaw, shallowReactive, resolveComponent, resolveDirective, withDirectives, normalizeClass, renderSlot, createCommentVNode, resolveDynamicComponent, normalizeStyle, withCtx, Fragment, renderList, mergeProps, toHandlers, createVNode, useTemplateRef, useSlots, createElementVNode, withModifiers, toDisplayString, Transition, isRef, vModelText, vShow } from "vue"; const cache = /* @__PURE__ */ new Map(); const MAX_CACHE_SIZE = 500; function getIconFromCache(iconId) { return cache.get(iconId); } function setIconInCache(iconId, svg) { if (cache.size >= MAX_CACHE_SIZE) { const firstKey = cache.keys().next().value; if (firstKey) cache.delete(firstKey); } cache.set(iconId, svg); } const PACKAGE_BASE_URL = "https://raw.githubusercontent.com/noeGnh/vue3-icon-picker/master/packages/vue3-icon-picker"; const ICONS_LIST_URL = `${PACKAGE_BASE_URL}/icons-list.json`; const ICONS_ASSETS_URL = `${PACKAGE_BASE_URL}/src/assets/sicons`; const ICONS_STORAGE_KEY = "v3ip-icons-list"; function useIconsLoader() { const iconsList = ref([]); const extractIconData = (key) => { const parts = key.split("_"); const realLibNames = { a: "antd", b: "carbon", fa: "fa", f: "fluent", i4: "ionicons4", i5: "ionicons5", m: "material", t: "tabler" }; const realIconFormats = { F1: "Filled", O1: "Outlined", O2: "Outline", R1: "Round", S1: "Sharp", T1: "Twotone", R2: "Regular" }; function restoreIconFormat(filename) { return filename.replace(/(F1|O1|O2|R1|S1|T1|R2)(?=$|\.)/, (match) => { return realIconFormats[match] || match; }); } return [ restoreIconFormat(parts.length > 1 ? parts[1] : parts[0]), parts.length > 1 && parts[0] ? realLibNames[parts[0]] : "" ]; }; const oneMoment = () => { return new Promise((resolve) => setTimeout(resolve)); }; const prepareData = async () => { let iconsRawList = []; try { iconsRawList = JSON.parse(localStorage.getItem(ICONS_STORAGE_KEY) || "[]"); if (!iconsRawList || iconsRawList.length === 0) { const response = await fetch(ICONS_LIST_URL); iconsRawList = await response.json(); localStorage.setItem(ICONS_STORAGE_KEY, JSON.stringify(iconsRawList)); } } catch (error) { } let i = 1; for (const value of iconsRawList) { if (i && i % 5e3 === 0) { await oneMoment(); } const [name, library] = extractIconData(value); if (name && library) { iconsList.value.push({ id: i, name, svgUrl: `${ICONS_ASSETS_URL}/${library}/${name}.svg`, library }); i += 1; } } return iconsList.value; }; return { iconsList, prepareData }; } function isSVG(input) { var _a; const svgRegex = /^\s*<svg\b[^>]*>.*<\/svg>\s*$/is; try { if (svgRegex.test(input)) { const parser = new DOMParser(); const doc = parser.parseFromString(input, "image/svg+xml"); const parserErrors = doc.getElementsByTagName("parsererror"); if (parserErrors.length > 0) { return false; } const svgElements = doc.getElementsByTagName("svg"); return svgElements.length > 0 && ((_a = svgElements[0]) == null ? void 0 : _a.parentNode) === doc; } return false; } catch (e) { return false; } } function isURL(string) { var protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/; var localhostDomainRE = /^localhost[:?\d]*(?:[^:?\d]\S*)?$/; var nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/; if (typeof string !== "string") { return false; } var match = string.match(protocolAndDomainRE); if (!match) { return false; } var everythingAfterProtocol = match[1]; if (!everythingAfterProtocol) { return false; } if (localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol)) { return true; } return false; } const _hoisted_1$3 = ["innerHTML"]; const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "Icon", props: { data: {}, color: { default: void 0 }, size: { default: 24 } }, setup(__props) { useCssVars((_ctx) => ({ "v61b31d17": unref(size), "v585cd5e6": unref(color) })); const props2 = __props; const { prepareData } = useIconsLoader(); const color = computed(() => props2.color); const size = computed( () => typeof props2.size == "number" ? props2.size + "px" : props2.size || "unset" ); const svgCode = ref(); const isLoading = ref(false); var abortController = null; const fetchData = async (url) => { if (abortController) { abortController.abort(); } const filename = url.split("/").pop(); const name = (filename == null ? void 0 : filename.split(".").slice(0, -1).join(".")) || "icon"; const cached = getIconFromCache(name); if (cached) { svgCode.value = cached; return; } if (isLoading.value || !url) return; isLoading.value = true; abortController = new AbortController(); try { const response = await fetch(url, { signal: abortController.signal }); const svg = await response.text(); setIconInCache(name, svg); svgCode.value = svg; } catch (error) { if (error.name !== "AbortError") { console.error(`Failed to load icon ${name}`, error); svgCode.value = `<svg viewBox="0 0 24 24"><rect width="24" height="24" fill="#eee"/></svg>`; } } finally { isLoading.value = false; abortController = null; } }; onUnmounted(() => { if (abortController) { abortController.abort(); } }); watch( () => props2.data, async (val) => { var _a; if (isURL(val)) { fetchData(val); } else if (isSVG(val)) { svgCode.value = val; } else { const iconsList = await prepareData(); const url = ((_a = iconsList == null ? void 0 : iconsList.find((icon) => icon.name == val)) == null ? void 0 : _a.svgUrl) || ""; fetchData(url); } }, { immediate: true } ); return (_ctx, _cache) => { return openBlock(), createElementBlock("i", { innerHTML: unref(svgCode) }, null, 8, _hoisted_1$3); }; } }); const _export_sfc = (sfc, props2) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props2) { target[key] = val; } return target; }; const ItemIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-fb1b354e"]]); function tryOnScopeDispose(fn, failSilently) { if (getCurrentScope()) { onScopeDispose(fn, failSilently); return true; } return false; } const isClient = typeof window !== "undefined" && typeof document !== "undefined"; typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope; const toString = Object.prototype.toString; const isObject = (val) => toString.call(val) === "[object Object]"; const noop = () => { }; function toArray(value) { return Array.isArray(value) ? value : [value]; } function getLifeCycleTarget(target) { return getCurrentInstance(); } function tryOnMounted(fn, sync = true, target) { if (getLifeCycleTarget()) onMounted(fn, target); else if (sync) fn(); else nextTick(fn); } function watchImmediate(source, cb, options) { return watch(source, cb, { ...options, immediate: true }); } const defaultWindow = isClient ? window : void 0; function unrefElement(elRef) { var _$el; const plain = toValue(elRef); return (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain; } function useEventListener(...args) { const register = (el, event, listener, options) => { el.addEventListener(event, listener, options); return () => el.removeEventListener(event, listener, options); }; const firstParamTargets = computed(() => { const test = toArray(toValue(args[0])).filter((e) => e != null); return test.every((e) => typeof e !== "string") ? test : void 0; }); return watchImmediate(() => { var _firstParamTargets$va, _firstParamTargets$va2; return [ (_firstParamTargets$va = (_firstParamTargets$va2 = firstParamTargets.value) === null || _firstParamTargets$va2 === void 0 ? void 0 : _firstParamTargets$va2.map((e) => unrefElement(e))) !== null && _firstParamTargets$va !== void 0 ? _firstParamTargets$va : [defaultWindow].filter((e) => e != null), toArray(toValue(firstParamTargets.value ? args[1] : args[0])), toArray(unref(firstParamTargets.value ? args[2] : args[1])), toValue(firstParamTargets.value ? args[3] : args[2]) ]; }, ([raw_targets, raw_events, raw_listeners, raw_options], _, onCleanup) => { if (!(raw_targets === null || raw_targets === void 0 ? void 0 : raw_targets.length) || !(raw_events === null || raw_events === void 0 ? void 0 : raw_events.length) || !(raw_listeners === null || raw_listeners === void 0 ? void 0 : raw_listeners.length)) return; const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options; const cleanups = raw_targets.flatMap((el) => raw_events.flatMap((event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone)))); onCleanup(() => { cleanups.forEach((fn) => fn()); }); }, { flush: "post" }); } function onClickOutside(target, handler, options = {}) { const { window: window$1 = defaultWindow, ignore = [], capture = true, detectIframe = false, controls = false } = options; if (!window$1) return controls ? { stop: noop, cancel: noop, trigger: noop } : noop; let shouldListen = true; const shouldIgnore = (event) => { return toValue(ignore).some((target$1) => { if (typeof target$1 === "string") return Array.from(window$1.document.querySelectorAll(target$1)).some((el) => el === event.target || event.composedPath().includes(el)); else { const el = unrefElement(target$1); return el && (event.target === el || event.composedPath().includes(el)); } }); }; function hasMultipleRoots(target$1) { const vm = toValue(target$1); return vm && vm.$.subTree.shapeFlag === 16; } function checkMultipleRoots(target$1, event) { const vm = toValue(target$1); const children = vm.$.subTree && vm.$.subTree.children; if (children == null || !Array.isArray(children)) return false; return children.some((child) => child.el === event.target || event.composedPath().includes(child.el)); } const listener = (event) => { const el = unrefElement(target); if (event.target == null) return; if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event)) return; if (!el || el === event.target || event.composedPath().includes(el)) return; if ("detail" in event && event.detail === 0) shouldListen = !shouldIgnore(event); if (!shouldListen) { shouldListen = true; return; } handler(event); }; let isProcessingClick = false; const cleanup = [ useEventListener(window$1, "click", (event) => { if (!isProcessingClick) { isProcessingClick = true; setTimeout(() => { isProcessingClick = false; }, 0); listener(event); } }, { passive: true, capture }), useEventListener(window$1, "pointerdown", (e) => { const el = unrefElement(target); shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el)); }, { passive: true }), detectIframe && useEventListener(window$1, "blur", (event) => { setTimeout(() => { var _window$document$acti; const el = unrefElement(target); if (((_window$document$acti = window$1.document.activeElement) === null || _window$document$acti === void 0 ? void 0 : _window$document$acti.tagName) === "IFRAME" && !(el === null || el === void 0 ? void 0 : el.contains(window$1.document.activeElement))) handler(event); }, 0); }, { passive: true }) ].filter(Boolean); const stop = () => cleanup.forEach((fn) => fn()); if (controls) return { stop, cancel: () => { shouldListen = false; }, trigger: (event) => { shouldListen = true; listener(event); shouldListen = false; } }; return stop; } // @__NO_SIDE_EFFECTS__ function useMounted() { const isMounted = shallowRef(false); const instance = getCurrentInstance(); if (instance) onMounted(() => { isMounted.value = true; }, instance); return isMounted; } // @__NO_SIDE_EFFECTS__ function useSupported(callback) { const isMounted = /* @__PURE__ */ useMounted(); return computed(() => { isMounted.value; return Boolean(callback()); }); } function useResizeObserver(target, callback, options = {}) { const { window: window$1 = defaultWindow, ...observerOptions } = options; let observer; const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "ResizeObserver" in window$1); const cleanup = () => { if (observer) { observer.disconnect(); observer = void 0; } }; const stopWatch = watch(computed(() => { const _targets = toValue(target); return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)]; }), (els) => { cleanup(); if (isSupported.value && window$1) { observer = new ResizeObserver(callback); for (const _el of els) if (_el) observer.observe(_el, observerOptions); } }, { immediate: true, flush: "post" }); const stop = () => { cleanup(); stopWatch(); }; tryOnScopeDispose(stop); return { isSupported, stop }; } function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) { const { window: window$1 = defaultWindow, box = "content-box" } = options; const isSVG2 = computed(() => { var _unrefElement; return (_unrefElement = unrefElement(target)) === null || _unrefElement === void 0 || (_unrefElement = _unrefElement.namespaceURI) === null || _unrefElement === void 0 ? void 0 : _unrefElement.includes("svg"); }); const width = shallowRef(initialSize.width); const height = shallowRef(initialSize.height); const { stop: stop1 } = useResizeObserver(target, ([entry]) => { const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize; if (window$1 && isSVG2.value) { const $elem = unrefElement(target); if ($elem) { const rect = $elem.getBoundingClientRect(); width.value = rect.width; height.value = rect.height; } } else if (boxSize) { const formatBoxSize = toArray(boxSize); width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0); height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0); } else { width.value = entry.contentRect.width; height.value = entry.contentRect.height; } }, options); tryOnMounted(() => { const ele = unrefElement(target); if (ele) { width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width; height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height; } }); const stop2 = watch(() => unrefElement(target), (ele) => { width.value = ele ? initialSize.width : 0; height.value = ele ? initialSize.height : 0; }); function stop() { stop1(); stop2(); } return { width, height, stop }; } var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; function getDefaultExportFromCjs(x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; } var lodash_uniqby = { exports: {} }; lodash_uniqby.exports; (function(module, exports$1) { var LARGE_ARRAY_SIZE = 200; var FUNC_ERROR_TEXT = "Expected a function"; var HASH_UNDEFINED = "__lodash_hash_undefined__"; var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991; var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", promiseTag = "[object Promise]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]"; var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; var reEscapeChar = /\\(\\)?/g; var reIsHostCtor = /^\[object .+?Constructor\]$/; var reIsUint = /^(?:0|[1-9]\d*)$/; var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; var freeSelf = typeof self == "object" && self && self.Object === Object && self; var root = freeGlobal || freeSelf || Function("return this")(); var freeExports = exports$1 && !exports$1.nodeType && exports$1; var freeModule = freeExports && true && module && !module.nodeType && module; var moduleExports = freeModule && freeModule.exports === freeExports; var freeProcess = moduleExports && freeGlobal.process; var nodeUtil = function() { try { return freeProcess && freeProcess.binding("util"); } catch (e) { } }(); var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; function arrayIncludes(array, value) { var length = array ? array.length : 0; return !!length && baseIndexOf(array, value, 0) > -1; } function arraySome(array, predicate) { var index = -1, length = array ? array.length : 0; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } function baseFindIndex(array, predicate, fromIndex, fromRight) { var length = array.length, index = fromIndex + -1; while (++index < length) { if (predicate(array[index], index, array)) { return index; } } return -1; } function baseIndexOf(array, value, fromIndex) { if (value !== value) { return baseFindIndex(array, baseIsNaN, fromIndex); } var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } function baseIsNaN(value) { return value !== value; } function baseProperty(key) { return function(object) { return object == null ? void 0 : object[key]; }; } function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } function baseUnary(func) { return function(value) { return func(value); }; } function cacheHas(cache2, key) { return cache2.has(key); } function getValue(object, key) { return object == null ? void 0 : object[key]; } function isHostObject(value) { var result = false; if (value != null && typeof value.toString != "function") { try { result = !!(value + ""); } catch (e) { } } return result; } function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; var coreJsData = root["__core-js_shared__"]; var maskSrcKey = function() { var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); return uid2 ? "Symbol(src)_1." + uid2 : ""; }(); var funcToString = funcProto.toString; var hasOwnProperty = objectProto.hasOwnProperty; var objectToString = objectProto.toString; var reIsNative = RegExp( "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); var Symbol2 = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice; var nativeKeys = overArg(Object.keys, Object); var DataView = getNative(root, "DataView"), Map2 = getNative(root, "Map"), Promise2 = getNative(root, "Promise"), Set = getNative(root, "Set"), WeakMap = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create"); var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); var symbolProto = Symbol2 ? Symbol2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0; function Hash(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; } function hashDelete(key) { return this.has(key) && delete this.__data__[key]; } function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? void 0 : result; } return hasOwnProperty.call(data, key) ? data[key] : void 0; } function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key); } function hashSet(key, value) { var data = this.__data__; data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value; return this; } Hash.prototype.clear = hashClear; Hash.prototype["delete"] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; function ListCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function listCacheClear() { this.__data__ = []; } function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } return true; } function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? void 0 : data[index][1]; } function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { data.push([key, value]); } else { data[index][1] = value; } return this; } ListCache.prototype.clear = listCacheClear; ListCache.prototype["delete"] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; function MapCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function mapCacheClear() { this.__data__ = { "hash": new Hash(), "map": new (Map2 || ListCache)(), "string": new Hash() }; } function mapCacheDelete(key) { return getMapData(this, key)["delete"](key); } function mapCacheGet(key) { return getMapData(this, key).get(key); } function mapCacheHas(key) { return getMapData(this, key).has(key); } function mapCacheSet(key, value) { getMapData(this, key).set(key, value); return this; } MapCache.prototype.clear = mapCacheClear; MapCache.prototype["delete"] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; function SetCache(values) { var index = -1, length = values ? values.length : 0; this.__data__ = new MapCache(); while (++index < length) { this.add(values[index]); } } function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } function setCacheHas(value) { return this.__data__.has(value); } SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; function Stack(entries) { this.__data__ = new ListCache(entries); } function stackClear() { this.__data__ = new ListCache(); } function stackDelete(key) { return this.__data__["delete"](key); } function stackGet(key) { return this.__data__.get(key); } function stackHas(key) { return this.__data__.has(key); } function stackSet(key, value) { var cache2 = this.__data__; if (cache2 instanceof ListCache) { var pairs = cache2.__data__; if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) { pairs.push([key, value]); return this; } cache2 = this.__data__ = new MapCache(pairs); } cache2.set(key, value); return this; } Stack.prototype.clear = stackClear; Stack.prototype["delete"] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; function arrayLikeKeys(value, inherited) { var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : []; var length = result.length, skipIndexes = !!length; for (var key in value) { if (hasOwnProperty.call(value, key) && !(skipIndexes && (key == "length" || isIndex(key, length)))) { result.push(key); } } return result; } function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } function baseGet(object, path) { path = isKey(path, object) ? [path] : castPath(path); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return index && index == length ? object : void 0; } function baseGetTag(value) { return objectToString.call(value); } function baseHasIn(object, key) { return object != null && key in Object(object); } function baseIsEqual(value, other, customizer, bitmask, stack) { if (value === other) { return true; } if (value == null || other == null || !isObject2(value) && !isObjectLike(other)) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); } function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; if (!objIsArr) { objTag = getTag(object); objTag = objTag == argsTag ? objectTag : objTag; } if (!othIsArr) { othTag = getTag(other); othTag = othTag == argsTag ? objectTag : othTag; } var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; if (isSameTag && !objIsObj) { stack || (stack = new Stack()); return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); } if (!(bitmask & PARTIAL_COMPARE_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack()); return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack()); return equalObjects(object, other, equalFunc, customizer, bitmask, stack); } function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if (data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (data[2]) { if (objValue === void 0 && !(key in object)) { return false; } } else { var stack = new Stack(); var result; if (!(result === void 0 ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { return false; } } } return true; } function baseIsNative(value) { if (!isObject2(value) || isMasked(value)) { return false; } var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } function baseIteratee(value) { if (typeof value == "function") { return value; } if (value == null) { return identity; } if (typeof value == "object") { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != "constructor") { result.push(key); } } return result; } function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, void 0, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); }; } function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } function baseToString(value) { if (typeof value == "string") { return value; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ""; } var result = value + ""; return result == "0" && 1 / value == -INFINITY ? "-0" : result; } function baseUniq(array, iteratee, comparator) { var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; if (length >= LARGE_ARRAY_SIZE) { var set = iteratee ? null : createSet(array); if (set) { return setToArray(set); } isCommon = false; includes = cacheHas; seen = new SetCache(); } else { seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed2 = iteratee ? iteratee(value) : value; value = value !== 0 ? value : 0; if (isCommon && computed2 === computed2) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed2) { continue outer; } } if (iteratee) { seen.push(computed2); } result.push(value); } else if (!includes(seen, computed2, comparator)) { if (seen !== result) { seen.push(computed2); } result.push(value); } } return result; } function castPath(value) { return isArray(value) ? value : stringToPath(value); } var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop2 : function(values) { return new Set(values); }; function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } var stacked = stack.get(array); if (stacked && stack.get(other)) { return stacked == other; } var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : void 0; stack.set(array, other); stack.set(other, array); while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== void 0) { if (compared) { continue; } result = false; break; } if (seen) { if (!arraySome(other, function(othValue2, othIndex) { if (!seen.has(othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, customizer, bitmask, stack))) { return seen.add(othIndex); } })) { result = false; break; } } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { result = false; break; } } stack["delete"](array); stack["delete"](other); return result; } function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { switch (tag) { case dataViewTag: if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: return object == other + ""; case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & PARTIAL_COMPARE_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= UNORDERED_COMPARE_FLAG; stack.set(object, other); var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); stack["delete"](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } var stacked = stack.get(object); if (stacked && stack.get(other)) { return stacked == other; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) { result = false; break; } skipCtor || (skipCtor = key == "constructor"); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { result = false; } } stack["delete"](object); stack["delete"](other); return result; } function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; } function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : void 0; } var getTag = baseGetTag; if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { getTag = function(value) { var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : void 0; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } function hasPath(object, path, hasFunc) { path = isKey(path, object) ? [path] : castPath(path); var result, index = -1, length = path.length; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result) { return result; } var length = object ? object.length : 0; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); } function isKeyable(value) { var type = typeof value; return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; } function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } function isPrototype(value) { var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; return value === proto; } function isStrictComparable(value) { return value === value && !isObject2(value); } function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== void 0 || key in Object(object)); }; } var stringToPath = memoize(function(string) { string = toString2(string); var result = []; if (reLeadingDot.test(string)) { result.push(""); } string.replace(rePropName, function(match, number, quote, string2) { result.push(quote ? string2.replace(reEscapeChar, "$1") : number || match); }); return result; }); function toKey(value) { if (typeof value == "string" || isSymbol(value)) { return value; } var result = value + ""; return result == "0" && 1 / value == -INFINITY ? "-0" : result; } function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) { } try { return func + ""; } catch (e) { } } return ""; } function uniqBy2(array, iteratee) { return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : []; } function memoize(func, resolver) { if (typeof func != "function" || resolver && typeof resolver != "function") { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; if (cache2.has(key)) { return cache2.get(key); } var result = func.apply(this, args); memoized.cache = cache2.set(key, result); return result; }; memoized.cache = new (memoize.Cache || MapCache)(); return memoized; } memoize.Cache = MapCache; function eq(value, other) { return value === other || value !== value && other !== other; } function isArguments(value) { return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag); } var isArray = Array.isArray; function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } function isFunction(value) { var tag = isObject2(value) ? objectToString.call(value) : ""; return tag == funcTag || tag == genTag; } function isLength(value) { return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } function isObject2(value) { var type = typeof value; return !!value && (type == "object" || type == "function"); } function isObjectLike(value) { return !!value && typeof value == "object"; } function isSymbol(value) { return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag; } var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; function toString2(value) { return value == null ? "" : baseToString(value); } function get(object, path, defaultValue) { var result = object == null ? void 0 : baseGet(object, path); return result === void 0 ? defaultValue : result; } function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } function identity(value) { return value; } function noop2() { } function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } module.exports = uniqBy2; })(lodash_uniqby, lodash_uniqby.exports); var lodash_uniqbyExports = lodash_uniqby.exports; const uniqBy = /* @__PURE__ */ getDefaultExportFromCjs(lodash_uniqbyExports); function getInternetExplorerVersion() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0) { return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)), 10); } var trident = ua.indexOf("Trident/"); if (trident > 0) { var rv = ua.indexOf("rv:"); return parseInt(ua.substring(rv + 3, ua.indexOf(".", rv)), 10); } var edge = ua.indexOf("Edge/"); if (edge > 0) { return parseInt(ua.substring(edge + 5, ua.indexOf(".", edge)), 10); } return -1; } let isIE; function initCompat() { if (!initCompat.init) { initCompat.init = true; isIE = getInternetExplorerVersion() !== -1; } } var script = { name: "ResizeObserver", props: { emitOnMount: { type: Boolean, default: false }, ignoreWidth: { type: Boolean, default: false }, ignoreHeight: { type: Boolean, default: false } }, emits: [ "notify" ], mounted() { initCompat(); nextTick(() => { this._w = this.$el.offsetWidth; this._h = this.$el.offsetHeight; if (this.emitOnMount) { this.emitSize(); } }); const object = document.createElement("object"); this._resizeObject = object; object.setAttribute("aria-hidden", "true"); object.setAttribute("tabindex", -1); object.onload = this.addResizeHandlers; object.type = "text/html"; if (isIE) { this.$el.appendChild(object); } object.data = "about:blank"; if (!isIE) { this.$el.appendChild(object); } }, beforeUnmount() { this.removeResizeHandlers(); }, methods: { compareAndNotify() { if (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) { this._w = this.$el.offsetWidth; this._h = this.$el.offsetHeight; this.emitSize(); } }, emitSize() { this.$emit("notify", { width: this._w, height: this._h }); }, addResizeHandlers() { this._resizeObject.contentDocument.defaultView.addEventListener("resize", this.compareAndNotify); this.compareAndNotify(); }, removeResizeHandlers() { if (this._resizeObject && this._resizeObject.onload) { if (!isIE && this._resizeObject.contentDocument) { this._resizeObject.contentDocument.defaultView.removeEventListener("resize", this.compareAndNotify); } this.$el.removeChild(this._resizeObject); this._resizeObject.onload = null; this._resizeObject = null; } } } }; const _withId = /* @__PURE__ */ withScopeId("data-v-b329ee4c"); pushScopeId("data-v-b329ee4c"); const _hoisted_1$2 = { class: "resize-observer", tabindex: "-1" }; popScopeId(); const render = /* @__PURE__ */ _withId((_ctx, _cache, $props, $setup, $data, $options) => { return openBlock(), createBlock("div", _hoisted_1$2); }); script.render = render; script.__scopeId = "data-v-b329ee4c"; script.__file = "src/components/ResizeObserver.vue"; function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function(obj2