import { Fragment, KeepAlive, Suspense, computed, createBaseVNode, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderList, resolveComponent, resolveDynamicComponent, toDisplayString, unref, watch, withCtx, withDirectives } from "./runtime-core.esm-bundler-Cyv4obHQ.js"; import { useRoute, useRouter, vModelCheckbox, vModelText } from "./vue-router-BxYGFXy-.js"; import { usePayloadStore } from "./payload-BX9lTMvN.js"; import "./_plugin-vue_export-helper-DfavQbjy.js"; import { Container_default, NavBar_default, QuerySelector_default } from "./QuerySelector-iLRAQoow.js"; import { useOptionsStore } from "./options-D_MMddT_.js"; import { ModuleList_default } from "./ModuleList-ByxGSHde.js"; import { useSearchResults } from "./search-Bklj8tNk.js"; const _hoisted_1$3 = { flex: "~ gap-1" }; const _hoisted_2$3 = [ "id", "name", "checked", "value" ]; var RadioGroup_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({ __name: "RadioGroup", props: { name: {}, modelValue: {}, options: {} }, emits: ["update:modelValue"], setup(__props, { emit: __emit }) { const emit = __emit; function onChange(e) { const target = e.target; emit("update:modelValue", target.value); } return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (opt) => { return openBlock(), createElementBlock("label", { key: opt.value, flex: "~ gap-2" }, [createBaseVNode("input", { id: opt.value, name: _ctx.name, checked: _ctx.modelValue === opt.value, value: opt.value, type: "radio", onChange }, null, 40, _hoisted_2$3), createBaseVNode("div", null, toDisplayString(opt.label), 1)]); }), 128))]); }; } }); var RadioGroup_default = RadioGroup_vue_vue_type_script_setup_true_lang_default; /** * vis-data * http://visjs.org/ * * Manage unstructured data using DataSet. Add, update, and remove data, and listen for changes in the data. * * @version 8.0.1 * @date 2025-07-13T02:52:37.151Z * * @copyright (c) 2011-2017 Almende B.V, http://almende.com * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs * * @license * vis.js is dual licensed under both * * 1. The Apache 2.0 License * http://www.apache.org/licenses/LICENSE-2.0 * * and * * 2. The MIT License * http://opensource.org/licenses/MIT * * vis.js may be distributed under either license. */ var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; function getDefaultExportFromCjs$1(x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; } var defineProperty$5$1 = { exports: {} }; var es_object_defineProperty$1 = {}; var globalThis_1$1; var hasRequiredGlobalThis$1; function requireGlobalThis$1() { if (hasRequiredGlobalThis$1) return globalThis_1$1; hasRequiredGlobalThis$1 = 1; var check = function(it$1) { return it$1 && it$1.Math === Math && it$1; }; globalThis_1$1 = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof commonjsGlobal$1 == "object" && commonjsGlobal$1) || check(typeof globalThis_1$1 == "object" && globalThis_1$1) || function() { return this; }() || Function("return this")(); return globalThis_1$1; } var fails$1; var hasRequiredFails$1; function requireFails$1() { if (hasRequiredFails$1) return fails$1; hasRequiredFails$1 = 1; fails$1 = function(exec) { try { return !!exec(); } catch (error) { return true; } }; return fails$1; } var functionBindNative$1; var hasRequiredFunctionBindNative$1; function requireFunctionBindNative$1() { if (hasRequiredFunctionBindNative$1) return functionBindNative$1; hasRequiredFunctionBindNative$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); functionBindNative$1 = !fails$2(function() { var test = function() {}.bind(); return typeof test != "function" || test.hasOwnProperty("prototype"); }); return functionBindNative$1; } var functionApply$1; var hasRequiredFunctionApply$1; function requireFunctionApply$1() { if (hasRequiredFunctionApply$1) return functionApply$1; hasRequiredFunctionApply$1 = 1; var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative$1(); var FunctionPrototype = Function.prototype; var apply = FunctionPrototype.apply; var call = FunctionPrototype.call; functionApply$1 = typeof Reflect == "object" && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function() { return call.apply(apply, arguments); }); return functionApply$1; } var functionUncurryThis$1; var hasRequiredFunctionUncurryThis$1; function requireFunctionUncurryThis$1() { if (hasRequiredFunctionUncurryThis$1) return functionUncurryThis$1; hasRequiredFunctionUncurryThis$1 = 1; var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative$1(); var FunctionPrototype = Function.prototype; var call = FunctionPrototype.call; var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); functionUncurryThis$1 = NATIVE_BIND ? uncurryThisWithBind : function(fn) { return function() { return call.apply(fn, arguments); }; }; return functionUncurryThis$1; } var classofRaw$1; var hasRequiredClassofRaw$1; function requireClassofRaw$1() { if (hasRequiredClassofRaw$1) return classofRaw$1; hasRequiredClassofRaw$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var toString$2 = uncurryThis({}.toString); var stringSlice = uncurryThis("".slice); classofRaw$1 = function(it$1) { return stringSlice(toString$2(it$1), 8, -1); }; return classofRaw$1; } var functionUncurryThisClause$1; var hasRequiredFunctionUncurryThisClause$1; function requireFunctionUncurryThisClause$1() { if (hasRequiredFunctionUncurryThisClause$1) return functionUncurryThisClause$1; hasRequiredFunctionUncurryThisClause$1 = 1; var classofRaw$2 = /* @__PURE__ */ requireClassofRaw$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); functionUncurryThisClause$1 = function(fn) { if (classofRaw$2(fn) === "Function") return uncurryThis(fn); }; return functionUncurryThisClause$1; } var isCallable$1; var hasRequiredIsCallable$1; function requireIsCallable$1() { if (hasRequiredIsCallable$1) return isCallable$1; hasRequiredIsCallable$1 = 1; var documentAll = typeof document == "object" && document.all; isCallable$1 = typeof documentAll == "undefined" && documentAll !== void 0 ? function(argument) { return typeof argument == "function" || argument === documentAll; } : function(argument) { return typeof argument == "function"; }; return isCallable$1; } var objectGetOwnPropertyDescriptor$1 = {}; var descriptors$1; var hasRequiredDescriptors$1; function requireDescriptors$1() { if (hasRequiredDescriptors$1) return descriptors$1; hasRequiredDescriptors$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); descriptors$1 = !fails$2(function() { return Object.defineProperty({}, 1, { get: function() { return 7; } })[1] !== 7; }); return descriptors$1; } var functionCall$1; var hasRequiredFunctionCall$1; function requireFunctionCall$1() { if (hasRequiredFunctionCall$1) return functionCall$1; hasRequiredFunctionCall$1 = 1; var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative$1(); var call = Function.prototype.call; functionCall$1 = NATIVE_BIND ? call.bind(call) : function() { return call.apply(call, arguments); }; return functionCall$1; } var objectPropertyIsEnumerable$1 = {}; var hasRequiredObjectPropertyIsEnumerable$1; function requireObjectPropertyIsEnumerable$1() { if (hasRequiredObjectPropertyIsEnumerable$1) return objectPropertyIsEnumerable$1; hasRequiredObjectPropertyIsEnumerable$1 = 1; var $propertyIsEnumerable = {}.propertyIsEnumerable; var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor; var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1: 2 }, 1); objectPropertyIsEnumerable$1.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$4(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable; return objectPropertyIsEnumerable$1; } var createPropertyDescriptor$1; var hasRequiredCreatePropertyDescriptor$1; function requireCreatePropertyDescriptor$1() { if (hasRequiredCreatePropertyDescriptor$1) return createPropertyDescriptor$1; hasRequiredCreatePropertyDescriptor$1 = 1; createPropertyDescriptor$1 = function(bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value }; }; return createPropertyDescriptor$1; } var indexedObject$1; var hasRequiredIndexedObject$1; function requireIndexedObject$1() { if (hasRequiredIndexedObject$1) return indexedObject$1; hasRequiredIndexedObject$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var classof$2 = /* @__PURE__ */ requireClassofRaw$1(); var $Object = Object; var split = uncurryThis("".split); indexedObject$1 = fails$2(function() { return !$Object("z").propertyIsEnumerable(0); }) ? function(it$1) { return classof$2(it$1) === "String" ? split(it$1, "") : $Object(it$1); } : $Object; return indexedObject$1; } var isNullOrUndefined$1; var hasRequiredIsNullOrUndefined$1; function requireIsNullOrUndefined$1() { if (hasRequiredIsNullOrUndefined$1) return isNullOrUndefined$1; hasRequiredIsNullOrUndefined$1 = 1; isNullOrUndefined$1 = function(it$1) { return it$1 === null || it$1 === void 0; }; return isNullOrUndefined$1; } var requireObjectCoercible$1; var hasRequiredRequireObjectCoercible$1; function requireRequireObjectCoercible$1() { if (hasRequiredRequireObjectCoercible$1) return requireObjectCoercible$1; hasRequiredRequireObjectCoercible$1 = 1; var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined$1(); var $TypeError = TypeError; requireObjectCoercible$1 = function(it$1) { if (isNullOrUndefined$2(it$1)) throw new $TypeError("Can't call method on " + it$1); return it$1; }; return requireObjectCoercible$1; } var toIndexedObject$1; var hasRequiredToIndexedObject$1; function requireToIndexedObject$1() { if (hasRequiredToIndexedObject$1) return toIndexedObject$1; hasRequiredToIndexedObject$1 = 1; var IndexedObject = /* @__PURE__ */ requireIndexedObject$1(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible$1(); toIndexedObject$1 = function(it$1) { return IndexedObject(requireObjectCoercible$2(it$1)); }; return toIndexedObject$1; } var isObject$2; var hasRequiredIsObject$1; function requireIsObject$1() { if (hasRequiredIsObject$1) return isObject$2; hasRequiredIsObject$1 = 1; var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); isObject$2 = function(it$1) { return typeof it$1 == "object" ? it$1 !== null : isCallable$2(it$1); }; return isObject$2; } var path$1; var hasRequiredPath$1; function requirePath$1() { if (hasRequiredPath$1) return path$1; hasRequiredPath$1 = 1; path$1 = {}; return path$1; } var getBuiltIn$1; var hasRequiredGetBuiltIn$1; function requireGetBuiltIn$1() { if (hasRequiredGetBuiltIn$1) return getBuiltIn$1; hasRequiredGetBuiltIn$1 = 1; var path$2 = /* @__PURE__ */ requirePath$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var aFunction = function(variable) { return isCallable$2(variable) ? variable : void 0; }; getBuiltIn$1 = function(namespace, method) { return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(globalThis$1[namespace]) : path$2[namespace] && path$2[namespace][method] || globalThis$1[namespace] && globalThis$1[namespace][method]; }; return getBuiltIn$1; } var objectIsPrototypeOf$1; var hasRequiredObjectIsPrototypeOf$1; function requireObjectIsPrototypeOf$1() { if (hasRequiredObjectIsPrototypeOf$1) return objectIsPrototypeOf$1; hasRequiredObjectIsPrototypeOf$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); objectIsPrototypeOf$1 = uncurryThis({}.isPrototypeOf); return objectIsPrototypeOf$1; } var environmentUserAgent$1; var hasRequiredEnvironmentUserAgent$1; function requireEnvironmentUserAgent$1() { if (hasRequiredEnvironmentUserAgent$1) return environmentUserAgent$1; hasRequiredEnvironmentUserAgent$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var navigator$1 = globalThis$1.navigator; var userAgent = navigator$1 && navigator$1.userAgent; environmentUserAgent$1 = userAgent ? String(userAgent) : ""; return environmentUserAgent$1; } var environmentV8Version$1; var hasRequiredEnvironmentV8Version$1; function requireEnvironmentV8Version$1() { if (hasRequiredEnvironmentV8Version$1) return environmentV8Version$1; hasRequiredEnvironmentV8Version$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var userAgent = /* @__PURE__ */ requireEnvironmentUserAgent$1(); var process = globalThis$1.process; var Deno$1 = globalThis$1.Deno; var versions = process && process.versions || Deno$1 && Deno$1.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split("."); version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } environmentV8Version$1 = version; return environmentV8Version$1; } var symbolConstructorDetection$1; var hasRequiredSymbolConstructorDetection$1; function requireSymbolConstructorDetection$1() { if (hasRequiredSymbolConstructorDetection$1) return symbolConstructorDetection$1; hasRequiredSymbolConstructorDetection$1 = 1; var V8_VERSION = /* @__PURE__ */ requireEnvironmentV8Version$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var $String = globalThis$1.String; symbolConstructorDetection$1 = !!Object.getOwnPropertySymbols && !fails$2(function() { var symbol$6 = Symbol("symbol detection"); return !$String(symbol$6) || !(Object(symbol$6) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); return symbolConstructorDetection$1; } var useSymbolAsUid$1; var hasRequiredUseSymbolAsUid$1; function requireUseSymbolAsUid$1() { if (hasRequiredUseSymbolAsUid$1) return useSymbolAsUid$1; hasRequiredUseSymbolAsUid$1 = 1; var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection$1(); useSymbolAsUid$1 = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol"; return useSymbolAsUid$1; } var isSymbol$1; var hasRequiredIsSymbol$1; function requireIsSymbol$1() { if (hasRequiredIsSymbol$1) return isSymbol$1; hasRequiredIsSymbol$1 = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var USE_SYMBOL_AS_UID = /* @__PURE__ */ requireUseSymbolAsUid$1(); var $Object = Object; isSymbol$1 = USE_SYMBOL_AS_UID ? function(it$1) { return typeof it$1 == "symbol"; } : function(it$1) { var $Symbol = getBuiltIn$2("Symbol"); return isCallable$2($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it$1)); }; return isSymbol$1; } var tryToString$1; var hasRequiredTryToString$1; function requireTryToString$1() { if (hasRequiredTryToString$1) return tryToString$1; hasRequiredTryToString$1 = 1; var $String = String; tryToString$1 = function(argument) { try { return $String(argument); } catch (error) { return "Object"; } }; return tryToString$1; } var aCallable$1; var hasRequiredACallable$1; function requireACallable$1() { if (hasRequiredACallable$1) return aCallable$1; hasRequiredACallable$1 = 1; var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var tryToString$2 = /* @__PURE__ */ requireTryToString$1(); var $TypeError = TypeError; aCallable$1 = function(argument) { if (isCallable$2(argument)) return argument; throw new $TypeError(tryToString$2(argument) + " is not a function"); }; return aCallable$1; } var getMethod$1; var hasRequiredGetMethod$1; function requireGetMethod$1() { if (hasRequiredGetMethod$1) return getMethod$1; hasRequiredGetMethod$1 = 1; var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined$1(); getMethod$1 = function(V, P) { var func = V[P]; return isNullOrUndefined$2(func) ? void 0 : aCallable$2(func); }; return getMethod$1; } var ordinaryToPrimitive$1; var hasRequiredOrdinaryToPrimitive$1; function requireOrdinaryToPrimitive$1() { if (hasRequiredOrdinaryToPrimitive$1) return ordinaryToPrimitive$1; hasRequiredOrdinaryToPrimitive$1 = 1; var call = /* @__PURE__ */ requireFunctionCall$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var $TypeError = TypeError; ordinaryToPrimitive$1 = function(input, pref) { var fn, val; if (pref === "string" && isCallable$2(fn = input.toString) && !isObject$3(val = call(fn, input))) return val; if (isCallable$2(fn = input.valueOf) && !isObject$3(val = call(fn, input))) return val; if (pref !== "string" && isCallable$2(fn = input.toString) && !isObject$3(val = call(fn, input))) return val; throw new $TypeError("Can't convert object to primitive value"); }; return ordinaryToPrimitive$1; } var sharedStore$1 = { exports: {} }; var isPure$1; var hasRequiredIsPure$1; function requireIsPure$1() { if (hasRequiredIsPure$1) return isPure$1; hasRequiredIsPure$1 = 1; isPure$1 = true; return isPure$1; } var defineGlobalProperty$1; var hasRequiredDefineGlobalProperty$1; function requireDefineGlobalProperty$1() { if (hasRequiredDefineGlobalProperty$1) return defineGlobalProperty$1; hasRequiredDefineGlobalProperty$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var defineProperty$7 = Object.defineProperty; defineGlobalProperty$1 = function(key, value) { try { defineProperty$7(globalThis$1, key, { value, configurable: true, writable: true }); } catch (error) { globalThis$1[key] = value; } return value; }; return defineGlobalProperty$1; } var hasRequiredSharedStore$1; function requireSharedStore$1() { if (hasRequiredSharedStore$1) return sharedStore$1.exports; hasRequiredSharedStore$1 = 1; var IS_PURE = /* @__PURE__ */ requireIsPure$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var defineGlobalProperty$2 = /* @__PURE__ */ requireDefineGlobalProperty$1(); var SHARED = "__core-js_shared__"; var store = sharedStore$1.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {}); (store.versions || (store.versions = [])).push({ version: "3.44.0", mode: IS_PURE ? "pure" : "global", copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)", license: "https://github.com/zloirock/core-js/blob/v3.44.0/LICENSE", source: "https://github.com/zloirock/core-js" }); return sharedStore$1.exports; } var shared$1; var hasRequiredShared$1; function requireShared$1() { if (hasRequiredShared$1) return shared$1; hasRequiredShared$1 = 1; var store = /* @__PURE__ */ requireSharedStore$1(); shared$1 = function(key, value) { return store[key] || (store[key] = value || {}); }; return shared$1; } var toObject$1; var hasRequiredToObject$1; function requireToObject$1() { if (hasRequiredToObject$1) return toObject$1; hasRequiredToObject$1 = 1; var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible$1(); var $Object = Object; toObject$1 = function(argument) { return $Object(requireObjectCoercible$2(argument)); }; return toObject$1; } var hasOwnProperty_1$1; var hasRequiredHasOwnProperty$1; function requireHasOwnProperty$1() { if (hasRequiredHasOwnProperty$1) return hasOwnProperty_1$1; hasRequiredHasOwnProperty$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var hasOwnProperty = uncurryThis({}.hasOwnProperty); hasOwnProperty_1$1 = Object.hasOwn || function hasOwn(it$1, key) { return hasOwnProperty(toObject$2(it$1), key); }; return hasOwnProperty_1$1; } var uid$1; var hasRequiredUid$1; function requireUid$1() { if (hasRequiredUid$1) return uid$1; hasRequiredUid$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var id = 0; var postfix = Math.random(); var toString$2 = uncurryThis(1.1.toString); uid$1 = function(key) { return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString$2(++id + postfix, 36); }; return uid$1; } var wellKnownSymbol$1; var hasRequiredWellKnownSymbol$1; function requireWellKnownSymbol$1() { if (hasRequiredWellKnownSymbol$1) return wellKnownSymbol$1; hasRequiredWellKnownSymbol$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var shared$2 = /* @__PURE__ */ requireShared$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var uid$2 = /* @__PURE__ */ requireUid$1(); var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection$1(); var USE_SYMBOL_AS_UID = /* @__PURE__ */ requireUseSymbolAsUid$1(); var Symbol$1 = globalThis$1.Symbol; var WellKnownSymbolsStore = shared$2("wks"); var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1["for"] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$2; wellKnownSymbol$1 = function(name) { if (!hasOwn(WellKnownSymbolsStore, name)) WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name); return WellKnownSymbolsStore[name]; }; return wellKnownSymbol$1; } var toPrimitive$6$1; var hasRequiredToPrimitive$5$1; function requireToPrimitive$5$1() { if (hasRequiredToPrimitive$5$1) return toPrimitive$6$1; hasRequiredToPrimitive$5$1 = 1; var call = /* @__PURE__ */ requireFunctionCall$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol$1(); var getMethod$2 = /* @__PURE__ */ requireGetMethod$1(); var ordinaryToPrimitive$2 = /* @__PURE__ */ requireOrdinaryToPrimitive$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var $TypeError = TypeError; var TO_PRIMITIVE = wellKnownSymbol$2("toPrimitive"); toPrimitive$6$1 = function(input, pref) { if (!isObject$3(input) || isSymbol$2(input)) return input; var exoticToPrim = getMethod$2(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === void 0) pref = "default"; result = call(exoticToPrim, input, pref); if (!isObject$3(result) || isSymbol$2(result)) return result; throw new $TypeError("Can't convert object to primitive value"); } if (pref === void 0) pref = "number"; return ordinaryToPrimitive$2(input, pref); }; return toPrimitive$6$1; } var toPropertyKey$1$1; var hasRequiredToPropertyKey$1; function requireToPropertyKey$1() { if (hasRequiredToPropertyKey$1) return toPropertyKey$1$1; hasRequiredToPropertyKey$1 = 1; var toPrimitive$8 = /* @__PURE__ */ requireToPrimitive$5$1(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol$1(); toPropertyKey$1$1 = function(argument) { var key = toPrimitive$8(argument, "string"); return isSymbol$2(key) ? key : key + ""; }; return toPropertyKey$1$1; } var documentCreateElement$1; var hasRequiredDocumentCreateElement$1; function requireDocumentCreateElement$1() { if (hasRequiredDocumentCreateElement$1) return documentCreateElement$1; hasRequiredDocumentCreateElement$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var document$1 = globalThis$1.document; var EXISTS = isObject$3(document$1) && isObject$3(document$1.createElement); documentCreateElement$1 = function(it$1) { return EXISTS ? document$1.createElement(it$1) : {}; }; return documentCreateElement$1; } var ie8DomDefine$1; var hasRequiredIe8DomDefine$1; function requireIe8DomDefine$1() { if (hasRequiredIe8DomDefine$1) return ie8DomDefine$1; hasRequiredIe8DomDefine$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var createElement = /* @__PURE__ */ requireDocumentCreateElement$1(); ie8DomDefine$1 = !DESCRIPTORS && !fails$2(function() { return Object.defineProperty(createElement("div"), "a", { get: function() { return 7; } }).a !== 7; }); return ie8DomDefine$1; } var hasRequiredObjectGetOwnPropertyDescriptor$1; function requireObjectGetOwnPropertyDescriptor$1() { if (hasRequiredObjectGetOwnPropertyDescriptor$1) return objectGetOwnPropertyDescriptor$1; hasRequiredObjectGetOwnPropertyDescriptor$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var call = /* @__PURE__ */ requireFunctionCall$1(); var propertyIsEnumerableModule = /* @__PURE__ */ requireObjectPropertyIsEnumerable$1(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor$1(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var toPropertyKey$3 = /* @__PURE__ */ requireToPropertyKey$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var IE8_DOM_DEFINE = /* @__PURE__ */ requireIe8DomDefine$1(); var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; objectGetOwnPropertyDescriptor$1.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor$4(O, P) { O = toIndexedObject$2(O); P = toPropertyKey$3(P); if (IE8_DOM_DEFINE) try { return $getOwnPropertyDescriptor(O, P); } catch (error) {} if (hasOwn(O, P)) return createPropertyDescriptor$2(!call(propertyIsEnumerableModule.f, O, P), O[P]); }; return objectGetOwnPropertyDescriptor$1; } var isForced_1$1; var hasRequiredIsForced$1; function requireIsForced$1() { if (hasRequiredIsForced$1) return isForced_1$1; hasRequiredIsForced$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var replacement = /#|\.prototype\./; var isForced = function(feature, detection) { var value = data[normalize(feature)]; return value === POLYFILL ? true : value === NATIVE ? false : isCallable$2(detection) ? fails$2(detection) : !!detection; }; var normalize = isForced.normalize = function(string$1) { return String(string$1).replace(replacement, ".").toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = "N"; var POLYFILL = isForced.POLYFILL = "P"; isForced_1$1 = isForced; return isForced_1$1; } var functionBindContext$1; var hasRequiredFunctionBindContext$1; function requireFunctionBindContext$1() { if (hasRequiredFunctionBindContext$1) return functionBindContext$1; hasRequiredFunctionBindContext$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThisClause$1(); var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative$1(); var bind$5 = uncurryThis(uncurryThis.bind); functionBindContext$1 = function(fn, that) { aCallable$2(fn); return that === void 0 ? fn : NATIVE_BIND ? bind$5(fn, that) : function() { return fn.apply(that, arguments); }; }; return functionBindContext$1; } var objectDefineProperty$1 = {}; var v8PrototypeDefineBug$1; var hasRequiredV8PrototypeDefineBug$1; function requireV8PrototypeDefineBug$1() { if (hasRequiredV8PrototypeDefineBug$1) return v8PrototypeDefineBug$1; hasRequiredV8PrototypeDefineBug$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); v8PrototypeDefineBug$1 = DESCRIPTORS && fails$2(function() { return Object.defineProperty(function() {}, "prototype", { value: 42, writable: false }).prototype !== 42; }); return v8PrototypeDefineBug$1; } var anObject$1; var hasRequiredAnObject$1; function requireAnObject$1() { if (hasRequiredAnObject$1) return anObject$1; hasRequiredAnObject$1 = 1; var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var $String = String; var $TypeError = TypeError; anObject$1 = function(argument) { if (isObject$3(argument)) return argument; throw new $TypeError($String(argument) + " is not an object"); }; return anObject$1; } var hasRequiredObjectDefineProperty$1; function requireObjectDefineProperty$1() { if (hasRequiredObjectDefineProperty$1) return objectDefineProperty$1; hasRequiredObjectDefineProperty$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var IE8_DOM_DEFINE = /* @__PURE__ */ requireIe8DomDefine$1(); var V8_PROTOTYPE_DEFINE_BUG = /* @__PURE__ */ requireV8PrototypeDefineBug$1(); var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var toPropertyKey$3 = /* @__PURE__ */ requireToPropertyKey$1(); var $TypeError = TypeError; var $defineProperty = Object.defineProperty; var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var ENUMERABLE = "enumerable"; var CONFIGURABLE = "configurable"; var WRITABLE = "writable"; objectDefineProperty$1.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty$7(O, P, Attributes) { anObject$2(O); P = toPropertyKey$3(P); anObject$2(Attributes); if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { var current = $getOwnPropertyDescriptor(O, P); if (current && current[WRITABLE]) { O[P] = Attributes.value; Attributes = { configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], writable: false }; } } return $defineProperty(O, P, Attributes); } : $defineProperty : function defineProperty$7(O, P, Attributes) { anObject$2(O); P = toPropertyKey$3(P); anObject$2(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty(O, P, Attributes); } catch (error) {} if ("get" in Attributes || "set" in Attributes) throw new $TypeError("Accessors not supported"); if ("value" in Attributes) O[P] = Attributes.value; return O; }; return objectDefineProperty$1; } var createNonEnumerableProperty$1; var hasRequiredCreateNonEnumerableProperty$1; function requireCreateNonEnumerableProperty$1() { if (hasRequiredCreateNonEnumerableProperty$1) return createNonEnumerableProperty$1; hasRequiredCreateNonEnumerableProperty$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var definePropertyModule = /* @__PURE__ */ requireObjectDefineProperty$1(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor$1(); createNonEnumerableProperty$1 = DESCRIPTORS ? function(object$1, key, value) { return definePropertyModule.f(object$1, key, createPropertyDescriptor$2(1, value)); } : function(object$1, key, value) { object$1[key] = value; return object$1; }; return createNonEnumerableProperty$1; } var _export$1; var hasRequired_export$1; function require_export$1() { if (hasRequired_export$1) return _export$1; hasRequired_export$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var apply = /* @__PURE__ */ requireFunctionApply$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThisClause$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var getOwnPropertyDescriptor$4 = requireObjectGetOwnPropertyDescriptor$1().f; var isForced = /* @__PURE__ */ requireIsForced$1(); var path$2 = /* @__PURE__ */ requirePath$1(); var bind$5 = /* @__PURE__ */ requireFunctionBindContext$1(); var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var wrapConstructor = function(NativeConstructor) { var Wrapper = function(a, b, c$1) { if (this instanceof Wrapper) { switch (arguments.length) { case 0: return new NativeConstructor(); case 1: return new NativeConstructor(a); case 2: return new NativeConstructor(a, b); } return new NativeConstructor(a, b, c$1); } return apply(NativeConstructor, this, arguments); }; Wrapper.prototype = NativeConstructor.prototype; return Wrapper; }; _export$1 = function(options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var PROTO = options.proto; var nativeSource = GLOBAL ? globalThis$1 : STATIC ? globalThis$1[TARGET] : globalThis$1[TARGET] && globalThis$1[TARGET].prototype; var target = GLOBAL ? path$2 : path$2[TARGET] || createNonEnumerableProperty$2(path$2, TARGET, {})[TARGET]; var targetPrototype = target.prototype; var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE; var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor; for (key in source) { FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced); USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key); targetProperty = target[key]; if (USE_NATIVE) if (options.dontCallGetSet) { descriptor = getOwnPropertyDescriptor$4(nativeSource, key); nativeProperty = descriptor && descriptor.value; } else nativeProperty = nativeSource[key]; sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key]; if (!FORCED && !PROTO && typeof targetProperty == typeof sourceProperty) continue; if (options.bind && USE_NATIVE) resultProperty = bind$5(sourceProperty, globalThis$1); else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); else if (PROTO && isCallable$2(sourceProperty)) resultProperty = uncurryThis(sourceProperty); else resultProperty = sourceProperty; if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) createNonEnumerableProperty$2(resultProperty, "sham", true); createNonEnumerableProperty$2(target, key, resultProperty); if (PROTO) { VIRTUAL_PROTOTYPE = TARGET + "Prototype"; if (!hasOwn(path$2, VIRTUAL_PROTOTYPE)) createNonEnumerableProperty$2(path$2, VIRTUAL_PROTOTYPE, {}); createNonEnumerableProperty$2(path$2[VIRTUAL_PROTOTYPE], key, sourceProperty); if (options.real && targetPrototype && (FORCED || !targetPrototype[key])) createNonEnumerableProperty$2(targetPrototype, key, sourceProperty); } } }; return _export$1; } var hasRequiredEs_object_defineProperty$1; function requireEs_object_defineProperty$1() { if (hasRequiredEs_object_defineProperty$1) return es_object_defineProperty$1; hasRequiredEs_object_defineProperty$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var defineProperty$7 = requireObjectDefineProperty$1().f; $({ target: "Object", stat: true, forced: Object.defineProperty !== defineProperty$7, sham: !DESCRIPTORS }, { defineProperty: defineProperty$7 }); return es_object_defineProperty$1; } var hasRequiredDefineProperty$5$1; function requireDefineProperty$5$1() { if (hasRequiredDefineProperty$5$1) return defineProperty$5$1.exports; hasRequiredDefineProperty$5$1 = 1; requireEs_object_defineProperty$1(); var path$2 = /* @__PURE__ */ requirePath$1(); var Object$1 = path$2.Object; var defineProperty$7 = defineProperty$5$1.exports = function defineProperty$8(it$1, key, desc) { return Object$1.defineProperty(it$1, key, desc); }; if (Object$1.defineProperty.sham) defineProperty$7.sham = true; return defineProperty$5$1.exports; } var defineProperty$4$1; var hasRequiredDefineProperty$4$1; function requireDefineProperty$4$1() { if (hasRequiredDefineProperty$4$1) return defineProperty$4$1; hasRequiredDefineProperty$4$1 = 1; var parent = /* @__PURE__ */ requireDefineProperty$5$1(); defineProperty$4$1 = parent; return defineProperty$4$1; } var defineProperty$3$1; var hasRequiredDefineProperty$3$1; function requireDefineProperty$3$1() { if (hasRequiredDefineProperty$3$1) return defineProperty$3$1; hasRequiredDefineProperty$3$1 = 1; var parent = /* @__PURE__ */ requireDefineProperty$4$1(); defineProperty$3$1 = parent; return defineProperty$3$1; } var defineProperty$2$1; var hasRequiredDefineProperty$2$1; function requireDefineProperty$2$1() { if (hasRequiredDefineProperty$2$1) return defineProperty$2$1; hasRequiredDefineProperty$2$1 = 1; var parent = /* @__PURE__ */ requireDefineProperty$3$1(); defineProperty$2$1 = parent; return defineProperty$2$1; } var defineProperty$1$1; var hasRequiredDefineProperty$1$1; function requireDefineProperty$1$1() { if (hasRequiredDefineProperty$1$1) return defineProperty$1$1; hasRequiredDefineProperty$1$1 = 1; defineProperty$1$1 = /* @__PURE__ */ requireDefineProperty$2$1(); return defineProperty$1$1; } var definePropertyExports$1$1 = /* @__PURE__ */ requireDefineProperty$1$1(); var _Object$defineProperty$1$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(definePropertyExports$1$1); var es_array_concat$1 = {}; var isArray$3$1; var hasRequiredIsArray$3$1; function requireIsArray$3$1() { if (hasRequiredIsArray$3$1) return isArray$3$1; hasRequiredIsArray$3$1 = 1; var classof$2 = /* @__PURE__ */ requireClassofRaw$1(); isArray$3$1 = Array.isArray || function isArray$5(argument) { return classof$2(argument) === "Array"; }; return isArray$3$1; } var mathTrunc$1; var hasRequiredMathTrunc$1; function requireMathTrunc$1() { if (hasRequiredMathTrunc$1) return mathTrunc$1; hasRequiredMathTrunc$1 = 1; var ceil = Math.ceil; var floor = Math.floor; mathTrunc$1 = Math.trunc || function trunc(x) { var n = +x; return (n > 0 ? floor : ceil)(n); }; return mathTrunc$1; } var toIntegerOrInfinity$1; var hasRequiredToIntegerOrInfinity$1; function requireToIntegerOrInfinity$1() { if (hasRequiredToIntegerOrInfinity$1) return toIntegerOrInfinity$1; hasRequiredToIntegerOrInfinity$1 = 1; var trunc = /* @__PURE__ */ requireMathTrunc$1(); toIntegerOrInfinity$1 = function(argument) { var number$1 = +argument; return number$1 !== number$1 || number$1 === 0 ? 0 : trunc(number$1); }; return toIntegerOrInfinity$1; } var toLength$1; var hasRequiredToLength$1; function requireToLength$1() { if (hasRequiredToLength$1) return toLength$1; hasRequiredToLength$1 = 1; var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity$1(); var min = Math.min; toLength$1 = function(argument) { var len = toIntegerOrInfinity$2(argument); return len > 0 ? min(len, 9007199254740991) : 0; }; return toLength$1; } var lengthOfArrayLike$1; var hasRequiredLengthOfArrayLike$1; function requireLengthOfArrayLike$1() { if (hasRequiredLengthOfArrayLike$1) return lengthOfArrayLike$1; hasRequiredLengthOfArrayLike$1 = 1; var toLength$2 = /* @__PURE__ */ requireToLength$1(); lengthOfArrayLike$1 = function(obj) { return toLength$2(obj.length); }; return lengthOfArrayLike$1; } var doesNotExceedSafeInteger$1; var hasRequiredDoesNotExceedSafeInteger$1; function requireDoesNotExceedSafeInteger$1() { if (hasRequiredDoesNotExceedSafeInteger$1) return doesNotExceedSafeInteger$1; hasRequiredDoesNotExceedSafeInteger$1 = 1; var $TypeError = TypeError; var MAX_SAFE_INTEGER = 9007199254740991; doesNotExceedSafeInteger$1 = function(it$1) { if (it$1 > MAX_SAFE_INTEGER) throw $TypeError("Maximum allowed index exceeded"); return it$1; }; return doesNotExceedSafeInteger$1; } var createProperty$1; var hasRequiredCreateProperty$1; function requireCreateProperty$1() { if (hasRequiredCreateProperty$1) return createProperty$1; hasRequiredCreateProperty$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var definePropertyModule = /* @__PURE__ */ requireObjectDefineProperty$1(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor$1(); createProperty$1 = function(object$1, key, value) { if (DESCRIPTORS) definePropertyModule.f(object$1, key, createPropertyDescriptor$2(0, value)); else object$1[key] = value; }; return createProperty$1; } var toStringTagSupport$1; var hasRequiredToStringTagSupport$1; function requireToStringTagSupport$1() { if (hasRequiredToStringTagSupport$1) return toStringTagSupport$1; hasRequiredToStringTagSupport$1 = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var TO_STRING_TAG = wellKnownSymbol$2("toStringTag"); var test = {}; test[TO_STRING_TAG] = "z"; toStringTagSupport$1 = String(test) === "[object z]"; return toStringTagSupport$1; } var classof$1; var hasRequiredClassof$1; function requireClassof$1() { if (hasRequiredClassof$1) return classof$1; hasRequiredClassof$1 = 1; var TO_STRING_TAG_SUPPORT = /* @__PURE__ */ requireToStringTagSupport$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var classofRaw$2 = /* @__PURE__ */ requireClassofRaw$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var TO_STRING_TAG = wellKnownSymbol$2("toStringTag"); var $Object = Object; var CORRECT_ARGUMENTS = classofRaw$2(function() { return arguments; }()) === "Arguments"; var tryGet = function(it$1, key) { try { return it$1[key]; } catch (error) {} }; classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw$2 : function(it$1) { var O, tag, result; return it$1 === void 0 ? "Undefined" : it$1 === null ? "Null" : typeof (tag = tryGet(O = $Object(it$1), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw$2(O) : (result = classofRaw$2(O)) === "Object" && isCallable$2(O.callee) ? "Arguments" : result; }; return classof$1; } var inspectSource$1; var hasRequiredInspectSource$1; function requireInspectSource$1() { if (hasRequiredInspectSource$1) return inspectSource$1; hasRequiredInspectSource$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var store = /* @__PURE__ */ requireSharedStore$1(); var functionToString = uncurryThis(Function.toString); if (!isCallable$2(store.inspectSource)) store.inspectSource = function(it$1) { return functionToString(it$1); }; inspectSource$1 = store.inspectSource; return inspectSource$1; } var isConstructor$1; var hasRequiredIsConstructor$1; function requireIsConstructor$1() { if (hasRequiredIsConstructor$1) return isConstructor$1; hasRequiredIsConstructor$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var classof$2 = /* @__PURE__ */ requireClassof$1(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var inspectSource$2 = /* @__PURE__ */ requireInspectSource$1(); var noop = function() {}; var construct = getBuiltIn$2("Reflect", "construct"); var constructorRegExp = /^\s*(?:class|function)\b/; var exec = uncurryThis(constructorRegExp.exec); var INCORRECT_TO_STRING = !constructorRegExp.test(noop); var isConstructorModern = function isConstructor$2(argument) { if (!isCallable$2(argument)) return false; try { construct(noop, [], argument); return true; } catch (error) { return false; } }; var isConstructorLegacy = function isConstructor$2(argument) { if (!isCallable$2(argument)) return false; switch (classof$2(argument)) { case "AsyncFunction": case "GeneratorFunction": case "AsyncGeneratorFunction": return false; } try { return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$2(argument)); } catch (error) { return true; } }; isConstructorLegacy.sham = true; isConstructor$1 = !construct || fails$2(function() { var called; return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() { called = true; }) || called; }) ? isConstructorLegacy : isConstructorModern; return isConstructor$1; } var arraySpeciesConstructor$1; var hasRequiredArraySpeciesConstructor$1; function requireArraySpeciesConstructor$1() { if (hasRequiredArraySpeciesConstructor$1) return arraySpeciesConstructor$1; hasRequiredArraySpeciesConstructor$1 = 1; var isArray$5 = /* @__PURE__ */ requireIsArray$3$1(); var isConstructor$2 = /* @__PURE__ */ requireIsConstructor$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var SPECIES = wellKnownSymbol$2("species"); var $Array = Array; arraySpeciesConstructor$1 = function(originalArray) { var C; if (isArray$5(originalArray)) { C = originalArray.constructor; if (isConstructor$2(C) && (C === $Array || isArray$5(C.prototype))) C = void 0; else if (isObject$3(C)) { C = C[SPECIES]; if (C === null) C = void 0; } } return C === void 0 ? $Array : C; }; return arraySpeciesConstructor$1; } var arraySpeciesCreate$1; var hasRequiredArraySpeciesCreate$1; function requireArraySpeciesCreate$1() { if (hasRequiredArraySpeciesCreate$1) return arraySpeciesCreate$1; hasRequiredArraySpeciesCreate$1 = 1; var arraySpeciesConstructor$2 = /* @__PURE__ */ requireArraySpeciesConstructor$1(); arraySpeciesCreate$1 = function(originalArray, length$1) { return new (arraySpeciesConstructor$2(originalArray))(length$1 === 0 ? 0 : length$1); }; return arraySpeciesCreate$1; } var arrayMethodHasSpeciesSupport$1; var hasRequiredArrayMethodHasSpeciesSupport$1; function requireArrayMethodHasSpeciesSupport$1() { if (hasRequiredArrayMethodHasSpeciesSupport$1) return arrayMethodHasSpeciesSupport$1; hasRequiredArrayMethodHasSpeciesSupport$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var V8_VERSION = /* @__PURE__ */ requireEnvironmentV8Version$1(); var SPECIES = wellKnownSymbol$2("species"); arrayMethodHasSpeciesSupport$1 = function(METHOD_NAME) { return V8_VERSION >= 51 || !fails$2(function() { var array$1 = []; var constructor = array$1.constructor = {}; constructor[SPECIES] = function() { return { foo: 1 }; }; return array$1[METHOD_NAME](Boolean).foo !== 1; }); }; return arrayMethodHasSpeciesSupport$1; } var hasRequiredEs_array_concat$1; function requireEs_array_concat$1() { if (hasRequiredEs_array_concat$1) return es_array_concat$1; hasRequiredEs_array_concat$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var isArray$5 = /* @__PURE__ */ requireIsArray$3$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var doesNotExceedSafeInteger$2 = /* @__PURE__ */ requireDoesNotExceedSafeInteger$1(); var createProperty$2 = /* @__PURE__ */ requireCreateProperty$1(); var arraySpeciesCreate$2 = /* @__PURE__ */ requireArraySpeciesCreate$1(); var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var V8_VERSION = /* @__PURE__ */ requireEnvironmentV8Version$1(); var IS_CONCAT_SPREADABLE = wellKnownSymbol$2("isConcatSpreadable"); var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails$2(function() { var array$1 = []; array$1[IS_CONCAT_SPREADABLE] = false; return array$1.concat()[0] !== array$1; }); var isConcatSpreadable = function(O) { if (!isObject$3(O)) return false; var spreadable = O[IS_CONCAT_SPREADABLE]; return spreadable !== void 0 ? !!spreadable : isArray$5(O); }; var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !arrayMethodHasSpeciesSupport$2("concat"); $({ target: "Array", proto: true, arity: 1, forced: FORCED }, { concat: function concat$5(arg) { var O = toObject$2(this); var A = arraySpeciesCreate$2(O, 0); var n = 0; var i, k, length$1, len, E; for (i = -1, length$1 = arguments.length; i < length$1; i++) { E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = lengthOfArrayLike$2(E); doesNotExceedSafeInteger$2(n + len); for (k = 0; k < len; k++, n++) if (k in E) createProperty$2(A, n, E[k]); } else { doesNotExceedSafeInteger$2(n + 1); createProperty$2(A, n++, E); } } A.length = n; return A; } }); return es_array_concat$1; } var es_symbol$1 = {}; var es_symbol_constructor$1 = {}; var toString$1; var hasRequiredToString$1; function requireToString$1() { if (hasRequiredToString$1) return toString$1; hasRequiredToString$1 = 1; var classof$2 = /* @__PURE__ */ requireClassof$1(); var $String = String; toString$1 = function(argument) { if (classof$2(argument) === "Symbol") throw new TypeError("Cannot convert a Symbol value to a string"); return $String(argument); }; return toString$1; } var objectDefineProperties$1 = {}; var toAbsoluteIndex$1; var hasRequiredToAbsoluteIndex$1; function requireToAbsoluteIndex$1() { if (hasRequiredToAbsoluteIndex$1) return toAbsoluteIndex$1; hasRequiredToAbsoluteIndex$1 = 1; var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity$1(); var max = Math.max; var min = Math.min; toAbsoluteIndex$1 = function(index$1, length$1) { var integer = toIntegerOrInfinity$2(index$1); return integer < 0 ? max(integer + length$1, 0) : min(integer, length$1); }; return toAbsoluteIndex$1; } var arrayIncludes$1; var hasRequiredArrayIncludes$1; function requireArrayIncludes$1() { if (hasRequiredArrayIncludes$1) return arrayIncludes$1; hasRequiredArrayIncludes$1 = 1; var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var toAbsoluteIndex$2 = /* @__PURE__ */ requireToAbsoluteIndex$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var createMethod = function(IS_INCLUDES) { return function($this, el, fromIndex) { var O = toIndexedObject$2($this); var length$1 = lengthOfArrayLike$2(O); if (length$1 === 0) return !IS_INCLUDES && -1; var index$1 = toAbsoluteIndex$2(fromIndex, length$1); var value; if (IS_INCLUDES && el !== el) while (length$1 > index$1) { value = O[index$1++]; if (value !== value) return true; } else for (; length$1 > index$1; index$1++) if ((IS_INCLUDES || index$1 in O) && O[index$1] === el) return IS_INCLUDES || index$1 || 0; return !IS_INCLUDES && -1; }; }; arrayIncludes$1 = { includes: createMethod(true), indexOf: createMethod(false) }; return arrayIncludes$1; } var hiddenKeys$1; var hasRequiredHiddenKeys$1; function requireHiddenKeys$1() { if (hasRequiredHiddenKeys$1) return hiddenKeys$1; hasRequiredHiddenKeys$1 = 1; hiddenKeys$1 = {}; return hiddenKeys$1; } var objectKeysInternal$1; var hasRequiredObjectKeysInternal$1; function requireObjectKeysInternal$1() { if (hasRequiredObjectKeysInternal$1) return objectKeysInternal$1; hasRequiredObjectKeysInternal$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var indexOf$4 = requireArrayIncludes$1().indexOf; var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys$1(); var push = uncurryThis([].push); objectKeysInternal$1 = function(object$1, names) { var O = toIndexedObject$2(object$1); var i = 0; var result = []; var key; for (key in O) !hasOwn(hiddenKeys$2, key) && hasOwn(O, key) && push(result, key); while (names.length > i) if (hasOwn(O, key = names[i++])) ~indexOf$4(result, key) || push(result, key); return result; }; return objectKeysInternal$1; } var enumBugKeys$1; var hasRequiredEnumBugKeys$1; function requireEnumBugKeys$1() { if (hasRequiredEnumBugKeys$1) return enumBugKeys$1; hasRequiredEnumBugKeys$1 = 1; enumBugKeys$1 = [ "constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf" ]; return enumBugKeys$1; } var objectKeys$1; var hasRequiredObjectKeys$1; function requireObjectKeys$1() { if (hasRequiredObjectKeys$1) return objectKeys$1; hasRequiredObjectKeys$1 = 1; var internalObjectKeys = /* @__PURE__ */ requireObjectKeysInternal$1(); var enumBugKeys$2 = /* @__PURE__ */ requireEnumBugKeys$1(); objectKeys$1 = Object.keys || function keys$8(O) { return internalObjectKeys(O, enumBugKeys$2); }; return objectKeys$1; } var hasRequiredObjectDefineProperties$1; function requireObjectDefineProperties$1() { if (hasRequiredObjectDefineProperties$1) return objectDefineProperties$1; hasRequiredObjectDefineProperties$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var V8_PROTOTYPE_DEFINE_BUG = /* @__PURE__ */ requireV8PrototypeDefineBug$1(); var definePropertyModule = /* @__PURE__ */ requireObjectDefineProperty$1(); var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var objectKeys$2 = /* @__PURE__ */ requireObjectKeys$1(); objectDefineProperties$1.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties$4(O, Properties) { anObject$2(O); var props = toIndexedObject$2(Properties); var keys$8 = objectKeys$2(Properties); var length$1 = keys$8.length; var index$1 = 0; var key; while (length$1 > index$1) definePropertyModule.f(O, key = keys$8[index$1++], props[key]); return O; }; return objectDefineProperties$1; } var html$1; var hasRequiredHtml$1; function requireHtml$1() { if (hasRequiredHtml$1) return html$1; hasRequiredHtml$1 = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); html$1 = getBuiltIn$2("document", "documentElement"); return html$1; } var sharedKey$1; var hasRequiredSharedKey$1; function requireSharedKey$1() { if (hasRequiredSharedKey$1) return sharedKey$1; hasRequiredSharedKey$1 = 1; var shared$2 = /* @__PURE__ */ requireShared$1(); var uid$2 = /* @__PURE__ */ requireUid$1(); var keys$8 = shared$2("keys"); sharedKey$1 = function(key) { return keys$8[key] || (keys$8[key] = uid$2(key)); }; return sharedKey$1; } var objectCreate$1; var hasRequiredObjectCreate$1; function requireObjectCreate$1() { if (hasRequiredObjectCreate$1) return objectCreate$1; hasRequiredObjectCreate$1 = 1; var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var definePropertiesModule = /* @__PURE__ */ requireObjectDefineProperties$1(); var enumBugKeys$2 = /* @__PURE__ */ requireEnumBugKeys$1(); var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys$1(); var html$2 = /* @__PURE__ */ requireHtml$1(); var documentCreateElement$2 = /* @__PURE__ */ requireDocumentCreateElement$1(); var sharedKey$2 = /* @__PURE__ */ requireSharedKey$1(); var GT = ">"; var LT = "<"; var PROTOTYPE = "prototype"; var SCRIPT = "script"; var IE_PROTO = sharedKey$2("IE_PROTO"); var EmptyConstructor = function() {}; var scriptTag = function(content) { return LT + SCRIPT + GT + content + LT + "/" + SCRIPT + GT; }; var NullProtoObjectViaActiveX = function(activeXDocument$1) { activeXDocument$1.write(scriptTag("")); activeXDocument$1.close(); var temp = activeXDocument$1.parentWindow.Object; activeXDocument$1 = null; return temp; }; var NullProtoObjectViaIFrame = function() { var iframe = documentCreateElement$2("iframe"); var JS = "java" + SCRIPT + ":"; var iframeDocument; iframe.style.display = "none"; html$2.appendChild(iframe); iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag("document.F=Object")); iframeDocument.close(); return iframeDocument.F; }; var activeXDocument; var NullProtoObject = function() { try { activeXDocument = new ActiveXObject("htmlfile"); } catch (error) {} NullProtoObject = typeof document != "undefined" ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); var length$1 = enumBugKeys$2.length; while (length$1--) delete NullProtoObject[PROTOTYPE][enumBugKeys$2[length$1]]; return NullProtoObject(); }; hiddenKeys$2[IE_PROTO] = true; objectCreate$1 = Object.create || function create$4(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject$2(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === void 0 ? result : definePropertiesModule.f(result, Properties); }; return objectCreate$1; } var objectGetOwnPropertyNames$1 = {}; var hasRequiredObjectGetOwnPropertyNames$1; function requireObjectGetOwnPropertyNames$1() { if (hasRequiredObjectGetOwnPropertyNames$1) return objectGetOwnPropertyNames$1; hasRequiredObjectGetOwnPropertyNames$1 = 1; var internalObjectKeys = /* @__PURE__ */ requireObjectKeysInternal$1(); var enumBugKeys$2 = /* @__PURE__ */ requireEnumBugKeys$1(); var hiddenKeys$2 = enumBugKeys$2.concat("length", "prototype"); objectGetOwnPropertyNames$1.f = Object.getOwnPropertyNames || function getOwnPropertyNames$3(O) { return internalObjectKeys(O, hiddenKeys$2); }; return objectGetOwnPropertyNames$1; } var objectGetOwnPropertyNamesExternal$1 = {}; var arraySlice$1; var hasRequiredArraySlice$1; function requireArraySlice$1() { if (hasRequiredArraySlice$1) return arraySlice$1; hasRequiredArraySlice$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); arraySlice$1 = uncurryThis([].slice); return arraySlice$1; } var hasRequiredObjectGetOwnPropertyNamesExternal$1; function requireObjectGetOwnPropertyNamesExternal$1() { if (hasRequiredObjectGetOwnPropertyNamesExternal$1) return objectGetOwnPropertyNamesExternal$1; hasRequiredObjectGetOwnPropertyNamesExternal$1 = 1; var classof$2 = /* @__PURE__ */ requireClassofRaw$1(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var $getOwnPropertyNames = requireObjectGetOwnPropertyNames$1().f; var arraySlice$2 = /* @__PURE__ */ requireArraySlice$1(); var windowNames = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function(it$1) { try { return $getOwnPropertyNames(it$1); } catch (error) { return arraySlice$2(windowNames); } }; objectGetOwnPropertyNamesExternal$1.f = function getOwnPropertyNames$3(it$1) { return windowNames && classof$2(it$1) === "Window" ? getWindowNames(it$1) : $getOwnPropertyNames(toIndexedObject$2(it$1)); }; return objectGetOwnPropertyNamesExternal$1; } var objectGetOwnPropertySymbols$1 = {}; var hasRequiredObjectGetOwnPropertySymbols$1; function requireObjectGetOwnPropertySymbols$1() { if (hasRequiredObjectGetOwnPropertySymbols$1) return objectGetOwnPropertySymbols$1; hasRequiredObjectGetOwnPropertySymbols$1 = 1; objectGetOwnPropertySymbols$1.f = Object.getOwnPropertySymbols; return objectGetOwnPropertySymbols$1; } var defineBuiltIn$1; var hasRequiredDefineBuiltIn$1; function requireDefineBuiltIn$1() { if (hasRequiredDefineBuiltIn$1) return defineBuiltIn$1; hasRequiredDefineBuiltIn$1 = 1; var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty$1(); defineBuiltIn$1 = function(target, key, value, options) { if (options && options.enumerable) target[key] = value; else createNonEnumerableProperty$2(target, key, value); return target; }; return defineBuiltIn$1; } var defineBuiltInAccessor$1; var hasRequiredDefineBuiltInAccessor$1; function requireDefineBuiltInAccessor$1() { if (hasRequiredDefineBuiltInAccessor$1) return defineBuiltInAccessor$1; hasRequiredDefineBuiltInAccessor$1 = 1; var defineProperty$7 = /* @__PURE__ */ requireObjectDefineProperty$1(); defineBuiltInAccessor$1 = function(target, name, descriptor) { return defineProperty$7.f(target, name, descriptor); }; return defineBuiltInAccessor$1; } var wellKnownSymbolWrapped$1 = {}; var hasRequiredWellKnownSymbolWrapped$1; function requireWellKnownSymbolWrapped$1() { if (hasRequiredWellKnownSymbolWrapped$1) return wellKnownSymbolWrapped$1; hasRequiredWellKnownSymbolWrapped$1 = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); wellKnownSymbolWrapped$1.f = wellKnownSymbol$2; return wellKnownSymbolWrapped$1; } var wellKnownSymbolDefine$1; var hasRequiredWellKnownSymbolDefine$1; function requireWellKnownSymbolDefine$1() { if (hasRequiredWellKnownSymbolDefine$1) return wellKnownSymbolDefine$1; hasRequiredWellKnownSymbolDefine$1 = 1; var path$2 = /* @__PURE__ */ requirePath$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var wrappedWellKnownSymbolModule = /* @__PURE__ */ requireWellKnownSymbolWrapped$1(); var defineProperty$7 = requireObjectDefineProperty$1().f; wellKnownSymbolDefine$1 = function(NAME) { var Symbol$1 = path$2.Symbol || (path$2.Symbol = {}); if (!hasOwn(Symbol$1, NAME)) defineProperty$7(Symbol$1, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) }); }; return wellKnownSymbolDefine$1; } var symbolDefineToPrimitive$1; var hasRequiredSymbolDefineToPrimitive$1; function requireSymbolDefineToPrimitive$1() { if (hasRequiredSymbolDefineToPrimitive$1) return symbolDefineToPrimitive$1; hasRequiredSymbolDefineToPrimitive$1 = 1; var call = /* @__PURE__ */ requireFunctionCall$1(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn$1(); symbolDefineToPrimitive$1 = function() { var Symbol$1 = getBuiltIn$2("Symbol"); var SymbolPrototype = Symbol$1 && Symbol$1.prototype; var valueOf = SymbolPrototype && SymbolPrototype.valueOf; var TO_PRIMITIVE = wellKnownSymbol$2("toPrimitive"); if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) defineBuiltIn$2(SymbolPrototype, TO_PRIMITIVE, function(hint) { return call(valueOf, this); }, { arity: 1 }); }; return symbolDefineToPrimitive$1; } var objectToString$1; var hasRequiredObjectToString$1; function requireObjectToString$1() { if (hasRequiredObjectToString$1) return objectToString$1; hasRequiredObjectToString$1 = 1; var TO_STRING_TAG_SUPPORT = /* @__PURE__ */ requireToStringTagSupport$1(); var classof$2 = /* @__PURE__ */ requireClassof$1(); objectToString$1 = TO_STRING_TAG_SUPPORT ? {}.toString : function toString$2() { return "[object " + classof$2(this) + "]"; }; return objectToString$1; } var setToStringTag$1; var hasRequiredSetToStringTag$1; function requireSetToStringTag$1() { if (hasRequiredSetToStringTag$1) return setToStringTag$1; hasRequiredSetToStringTag$1 = 1; var TO_STRING_TAG_SUPPORT = /* @__PURE__ */ requireToStringTagSupport$1(); var defineProperty$7 = requireObjectDefineProperty$1().f; var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var toString$2 = /* @__PURE__ */ requireObjectToString$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var TO_STRING_TAG = wellKnownSymbol$2("toStringTag"); setToStringTag$1 = function(it$1, TAG, STATIC, SET_METHOD) { var target = STATIC ? it$1 : it$1 && it$1.prototype; if (target) { if (!hasOwn(target, TO_STRING_TAG)) defineProperty$7(target, TO_STRING_TAG, { configurable: true, value: TAG }); if (SET_METHOD && !TO_STRING_TAG_SUPPORT) createNonEnumerableProperty$2(target, "toString", toString$2); } }; return setToStringTag$1; } var weakMapBasicDetection$1; var hasRequiredWeakMapBasicDetection$1; function requireWeakMapBasicDetection$1() { if (hasRequiredWeakMapBasicDetection$1) return weakMapBasicDetection$1; hasRequiredWeakMapBasicDetection$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var WeakMap = globalThis$1.WeakMap; weakMapBasicDetection$1 = isCallable$2(WeakMap) && /native code/.test(String(WeakMap)); return weakMapBasicDetection$1; } var internalState$1; var hasRequiredInternalState$1; function requireInternalState$1() { if (hasRequiredInternalState$1) return internalState$1; hasRequiredInternalState$1 = 1; var NATIVE_WEAK_MAP = /* @__PURE__ */ requireWeakMapBasicDetection$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var shared$2 = /* @__PURE__ */ requireSharedStore$1(); var sharedKey$2 = /* @__PURE__ */ requireSharedKey$1(); var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys$1(); var OBJECT_ALREADY_INITIALIZED = "Object already initialized"; var TypeError$1 = globalThis$1.TypeError; var WeakMap = globalThis$1.WeakMap; var set$4, get, has; var enforce = function(it$1) { return has(it$1) ? get(it$1) : set$4(it$1, {}); }; var getterFor = function(TYPE) { return function(it$1) { var state; if (!isObject$3(it$1) || (state = get(it$1)).type !== TYPE) throw new TypeError$1("Incompatible receiver, " + TYPE + " required"); return state; }; }; if (NATIVE_WEAK_MAP || shared$2.state) { var store = shared$2.state || (shared$2.state = new WeakMap()); store.get = store.get; store.has = store.has; store.set = store.set; set$4 = function(it$1, metadata) { if (store.has(it$1)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED); metadata.facade = it$1; store.set(it$1, metadata); return metadata; }; get = function(it$1) { return store.get(it$1) || {}; }; has = function(it$1) { return store.has(it$1); }; } else { var STATE = sharedKey$2("state"); hiddenKeys$2[STATE] = true; set$4 = function(it$1, metadata) { if (hasOwn(it$1, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED); metadata.facade = it$1; createNonEnumerableProperty$2(it$1, STATE, metadata); return metadata; }; get = function(it$1) { return hasOwn(it$1, STATE) ? it$1[STATE] : {}; }; has = function(it$1) { return hasOwn(it$1, STATE); }; } internalState$1 = { set: set$4, get, has, enforce, getterFor }; return internalState$1; } var arrayIteration$1; var hasRequiredArrayIteration$1; function requireArrayIteration$1() { if (hasRequiredArrayIteration$1) return arrayIteration$1; hasRequiredArrayIteration$1 = 1; var bind$5 = /* @__PURE__ */ requireFunctionBindContext$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var IndexedObject = /* @__PURE__ */ requireIndexedObject$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var arraySpeciesCreate$2 = /* @__PURE__ */ requireArraySpeciesCreate$1(); var push = uncurryThis([].push); var createMethod = function(TYPE) { var IS_MAP = TYPE === 1; var IS_FILTER = TYPE === 2; var IS_SOME = TYPE === 3; var IS_EVERY = TYPE === 4; var IS_FIND_INDEX = TYPE === 6; var IS_FILTER_REJECT = TYPE === 7; var NO_HOLES = TYPE === 5 || IS_FIND_INDEX; return function($this, callbackfn, that, specificCreate) { var O = toObject$2($this); var self$1 = IndexedObject(O); var length$1 = lengthOfArrayLike$2(self$1); var boundFunction = bind$5(callbackfn, that); var index$1 = 0; var create$4 = specificCreate || arraySpeciesCreate$2; var target = IS_MAP ? create$4($this, length$1) : IS_FILTER || IS_FILTER_REJECT ? create$4($this, 0) : void 0; var value, result; for (; length$1 > index$1; index$1++) if (NO_HOLES || index$1 in self$1) { value = self$1[index$1]; result = boundFunction(value, index$1, O); if (TYPE) if (IS_MAP) target[index$1] = result; else if (result) switch (TYPE) { case 3: return true; case 5: return value; case 6: return index$1; case 2: push(target, value); } else switch (TYPE) { case 4: return false; case 7: push(target, value); } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; arrayIteration$1 = { forEach: createMethod(0), map: createMethod(1), filter: createMethod(2), some: createMethod(3), every: createMethod(4), find: createMethod(5), findIndex: createMethod(6), filterReject: createMethod(7) }; return arrayIteration$1; } var hasRequiredEs_symbol_constructor$1; function requireEs_symbol_constructor$1() { if (hasRequiredEs_symbol_constructor$1) return es_symbol_constructor$1; hasRequiredEs_symbol_constructor$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var call = /* @__PURE__ */ requireFunctionCall$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var IS_PURE = /* @__PURE__ */ requireIsPure$1(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var toPropertyKey$3 = /* @__PURE__ */ requireToPropertyKey$1(); var $toString = /* @__PURE__ */ requireToString$1(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor$1(); var nativeObjectCreate = /* @__PURE__ */ requireObjectCreate$1(); var objectKeys$2 = /* @__PURE__ */ requireObjectKeys$1(); var getOwnPropertyNamesModule = /* @__PURE__ */ requireObjectGetOwnPropertyNames$1(); var getOwnPropertyNamesExternal = /* @__PURE__ */ requireObjectGetOwnPropertyNamesExternal$1(); var getOwnPropertySymbolsModule = /* @__PURE__ */ requireObjectGetOwnPropertySymbols$1(); var getOwnPropertyDescriptorModule = /* @__PURE__ */ requireObjectGetOwnPropertyDescriptor$1(); var definePropertyModule = /* @__PURE__ */ requireObjectDefineProperty$1(); var definePropertiesModule = /* @__PURE__ */ requireObjectDefineProperties$1(); var propertyIsEnumerableModule = /* @__PURE__ */ requireObjectPropertyIsEnumerable$1(); var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn$1(); var defineBuiltInAccessor$2 = /* @__PURE__ */ requireDefineBuiltInAccessor$1(); var shared$2 = /* @__PURE__ */ requireShared$1(); var sharedKey$2 = /* @__PURE__ */ requireSharedKey$1(); var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys$1(); var uid$2 = /* @__PURE__ */ requireUid$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var wrappedWellKnownSymbolModule = /* @__PURE__ */ requireWellKnownSymbolWrapped$1(); var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); var defineSymbolToPrimitive = /* @__PURE__ */ requireSymbolDefineToPrimitive$1(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag$1(); var InternalStateModule = /* @__PURE__ */ requireInternalState$1(); var $forEach = requireArrayIteration$1().forEach; var HIDDEN = sharedKey$2("hidden"); var SYMBOL = "Symbol"; var PROTOTYPE = "prototype"; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(SYMBOL); var ObjectPrototype = Object[PROTOTYPE]; var $Symbol = globalThis$1.Symbol; var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; var RangeError$1 = globalThis$1.RangeError; var TypeError$1 = globalThis$1.TypeError; var QObject = globalThis$1.QObject; var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; var push = uncurryThis([].push); var AllSymbols = shared$2("symbols"); var ObjectPrototypeSymbols = shared$2("op-symbols"); var WellKnownSymbolsStore = shared$2("wks"); var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; var fallbackDefineProperty = function(O, P, Attributes) { var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; nativeDefineProperty(O, P, Attributes); if (ObjectPrototypeDescriptor && O !== ObjectPrototype) nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); }; var setSymbolDescriptor = DESCRIPTORS && fails$2(function() { return nativeObjectCreate(nativeDefineProperty({}, "a", { get: function() { return nativeDefineProperty(this, "a", { value: 7 }).a; } })).a !== 7; }) ? fallbackDefineProperty : nativeDefineProperty; var wrap = function(tag, description) { var symbol$6 = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype); setInternalState(symbol$6, { type: SYMBOL, tag, description }); if (!DESCRIPTORS) symbol$6.description = description; return symbol$6; }; var $defineProperty = function defineProperty$7(O, P, Attributes) { if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); anObject$2(O); var key = toPropertyKey$3(P); anObject$2(Attributes); if (hasOwn(AllSymbols, key)) { if (!Attributes.enumerable) { if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor$2(1, nativeObjectCreate(null))); O[HIDDEN][key] = true; } else { if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor$2(0, false) }); } return setSymbolDescriptor(O, key, Attributes); } return nativeDefineProperty(O, key, Attributes); }; var $defineProperties = function defineProperties$4(O, Properties) { anObject$2(O); var properties = toIndexedObject$2(Properties); var keys$8 = objectKeys$2(properties).concat($getOwnPropertySymbols(properties)); $forEach(keys$8, function(key) { if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]); }); return O; }; var $create = function create$4(O, Properties) { return Properties === void 0 ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); }; var $propertyIsEnumerable = function propertyIsEnumerable(V) { var P = toPropertyKey$3(V); var enumerable = call(nativePropertyIsEnumerable, this, P); if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false; return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor$4(O, P) { var it$1 = toIndexedObject$2(O); var key = toPropertyKey$3(P); if (it$1 === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return; var descriptor = nativeGetOwnPropertyDescriptor(it$1, key); if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it$1, HIDDEN) && it$1[HIDDEN][key])) descriptor.enumerable = true; return descriptor; }; var $getOwnPropertyNames = function getOwnPropertyNames$3(O) { var names = nativeGetOwnPropertyNames(toIndexedObject$2(O)); var result = []; $forEach(names, function(key) { if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys$2, key)) push(result, key); }); return result; }; var $getOwnPropertySymbols = function(O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject$2(O)); var result = []; $forEach(names, function(key) { if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) push(result, AllSymbols[key]); }); return result; }; if (!NATIVE_SYMBOL) { $Symbol = function Symbol$1() { if (isPrototypeOf(SymbolPrototype, this)) throw new TypeError$1("Symbol is not a constructor"); var description = !arguments.length || arguments[0] === void 0 ? void 0 : $toString(arguments[0]); var tag = uid$2(description); var setter = function(value) { var $this = this === void 0 ? globalThis$1 : this; if ($this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); if (hasOwn($this, HIDDEN) && hasOwn($this[HIDDEN], tag)) $this[HIDDEN][tag] = false; var descriptor = createPropertyDescriptor$2(1, value); try { setSymbolDescriptor($this, tag, descriptor); } catch (error) { if (!(error instanceof RangeError$1)) throw error; fallbackDefineProperty($this, tag, descriptor); } }; if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); return wrap(tag, description); }; SymbolPrototype = $Symbol[PROTOTYPE]; defineBuiltIn$2(SymbolPrototype, "toString", function toString$2() { return getInternalState(this).tag; }); defineBuiltIn$2($Symbol, "withoutSetter", function(description) { return wrap(uid$2(description), description); }); propertyIsEnumerableModule.f = $propertyIsEnumerable; definePropertyModule.f = $defineProperty; definePropertiesModule.f = $defineProperties; getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; wrappedWellKnownSymbolModule.f = function(name) { return wrap(wellKnownSymbol$2(name), name); }; if (DESCRIPTORS) { defineBuiltInAccessor$2(SymbolPrototype, "description", { configurable: true, get: function description() { return getInternalState(this).description; } }); if (!IS_PURE) defineBuiltIn$2(ObjectPrototype, "propertyIsEnumerable", $propertyIsEnumerable, { unsafe: true }); } } $({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, { Symbol: $Symbol }); $forEach(objectKeys$2(WellKnownSymbolsStore), function(name) { defineWellKnownSymbol(name); }); $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, { useSetter: function() { USE_SETTER = true; }, useSimple: function() { USE_SETTER = false; } }); $({ target: "Object", stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { create: $create, defineProperty: $defineProperty, defineProperties: $defineProperties, getOwnPropertyDescriptor: $getOwnPropertyDescriptor }); $({ target: "Object", stat: true, forced: !NATIVE_SYMBOL }, { getOwnPropertyNames: $getOwnPropertyNames }); defineSymbolToPrimitive(); setToStringTag$2($Symbol, SYMBOL); hiddenKeys$2[HIDDEN] = true; return es_symbol_constructor$1; } var es_symbol_for$1 = {}; var symbolRegistryDetection$1; var hasRequiredSymbolRegistryDetection$1; function requireSymbolRegistryDetection$1() { if (hasRequiredSymbolRegistryDetection$1) return symbolRegistryDetection$1; hasRequiredSymbolRegistryDetection$1 = 1; var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection$1(); symbolRegistryDetection$1 = NATIVE_SYMBOL && !!Symbol["for"] && !!Symbol.keyFor; return symbolRegistryDetection$1; } var hasRequiredEs_symbol_for$1; function requireEs_symbol_for$1() { if (hasRequiredEs_symbol_for$1) return es_symbol_for$1; hasRequiredEs_symbol_for$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var toString$2 = /* @__PURE__ */ requireToString$1(); var shared$2 = /* @__PURE__ */ requireShared$1(); var NATIVE_SYMBOL_REGISTRY = /* @__PURE__ */ requireSymbolRegistryDetection$1(); var StringToSymbolRegistry = shared$2("string-to-symbol-registry"); var SymbolToStringRegistry = shared$2("symbol-to-string-registry"); $({ target: "Symbol", stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { "for": function(key) { var string$1 = toString$2(key); if (hasOwn(StringToSymbolRegistry, string$1)) return StringToSymbolRegistry[string$1]; var symbol$6 = getBuiltIn$2("Symbol")(string$1); StringToSymbolRegistry[string$1] = symbol$6; SymbolToStringRegistry[symbol$6] = string$1; return symbol$6; } }); return es_symbol_for$1; } var es_symbol_keyFor$1 = {}; var hasRequiredEs_symbol_keyFor$1; function requireEs_symbol_keyFor$1() { if (hasRequiredEs_symbol_keyFor$1) return es_symbol_keyFor$1; hasRequiredEs_symbol_keyFor$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol$1(); var tryToString$2 = /* @__PURE__ */ requireTryToString$1(); var shared$2 = /* @__PURE__ */ requireShared$1(); var NATIVE_SYMBOL_REGISTRY = /* @__PURE__ */ requireSymbolRegistryDetection$1(); var SymbolToStringRegistry = shared$2("symbol-to-string-registry"); $({ target: "Symbol", stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { keyFor: function keyFor(sym) { if (!isSymbol$2(sym)) throw new TypeError(tryToString$2(sym) + " is not a symbol"); if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; } }); return es_symbol_keyFor$1; } var es_json_stringify$1 = {}; var getJsonReplacerFunction$1; var hasRequiredGetJsonReplacerFunction$1; function requireGetJsonReplacerFunction$1() { if (hasRequiredGetJsonReplacerFunction$1) return getJsonReplacerFunction$1; hasRequiredGetJsonReplacerFunction$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var isArray$5 = /* @__PURE__ */ requireIsArray$3$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var classof$2 = /* @__PURE__ */ requireClassofRaw$1(); var toString$2 = /* @__PURE__ */ requireToString$1(); var push = uncurryThis([].push); getJsonReplacerFunction$1 = function(replacer) { if (isCallable$2(replacer)) return replacer; if (!isArray$5(replacer)) return; var rawLength = replacer.length; var keys$8 = []; for (var i = 0; i < rawLength; i++) { var element = replacer[i]; if (typeof element == "string") push(keys$8, element); else if (typeof element == "number" || classof$2(element) === "Number" || classof$2(element) === "String") push(keys$8, toString$2(element)); } var keysLength = keys$8.length; var root = true; return function(key, value) { if (root) { root = false; return value; } if (isArray$5(this)) return value; for (var j = 0; j < keysLength; j++) if (keys$8[j] === key) return value; }; }; return getJsonReplacerFunction$1; } var hasRequiredEs_json_stringify$1; function requireEs_json_stringify$1() { if (hasRequiredEs_json_stringify$1) return es_json_stringify$1; hasRequiredEs_json_stringify$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var apply = /* @__PURE__ */ requireFunctionApply$1(); var call = /* @__PURE__ */ requireFunctionCall$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol$1(); var arraySlice$2 = /* @__PURE__ */ requireArraySlice$1(); var getReplacerFunction = /* @__PURE__ */ requireGetJsonReplacerFunction$1(); var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection$1(); var $String = String; var $stringify = getBuiltIn$2("JSON", "stringify"); var exec = uncurryThis(/./.exec); var charAt = uncurryThis("".charAt); var charCodeAt = uncurryThis("".charCodeAt); var replace = uncurryThis("".replace); var numberToString = uncurryThis(1.1.toString); var tester = /[\uD800-\uDFFF]/g; var low = /^[\uD800-\uDBFF]$/; var hi = /^[\uDC00-\uDFFF]$/; var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails$2(function() { var symbol$6 = getBuiltIn$2("Symbol")("stringify detection"); return $stringify([symbol$6]) !== "[null]" || $stringify({ a: symbol$6 }) !== "{}" || $stringify(Object(symbol$6)) !== "{}"; }); var ILL_FORMED_UNICODE = fails$2(function() { return $stringify('\uDF06\uD834') !== "\"\\udf06\\ud834\"" || $stringify('\uDEAD') !== "\"\\udead\""; }); var stringifyWithSymbolsFix = function(it$1, replacer) { var args = arraySlice$2(arguments); var $replacer = getReplacerFunction(replacer); if (!isCallable$2($replacer) && (it$1 === void 0 || isSymbol$2(it$1))) return; args[1] = function(key, value) { if (isCallable$2($replacer)) value = call($replacer, this, $String(key), value); if (!isSymbol$2(value)) return value; }; return apply($stringify, null, args); }; var fixIllFormed = function(match, offset, string$1) { var prev = charAt(string$1, offset - 1); var next$1 = charAt(string$1, offset + 1); if (exec(low, match) && !exec(hi, next$1) || exec(hi, match) && !exec(low, prev)) return "\\u" + numberToString(charCodeAt(match, 0), 16); return match; }; if ($stringify) $({ target: "JSON", stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, { stringify: function stringify$4(it$1, replacer, space) { var args = arraySlice$2(arguments); var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args); return ILL_FORMED_UNICODE && typeof result == "string" ? replace(result, tester, fixIllFormed) : result; } }); return es_json_stringify$1; } var es_object_getOwnPropertySymbols$1 = {}; var hasRequiredEs_object_getOwnPropertySymbols$1; function requireEs_object_getOwnPropertySymbols$1() { if (hasRequiredEs_object_getOwnPropertySymbols$1) return es_object_getOwnPropertySymbols$1; hasRequiredEs_object_getOwnPropertySymbols$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var getOwnPropertySymbolsModule = /* @__PURE__ */ requireObjectGetOwnPropertySymbols$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var FORCED = !NATIVE_SYMBOL || fails$2(function() { getOwnPropertySymbolsModule.f(1); }); $({ target: "Object", stat: true, forced: FORCED }, { getOwnPropertySymbols: function getOwnPropertySymbols$4(it$1) { var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject$2(it$1)) : []; } }); return es_object_getOwnPropertySymbols$1; } var hasRequiredEs_symbol$1; function requireEs_symbol$1() { if (hasRequiredEs_symbol$1) return es_symbol$1; hasRequiredEs_symbol$1 = 1; requireEs_symbol_constructor$1(); requireEs_symbol_for$1(); requireEs_symbol_keyFor$1(); requireEs_json_stringify$1(); requireEs_object_getOwnPropertySymbols$1(); return es_symbol$1; } var es_symbol_asyncDispose$1 = {}; var hasRequiredEs_symbol_asyncDispose$1; function requireEs_symbol_asyncDispose$1() { if (hasRequiredEs_symbol_asyncDispose$1) return es_symbol_asyncDispose$1; hasRequiredEs_symbol_asyncDispose$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("asyncDispose"); return es_symbol_asyncDispose$1; } var es_symbol_asyncIterator$1 = {}; var hasRequiredEs_symbol_asyncIterator$1; function requireEs_symbol_asyncIterator$1() { if (hasRequiredEs_symbol_asyncIterator$1) return es_symbol_asyncIterator$1; hasRequiredEs_symbol_asyncIterator$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("asyncIterator"); return es_symbol_asyncIterator$1; } var es_symbol_dispose$1 = {}; var hasRequiredEs_symbol_dispose$1; function requireEs_symbol_dispose$1() { if (hasRequiredEs_symbol_dispose$1) return es_symbol_dispose$1; hasRequiredEs_symbol_dispose$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("dispose"); return es_symbol_dispose$1; } var es_symbol_hasInstance$1 = {}; var hasRequiredEs_symbol_hasInstance$1; function requireEs_symbol_hasInstance$1() { if (hasRequiredEs_symbol_hasInstance$1) return es_symbol_hasInstance$1; hasRequiredEs_symbol_hasInstance$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("hasInstance"); return es_symbol_hasInstance$1; } var es_symbol_isConcatSpreadable$1 = {}; var hasRequiredEs_symbol_isConcatSpreadable$1; function requireEs_symbol_isConcatSpreadable$1() { if (hasRequiredEs_symbol_isConcatSpreadable$1) return es_symbol_isConcatSpreadable$1; hasRequiredEs_symbol_isConcatSpreadable$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("isConcatSpreadable"); return es_symbol_isConcatSpreadable$1; } var es_symbol_iterator$1 = {}; var hasRequiredEs_symbol_iterator$1; function requireEs_symbol_iterator$1() { if (hasRequiredEs_symbol_iterator$1) return es_symbol_iterator$1; hasRequiredEs_symbol_iterator$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("iterator"); return es_symbol_iterator$1; } var es_symbol_match$1 = {}; var hasRequiredEs_symbol_match$1; function requireEs_symbol_match$1() { if (hasRequiredEs_symbol_match$1) return es_symbol_match$1; hasRequiredEs_symbol_match$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("match"); return es_symbol_match$1; } var es_symbol_matchAll$1 = {}; var hasRequiredEs_symbol_matchAll$1; function requireEs_symbol_matchAll$1() { if (hasRequiredEs_symbol_matchAll$1) return es_symbol_matchAll$1; hasRequiredEs_symbol_matchAll$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("matchAll"); return es_symbol_matchAll$1; } var es_symbol_replace$1 = {}; var hasRequiredEs_symbol_replace$1; function requireEs_symbol_replace$1() { if (hasRequiredEs_symbol_replace$1) return es_symbol_replace$1; hasRequiredEs_symbol_replace$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("replace"); return es_symbol_replace$1; } var es_symbol_search$1 = {}; var hasRequiredEs_symbol_search$1; function requireEs_symbol_search$1() { if (hasRequiredEs_symbol_search$1) return es_symbol_search$1; hasRequiredEs_symbol_search$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("search"); return es_symbol_search$1; } var es_symbol_species$1 = {}; var hasRequiredEs_symbol_species$1; function requireEs_symbol_species$1() { if (hasRequiredEs_symbol_species$1) return es_symbol_species$1; hasRequiredEs_symbol_species$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("species"); return es_symbol_species$1; } var es_symbol_split$1 = {}; var hasRequiredEs_symbol_split$1; function requireEs_symbol_split$1() { if (hasRequiredEs_symbol_split$1) return es_symbol_split$1; hasRequiredEs_symbol_split$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("split"); return es_symbol_split$1; } var es_symbol_toPrimitive$1 = {}; var hasRequiredEs_symbol_toPrimitive$1; function requireEs_symbol_toPrimitive$1() { if (hasRequiredEs_symbol_toPrimitive$1) return es_symbol_toPrimitive$1; hasRequiredEs_symbol_toPrimitive$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); var defineSymbolToPrimitive = /* @__PURE__ */ requireSymbolDefineToPrimitive$1(); defineWellKnownSymbol("toPrimitive"); defineSymbolToPrimitive(); return es_symbol_toPrimitive$1; } var es_symbol_toStringTag$1 = {}; var hasRequiredEs_symbol_toStringTag$1; function requireEs_symbol_toStringTag$1() { if (hasRequiredEs_symbol_toStringTag$1) return es_symbol_toStringTag$1; hasRequiredEs_symbol_toStringTag$1 = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag$1(); defineWellKnownSymbol("toStringTag"); setToStringTag$2(getBuiltIn$2("Symbol"), "Symbol"); return es_symbol_toStringTag$1; } var es_symbol_unscopables$1 = {}; var hasRequiredEs_symbol_unscopables$1; function requireEs_symbol_unscopables$1() { if (hasRequiredEs_symbol_unscopables$1) return es_symbol_unscopables$1; hasRequiredEs_symbol_unscopables$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("unscopables"); return es_symbol_unscopables$1; } var es_json_toStringTag$1 = {}; var hasRequiredEs_json_toStringTag$1; function requireEs_json_toStringTag$1() { if (hasRequiredEs_json_toStringTag$1) return es_json_toStringTag$1; hasRequiredEs_json_toStringTag$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag$1(); setToStringTag$2(globalThis$1.JSON, "JSON", true); return es_json_toStringTag$1; } var symbol$4$1; var hasRequiredSymbol$4$1; function requireSymbol$4$1() { if (hasRequiredSymbol$4$1) return symbol$4$1; hasRequiredSymbol$4$1 = 1; requireEs_array_concat$1(); requireEs_symbol$1(); requireEs_symbol_asyncDispose$1(); requireEs_symbol_asyncIterator$1(); requireEs_symbol_dispose$1(); requireEs_symbol_hasInstance$1(); requireEs_symbol_isConcatSpreadable$1(); requireEs_symbol_iterator$1(); requireEs_symbol_match$1(); requireEs_symbol_matchAll$1(); requireEs_symbol_replace$1(); requireEs_symbol_search$1(); requireEs_symbol_species$1(); requireEs_symbol_split$1(); requireEs_symbol_toPrimitive$1(); requireEs_symbol_toStringTag$1(); requireEs_symbol_unscopables$1(); requireEs_json_toStringTag$1(); var path$2 = /* @__PURE__ */ requirePath$1(); symbol$4$1 = path$2.Symbol; return symbol$4$1; } var web_domCollections_iterator$1 = {}; var addToUnscopables$1; var hasRequiredAddToUnscopables$1; function requireAddToUnscopables$1() { if (hasRequiredAddToUnscopables$1) return addToUnscopables$1; hasRequiredAddToUnscopables$1 = 1; addToUnscopables$1 = function() {}; return addToUnscopables$1; } var iterators$1; var hasRequiredIterators$1; function requireIterators$1() { if (hasRequiredIterators$1) return iterators$1; hasRequiredIterators$1 = 1; iterators$1 = {}; return iterators$1; } var functionName$1; var hasRequiredFunctionName$1; function requireFunctionName$1() { if (hasRequiredFunctionName$1) return functionName$1; hasRequiredFunctionName$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var FunctionPrototype = Function.prototype; var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; var EXISTS = hasOwn(FunctionPrototype, "name"); var PROPER = EXISTS && function something() {}.name === "something"; var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable); functionName$1 = { EXISTS, PROPER, CONFIGURABLE }; return functionName$1; } var correctPrototypeGetter$1; var hasRequiredCorrectPrototypeGetter$1; function requireCorrectPrototypeGetter$1() { if (hasRequiredCorrectPrototypeGetter$1) return correctPrototypeGetter$1; hasRequiredCorrectPrototypeGetter$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); correctPrototypeGetter$1 = !fails$2(function() { function F() {} F.prototype.constructor = null; return Object.getPrototypeOf(new F()) !== F.prototype; }); return correctPrototypeGetter$1; } var objectGetPrototypeOf$1; var hasRequiredObjectGetPrototypeOf$1; function requireObjectGetPrototypeOf$1() { if (hasRequiredObjectGetPrototypeOf$1) return objectGetPrototypeOf$1; hasRequiredObjectGetPrototypeOf$1 = 1; var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var sharedKey$2 = /* @__PURE__ */ requireSharedKey$1(); var CORRECT_PROTOTYPE_GETTER = /* @__PURE__ */ requireCorrectPrototypeGetter$1(); var IE_PROTO = sharedKey$2("IE_PROTO"); var $Object = Object; var ObjectPrototype = $Object.prototype; objectGetPrototypeOf$1 = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function(O) { var object$1 = toObject$2(O); if (hasOwn(object$1, IE_PROTO)) return object$1[IE_PROTO]; var constructor = object$1.constructor; if (isCallable$2(constructor) && object$1 instanceof constructor) return constructor.prototype; return object$1 instanceof $Object ? ObjectPrototype : null; }; return objectGetPrototypeOf$1; } var iteratorsCore$1; var hasRequiredIteratorsCore$1; function requireIteratorsCore$1() { if (hasRequiredIteratorsCore$1) return iteratorsCore$1; hasRequiredIteratorsCore$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var create$4 = /* @__PURE__ */ requireObjectCreate$1(); var getPrototypeOf = /* @__PURE__ */ requireObjectGetPrototypeOf$1(); var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var IS_PURE = /* @__PURE__ */ requireIsPure$1(); var ITERATOR = wellKnownSymbol$2("iterator"); var BUGGY_SAFARI_ITERATORS = false; var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; if ([].keys) { arrayIterator = [].keys(); if (!("next" in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; else { PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; } } var NEW_ITERATOR_PROTOTYPE = !isObject$3(IteratorPrototype) || fails$2(function() { var test = {}; return IteratorPrototype[ITERATOR].call(test) !== test; }); if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; else if (IS_PURE) IteratorPrototype = create$4(IteratorPrototype); if (!isCallable$2(IteratorPrototype[ITERATOR])) defineBuiltIn$2(IteratorPrototype, ITERATOR, function() { return this; }); iteratorsCore$1 = { IteratorPrototype, BUGGY_SAFARI_ITERATORS }; return iteratorsCore$1; } var iteratorCreateConstructor$1; var hasRequiredIteratorCreateConstructor$1; function requireIteratorCreateConstructor$1() { if (hasRequiredIteratorCreateConstructor$1) return iteratorCreateConstructor$1; hasRequiredIteratorCreateConstructor$1 = 1; var IteratorPrototype = requireIteratorsCore$1().IteratorPrototype; var create$4 = /* @__PURE__ */ requireObjectCreate$1(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor$1(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag$1(); var Iterators = /* @__PURE__ */ requireIterators$1(); var returnThis = function() { return this; }; iteratorCreateConstructor$1 = function(IteratorConstructor, NAME, next$1, ENUMERABLE_NEXT) { var TO_STRING_TAG = NAME + " Iterator"; IteratorConstructor.prototype = create$4(IteratorPrototype, { next: createPropertyDescriptor$2(+!ENUMERABLE_NEXT, next$1) }); setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false, true); Iterators[TO_STRING_TAG] = returnThis; return IteratorConstructor; }; return iteratorCreateConstructor$1; } var functionUncurryThisAccessor$1; var hasRequiredFunctionUncurryThisAccessor$1; function requireFunctionUncurryThisAccessor$1() { if (hasRequiredFunctionUncurryThisAccessor$1) return functionUncurryThisAccessor$1; hasRequiredFunctionUncurryThisAccessor$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var aCallable$2 = /* @__PURE__ */ requireACallable$1(); functionUncurryThisAccessor$1 = function(object$1, key, method) { try { return uncurryThis(aCallable$2(Object.getOwnPropertyDescriptor(object$1, key)[method])); } catch (error) {} }; return functionUncurryThisAccessor$1; } var isPossiblePrototype$1; var hasRequiredIsPossiblePrototype$1; function requireIsPossiblePrototype$1() { if (hasRequiredIsPossiblePrototype$1) return isPossiblePrototype$1; hasRequiredIsPossiblePrototype$1 = 1; var isObject$3 = /* @__PURE__ */ requireIsObject$1(); isPossiblePrototype$1 = function(argument) { return isObject$3(argument) || argument === null; }; return isPossiblePrototype$1; } var aPossiblePrototype$1; var hasRequiredAPossiblePrototype$1; function requireAPossiblePrototype$1() { if (hasRequiredAPossiblePrototype$1) return aPossiblePrototype$1; hasRequiredAPossiblePrototype$1 = 1; var isPossiblePrototype$2 = /* @__PURE__ */ requireIsPossiblePrototype$1(); var $String = String; var $TypeError = TypeError; aPossiblePrototype$1 = function(argument) { if (isPossiblePrototype$2(argument)) return argument; throw new $TypeError("Can't set " + $String(argument) + " as a prototype"); }; return aPossiblePrototype$1; } var objectSetPrototypeOf$1; var hasRequiredObjectSetPrototypeOf$1; function requireObjectSetPrototypeOf$1() { if (hasRequiredObjectSetPrototypeOf$1) return objectSetPrototypeOf$1; hasRequiredObjectSetPrototypeOf$1 = 1; var uncurryThisAccessor = /* @__PURE__ */ requireFunctionUncurryThisAccessor$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible$1(); var aPossiblePrototype$2 = /* @__PURE__ */ requireAPossiblePrototype$1(); objectSetPrototypeOf$1 = Object.setPrototypeOf || ("__proto__" in {} ? function() { var CORRECT_SETTER = false; var test = {}; var setter; try { setter = uncurryThisAccessor(Object.prototype, "__proto__", "set"); setter(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) {} return function setPrototypeOf(O, proto) { requireObjectCoercible$2(O); aPossiblePrototype$2(proto); if (!isObject$3(O)) return O; if (CORRECT_SETTER) setter(O, proto); else O.__proto__ = proto; return O; }; }() : void 0); return objectSetPrototypeOf$1; } var iteratorDefine$1; var hasRequiredIteratorDefine$1; function requireIteratorDefine$1() { if (hasRequiredIteratorDefine$1) return iteratorDefine$1; hasRequiredIteratorDefine$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var call = /* @__PURE__ */ requireFunctionCall$1(); var IS_PURE = /* @__PURE__ */ requireIsPure$1(); var FunctionName = /* @__PURE__ */ requireFunctionName$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var createIteratorConstructor = /* @__PURE__ */ requireIteratorCreateConstructor$1(); var getPrototypeOf = /* @__PURE__ */ requireObjectGetPrototypeOf$1(); var setPrototypeOf = /* @__PURE__ */ requireObjectSetPrototypeOf$1(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag$1(); var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty$1(); var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var Iterators = /* @__PURE__ */ requireIterators$1(); var IteratorsCore = /* @__PURE__ */ requireIteratorsCore$1(); var PROPER_FUNCTION_NAME = FunctionName.PROPER; var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR = wellKnownSymbol$2("iterator"); var KEYS = "keys"; var VALUES = "values"; var ENTRIES = "entries"; var returnThis = function() { return this; }; iteratorDefine$1 = function(Iterable, NAME, IteratorConstructor, next$1, DEFAULT, IS_SET, FORCED) { createIteratorConstructor(IteratorConstructor, NAME, next$1); var getIterationMethod = function(KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND]; switch (KIND) { case KEYS: return function keys$8() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values$8() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries$4() { return new IteratorConstructor(this, KIND); }; } return function() { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + " Iterator"; var INCORRECT_VALUES_NAME = false; var IterablePrototype = Iterable.prototype; var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype["@@iterator"] || DEFAULT && IterablePrototype[DEFAULT]; var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); var anyNativeIterator = NAME === "Array" ? IterablePrototype.entries || nativeIterator : nativeIterator; var CurrentIteratorPrototype, methods, KEY; if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf) setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); else if (!isCallable$2(CurrentIteratorPrototype[ITERATOR])) defineBuiltIn$2(CurrentIteratorPrototype, ITERATOR, returnThis); } setToStringTag$2(CurrentIteratorPrototype, TO_STRING_TAG, true, true); if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; } } if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) createNonEnumerableProperty$2(IterablePrototype, "name", VALUES); else { INCORRECT_VALUES_NAME = true; defaultIterator = function values$8() { return call(nativeIterator, this); }; } if (DEFAULT) { methods = { values: getIterationMethod(VALUES), keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), entries: getIterationMethod(ENTRIES) }; if (FORCED) { for (KEY in methods) if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]); } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) defineBuiltIn$2(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT }); Iterators[NAME] = defaultIterator; return methods; }; return iteratorDefine$1; } var createIterResultObject$1; var hasRequiredCreateIterResultObject$1; function requireCreateIterResultObject$1() { if (hasRequiredCreateIterResultObject$1) return createIterResultObject$1; hasRequiredCreateIterResultObject$1 = 1; createIterResultObject$1 = function(value, done) { return { value, done }; }; return createIterResultObject$1; } var es_array_iterator$1; var hasRequiredEs_array_iterator$1; function requireEs_array_iterator$1() { if (hasRequiredEs_array_iterator$1) return es_array_iterator$1; hasRequiredEs_array_iterator$1 = 1; var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var addToUnscopables$2 = /* @__PURE__ */ requireAddToUnscopables$1(); var Iterators = /* @__PURE__ */ requireIterators$1(); var InternalStateModule = /* @__PURE__ */ requireInternalState$1(); var defineProperty$7 = requireObjectDefineProperty$1().f; var defineIterator = /* @__PURE__ */ requireIteratorDefine$1(); var createIterResultObject$2 = /* @__PURE__ */ requireCreateIterResultObject$1(); var IS_PURE = /* @__PURE__ */ requireIsPure$1(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var ARRAY_ITERATOR = "Array Iterator"; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); es_array_iterator$1 = defineIterator(Array, "Array", function(iterated, kind) { setInternalState(this, { type: ARRAY_ITERATOR, target: toIndexedObject$2(iterated), index: 0, kind }); }, function() { var state = getInternalState(this); var target = state.target; var index$1 = state.index++; if (!target || index$1 >= target.length) { state.target = null; return createIterResultObject$2(void 0, true); } switch (state.kind) { case "keys": return createIterResultObject$2(index$1, false); case "values": return createIterResultObject$2(target[index$1], false); } return createIterResultObject$2([index$1, target[index$1]], false); }, "values"); var values$8 = Iterators.Arguments = Iterators.Array; addToUnscopables$2("keys"); addToUnscopables$2("values"); addToUnscopables$2("entries"); if (!IS_PURE && DESCRIPTORS && values$8.name !== "values") try { defineProperty$7(values$8, "name", { value: "values" }); } catch (error) {} return es_array_iterator$1; } var domIterables$1; var hasRequiredDomIterables$1; function requireDomIterables$1() { if (hasRequiredDomIterables$1) return domIterables$1; hasRequiredDomIterables$1 = 1; domIterables$1 = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; return domIterables$1; } var hasRequiredWeb_domCollections_iterator$1; function requireWeb_domCollections_iterator$1() { if (hasRequiredWeb_domCollections_iterator$1) return web_domCollections_iterator$1; hasRequiredWeb_domCollections_iterator$1 = 1; requireEs_array_iterator$1(); var DOMIterables = /* @__PURE__ */ requireDomIterables$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag$1(); var Iterators = /* @__PURE__ */ requireIterators$1(); for (var COLLECTION_NAME in DOMIterables) { setToStringTag$2(globalThis$1[COLLECTION_NAME], COLLECTION_NAME); Iterators[COLLECTION_NAME] = Iterators.Array; } return web_domCollections_iterator$1; } var symbol$3$1; var hasRequiredSymbol$3$1; function requireSymbol$3$1() { if (hasRequiredSymbol$3$1) return symbol$3$1; hasRequiredSymbol$3$1 = 1; var parent = /* @__PURE__ */ requireSymbol$4$1(); requireWeb_domCollections_iterator$1(); symbol$3$1 = parent; return symbol$3$1; } var esnext_function_metadata$1 = {}; var hasRequiredEsnext_function_metadata$1; function requireEsnext_function_metadata$1() { if (hasRequiredEsnext_function_metadata$1) return esnext_function_metadata$1; hasRequiredEsnext_function_metadata$1 = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var defineProperty$7 = requireObjectDefineProperty$1().f; var METADATA = wellKnownSymbol$2("metadata"); var FunctionPrototype = Function.prototype; if (FunctionPrototype[METADATA] === void 0) defineProperty$7(FunctionPrototype, METADATA, { value: null }); return esnext_function_metadata$1; } var esnext_symbol_asyncDispose$1 = {}; var hasRequiredEsnext_symbol_asyncDispose$1; function requireEsnext_symbol_asyncDispose$1() { if (hasRequiredEsnext_symbol_asyncDispose$1) return esnext_symbol_asyncDispose$1; hasRequiredEsnext_symbol_asyncDispose$1 = 1; requireEs_symbol_asyncDispose$1(); return esnext_symbol_asyncDispose$1; } var esnext_symbol_dispose$1 = {}; var hasRequiredEsnext_symbol_dispose$1; function requireEsnext_symbol_dispose$1() { if (hasRequiredEsnext_symbol_dispose$1) return esnext_symbol_dispose$1; hasRequiredEsnext_symbol_dispose$1 = 1; requireEs_symbol_dispose$1(); return esnext_symbol_dispose$1; } var esnext_symbol_metadata$1 = {}; var hasRequiredEsnext_symbol_metadata$1; function requireEsnext_symbol_metadata$1() { if (hasRequiredEsnext_symbol_metadata$1) return esnext_symbol_metadata$1; hasRequiredEsnext_symbol_metadata$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("metadata"); return esnext_symbol_metadata$1; } var symbol$2$1; var hasRequiredSymbol$2$1; function requireSymbol$2$1() { if (hasRequiredSymbol$2$1) return symbol$2$1; hasRequiredSymbol$2$1 = 1; var parent = /* @__PURE__ */ requireSymbol$3$1(); requireEsnext_function_metadata$1(); requireEsnext_symbol_asyncDispose$1(); requireEsnext_symbol_dispose$1(); requireEsnext_symbol_metadata$1(); symbol$2$1 = parent; return symbol$2$1; } var esnext_symbol_isRegisteredSymbol$1 = {}; var symbolIsRegistered$1; var hasRequiredSymbolIsRegistered$1; function requireSymbolIsRegistered$1() { if (hasRequiredSymbolIsRegistered$1) return symbolIsRegistered$1; hasRequiredSymbolIsRegistered$1 = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var Symbol$1 = getBuiltIn$2("Symbol"); var keyFor = Symbol$1.keyFor; var thisSymbolValue = uncurryThis(Symbol$1.prototype.valueOf); symbolIsRegistered$1 = Symbol$1.isRegisteredSymbol || function isRegisteredSymbol(value) { try { return keyFor(thisSymbolValue(value)) !== void 0; } catch (error) { return false; } }; return symbolIsRegistered$1; } var hasRequiredEsnext_symbol_isRegisteredSymbol$1; function requireEsnext_symbol_isRegisteredSymbol$1() { if (hasRequiredEsnext_symbol_isRegisteredSymbol$1) return esnext_symbol_isRegisteredSymbol$1; hasRequiredEsnext_symbol_isRegisteredSymbol$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var isRegisteredSymbol = /* @__PURE__ */ requireSymbolIsRegistered$1(); $({ target: "Symbol", stat: true }, { isRegisteredSymbol }); return esnext_symbol_isRegisteredSymbol$1; } var esnext_symbol_isWellKnownSymbol$1 = {}; var symbolIsWellKnown$1; var hasRequiredSymbolIsWellKnown$1; function requireSymbolIsWellKnown$1() { if (hasRequiredSymbolIsWellKnown$1) return symbolIsWellKnown$1; hasRequiredSymbolIsWellKnown$1 = 1; var shared$2 = /* @__PURE__ */ requireShared$1(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var Symbol$1 = getBuiltIn$2("Symbol"); var $isWellKnownSymbol = Symbol$1.isWellKnownSymbol; var getOwnPropertyNames$3 = getBuiltIn$2("Object", "getOwnPropertyNames"); var thisSymbolValue = uncurryThis(Symbol$1.prototype.valueOf); var WellKnownSymbolsStore = shared$2("wks"); for (var i = 0, symbolKeys = getOwnPropertyNames$3(Symbol$1), symbolKeysLength = symbolKeys.length; i < symbolKeysLength; i++) try { var symbolKey = symbolKeys[i]; if (isSymbol$2(Symbol$1[symbolKey])) wellKnownSymbol$2(symbolKey); } catch (error) {} symbolIsWellKnown$1 = function isWellKnownSymbol(value) { if ($isWellKnownSymbol && $isWellKnownSymbol(value)) return true; try { var symbol$6 = thisSymbolValue(value); for (var j = 0, keys$8 = getOwnPropertyNames$3(WellKnownSymbolsStore), keysLength = keys$8.length; j < keysLength; j++) if (WellKnownSymbolsStore[keys$8[j]] == symbol$6) return true; } catch (error) {} return false; }; return symbolIsWellKnown$1; } var hasRequiredEsnext_symbol_isWellKnownSymbol$1; function requireEsnext_symbol_isWellKnownSymbol$1() { if (hasRequiredEsnext_symbol_isWellKnownSymbol$1) return esnext_symbol_isWellKnownSymbol$1; hasRequiredEsnext_symbol_isWellKnownSymbol$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var isWellKnownSymbol = /* @__PURE__ */ requireSymbolIsWellKnown$1(); $({ target: "Symbol", stat: true, forced: true }, { isWellKnownSymbol }); return esnext_symbol_isWellKnownSymbol$1; } var esnext_symbol_customMatcher$1 = {}; var hasRequiredEsnext_symbol_customMatcher$1; function requireEsnext_symbol_customMatcher$1() { if (hasRequiredEsnext_symbol_customMatcher$1) return esnext_symbol_customMatcher$1; hasRequiredEsnext_symbol_customMatcher$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("customMatcher"); return esnext_symbol_customMatcher$1; } var esnext_symbol_observable$1 = {}; var hasRequiredEsnext_symbol_observable$1; function requireEsnext_symbol_observable$1() { if (hasRequiredEsnext_symbol_observable$1) return esnext_symbol_observable$1; hasRequiredEsnext_symbol_observable$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("observable"); return esnext_symbol_observable$1; } var esnext_symbol_isRegistered$1 = {}; var hasRequiredEsnext_symbol_isRegistered$1; function requireEsnext_symbol_isRegistered$1() { if (hasRequiredEsnext_symbol_isRegistered$1) return esnext_symbol_isRegistered$1; hasRequiredEsnext_symbol_isRegistered$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var isRegisteredSymbol = /* @__PURE__ */ requireSymbolIsRegistered$1(); $({ target: "Symbol", stat: true, name: "isRegisteredSymbol" }, { isRegistered: isRegisteredSymbol }); return esnext_symbol_isRegistered$1; } var esnext_symbol_isWellKnown$1 = {}; var hasRequiredEsnext_symbol_isWellKnown$1; function requireEsnext_symbol_isWellKnown$1() { if (hasRequiredEsnext_symbol_isWellKnown$1) return esnext_symbol_isWellKnown$1; hasRequiredEsnext_symbol_isWellKnown$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var isWellKnownSymbol = /* @__PURE__ */ requireSymbolIsWellKnown$1(); $({ target: "Symbol", stat: true, name: "isWellKnownSymbol", forced: true }, { isWellKnown: isWellKnownSymbol }); return esnext_symbol_isWellKnown$1; } var esnext_symbol_matcher$1 = {}; var hasRequiredEsnext_symbol_matcher$1; function requireEsnext_symbol_matcher$1() { if (hasRequiredEsnext_symbol_matcher$1) return esnext_symbol_matcher$1; hasRequiredEsnext_symbol_matcher$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("matcher"); return esnext_symbol_matcher$1; } var esnext_symbol_metadataKey$1 = {}; var hasRequiredEsnext_symbol_metadataKey$1; function requireEsnext_symbol_metadataKey$1() { if (hasRequiredEsnext_symbol_metadataKey$1) return esnext_symbol_metadataKey$1; hasRequiredEsnext_symbol_metadataKey$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("metadataKey"); return esnext_symbol_metadataKey$1; } var esnext_symbol_patternMatch$1 = {}; var hasRequiredEsnext_symbol_patternMatch$1; function requireEsnext_symbol_patternMatch$1() { if (hasRequiredEsnext_symbol_patternMatch$1) return esnext_symbol_patternMatch$1; hasRequiredEsnext_symbol_patternMatch$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("patternMatch"); return esnext_symbol_patternMatch$1; } var esnext_symbol_replaceAll$1 = {}; var hasRequiredEsnext_symbol_replaceAll$1; function requireEsnext_symbol_replaceAll$1() { if (hasRequiredEsnext_symbol_replaceAll$1) return esnext_symbol_replaceAll$1; hasRequiredEsnext_symbol_replaceAll$1 = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine$1(); defineWellKnownSymbol("replaceAll"); return esnext_symbol_replaceAll$1; } var symbol$1$1; var hasRequiredSymbol$1$1; function requireSymbol$1$1() { if (hasRequiredSymbol$1$1) return symbol$1$1; hasRequiredSymbol$1$1 = 1; var parent = /* @__PURE__ */ requireSymbol$2$1(); requireEsnext_symbol_isRegisteredSymbol$1(); requireEsnext_symbol_isWellKnownSymbol$1(); requireEsnext_symbol_customMatcher$1(); requireEsnext_symbol_observable$1(); requireEsnext_symbol_isRegistered$1(); requireEsnext_symbol_isWellKnown$1(); requireEsnext_symbol_matcher$1(); requireEsnext_symbol_metadataKey$1(); requireEsnext_symbol_patternMatch$1(); requireEsnext_symbol_replaceAll$1(); symbol$1$1 = parent; return symbol$1$1; } var symbol$5; var hasRequiredSymbol$5; function requireSymbol$5() { if (hasRequiredSymbol$5) return symbol$5; hasRequiredSymbol$5 = 1; symbol$5 = /* @__PURE__ */ requireSymbol$1$1(); return symbol$5; } var symbolExports$1 = /* @__PURE__ */ requireSymbol$5(); var _Symbol$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(symbolExports$1); var es_string_iterator$1 = {}; var stringMultibyte$1; var hasRequiredStringMultibyte$1; function requireStringMultibyte$1() { if (hasRequiredStringMultibyte$1) return stringMultibyte$1; hasRequiredStringMultibyte$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity$1(); var toString$2 = /* @__PURE__ */ requireToString$1(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible$1(); var charAt = uncurryThis("".charAt); var charCodeAt = uncurryThis("".charCodeAt); var stringSlice = uncurryThis("".slice); var createMethod = function(CONVERT_TO_STRING) { return function($this, pos) { var S = toString$2(requireObjectCoercible$2($this)); var position = toIntegerOrInfinity$2(pos); var size = S.length; var first$1, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? "" : void 0; first$1 = charCodeAt(S, position); return first$1 < 55296 || first$1 > 56319 || position + 1 === size || (second = charCodeAt(S, position + 1)) < 56320 || second > 57343 ? CONVERT_TO_STRING ? charAt(S, position) : first$1 : CONVERT_TO_STRING ? stringSlice(S, position, position + 2) : (first$1 - 55296 << 10) + (second - 56320) + 65536; }; }; stringMultibyte$1 = { codeAt: createMethod(false), charAt: createMethod(true) }; return stringMultibyte$1; } var hasRequiredEs_string_iterator$1; function requireEs_string_iterator$1() { if (hasRequiredEs_string_iterator$1) return es_string_iterator$1; hasRequiredEs_string_iterator$1 = 1; var charAt = requireStringMultibyte$1().charAt; var toString$2 = /* @__PURE__ */ requireToString$1(); var InternalStateModule = /* @__PURE__ */ requireInternalState$1(); var defineIterator = /* @__PURE__ */ requireIteratorDefine$1(); var createIterResultObject$2 = /* @__PURE__ */ requireCreateIterResultObject$1(); var STRING_ITERATOR = "String Iterator"; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); defineIterator(String, "String", function(iterated) { setInternalState(this, { type: STRING_ITERATOR, string: toString$2(iterated), index: 0 }); }, function next$1() { var state = getInternalState(this); var string$1 = state.string; var index$1 = state.index; var point; if (index$1 >= string$1.length) return createIterResultObject$2(void 0, true); point = charAt(string$1, index$1); state.index += point.length; return createIterResultObject$2(point, false); }); return es_string_iterator$1; } var iterator$5; var hasRequiredIterator$5; function requireIterator$5() { if (hasRequiredIterator$5) return iterator$5; hasRequiredIterator$5 = 1; requireEs_array_iterator$1(); requireEs_string_iterator$1(); requireEs_symbol_iterator$1(); var WrappedWellKnownSymbolModule = /* @__PURE__ */ requireWellKnownSymbolWrapped$1(); iterator$5 = WrappedWellKnownSymbolModule.f("iterator"); return iterator$5; } var iterator$4$1; var hasRequiredIterator$4$1; function requireIterator$4$1() { if (hasRequiredIterator$4$1) return iterator$4$1; hasRequiredIterator$4$1 = 1; var parent = /* @__PURE__ */ requireIterator$5(); requireWeb_domCollections_iterator$1(); iterator$4$1 = parent; return iterator$4$1; } var iterator$3$1; var hasRequiredIterator$3$1; function requireIterator$3$1() { if (hasRequiredIterator$3$1) return iterator$3$1; hasRequiredIterator$3$1 = 1; var parent = /* @__PURE__ */ requireIterator$4$1(); iterator$3$1 = parent; return iterator$3$1; } var iterator$2$1; var hasRequiredIterator$2$1; function requireIterator$2$1() { if (hasRequiredIterator$2$1) return iterator$2$1; hasRequiredIterator$2$1 = 1; var parent = /* @__PURE__ */ requireIterator$3$1(); iterator$2$1 = parent; return iterator$2$1; } var iterator$1$1; var hasRequiredIterator$1$1; function requireIterator$1$1() { if (hasRequiredIterator$1$1) return iterator$1$1; hasRequiredIterator$1$1 = 1; iterator$1$1 = /* @__PURE__ */ requireIterator$2$1(); return iterator$1$1; } var iteratorExports$1 = /* @__PURE__ */ requireIterator$1$1(); var _Symbol$iterator$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(iteratorExports$1); function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof _Symbol$1 && "symbol" == typeof _Symbol$iterator$1 ? function(o$1) { return typeof o$1; } : function(o$1) { return o$1 && "function" == typeof _Symbol$1 && o$1.constructor === _Symbol$1 && o$1 !== _Symbol$1.prototype ? "symbol" : typeof o$1; }, _typeof$1(o); } var toPrimitive$5$1; var hasRequiredToPrimitive$4$1; function requireToPrimitive$4$1() { if (hasRequiredToPrimitive$4$1) return toPrimitive$5$1; hasRequiredToPrimitive$4$1 = 1; requireEs_symbol_toPrimitive$1(); var WrappedWellKnownSymbolModule = /* @__PURE__ */ requireWellKnownSymbolWrapped$1(); toPrimitive$5$1 = WrappedWellKnownSymbolModule.f("toPrimitive"); return toPrimitive$5$1; } var toPrimitive$4$1; var hasRequiredToPrimitive$3$1; function requireToPrimitive$3$1() { if (hasRequiredToPrimitive$3$1) return toPrimitive$4$1; hasRequiredToPrimitive$3$1 = 1; var parent = /* @__PURE__ */ requireToPrimitive$4$1(); toPrimitive$4$1 = parent; return toPrimitive$4$1; } var toPrimitive$3$1; var hasRequiredToPrimitive$2$1; function requireToPrimitive$2$1() { if (hasRequiredToPrimitive$2$1) return toPrimitive$3$1; hasRequiredToPrimitive$2$1 = 1; var parent = /* @__PURE__ */ requireToPrimitive$3$1(); toPrimitive$3$1 = parent; return toPrimitive$3$1; } var toPrimitive$2$1; var hasRequiredToPrimitive$1$1; function requireToPrimitive$1$1() { if (hasRequiredToPrimitive$1$1) return toPrimitive$2$1; hasRequiredToPrimitive$1$1 = 1; var parent = /* @__PURE__ */ requireToPrimitive$2$1(); toPrimitive$2$1 = parent; return toPrimitive$2$1; } var toPrimitive$1$1; var hasRequiredToPrimitive$6; function requireToPrimitive$6() { if (hasRequiredToPrimitive$6) return toPrimitive$1$1; hasRequiredToPrimitive$6 = 1; toPrimitive$1$1 = /* @__PURE__ */ requireToPrimitive$1$1(); return toPrimitive$1$1; } var toPrimitiveExports$1 = /* @__PURE__ */ requireToPrimitive$6(); var _Symbol$toPrimitive$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(toPrimitiveExports$1); function toPrimitive$7(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[_Symbol$toPrimitive$1]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function toPropertyKey$2(t) { var i = toPrimitive$7(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; } function _defineProperty$1(e, r, t) { return (r = toPropertyKey$2(r)) in e ? _Object$defineProperty$1$1(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; } var es_function_bind$1 = {}; var functionBind$1; var hasRequiredFunctionBind$1; function requireFunctionBind$1() { if (hasRequiredFunctionBind$1) return functionBind$1; hasRequiredFunctionBind$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var arraySlice$2 = /* @__PURE__ */ requireArraySlice$1(); var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative$1(); var $Function = Function; var concat$5 = uncurryThis([].concat); var join = uncurryThis([].join); var factories = {}; var construct = function(C, argsLength, args) { if (!hasOwn(factories, argsLength)) { var list = []; var i = 0; for (; i < argsLength; i++) list[i] = "a[" + i + "]"; factories[argsLength] = $Function("C,a", "return new C(" + join(list, ",") + ")"); } return factories[argsLength](C, args); }; functionBind$1 = NATIVE_BIND ? $Function.bind : function bind$5(that) { var F = aCallable$2(this); var Prototype = F.prototype; var partArgs = arraySlice$2(arguments, 1); var boundFunction = function bound() { var args = concat$5(partArgs, arraySlice$2(arguments)); return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args); }; if (isObject$3(Prototype)) boundFunction.prototype = Prototype; return boundFunction; }; return functionBind$1; } var hasRequiredEs_function_bind$1; function requireEs_function_bind$1() { if (hasRequiredEs_function_bind$1) return es_function_bind$1; hasRequiredEs_function_bind$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var bind$5 = /* @__PURE__ */ requireFunctionBind$1(); $({ target: "Function", proto: true, forced: Function.bind !== bind$5 }, { bind: bind$5 }); return es_function_bind$1; } var getBuiltInPrototypeMethod$1; var hasRequiredGetBuiltInPrototypeMethod$1; function requireGetBuiltInPrototypeMethod$1() { if (hasRequiredGetBuiltInPrototypeMethod$1) return getBuiltInPrototypeMethod$1; hasRequiredGetBuiltInPrototypeMethod$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var path$2 = /* @__PURE__ */ requirePath$1(); getBuiltInPrototypeMethod$1 = function(CONSTRUCTOR, METHOD) { var Namespace = path$2[CONSTRUCTOR + "Prototype"]; var pureMethod = Namespace && Namespace[METHOD]; if (pureMethod) return pureMethod; var NativeConstructor = globalThis$1[CONSTRUCTOR]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; return NativePrototype && NativePrototype[METHOD]; }; return getBuiltInPrototypeMethod$1; } var bind$3$1; var hasRequiredBind$3$1; function requireBind$3$1() { if (hasRequiredBind$3$1) return bind$3$1; hasRequiredBind$3$1 = 1; requireEs_function_bind$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); bind$3$1 = getBuiltInPrototypeMethod$2("Function", "bind"); return bind$3$1; } var bind$2$1; var hasRequiredBind$2$1; function requireBind$2$1() { if (hasRequiredBind$2$1) return bind$2$1; hasRequiredBind$2$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireBind$3$1(); var FunctionPrototype = Function.prototype; bind$2$1 = function(it$1) { var own = it$1.bind; return it$1 === FunctionPrototype || isPrototypeOf(FunctionPrototype, it$1) && own === FunctionPrototype.bind ? method : own; }; return bind$2$1; } var bind$1$1; var hasRequiredBind$1$1; function requireBind$1$1() { if (hasRequiredBind$1$1) return bind$1$1; hasRequiredBind$1$1 = 1; var parent = /* @__PURE__ */ requireBind$2$1(); bind$1$1 = parent; return bind$1$1; } var bind$4; var hasRequiredBind$4; function requireBind$4() { if (hasRequiredBind$4) return bind$4; hasRequiredBind$4 = 1; bind$4 = /* @__PURE__ */ requireBind$1$1(); return bind$4; } var bindExports$1 = requireBind$4(); var _bindInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(bindExports$1); var es_array_reduce$1 = {}; var arrayReduce$1; var hasRequiredArrayReduce$1; function requireArrayReduce$1() { if (hasRequiredArrayReduce$1) return arrayReduce$1; hasRequiredArrayReduce$1 = 1; var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var IndexedObject = /* @__PURE__ */ requireIndexedObject$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var $TypeError = TypeError; var REDUCE_EMPTY = "Reduce of empty array with no initial value"; var createMethod = function(IS_RIGHT) { return function(that, callbackfn, argumentsLength, memo) { var O = toObject$2(that); var self$1 = IndexedObject(O); var length$1 = lengthOfArrayLike$2(O); aCallable$2(callbackfn); if (length$1 === 0 && argumentsLength < 2) throw new $TypeError(REDUCE_EMPTY); var index$1 = IS_RIGHT ? length$1 - 1 : 0; var i = IS_RIGHT ? -1 : 1; if (argumentsLength < 2) while (true) { if (index$1 in self$1) { memo = self$1[index$1]; index$1 += i; break; } index$1 += i; if (IS_RIGHT ? index$1 < 0 : length$1 <= index$1) throw new $TypeError(REDUCE_EMPTY); } for (; IS_RIGHT ? index$1 >= 0 : length$1 > index$1; index$1 += i) if (index$1 in self$1) memo = callbackfn(memo, self$1[index$1], index$1, O); return memo; }; }; arrayReduce$1 = { left: createMethod(false), right: createMethod(true) }; return arrayReduce$1; } var arrayMethodIsStrict$1; var hasRequiredArrayMethodIsStrict$1; function requireArrayMethodIsStrict$1() { if (hasRequiredArrayMethodIsStrict$1) return arrayMethodIsStrict$1; hasRequiredArrayMethodIsStrict$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); arrayMethodIsStrict$1 = function(METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !!method && fails$2(function() { method.call(null, argument || function() { return 1; }, 1); }); }; return arrayMethodIsStrict$1; } var environment$1; var hasRequiredEnvironment$1; function requireEnvironment$1() { if (hasRequiredEnvironment$1) return environment$1; hasRequiredEnvironment$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var userAgent = /* @__PURE__ */ requireEnvironmentUserAgent$1(); var classof$2 = /* @__PURE__ */ requireClassofRaw$1(); var userAgentStartsWith = function(string$1) { return userAgent.slice(0, string$1.length) === string$1; }; environment$1 = function() { if (userAgentStartsWith("Bun/")) return "BUN"; if (userAgentStartsWith("Cloudflare-Workers")) return "CLOUDFLARE"; if (userAgentStartsWith("Deno/")) return "DENO"; if (userAgentStartsWith("Node.js/")) return "NODE"; if (globalThis$1.Bun && typeof Bun.version == "string") return "BUN"; if (globalThis$1.Deno && typeof Deno.version == "object") return "DENO"; if (classof$2(globalThis$1.process) === "process") return "NODE"; if (globalThis$1.window && globalThis$1.document) return "BROWSER"; return "REST"; }(); return environment$1; } var environmentIsNode$1; var hasRequiredEnvironmentIsNode$1; function requireEnvironmentIsNode$1() { if (hasRequiredEnvironmentIsNode$1) return environmentIsNode$1; hasRequiredEnvironmentIsNode$1 = 1; var ENVIRONMENT = /* @__PURE__ */ requireEnvironment$1(); environmentIsNode$1 = ENVIRONMENT === "NODE"; return environmentIsNode$1; } var hasRequiredEs_array_reduce$1; function requireEs_array_reduce$1() { if (hasRequiredEs_array_reduce$1) return es_array_reduce$1; hasRequiredEs_array_reduce$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var $reduce = requireArrayReduce$1().left; var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict$1(); var CHROME_VERSION = /* @__PURE__ */ requireEnvironmentV8Version$1(); var IS_NODE = /* @__PURE__ */ requireEnvironmentIsNode$1(); var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83; var FORCED = CHROME_BUG || !arrayMethodIsStrict$2("reduce"); $({ target: "Array", proto: true, forced: FORCED }, { reduce: function reduce$5(callbackfn) { var length$1 = arguments.length; return $reduce(this, callbackfn, length$1, length$1 > 1 ? arguments[1] : void 0); } }); return es_array_reduce$1; } var reduce$3$1; var hasRequiredReduce$3$1; function requireReduce$3$1() { if (hasRequiredReduce$3$1) return reduce$3$1; hasRequiredReduce$3$1 = 1; requireEs_array_reduce$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); reduce$3$1 = getBuiltInPrototypeMethod$2("Array", "reduce"); return reduce$3$1; } var reduce$2$1; var hasRequiredReduce$2$1; function requireReduce$2$1() { if (hasRequiredReduce$2$1) return reduce$2$1; hasRequiredReduce$2$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireReduce$3$1(); var ArrayPrototype = Array.prototype; reduce$2$1 = function(it$1) { var own = it$1.reduce; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.reduce ? method : own; }; return reduce$2$1; } var reduce$1$1; var hasRequiredReduce$1$1; function requireReduce$1$1() { if (hasRequiredReduce$1$1) return reduce$1$1; hasRequiredReduce$1$1 = 1; var parent = /* @__PURE__ */ requireReduce$2$1(); reduce$1$1 = parent; return reduce$1$1; } var reduce$4; var hasRequiredReduce$4; function requireReduce$4() { if (hasRequiredReduce$4) return reduce$4; hasRequiredReduce$4 = 1; reduce$4 = /* @__PURE__ */ requireReduce$1$1(); return reduce$4; } var reduceExports$1 = requireReduce$4(); var _reduceInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(reduceExports$1); var es_array_filter$1 = {}; var hasRequiredEs_array_filter$1; function requireEs_array_filter$1() { if (hasRequiredEs_array_filter$1) return es_array_filter$1; hasRequiredEs_array_filter$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var $filter = requireArrayIteration$1().filter; var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport$1(); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$2("filter"); $({ target: "Array", proto: true, forced: !HAS_SPECIES_SUPPORT }, { filter: function filter$5(callbackfn) { return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } }); return es_array_filter$1; } var filter$3$1; var hasRequiredFilter$3$1; function requireFilter$3$1() { if (hasRequiredFilter$3$1) return filter$3$1; hasRequiredFilter$3$1 = 1; requireEs_array_filter$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); filter$3$1 = getBuiltInPrototypeMethod$2("Array", "filter"); return filter$3$1; } var filter$2$1; var hasRequiredFilter$2$1; function requireFilter$2$1() { if (hasRequiredFilter$2$1) return filter$2$1; hasRequiredFilter$2$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireFilter$3$1(); var ArrayPrototype = Array.prototype; filter$2$1 = function(it$1) { var own = it$1.filter; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.filter ? method : own; }; return filter$2$1; } var filter$1$1; var hasRequiredFilter$1$1; function requireFilter$1$1() { if (hasRequiredFilter$1$1) return filter$1$1; hasRequiredFilter$1$1 = 1; var parent = /* @__PURE__ */ requireFilter$2$1(); filter$1$1 = parent; return filter$1$1; } var filter$4; var hasRequiredFilter$4; function requireFilter$4() { if (hasRequiredFilter$4) return filter$4; hasRequiredFilter$4 = 1; filter$4 = /* @__PURE__ */ requireFilter$1$1(); return filter$4; } var filterExports$1 = requireFilter$4(); var _filterInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(filterExports$1); var es_array_map$1 = {}; var hasRequiredEs_array_map$1; function requireEs_array_map$1() { if (hasRequiredEs_array_map$1) return es_array_map$1; hasRequiredEs_array_map$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var $map = requireArrayIteration$1().map; var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport$1(); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$2("map"); $({ target: "Array", proto: true, forced: !HAS_SPECIES_SUPPORT }, { map: function map$8(callbackfn) { return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } }); return es_array_map$1; } var map$6$1; var hasRequiredMap$6$1; function requireMap$6$1() { if (hasRequiredMap$6$1) return map$6$1; hasRequiredMap$6$1 = 1; requireEs_array_map$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); map$6$1 = getBuiltInPrototypeMethod$2("Array", "map"); return map$6$1; } var map$5$1; var hasRequiredMap$5$1; function requireMap$5$1() { if (hasRequiredMap$5$1) return map$5$1; hasRequiredMap$5$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireMap$6$1(); var ArrayPrototype = Array.prototype; map$5$1 = function(it$1) { var own = it$1.map; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.map ? method : own; }; return map$5$1; } var map$4$1; var hasRequiredMap$4$1; function requireMap$4$1() { if (hasRequiredMap$4$1) return map$4$1; hasRequiredMap$4$1 = 1; var parent = /* @__PURE__ */ requireMap$5$1(); map$4$1 = parent; return map$4$1; } var map$3$1; var hasRequiredMap$3$1; function requireMap$3$1() { if (hasRequiredMap$3$1) return map$3$1; hasRequiredMap$3$1 = 1; map$3$1 = /* @__PURE__ */ requireMap$4$1(); return map$3$1; } var mapExports$1$1 = requireMap$3$1(); var _mapInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(mapExports$1$1); var es_array_flatMap = {}; var flattenIntoArray_1; var hasRequiredFlattenIntoArray; function requireFlattenIntoArray() { if (hasRequiredFlattenIntoArray) return flattenIntoArray_1; hasRequiredFlattenIntoArray = 1; var isArray$5 = /* @__PURE__ */ requireIsArray$3$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var doesNotExceedSafeInteger$2 = /* @__PURE__ */ requireDoesNotExceedSafeInteger$1(); var bind$5 = /* @__PURE__ */ requireFunctionBindContext$1(); var flattenIntoArray = function(target, original, source, sourceLen, start, depth, mapper, thisArg) { var targetIndex = start; var sourceIndex = 0; var mapFn = mapper ? bind$5(mapper, thisArg) : false; var element, elementLen; while (sourceIndex < sourceLen) { if (sourceIndex in source) { element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; if (depth > 0 && isArray$5(element)) { elementLen = lengthOfArrayLike$2(element); targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1; } else { doesNotExceedSafeInteger$2(targetIndex + 1); target[targetIndex] = element; } targetIndex++; } sourceIndex++; } return targetIndex; }; flattenIntoArray_1 = flattenIntoArray; return flattenIntoArray_1; } var hasRequiredEs_array_flatMap; function requireEs_array_flatMap() { if (hasRequiredEs_array_flatMap) return es_array_flatMap; hasRequiredEs_array_flatMap = 1; var $ = /* @__PURE__ */ require_export$1(); var flattenIntoArray = /* @__PURE__ */ requireFlattenIntoArray(); var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var arraySpeciesCreate$2 = /* @__PURE__ */ requireArraySpeciesCreate$1(); $({ target: "Array", proto: true }, { flatMap: function flatMap$4(callbackfn) { var O = toObject$2(this); var sourceLen = lengthOfArrayLike$2(O); var A; aCallable$2(callbackfn); A = arraySpeciesCreate$2(O, 0); A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : void 0); return A; } }); return es_array_flatMap; } var es_array_unscopables_flatMap = {}; var hasRequiredEs_array_unscopables_flatMap; function requireEs_array_unscopables_flatMap() { if (hasRequiredEs_array_unscopables_flatMap) return es_array_unscopables_flatMap; hasRequiredEs_array_unscopables_flatMap = 1; var addToUnscopables$2 = /* @__PURE__ */ requireAddToUnscopables$1(); addToUnscopables$2("flatMap"); return es_array_unscopables_flatMap; } var flatMap$3; var hasRequiredFlatMap$3; function requireFlatMap$3() { if (hasRequiredFlatMap$3) return flatMap$3; hasRequiredFlatMap$3 = 1; requireEs_array_flatMap(); requireEs_array_unscopables_flatMap(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); flatMap$3 = getBuiltInPrototypeMethod$2("Array", "flatMap"); return flatMap$3; } var flatMap$2; var hasRequiredFlatMap$2; function requireFlatMap$2() { if (hasRequiredFlatMap$2) return flatMap$2; hasRequiredFlatMap$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireFlatMap$3(); var ArrayPrototype = Array.prototype; flatMap$2 = function(it$1) { var own = it$1.flatMap; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.flatMap ? method : own; }; return flatMap$2; } var flatMap$1; var hasRequiredFlatMap$1; function requireFlatMap$1() { if (hasRequiredFlatMap$1) return flatMap$1; hasRequiredFlatMap$1 = 1; var parent = /* @__PURE__ */ requireFlatMap$2(); flatMap$1 = parent; return flatMap$1; } var flatMap; var hasRequiredFlatMap; function requireFlatMap() { if (hasRequiredFlatMap) return flatMap; hasRequiredFlatMap = 1; flatMap = /* @__PURE__ */ requireFlatMap$1(); return flatMap; } var flatMapExports = requireFlatMap(); var componentEmitter$1 = { exports: {} }; var hasRequiredComponentEmitter$1; function requireComponentEmitter$1() { if (hasRequiredComponentEmitter$1) return componentEmitter$1.exports; hasRequiredComponentEmitter$1 = 1; (function(module) { function Emitter$2(object$1) { if (object$1) return mixin(object$1); this._callbacks = new Map(); } function mixin(object$1) { Object.assign(object$1, Emitter$2.prototype); object$1._callbacks = new Map(); return object$1; } Emitter$2.prototype.on = function(event, listener) { const callbacks = this._callbacks.get(event) ?? []; callbacks.push(listener); this._callbacks.set(event, callbacks); return this; }; Emitter$2.prototype.once = function(event, listener) { const on = (...arguments_) => { this.off(event, on); listener.apply(this, arguments_); }; on.fn = listener; this.on(event, on); return this; }; Emitter$2.prototype.off = function(event, listener) { if (event === void 0 && listener === void 0) { this._callbacks.clear(); return this; } if (listener === void 0) { this._callbacks.delete(event); return this; } const callbacks = this._callbacks.get(event); if (callbacks) { for (const [index$1, callback] of callbacks.entries()) if (callback === listener || callback.fn === listener) { callbacks.splice(index$1, 1); break; } if (callbacks.length === 0) this._callbacks.delete(event); else this._callbacks.set(event, callbacks); } return this; }; Emitter$2.prototype.emit = function(event, ...arguments_) { const callbacks = this._callbacks.get(event); if (callbacks) { const callbacksCopy = [...callbacks]; for (const callback of callbacksCopy) callback.apply(this, arguments_); } return this; }; Emitter$2.prototype.listeners = function(event) { return this._callbacks.get(event) ?? []; }; Emitter$2.prototype.listenerCount = function(event) { if (event) return this.listeners(event).length; let totalCount = 0; for (const callbacks of this._callbacks.values()) totalCount += callbacks.length; return totalCount; }; Emitter$2.prototype.hasListeners = function(event) { return this.listenerCount(event) > 0; }; Emitter$2.prototype.addEventListener = Emitter$2.prototype.on; Emitter$2.prototype.removeListener = Emitter$2.prototype.off; Emitter$2.prototype.removeEventListener = Emitter$2.prototype.off; Emitter$2.prototype.removeAllListeners = Emitter$2.prototype.off; module.exports = Emitter$2; })(componentEmitter$1); return componentEmitter$1.exports; } var componentEmitterExports$1 = /* @__PURE__ */ requireComponentEmitter$1(); var Emitter$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(componentEmitterExports$1); /*! Hammer.JS - v2.0.17-rc - 2019-12-16 * http://naver.github.io/egjs * * Forked By Naver egjs * Copyright (c) hammerjs * Licensed under the MIT license */ function _extends$1() { _extends$1 = Object.assign || function(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; } return target; }; return _extends$1.apply(this, arguments); } function _inheritsLoose$1(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } function _assertThisInitialized$1(self$1) { if (self$1 === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return self$1; } /** * @private * extend object. * means that properties in dest will be overwritten by the ones in src. * @param {Object} target * @param {...Object} objects_to_assign * @returns {Object} target */ var assign$3$1; if (typeof Object.assign !== "function") assign$3$1 = function assign$6(target) { if (target === void 0 || target === null) throw new TypeError("Cannot convert undefined or null to object"); var output = Object(target); for (var index$1 = 1; index$1 < arguments.length; index$1++) { var source = arguments[index$1]; if (source !== void 0 && source !== null) { for (var nextKey in source) if (source.hasOwnProperty(nextKey)) output[nextKey] = source[nextKey]; } } return output; }; else assign$3$1 = Object.assign; var assign$1$1 = assign$3$1; var VENDOR_PREFIXES$1 = [ "", "webkit", "Moz", "MS", "ms", "o" ]; var TEST_ELEMENT$1 = typeof document === "undefined" ? { style: {} } : document.createElement("div"); var TYPE_FUNCTION$1 = "function"; var round$1 = Math.round, abs$1 = Math.abs; var now$4 = Date.now; /** * @private * get the prefixed property * @param {Object} obj * @param {String} property * @returns {String|Undefined} prefixed */ function prefixed$1(obj, property) { var prefix; var prop; var camelProp = property[0].toUpperCase() + property.slice(1); var i = 0; while (i < VENDOR_PREFIXES$1.length) { prefix = VENDOR_PREFIXES$1[i]; prop = prefix ? prefix + camelProp : property; if (prop in obj) return prop; i++; } return void 0; } var win$1; if (typeof window === "undefined") win$1 = {}; else win$1 = window; var PREFIXED_TOUCH_ACTION$1 = prefixed$1(TEST_ELEMENT$1.style, "touchAction"); var NATIVE_TOUCH_ACTION$1 = PREFIXED_TOUCH_ACTION$1 !== void 0; function getTouchActionProps$1() { if (!NATIVE_TOUCH_ACTION$1) return false; var touchMap = {}; var cssSupports = win$1.CSS && win$1.CSS.supports; [ "auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none" ].forEach(function(val) { return touchMap[val] = cssSupports ? win$1.CSS.supports("touch-action", val) : true; }); return touchMap; } var TOUCH_ACTION_COMPUTE$1 = "compute"; var TOUCH_ACTION_AUTO$1 = "auto"; var TOUCH_ACTION_MANIPULATION$1 = "manipulation"; var TOUCH_ACTION_NONE$1 = "none"; var TOUCH_ACTION_PAN_X$1 = "pan-x"; var TOUCH_ACTION_PAN_Y$1 = "pan-y"; var TOUCH_ACTION_MAP$1 = getTouchActionProps$1(); var MOBILE_REGEX$1 = /mobile|tablet|ip(ad|hone|od)|android/i; var SUPPORT_TOUCH$1 = "ontouchstart" in win$1; var SUPPORT_POINTER_EVENTS$1 = prefixed$1(win$1, "PointerEvent") !== void 0; var SUPPORT_ONLY_TOUCH$1 = SUPPORT_TOUCH$1 && MOBILE_REGEX$1.test(navigator.userAgent); var INPUT_TYPE_TOUCH$1 = "touch"; var INPUT_TYPE_PEN$1 = "pen"; var INPUT_TYPE_MOUSE$1 = "mouse"; var INPUT_TYPE_KINECT$1 = "kinect"; var COMPUTE_INTERVAL$1 = 25; var INPUT_START$1 = 1; var INPUT_MOVE$1 = 2; var INPUT_END$1 = 4; var INPUT_CANCEL$1 = 8; var DIRECTION_NONE$1 = 1; var DIRECTION_LEFT$1 = 2; var DIRECTION_RIGHT$1 = 4; var DIRECTION_UP$1 = 8; var DIRECTION_DOWN$1 = 16; var DIRECTION_HORIZONTAL$1 = DIRECTION_LEFT$1 | DIRECTION_RIGHT$1; var DIRECTION_VERTICAL$1 = DIRECTION_UP$1 | DIRECTION_DOWN$1; var DIRECTION_ALL$1 = DIRECTION_HORIZONTAL$1 | DIRECTION_VERTICAL$1; var PROPS_XY$1 = ["x", "y"]; var PROPS_CLIENT_XY$1 = ["clientX", "clientY"]; /** * @private * walk objects and arrays * @param {Object} obj * @param {Function} iterator * @param {Object} context */ function each$1(obj, iterator$7, context) { var i; if (!obj) return; if (obj.forEach) obj.forEach(iterator$7, context); else if (obj.length !== void 0) { i = 0; while (i < obj.length) { iterator$7.call(context, obj[i], i, obj); i++; } } else for (i in obj) obj.hasOwnProperty(i) && iterator$7.call(context, obj[i], i, obj); } /** * @private * let a boolean value also be a function that must return a boolean * this first item in args will be used as the context * @param {Boolean|Function} val * @param {Array} [args] * @returns {Boolean} */ function boolOrFn$1(val, args) { if (typeof val === TYPE_FUNCTION$1) return val.apply(args ? args[0] || void 0 : void 0, args); return val; } /** * @private * small indexOf wrapper * @param {String} str * @param {String} find * @returns {Boolean} found */ function inStr$1(str, find) { return str.indexOf(find) > -1; } /** * @private * when the touchActions are collected they are not a valid value, so we need to clean things up. * * @param {String} actions * @returns {*} */ function cleanTouchActions$1(actions) { if (inStr$1(actions, TOUCH_ACTION_NONE$1)) return TOUCH_ACTION_NONE$1; var hasPanX = inStr$1(actions, TOUCH_ACTION_PAN_X$1); var hasPanY = inStr$1(actions, TOUCH_ACTION_PAN_Y$1); if (hasPanX && hasPanY) return TOUCH_ACTION_NONE$1; if (hasPanX || hasPanY) return hasPanX ? TOUCH_ACTION_PAN_X$1 : TOUCH_ACTION_PAN_Y$1; if (inStr$1(actions, TOUCH_ACTION_MANIPULATION$1)) return TOUCH_ACTION_MANIPULATION$1; return TOUCH_ACTION_AUTO$1; } /** * @private * Touch Action * sets the touchAction property or uses the js alternative * @param {Manager} manager * @param {String} value * @constructor */ var TouchAction$1 = /* @__PURE__ */ function() { function TouchAction$2(manager, value) { this.manager = manager; this.set(value); } /** * @private * set the touchAction value on the element or enable the polyfill * @param {String} value */ var _proto = TouchAction$2.prototype; _proto.set = function set$4(value) { if (value === TOUCH_ACTION_COMPUTE$1) value = this.compute(); if (NATIVE_TOUCH_ACTION$1 && this.manager.element.style && TOUCH_ACTION_MAP$1[value]) this.manager.element.style[PREFIXED_TOUCH_ACTION$1] = value; this.actions = value.toLowerCase().trim(); }; /** * @private * just re-set the touchAction value */ _proto.update = function update() { this.set(this.manager.options.touchAction); }; /** * @private * compute the value for the touchAction property based on the recognizer's settings * @returns {String} value */ _proto.compute = function compute() { var actions = []; each$1(this.manager.recognizers, function(recognizer) { if (boolOrFn$1(recognizer.options.enable, [recognizer])) actions = actions.concat(recognizer.getTouchAction()); }); return cleanTouchActions$1(actions.join(" ")); }; /** * @private * this method is called on each input cycle and provides the preventing of the browser behavior * @param {Object} input */ _proto.preventDefaults = function preventDefaults(input) { var srcEvent = input.srcEvent; var direction = input.offsetDirection; if (this.manager.session.prevented) { srcEvent.preventDefault(); return; } var actions = this.actions; var hasNone = inStr$1(actions, TOUCH_ACTION_NONE$1) && !TOUCH_ACTION_MAP$1[TOUCH_ACTION_NONE$1]; var hasPanY = inStr$1(actions, TOUCH_ACTION_PAN_Y$1) && !TOUCH_ACTION_MAP$1[TOUCH_ACTION_PAN_Y$1]; var hasPanX = inStr$1(actions, TOUCH_ACTION_PAN_X$1) && !TOUCH_ACTION_MAP$1[TOUCH_ACTION_PAN_X$1]; if (hasNone) { var isTapPointer = input.pointers.length === 1; var isTapMovement = input.distance < 2; var isTapTouchTime = input.deltaTime < 250; if (isTapPointer && isTapMovement && isTapTouchTime) return; } if (hasPanX && hasPanY) return; if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL$1 || hasPanX && direction & DIRECTION_VERTICAL$1) return this.preventSrc(srcEvent); }; /** * @private * call preventDefault to prevent the browser's default behavior (scrolling in most cases) * @param {Object} srcEvent */ _proto.preventSrc = function preventSrc(srcEvent) { this.manager.session.prevented = true; srcEvent.preventDefault(); }; return TouchAction$2; }(); /** * @private * find if a node is in the given parent * @method hasParent * @param {HTMLElement} node * @param {HTMLElement} parent * @return {Boolean} found */ function hasParent$1(node, parent) { while (node) { if (node === parent) return true; node = node.parentNode; } return false; } /** * @private * get the center of all the pointers * @param {Array} pointers * @return {Object} center contains `x` and `y` properties */ function getCenter$1(pointers) { var pointersLength = pointers.length; if (pointersLength === 1) return { x: round$1(pointers[0].clientX), y: round$1(pointers[0].clientY) }; var x = 0; var y = 0; var i = 0; while (i < pointersLength) { x += pointers[i].clientX; y += pointers[i].clientY; i++; } return { x: round$1(x / pointersLength), y: round$1(y / pointersLength) }; } /** * @private * create a simple clone from the input used for storage of firstInput and firstMultiple * @param {Object} input * @returns {Object} clonedInputData */ function simpleCloneInputData$1(input) { var pointers = []; var i = 0; while (i < input.pointers.length) { pointers[i] = { clientX: round$1(input.pointers[i].clientX), clientY: round$1(input.pointers[i].clientY) }; i++; } return { timeStamp: now$4(), pointers, center: getCenter$1(pointers), deltaX: input.deltaX, deltaY: input.deltaY }; } /** * @private * calculate the absolute distance between two points * @param {Object} p1 {x, y} * @param {Object} p2 {x, y} * @param {Array} [props] containing x and y keys * @return {Number} distance */ function getDistance$1(p1, p2, props) { if (!props) props = PROPS_XY$1; var x = p2[props[0]] - p1[props[0]]; var y = p2[props[1]] - p1[props[1]]; return Math.sqrt(x * x + y * y); } /** * @private * calculate the angle between two coordinates * @param {Object} p1 * @param {Object} p2 * @param {Array} [props] containing x and y keys * @return {Number} angle */ function getAngle$1(p1, p2, props) { if (!props) props = PROPS_XY$1; var x = p2[props[0]] - p1[props[0]]; var y = p2[props[1]] - p1[props[1]]; return Math.atan2(y, x) * 180 / Math.PI; } /** * @private * get the direction between two points * @param {Number} x * @param {Number} y * @return {Number} direction */ function getDirection$1(x, y) { if (x === y) return DIRECTION_NONE$1; if (abs$1(x) >= abs$1(y)) return x < 0 ? DIRECTION_LEFT$1 : DIRECTION_RIGHT$1; return y < 0 ? DIRECTION_UP$1 : DIRECTION_DOWN$1; } function computeDeltaXY$1(session, input) { var center = input.center; var offset = session.offsetDelta || {}; var prevDelta = session.prevDelta || {}; var prevInput = session.prevInput || {}; if (input.eventType === INPUT_START$1 || prevInput.eventType === INPUT_END$1) { prevDelta = session.prevDelta = { x: prevInput.deltaX || 0, y: prevInput.deltaY || 0 }; offset = session.offsetDelta = { x: center.x, y: center.y }; } input.deltaX = prevDelta.x + (center.x - offset.x); input.deltaY = prevDelta.y + (center.y - offset.y); } /** * @private * calculate the velocity between two points. unit is in px per ms. * @param {Number} deltaTime * @param {Number} x * @param {Number} y * @return {Object} velocity `x` and `y` */ function getVelocity$1(deltaTime, x, y) { return { x: x / deltaTime || 0, y: y / deltaTime || 0 }; } /** * @private * calculate the scale factor between two pointersets * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out * @param {Array} start array of pointers * @param {Array} end array of pointers * @return {Number} scale */ function getScale$1(start, end) { return getDistance$1(end[0], end[1], PROPS_CLIENT_XY$1) / getDistance$1(start[0], start[1], PROPS_CLIENT_XY$1); } /** * @private * calculate the rotation degrees between two pointersets * @param {Array} start array of pointers * @param {Array} end array of pointers * @return {Number} rotation */ function getRotation$1(start, end) { return getAngle$1(end[1], end[0], PROPS_CLIENT_XY$1) + getAngle$1(start[1], start[0], PROPS_CLIENT_XY$1); } /** * @private * velocity is calculated every x ms * @param {Object} session * @param {Object} input */ function computeIntervalInputData$1(session, input) { var last = session.lastInterval || input; var deltaTime = input.timeStamp - last.timeStamp; var velocity; var velocityX; var velocityY; var direction; if (input.eventType !== INPUT_CANCEL$1 && (deltaTime > COMPUTE_INTERVAL$1 || last.velocity === void 0)) { var deltaX = input.deltaX - last.deltaX; var deltaY = input.deltaY - last.deltaY; var v = getVelocity$1(deltaTime, deltaX, deltaY); velocityX = v.x; velocityY = v.y; velocity = abs$1(v.x) > abs$1(v.y) ? v.x : v.y; direction = getDirection$1(deltaX, deltaY); session.lastInterval = input; } else { velocity = last.velocity; velocityX = last.velocityX; velocityY = last.velocityY; direction = last.direction; } input.velocity = velocity; input.velocityX = velocityX; input.velocityY = velocityY; input.direction = direction; } /** * @private * extend the data with some usable properties like scale, rotate, velocity etc * @param {Object} manager * @param {Object} input */ function computeInputData$1(manager, input) { var session = manager.session; var pointers = input.pointers; var pointersLength = pointers.length; if (!session.firstInput) session.firstInput = simpleCloneInputData$1(input); if (pointersLength > 1 && !session.firstMultiple) session.firstMultiple = simpleCloneInputData$1(input); else if (pointersLength === 1) session.firstMultiple = false; var firstInput = session.firstInput, firstMultiple = session.firstMultiple; var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; var center = input.center = getCenter$1(pointers); input.timeStamp = now$4(); input.deltaTime = input.timeStamp - firstInput.timeStamp; input.angle = getAngle$1(offsetCenter, center); input.distance = getDistance$1(offsetCenter, center); computeDeltaXY$1(session, input); input.offsetDirection = getDirection$1(input.deltaX, input.deltaY); var overallVelocity = getVelocity$1(input.deltaTime, input.deltaX, input.deltaY); input.overallVelocityX = overallVelocity.x; input.overallVelocityY = overallVelocity.y; input.overallVelocity = abs$1(overallVelocity.x) > abs$1(overallVelocity.y) ? overallVelocity.x : overallVelocity.y; input.scale = firstMultiple ? getScale$1(firstMultiple.pointers, pointers) : 1; input.rotation = firstMultiple ? getRotation$1(firstMultiple.pointers, pointers) : 0; input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers; computeIntervalInputData$1(session, input); var target = manager.element; var srcEvent = input.srcEvent; var srcEventTarget; if (srcEvent.composedPath) srcEventTarget = srcEvent.composedPath()[0]; else if (srcEvent.path) srcEventTarget = srcEvent.path[0]; else srcEventTarget = srcEvent.target; if (hasParent$1(srcEventTarget, target)) target = srcEventTarget; input.target = target; } /** * @private * handle input events * @param {Manager} manager * @param {String} eventType * @param {Object} input */ function inputHandler$1(manager, eventType, input) { var pointersLen = input.pointers.length; var changedPointersLen = input.changedPointers.length; var isFirst = eventType & INPUT_START$1 && pointersLen - changedPointersLen === 0; var isFinal = eventType & (INPUT_END$1 | INPUT_CANCEL$1) && pointersLen - changedPointersLen === 0; input.isFirst = !!isFirst; input.isFinal = !!isFinal; if (isFirst) manager.session = {}; input.eventType = eventType; computeInputData$1(manager, input); manager.emit("hammer.input", input); manager.recognize(input); manager.session.prevInput = input; } /** * @private * split string on whitespace * @param {String} str * @returns {Array} words */ function splitStr$1(str) { return str.trim().split(/\s+/g); } /** * @private * addEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ function addEventListeners$1(target, types, handler) { each$1(splitStr$1(types), function(type) { target.addEventListener(type, handler, false); }); } /** * @private * removeEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ function removeEventListeners$1(target, types, handler) { each$1(splitStr$1(types), function(type) { target.removeEventListener(type, handler, false); }); } /** * @private * get the window object of an element * @param {HTMLElement} element * @returns {DocumentView|Window} */ function getWindowForElement$1(element) { var doc = element.ownerDocument || element; return doc.defaultView || doc.parentWindow || window; } /** * @private * create new input type manager * @param {Manager} manager * @param {Function} callback * @returns {Input} * @constructor */ var Input$1 = /* @__PURE__ */ function() { function Input$2(manager, callback) { var self$1 = this; this.manager = manager; this.callback = callback; this.element = manager.element; this.target = manager.options.inputTarget; this.domHandler = function(ev) { if (boolOrFn$1(manager.options.enable, [manager])) self$1.handler(ev); }; this.init(); } /** * @private * should handle the inputEvent data and trigger the callback * @virtual */ var _proto = Input$2.prototype; _proto.handler = function handler() {}; /** * @private * bind the events */ _proto.init = function init() { this.evEl && addEventListeners$1(this.element, this.evEl, this.domHandler); this.evTarget && addEventListeners$1(this.target, this.evTarget, this.domHandler); this.evWin && addEventListeners$1(getWindowForElement$1(this.element), this.evWin, this.domHandler); }; /** * @private * unbind the events */ _proto.destroy = function destroy() { this.evEl && removeEventListeners$1(this.element, this.evEl, this.domHandler); this.evTarget && removeEventListeners$1(this.target, this.evTarget, this.domHandler); this.evWin && removeEventListeners$1(getWindowForElement$1(this.element), this.evWin, this.domHandler); }; return Input$2; }(); /** * @private * find if a array contains the object using indexOf or a simple polyFill * @param {Array} src * @param {String} find * @param {String} [findByKey] * @return {Boolean|Number} false when not found, or the index */ function inArray$1(src, find, findByKey) { if (src.indexOf && !findByKey) return src.indexOf(find); else { var i = 0; while (i < src.length) { if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) return i; i++; } return -1; } } var POINTER_INPUT_MAP$1 = { pointerdown: INPUT_START$1, pointermove: INPUT_MOVE$1, pointerup: INPUT_END$1, pointercancel: INPUT_CANCEL$1, pointerout: INPUT_CANCEL$1 }; var IE10_POINTER_TYPE_ENUM$1 = { 2: INPUT_TYPE_TOUCH$1, 3: INPUT_TYPE_PEN$1, 4: INPUT_TYPE_MOUSE$1, 5: INPUT_TYPE_KINECT$1 }; var POINTER_ELEMENT_EVENTS$1 = "pointerdown"; var POINTER_WINDOW_EVENTS$1 = "pointermove pointerup pointercancel"; if (win$1.MSPointerEvent && !win$1.PointerEvent) { POINTER_ELEMENT_EVENTS$1 = "MSPointerDown"; POINTER_WINDOW_EVENTS$1 = "MSPointerMove MSPointerUp MSPointerCancel"; } /** * @private * Pointer events input * @constructor * @extends Input */ var PointerEventInput$1 = /* @__PURE__ */ function(_Input) { _inheritsLoose$1(PointerEventInput$2, _Input); function PointerEventInput$2() { var _this; var proto = PointerEventInput$2.prototype; proto.evEl = POINTER_ELEMENT_EVENTS$1; proto.evWin = POINTER_WINDOW_EVENTS$1; _this = _Input.apply(this, arguments) || this; _this.store = _this.manager.session.pointerEvents = []; return _this; } /** * @private * handle mouse events * @param {Object} ev */ var _proto = PointerEventInput$2.prototype; _proto.handler = function handler(ev) { var store = this.store; var removePointer = false; var eventTypeNormalized = ev.type.toLowerCase().replace("ms", ""); var eventType = POINTER_INPUT_MAP$1[eventTypeNormalized]; var pointerType = IE10_POINTER_TYPE_ENUM$1[ev.pointerType] || ev.pointerType; var isTouch = pointerType === INPUT_TYPE_TOUCH$1; var storeIndex = inArray$1(store, ev.pointerId, "pointerId"); if (eventType & INPUT_START$1 && (ev.button === 0 || isTouch)) { if (storeIndex < 0) { store.push(ev); storeIndex = store.length - 1; } } else if (eventType & (INPUT_END$1 | INPUT_CANCEL$1)) removePointer = true; if (storeIndex < 0) return; store[storeIndex] = ev; this.callback(this.manager, eventType, { pointers: store, changedPointers: [ev], pointerType, srcEvent: ev }); if (removePointer) store.splice(storeIndex, 1); }; return PointerEventInput$2; }(Input$1); /** * @private * convert array-like objects to real arrays * @param {Object} obj * @returns {Array} */ function toArray$1(obj) { return Array.prototype.slice.call(obj, 0); } /** * @private * unique array with objects based on a key (like 'id') or just by the array's value * @param {Array} src [{id:1},{id:2},{id:1}] * @param {String} [key] * @param {Boolean} [sort=False] * @returns {Array} [{id:1},{id:2}] */ function uniqueArray$1(src, key, sort$5) { var results = []; var values$8 = []; var i = 0; while (i < src.length) { var val = key ? src[i][key] : src[i]; if (inArray$1(values$8, val) < 0) results.push(src[i]); values$8[i] = val; i++; } if (sort$5) if (!key) results = results.sort(); else results = results.sort(function(a, b) { return a[key] > b[key]; }); return results; } var TOUCH_INPUT_MAP$1 = { touchstart: INPUT_START$1, touchmove: INPUT_MOVE$1, touchend: INPUT_END$1, touchcancel: INPUT_CANCEL$1 }; var TOUCH_TARGET_EVENTS$1 = "touchstart touchmove touchend touchcancel"; /** * @private * Multi-user touch events input * @constructor * @extends Input */ var TouchInput$1 = /* @__PURE__ */ function(_Input) { _inheritsLoose$1(TouchInput$2, _Input); function TouchInput$2() { var _this; TouchInput$2.prototype.evTarget = TOUCH_TARGET_EVENTS$1; _this = _Input.apply(this, arguments) || this; _this.targetIds = {}; return _this; } var _proto = TouchInput$2.prototype; _proto.handler = function handler(ev) { var type = TOUCH_INPUT_MAP$1[ev.type]; var touches = getTouches$1.call(this, ev, type); if (!touches) return; this.callback(this.manager, type, { pointers: touches[0], changedPointers: touches[1], pointerType: INPUT_TYPE_TOUCH$1, srcEvent: ev }); }; return TouchInput$2; }(Input$1); function getTouches$1(ev, type) { var allTouches = toArray$1(ev.touches); var targetIds = this.targetIds; if (type & (INPUT_START$1 | INPUT_MOVE$1) && allTouches.length === 1) { targetIds[allTouches[0].identifier] = true; return [allTouches, allTouches]; } var i; var targetTouches; var changedTouches = toArray$1(ev.changedTouches); var changedTargetTouches = []; var target = this.target; targetTouches = allTouches.filter(function(touch) { return hasParent$1(touch.target, target); }); if (type === INPUT_START$1) { i = 0; while (i < targetTouches.length) { targetIds[targetTouches[i].identifier] = true; i++; } } i = 0; while (i < changedTouches.length) { if (targetIds[changedTouches[i].identifier]) changedTargetTouches.push(changedTouches[i]); if (type & (INPUT_END$1 | INPUT_CANCEL$1)) delete targetIds[changedTouches[i].identifier]; i++; } if (!changedTargetTouches.length) return; return [uniqueArray$1(targetTouches.concat(changedTargetTouches), "identifier", true), changedTargetTouches]; } var MOUSE_INPUT_MAP$1 = { mousedown: INPUT_START$1, mousemove: INPUT_MOVE$1, mouseup: INPUT_END$1 }; var MOUSE_ELEMENT_EVENTS$1 = "mousedown"; var MOUSE_WINDOW_EVENTS$1 = "mousemove mouseup"; /** * @private * Mouse events input * @constructor * @extends Input */ var MouseInput$1 = /* @__PURE__ */ function(_Input) { _inheritsLoose$1(MouseInput$2, _Input); function MouseInput$2() { var _this; var proto = MouseInput$2.prototype; proto.evEl = MOUSE_ELEMENT_EVENTS$1; proto.evWin = MOUSE_WINDOW_EVENTS$1; _this = _Input.apply(this, arguments) || this; _this.pressed = false; return _this; } /** * @private * handle mouse events * @param {Object} ev */ var _proto = MouseInput$2.prototype; _proto.handler = function handler(ev) { var eventType = MOUSE_INPUT_MAP$1[ev.type]; if (eventType & INPUT_START$1 && ev.button === 0) this.pressed = true; if (eventType & INPUT_MOVE$1 && ev.which !== 1) eventType = INPUT_END$1; if (!this.pressed) return; if (eventType & INPUT_END$1) this.pressed = false; this.callback(this.manager, eventType, { pointers: [ev], changedPointers: [ev], pointerType: INPUT_TYPE_MOUSE$1, srcEvent: ev }); }; return MouseInput$2; }(Input$1); /** * @private * Combined touch and mouse input * * Touch has a higher priority then mouse, and while touching no mouse events are allowed. * This because touch devices also emit mouse events while doing a touch. * * @constructor * @extends Input */ var DEDUP_TIMEOUT$1 = 2500; var DEDUP_DISTANCE$1 = 25; function setLastTouch$1(eventData) { var _eventData$changedPoi = eventData.changedPointers, touch = _eventData$changedPoi[0]; if (touch.identifier === this.primaryTouch) { var lastTouch = { x: touch.clientX, y: touch.clientY }; var lts = this.lastTouches; this.lastTouches.push(lastTouch); var removeLastTouch = function removeLastTouch$1() { var i = lts.indexOf(lastTouch); if (i > -1) lts.splice(i, 1); }; setTimeout(removeLastTouch, DEDUP_TIMEOUT$1); } } function recordTouches$1(eventType, eventData) { if (eventType & INPUT_START$1) { this.primaryTouch = eventData.changedPointers[0].identifier; setLastTouch$1.call(this, eventData); } else if (eventType & (INPUT_END$1 | INPUT_CANCEL$1)) setLastTouch$1.call(this, eventData); } function isSyntheticEvent$1(eventData) { var x = eventData.srcEvent.clientX; var y = eventData.srcEvent.clientY; for (var i = 0; i < this.lastTouches.length; i++) { var t = this.lastTouches[i]; var dx = Math.abs(x - t.x); var dy = Math.abs(y - t.y); if (dx <= DEDUP_DISTANCE$1 && dy <= DEDUP_DISTANCE$1) return true; } return false; } var TouchMouseInput$1 = /* @__PURE__ */ function() { var TouchMouseInput$2 = /* @__PURE__ */ function(_Input) { _inheritsLoose$1(TouchMouseInput$3, _Input); function TouchMouseInput$3(_manager, callback) { var _this; _this = _Input.call(this, _manager, callback) || this; _this.handler = function(manager, inputEvent, inputData) { var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH$1; var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE$1; if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) return; if (isTouch) recordTouches$1.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputEvent, inputData); else if (isMouse && isSyntheticEvent$1.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputData)) return; _this.callback(manager, inputEvent, inputData); }; _this.touch = new TouchInput$1(_this.manager, _this.handler); _this.mouse = new MouseInput$1(_this.manager, _this.handler); _this.primaryTouch = null; _this.lastTouches = []; return _this; } /** * @private * handle mouse and touch events * @param {Hammer} manager * @param {String} inputEvent * @param {Object} inputData */ var _proto = TouchMouseInput$3.prototype; /** * @private * remove the event listeners */ _proto.destroy = function destroy() { this.touch.destroy(); this.mouse.destroy(); }; return TouchMouseInput$3; }(Input$1); return TouchMouseInput$2; }(); /** * @private * create new input type manager * called by the Manager constructor * @param {Hammer} manager * @returns {Input} */ function createInputInstance$1(manager) { var Type; var inputClass = manager.options.inputClass; if (inputClass) Type = inputClass; else if (SUPPORT_POINTER_EVENTS$1) Type = PointerEventInput$1; else if (SUPPORT_ONLY_TOUCH$1) Type = TouchInput$1; else if (!SUPPORT_TOUCH$1) Type = MouseInput$1; else Type = TouchMouseInput$1; return new Type(manager, inputHandler$1); } /** * @private * if the argument is an array, we want to execute the fn on each entry * if it aint an array we don't want to do a thing. * this is used by all the methods that accept a single and array argument. * @param {*|Array} arg * @param {String} fn * @param {Object} [context] * @returns {Boolean} */ function invokeArrayArg$1(arg, fn, context) { if (Array.isArray(arg)) { each$1(arg, context[fn], context); return true; } return false; } var STATE_POSSIBLE$1 = 1; var STATE_BEGAN$1 = 2; var STATE_CHANGED$1 = 4; var STATE_ENDED$1 = 8; var STATE_RECOGNIZED$1 = STATE_ENDED$1; var STATE_CANCELLED$1 = 16; var STATE_FAILED$1 = 32; /** * @private * get a unique id * @returns {number} uniqueId */ var _uniqueId$1 = 1; function uniqueId$1() { return _uniqueId$1++; } /** * @private * get a recognizer by name if it is bound to a manager * @param {Recognizer|String} otherRecognizer * @param {Recognizer} recognizer * @returns {Recognizer} */ function getRecognizerByNameIfManager$1(otherRecognizer, recognizer) { var manager = recognizer.manager; if (manager) return manager.get(otherRecognizer); return otherRecognizer; } /** * @private * get a usable string, used as event postfix * @param {constant} state * @returns {String} state */ function stateStr$1(state) { if (state & STATE_CANCELLED$1) return "cancel"; else if (state & STATE_ENDED$1) return "end"; else if (state & STATE_CHANGED$1) return "move"; else if (state & STATE_BEGAN$1) return "start"; return ""; } /** * @private * Recognizer flow explained; * * All recognizers have the initial state of POSSIBLE when a input session starts. * The definition of a input session is from the first input until the last input, with all it's movement in it. * * Example session for mouse-input: mousedown -> mousemove -> mouseup * * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed * which determines with state it should be. * * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to * POSSIBLE to give it another change on the next cycle. * * Possible * | * +-----+---------------+ * | | * +-----+-----+ | * | | | * Failed Cancelled | * +-------+------+ * | | * Recognized Began * | * Changed * | * Ended/Recognized */ /** * @private * Recognizer * Every recognizer needs to extend from this class. * @constructor * @param {Object} options */ var Recognizer$1 = /* @__PURE__ */ function() { function Recognizer$2(options) { if (options === void 0) options = {}; this.options = _extends$1({ enable: true }, options); this.id = uniqueId$1(); this.manager = null; this.state = STATE_POSSIBLE$1; this.simultaneous = {}; this.requireFail = []; } /** * @private * set options * @param {Object} options * @return {Recognizer} */ var _proto = Recognizer$2.prototype; _proto.set = function set$4(options) { assign$1$1(this.options, options); this.manager && this.manager.touchAction.update(); return this; }; /** * @private * recognize simultaneous with an other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ _proto.recognizeWith = function recognizeWith(otherRecognizer) { if (invokeArrayArg$1(otherRecognizer, "recognizeWith", this)) return this; var simultaneous = this.simultaneous; otherRecognizer = getRecognizerByNameIfManager$1(otherRecognizer, this); if (!simultaneous[otherRecognizer.id]) { simultaneous[otherRecognizer.id] = otherRecognizer; otherRecognizer.recognizeWith(this); } return this; }; /** * @private * drop the simultaneous link. it doesnt remove the link on the other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) { if (invokeArrayArg$1(otherRecognizer, "dropRecognizeWith", this)) return this; otherRecognizer = getRecognizerByNameIfManager$1(otherRecognizer, this); delete this.simultaneous[otherRecognizer.id]; return this; }; /** * @private * recognizer can only run when an other is failing * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ _proto.requireFailure = function requireFailure(otherRecognizer) { if (invokeArrayArg$1(otherRecognizer, "requireFailure", this)) return this; var requireFail = this.requireFail; otherRecognizer = getRecognizerByNameIfManager$1(otherRecognizer, this); if (inArray$1(requireFail, otherRecognizer) === -1) { requireFail.push(otherRecognizer); otherRecognizer.requireFailure(this); } return this; }; /** * @private * drop the requireFailure link. it does not remove the link on the other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) { if (invokeArrayArg$1(otherRecognizer, "dropRequireFailure", this)) return this; otherRecognizer = getRecognizerByNameIfManager$1(otherRecognizer, this); var index$1 = inArray$1(this.requireFail, otherRecognizer); if (index$1 > -1) this.requireFail.splice(index$1, 1); return this; }; /** * @private * has require failures boolean * @returns {boolean} */ _proto.hasRequireFailures = function hasRequireFailures() { return this.requireFail.length > 0; }; /** * @private * if the recognizer can recognize simultaneous with an other recognizer * @param {Recognizer} otherRecognizer * @returns {Boolean} */ _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) { return !!this.simultaneous[otherRecognizer.id]; }; /** * @private * You should use `tryEmit` instead of `emit` directly to check * that all the needed recognizers has failed before emitting. * @param {Object} input */ _proto.emit = function emit(input) { var self$1 = this; var state = this.state; function emit(event) { self$1.manager.emit(event, input); } if (state < STATE_ENDED$1) emit(self$1.options.event + stateStr$1(state)); emit(self$1.options.event); if (input.additionalEvent) emit(input.additionalEvent); if (state >= STATE_ENDED$1) emit(self$1.options.event + stateStr$1(state)); }; /** * @private * Check that all the require failure recognizers has failed, * if true, it emits a gesture event, * otherwise, setup the state to FAILED. * @param {Object} input */ _proto.tryEmit = function tryEmit(input) { if (this.canEmit()) return this.emit(input); this.state = STATE_FAILED$1; }; /** * @private * can we emit? * @returns {boolean} */ _proto.canEmit = function canEmit() { var i = 0; while (i < this.requireFail.length) { if (!(this.requireFail[i].state & (STATE_FAILED$1 | STATE_POSSIBLE$1))) return false; i++; } return true; }; /** * @private * update the recognizer * @param {Object} inputData */ _proto.recognize = function recognize(inputData) { var inputDataClone = assign$1$1({}, inputData); if (!boolOrFn$1(this.options.enable, [this, inputDataClone])) { this.reset(); this.state = STATE_FAILED$1; return; } if (this.state & (STATE_RECOGNIZED$1 | STATE_CANCELLED$1 | STATE_FAILED$1)) this.state = STATE_POSSIBLE$1; this.state = this.process(inputDataClone); if (this.state & (STATE_BEGAN$1 | STATE_CHANGED$1 | STATE_ENDED$1 | STATE_CANCELLED$1)) this.tryEmit(inputDataClone); }; /** * @private * return the state of the recognizer * the actual recognizing happens in this method * @virtual * @param {Object} inputData * @returns {constant} STATE */ _proto.process = function process(inputData) {}; /** * @private * return the preferred touch-action * @virtual * @returns {Array} */ _proto.getTouchAction = function getTouchAction() {}; /** * @private * called when the gesture isn't allowed to recognize * like when another is being recognized or it is disabled * @virtual */ _proto.reset = function reset() {}; return Recognizer$2; }(); /** * @private * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur * between the given interval and position. The delay option can be used to recognize multi-taps without firing * a single tap. * * The eventData from the emitted event contains the property `tapCount`, which contains the amount of * multi-taps being recognized. * @constructor * @extends Recognizer */ var TapRecognizer$1 = /* @__PURE__ */ function(_Recognizer) { _inheritsLoose$1(TapRecognizer$2, _Recognizer); function TapRecognizer$2(options) { var _this; if (options === void 0) options = {}; _this = _Recognizer.call(this, _extends$1({ event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 9, posThreshold: 10 }, options)) || this; _this.pTime = false; _this.pCenter = false; _this._timer = null; _this._input = null; _this.count = 0; return _this; } var _proto = TapRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return [TOUCH_ACTION_MANIPULATION$1]; }; _proto.process = function process(input) { var _this2 = this; var options = this.options; var validPointers = input.pointers.length === options.pointers; var validMovement = input.distance < options.threshold; var validTouchTime = input.deltaTime < options.time; this.reset(); if (input.eventType & INPUT_START$1 && this.count === 0) return this.failTimeout(); if (validMovement && validTouchTime && validPointers) { if (input.eventType !== INPUT_END$1) return this.failTimeout(); var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true; var validMultiTap = !this.pCenter || getDistance$1(this.pCenter, input.center) < options.posThreshold; this.pTime = input.timeStamp; this.pCenter = input.center; if (!validMultiTap || !validInterval) this.count = 1; else this.count += 1; this._input = input; var tapCount = this.count % options.taps; if (tapCount === 0) if (!this.hasRequireFailures()) return STATE_RECOGNIZED$1; else { this._timer = setTimeout(function() { _this2.state = STATE_RECOGNIZED$1; _this2.tryEmit(); }, options.interval); return STATE_BEGAN$1; } } return STATE_FAILED$1; }; _proto.failTimeout = function failTimeout() { var _this3 = this; this._timer = setTimeout(function() { _this3.state = STATE_FAILED$1; }, this.options.interval); return STATE_FAILED$1; }; _proto.reset = function reset() { clearTimeout(this._timer); }; _proto.emit = function emit() { if (this.state === STATE_RECOGNIZED$1) { this._input.tapCount = this.count; this.manager.emit(this.options.event, this._input); } }; return TapRecognizer$2; }(Recognizer$1); /** * @private * This recognizer is just used as a base for the simple attribute recognizers. * @constructor * @extends Recognizer */ var AttrRecognizer$1 = /* @__PURE__ */ function(_Recognizer) { _inheritsLoose$1(AttrRecognizer$2, _Recognizer); function AttrRecognizer$2(options) { if (options === void 0) options = {}; return _Recognizer.call(this, _extends$1({ pointers: 1 }, options)) || this; } /** * @private * Used to check if it the recognizer receives valid input, like input.distance > 10. * @memberof AttrRecognizer * @param {Object} input * @returns {Boolean} recognized */ var _proto = AttrRecognizer$2.prototype; _proto.attrTest = function attrTest(input) { var optionPointers = this.options.pointers; return optionPointers === 0 || input.pointers.length === optionPointers; }; /** * @private * Process the input and return the state for the recognizer * @memberof AttrRecognizer * @param {Object} input * @returns {*} State */ _proto.process = function process(input) { var state = this.state; var eventType = input.eventType; var isRecognized = state & (STATE_BEGAN$1 | STATE_CHANGED$1); var isValid = this.attrTest(input); if (isRecognized && (eventType & INPUT_CANCEL$1 || !isValid)) return state | STATE_CANCELLED$1; else if (isRecognized || isValid) { if (eventType & INPUT_END$1) return state | STATE_ENDED$1; else if (!(state & STATE_BEGAN$1)) return STATE_BEGAN$1; return state | STATE_CHANGED$1; } return STATE_FAILED$1; }; return AttrRecognizer$2; }(Recognizer$1); /** * @private * direction cons to string * @param {constant} direction * @returns {String} */ function directionStr$1(direction) { if (direction === DIRECTION_DOWN$1) return "down"; else if (direction === DIRECTION_UP$1) return "up"; else if (direction === DIRECTION_LEFT$1) return "left"; else if (direction === DIRECTION_RIGHT$1) return "right"; return ""; } /** * @private * Pan * Recognized when the pointer is down and moved in the allowed direction. * @constructor * @extends AttrRecognizer */ var PanRecognizer$1 = /* @__PURE__ */ function(_AttrRecognizer) { _inheritsLoose$1(PanRecognizer$2, _AttrRecognizer); function PanRecognizer$2(options) { var _this; if (options === void 0) options = {}; _this = _AttrRecognizer.call(this, _extends$1({ event: "pan", threshold: 10, pointers: 1, direction: DIRECTION_ALL$1 }, options)) || this; _this.pX = null; _this.pY = null; return _this; } var _proto = PanRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { var direction = this.options.direction; var actions = []; if (direction & DIRECTION_HORIZONTAL$1) actions.push(TOUCH_ACTION_PAN_Y$1); if (direction & DIRECTION_VERTICAL$1) actions.push(TOUCH_ACTION_PAN_X$1); return actions; }; _proto.directionTest = function directionTest(input) { var options = this.options; var hasMoved = true; var distance = input.distance; var direction = input.direction; var x = input.deltaX; var y = input.deltaY; if (!(direction & options.direction)) if (options.direction & DIRECTION_HORIZONTAL$1) { direction = x === 0 ? DIRECTION_NONE$1 : x < 0 ? DIRECTION_LEFT$1 : DIRECTION_RIGHT$1; hasMoved = x !== this.pX; distance = Math.abs(input.deltaX); } else { direction = y === 0 ? DIRECTION_NONE$1 : y < 0 ? DIRECTION_UP$1 : DIRECTION_DOWN$1; hasMoved = y !== this.pY; distance = Math.abs(input.deltaY); } input.direction = direction; return hasMoved && distance > options.threshold && direction & options.direction; }; _proto.attrTest = function attrTest(input) { return AttrRecognizer$1.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN$1 || !(this.state & STATE_BEGAN$1) && this.directionTest(input)); }; _proto.emit = function emit(input) { this.pX = input.deltaX; this.pY = input.deltaY; var direction = directionStr$1(input.direction); if (direction) input.additionalEvent = this.options.event + direction; _AttrRecognizer.prototype.emit.call(this, input); }; return PanRecognizer$2; }(AttrRecognizer$1); /** * @private * Swipe * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. * @constructor * @extends AttrRecognizer */ var SwipeRecognizer$1 = /* @__PURE__ */ function(_AttrRecognizer) { _inheritsLoose$1(SwipeRecognizer$2, _AttrRecognizer); function SwipeRecognizer$2(options) { if (options === void 0) options = {}; return _AttrRecognizer.call(this, _extends$1({ event: "swipe", threshold: 10, velocity: .3, direction: DIRECTION_HORIZONTAL$1 | DIRECTION_VERTICAL$1, pointers: 1 }, options)) || this; } var _proto = SwipeRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return PanRecognizer$1.prototype.getTouchAction.call(this); }; _proto.attrTest = function attrTest(input) { var direction = this.options.direction; var velocity; if (direction & (DIRECTION_HORIZONTAL$1 | DIRECTION_VERTICAL$1)) velocity = input.overallVelocity; else if (direction & DIRECTION_HORIZONTAL$1) velocity = input.overallVelocityX; else if (direction & DIRECTION_VERTICAL$1) velocity = input.overallVelocityY; return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs$1(velocity) > this.options.velocity && input.eventType & INPUT_END$1; }; _proto.emit = function emit(input) { var direction = directionStr$1(input.offsetDirection); if (direction) this.manager.emit(this.options.event + direction, input); this.manager.emit(this.options.event, input); }; return SwipeRecognizer$2; }(AttrRecognizer$1); /** * @private * Pinch * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). * @constructor * @extends AttrRecognizer */ var PinchRecognizer$1 = /* @__PURE__ */ function(_AttrRecognizer) { _inheritsLoose$1(PinchRecognizer$2, _AttrRecognizer); function PinchRecognizer$2(options) { if (options === void 0) options = {}; return _AttrRecognizer.call(this, _extends$1({ event: "pinch", threshold: 0, pointers: 2 }, options)) || this; } var _proto = PinchRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return [TOUCH_ACTION_NONE$1]; }; _proto.attrTest = function attrTest(input) { return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN$1); }; _proto.emit = function emit(input) { if (input.scale !== 1) { var inOut = input.scale < 1 ? "in" : "out"; input.additionalEvent = this.options.event + inOut; } _AttrRecognizer.prototype.emit.call(this, input); }; return PinchRecognizer$2; }(AttrRecognizer$1); /** * @private * Rotate * Recognized when two or more pointer are moving in a circular motion. * @constructor * @extends AttrRecognizer */ var RotateRecognizer$1 = /* @__PURE__ */ function(_AttrRecognizer) { _inheritsLoose$1(RotateRecognizer$2, _AttrRecognizer); function RotateRecognizer$2(options) { if (options === void 0) options = {}; return _AttrRecognizer.call(this, _extends$1({ event: "rotate", threshold: 0, pointers: 2 }, options)) || this; } var _proto = RotateRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return [TOUCH_ACTION_NONE$1]; }; _proto.attrTest = function attrTest(input) { return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN$1); }; return RotateRecognizer$2; }(AttrRecognizer$1); /** * @private * Press * Recognized when the pointer is down for x ms without any movement. * @constructor * @extends Recognizer */ var PressRecognizer$1 = /* @__PURE__ */ function(_Recognizer) { _inheritsLoose$1(PressRecognizer$2, _Recognizer); function PressRecognizer$2(options) { var _this; if (options === void 0) options = {}; _this = _Recognizer.call(this, _extends$1({ event: "press", pointers: 1, time: 251, threshold: 9 }, options)) || this; _this._timer = null; _this._input = null; return _this; } var _proto = PressRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return [TOUCH_ACTION_AUTO$1]; }; _proto.process = function process(input) { var _this2 = this; var options = this.options; var validPointers = input.pointers.length === options.pointers; var validMovement = input.distance < options.threshold; var validTime = input.deltaTime > options.time; this._input = input; if (!validMovement || !validPointers || input.eventType & (INPUT_END$1 | INPUT_CANCEL$1) && !validTime) this.reset(); else if (input.eventType & INPUT_START$1) { this.reset(); this._timer = setTimeout(function() { _this2.state = STATE_RECOGNIZED$1; _this2.tryEmit(); }, options.time); } else if (input.eventType & INPUT_END$1) return STATE_RECOGNIZED$1; return STATE_FAILED$1; }; _proto.reset = function reset() { clearTimeout(this._timer); }; _proto.emit = function emit(input) { if (this.state !== STATE_RECOGNIZED$1) return; if (input && input.eventType & INPUT_END$1) this.manager.emit(this.options.event + "up", input); else { this._input.timeStamp = now$4(); this.manager.emit(this.options.event, this._input); } }; return PressRecognizer$2; }(Recognizer$1); var defaults$1 = { domEvents: false, touchAction: TOUCH_ACTION_COMPUTE$1, enable: true, inputTarget: null, inputClass: null, cssProps: { userSelect: "none", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } }; /** * @private * Default recognizer setup when calling `Hammer()` * When creating a new Manager these will be skipped. * This is separated with other defaults because of tree-shaking. * @type {Array} */ var preset$1 = [ [RotateRecognizer$1, { enable: false }], [ PinchRecognizer$1, { enable: false }, ["rotate"] ], [SwipeRecognizer$1, { direction: DIRECTION_HORIZONTAL$1 }], [ PanRecognizer$1, { direction: DIRECTION_HORIZONTAL$1 }, ["swipe"] ], [TapRecognizer$1], [ TapRecognizer$1, { event: "doubletap", taps: 2 }, ["tap"] ], [PressRecognizer$1] ]; var STOP$1 = 1; var FORCED_STOP$1 = 2; /** * @private * add/remove the css properties as defined in manager.options.cssProps * @param {Manager} manager * @param {Boolean} add */ function toggleCssProps$1(manager, add) { var element = manager.element; if (!element.style) return; var prop; each$1(manager.options.cssProps, function(value, name) { prop = prefixed$1(element.style, name); if (add) { manager.oldCssProps[prop] = element.style[prop]; element.style[prop] = value; } else element.style[prop] = manager.oldCssProps[prop] || ""; }); if (!add) manager.oldCssProps = {}; } /** * @private * trigger dom event * @param {String} event * @param {Object} data */ function triggerDomEvent$1(event, data) { var gestureEvent = document.createEvent("Event"); gestureEvent.initEvent(event, true, true); gestureEvent.gesture = data; data.target.dispatchEvent(gestureEvent); } /** * @private * Manager * @param {HTMLElement} element * @param {Object} [options] * @constructor */ var Manager$1 = /* @__PURE__ */ function() { function Manager$2(element, options) { var _this = this; this.options = assign$1$1({}, defaults$1, options || {}); this.options.inputTarget = this.options.inputTarget || element; this.handlers = {}; this.session = {}; this.recognizers = []; this.oldCssProps = {}; this.element = element; this.input = createInputInstance$1(this); this.touchAction = new TouchAction$1(this, this.options.touchAction); toggleCssProps$1(this, true); each$1(this.options.recognizers, function(item) { var recognizer = _this.add(new item[0](item[1])); item[2] && recognizer.recognizeWith(item[2]); item[3] && recognizer.requireFailure(item[3]); }, this); } /** * @private * set options * @param {Object} options * @returns {Manager} */ var _proto = Manager$2.prototype; _proto.set = function set$4(options) { assign$1$1(this.options, options); if (options.touchAction) this.touchAction.update(); if (options.inputTarget) { this.input.destroy(); this.input.target = options.inputTarget; this.input.init(); } return this; }; /** * @private * stop recognizing for this session. * This session will be discarded, when a new [input]start event is fired. * When forced, the recognizer cycle is stopped immediately. * @param {Boolean} [force] */ _proto.stop = function stop(force) { this.session.stopped = force ? FORCED_STOP$1 : STOP$1; }; /** * @private * run the recognizers! * called by the inputHandler function on every movement of the pointers (touches) * it walks through all the recognizers and tries to detect the gesture that is being made * @param {Object} inputData */ _proto.recognize = function recognize(inputData) { var session = this.session; if (session.stopped) return; this.touchAction.preventDefaults(inputData); var recognizer; var recognizers = this.recognizers; var curRecognizer = session.curRecognizer; if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED$1) { session.curRecognizer = null; curRecognizer = null; } var i = 0; while (i < recognizers.length) { recognizer = recognizers[i]; if (session.stopped !== FORCED_STOP$1 && (!curRecognizer || recognizer === curRecognizer || recognizer.canRecognizeWith(curRecognizer))) recognizer.recognize(inputData); else recognizer.reset(); if (!curRecognizer && recognizer.state & (STATE_BEGAN$1 | STATE_CHANGED$1 | STATE_ENDED$1)) { session.curRecognizer = recognizer; curRecognizer = recognizer; } i++; } }; /** * @private * get a recognizer by its event name. * @param {Recognizer|String} recognizer * @returns {Recognizer|Null} */ _proto.get = function get(recognizer) { if (recognizer instanceof Recognizer$1) return recognizer; var recognizers = this.recognizers; for (var i = 0; i < recognizers.length; i++) if (recognizers[i].options.event === recognizer) return recognizers[i]; return null; }; /** * @private add a recognizer to the manager * existing recognizers with the same event name will be removed * @param {Recognizer} recognizer * @returns {Recognizer|Manager} */ _proto.add = function add(recognizer) { if (invokeArrayArg$1(recognizer, "add", this)) return this; var existing = this.get(recognizer.options.event); if (existing) this.remove(existing); this.recognizers.push(recognizer); recognizer.manager = this; this.touchAction.update(); return recognizer; }; /** * @private * remove a recognizer by name or instance * @param {Recognizer|String} recognizer * @returns {Manager} */ _proto.remove = function remove(recognizer) { if (invokeArrayArg$1(recognizer, "remove", this)) return this; var targetRecognizer = this.get(recognizer); if (recognizer) { var recognizers = this.recognizers; var index$1 = inArray$1(recognizers, targetRecognizer); if (index$1 !== -1) { recognizers.splice(index$1, 1); this.touchAction.update(); } } return this; }; /** * @private * bind event * @param {String} events * @param {Function} handler * @returns {EventEmitter} this */ _proto.on = function on(events, handler) { if (events === void 0 || handler === void 0) return this; var handlers = this.handlers; each$1(splitStr$1(events), function(event) { handlers[event] = handlers[event] || []; handlers[event].push(handler); }); return this; }; /** * @private unbind event, leave emit blank to remove all handlers * @param {String} events * @param {Function} [handler] * @returns {EventEmitter} this */ _proto.off = function off(events, handler) { if (events === void 0) return this; var handlers = this.handlers; each$1(splitStr$1(events), function(event) { if (!handler) delete handlers[event]; else handlers[event] && handlers[event].splice(inArray$1(handlers[event], handler), 1); }); return this; }; /** * @private emit event to the listeners * @param {String} event * @param {Object} data */ _proto.emit = function emit(event, data) { if (this.options.domEvents) triggerDomEvent$1(event, data); var handlers = this.handlers[event] && this.handlers[event].slice(); if (!handlers || !handlers.length) return; data.type = event; data.preventDefault = function() { data.srcEvent.preventDefault(); }; var i = 0; while (i < handlers.length) { handlers[i](data); i++; } }; /** * @private * destroy the manager and unbinds all events * it doesn't unbind dom events, that is the user own responsibility */ _proto.destroy = function destroy() { this.element && toggleCssProps$1(this, false); this.handlers = {}; this.session = {}; this.input.destroy(); this.element = null; }; return Manager$2; }(); var SINGLE_TOUCH_INPUT_MAP$1 = { touchstart: INPUT_START$1, touchmove: INPUT_MOVE$1, touchend: INPUT_END$1, touchcancel: INPUT_CANCEL$1 }; var SINGLE_TOUCH_TARGET_EVENTS$1 = "touchstart"; var SINGLE_TOUCH_WINDOW_EVENTS$1 = "touchstart touchmove touchend touchcancel"; /** * @private * Touch events input * @constructor * @extends Input */ var SingleTouchInput$1 = /* @__PURE__ */ function(_Input) { _inheritsLoose$1(SingleTouchInput$2, _Input); function SingleTouchInput$2() { var _this; var proto = SingleTouchInput$2.prototype; proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS$1; proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS$1; _this = _Input.apply(this, arguments) || this; _this.started = false; return _this; } var _proto = SingleTouchInput$2.prototype; _proto.handler = function handler(ev) { var type = SINGLE_TOUCH_INPUT_MAP$1[ev.type]; if (type === INPUT_START$1) this.started = true; if (!this.started) return; var touches = normalizeSingleTouches$1.call(this, ev, type); if (type & (INPUT_END$1 | INPUT_CANCEL$1) && touches[0].length - touches[1].length === 0) this.started = false; this.callback(this.manager, type, { pointers: touches[0], changedPointers: touches[1], pointerType: INPUT_TYPE_TOUCH$1, srcEvent: ev }); }; return SingleTouchInput$2; }(Input$1); function normalizeSingleTouches$1(ev, type) { var all = toArray$1(ev.touches); var changed = toArray$1(ev.changedTouches); if (type & (INPUT_END$1 | INPUT_CANCEL$1)) all = uniqueArray$1(all.concat(changed), "identifier", true); return [all, changed]; } /** * @private * wrap a method with a deprecation warning and stack trace * @param {Function} method * @param {String} name * @param {String} message * @returns {Function} A new function wrapping the supplied method. */ function deprecate$1(method, name, message) { var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n"; return function() { var e = new Error("get-stack-trace"); var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace"; var log = window.console && (window.console.warn || window.console.log); if (log) log.call(window.console, deprecationMessage, stack); return method.apply(this, arguments); }; } /** * @private * extend object. * means that properties in dest will be overwritten by the ones in src. * @param {Object} dest * @param {Object} src * @param {Boolean} [merge=false] * @returns {Object} dest */ var extend$1 = deprecate$1(function(dest, src, merge$3) { var keys$8 = Object.keys(src); var i = 0; while (i < keys$8.length) { if (!merge$3 || merge$3 && dest[keys$8[i]] === void 0) dest[keys$8[i]] = src[keys$8[i]]; i++; } return dest; }, "extend", "Use `assign`."); /** * @private * merge the values from src in the dest. * means that properties that exist in dest will not be overwritten by src * @param {Object} dest * @param {Object} src * @returns {Object} dest */ var merge$2 = deprecate$1(function(dest, src) { return extend$1(dest, src, true); }, "merge", "Use `assign`."); /** * @private * simple class inheritance * @param {Function} child * @param {Function} base * @param {Object} [properties] */ function inherit$1(child, base, properties) { var baseP = base.prototype; var childP; childP = child.prototype = Object.create(baseP); childP.constructor = child; childP._super = baseP; if (properties) assign$1$1(childP, properties); } /** * @private * simple function bind * @param {Function} fn * @param {Object} context * @returns {Function} */ function bindFn$1(fn, context) { return function boundFn() { return fn.apply(context, arguments); }; } /** * @private * Simple way to create a manager with a default set of recognizers. * @param {HTMLElement} element * @param {Object} [options] * @constructor */ var Hammer$3 = /* @__PURE__ */ function() { var Hammer$4 = function Hammer$5(element, options) { if (options === void 0) options = {}; return new Manager$1(element, _extends$1({ recognizers: preset$1.concat() }, options)); }; Hammer$4.VERSION = "2.0.17-rc"; Hammer$4.DIRECTION_ALL = DIRECTION_ALL$1; Hammer$4.DIRECTION_DOWN = DIRECTION_DOWN$1; Hammer$4.DIRECTION_LEFT = DIRECTION_LEFT$1; Hammer$4.DIRECTION_RIGHT = DIRECTION_RIGHT$1; Hammer$4.DIRECTION_UP = DIRECTION_UP$1; Hammer$4.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL$1; Hammer$4.DIRECTION_VERTICAL = DIRECTION_VERTICAL$1; Hammer$4.DIRECTION_NONE = DIRECTION_NONE$1; Hammer$4.DIRECTION_DOWN = DIRECTION_DOWN$1; Hammer$4.INPUT_START = INPUT_START$1; Hammer$4.INPUT_MOVE = INPUT_MOVE$1; Hammer$4.INPUT_END = INPUT_END$1; Hammer$4.INPUT_CANCEL = INPUT_CANCEL$1; Hammer$4.STATE_POSSIBLE = STATE_POSSIBLE$1; Hammer$4.STATE_BEGAN = STATE_BEGAN$1; Hammer$4.STATE_CHANGED = STATE_CHANGED$1; Hammer$4.STATE_ENDED = STATE_ENDED$1; Hammer$4.STATE_RECOGNIZED = STATE_RECOGNIZED$1; Hammer$4.STATE_CANCELLED = STATE_CANCELLED$1; Hammer$4.STATE_FAILED = STATE_FAILED$1; Hammer$4.Manager = Manager$1; Hammer$4.Input = Input$1; Hammer$4.TouchAction = TouchAction$1; Hammer$4.TouchInput = TouchInput$1; Hammer$4.MouseInput = MouseInput$1; Hammer$4.PointerEventInput = PointerEventInput$1; Hammer$4.TouchMouseInput = TouchMouseInput$1; Hammer$4.SingleTouchInput = SingleTouchInput$1; Hammer$4.Recognizer = Recognizer$1; Hammer$4.AttrRecognizer = AttrRecognizer$1; Hammer$4.Tap = TapRecognizer$1; Hammer$4.Pan = PanRecognizer$1; Hammer$4.Swipe = SwipeRecognizer$1; Hammer$4.Pinch = PinchRecognizer$1; Hammer$4.Rotate = RotateRecognizer$1; Hammer$4.Press = PressRecognizer$1; Hammer$4.on = addEventListeners$1; Hammer$4.off = removeEventListeners$1; Hammer$4.each = each$1; Hammer$4.merge = merge$2; Hammer$4.extend = extend$1; Hammer$4.bindFn = bindFn$1; Hammer$4.assign = assign$1$1; Hammer$4.inherit = inherit$1; Hammer$4.bindFn = bindFn$1; Hammer$4.prefixed = prefixed$1; Hammer$4.toArray = toArray$1; Hammer$4.inArray = inArray$1; Hammer$4.uniqueArray = uniqueArray$1; Hammer$4.splitStr = splitStr$1; Hammer$4.boolOrFn = boolOrFn$1; Hammer$4.hasParent = hasParent$1; Hammer$4.addEventListeners = addEventListeners$1; Hammer$4.removeEventListeners = removeEventListeners$1; Hammer$4.defaults = assign$1$1({}, defaults$1, { preset: preset$1 }); return Hammer$4; }(); /** * vis-util * https://github.com/visjs/vis-util * * utilitie collection for visjs * * @version 6.0.0 * @date 2025-07-12T18:02:43.836Z * * @copyright (c) 2011-2017 Almende B.V, http://almende.com * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs * * @license * vis.js is dual licensed under both * * 1. The Apache 2.0 License * http://www.apache.org/licenses/LICENSE-2.0 * * and * * 2. The MIT License * http://opensource.org/licenses/MIT * * vis.js may be distributed under either license. */ /** * Use this symbol to delete properies in deepObjectAssign. */ const DELETE = Symbol("DELETE"); /** * Pure version of deepObjectAssign, it doesn't modify any of it's arguments. * @param base - The base object that fullfils the whole interface T. * @param updates - Updates that may change or delete props. * @returns A brand new instance with all the supplied objects deeply merged. */ function pureDeepObjectAssign(base, ...updates) { return deepObjectAssign({}, base, ...updates); } /** * Deep version of object assign with additional deleting by the DELETE symbol. * @param values - Objects to be deeply merged. * @returns The first object from values. */ function deepObjectAssign(...values$8) { const merged = deepObjectAssignNonentry(...values$8); stripDelete(merged); return merged; } /** * Deep version of object assign with additional deleting by the DELETE symbol. * @remarks * This doesn't strip the DELETE symbols so they may end up in the final object. * @param values - Objects to be deeply merged. * @returns The first object from values. */ function deepObjectAssignNonentry(...values$8) { if (values$8.length < 2) return values$8[0]; else if (values$8.length > 2) return deepObjectAssignNonentry(deepObjectAssign(values$8[0], values$8[1]), ...values$8.slice(2)); const a = values$8[0]; const b = values$8[1]; if (a instanceof Date && b instanceof Date) { a.setTime(b.getTime()); return a; } for (const prop of Reflect.ownKeys(b)) if (!Object.prototype.propertyIsEnumerable.call(b, prop)); else if (b[prop] === DELETE) delete a[prop]; else if (a[prop] !== null && b[prop] !== null && typeof a[prop] === "object" && typeof b[prop] === "object" && !Array.isArray(a[prop]) && !Array.isArray(b[prop])) a[prop] = deepObjectAssignNonentry(a[prop], b[prop]); else a[prop] = clone(b[prop]); return a; } /** * Deep clone given object or array. In case of primitive simply return. * @param a - Anything. * @returns Deep cloned object/array or unchanged a. */ function clone(a) { if (Array.isArray(a)) return a.map((value) => clone(value)); else if (typeof a === "object" && a !== null) { if (a instanceof Date) return new Date(a.getTime()); return deepObjectAssignNonentry({}, a); } else return a; } /** * Strip DELETE from given object. * @param a - Object which may contain DELETE but won't after this is executed. */ function stripDelete(a) { for (const prop of Object.keys(a)) if (a[prop] === DELETE) delete a[prop]; else if (typeof a[prop] === "object" && a[prop] !== null) stripDelete(a[prop]); } /** * Setup a mock hammer.js object, for unit testing. * * Inspiration: https://github.com/uber/deck.gl/pull/658 * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}} */ function hammerMock$1() { const noop = () => {}; return { on: noop, off: noop, destroy: noop, emit: noop, get() { return { set: noop }; } }; } const Hammer$1$4 = typeof window !== "undefined" ? window.Hammer || Hammer$3 : function() { return hammerMock$1(); }; /** * Turn an element into an clickToUse element. * When not active, the element has a transparent overlay. When the overlay is * clicked, the mode is changed to active. * When active, the element is displayed with a blue border around it, and * the interactive contents of the element can be used. When clicked outside * the element, the elements mode is changed to inactive. * @param {Element} container * @class Activator */ function Activator$1$1(container) { this._cleanupQueue = []; this.active = false; this._dom = { container, overlay: document.createElement("div") }; this._dom.overlay.classList.add("vis-overlay"); this._dom.container.appendChild(this._dom.overlay); this._cleanupQueue.push(() => { this._dom.overlay.parentNode.removeChild(this._dom.overlay); }); const hammer = Hammer$1$4(this._dom.overlay); hammer.on("tap", this._onTapOverlay.bind(this)); this._cleanupQueue.push(() => { hammer.destroy(); }); const events = [ "tap", "doubletap", "press", "pinch", "pan", "panstart", "panmove", "panend" ]; events.forEach((event) => { hammer.on(event, (event$1) => { event$1.srcEvent.stopPropagation(); }); }); if (document && document.body) { this._onClick = (event) => { if (!_hasParent$1(event.target, container)) this.deactivate(); }; document.body.addEventListener("click", this._onClick); this._cleanupQueue.push(() => { document.body.removeEventListener("click", this._onClick); }); } this._escListener = (event) => { if ("key" in event ? event.key === "Escape" : event.keyCode === 27) this.deactivate(); }; } Emitter$1(Activator$1$1.prototype); Activator$1$1.current = null; /** * Destroy the activator. Cleans up all created DOM and event listeners */ Activator$1$1.prototype.destroy = function() { this.deactivate(); for (const callback of this._cleanupQueue.splice(0).reverse()) callback(); }; /** * Activate the element * Overlay is hidden, element is decorated with a blue shadow border */ Activator$1$1.prototype.activate = function() { if (Activator$1$1.current) Activator$1$1.current.deactivate(); Activator$1$1.current = this; this.active = true; this._dom.overlay.style.display = "none"; this._dom.container.classList.add("vis-active"); this.emit("change"); this.emit("activate"); document.body.addEventListener("keydown", this._escListener); }; /** * Deactivate the element * Overlay is displayed on top of the element */ Activator$1$1.prototype.deactivate = function() { this.active = false; this._dom.overlay.style.display = "block"; this._dom.container.classList.remove("vis-active"); document.body.removeEventListener("keydown", this._escListener); this.emit("change"); this.emit("deactivate"); }; /** * Handle a tap event: activate the container * @param {Event} event The event * @private */ Activator$1$1.prototype._onTapOverlay = function(event) { this.activate(); event.srcEvent.stopPropagation(); }; /** * Test whether the element has the requested parent element somewhere in * its chain of parent nodes. * @param {HTMLElement} element * @param {HTMLElement} parent * @returns {boolean} Returns true when the parent is found somewhere in the * chain of parent nodes. * @private */ function _hasParent$1(element, parent) { while (element) { if (element === parent) return true; element = element.parentNode; } return false; } var getOwnPropertySymbols$2$1; var hasRequiredGetOwnPropertySymbols$2$1; function requireGetOwnPropertySymbols$2$1() { if (hasRequiredGetOwnPropertySymbols$2$1) return getOwnPropertySymbols$2$1; hasRequiredGetOwnPropertySymbols$2$1 = 1; requireEs_symbol$1(); var path$2 = /* @__PURE__ */ requirePath$1(); getOwnPropertySymbols$2$1 = path$2.Object.getOwnPropertySymbols; return getOwnPropertySymbols$2$1; } var getOwnPropertySymbols$1$1; var hasRequiredGetOwnPropertySymbols$1$1; function requireGetOwnPropertySymbols$1$1() { if (hasRequiredGetOwnPropertySymbols$1$1) return getOwnPropertySymbols$1$1; hasRequiredGetOwnPropertySymbols$1$1 = 1; var parent = /* @__PURE__ */ requireGetOwnPropertySymbols$2$1(); getOwnPropertySymbols$1$1 = parent; return getOwnPropertySymbols$1$1; } var getOwnPropertySymbols$3; var hasRequiredGetOwnPropertySymbols$3; function requireGetOwnPropertySymbols$3() { if (hasRequiredGetOwnPropertySymbols$3) return getOwnPropertySymbols$3; hasRequiredGetOwnPropertySymbols$3 = 1; getOwnPropertySymbols$3 = /* @__PURE__ */ requireGetOwnPropertySymbols$1$1(); return getOwnPropertySymbols$3; } var getOwnPropertySymbolsExports$1 = requireGetOwnPropertySymbols$3(); var _Object$getOwnPropertySymbols$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(getOwnPropertySymbolsExports$1); var getOwnPropertyDescriptor$2$1 = { exports: {} }; var es_object_getOwnPropertyDescriptor$1 = {}; var hasRequiredEs_object_getOwnPropertyDescriptor$1; function requireEs_object_getOwnPropertyDescriptor$1() { if (hasRequiredEs_object_getOwnPropertyDescriptor$1) return es_object_getOwnPropertyDescriptor$1; hasRequiredEs_object_getOwnPropertyDescriptor$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var nativeGetOwnPropertyDescriptor = requireObjectGetOwnPropertyDescriptor$1().f; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var FORCED = !DESCRIPTORS || fails$2(function() { nativeGetOwnPropertyDescriptor(1); }); $({ target: "Object", stat: true, forced: FORCED, sham: !DESCRIPTORS }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor$4(it$1, key) { return nativeGetOwnPropertyDescriptor(toIndexedObject$2(it$1), key); } }); return es_object_getOwnPropertyDescriptor$1; } var hasRequiredGetOwnPropertyDescriptor$2$1; function requireGetOwnPropertyDescriptor$2$1() { if (hasRequiredGetOwnPropertyDescriptor$2$1) return getOwnPropertyDescriptor$2$1.exports; hasRequiredGetOwnPropertyDescriptor$2$1 = 1; requireEs_object_getOwnPropertyDescriptor$1(); var path$2 = /* @__PURE__ */ requirePath$1(); var Object$1 = path$2.Object; var getOwnPropertyDescriptor$4 = getOwnPropertyDescriptor$2$1.exports = function getOwnPropertyDescriptor$5(it$1, key) { return Object$1.getOwnPropertyDescriptor(it$1, key); }; if (Object$1.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor$4.sham = true; return getOwnPropertyDescriptor$2$1.exports; } var getOwnPropertyDescriptor$1$1; var hasRequiredGetOwnPropertyDescriptor$1$1; function requireGetOwnPropertyDescriptor$1$1() { if (hasRequiredGetOwnPropertyDescriptor$1$1) return getOwnPropertyDescriptor$1$1; hasRequiredGetOwnPropertyDescriptor$1$1 = 1; var parent = /* @__PURE__ */ requireGetOwnPropertyDescriptor$2$1(); getOwnPropertyDescriptor$1$1 = parent; return getOwnPropertyDescriptor$1$1; } var getOwnPropertyDescriptor$3; var hasRequiredGetOwnPropertyDescriptor$3; function requireGetOwnPropertyDescriptor$3() { if (hasRequiredGetOwnPropertyDescriptor$3) return getOwnPropertyDescriptor$3; hasRequiredGetOwnPropertyDescriptor$3 = 1; getOwnPropertyDescriptor$3 = /* @__PURE__ */ requireGetOwnPropertyDescriptor$1$1(); return getOwnPropertyDescriptor$3; } var getOwnPropertyDescriptorExports$1 = requireGetOwnPropertyDescriptor$3(); var _Object$getOwnPropertyDescriptor$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(getOwnPropertyDescriptorExports$1); var es_array_forEach$1 = {}; var arrayForEach$1; var hasRequiredArrayForEach$1; function requireArrayForEach$1() { if (hasRequiredArrayForEach$1) return arrayForEach$1; hasRequiredArrayForEach$1 = 1; var $forEach = requireArrayIteration$1().forEach; var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict$1(); var STRICT_METHOD = arrayMethodIsStrict$2("forEach"); arrayForEach$1 = !STRICT_METHOD ? function forEach$6(callbackfn) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } : [].forEach; return arrayForEach$1; } var hasRequiredEs_array_forEach$1; function requireEs_array_forEach$1() { if (hasRequiredEs_array_forEach$1) return es_array_forEach$1; hasRequiredEs_array_forEach$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var forEach$6 = /* @__PURE__ */ requireArrayForEach$1(); $({ target: "Array", proto: true, forced: [].forEach !== forEach$6 }, { forEach: forEach$6 }); return es_array_forEach$1; } var forEach$3$1; var hasRequiredForEach$3$1; function requireForEach$3$1() { if (hasRequiredForEach$3$1) return forEach$3$1; hasRequiredForEach$3$1 = 1; requireEs_array_forEach$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); forEach$3$1 = getBuiltInPrototypeMethod$2("Array", "forEach"); return forEach$3$1; } var forEach$2$1; var hasRequiredForEach$2$1; function requireForEach$2$1() { if (hasRequiredForEach$2$1) return forEach$2$1; hasRequiredForEach$2$1 = 1; var parent = /* @__PURE__ */ requireForEach$3$1(); forEach$2$1 = parent; return forEach$2$1; } var forEach$1$1; var hasRequiredForEach$1$1; function requireForEach$1$1() { if (hasRequiredForEach$1$1) return forEach$1$1; hasRequiredForEach$1$1 = 1; var classof$2 = /* @__PURE__ */ requireClassof$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireForEach$2$1(); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; forEach$1$1 = function(it$1) { var own = it$1.forEach; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.forEach || hasOwn(DOMIterables, classof$2(it$1)) ? method : own; }; return forEach$1$1; } var forEach$5; var hasRequiredForEach$4; function requireForEach$4() { if (hasRequiredForEach$4) return forEach$5; hasRequiredForEach$4 = 1; forEach$5 = /* @__PURE__ */ requireForEach$1$1(); return forEach$5; } var forEachExports$1 = requireForEach$4(); var _forEachInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(forEachExports$1); var es_object_getOwnPropertyDescriptors$1 = {}; var ownKeys$4$1; var hasRequiredOwnKeys$3; function requireOwnKeys$3() { if (hasRequiredOwnKeys$3) return ownKeys$4$1; hasRequiredOwnKeys$3 = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var getOwnPropertyNamesModule = /* @__PURE__ */ requireObjectGetOwnPropertyNames$1(); var getOwnPropertySymbolsModule = /* @__PURE__ */ requireObjectGetOwnPropertySymbols$1(); var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var concat$5 = uncurryThis([].concat); ownKeys$4$1 = getBuiltIn$2("Reflect", "ownKeys") || function ownKeys$6(it$1) { var keys$8 = getOwnPropertyNamesModule.f(anObject$2(it$1)); var getOwnPropertySymbols$4 = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols$4 ? concat$5(keys$8, getOwnPropertySymbols$4(it$1)) : keys$8; }; return ownKeys$4$1; } var hasRequiredEs_object_getOwnPropertyDescriptors$1; function requireEs_object_getOwnPropertyDescriptors$1() { if (hasRequiredEs_object_getOwnPropertyDescriptors$1) return es_object_getOwnPropertyDescriptors$1; hasRequiredEs_object_getOwnPropertyDescriptors$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var ownKeys$6 = /* @__PURE__ */ requireOwnKeys$3(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject$1(); var getOwnPropertyDescriptorModule = /* @__PURE__ */ requireObjectGetOwnPropertyDescriptor$1(); var createProperty$2 = /* @__PURE__ */ requireCreateProperty$1(); $({ target: "Object", stat: true, sham: !DESCRIPTORS }, { getOwnPropertyDescriptors: function getOwnPropertyDescriptors$4(object$1) { var O = toIndexedObject$2(object$1); var getOwnPropertyDescriptor$4 = getOwnPropertyDescriptorModule.f; var keys$8 = ownKeys$6(O); var result = {}; var index$1 = 0; var key, descriptor; while (keys$8.length > index$1) { descriptor = getOwnPropertyDescriptor$4(O, key = keys$8[index$1++]); if (descriptor !== void 0) createProperty$2(result, key, descriptor); } return result; } }); return es_object_getOwnPropertyDescriptors$1; } var getOwnPropertyDescriptors$2$1; var hasRequiredGetOwnPropertyDescriptors$2$1; function requireGetOwnPropertyDescriptors$2$1() { if (hasRequiredGetOwnPropertyDescriptors$2$1) return getOwnPropertyDescriptors$2$1; hasRequiredGetOwnPropertyDescriptors$2$1 = 1; requireEs_object_getOwnPropertyDescriptors$1(); var path$2 = /* @__PURE__ */ requirePath$1(); getOwnPropertyDescriptors$2$1 = path$2.Object.getOwnPropertyDescriptors; return getOwnPropertyDescriptors$2$1; } var getOwnPropertyDescriptors$1$1; var hasRequiredGetOwnPropertyDescriptors$1$1; function requireGetOwnPropertyDescriptors$1$1() { if (hasRequiredGetOwnPropertyDescriptors$1$1) return getOwnPropertyDescriptors$1$1; hasRequiredGetOwnPropertyDescriptors$1$1 = 1; var parent = /* @__PURE__ */ requireGetOwnPropertyDescriptors$2$1(); getOwnPropertyDescriptors$1$1 = parent; return getOwnPropertyDescriptors$1$1; } var getOwnPropertyDescriptors$3; var hasRequiredGetOwnPropertyDescriptors$3; function requireGetOwnPropertyDescriptors$3() { if (hasRequiredGetOwnPropertyDescriptors$3) return getOwnPropertyDescriptors$3; hasRequiredGetOwnPropertyDescriptors$3 = 1; getOwnPropertyDescriptors$3 = /* @__PURE__ */ requireGetOwnPropertyDescriptors$1$1(); return getOwnPropertyDescriptors$3; } var getOwnPropertyDescriptorsExports$1 = requireGetOwnPropertyDescriptors$3(); var _Object$getOwnPropertyDescriptors$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(getOwnPropertyDescriptorsExports$1); var defineProperties$2$1 = { exports: {} }; var es_object_defineProperties$1 = {}; var hasRequiredEs_object_defineProperties$1; function requireEs_object_defineProperties$1() { if (hasRequiredEs_object_defineProperties$1) return es_object_defineProperties$1; hasRequiredEs_object_defineProperties$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var defineProperties$4 = requireObjectDefineProperties$1().f; $({ target: "Object", stat: true, forced: Object.defineProperties !== defineProperties$4, sham: !DESCRIPTORS }, { defineProperties: defineProperties$4 }); return es_object_defineProperties$1; } var hasRequiredDefineProperties$2$1; function requireDefineProperties$2$1() { if (hasRequiredDefineProperties$2$1) return defineProperties$2$1.exports; hasRequiredDefineProperties$2$1 = 1; requireEs_object_defineProperties$1(); var path$2 = /* @__PURE__ */ requirePath$1(); var Object$1 = path$2.Object; var defineProperties$4 = defineProperties$2$1.exports = function defineProperties$5(T, D) { return Object$1.defineProperties(T, D); }; if (Object$1.defineProperties.sham) defineProperties$4.sham = true; return defineProperties$2$1.exports; } var defineProperties$1$1; var hasRequiredDefineProperties$1$1; function requireDefineProperties$1$1() { if (hasRequiredDefineProperties$1$1) return defineProperties$1$1; hasRequiredDefineProperties$1$1 = 1; var parent = /* @__PURE__ */ requireDefineProperties$2$1(); defineProperties$1$1 = parent; return defineProperties$1$1; } var defineProperties$3; var hasRequiredDefineProperties$3; function requireDefineProperties$3() { if (hasRequiredDefineProperties$3) return defineProperties$3; hasRequiredDefineProperties$3 = 1; defineProperties$3 = /* @__PURE__ */ requireDefineProperties$1$1(); return defineProperties$3; } var definePropertiesExports$1 = requireDefineProperties$3(); var _Object$defineProperties$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(definePropertiesExports$1); var defineProperty$6; var hasRequiredDefineProperty$6; function requireDefineProperty$6() { if (hasRequiredDefineProperty$6) return defineProperty$6; hasRequiredDefineProperty$6 = 1; defineProperty$6 = /* @__PURE__ */ requireDefineProperty$4$1(); return defineProperty$6; } var definePropertyExports$2 = requireDefineProperty$6(); var _Object$defineProperty$2 = /* @__PURE__ */ getDefaultExportFromCjs$1(definePropertyExports$2); var es_array_isArray$1 = {}; var hasRequiredEs_array_isArray$1; function requireEs_array_isArray$1() { if (hasRequiredEs_array_isArray$1) return es_array_isArray$1; hasRequiredEs_array_isArray$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var isArray$5 = /* @__PURE__ */ requireIsArray$3$1(); $({ target: "Array", stat: true }, { isArray: isArray$5 }); return es_array_isArray$1; } var isArray$2$1; var hasRequiredIsArray$2$1; function requireIsArray$2$1() { if (hasRequiredIsArray$2$1) return isArray$2$1; hasRequiredIsArray$2$1 = 1; requireEs_array_isArray$1(); var path$2 = /* @__PURE__ */ requirePath$1(); isArray$2$1 = path$2.Array.isArray; return isArray$2$1; } var isArray$1$1; var hasRequiredIsArray$1$1; function requireIsArray$1$1() { if (hasRequiredIsArray$1$1) return isArray$1$1; hasRequiredIsArray$1$1 = 1; var parent = /* @__PURE__ */ requireIsArray$2$1(); isArray$1$1 = parent; return isArray$1$1; } var isArray$4; var hasRequiredIsArray$4; function requireIsArray$4() { if (hasRequiredIsArray$4) return isArray$4; hasRequiredIsArray$4 = 1; isArray$4 = /* @__PURE__ */ requireIsArray$1$1(); return isArray$4; } var isArrayExports$1 = requireIsArray$4(); var _Array$isArray$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(isArrayExports$1); var es_map$1 = {}; var es_map_constructor$1 = {}; var internalMetadata$1 = { exports: {} }; var arrayBufferNonExtensible$1; var hasRequiredArrayBufferNonExtensible$1; function requireArrayBufferNonExtensible$1() { if (hasRequiredArrayBufferNonExtensible$1) return arrayBufferNonExtensible$1; hasRequiredArrayBufferNonExtensible$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); arrayBufferNonExtensible$1 = fails$2(function() { if (typeof ArrayBuffer == "function") { var buffer = new ArrayBuffer(8); if (Object.isExtensible(buffer)) Object.defineProperty(buffer, "a", { value: 8 }); } }); return arrayBufferNonExtensible$1; } var objectIsExtensible$1; var hasRequiredObjectIsExtensible$1; function requireObjectIsExtensible$1() { if (hasRequiredObjectIsExtensible$1) return objectIsExtensible$1; hasRequiredObjectIsExtensible$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var classof$2 = /* @__PURE__ */ requireClassofRaw$1(); var ARRAY_BUFFER_NON_EXTENSIBLE = /* @__PURE__ */ requireArrayBufferNonExtensible$1(); var $isExtensible = Object.isExtensible; var FAILS_ON_PRIMITIVES = fails$2(function() {}); objectIsExtensible$1 = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it$1) { if (!isObject$3(it$1)) return false; if (ARRAY_BUFFER_NON_EXTENSIBLE && classof$2(it$1) === "ArrayBuffer") return false; return $isExtensible ? $isExtensible(it$1) : true; } : $isExtensible; return objectIsExtensible$1; } var freezing$1; var hasRequiredFreezing$1; function requireFreezing$1() { if (hasRequiredFreezing$1) return freezing$1; hasRequiredFreezing$1 = 1; var fails$2 = /* @__PURE__ */ requireFails$1(); freezing$1 = !fails$2(function() { return Object.isExtensible(Object.preventExtensions({})); }); return freezing$1; } var hasRequiredInternalMetadata$1; function requireInternalMetadata$1() { if (hasRequiredInternalMetadata$1) return internalMetadata$1.exports; hasRequiredInternalMetadata$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var defineProperty$7 = requireObjectDefineProperty$1().f; var getOwnPropertyNamesModule = /* @__PURE__ */ requireObjectGetOwnPropertyNames$1(); var getOwnPropertyNamesExternalModule = /* @__PURE__ */ requireObjectGetOwnPropertyNamesExternal$1(); var isExtensible = /* @__PURE__ */ requireObjectIsExtensible$1(); var uid$2 = /* @__PURE__ */ requireUid$1(); var FREEZING = /* @__PURE__ */ requireFreezing$1(); var REQUIRED = false; var METADATA = uid$2("meta"); var id = 0; var setMetadata = function(it$1) { defineProperty$7(it$1, METADATA, { value: { objectID: "O" + id++, weakData: {} } }); }; var fastKey = function(it$1, create$4) { if (!isObject$3(it$1)) return typeof it$1 == "symbol" ? it$1 : (typeof it$1 == "string" ? "S" : "P") + it$1; if (!hasOwn(it$1, METADATA)) { if (!isExtensible(it$1)) return "F"; if (!create$4) return "E"; setMetadata(it$1); } return it$1[METADATA].objectID; }; var getWeakData = function(it$1, create$4) { if (!hasOwn(it$1, METADATA)) { if (!isExtensible(it$1)) return true; if (!create$4) return false; setMetadata(it$1); } return it$1[METADATA].weakData; }; var onFreeze = function(it$1) { if (FREEZING && REQUIRED && isExtensible(it$1) && !hasOwn(it$1, METADATA)) setMetadata(it$1); return it$1; }; var enable = function() { meta.enable = function() {}; REQUIRED = true; var getOwnPropertyNames$3 = getOwnPropertyNamesModule.f; var splice$5 = uncurryThis([].splice); var test = {}; test[METADATA] = 1; if (getOwnPropertyNames$3(test).length) { getOwnPropertyNamesModule.f = function(it$1) { var result = getOwnPropertyNames$3(it$1); for (var i = 0, length$1 = result.length; i < length$1; i++) if (result[i] === METADATA) { splice$5(result, i, 1); break; } return result; }; $({ target: "Object", stat: true, forced: true }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f }); } }; var meta = internalMetadata$1.exports = { enable, fastKey, getWeakData, onFreeze }; hiddenKeys$2[METADATA] = true; return internalMetadata$1.exports; } var isArrayIteratorMethod$1; var hasRequiredIsArrayIteratorMethod$1; function requireIsArrayIteratorMethod$1() { if (hasRequiredIsArrayIteratorMethod$1) return isArrayIteratorMethod$1; hasRequiredIsArrayIteratorMethod$1 = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var Iterators = /* @__PURE__ */ requireIterators$1(); var ITERATOR = wellKnownSymbol$2("iterator"); var ArrayPrototype = Array.prototype; isArrayIteratorMethod$1 = function(it$1) { return it$1 !== void 0 && (Iterators.Array === it$1 || ArrayPrototype[ITERATOR] === it$1); }; return isArrayIteratorMethod$1; } var getIteratorMethod$1; var hasRequiredGetIteratorMethod$1; function requireGetIteratorMethod$1() { if (hasRequiredGetIteratorMethod$1) return getIteratorMethod$1; hasRequiredGetIteratorMethod$1 = 1; var classof$2 = /* @__PURE__ */ requireClassof$1(); var getMethod$2 = /* @__PURE__ */ requireGetMethod$1(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined$1(); var Iterators = /* @__PURE__ */ requireIterators$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var ITERATOR = wellKnownSymbol$2("iterator"); getIteratorMethod$1 = function(it$1) { if (!isNullOrUndefined$2(it$1)) return getMethod$2(it$1, ITERATOR) || getMethod$2(it$1, "@@iterator") || Iterators[classof$2(it$1)]; }; return getIteratorMethod$1; } var getIterator$5; var hasRequiredGetIterator$6; function requireGetIterator$6() { if (hasRequiredGetIterator$6) return getIterator$5; hasRequiredGetIterator$6 = 1; var call = /* @__PURE__ */ requireFunctionCall$1(); var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var tryToString$2 = /* @__PURE__ */ requireTryToString$1(); var getIteratorMethod$2 = /* @__PURE__ */ requireGetIteratorMethod$1(); var $TypeError = TypeError; getIterator$5 = function(argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod$2(argument) : usingIterator; if (aCallable$2(iteratorMethod)) return anObject$2(call(iteratorMethod, argument)); throw new $TypeError(tryToString$2(argument) + " is not iterable"); }; return getIterator$5; } var iteratorClose$1; var hasRequiredIteratorClose$1; function requireIteratorClose$1() { if (hasRequiredIteratorClose$1) return iteratorClose$1; hasRequiredIteratorClose$1 = 1; var call = /* @__PURE__ */ requireFunctionCall$1(); var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var getMethod$2 = /* @__PURE__ */ requireGetMethod$1(); iteratorClose$1 = function(iterator$7, kind, value) { var innerResult, innerError; anObject$2(iterator$7); try { innerResult = getMethod$2(iterator$7, "return"); if (!innerResult) { if (kind === "throw") throw value; return value; } innerResult = call(innerResult, iterator$7); } catch (error) { innerError = true; innerResult = error; } if (kind === "throw") throw value; if (innerError) throw innerResult; anObject$2(innerResult); return value; }; return iteratorClose$1; } var iterate$1; var hasRequiredIterate$1; function requireIterate$1() { if (hasRequiredIterate$1) return iterate$1; hasRequiredIterate$1 = 1; var bind$5 = /* @__PURE__ */ requireFunctionBindContext$1(); var call = /* @__PURE__ */ requireFunctionCall$1(); var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var tryToString$2 = /* @__PURE__ */ requireTryToString$1(); var isArrayIteratorMethod$2 = /* @__PURE__ */ requireIsArrayIteratorMethod$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var getIterator$7 = /* @__PURE__ */ requireGetIterator$6(); var getIteratorMethod$2 = /* @__PURE__ */ requireGetIteratorMethod$1(); var iteratorClose$2 = /* @__PURE__ */ requireIteratorClose$1(); var $TypeError = TypeError; var Result = function(stopped, result) { this.stopped = stopped; this.result = result; }; var ResultPrototype = Result.prototype; iterate$1 = function(iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_RECORD = !!(options && options.IS_RECORD); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = bind$5(unboundFunction, that); var iterator$7, iterFn, index$1, length$1, result, next$1, step; var stop = function(condition) { if (iterator$7) iteratorClose$2(iterator$7, "normal"); return new Result(true, condition); }; var callFn = function(value) { if (AS_ENTRIES) { anObject$2(value); return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; if (IS_RECORD) iterator$7 = iterable.iterator; else if (IS_ITERATOR) iterator$7 = iterable; else { iterFn = getIteratorMethod$2(iterable); if (!iterFn) throw new $TypeError(tryToString$2(iterable) + " is not iterable"); if (isArrayIteratorMethod$2(iterFn)) { for (index$1 = 0, length$1 = lengthOfArrayLike$2(iterable); length$1 > index$1; index$1++) { result = callFn(iterable[index$1]); if (result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); } iterator$7 = getIterator$7(iterable, iterFn); } next$1 = IS_RECORD ? iterable.next : iterator$7.next; while (!(step = call(next$1, iterator$7)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose$2(iterator$7, "throw", error); } if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); }; return iterate$1; } var anInstance$1; var hasRequiredAnInstance$1; function requireAnInstance$1() { if (hasRequiredAnInstance$1) return anInstance$1; hasRequiredAnInstance$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var $TypeError = TypeError; anInstance$1 = function(it$1, Prototype) { if (isPrototypeOf(Prototype, it$1)) return it$1; throw new $TypeError("Incorrect invocation"); }; return anInstance$1; } var collection$1; var hasRequiredCollection$1; function requireCollection$1() { if (hasRequiredCollection$1) return collection$1; hasRequiredCollection$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var InternalMetadataModule = /* @__PURE__ */ requireInternalMetadata$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty$1(); var iterate$2 = /* @__PURE__ */ requireIterate$1(); var anInstance$2 = /* @__PURE__ */ requireAnInstance$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var isObject$3 = /* @__PURE__ */ requireIsObject$1(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined$1(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag$1(); var defineProperty$7 = requireObjectDefineProperty$1().f; var forEach$6 = requireArrayIteration$1().forEach; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var InternalStateModule = /* @__PURE__ */ requireInternalState$1(); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; collection$1 = function(CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf("Map") !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf("Weak") !== -1; var ADDER = IS_MAP ? "set" : "add"; var NativeConstructor = globalThis$1[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var exported = {}; var Constructor; if (!DESCRIPTORS || !isCallable$2(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails$2(function() { new NativeConstructor().entries().next(); }))) { Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); InternalMetadataModule.enable(); } else { Constructor = wrapper(function(target, iterable) { setInternalState(anInstance$2(target, Prototype), { type: CONSTRUCTOR_NAME, collection: new NativeConstructor() }); if (!isNullOrUndefined$2(iterable)) iterate$2(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); forEach$6([ "add", "clear", "delete", "forEach", "get", "has", "set", "keys", "values", "entries" ], function(KEY) { var IS_ADDER = KEY === "add" || KEY === "set"; if (KEY in NativePrototype && !(IS_WEAK && KEY === "clear")) createNonEnumerableProperty$2(Prototype, KEY, function(a, b) { var collection$2 = getInternalState(this).collection; if (!IS_ADDER && IS_WEAK && !isObject$3(a)) return KEY === "get" ? void 0 : false; var result = collection$2[KEY](a === 0 ? 0 : a, b); return IS_ADDER ? this : result; }); }); IS_WEAK || defineProperty$7(Prototype, "size", { configurable: true, get: function() { return getInternalState(this).collection.size; } }); } setToStringTag$2(Constructor, CONSTRUCTOR_NAME, false, true); exported[CONSTRUCTOR_NAME] = Constructor; $({ global: true, forced: true }, exported); if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); return Constructor; }; return collection$1; } var defineBuiltIns$1; var hasRequiredDefineBuiltIns$1; function requireDefineBuiltIns$1() { if (hasRequiredDefineBuiltIns$1) return defineBuiltIns$1; hasRequiredDefineBuiltIns$1 = 1; var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn$1(); defineBuiltIns$1 = function(target, src, options) { for (var key in src) if (options && options.unsafe && target[key]) target[key] = src[key]; else defineBuiltIn$2(target, key, src[key], options); return target; }; return defineBuiltIns$1; } var setSpecies$1; var hasRequiredSetSpecies$1; function requireSetSpecies$1() { if (hasRequiredSetSpecies$1) return setSpecies$1; hasRequiredSetSpecies$1 = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var defineBuiltInAccessor$2 = /* @__PURE__ */ requireDefineBuiltInAccessor$1(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol$1(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var SPECIES = wellKnownSymbol$2("species"); setSpecies$1 = function(CONSTRUCTOR_NAME) { var Constructor = getBuiltIn$2(CONSTRUCTOR_NAME); if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) defineBuiltInAccessor$2(Constructor, SPECIES, { configurable: true, get: function() { return this; } }); }; return setSpecies$1; } var collectionStrong$1; var hasRequiredCollectionStrong$1; function requireCollectionStrong$1() { if (hasRequiredCollectionStrong$1) return collectionStrong$1; hasRequiredCollectionStrong$1 = 1; var create$4 = /* @__PURE__ */ requireObjectCreate$1(); var defineBuiltInAccessor$2 = /* @__PURE__ */ requireDefineBuiltInAccessor$1(); var defineBuiltIns$2 = /* @__PURE__ */ requireDefineBuiltIns$1(); var bind$5 = /* @__PURE__ */ requireFunctionBindContext$1(); var anInstance$2 = /* @__PURE__ */ requireAnInstance$1(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined$1(); var iterate$2 = /* @__PURE__ */ requireIterate$1(); var defineIterator = /* @__PURE__ */ requireIteratorDefine$1(); var createIterResultObject$2 = /* @__PURE__ */ requireCreateIterResultObject$1(); var setSpecies$2 = /* @__PURE__ */ requireSetSpecies$1(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var fastKey = requireInternalMetadata$1().fastKey; var InternalStateModule = /* @__PURE__ */ requireInternalState$1(); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; collectionStrong$1 = { getConstructor: function(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function(that, iterable) { anInstance$2(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, index: create$4(null), first: null, last: null, size: 0 }); if (!DESCRIPTORS) that.size = 0; if (!isNullOrUndefined$2(iterable)) iterate$2(iterable, that[ADDER], { that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function(that, key, value) { var state = getInternalState(that); var entry = getEntry(that, key); var previous, index$1; if (entry) entry.value = value; else { state.last = entry = { index: index$1 = fastKey(key, true), key, value, previous: previous = state.last, next: null, removed: false }; if (!state.first) state.first = entry; if (previous) previous.next = entry; if (DESCRIPTORS) state.size++; else that.size++; if (index$1 !== "F") state.index[index$1] = entry; } return that; }; var getEntry = function(that, key) { var state = getInternalState(that); var index$1 = fastKey(key); var entry; if (index$1 !== "F") return state.index[index$1]; for (entry = state.first; entry; entry = entry.next) if (entry.key === key) return entry; }; defineBuiltIns$2(Prototype, { clear: function clear() { var that = this; var state = getInternalState(that); var entry = state.first; while (entry) { entry.removed = true; if (entry.previous) entry.previous = entry.previous.next = null; entry = entry.next; } state.first = state.last = null; state.index = create$4(null); if (DESCRIPTORS) state.size = 0; else that.size = 0; }, "delete": function(key) { var that = this; var state = getInternalState(that); var entry = getEntry(that, key); if (entry) { var next$1 = entry.next; var prev = entry.previous; delete state.index[entry.index]; entry.removed = true; if (prev) prev.next = next$1; if (next$1) next$1.previous = prev; if (state.first === entry) state.first = next$1; if (state.last === entry) state.last = prev; if (DESCRIPTORS) state.size--; else that.size--; } return !!entry; }, forEach: function forEach$6(callbackfn) { var state = getInternalState(this); var boundFunction = bind$5(callbackfn, arguments.length > 1 ? arguments[1] : void 0); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); while (entry && entry.removed) entry = entry.previous; } }, has: function has(key) { return !!getEntry(this, key); } }); defineBuiltIns$2(Prototype, IS_MAP ? { get: function get(key) { var entry = getEntry(this, key); return entry && entry.value; }, set: function set$4(key, value) { return define(this, key === 0 ? 0 : key, value); } } : { add: function add(value) { return define(this, value = value === 0 ? 0 : value, value); } }); if (DESCRIPTORS) defineBuiltInAccessor$2(Prototype, "size", { configurable: true, get: function() { return getInternalState(this).size; } }); return Constructor; }, setStrong: function(Constructor, CONSTRUCTOR_NAME, IS_MAP) { var ITERATOR_NAME = CONSTRUCTOR_NAME + " Iterator"; var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); defineIterator(Constructor, CONSTRUCTOR_NAME, function(iterated, kind) { setInternalState(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), kind, last: null }); }, function() { var state = getInternalIteratorState(this); var kind = state.kind; var entry = state.last; while (entry && entry.removed) entry = entry.previous; if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { state.target = null; return createIterResultObject$2(void 0, true); } if (kind === "keys") return createIterResultObject$2(entry.key, false); if (kind === "values") return createIterResultObject$2(entry.value, false); return createIterResultObject$2([entry.key, entry.value], false); }, IS_MAP ? "entries" : "values", !IS_MAP, true); setSpecies$2(CONSTRUCTOR_NAME); } }; return collectionStrong$1; } var hasRequiredEs_map_constructor$1; function requireEs_map_constructor$1() { if (hasRequiredEs_map_constructor$1) return es_map_constructor$1; hasRequiredEs_map_constructor$1 = 1; var collection$2 = /* @__PURE__ */ requireCollection$1(); var collectionStrong$2 = /* @__PURE__ */ requireCollectionStrong$1(); collection$2("Map", function(init) { return function Map$1() { return init(this, arguments.length ? arguments[0] : void 0); }; }, collectionStrong$2); return es_map_constructor$1; } var hasRequiredEs_map$1; function requireEs_map$1() { if (hasRequiredEs_map$1) return es_map$1; hasRequiredEs_map$1 = 1; requireEs_map_constructor$1(); return es_map$1; } var es_map_groupBy$1 = {}; var caller$1; var hasRequiredCaller$1; function requireCaller$1() { if (hasRequiredCaller$1) return caller$1; hasRequiredCaller$1 = 1; caller$1 = function(methodName, numArgs) { return numArgs === 1 ? function(object$1, arg) { return object$1[methodName](arg); } : function(object$1, arg1, arg2) { return object$1[methodName](arg1, arg2); }; }; return caller$1; } var mapHelpers$1; var hasRequiredMapHelpers$1; function requireMapHelpers$1() { if (hasRequiredMapHelpers$1) return mapHelpers$1; hasRequiredMapHelpers$1 = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var caller$2 = /* @__PURE__ */ requireCaller$1(); var Map$1 = getBuiltIn$2("Map"); mapHelpers$1 = { Map: Map$1, set: caller$2("set", 2), get: caller$2("get", 1), has: caller$2("has", 1), remove: caller$2("delete", 1), proto: Map$1.prototype }; return mapHelpers$1; } var hasRequiredEs_map_groupBy$1; function requireEs_map_groupBy$1() { if (hasRequiredEs_map_groupBy$1) return es_map_groupBy$1; hasRequiredEs_map_groupBy$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible$1(); var iterate$2 = /* @__PURE__ */ requireIterate$1(); var MapHelpers = /* @__PURE__ */ requireMapHelpers$1(); var IS_PURE = /* @__PURE__ */ requireIsPure$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var Map$1 = MapHelpers.Map; var has = MapHelpers.has; var get = MapHelpers.get; var set$4 = MapHelpers.set; var push = uncurryThis([].push); var DOES_NOT_WORK_WITH_PRIMITIVES = IS_PURE || fails$2(function() { return Map$1.groupBy("ab", function(it$1) { return it$1; }).get("a").length !== 1; }); $({ target: "Map", stat: true, forced: IS_PURE || DOES_NOT_WORK_WITH_PRIMITIVES }, { groupBy: function groupBy(items, callbackfn) { requireObjectCoercible$2(items); aCallable$2(callbackfn); var map$8 = new Map$1(); var k = 0; iterate$2(items, function(value) { var key = callbackfn(value, k++); if (!has(map$8, key)) set$4(map$8, key, [value]); else push(get(map$8, key), value); }); return map$8; } }); return es_map_groupBy$1; } var map$2$1; var hasRequiredMap$2$1; function requireMap$2$1() { if (hasRequiredMap$2$1) return map$2$1; hasRequiredMap$2$1 = 1; requireEs_array_iterator$1(); requireEs_map$1(); requireEs_map_groupBy$1(); requireEs_string_iterator$1(); var path$2 = /* @__PURE__ */ requirePath$1(); map$2$1 = path$2.Map; return map$2$1; } var map$1$1; var hasRequiredMap$1$1; function requireMap$1$1() { if (hasRequiredMap$1$1) return map$1$1; hasRequiredMap$1$1 = 1; var parent = /* @__PURE__ */ requireMap$2$1(); requireWeb_domCollections_iterator$1(); map$1$1 = parent; return map$1$1; } var map$7; var hasRequiredMap$7; function requireMap$7() { if (hasRequiredMap$7) return map$7; hasRequiredMap$7 = 1; map$7 = /* @__PURE__ */ requireMap$1$1(); return map$7; } var mapExports$2 = requireMap$7(); var _Map$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(mapExports$2); var es_array_some$1 = {}; var hasRequiredEs_array_some$1; function requireEs_array_some$1() { if (hasRequiredEs_array_some$1) return es_array_some$1; hasRequiredEs_array_some$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var $some = requireArrayIteration$1().some; var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict$1(); var STRICT_METHOD = arrayMethodIsStrict$2("some"); $({ target: "Array", proto: true, forced: !STRICT_METHOD }, { some: function some$5(callbackfn) { return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } }); return es_array_some$1; } var some$3$1; var hasRequiredSome$3$1; function requireSome$3$1() { if (hasRequiredSome$3$1) return some$3$1; hasRequiredSome$3$1 = 1; requireEs_array_some$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); some$3$1 = getBuiltInPrototypeMethod$2("Array", "some"); return some$3$1; } var some$2$1; var hasRequiredSome$2$1; function requireSome$2$1() { if (hasRequiredSome$2$1) return some$2$1; hasRequiredSome$2$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireSome$3$1(); var ArrayPrototype = Array.prototype; some$2$1 = function(it$1) { var own = it$1.some; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.some ? method : own; }; return some$2$1; } var some$1$1; var hasRequiredSome$1$1; function requireSome$1$1() { if (hasRequiredSome$1$1) return some$1$1; hasRequiredSome$1$1 = 1; var parent = /* @__PURE__ */ requireSome$2$1(); some$1$1 = parent; return some$1$1; } var some$4; var hasRequiredSome$4; function requireSome$4() { if (hasRequiredSome$4) return some$4; hasRequiredSome$4 = 1; some$4 = /* @__PURE__ */ requireSome$1$1(); return some$4; } var someExports$1 = requireSome$4(); var _someInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(someExports$1); var es_object_assign$1 = {}; var objectAssign$1; var hasRequiredObjectAssign$1; function requireObjectAssign$1() { if (hasRequiredObjectAssign$1) return objectAssign$1; hasRequiredObjectAssign$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var call = /* @__PURE__ */ requireFunctionCall$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var objectKeys$2 = /* @__PURE__ */ requireObjectKeys$1(); var getOwnPropertySymbolsModule = /* @__PURE__ */ requireObjectGetOwnPropertySymbols$1(); var propertyIsEnumerableModule = /* @__PURE__ */ requireObjectPropertyIsEnumerable$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var IndexedObject = /* @__PURE__ */ requireIndexedObject$1(); var $assign = Object.assign; var defineProperty$7 = Object.defineProperty; var concat$5 = uncurryThis([].concat); objectAssign$1 = !$assign || fails$2(function() { if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty$7({}, "a", { enumerable: true, get: function() { defineProperty$7(this, "b", { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return true; var A = {}; var B = {}; var symbol$6 = Symbol("assign detection"); var alphabet = "abcdefghijklmnopqrst"; A[symbol$6] = 7; alphabet.split("").forEach(function(chr) { B[chr] = chr; }); return $assign({}, A)[symbol$6] !== 7 || objectKeys$2($assign({}, B)).join("") !== alphabet; }) ? function assign$6(target, source) { var T = toObject$2(target); var argumentsLength = arguments.length; var index$1 = 1; var getOwnPropertySymbols$4 = getOwnPropertySymbolsModule.f; var propertyIsEnumerable = propertyIsEnumerableModule.f; while (argumentsLength > index$1) { var S = IndexedObject(arguments[index$1++]); var keys$8 = getOwnPropertySymbols$4 ? concat$5(objectKeys$2(S), getOwnPropertySymbols$4(S)) : objectKeys$2(S); var length$1 = keys$8.length; var j = 0; var key; while (length$1 > j) { key = keys$8[j++]; if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key]; } } return T; } : $assign; return objectAssign$1; } var hasRequiredEs_object_assign$1; function requireEs_object_assign$1() { if (hasRequiredEs_object_assign$1) return es_object_assign$1; hasRequiredEs_object_assign$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var assign$6 = /* @__PURE__ */ requireObjectAssign$1(); $({ target: "Object", stat: true, arity: 2, forced: Object.assign !== assign$6 }, { assign: assign$6 }); return es_object_assign$1; } var assign$2$1; var hasRequiredAssign$2$1; function requireAssign$2$1() { if (hasRequiredAssign$2$1) return assign$2$1; hasRequiredAssign$2$1 = 1; requireEs_object_assign$1(); var path$2 = /* @__PURE__ */ requirePath$1(); assign$2$1 = path$2.Object.assign; return assign$2$1; } var assign$1$2; var hasRequiredAssign$1$1; function requireAssign$1$1() { if (hasRequiredAssign$1$1) return assign$1$2; hasRequiredAssign$1$1 = 1; var parent = /* @__PURE__ */ requireAssign$2$1(); assign$1$2 = parent; return assign$1$2; } var assign$5; var hasRequiredAssign$3; function requireAssign$3() { if (hasRequiredAssign$3) return assign$5; hasRequiredAssign$3 = 1; assign$5 = /* @__PURE__ */ requireAssign$1$1(); return assign$5; } var assignExports$1 = requireAssign$3(); var _Object$assign$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(assignExports$1); var concat$3$1; var hasRequiredConcat$3$1; function requireConcat$3$1() { if (hasRequiredConcat$3$1) return concat$3$1; hasRequiredConcat$3$1 = 1; requireEs_array_concat$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); concat$3$1 = getBuiltInPrototypeMethod$2("Array", "concat"); return concat$3$1; } var concat$2$1; var hasRequiredConcat$2$1; function requireConcat$2$1() { if (hasRequiredConcat$2$1) return concat$2$1; hasRequiredConcat$2$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireConcat$3$1(); var ArrayPrototype = Array.prototype; concat$2$1 = function(it$1) { var own = it$1.concat; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.concat ? method : own; }; return concat$2$1; } var concat$1$1; var hasRequiredConcat$1$1; function requireConcat$1$1() { if (hasRequiredConcat$1$1) return concat$1$1; hasRequiredConcat$1$1 = 1; var parent = /* @__PURE__ */ requireConcat$2$1(); concat$1$1 = parent; return concat$1$1; } var concat$4; var hasRequiredConcat$4; function requireConcat$4() { if (hasRequiredConcat$4) return concat$4; hasRequiredConcat$4 = 1; concat$4 = /* @__PURE__ */ requireConcat$1$1(); return concat$4; } var concatExports$1 = requireConcat$4(); var _concatInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(concatExports$1); var keys$6; var hasRequiredKeys$6; function requireKeys$6() { if (hasRequiredKeys$6) return keys$6; hasRequiredKeys$6 = 1; requireEs_array_iterator$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); keys$6 = getBuiltInPrototypeMethod$2("Array", "keys"); return keys$6; } var keys$5; var hasRequiredKeys$5; function requireKeys$5() { if (hasRequiredKeys$5) return keys$5; hasRequiredKeys$5 = 1; var parent = /* @__PURE__ */ requireKeys$6(); keys$5 = parent; return keys$5; } var keys$4; var hasRequiredKeys$4; function requireKeys$4() { if (hasRequiredKeys$4) return keys$4; hasRequiredKeys$4 = 1; requireWeb_domCollections_iterator$1(); var classof$2 = /* @__PURE__ */ requireClassof$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireKeys$5(); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; keys$4 = function(it$1) { var own = it$1.keys; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.keys || hasOwn(DOMIterables, classof$2(it$1)) ? method : own; }; return keys$4; } var keys$3; var hasRequiredKeys$3; function requireKeys$3() { if (hasRequiredKeys$3) return keys$3; hasRequiredKeys$3 = 1; keys$3 = /* @__PURE__ */ requireKeys$4(); return keys$3; } var keysExports$1 = requireKeys$3(); var _keysInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs$1(keysExports$1); var es_object_keys$1 = {}; var hasRequiredEs_object_keys$1; function requireEs_object_keys$1() { if (hasRequiredEs_object_keys$1) return es_object_keys$1; hasRequiredEs_object_keys$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var nativeKeys = /* @__PURE__ */ requireObjectKeys$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var FAILS_ON_PRIMITIVES = fails$2(function() { nativeKeys(1); }); $({ target: "Object", stat: true, forced: FAILS_ON_PRIMITIVES }, { keys: function keys$8(it$1) { return nativeKeys(toObject$2(it$1)); } }); return es_object_keys$1; } var keys$2$1; var hasRequiredKeys$2$1; function requireKeys$2$1() { if (hasRequiredKeys$2$1) return keys$2$1; hasRequiredKeys$2$1 = 1; requireEs_object_keys$1(); var path$2 = /* @__PURE__ */ requirePath$1(); keys$2$1 = path$2.Object.keys; return keys$2$1; } var keys$1$1; var hasRequiredKeys$1$1; function requireKeys$1$1() { if (hasRequiredKeys$1$1) return keys$1$1; hasRequiredKeys$1$1 = 1; var parent = /* @__PURE__ */ requireKeys$2$1(); keys$1$1 = parent; return keys$1$1; } var keys$7; var hasRequiredKeys$7; function requireKeys$7() { if (hasRequiredKeys$7) return keys$7; hasRequiredKeys$7 = 1; keys$7 = /* @__PURE__ */ requireKeys$1$1(); return keys$7; } var keysExports$2 = requireKeys$7(); var _Object$keys$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(keysExports$2); var es_array_sort$1 = {}; var deletePropertyOrThrow$1; var hasRequiredDeletePropertyOrThrow$1; function requireDeletePropertyOrThrow$1() { if (hasRequiredDeletePropertyOrThrow$1) return deletePropertyOrThrow$1; hasRequiredDeletePropertyOrThrow$1 = 1; var tryToString$2 = /* @__PURE__ */ requireTryToString$1(); var $TypeError = TypeError; deletePropertyOrThrow$1 = function(O, P) { if (!delete O[P]) throw new $TypeError("Cannot delete property " + tryToString$2(P) + " of " + tryToString$2(O)); }; return deletePropertyOrThrow$1; } var arraySort$1; var hasRequiredArraySort$1; function requireArraySort$1() { if (hasRequiredArraySort$1) return arraySort$1; hasRequiredArraySort$1 = 1; var arraySlice$2 = /* @__PURE__ */ requireArraySlice$1(); var floor = Math.floor; var sort$5 = function(array$1, comparefn) { var length$1 = array$1.length; if (length$1 < 8) { var i = 1; var element, j; while (i < length$1) { j = i; element = array$1[i]; while (j && comparefn(array$1[j - 1], element) > 0) array$1[j] = array$1[--j]; if (j !== i++) array$1[j] = element; } } else { var middle = floor(length$1 / 2); var left = sort$5(arraySlice$2(array$1, 0, middle), comparefn); var right = sort$5(arraySlice$2(array$1, middle), comparefn); var llength = left.length; var rlength = right.length; var lindex = 0; var rindex = 0; while (lindex < llength || rindex < rlength) array$1[lindex + rindex] = lindex < llength && rindex < rlength ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++] : lindex < llength ? left[lindex++] : right[rindex++]; } return array$1; }; arraySort$1 = sort$5; return arraySort$1; } var environmentFfVersion$1; var hasRequiredEnvironmentFfVersion$1; function requireEnvironmentFfVersion$1() { if (hasRequiredEnvironmentFfVersion$1) return environmentFfVersion$1; hasRequiredEnvironmentFfVersion$1 = 1; var userAgent = /* @__PURE__ */ requireEnvironmentUserAgent$1(); var firefox = userAgent.match(/firefox\/(\d+)/i); environmentFfVersion$1 = !!firefox && +firefox[1]; return environmentFfVersion$1; } var environmentIsIeOrEdge$1; var hasRequiredEnvironmentIsIeOrEdge$1; function requireEnvironmentIsIeOrEdge$1() { if (hasRequiredEnvironmentIsIeOrEdge$1) return environmentIsIeOrEdge$1; hasRequiredEnvironmentIsIeOrEdge$1 = 1; var UA = /* @__PURE__ */ requireEnvironmentUserAgent$1(); environmentIsIeOrEdge$1 = /MSIE|Trident/.test(UA); return environmentIsIeOrEdge$1; } var environmentWebkitVersion$1; var hasRequiredEnvironmentWebkitVersion$1; function requireEnvironmentWebkitVersion$1() { if (hasRequiredEnvironmentWebkitVersion$1) return environmentWebkitVersion$1; hasRequiredEnvironmentWebkitVersion$1 = 1; var userAgent = /* @__PURE__ */ requireEnvironmentUserAgent$1(); var webkit = userAgent.match(/AppleWebKit\/(\d+)\./); environmentWebkitVersion$1 = !!webkit && +webkit[1]; return environmentWebkitVersion$1; } var hasRequiredEs_array_sort$1; function requireEs_array_sort$1() { if (hasRequiredEs_array_sort$1) return es_array_sort$1; hasRequiredEs_array_sort$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var deletePropertyOrThrow$2 = /* @__PURE__ */ requireDeletePropertyOrThrow$1(); var toString$2 = /* @__PURE__ */ requireToString$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var internalSort = /* @__PURE__ */ requireArraySort$1(); var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict$1(); var FF = /* @__PURE__ */ requireEnvironmentFfVersion$1(); var IE_OR_EDGE = /* @__PURE__ */ requireEnvironmentIsIeOrEdge$1(); var V8 = /* @__PURE__ */ requireEnvironmentV8Version$1(); var WEBKIT = /* @__PURE__ */ requireEnvironmentWebkitVersion$1(); var test = []; var nativeSort = uncurryThis(test.sort); var push = uncurryThis(test.push); var FAILS_ON_UNDEFINED = fails$2(function() { test.sort(void 0); }); var FAILS_ON_NULL = fails$2(function() { test.sort(null); }); var STRICT_METHOD = arrayMethodIsStrict$2("sort"); var STABLE_SORT = !fails$2(function() { if (V8) return V8 < 70; if (FF && FF > 3) return; if (IE_OR_EDGE) return true; if (WEBKIT) return WEBKIT < 603; var result = ""; var code, chr, value, index$1; for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index$1 = 0; index$1 < 47; index$1++) test.push({ k: chr + index$1, v: value }); } test.sort(function(a, b) { return b.v - a.v; }); for (index$1 = 0; index$1 < test.length; index$1++) { chr = test[index$1].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } return result !== "DGBEFHACIJK"; }); var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT; var getSortCompare = function(comparefn) { return function(x, y) { if (y === void 0) return -1; if (x === void 0) return 1; if (comparefn !== void 0) return +comparefn(x, y) || 0; return toString$2(x) > toString$2(y) ? 1 : -1; }; }; $({ target: "Array", proto: true, forced: FORCED }, { sort: function sort$5(comparefn) { if (comparefn !== void 0) aCallable$2(comparefn); var array$1 = toObject$2(this); if (STABLE_SORT) return comparefn === void 0 ? nativeSort(array$1) : nativeSort(array$1, comparefn); var items = []; var arrayLength = lengthOfArrayLike$2(array$1); var itemsLength, index$1; for (index$1 = 0; index$1 < arrayLength; index$1++) if (index$1 in array$1) push(items, array$1[index$1]); internalSort(items, getSortCompare(comparefn)); itemsLength = lengthOfArrayLike$2(items); index$1 = 0; while (index$1 < itemsLength) array$1[index$1] = items[index$1++]; while (index$1 < arrayLength) deletePropertyOrThrow$2(array$1, index$1++); return array$1; } }); return es_array_sort$1; } var sort$3$1; var hasRequiredSort$3$1; function requireSort$3$1() { if (hasRequiredSort$3$1) return sort$3$1; hasRequiredSort$3$1 = 1; requireEs_array_sort$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); sort$3$1 = getBuiltInPrototypeMethod$2("Array", "sort"); return sort$3$1; } var sort$2$1; var hasRequiredSort$2$1; function requireSort$2$1() { if (hasRequiredSort$2$1) return sort$2$1; hasRequiredSort$2$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireSort$3$1(); var ArrayPrototype = Array.prototype; sort$2$1 = function(it$1) { var own = it$1.sort; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.sort ? method : own; }; return sort$2$1; } var sort$1$1; var hasRequiredSort$1$1; function requireSort$1$1() { if (hasRequiredSort$1$1) return sort$1$1; hasRequiredSort$1$1 = 1; var parent = /* @__PURE__ */ requireSort$2$1(); sort$1$1 = parent; return sort$1$1; } var sort$4; var hasRequiredSort$4; function requireSort$4() { if (hasRequiredSort$4) return sort$4; hasRequiredSort$4 = 1; sort$4 = /* @__PURE__ */ requireSort$1$1(); return sort$4; } var sortExports$1 = requireSort$4(); var _sortInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(sortExports$1); var values$3$1; var hasRequiredValues$3$1; function requireValues$3$1() { if (hasRequiredValues$3$1) return values$3$1; hasRequiredValues$3$1 = 1; requireEs_array_iterator$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); values$3$1 = getBuiltInPrototypeMethod$2("Array", "values"); return values$3$1; } var values$2$1; var hasRequiredValues$2$1; function requireValues$2$1() { if (hasRequiredValues$2$1) return values$2$1; hasRequiredValues$2$1 = 1; var parent = /* @__PURE__ */ requireValues$3$1(); values$2$1 = parent; return values$2$1; } var values$1$1; var hasRequiredValues$1$1; function requireValues$1$1() { if (hasRequiredValues$1$1) return values$1$1; hasRequiredValues$1$1 = 1; requireWeb_domCollections_iterator$1(); var classof$2 = /* @__PURE__ */ requireClassof$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireValues$2$1(); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; values$1$1 = function(it$1) { var own = it$1.values; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.values || hasOwn(DOMIterables, classof$2(it$1)) ? method : own; }; return values$1$1; } var values$7; var hasRequiredValues$7; function requireValues$7() { if (hasRequiredValues$7) return values$7; hasRequiredValues$7 = 1; values$7 = /* @__PURE__ */ requireValues$1$1(); return values$7; } var valuesExports$2 = requireValues$7(); var _valuesInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(valuesExports$2); var es_date_toJson$1 = {}; var stringRepeat$1; var hasRequiredStringRepeat$1; function requireStringRepeat$1() { if (hasRequiredStringRepeat$1) return stringRepeat$1; hasRequiredStringRepeat$1 = 1; var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity$1(); var toString$2 = /* @__PURE__ */ requireToString$1(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible$1(); var $RangeError = RangeError; stringRepeat$1 = function repeat(count) { var str = toString$2(requireObjectCoercible$2(this)); var result = ""; var n = toIntegerOrInfinity$2(count); if (n < 0 || n === Infinity) throw new $RangeError("Wrong number of repetitions"); for (; n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str; return result; }; return stringRepeat$1; } var stringPad$1; var hasRequiredStringPad$1; function requireStringPad$1() { if (hasRequiredStringPad$1) return stringPad$1; hasRequiredStringPad$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var toLength$2 = /* @__PURE__ */ requireToLength$1(); var toString$2 = /* @__PURE__ */ requireToString$1(); var $repeat = /* @__PURE__ */ requireStringRepeat$1(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible$1(); var repeat = uncurryThis($repeat); var stringSlice = uncurryThis("".slice); var ceil = Math.ceil; var createMethod = function(IS_END) { return function($this, maxLength, fillString) { var S = toString$2(requireObjectCoercible$2($this)); var intMaxLength = toLength$2(maxLength); var stringLength = S.length; var fillStr = fillString === void 0 ? " " : toString$2(fillString); var fillLen, stringFiller; if (intMaxLength <= stringLength || fillStr === "") return S; fillLen = intMaxLength - stringLength; stringFiller = repeat(fillStr, ceil(fillLen / fillStr.length)); if (stringFiller.length > fillLen) stringFiller = stringSlice(stringFiller, 0, fillLen); return IS_END ? S + stringFiller : stringFiller + S; }; }; stringPad$1 = { start: createMethod(false), end: createMethod(true) }; return stringPad$1; } var dateToIsoString$1; var hasRequiredDateToIsoString$1; function requireDateToIsoString$1() { if (hasRequiredDateToIsoString$1) return dateToIsoString$1; hasRequiredDateToIsoString$1 = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var padStart = requireStringPad$1().start; var $RangeError = RangeError; var $isFinite = isFinite; var abs$2 = Math.abs; var DatePrototype = Date.prototype; var nativeDateToISOString = DatePrototype.toISOString; var thisTimeValue = uncurryThis(DatePrototype.getTime); var getUTCDate = uncurryThis(DatePrototype.getUTCDate); var getUTCFullYear = uncurryThis(DatePrototype.getUTCFullYear); var getUTCHours = uncurryThis(DatePrototype.getUTCHours); var getUTCMilliseconds = uncurryThis(DatePrototype.getUTCMilliseconds); var getUTCMinutes = uncurryThis(DatePrototype.getUTCMinutes); var getUTCMonth = uncurryThis(DatePrototype.getUTCMonth); var getUTCSeconds = uncurryThis(DatePrototype.getUTCSeconds); dateToIsoString$1 = fails$2(function() { return nativeDateToISOString.call(new Date(-50000000000001)) !== "0385-07-25T07:06:39.999Z"; }) || !fails$2(function() { nativeDateToISOString.call(new Date(NaN)); }) ? function toISOString() { if (!$isFinite(thisTimeValue(this))) throw new $RangeError("Invalid time value"); var date = this; var year = getUTCFullYear(date); var milliseconds = getUTCMilliseconds(date); var sign = year < 0 ? "-" : year > 9999 ? "+" : ""; return sign + padStart(abs$2(year), sign ? 6 : 4, 0) + "-" + padStart(getUTCMonth(date) + 1, 2, 0) + "-" + padStart(getUTCDate(date), 2, 0) + "T" + padStart(getUTCHours(date), 2, 0) + ":" + padStart(getUTCMinutes(date), 2, 0) + ":" + padStart(getUTCSeconds(date), 2, 0) + "." + padStart(milliseconds, 3, 0) + "Z"; } : nativeDateToISOString; return dateToIsoString$1; } var hasRequiredEs_date_toJson$1; function requireEs_date_toJson$1() { if (hasRequiredEs_date_toJson$1) return es_date_toJson$1; hasRequiredEs_date_toJson$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var call = /* @__PURE__ */ requireFunctionCall$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var toPrimitive$8 = /* @__PURE__ */ requireToPrimitive$5$1(); var toISOString = /* @__PURE__ */ requireDateToIsoString$1(); var classof$2 = /* @__PURE__ */ requireClassofRaw$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var FORCED = fails$2(function() { return new Date(NaN).toJSON() !== null || call(Date.prototype.toJSON, { toISOString: function() { return 1; } }) !== 1; }); $({ target: "Date", proto: true, forced: FORCED }, { toJSON: function toJSON(key) { var O = toObject$2(this); var pv = toPrimitive$8(O, "number"); return typeof pv == "number" && !isFinite(pv) ? null : !("toISOString" in O) && classof$2(O) === "Date" ? call(toISOString, O) : O.toISOString(); } }); return es_date_toJson$1; } var stringify$2$1; var hasRequiredStringify$2$1; function requireStringify$2$1() { if (hasRequiredStringify$2$1) return stringify$2$1; hasRequiredStringify$2$1 = 1; requireEs_date_toJson$1(); requireEs_json_stringify$1(); var path$2 = /* @__PURE__ */ requirePath$1(); var apply = /* @__PURE__ */ requireFunctionApply$1(); if (!path$2.JSON) path$2.JSON = { stringify: JSON.stringify }; stringify$2$1 = function stringify$4(it$1, replacer, space) { return apply(path$2.JSON.stringify, null, arguments); }; return stringify$2$1; } var stringify$1$1; var hasRequiredStringify$1$1; function requireStringify$1$1() { if (hasRequiredStringify$1$1) return stringify$1$1; hasRequiredStringify$1$1 = 1; var parent = /* @__PURE__ */ requireStringify$2$1(); stringify$1$1 = parent; return stringify$1$1; } var stringify$3; var hasRequiredStringify$3; function requireStringify$3() { if (hasRequiredStringify$3) return stringify$3; hasRequiredStringify$3 = 1; stringify$3 = /* @__PURE__ */ requireStringify$1$1(); return stringify$3; } var stringifyExports$1 = requireStringify$3(); var _JSON$stringify$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(stringifyExports$1); var iterator$6; var hasRequiredIterator$6; function requireIterator$6() { if (hasRequiredIterator$6) return iterator$6; hasRequiredIterator$6 = 1; iterator$6 = /* @__PURE__ */ requireIterator$4$1(); return iterator$6; } var iteratorExports$2 = requireIterator$6(); var _Symbol$iterator$2 = /* @__PURE__ */ getDefaultExportFromCjs$1(iteratorExports$2); var entries$3; var hasRequiredEntries$3; function requireEntries$3() { if (hasRequiredEntries$3) return entries$3; hasRequiredEntries$3 = 1; requireEs_array_iterator$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); entries$3 = getBuiltInPrototypeMethod$2("Array", "entries"); return entries$3; } var entries$2; var hasRequiredEntries$2; function requireEntries$2() { if (hasRequiredEntries$2) return entries$2; hasRequiredEntries$2 = 1; var parent = /* @__PURE__ */ requireEntries$3(); entries$2 = parent; return entries$2; } var entries$1; var hasRequiredEntries$1; function requireEntries$1() { if (hasRequiredEntries$1) return entries$1; hasRequiredEntries$1 = 1; requireWeb_domCollections_iterator$1(); var classof$2 = /* @__PURE__ */ requireClassof$1(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty$1(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireEntries$2(); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; entries$1 = function(it$1) { var own = it$1.entries; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.entries || hasOwn(DOMIterables, classof$2(it$1)) ? method : own; }; return entries$1; } var entries; var hasRequiredEntries; function requireEntries() { if (hasRequiredEntries) return entries; hasRequiredEntries = 1; entries = /* @__PURE__ */ requireEntries$1(); return entries; } var entriesExports = requireEntries(); var _entriesInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs$1(entriesExports); const byteToHex$1 = []; for (let i = 0; i < 256; ++i) byteToHex$1.push((i + 256).toString(16).slice(1)); function unsafeStringify$1(arr, offset = 0) { return (byteToHex$1[arr[offset + 0]] + byteToHex$1[arr[offset + 1]] + byteToHex$1[arr[offset + 2]] + byteToHex$1[arr[offset + 3]] + "-" + byteToHex$1[arr[offset + 4]] + byteToHex$1[arr[offset + 5]] + "-" + byteToHex$1[arr[offset + 6]] + byteToHex$1[arr[offset + 7]] + "-" + byteToHex$1[arr[offset + 8]] + byteToHex$1[arr[offset + 9]] + "-" + byteToHex$1[arr[offset + 10]] + byteToHex$1[arr[offset + 11]] + byteToHex$1[arr[offset + 12]] + byteToHex$1[arr[offset + 13]] + byteToHex$1[arr[offset + 14]] + byteToHex$1[arr[offset + 15]]).toLowerCase(); } let getRandomValues$1; const rnds8$1 = new Uint8Array(16); function rng$1() { if (!getRandomValues$1) { if (typeof crypto === "undefined" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); getRandomValues$1 = crypto.getRandomValues.bind(crypto); } return getRandomValues$1(rnds8$1); } const randomUUID$1 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto); var native$1 = { randomUUID: randomUUID$1 }; function v4$1(options, buf, offset) { if (native$1.randomUUID && !options) return native$1.randomUUID(); options = options || {}; const rnds = options.random ?? options.rng?.() ?? rng$1(); if (rnds.length < 16) throw new Error("Random bytes length must be >= 16"); rnds[6] = rnds[6] & 15 | 64; rnds[8] = rnds[8] & 63 | 128; return unsafeStringify$1(rnds); } /** * Determine whether a value can be used as an id. * @param value - Input value of unknown type. * @returns True if the value is valid id, false otherwise. */ function isId(value) { return typeof value === "string" || typeof value === "number"; } var web_timers$1 = {}; var web_setInterval$1 = {}; var validateArgumentsLength$1; var hasRequiredValidateArgumentsLength$1; function requireValidateArgumentsLength$1() { if (hasRequiredValidateArgumentsLength$1) return validateArgumentsLength$1; hasRequiredValidateArgumentsLength$1 = 1; var $TypeError = TypeError; validateArgumentsLength$1 = function(passed, required) { if (passed < required) throw new $TypeError("Not enough arguments"); return passed; }; return validateArgumentsLength$1; } var schedulersFix$1; var hasRequiredSchedulersFix$1; function requireSchedulersFix$1() { if (hasRequiredSchedulersFix$1) return schedulersFix$1; hasRequiredSchedulersFix$1 = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var apply = /* @__PURE__ */ requireFunctionApply$1(); var isCallable$2 = /* @__PURE__ */ requireIsCallable$1(); var ENVIRONMENT = /* @__PURE__ */ requireEnvironment$1(); var USER_AGENT = /* @__PURE__ */ requireEnvironmentUserAgent$1(); var arraySlice$2 = /* @__PURE__ */ requireArraySlice$1(); var validateArgumentsLength$2 = /* @__PURE__ */ requireValidateArgumentsLength$1(); var Function$1 = globalThis$1.Function; var WRAP = /MSIE .\./.test(USER_AGENT) || ENVIRONMENT === "BUN" && function() { var version = globalThis$1.Bun.version.split("."); return version.length < 3 || version[0] === "0" && (version[1] < 3 || version[1] === "3" && version[2] === "0"); }(); schedulersFix$1 = function(scheduler, hasTimeArg) { var firstParamIndex = hasTimeArg ? 2 : 1; return WRAP ? function(handler, timeout) { var boundArgs = validateArgumentsLength$2(arguments.length, 1) > firstParamIndex; var fn = isCallable$2(handler) ? handler : Function$1(handler); var params = boundArgs ? arraySlice$2(arguments, firstParamIndex) : []; var callback = boundArgs ? function() { apply(fn, this, params); } : fn; return hasTimeArg ? scheduler(callback, timeout) : scheduler(callback); } : scheduler; }; return schedulersFix$1; } var hasRequiredWeb_setInterval$1; function requireWeb_setInterval$1() { if (hasRequiredWeb_setInterval$1) return web_setInterval$1; hasRequiredWeb_setInterval$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var schedulersFix$2 = /* @__PURE__ */ requireSchedulersFix$1(); var setInterval$2 = schedulersFix$2(globalThis$1.setInterval, true); $({ global: true, bind: true, forced: globalThis$1.setInterval !== setInterval$2 }, { setInterval: setInterval$2 }); return web_setInterval$1; } var web_setTimeout$1 = {}; var hasRequiredWeb_setTimeout$1; function requireWeb_setTimeout$1() { if (hasRequiredWeb_setTimeout$1) return web_setTimeout$1; hasRequiredWeb_setTimeout$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis$1(); var schedulersFix$2 = /* @__PURE__ */ requireSchedulersFix$1(); var setTimeout$3 = schedulersFix$2(globalThis$1.setTimeout, true); $({ global: true, bind: true, forced: globalThis$1.setTimeout !== setTimeout$3 }, { setTimeout: setTimeout$3 }); return web_setTimeout$1; } var hasRequiredWeb_timers$1; function requireWeb_timers$1() { if (hasRequiredWeb_timers$1) return web_timers$1; hasRequiredWeb_timers$1 = 1; requireWeb_setInterval$1(); requireWeb_setTimeout$1(); return web_timers$1; } var setTimeout$2$1; var hasRequiredSetTimeout$1$1; function requireSetTimeout$1$1() { if (hasRequiredSetTimeout$1$1) return setTimeout$2$1; hasRequiredSetTimeout$1$1 = 1; requireWeb_timers$1(); var path$2 = /* @__PURE__ */ requirePath$1(); setTimeout$2$1 = path$2.setTimeout; return setTimeout$2$1; } var setTimeout$1$1; var hasRequiredSetTimeout$2; function requireSetTimeout$2() { if (hasRequiredSetTimeout$2) return setTimeout$1$1; hasRequiredSetTimeout$2 = 1; setTimeout$1$1 = /* @__PURE__ */ requireSetTimeout$1$1(); return setTimeout$1$1; } var setTimeoutExports$1 = requireSetTimeout$2(); var _setTimeout$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(setTimeoutExports$1); var es_array_splice$1 = {}; var arraySetLength$1; var hasRequiredArraySetLength$1; function requireArraySetLength$1() { if (hasRequiredArraySetLength$1) return arraySetLength$1; hasRequiredArraySetLength$1 = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var isArray$5 = /* @__PURE__ */ requireIsArray$3$1(); var $TypeError = TypeError; var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor; var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function() { if (this !== void 0) return true; try { Object.defineProperty([], "length", { writable: false }).length = 1; } catch (error) { return error instanceof TypeError; } }(); arraySetLength$1 = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function(O, length$1) { if (isArray$5(O) && !getOwnPropertyDescriptor$4(O, "length").writable) throw new $TypeError("Cannot set read only .length"); return O.length = length$1; } : function(O, length$1) { return O.length = length$1; }; return arraySetLength$1; } var hasRequiredEs_array_splice$1; function requireEs_array_splice$1() { if (hasRequiredEs_array_splice$1) return es_array_splice$1; hasRequiredEs_array_splice$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var toObject$2 = /* @__PURE__ */ requireToObject$1(); var toAbsoluteIndex$2 = /* @__PURE__ */ requireToAbsoluteIndex$1(); var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity$1(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike$1(); var setArrayLength = /* @__PURE__ */ requireArraySetLength$1(); var doesNotExceedSafeInteger$2 = /* @__PURE__ */ requireDoesNotExceedSafeInteger$1(); var arraySpeciesCreate$2 = /* @__PURE__ */ requireArraySpeciesCreate$1(); var createProperty$2 = /* @__PURE__ */ requireCreateProperty$1(); var deletePropertyOrThrow$2 = /* @__PURE__ */ requireDeletePropertyOrThrow$1(); var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport$1(); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$2("splice"); var max = Math.max; var min = Math.min; $({ target: "Array", proto: true, forced: !HAS_SPECIES_SUPPORT }, { splice: function splice$5(start, deleteCount) { var O = toObject$2(this); var len = lengthOfArrayLike$2(O); var actualStart = toAbsoluteIndex$2(start, len); var argumentsLength = arguments.length; var insertCount, actualDeleteCount, A, k, from, to; if (argumentsLength === 0) insertCount = actualDeleteCount = 0; else if (argumentsLength === 1) { insertCount = 0; actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; actualDeleteCount = min(max(toIntegerOrInfinity$2(deleteCount), 0), len - actualStart); } doesNotExceedSafeInteger$2(len + insertCount - actualDeleteCount); A = arraySpeciesCreate$2(O, actualDeleteCount); for (k = 0; k < actualDeleteCount; k++) { from = actualStart + k; if (from in O) createProperty$2(A, k, O[from]); } A.length = actualDeleteCount; if (insertCount < actualDeleteCount) { for (k = actualStart; k < len - actualDeleteCount; k++) { from = k + actualDeleteCount; to = k + insertCount; if (from in O) O[to] = O[from]; else deletePropertyOrThrow$2(O, to); } for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow$2(O, k - 1); } else if (insertCount > actualDeleteCount) for (k = len - actualDeleteCount; k > actualStart; k--) { from = k + actualDeleteCount - 1; to = k + insertCount - 1; if (from in O) O[to] = O[from]; else deletePropertyOrThrow$2(O, to); } for (k = 0; k < insertCount; k++) O[k + actualStart] = arguments[k + 2]; setArrayLength(O, len - actualDeleteCount + insertCount); return A; } }); return es_array_splice$1; } var splice$3$1; var hasRequiredSplice$3$1; function requireSplice$3$1() { if (hasRequiredSplice$3$1) return splice$3$1; hasRequiredSplice$3$1 = 1; requireEs_array_splice$1(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod$1(); splice$3$1 = getBuiltInPrototypeMethod$2("Array", "splice"); return splice$3$1; } var splice$2$1; var hasRequiredSplice$2$1; function requireSplice$2$1() { if (hasRequiredSplice$2$1) return splice$2$1; hasRequiredSplice$2$1 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf$1(); var method = /* @__PURE__ */ requireSplice$3$1(); var ArrayPrototype = Array.prototype; splice$2$1 = function(it$1) { var own = it$1.splice; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.splice ? method : own; }; return splice$2$1; } var splice$1$1; var hasRequiredSplice$1$1; function requireSplice$1$1() { if (hasRequiredSplice$1$1) return splice$1$1; hasRequiredSplice$1$1 = 1; var parent = /* @__PURE__ */ requireSplice$2$1(); splice$1$1 = parent; return splice$1$1; } var splice$4; var hasRequiredSplice$4; function requireSplice$4() { if (hasRequiredSplice$4) return splice$4; hasRequiredSplice$4 = 1; splice$4 = /* @__PURE__ */ requireSplice$1$1(); return splice$4; } var spliceExports$1 = requireSplice$4(); var _spliceInstanceProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(spliceExports$1); var Queue = class Queue { /** * Construct a new Queue. * @param options - Queue configuration. */ constructor(options) { /** Delay in milliseconds. If defined the queue will be periodically flushed. */ /** Maximum number of entries in the queue before it will be flushed. */ _defineProperty$1(this, "_queue", []); _defineProperty$1(this, "_timeout", null); _defineProperty$1(this, "_extended", null); this.delay = null; this.max = Infinity; this.setOptions(options); } /** * Update the configuration of the queue. * @param options - Queue configuration. */ setOptions(options) { if (options && typeof options.delay !== "undefined") this.delay = options.delay; if (options && typeof options.max !== "undefined") this.max = options.max; this._flushIfNeeded(); } /** * Extend an object with queuing functionality. * The object will be extended with a function flush, and the methods provided in options.replace will be replaced with queued ones. * @param object - The object to be extended. * @param options - Additional options. * @returns The created queue. */ static extend(object$1, options) { const queue = new Queue(options); if (object$1.flush !== void 0) throw new Error("Target object already has a property flush"); object$1.flush = () => { queue.flush(); }; const methods = [{ name: "flush", original: void 0 }]; if (options && options.replace) for (let i = 0; i < options.replace.length; i++) { const name = options.replace[i]; methods.push({ name, original: object$1[name] }); queue.replace(object$1, name); } queue._extended = { object: object$1, methods }; return queue; } /** * Destroy the queue. The queue will first flush all queued actions, and in case it has extended an object, will restore the original object. */ destroy() { this.flush(); if (this._extended) { const object$1 = this._extended.object; const methods = this._extended.methods; for (let i = 0; i < methods.length; i++) { const method = methods[i]; if (method.original) object$1[method.name] = method.original; else delete object$1[method.name]; } this._extended = null; } } /** * Replace a method on an object with a queued version. * @param object - Object having the method. * @param method - The method name. */ replace(object$1, method) { const me = this; const original = object$1[method]; if (!original) throw new Error("Method " + method + " undefined"); object$1[method] = function() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; me.queue({ args, fn: original, context: this }); }; } /** * Queue a call. * @param entry - The function or entry to be queued. */ queue(entry) { if (typeof entry === "function") this._queue.push({ fn: entry }); else this._queue.push(entry); this._flushIfNeeded(); } /** * Check whether the queue needs to be flushed. */ _flushIfNeeded() { if (this._queue.length > this.max) this.flush(); if (this._timeout != null) { clearTimeout(this._timeout); this._timeout = null; } if (this.queue.length > 0 && typeof this.delay === "number") this._timeout = _setTimeout$1(() => { this.flush(); }, this.delay); } /** * Flush all queued calls */ flush() { var _context, _context2; _forEachInstanceProperty$1(_context = _spliceInstanceProperty$1(_context2 = this._queue).call(_context2, 0)).call(_context, (entry) => { entry.fn.apply(entry.context || entry.fn, entry.args || []); }); } }; var DataSetPart = class DataSetPart { constructor() { _defineProperty$1(this, "_subscribers", { "*": [], add: [], remove: [], update: [] }); /** * @deprecated Use on instead (PS: DataView.subscribe === DataView.on). */ _defineProperty$1(this, "subscribe", DataSetPart.prototype.on); /** * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off). */ _defineProperty$1(this, "unsubscribe", DataSetPart.prototype.off); } /** * Trigger an event * @param event - Event name. * @param payload - Event payload. * @param senderId - Id of the sender. */ _trigger(event, payload, senderId) { var _context; if (event === "*") throw new Error("Cannot trigger event *"); _forEachInstanceProperty$1(_context = [...this._subscribers[event], ...this._subscribers["*"]]).call(_context, (subscriber) => { subscriber(event, payload, senderId != null ? senderId : null); }); } /** * Subscribe to an event, add an event listener. * @remarks Non-function callbacks are ignored. * @param event - Event name. * @param callback - Callback method. */ on(event, callback) { if (typeof callback === "function") this._subscribers[event].push(callback); } /** * Unsubscribe from an event, remove an event listener. * @remarks If the same callback was subscribed more than once **all** occurences will be removed. * @param event - Event name. * @param callback - Callback method. */ off(event, callback) { var _context2; this._subscribers[event] = _filterInstanceProperty$1(_context2 = this._subscribers[event]).call(_context2, (subscriber) => subscriber !== callback); } get testLeakSubscribers() { return this._subscribers; } }; var es_object_create$1 = {}; var hasRequiredEs_object_create$1; function requireEs_object_create$1() { if (hasRequiredEs_object_create$1) return es_object_create$1; hasRequiredEs_object_create$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors$1(); var create$4 = /* @__PURE__ */ requireObjectCreate$1(); $({ target: "Object", stat: true, sham: !DESCRIPTORS }, { create: create$4 }); return es_object_create$1; } var create$2$1; var hasRequiredCreate$2$1; function requireCreate$2$1() { if (hasRequiredCreate$2$1) return create$2$1; hasRequiredCreate$2$1 = 1; requireEs_object_create$1(); var path$2 = /* @__PURE__ */ requirePath$1(); var Object$1 = path$2.Object; create$2$1 = function create$4(P, D) { return Object$1.create(P, D); }; return create$2$1; } var create$1$1; var hasRequiredCreate$1$1; function requireCreate$1$1() { if (hasRequiredCreate$1$1) return create$1$1; hasRequiredCreate$1$1 = 1; var parent = /* @__PURE__ */ requireCreate$2$1(); create$1$1 = parent; return create$1$1; } var create$3; var hasRequiredCreate$3; function requireCreate$3() { if (hasRequiredCreate$3) return create$3; hasRequiredCreate$3 = 1; create$3 = /* @__PURE__ */ requireCreate$1$1(); return create$3; } var createExports$1 = requireCreate$3(); var _Object$create$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(createExports$1); var es_set$1 = {}; var es_set_constructor$1 = {}; var hasRequiredEs_set_constructor$1; function requireEs_set_constructor$1() { if (hasRequiredEs_set_constructor$1) return es_set_constructor$1; hasRequiredEs_set_constructor$1 = 1; var collection$2 = /* @__PURE__ */ requireCollection$1(); var collectionStrong$2 = /* @__PURE__ */ requireCollectionStrong$1(); collection$2("Set", function(init) { return function Set$1() { return init(this, arguments.length ? arguments[0] : void 0); }; }, collectionStrong$2); return es_set_constructor$1; } var hasRequiredEs_set$1; function requireEs_set$1() { if (hasRequiredEs_set$1) return es_set$1; hasRequiredEs_set$1 = 1; requireEs_set_constructor$1(); return es_set$1; } var es_set_difference_v2$1 = {}; var aSet$1; var hasRequiredASet$1; function requireASet$1() { if (hasRequiredASet$1) return aSet$1; hasRequiredASet$1 = 1; var tryToString$2 = /* @__PURE__ */ requireTryToString$1(); var $TypeError = TypeError; aSet$1 = function(it$1) { if (typeof it$1 == "object" && "size" in it$1 && "has" in it$1 && "add" in it$1 && "delete" in it$1 && "keys" in it$1) return it$1; throw new $TypeError(tryToString$2(it$1) + " is not a set"); }; return aSet$1; } var setHelpers$1; var hasRequiredSetHelpers$1; function requireSetHelpers$1() { if (hasRequiredSetHelpers$1) return setHelpers$1; hasRequiredSetHelpers$1 = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn$1(); var caller$2 = /* @__PURE__ */ requireCaller$1(); var Set$1 = getBuiltIn$2("Set"); var SetPrototype = Set$1.prototype; setHelpers$1 = { Set: Set$1, add: caller$2("add", 1), has: caller$2("has", 1), remove: caller$2("delete", 1), proto: SetPrototype }; return setHelpers$1; } var iterateSimple$1; var hasRequiredIterateSimple$1; function requireIterateSimple$1() { if (hasRequiredIterateSimple$1) return iterateSimple$1; hasRequiredIterateSimple$1 = 1; var call = /* @__PURE__ */ requireFunctionCall$1(); iterateSimple$1 = function(record, fn, ITERATOR_INSTEAD_OF_RECORD) { var iterator$7 = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator; var next$1 = record.next; var step, result; while (!(step = call(next$1, iterator$7)).done) { result = fn(step.value); if (result !== void 0) return result; } }; return iterateSimple$1; } var setIterate$1; var hasRequiredSetIterate$1; function requireSetIterate$1() { if (hasRequiredSetIterate$1) return setIterate$1; hasRequiredSetIterate$1 = 1; var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple$1(); setIterate$1 = function(set$4, fn, interruptible) { return interruptible ? iterateSimple$2(set$4.keys(), fn, true) : set$4.forEach(fn); }; return setIterate$1; } var setClone$1; var hasRequiredSetClone$1; function requireSetClone$1() { if (hasRequiredSetClone$1) return setClone$1; hasRequiredSetClone$1 = 1; var SetHelpers = /* @__PURE__ */ requireSetHelpers$1(); var iterate$2 = /* @__PURE__ */ requireSetIterate$1(); var Set$1 = SetHelpers.Set; var add = SetHelpers.add; setClone$1 = function(set$4) { var result = new Set$1(); iterate$2(set$4, function(it$1) { add(result, it$1); }); return result; }; return setClone$1; } var setSize$1; var hasRequiredSetSize$1; function requireSetSize$1() { if (hasRequiredSetSize$1) return setSize$1; hasRequiredSetSize$1 = 1; setSize$1 = function(set$4) { return set$4.size; }; return setSize$1; } var getIteratorDirect$1; var hasRequiredGetIteratorDirect$1; function requireGetIteratorDirect$1() { if (hasRequiredGetIteratorDirect$1) return getIteratorDirect$1; hasRequiredGetIteratorDirect$1 = 1; getIteratorDirect$1 = function(obj) { return { iterator: obj, next: obj.next, done: false }; }; return getIteratorDirect$1; } var getSetRecord$1; var hasRequiredGetSetRecord$1; function requireGetSetRecord$1() { if (hasRequiredGetSetRecord$1) return getSetRecord$1; hasRequiredGetSetRecord$1 = 1; var aCallable$2 = /* @__PURE__ */ requireACallable$1(); var anObject$2 = /* @__PURE__ */ requireAnObject$1(); var call = /* @__PURE__ */ requireFunctionCall$1(); var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity$1(); var getIteratorDirect$2 = /* @__PURE__ */ requireGetIteratorDirect$1(); var INVALID_SIZE = "Invalid size"; var $RangeError = RangeError; var $TypeError = TypeError; var max = Math.max; var SetRecord = function(set$4, intSize) { this.set = set$4; this.size = max(intSize, 0); this.has = aCallable$2(set$4.has); this.keys = aCallable$2(set$4.keys); }; SetRecord.prototype = { getIterator: function() { return getIteratorDirect$2(anObject$2(call(this.keys, this.set))); }, includes: function(it$1) { return call(this.has, this.set, it$1); } }; getSetRecord$1 = function(obj) { anObject$2(obj); var numSize = +obj.size; if (numSize !== numSize) throw new $TypeError(INVALID_SIZE); var intSize = toIntegerOrInfinity$2(numSize); if (intSize < 0) throw new $RangeError(INVALID_SIZE); return new SetRecord(obj, intSize); }; return getSetRecord$1; } var setDifference$1; var hasRequiredSetDifference$1; function requireSetDifference$1() { if (hasRequiredSetDifference$1) return setDifference$1; hasRequiredSetDifference$1 = 1; var aSet$2 = /* @__PURE__ */ requireASet$1(); var SetHelpers = /* @__PURE__ */ requireSetHelpers$1(); var clone$1 = /* @__PURE__ */ requireSetClone$1(); var size = /* @__PURE__ */ requireSetSize$1(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord$1(); var iterateSet = /* @__PURE__ */ requireSetIterate$1(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple$1(); var has = SetHelpers.has; var remove = SetHelpers.remove; setDifference$1 = function difference(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); var result = clone$1(O); if (size(O) <= otherRec.size) iterateSet(O, function(e) { if (otherRec.includes(e)) remove(result, e); }); else iterateSimple$2(otherRec.getIterator(), function(e) { if (has(result, e)) remove(result, e); }); return result; }; return setDifference$1; } var setMethodAcceptSetLike$1; var hasRequiredSetMethodAcceptSetLike$1; function requireSetMethodAcceptSetLike$1() { if (hasRequiredSetMethodAcceptSetLike$1) return setMethodAcceptSetLike$1; hasRequiredSetMethodAcceptSetLike$1 = 1; setMethodAcceptSetLike$1 = function() { return false; }; return setMethodAcceptSetLike$1; } var hasRequiredEs_set_difference_v2$1; function requireEs_set_difference_v2$1() { if (hasRequiredEs_set_difference_v2$1) return es_set_difference_v2$1; hasRequiredEs_set_difference_v2$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var difference = /* @__PURE__ */ requireSetDifference$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike$1(); var SET_LIKE_INCORRECT_BEHAVIOR = !setMethodAcceptSetLike$2("difference", function(result) { return result.size === 0; }); var FORCED = SET_LIKE_INCORRECT_BEHAVIOR || fails$2(function() { var setLike = { size: 1, has: function() { return true; }, keys: function() { var index$1 = 0; return { next: function() { var done = index$1++ > 1; if (baseSet.has(1)) baseSet.clear(); return { done, value: 2 }; } }; } }; var baseSet = new Set([ 1, 2, 3, 4 ]); return baseSet.difference(setLike).size !== 3; }); $({ target: "Set", proto: true, real: true, forced: FORCED }, { difference }); return es_set_difference_v2$1; } var es_set_intersection_v2$1 = {}; var setIntersection$1; var hasRequiredSetIntersection$1; function requireSetIntersection$1() { if (hasRequiredSetIntersection$1) return setIntersection$1; hasRequiredSetIntersection$1 = 1; var aSet$2 = /* @__PURE__ */ requireASet$1(); var SetHelpers = /* @__PURE__ */ requireSetHelpers$1(); var size = /* @__PURE__ */ requireSetSize$1(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord$1(); var iterateSet = /* @__PURE__ */ requireSetIterate$1(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple$1(); var Set$1 = SetHelpers.Set; var add = SetHelpers.add; var has = SetHelpers.has; setIntersection$1 = function intersection(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); var result = new Set$1(); if (size(O) > otherRec.size) iterateSimple$2(otherRec.getIterator(), function(e) { if (has(O, e)) add(result, e); }); else iterateSet(O, function(e) { if (otherRec.includes(e)) add(result, e); }); return result; }; return setIntersection$1; } var hasRequiredEs_set_intersection_v2$1; function requireEs_set_intersection_v2$1() { if (hasRequiredEs_set_intersection_v2$1) return es_set_intersection_v2$1; hasRequiredEs_set_intersection_v2$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var fails$2 = /* @__PURE__ */ requireFails$1(); var intersection = /* @__PURE__ */ requireSetIntersection$1(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike$1(); var INCORRECT = !setMethodAcceptSetLike$2("intersection", function(result) { return result.size === 2 && result.has(1) && result.has(2); }) || fails$2(function() { return String(Array.from(new Set([ 1, 2, 3 ]).intersection(new Set([3, 2])))) !== "3,2"; }); $({ target: "Set", proto: true, real: true, forced: INCORRECT }, { intersection }); return es_set_intersection_v2$1; } var es_set_isDisjointFrom_v2$1 = {}; var setIsDisjointFrom$1; var hasRequiredSetIsDisjointFrom$1; function requireSetIsDisjointFrom$1() { if (hasRequiredSetIsDisjointFrom$1) return setIsDisjointFrom$1; hasRequiredSetIsDisjointFrom$1 = 1; var aSet$2 = /* @__PURE__ */ requireASet$1(); var has = requireSetHelpers$1().has; var size = /* @__PURE__ */ requireSetSize$1(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord$1(); var iterateSet = /* @__PURE__ */ requireSetIterate$1(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple$1(); var iteratorClose$2 = /* @__PURE__ */ requireIteratorClose$1(); setIsDisjointFrom$1 = function isDisjointFrom(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); if (size(O) <= otherRec.size) return iterateSet(O, function(e) { if (otherRec.includes(e)) return false; }, true) !== false; var iterator$7 = otherRec.getIterator(); return iterateSimple$2(iterator$7, function(e) { if (has(O, e)) return iteratorClose$2(iterator$7, "normal", false); }) !== false; }; return setIsDisjointFrom$1; } var hasRequiredEs_set_isDisjointFrom_v2$1; function requireEs_set_isDisjointFrom_v2$1() { if (hasRequiredEs_set_isDisjointFrom_v2$1) return es_set_isDisjointFrom_v2$1; hasRequiredEs_set_isDisjointFrom_v2$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var isDisjointFrom = /* @__PURE__ */ requireSetIsDisjointFrom$1(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike$1(); var INCORRECT = !setMethodAcceptSetLike$2("isDisjointFrom", function(result) { return !result; }); $({ target: "Set", proto: true, real: true, forced: INCORRECT }, { isDisjointFrom }); return es_set_isDisjointFrom_v2$1; } var es_set_isSubsetOf_v2$1 = {}; var setIsSubsetOf$1; var hasRequiredSetIsSubsetOf$1; function requireSetIsSubsetOf$1() { if (hasRequiredSetIsSubsetOf$1) return setIsSubsetOf$1; hasRequiredSetIsSubsetOf$1 = 1; var aSet$2 = /* @__PURE__ */ requireASet$1(); var size = /* @__PURE__ */ requireSetSize$1(); var iterate$2 = /* @__PURE__ */ requireSetIterate$1(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord$1(); setIsSubsetOf$1 = function isSubsetOf(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); if (size(O) > otherRec.size) return false; return iterate$2(O, function(e) { if (!otherRec.includes(e)) return false; }, true) !== false; }; return setIsSubsetOf$1; } var hasRequiredEs_set_isSubsetOf_v2$1; function requireEs_set_isSubsetOf_v2$1() { if (hasRequiredEs_set_isSubsetOf_v2$1) return es_set_isSubsetOf_v2$1; hasRequiredEs_set_isSubsetOf_v2$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var isSubsetOf = /* @__PURE__ */ requireSetIsSubsetOf$1(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike$1(); var INCORRECT = !setMethodAcceptSetLike$2("isSubsetOf", function(result) { return result; }); $({ target: "Set", proto: true, real: true, forced: INCORRECT }, { isSubsetOf }); return es_set_isSubsetOf_v2$1; } var es_set_isSupersetOf_v2$1 = {}; var setIsSupersetOf$1; var hasRequiredSetIsSupersetOf$1; function requireSetIsSupersetOf$1() { if (hasRequiredSetIsSupersetOf$1) return setIsSupersetOf$1; hasRequiredSetIsSupersetOf$1 = 1; var aSet$2 = /* @__PURE__ */ requireASet$1(); var has = requireSetHelpers$1().has; var size = /* @__PURE__ */ requireSetSize$1(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord$1(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple$1(); var iteratorClose$2 = /* @__PURE__ */ requireIteratorClose$1(); setIsSupersetOf$1 = function isSupersetOf(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); if (size(O) < otherRec.size) return false; var iterator$7 = otherRec.getIterator(); return iterateSimple$2(iterator$7, function(e) { if (!has(O, e)) return iteratorClose$2(iterator$7, "normal", false); }) !== false; }; return setIsSupersetOf$1; } var hasRequiredEs_set_isSupersetOf_v2$1; function requireEs_set_isSupersetOf_v2$1() { if (hasRequiredEs_set_isSupersetOf_v2$1) return es_set_isSupersetOf_v2$1; hasRequiredEs_set_isSupersetOf_v2$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var isSupersetOf = /* @__PURE__ */ requireSetIsSupersetOf$1(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike$1(); var INCORRECT = !setMethodAcceptSetLike$2("isSupersetOf", function(result) { return !result; }); $({ target: "Set", proto: true, real: true, forced: INCORRECT }, { isSupersetOf }); return es_set_isSupersetOf_v2$1; } var es_set_symmetricDifference_v2$1 = {}; var setSymmetricDifference$1; var hasRequiredSetSymmetricDifference$1; function requireSetSymmetricDifference$1() { if (hasRequiredSetSymmetricDifference$1) return setSymmetricDifference$1; hasRequiredSetSymmetricDifference$1 = 1; var aSet$2 = /* @__PURE__ */ requireASet$1(); var SetHelpers = /* @__PURE__ */ requireSetHelpers$1(); var clone$1 = /* @__PURE__ */ requireSetClone$1(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord$1(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple$1(); var add = SetHelpers.add; var has = SetHelpers.has; var remove = SetHelpers.remove; setSymmetricDifference$1 = function symmetricDifference(other) { var O = aSet$2(this); var keysIter = getSetRecord$2(other).getIterator(); var result = clone$1(O); iterateSimple$2(keysIter, function(e) { if (has(O, e)) remove(result, e); else add(result, e); }); return result; }; return setSymmetricDifference$1; } var setMethodGetKeysBeforeCloningDetection$1; var hasRequiredSetMethodGetKeysBeforeCloningDetection$1; function requireSetMethodGetKeysBeforeCloningDetection$1() { if (hasRequiredSetMethodGetKeysBeforeCloningDetection$1) return setMethodGetKeysBeforeCloningDetection$1; hasRequiredSetMethodGetKeysBeforeCloningDetection$1 = 1; setMethodGetKeysBeforeCloningDetection$1 = function(METHOD_NAME) { try { var baseSet = new Set(); var setLike = { size: 0, has: function() { return true; }, keys: function() { return Object.defineProperty({}, "next", { get: function() { baseSet.clear(); baseSet.add(4); return function() { return { done: true }; }; } }); } }; var result = baseSet[METHOD_NAME](setLike); return result.size === 1 && result.values().next().value === 4; } catch (error) { return false; } }; return setMethodGetKeysBeforeCloningDetection$1; } var hasRequiredEs_set_symmetricDifference_v2$1; function requireEs_set_symmetricDifference_v2$1() { if (hasRequiredEs_set_symmetricDifference_v2$1) return es_set_symmetricDifference_v2$1; hasRequiredEs_set_symmetricDifference_v2$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var symmetricDifference = /* @__PURE__ */ requireSetSymmetricDifference$1(); var setMethodGetKeysBeforeCloning = /* @__PURE__ */ requireSetMethodGetKeysBeforeCloningDetection$1(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike$1(); var FORCED = !setMethodAcceptSetLike$2("symmetricDifference") || !setMethodGetKeysBeforeCloning("symmetricDifference"); $({ target: "Set", proto: true, real: true, forced: FORCED }, { symmetricDifference }); return es_set_symmetricDifference_v2$1; } var es_set_union_v2$1 = {}; var setUnion$1; var hasRequiredSetUnion$1; function requireSetUnion$1() { if (hasRequiredSetUnion$1) return setUnion$1; hasRequiredSetUnion$1 = 1; var aSet$2 = /* @__PURE__ */ requireASet$1(); var add = requireSetHelpers$1().add; var clone$1 = /* @__PURE__ */ requireSetClone$1(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord$1(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple$1(); setUnion$1 = function union(other) { var O = aSet$2(this); var keysIter = getSetRecord$2(other).getIterator(); var result = clone$1(O); iterateSimple$2(keysIter, function(it$1) { add(result, it$1); }); return result; }; return setUnion$1; } var hasRequiredEs_set_union_v2$1; function requireEs_set_union_v2$1() { if (hasRequiredEs_set_union_v2$1) return es_set_union_v2$1; hasRequiredEs_set_union_v2$1 = 1; var $ = /* @__PURE__ */ require_export$1(); var union = /* @__PURE__ */ requireSetUnion$1(); var setMethodGetKeysBeforeCloning = /* @__PURE__ */ requireSetMethodGetKeysBeforeCloningDetection$1(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike$1(); var FORCED = !setMethodAcceptSetLike$2("union") || !setMethodGetKeysBeforeCloning("union"); $({ target: "Set", proto: true, real: true, forced: FORCED }, { union }); return es_set_union_v2$1; } var set$2$1; var hasRequiredSet$2$1; function requireSet$2$1() { if (hasRequiredSet$2$1) return set$2$1; hasRequiredSet$2$1 = 1; requireEs_array_iterator$1(); requireEs_set$1(); requireEs_set_difference_v2$1(); requireEs_set_intersection_v2$1(); requireEs_set_isDisjointFrom_v2$1(); requireEs_set_isSubsetOf_v2$1(); requireEs_set_isSupersetOf_v2$1(); requireEs_set_symmetricDifference_v2$1(); requireEs_set_union_v2$1(); requireEs_string_iterator$1(); var path$2 = /* @__PURE__ */ requirePath$1(); set$2$1 = path$2.Set; return set$2$1; } var set$1$1; var hasRequiredSet$1$1; function requireSet$1$1() { if (hasRequiredSet$1$1) return set$1$1; hasRequiredSet$1$1 = 1; var parent = /* @__PURE__ */ requireSet$2$1(); requireWeb_domCollections_iterator$1(); set$1$1 = parent; return set$1$1; } var set$3; var hasRequiredSet$3; function requireSet$3() { if (hasRequiredSet$3) return set$3; hasRequiredSet$3 = 1; set$3 = /* @__PURE__ */ requireSet$1$1(); return set$3; } var setExports$1 = requireSet$3(); var _Set$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(setExports$1); var getIterator_1; var hasRequiredGetIterator$5; function requireGetIterator$5() { if (hasRequiredGetIterator$5) return getIterator_1; hasRequiredGetIterator$5 = 1; requireEs_array_iterator$1(); requireEs_string_iterator$1(); var getIterator$7 = /* @__PURE__ */ requireGetIterator$6(); getIterator_1 = getIterator$7; return getIterator_1; } var getIterator$4; var hasRequiredGetIterator$4; function requireGetIterator$4() { if (hasRequiredGetIterator$4) return getIterator$4; hasRequiredGetIterator$4 = 1; var parent = /* @__PURE__ */ requireGetIterator$5(); requireWeb_domCollections_iterator$1(); getIterator$4 = parent; return getIterator$4; } var getIterator$3; var hasRequiredGetIterator$3; function requireGetIterator$3() { if (hasRequiredGetIterator$3) return getIterator$3; hasRequiredGetIterator$3 = 1; var parent = /* @__PURE__ */ requireGetIterator$4(); getIterator$3 = parent; return getIterator$3; } var getIterator$2; var hasRequiredGetIterator$2; function requireGetIterator$2() { if (hasRequiredGetIterator$2) return getIterator$2; hasRequiredGetIterator$2 = 1; var parent = /* @__PURE__ */ requireGetIterator$3(); getIterator$2 = parent; return getIterator$2; } var getIterator$1; var hasRequiredGetIterator$1; function requireGetIterator$1() { if (hasRequiredGetIterator$1) return getIterator$1; hasRequiredGetIterator$1 = 1; getIterator$1 = /* @__PURE__ */ requireGetIterator$2(); return getIterator$1; } var getIterator$6; var hasRequiredGetIterator$7; function requireGetIterator$7() { if (hasRequiredGetIterator$7) return getIterator$6; hasRequiredGetIterator$7 = 1; getIterator$6 = /* @__PURE__ */ requireGetIterator$1(); return getIterator$6; } var getIteratorExports = requireGetIterator$7(); var _getIterator = /* @__PURE__ */ getDefaultExportFromCjs$1(getIteratorExports); var DataStream = class DataStream { /** * Create a new data stream. * @param pairs - The id, item pairs. */ constructor(pairs) { this._pairs = pairs; } /** * Return an iterable of key, value pairs for every entry in the stream. */ *[_Symbol$iterator$2]() { for (const [id, item] of this._pairs) yield [id, item]; } /** * Return an iterable of key, value pairs for every entry in the stream. */ *entries() { for (const [id, item] of this._pairs) yield [id, item]; } /** * Return an iterable of keys in the stream. */ *keys() { for (const [id] of this._pairs) yield id; } /** * Return an iterable of values in the stream. */ *values() { for (const [, item] of this._pairs) yield item; } /** * Return an array containing all the ids in this stream. * @remarks * The array may contain duplicities. * @returns The array with all ids from this stream. */ toIdArray() { var _context; return _mapInstanceProperty$1(_context = [...this._pairs]).call(_context, (pair) => pair[0]); } /** * Return an array containing all the items in this stream. * @remarks * The array may contain duplicities. * @returns The array with all items from this stream. */ toItemArray() { var _context2; return _mapInstanceProperty$1(_context2 = [...this._pairs]).call(_context2, (pair) => pair[1]); } /** * Return an array containing all the entries in this stream. * @remarks * The array may contain duplicities. * @returns The array with all entries from this stream. */ toEntryArray() { return [...this._pairs]; } /** * Return an object map containing all the items in this stream accessible by ids. * @remarks * In case of duplicate ids (coerced to string so `7 == '7'`) the last encoutered appears in the returned object. * @returns The object map of all id → item pairs from this stream. */ toObjectMap() { const map$8 = _Object$create$1(null); for (const [id, item] of this._pairs) map$8[id] = item; return map$8; } /** * Return a map containing all the items in this stream accessible by ids. * @returns The map of all id → item pairs from this stream. */ toMap() { return new _Map$1(this._pairs); } /** * Return a set containing all the (unique) ids in this stream. * @returns The set of all ids from this stream. */ toIdSet() { return new _Set$1(this.toIdArray()); } /** * Return a set containing all the (unique) items in this stream. * @returns The set of all items from this stream. */ toItemSet() { return new _Set$1(this.toItemArray()); } /** * Cache the items from this stream. * @remarks * This method allows for items to be fetched immediatelly and used (possibly multiple times) later. * It can also be used to optimize performance as {@link DataStream} would otherwise reevaluate everything upon each iteration. * * ## Example * ```javascript * const ds = new DataSet([…]) * * const cachedStream = ds.stream() * .filter(…) * .sort(…) * .map(…) * .cached(…) // Data are fetched, processed and cached here. * * ds.clear() * chachedStream // Still has all the items. * ``` * @returns A new {@link DataStream} with cached items (detached from the original {@link DataSet}). */ cache() { return new DataStream([...this._pairs]); } /** * Get the distinct values of given property. * @param callback - The function that picks and possibly converts the property. * @typeParam T - The type of the distinct value. * @returns A set of all distinct properties. */ distinct(callback) { const set$4 = new _Set$1(); for (const [id, item] of this._pairs) set$4.add(callback(item, id)); return set$4; } /** * Filter the items of the stream. * @param callback - The function that decides whether an item will be included. * @returns A new data stream with the filtered items. */ filter(callback) { const pairs = this._pairs; return new DataStream({ *[_Symbol$iterator$2]() { for (const [id, item] of pairs) if (callback(item, id)) yield [id, item]; } }); } /** * Execute a callback for each item of the stream. * @param callback - The function that will be invoked for each item. */ forEach(callback) { for (const [id, item] of this._pairs) callback(item, id); } /** * Map the items into a different type. * @param callback - The function that does the conversion. * @typeParam Mapped - The type of the item after mapping. * @returns A new data stream with the mapped items. */ map(callback) { const pairs = this._pairs; return new DataStream({ *[_Symbol$iterator$2]() { for (const [id, item] of pairs) yield [id, callback(item, id)]; } }); } /** * Get the item with the maximum value of given property. * @param callback - The function that picks and possibly converts the property. * @returns The item with the maximum if found otherwise null. */ max(callback) { const iter = _getIterator(this._pairs); let curr = iter.next(); if (curr.done) return null; let maxItem = curr.value[1]; let maxValue = callback(curr.value[1], curr.value[0]); while (!(curr = iter.next()).done) { const [id, item] = curr.value; const value = callback(item, id); if (value > maxValue) { maxValue = value; maxItem = item; } } return maxItem; } /** * Get the item with the minimum value of given property. * @param callback - The function that picks and possibly converts the property. * @returns The item with the minimum if found otherwise null. */ min(callback) { const iter = _getIterator(this._pairs); let curr = iter.next(); if (curr.done) return null; let minItem = curr.value[1]; let minValue = callback(curr.value[1], curr.value[0]); while (!(curr = iter.next()).done) { const [id, item] = curr.value; const value = callback(item, id); if (value < minValue) { minValue = value; minItem = item; } } return minItem; } /** * Reduce the items into a single value. * @param callback - The function that does the reduction. * @param accumulator - The initial value of the accumulator. * @typeParam T - The type of the accumulated value. * @returns The reduced value. */ reduce(callback, accumulator) { for (const [id, item] of this._pairs) accumulator = callback(accumulator, item, id); return accumulator; } /** * Sort the items. * @param callback - Item comparator. * @returns A new stream with sorted items. */ sort(callback) { return new DataStream({ [_Symbol$iterator$2]: () => { var _context3; return _getIterator(_sortInstanceProperty$1(_context3 = [...this._pairs]).call(_context3, (_ref, _ref2) => { let [idA, itemA] = _ref; let [idB, itemB] = _ref2; return callback(itemA, itemB, idA, idB); })); } }); } }; function ownKeys$3$1(e, r) { var t = _Object$keys$1(e); if (_Object$getOwnPropertySymbols$1) { var o = _Object$getOwnPropertySymbols$1(e); r && (o = _filterInstanceProperty$1(o).call(o, function(r$1) { return _Object$getOwnPropertyDescriptor$1(e, r$1).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context8, _context9; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty$1(_context8 = ownKeys$3$1(Object(t), true)).call(_context8, function(r$1) { _defineProperty$1(e, r$1, t[r$1]); }) : _Object$getOwnPropertyDescriptors$1 ? _Object$defineProperties$1(e, _Object$getOwnPropertyDescriptors$1(t)) : _forEachInstanceProperty$1(_context9 = ownKeys$3$1(Object(t))).call(_context9, function(r$1) { _Object$defineProperty$2(e, r$1, _Object$getOwnPropertyDescriptor$1(t, r$1)); }); } return e; } /** * Add an id to given item if it doesn't have one already. * @remarks * The item will be modified. * @param item - The item that will have an id after a call to this function. * @param idProp - The key of the id property. * @typeParam Item - Item type that may or may not have an id. * @typeParam IdProp - Name of the property that contains the id. * @returns true */ function ensureFullItem(item, idProp) { if (item[idProp] == null) item[idProp] = v4$1(); return item; } var DataSet = class extends DataSetPart { /** Flush all queued calls. */ /** @inheritDoc */ /** @inheritDoc */ get idProp() { return this._idProp; } /** * Construct a new DataSet. * @param data - Initial data or options. * @param options - Options (type error if data is also options). */ constructor(data, options) { super(); _defineProperty$1(this, "_queue", null); if (data && !_Array$isArray$1(data)) { options = data; data = []; } this._options = options || {}; this._data = new _Map$1(); this.length = 0; this._idProp = this._options.fieldId || "id"; if (data && data.length) this.add(data); this.setOptions(options); } /** * Set new options. * @param options - The new options. */ setOptions(options) { if (options && options.queue !== void 0) if (options.queue === false) { if (this._queue) { this._queue.destroy(); this._queue = null; } } else { if (!this._queue) this._queue = Queue.extend(this, { replace: [ "add", "update", "remove" ] }); if (options.queue && typeof options.queue === "object") this._queue.setOptions(options.queue); } } /** * Add a data item or an array with items. * * After the items are added to the DataSet, the DataSet will trigger an event `add`. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. * * ## Example * * ```javascript * // create a DataSet * const data = new vis.DataSet() * * // add items * const ids = data.add([ * { id: 1, text: 'item 1' }, * { id: 2, text: 'item 2' }, * { text: 'item without an id' } * ]) * * console.log(ids) // [1, 2, ''] * ``` * @param data - Items to be added (ids will be generated if missing). * @param senderId - Sender id. * @returns addedIds - Array with the ids (generated if not present) of the added items. * @throws When an item with the same id as any of the added items already exists. */ add(data, senderId) { const addedIds = []; let id; if (_Array$isArray$1(data)) { const idsToAdd = _mapInstanceProperty$1(data).call(data, (d) => d[this._idProp]); if (_someInstanceProperty$1(idsToAdd).call(idsToAdd, (id$1) => this._data.has(id$1))) throw new Error("A duplicate id was found in the parameter array."); for (let i = 0, len = data.length; i < len; i++) { id = this._addItem(data[i]); addedIds.push(id); } } else if (data && typeof data === "object") { id = this._addItem(data); addedIds.push(id); } else throw new Error("Unknown dataType"); if (addedIds.length) this._trigger("add", { items: addedIds }, senderId); return addedIds; } /** * Update existing items. When an item does not exist, it will be created. * @remarks * The provided properties will be merged in the existing item. When an item does not exist, it will be created. * * After the items are updated, the DataSet will trigger an event `add` for the added items, and an event `update`. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. * * ## Example * * ```javascript * // create a DataSet * const data = new vis.DataSet([ * { id: 1, text: 'item 1' }, * { id: 2, text: 'item 2' }, * { id: 3, text: 'item 3' } * ]) * * // update items * const ids = data.update([ * { id: 2, text: 'item 2 (updated)' }, * { id: 4, text: 'item 4 (new)' } * ]) * * console.log(ids) // [2, 4] * ``` * * ## Warning for TypeScript users * This method may introduce partial items into the data set. Use add or updateOnly instead for better type safety. * @param data - Items to be updated (if the id is already present) or added (if the id is missing). * @param senderId - Sender id. * @returns updatedIds - The ids of the added (these may be newly generated if there was no id in the item from the data) or updated items. * @throws When the supplied data is neither an item nor an array of items. */ update(data, senderId) { const addedIds = []; const updatedIds = []; const oldData = []; const updatedData = []; const idProp = this._idProp; const addOrUpdate = (item) => { const origId = item[idProp]; if (origId != null && this._data.has(origId)) { const fullItem = item; const oldItem = _Object$assign$1({}, this._data.get(origId)); const id = this._updateItem(fullItem); updatedIds.push(id); updatedData.push(fullItem); oldData.push(oldItem); } else { const id = this._addItem(item); addedIds.push(id); } }; if (_Array$isArray$1(data)) for (let i = 0, len = data.length; i < len; i++) if (data[i] && typeof data[i] === "object") addOrUpdate(data[i]); else console.warn("Ignoring input item, which is not an object at index " + i); else if (data && typeof data === "object") addOrUpdate(data); else throw new Error("Unknown dataType"); if (addedIds.length) this._trigger("add", { items: addedIds }, senderId); if (updatedIds.length) { const props = { items: updatedIds, oldData, data: updatedData }; this._trigger("update", props, senderId); } return _concatInstanceProperty$1(addedIds).call(addedIds, updatedIds); } /** * Update existing items. When an item does not exist, an error will be thrown. * @remarks * The provided properties will be deeply merged into the existing item. * When an item does not exist (id not present in the data set or absent), an error will be thrown and nothing will be changed. * * After the items are updated, the DataSet will trigger an event `update`. * When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. * * ## Example * * ```javascript * // create a DataSet * const data = new vis.DataSet([ * { id: 1, text: 'item 1' }, * { id: 2, text: 'item 2' }, * { id: 3, text: 'item 3' }, * ]) * * // update items * const ids = data.update([ * { id: 2, text: 'item 2 (updated)' }, // works * // { id: 4, text: 'item 4 (new)' }, // would throw * // { text: 'item 4 (new)' }, // would also throw * ]) * * console.log(ids) // [2] * ``` * @param data - Updates (the id and optionally other props) to the items in this data set. * @param senderId - Sender id. * @returns updatedIds - The ids of the updated items. * @throws When the supplied data is neither an item nor an array of items, when the ids are missing. */ updateOnly(data, senderId) { var _context; if (!_Array$isArray$1(data)) data = [data]; const updateEventData = _mapInstanceProperty$1(_context = _mapInstanceProperty$1(data).call(data, (update) => { const oldData = this._data.get(update[this._idProp]); if (oldData == null) throw new Error("Updating non-existent items is not allowed."); return { oldData, update }; })).call(_context, (_ref) => { let { oldData, update } = _ref; const id = oldData[this._idProp]; const updatedData = pureDeepObjectAssign(oldData, update); this._data.set(id, updatedData); return { id, oldData, updatedData }; }); if (updateEventData.length) { const props = { items: _mapInstanceProperty$1(updateEventData).call(updateEventData, (value) => value.id), oldData: _mapInstanceProperty$1(updateEventData).call(updateEventData, (value) => value.oldData), data: _mapInstanceProperty$1(updateEventData).call(updateEventData, (value) => value.updatedData) }; this._trigger("update", props, senderId); return props.items; } else return []; } /** @inheritDoc */ get(first$1, second) { let id = void 0; let ids = void 0; let options = void 0; if (isId(first$1)) { id = first$1; options = second; } else if (_Array$isArray$1(first$1)) { ids = first$1; options = second; } else options = first$1; const returnType = options && options.returnType === "Object" ? "Object" : "Array"; const filter$5 = options && _filterInstanceProperty$1(options); const items = []; let item = void 0; let itemIds = void 0; let itemId = void 0; if (id != null) { item = this._data.get(id); if (item && filter$5 && !filter$5(item)) item = void 0; } else if (ids != null) for (let i = 0, len = ids.length; i < len; i++) { item = this._data.get(ids[i]); if (item != null && (!filter$5 || filter$5(item))) items.push(item); } else { var _context2; itemIds = [..._keysInstanceProperty(_context2 = this._data).call(_context2)]; for (let i = 0, len = itemIds.length; i < len; i++) { itemId = itemIds[i]; item = this._data.get(itemId); if (item != null && (!filter$5 || filter$5(item))) items.push(item); } } if (options && options.order && id == void 0) this._sort(items, options.order); if (options && options.fields) { const fields = options.fields; if (id != void 0 && item != null) item = this._filterFields(item, fields); else for (let i = 0, len = items.length; i < len; i++) items[i] = this._filterFields(items[i], fields); } if (returnType == "Object") { const result = {}; for (let i = 0, len = items.length; i < len; i++) { const resultant = items[i]; const id$1 = resultant[this._idProp]; result[id$1] = resultant; } return result; } else if (id != null) return item !== null && item !== void 0 ? item : null; else return items; } /** @inheritDoc */ getIds(options) { const data = this._data; const filter$5 = options && _filterInstanceProperty$1(options); const order = options && options.order; const itemIds = [..._keysInstanceProperty(data).call(data)]; const ids = []; if (filter$5) if (order) { const items = []; for (let i = 0, len = itemIds.length; i < len; i++) { const id = itemIds[i]; const item = this._data.get(id); if (item != null && filter$5(item)) items.push(item); } this._sort(items, order); for (let i = 0, len = items.length; i < len; i++) ids.push(items[i][this._idProp]); } else for (let i = 0, len = itemIds.length; i < len; i++) { const id = itemIds[i]; const item = this._data.get(id); if (item != null && filter$5(item)) ids.push(item[this._idProp]); } else if (order) { const items = []; for (let i = 0, len = itemIds.length; i < len; i++) { const id = itemIds[i]; items.push(data.get(id)); } this._sort(items, order); for (let i = 0, len = items.length; i < len; i++) ids.push(items[i][this._idProp]); } else for (let i = 0, len = itemIds.length; i < len; i++) { const id = itemIds[i]; const item = data.get(id); if (item != null) ids.push(item[this._idProp]); } return ids; } /** @inheritDoc */ getDataSet() { return this; } /** @inheritDoc */ forEach(callback, options) { const filter$5 = options && _filterInstanceProperty$1(options); const data = this._data; const itemIds = [..._keysInstanceProperty(data).call(data)]; if (options && options.order) { const items = this.get(options); for (let i = 0, len = items.length; i < len; i++) { const item = items[i]; const id = item[this._idProp]; callback(item, id); } } else for (let i = 0, len = itemIds.length; i < len; i++) { const id = itemIds[i]; const item = this._data.get(id); if (item != null && (!filter$5 || filter$5(item))) callback(item, id); } } /** @inheritDoc */ map(callback, options) { const filter$5 = options && _filterInstanceProperty$1(options); const mappedItems = []; const data = this._data; const itemIds = [..._keysInstanceProperty(data).call(data)]; for (let i = 0, len = itemIds.length; i < len; i++) { const id = itemIds[i]; const item = this._data.get(id); if (item != null && (!filter$5 || filter$5(item))) mappedItems.push(callback(item, id)); } if (options && options.order) this._sort(mappedItems, options.order); return mappedItems; } /** * Filter the fields of an item. * @param item - The item whose fields should be filtered. * @param fields - The names of the fields that will be kept. * @typeParam K - Field name type. * @returns The item without any additional fields. */ _filterFields(item, fields) { var _context3; if (!item) return item; return _reduceInstanceProperty$1(_context3 = _Array$isArray$1(fields) ? fields : _Object$keys$1(fields)).call(_context3, (filteredItem, field) => { filteredItem[field] = item[field]; return filteredItem; }, {}); } /** * Sort the provided array with items. * @param items - Items to be sorted in place. * @param order - A field name or custom sort function. * @typeParam T - The type of the items in the items array. */ _sort(items, order) { if (typeof order === "string") { const name = order; _sortInstanceProperty$1(items).call(items, (a, b) => { const av = a[name]; const bv = b[name]; return av > bv ? 1 : av < bv ? -1 : 0; }); } else if (typeof order === "function") _sortInstanceProperty$1(items).call(items, order); else throw new TypeError("Order must be a function or a string"); } /** * Remove an item or multiple items by “reference” (only the id is used) or by id. * * The method ignores removal of non-existing items, and returns an array containing the ids of the items which are actually removed from the DataSet. * * After the items are removed, the DataSet will trigger an event `remove` for the removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. * * ## Example * ```javascript * // create a DataSet * const data = new vis.DataSet([ * { id: 1, text: 'item 1' }, * { id: 2, text: 'item 2' }, * { id: 3, text: 'item 3' } * ]) * * // remove items * const ids = data.remove([2, { id: 3 }, 4]) * * console.log(ids) // [2, 3] * ``` * @param id - One or more items or ids of items to be removed. * @param senderId - Sender id. * @returns The ids of the removed items. */ remove(id, senderId) { const removedIds = []; const removedItems = []; const ids = _Array$isArray$1(id) ? id : [id]; for (let i = 0, len = ids.length; i < len; i++) { const item = this._remove(ids[i]); if (item) { const itemId = item[this._idProp]; if (itemId != null) { removedIds.push(itemId); removedItems.push(item); } } } if (removedIds.length) this._trigger("remove", { items: removedIds, oldData: removedItems }, senderId); return removedIds; } /** * Remove an item by its id or reference. * @param id - Id of an item or the item itself. * @returns The removed item if removed, null otherwise. */ _remove(id) { let ident; if (isId(id)) ident = id; else if (id && typeof id === "object") ident = id[this._idProp]; if (ident != null && this._data.has(ident)) { const item = this._data.get(ident) || null; this._data.delete(ident); --this.length; return item; } return null; } /** * Clear the entire data set. * * After the items are removed, the {@link DataSet} will trigger an event `remove` for all removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. * @param senderId - Sender id. * @returns removedIds - The ids of all removed items. */ clear(senderId) { var _context4; const ids = [..._keysInstanceProperty(_context4 = this._data).call(_context4)]; const items = []; for (let i = 0, len = ids.length; i < len; i++) items.push(this._data.get(ids[i])); this._data.clear(); this.length = 0; this._trigger("remove", { items: ids, oldData: items }, senderId); return ids; } /** * Find the item with maximum value of a specified field. * @param field - Name of the property that should be searched for max value. * @returns Item containing max value, or null if no items. */ max(field) { let max = null; let maxField = null; for (const item of _valuesInstanceProperty$1(_context5 = this._data).call(_context5)) { var _context5; const itemField = item[field]; if (typeof itemField === "number" && (maxField == null || itemField > maxField)) { max = item; maxField = itemField; } } return max || null; } /** * Find the item with minimum value of a specified field. * @param field - Name of the property that should be searched for min value. * @returns Item containing min value, or null if no items. */ min(field) { let min = null; let minField = null; for (const item of _valuesInstanceProperty$1(_context6 = this._data).call(_context6)) { var _context6; const itemField = item[field]; if (typeof itemField === "number" && (minField == null || itemField < minField)) { min = item; minField = itemField; } } return min || null; } /** * Find all distinct values of a specified field * @param prop - The property name whose distinct values should be returned. * @returns Unordered array containing all distinct values. Items without specified property are ignored. */ distinct(prop) { const data = this._data; const itemIds = [..._keysInstanceProperty(data).call(data)]; const values$8 = []; let count = 0; for (let i = 0, len = itemIds.length; i < len; i++) { const id = itemIds[i]; const item = data.get(id); const value = item[prop]; let exists = false; for (let j = 0; j < count; j++) if (values$8[j] == value) { exists = true; break; } if (!exists && value !== void 0) { values$8[count] = value; count++; } } return values$8; } /** * Add a single item. Will fail when an item with the same id already exists. * @param item - A new item to be added. * @returns Added item's id. An id is generated when it is not present in the item. */ _addItem(item) { const fullItem = ensureFullItem(item, this._idProp); const id = fullItem[this._idProp]; if (this._data.has(id)) throw new Error("Cannot add item: item with id " + id + " already exists"); this._data.set(id, fullItem); ++this.length; return id; } /** * Update a single item: merge with existing item. * Will fail when the item has no id, or when there does not exist an item with the same id. * @param update - The new item * @returns The id of the updated item. */ _updateItem(update) { const id = update[this._idProp]; if (id == null) throw new Error("Cannot update item: item has no id (item: " + _JSON$stringify$1(update) + ")"); const item = this._data.get(id); if (!item) throw new Error("Cannot update item: no item with id " + id + " found"); this._data.set(id, _objectSpread$4(_objectSpread$4({}, item), update)); return id; } /** @inheritDoc */ stream(ids) { if (ids) { const data = this._data; return new DataStream({ *[_Symbol$iterator$2]() { for (const id of ids) { const item = data.get(id); if (item != null) yield [id, item]; } } }); } else { var _context7; return new DataStream({ [_Symbol$iterator$2]: _bindInstanceProperty$1(_context7 = _entriesInstanceProperty(this._data)).call(_context7, this._data) }); } } get testLeakData() { return this._data; } get testLeakIdProp() { return this._idProp; } get testLeakOptions() { return this._options; } get testLeakQueue() { return this._queue; } set testLeakQueue(v) { this._queue = v; } }; var es_reflect_ownKeys = {}; var hasRequiredEs_reflect_ownKeys; function requireEs_reflect_ownKeys() { if (hasRequiredEs_reflect_ownKeys) return es_reflect_ownKeys; hasRequiredEs_reflect_ownKeys = 1; var $ = /* @__PURE__ */ require_export$1(); var ownKeys$6 = /* @__PURE__ */ requireOwnKeys$3(); $({ target: "Reflect", stat: true }, { ownKeys: ownKeys$6 }); return es_reflect_ownKeys; } var ownKeys$2$1; var hasRequiredOwnKeys$2; function requireOwnKeys$2() { if (hasRequiredOwnKeys$2) return ownKeys$2$1; hasRequiredOwnKeys$2 = 1; requireEs_reflect_ownKeys(); var path$2 = /* @__PURE__ */ requirePath$1(); ownKeys$2$1 = path$2.Reflect.ownKeys; return ownKeys$2$1; } var ownKeys$1$1; var hasRequiredOwnKeys$1; function requireOwnKeys$1() { if (hasRequiredOwnKeys$1) return ownKeys$1$1; hasRequiredOwnKeys$1 = 1; var parent = /* @__PURE__ */ requireOwnKeys$2(); ownKeys$1$1 = parent; return ownKeys$1$1; } var ownKeys$5; var hasRequiredOwnKeys$4; function requireOwnKeys$4() { if (hasRequiredOwnKeys$4) return ownKeys$5; hasRequiredOwnKeys$4 = 1; ownKeys$5 = /* @__PURE__ */ requireOwnKeys$1(); return ownKeys$5; } var ownKeysExports = requireOwnKeys$4(); /** * Check that given value is compatible with Vis Data Set interface. * @param idProp - The expected property to contain item id. * @param v - The value to be tested. * @returns True if all expected values and methods match, false otherwise. */ function isDataSetLike(idProp, v) { return typeof v === "object" && v !== null && idProp === v.idProp && typeof v.add === "function" && typeof v.clear === "function" && typeof v.distinct === "function" && typeof _forEachInstanceProperty$1(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof _mapInstanceProperty$1(v) === "function" && typeof v.max === "function" && typeof v.min === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.remove === "function" && typeof v.setOptions === "function" && typeof v.stream === "function" && typeof v.update === "function" && typeof v.updateOnly === "function"; } /** * Check that given value is compatible with Vis Data View interface. * @param idProp - The expected property to contain item id. * @param v - The value to be tested. * @returns True if all expected values and methods match, false otherwise. */ function isDataViewLike(idProp, v) { return typeof v === "object" && v !== null && idProp === v.idProp && typeof _forEachInstanceProperty$1(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof _mapInstanceProperty$1(v) === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.stream === "function" && isDataSetLike(idProp, v.getDataSet()); } console.warn("You're running a development build."); 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 es_object_assign = {}; var globalThis_1; var hasRequiredGlobalThis; function requireGlobalThis() { if (hasRequiredGlobalThis) return globalThis_1; hasRequiredGlobalThis = 1; var check = function(it$1) { return it$1 && it$1.Math === Math && it$1; }; globalThis_1 = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof commonjsGlobal == "object" && commonjsGlobal) || check(typeof globalThis_1 == "object" && globalThis_1) || function() { return this; }() || Function("return this")(); return globalThis_1; } var fails; var hasRequiredFails; function requireFails() { if (hasRequiredFails) return fails; hasRequiredFails = 1; fails = function(exec) { try { return !!exec(); } catch (error) { return true; } }; return fails; } var functionBindNative; var hasRequiredFunctionBindNative; function requireFunctionBindNative() { if (hasRequiredFunctionBindNative) return functionBindNative; hasRequiredFunctionBindNative = 1; var fails$2 = /* @__PURE__ */ requireFails(); functionBindNative = !fails$2(function() { var test = function() {}.bind(); return typeof test != "function" || test.hasOwnProperty("prototype"); }); return functionBindNative; } var functionApply; var hasRequiredFunctionApply; function requireFunctionApply() { if (hasRequiredFunctionApply) return functionApply; hasRequiredFunctionApply = 1; var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative(); var FunctionPrototype = Function.prototype; var apply = FunctionPrototype.apply; var call = FunctionPrototype.call; functionApply = typeof Reflect == "object" && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function() { return call.apply(apply, arguments); }); return functionApply; } var functionUncurryThis; var hasRequiredFunctionUncurryThis; function requireFunctionUncurryThis() { if (hasRequiredFunctionUncurryThis) return functionUncurryThis; hasRequiredFunctionUncurryThis = 1; var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative(); var FunctionPrototype = Function.prototype; var call = FunctionPrototype.call; var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); functionUncurryThis = NATIVE_BIND ? uncurryThisWithBind : function(fn) { return function() { return call.apply(fn, arguments); }; }; return functionUncurryThis; } var classofRaw; var hasRequiredClassofRaw; function requireClassofRaw() { if (hasRequiredClassofRaw) return classofRaw; hasRequiredClassofRaw = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var toString$2 = uncurryThis({}.toString); var stringSlice = uncurryThis("".slice); classofRaw = function(it$1) { return stringSlice(toString$2(it$1), 8, -1); }; return classofRaw; } var functionUncurryThisClause; var hasRequiredFunctionUncurryThisClause; function requireFunctionUncurryThisClause() { if (hasRequiredFunctionUncurryThisClause) return functionUncurryThisClause; hasRequiredFunctionUncurryThisClause = 1; var classofRaw$2 = /* @__PURE__ */ requireClassofRaw(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); functionUncurryThisClause = function(fn) { if (classofRaw$2(fn) === "Function") return uncurryThis(fn); }; return functionUncurryThisClause; } var isCallable; var hasRequiredIsCallable; function requireIsCallable() { if (hasRequiredIsCallable) return isCallable; hasRequiredIsCallable = 1; var documentAll = typeof document == "object" && document.all; isCallable = typeof documentAll == "undefined" && documentAll !== void 0 ? function(argument) { return typeof argument == "function" || argument === documentAll; } : function(argument) { return typeof argument == "function"; }; return isCallable; } var objectGetOwnPropertyDescriptor = {}; var descriptors; var hasRequiredDescriptors; function requireDescriptors() { if (hasRequiredDescriptors) return descriptors; hasRequiredDescriptors = 1; var fails$2 = /* @__PURE__ */ requireFails(); descriptors = !fails$2(function() { return Object.defineProperty({}, 1, { get: function() { return 7; } })[1] !== 7; }); return descriptors; } var functionCall; var hasRequiredFunctionCall; function requireFunctionCall() { if (hasRequiredFunctionCall) return functionCall; hasRequiredFunctionCall = 1; var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative(); var call = Function.prototype.call; functionCall = NATIVE_BIND ? call.bind(call) : function() { return call.apply(call, arguments); }; return functionCall; } var objectPropertyIsEnumerable = {}; var hasRequiredObjectPropertyIsEnumerable; function requireObjectPropertyIsEnumerable() { if (hasRequiredObjectPropertyIsEnumerable) return objectPropertyIsEnumerable; hasRequiredObjectPropertyIsEnumerable = 1; var $propertyIsEnumerable = {}.propertyIsEnumerable; var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor; var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1: 2 }, 1); objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$4(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable; return objectPropertyIsEnumerable; } var createPropertyDescriptor; var hasRequiredCreatePropertyDescriptor; function requireCreatePropertyDescriptor() { if (hasRequiredCreatePropertyDescriptor) return createPropertyDescriptor; hasRequiredCreatePropertyDescriptor = 1; createPropertyDescriptor = function(bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value }; }; return createPropertyDescriptor; } var indexedObject; var hasRequiredIndexedObject; function requireIndexedObject() { if (hasRequiredIndexedObject) return indexedObject; hasRequiredIndexedObject = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var fails$2 = /* @__PURE__ */ requireFails(); var classof$2 = /* @__PURE__ */ requireClassofRaw(); var $Object = Object; var split = uncurryThis("".split); indexedObject = fails$2(function() { return !$Object("z").propertyIsEnumerable(0); }) ? function(it$1) { return classof$2(it$1) === "String" ? split(it$1, "") : $Object(it$1); } : $Object; return indexedObject; } var isNullOrUndefined; var hasRequiredIsNullOrUndefined; function requireIsNullOrUndefined() { if (hasRequiredIsNullOrUndefined) return isNullOrUndefined; hasRequiredIsNullOrUndefined = 1; isNullOrUndefined = function(it$1) { return it$1 === null || it$1 === void 0; }; return isNullOrUndefined; } var requireObjectCoercible; var hasRequiredRequireObjectCoercible; function requireRequireObjectCoercible() { if (hasRequiredRequireObjectCoercible) return requireObjectCoercible; hasRequiredRequireObjectCoercible = 1; var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined(); var $TypeError = TypeError; requireObjectCoercible = function(it$1) { if (isNullOrUndefined$2(it$1)) throw new $TypeError("Can't call method on " + it$1); return it$1; }; return requireObjectCoercible; } var toIndexedObject; var hasRequiredToIndexedObject; function requireToIndexedObject() { if (hasRequiredToIndexedObject) return toIndexedObject; hasRequiredToIndexedObject = 1; var IndexedObject = /* @__PURE__ */ requireIndexedObject(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); toIndexedObject = function(it$1) { return IndexedObject(requireObjectCoercible$2(it$1)); }; return toIndexedObject; } var isObject$1; var hasRequiredIsObject; function requireIsObject() { if (hasRequiredIsObject) return isObject$1; hasRequiredIsObject = 1; var isCallable$2 = /* @__PURE__ */ requireIsCallable(); isObject$1 = function(it$1) { return typeof it$1 == "object" ? it$1 !== null : isCallable$2(it$1); }; return isObject$1; } var path; var hasRequiredPath; function requirePath() { if (hasRequiredPath) return path; hasRequiredPath = 1; path = {}; return path; } var getBuiltIn; var hasRequiredGetBuiltIn; function requireGetBuiltIn() { if (hasRequiredGetBuiltIn) return getBuiltIn; hasRequiredGetBuiltIn = 1; var path$2 = /* @__PURE__ */ requirePath(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var aFunction = function(variable) { return isCallable$2(variable) ? variable : void 0; }; getBuiltIn = function(namespace, method) { return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(globalThis$1[namespace]) : path$2[namespace] && path$2[namespace][method] || globalThis$1[namespace] && globalThis$1[namespace][method]; }; return getBuiltIn; } var objectIsPrototypeOf; var hasRequiredObjectIsPrototypeOf; function requireObjectIsPrototypeOf() { if (hasRequiredObjectIsPrototypeOf) return objectIsPrototypeOf; hasRequiredObjectIsPrototypeOf = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); objectIsPrototypeOf = uncurryThis({}.isPrototypeOf); return objectIsPrototypeOf; } var environmentUserAgent; var hasRequiredEnvironmentUserAgent; function requireEnvironmentUserAgent() { if (hasRequiredEnvironmentUserAgent) return environmentUserAgent; hasRequiredEnvironmentUserAgent = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var navigator$1 = globalThis$1.navigator; var userAgent = navigator$1 && navigator$1.userAgent; environmentUserAgent = userAgent ? String(userAgent) : ""; return environmentUserAgent; } var environmentV8Version; var hasRequiredEnvironmentV8Version; function requireEnvironmentV8Version() { if (hasRequiredEnvironmentV8Version) return environmentV8Version; hasRequiredEnvironmentV8Version = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var userAgent = /* @__PURE__ */ requireEnvironmentUserAgent(); var process = globalThis$1.process; var Deno$1 = globalThis$1.Deno; var versions = process && process.versions || Deno$1 && Deno$1.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split("."); version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } environmentV8Version = version; return environmentV8Version; } var symbolConstructorDetection; var hasRequiredSymbolConstructorDetection; function requireSymbolConstructorDetection() { if (hasRequiredSymbolConstructorDetection) return symbolConstructorDetection; hasRequiredSymbolConstructorDetection = 1; var V8_VERSION = /* @__PURE__ */ requireEnvironmentV8Version(); var fails$2 = /* @__PURE__ */ requireFails(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var $String = globalThis$1.String; symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$2(function() { var symbol$6 = Symbol("symbol detection"); return !$String(symbol$6) || !(Object(symbol$6) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); return symbolConstructorDetection; } var useSymbolAsUid; var hasRequiredUseSymbolAsUid; function requireUseSymbolAsUid() { if (hasRequiredUseSymbolAsUid) return useSymbolAsUid; hasRequiredUseSymbolAsUid = 1; var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection(); useSymbolAsUid = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol"; return useSymbolAsUid; } var isSymbol; var hasRequiredIsSymbol; function requireIsSymbol() { if (hasRequiredIsSymbol) return isSymbol; hasRequiredIsSymbol = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var USE_SYMBOL_AS_UID = /* @__PURE__ */ requireUseSymbolAsUid(); var $Object = Object; isSymbol = USE_SYMBOL_AS_UID ? function(it$1) { return typeof it$1 == "symbol"; } : function(it$1) { var $Symbol = getBuiltIn$2("Symbol"); return isCallable$2($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it$1)); }; return isSymbol; } var tryToString; var hasRequiredTryToString; function requireTryToString() { if (hasRequiredTryToString) return tryToString; hasRequiredTryToString = 1; var $String = String; tryToString = function(argument) { try { return $String(argument); } catch (error) { return "Object"; } }; return tryToString; } var aCallable; var hasRequiredACallable; function requireACallable() { if (hasRequiredACallable) return aCallable; hasRequiredACallable = 1; var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var tryToString$2 = /* @__PURE__ */ requireTryToString(); var $TypeError = TypeError; aCallable = function(argument) { if (isCallable$2(argument)) return argument; throw new $TypeError(tryToString$2(argument) + " is not a function"); }; return aCallable; } var getMethod; var hasRequiredGetMethod; function requireGetMethod() { if (hasRequiredGetMethod) return getMethod; hasRequiredGetMethod = 1; var aCallable$2 = /* @__PURE__ */ requireACallable(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined(); getMethod = function(V, P) { var func = V[P]; return isNullOrUndefined$2(func) ? void 0 : aCallable$2(func); }; return getMethod; } var ordinaryToPrimitive; var hasRequiredOrdinaryToPrimitive; function requireOrdinaryToPrimitive() { if (hasRequiredOrdinaryToPrimitive) return ordinaryToPrimitive; hasRequiredOrdinaryToPrimitive = 1; var call = /* @__PURE__ */ requireFunctionCall(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var $TypeError = TypeError; ordinaryToPrimitive = function(input, pref) { var fn, val; if (pref === "string" && isCallable$2(fn = input.toString) && !isObject$3(val = call(fn, input))) return val; if (isCallable$2(fn = input.valueOf) && !isObject$3(val = call(fn, input))) return val; if (pref !== "string" && isCallable$2(fn = input.toString) && !isObject$3(val = call(fn, input))) return val; throw new $TypeError("Can't convert object to primitive value"); }; return ordinaryToPrimitive; } var sharedStore = { exports: {} }; var isPure; var hasRequiredIsPure; function requireIsPure() { if (hasRequiredIsPure) return isPure; hasRequiredIsPure = 1; isPure = true; return isPure; } var defineGlobalProperty; var hasRequiredDefineGlobalProperty; function requireDefineGlobalProperty() { if (hasRequiredDefineGlobalProperty) return defineGlobalProperty; hasRequiredDefineGlobalProperty = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var defineProperty$7 = Object.defineProperty; defineGlobalProperty = function(key, value) { try { defineProperty$7(globalThis$1, key, { value, configurable: true, writable: true }); } catch (error) { globalThis$1[key] = value; } return value; }; return defineGlobalProperty; } var hasRequiredSharedStore; function requireSharedStore() { if (hasRequiredSharedStore) return sharedStore.exports; hasRequiredSharedStore = 1; var IS_PURE = /* @__PURE__ */ requireIsPure(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var defineGlobalProperty$2 = /* @__PURE__ */ requireDefineGlobalProperty(); var SHARED = "__core-js_shared__"; var store = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {}); (store.versions || (store.versions = [])).push({ version: "3.44.0", mode: IS_PURE ? "pure" : "global", copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)", license: "https://github.com/zloirock/core-js/blob/v3.44.0/LICENSE", source: "https://github.com/zloirock/core-js" }); return sharedStore.exports; } var shared; var hasRequiredShared; function requireShared() { if (hasRequiredShared) return shared; hasRequiredShared = 1; var store = /* @__PURE__ */ requireSharedStore(); shared = function(key, value) { return store[key] || (store[key] = value || {}); }; return shared; } var toObject; var hasRequiredToObject; function requireToObject() { if (hasRequiredToObject) return toObject; hasRequiredToObject = 1; var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); var $Object = Object; toObject = function(argument) { return $Object(requireObjectCoercible$2(argument)); }; return toObject; } var hasOwnProperty_1; var hasRequiredHasOwnProperty; function requireHasOwnProperty() { if (hasRequiredHasOwnProperty) return hasOwnProperty_1; hasRequiredHasOwnProperty = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var toObject$2 = /* @__PURE__ */ requireToObject(); var hasOwnProperty = uncurryThis({}.hasOwnProperty); hasOwnProperty_1 = Object.hasOwn || function hasOwn(it$1, key) { return hasOwnProperty(toObject$2(it$1), key); }; return hasOwnProperty_1; } var uid; var hasRequiredUid; function requireUid() { if (hasRequiredUid) return uid; hasRequiredUid = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var id = 0; var postfix = Math.random(); var toString$2 = uncurryThis(1.1.toString); uid = function(key) { return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString$2(++id + postfix, 36); }; return uid; } var wellKnownSymbol; var hasRequiredWellKnownSymbol; function requireWellKnownSymbol() { if (hasRequiredWellKnownSymbol) return wellKnownSymbol; hasRequiredWellKnownSymbol = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var shared$2 = /* @__PURE__ */ requireShared(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var uid$2 = /* @__PURE__ */ requireUid(); var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection(); var USE_SYMBOL_AS_UID = /* @__PURE__ */ requireUseSymbolAsUid(); var Symbol$1 = globalThis$1.Symbol; var WellKnownSymbolsStore = shared$2("wks"); var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1["for"] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$2; wellKnownSymbol = function(name) { if (!hasOwn(WellKnownSymbolsStore, name)) WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name); return WellKnownSymbolsStore[name]; }; return wellKnownSymbol; } var toPrimitive$6; var hasRequiredToPrimitive$5; function requireToPrimitive$5() { if (hasRequiredToPrimitive$5) return toPrimitive$6; hasRequiredToPrimitive$5 = 1; var call = /* @__PURE__ */ requireFunctionCall(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol(); var getMethod$2 = /* @__PURE__ */ requireGetMethod(); var ordinaryToPrimitive$2 = /* @__PURE__ */ requireOrdinaryToPrimitive(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var $TypeError = TypeError; var TO_PRIMITIVE = wellKnownSymbol$2("toPrimitive"); toPrimitive$6 = function(input, pref) { if (!isObject$3(input) || isSymbol$2(input)) return input; var exoticToPrim = getMethod$2(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === void 0) pref = "default"; result = call(exoticToPrim, input, pref); if (!isObject$3(result) || isSymbol$2(result)) return result; throw new $TypeError("Can't convert object to primitive value"); } if (pref === void 0) pref = "number"; return ordinaryToPrimitive$2(input, pref); }; return toPrimitive$6; } var toPropertyKey$1; var hasRequiredToPropertyKey; function requireToPropertyKey() { if (hasRequiredToPropertyKey) return toPropertyKey$1; hasRequiredToPropertyKey = 1; var toPrimitive$8 = /* @__PURE__ */ requireToPrimitive$5(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol(); toPropertyKey$1 = function(argument) { var key = toPrimitive$8(argument, "string"); return isSymbol$2(key) ? key : key + ""; }; return toPropertyKey$1; } var documentCreateElement; var hasRequiredDocumentCreateElement; function requireDocumentCreateElement() { if (hasRequiredDocumentCreateElement) return documentCreateElement; hasRequiredDocumentCreateElement = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var document$1 = globalThis$1.document; var EXISTS = isObject$3(document$1) && isObject$3(document$1.createElement); documentCreateElement = function(it$1) { return EXISTS ? document$1.createElement(it$1) : {}; }; return documentCreateElement; } var ie8DomDefine; var hasRequiredIe8DomDefine; function requireIe8DomDefine() { if (hasRequiredIe8DomDefine) return ie8DomDefine; hasRequiredIe8DomDefine = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var fails$2 = /* @__PURE__ */ requireFails(); var createElement = /* @__PURE__ */ requireDocumentCreateElement(); ie8DomDefine = !DESCRIPTORS && !fails$2(function() { return Object.defineProperty(createElement("div"), "a", { get: function() { return 7; } }).a !== 7; }); return ie8DomDefine; } var hasRequiredObjectGetOwnPropertyDescriptor; function requireObjectGetOwnPropertyDescriptor() { if (hasRequiredObjectGetOwnPropertyDescriptor) return objectGetOwnPropertyDescriptor; hasRequiredObjectGetOwnPropertyDescriptor = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var call = /* @__PURE__ */ requireFunctionCall(); var propertyIsEnumerableModule = /* @__PURE__ */ requireObjectPropertyIsEnumerable(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var toPropertyKey$3 = /* @__PURE__ */ requireToPropertyKey(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var IE8_DOM_DEFINE = /* @__PURE__ */ requireIe8DomDefine(); var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; objectGetOwnPropertyDescriptor.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor$4(O, P) { O = toIndexedObject$2(O); P = toPropertyKey$3(P); if (IE8_DOM_DEFINE) try { return $getOwnPropertyDescriptor(O, P); } catch (error) {} if (hasOwn(O, P)) return createPropertyDescriptor$2(!call(propertyIsEnumerableModule.f, O, P), O[P]); }; return objectGetOwnPropertyDescriptor; } var isForced_1; var hasRequiredIsForced; function requireIsForced() { if (hasRequiredIsForced) return isForced_1; hasRequiredIsForced = 1; var fails$2 = /* @__PURE__ */ requireFails(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var replacement = /#|\.prototype\./; var isForced = function(feature, detection) { var value = data[normalize(feature)]; return value === POLYFILL ? true : value === NATIVE ? false : isCallable$2(detection) ? fails$2(detection) : !!detection; }; var normalize = isForced.normalize = function(string$1) { return String(string$1).replace(replacement, ".").toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = "N"; var POLYFILL = isForced.POLYFILL = "P"; isForced_1 = isForced; return isForced_1; } var functionBindContext; var hasRequiredFunctionBindContext; function requireFunctionBindContext() { if (hasRequiredFunctionBindContext) return functionBindContext; hasRequiredFunctionBindContext = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThisClause(); var aCallable$2 = /* @__PURE__ */ requireACallable(); var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative(); var bind$5 = uncurryThis(uncurryThis.bind); functionBindContext = function(fn, that) { aCallable$2(fn); return that === void 0 ? fn : NATIVE_BIND ? bind$5(fn, that) : function() { return fn.apply(that, arguments); }; }; return functionBindContext; } var objectDefineProperty = {}; var v8PrototypeDefineBug; var hasRequiredV8PrototypeDefineBug; function requireV8PrototypeDefineBug() { if (hasRequiredV8PrototypeDefineBug) return v8PrototypeDefineBug; hasRequiredV8PrototypeDefineBug = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var fails$2 = /* @__PURE__ */ requireFails(); v8PrototypeDefineBug = DESCRIPTORS && fails$2(function() { return Object.defineProperty(function() {}, "prototype", { value: 42, writable: false }).prototype !== 42; }); return v8PrototypeDefineBug; } var anObject; var hasRequiredAnObject; function requireAnObject() { if (hasRequiredAnObject) return anObject; hasRequiredAnObject = 1; var isObject$3 = /* @__PURE__ */ requireIsObject(); var $String = String; var $TypeError = TypeError; anObject = function(argument) { if (isObject$3(argument)) return argument; throw new $TypeError($String(argument) + " is not an object"); }; return anObject; } var hasRequiredObjectDefineProperty; function requireObjectDefineProperty() { if (hasRequiredObjectDefineProperty) return objectDefineProperty; hasRequiredObjectDefineProperty = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var IE8_DOM_DEFINE = /* @__PURE__ */ requireIe8DomDefine(); var V8_PROTOTYPE_DEFINE_BUG = /* @__PURE__ */ requireV8PrototypeDefineBug(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var toPropertyKey$3 = /* @__PURE__ */ requireToPropertyKey(); var $TypeError = TypeError; var $defineProperty = Object.defineProperty; var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var ENUMERABLE = "enumerable"; var CONFIGURABLE = "configurable"; var WRITABLE = "writable"; objectDefineProperty.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty$7(O, P, Attributes) { anObject$2(O); P = toPropertyKey$3(P); anObject$2(Attributes); if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { var current = $getOwnPropertyDescriptor(O, P); if (current && current[WRITABLE]) { O[P] = Attributes.value; Attributes = { configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], writable: false }; } } return $defineProperty(O, P, Attributes); } : $defineProperty : function defineProperty$7(O, P, Attributes) { anObject$2(O); P = toPropertyKey$3(P); anObject$2(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty(O, P, Attributes); } catch (error) {} if ("get" in Attributes || "set" in Attributes) throw new $TypeError("Accessors not supported"); if ("value" in Attributes) O[P] = Attributes.value; return O; }; return objectDefineProperty; } var createNonEnumerableProperty; var hasRequiredCreateNonEnumerableProperty; function requireCreateNonEnumerableProperty() { if (hasRequiredCreateNonEnumerableProperty) return createNonEnumerableProperty; hasRequiredCreateNonEnumerableProperty = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var definePropertyModule = /* @__PURE__ */ requireObjectDefineProperty(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor(); createNonEnumerableProperty = DESCRIPTORS ? function(object$1, key, value) { return definePropertyModule.f(object$1, key, createPropertyDescriptor$2(1, value)); } : function(object$1, key, value) { object$1[key] = value; return object$1; }; return createNonEnumerableProperty; } var _export; var hasRequired_export; function require_export() { if (hasRequired_export) return _export; hasRequired_export = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var apply = /* @__PURE__ */ requireFunctionApply(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThisClause(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var getOwnPropertyDescriptor$4 = requireObjectGetOwnPropertyDescriptor().f; var isForced = /* @__PURE__ */ requireIsForced(); var path$2 = /* @__PURE__ */ requirePath(); var bind$5 = /* @__PURE__ */ requireFunctionBindContext(); var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var wrapConstructor = function(NativeConstructor) { var Wrapper = function(a, b, c$1) { if (this instanceof Wrapper) { switch (arguments.length) { case 0: return new NativeConstructor(); case 1: return new NativeConstructor(a); case 2: return new NativeConstructor(a, b); } return new NativeConstructor(a, b, c$1); } return apply(NativeConstructor, this, arguments); }; Wrapper.prototype = NativeConstructor.prototype; return Wrapper; }; _export = function(options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var PROTO = options.proto; var nativeSource = GLOBAL ? globalThis$1 : STATIC ? globalThis$1[TARGET] : globalThis$1[TARGET] && globalThis$1[TARGET].prototype; var target = GLOBAL ? path$2 : path$2[TARGET] || createNonEnumerableProperty$2(path$2, TARGET, {})[TARGET]; var targetPrototype = target.prototype; var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE; var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor; for (key in source) { FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced); USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key); targetProperty = target[key]; if (USE_NATIVE) if (options.dontCallGetSet) { descriptor = getOwnPropertyDescriptor$4(nativeSource, key); nativeProperty = descriptor && descriptor.value; } else nativeProperty = nativeSource[key]; sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key]; if (!FORCED && !PROTO && typeof targetProperty == typeof sourceProperty) continue; if (options.bind && USE_NATIVE) resultProperty = bind$5(sourceProperty, globalThis$1); else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); else if (PROTO && isCallable$2(sourceProperty)) resultProperty = uncurryThis(sourceProperty); else resultProperty = sourceProperty; if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) createNonEnumerableProperty$2(resultProperty, "sham", true); createNonEnumerableProperty$2(target, key, resultProperty); if (PROTO) { VIRTUAL_PROTOTYPE = TARGET + "Prototype"; if (!hasOwn(path$2, VIRTUAL_PROTOTYPE)) createNonEnumerableProperty$2(path$2, VIRTUAL_PROTOTYPE, {}); createNonEnumerableProperty$2(path$2[VIRTUAL_PROTOTYPE], key, sourceProperty); if (options.real && targetPrototype && (FORCED || !targetPrototype[key])) createNonEnumerableProperty$2(targetPrototype, key, sourceProperty); } } }; return _export; } var mathTrunc; var hasRequiredMathTrunc; function requireMathTrunc() { if (hasRequiredMathTrunc) return mathTrunc; hasRequiredMathTrunc = 1; var ceil = Math.ceil; var floor = Math.floor; mathTrunc = Math.trunc || function trunc(x) { var n = +x; return (n > 0 ? floor : ceil)(n); }; return mathTrunc; } var toIntegerOrInfinity; var hasRequiredToIntegerOrInfinity; function requireToIntegerOrInfinity() { if (hasRequiredToIntegerOrInfinity) return toIntegerOrInfinity; hasRequiredToIntegerOrInfinity = 1; var trunc = /* @__PURE__ */ requireMathTrunc(); toIntegerOrInfinity = function(argument) { var number$1 = +argument; return number$1 !== number$1 || number$1 === 0 ? 0 : trunc(number$1); }; return toIntegerOrInfinity; } var toAbsoluteIndex; var hasRequiredToAbsoluteIndex; function requireToAbsoluteIndex() { if (hasRequiredToAbsoluteIndex) return toAbsoluteIndex; hasRequiredToAbsoluteIndex = 1; var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity(); var max = Math.max; var min = Math.min; toAbsoluteIndex = function(index$1, length$1) { var integer = toIntegerOrInfinity$2(index$1); return integer < 0 ? max(integer + length$1, 0) : min(integer, length$1); }; return toAbsoluteIndex; } var toLength; var hasRequiredToLength; function requireToLength() { if (hasRequiredToLength) return toLength; hasRequiredToLength = 1; var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity(); var min = Math.min; toLength = function(argument) { var len = toIntegerOrInfinity$2(argument); return len > 0 ? min(len, 9007199254740991) : 0; }; return toLength; } var lengthOfArrayLike; var hasRequiredLengthOfArrayLike; function requireLengthOfArrayLike() { if (hasRequiredLengthOfArrayLike) return lengthOfArrayLike; hasRequiredLengthOfArrayLike = 1; var toLength$2 = /* @__PURE__ */ requireToLength(); lengthOfArrayLike = function(obj) { return toLength$2(obj.length); }; return lengthOfArrayLike; } var arrayIncludes; var hasRequiredArrayIncludes; function requireArrayIncludes() { if (hasRequiredArrayIncludes) return arrayIncludes; hasRequiredArrayIncludes = 1; var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var toAbsoluteIndex$2 = /* @__PURE__ */ requireToAbsoluteIndex(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); var createMethod = function(IS_INCLUDES) { return function($this, el, fromIndex) { var O = toIndexedObject$2($this); var length$1 = lengthOfArrayLike$2(O); if (length$1 === 0) return !IS_INCLUDES && -1; var index$1 = toAbsoluteIndex$2(fromIndex, length$1); var value; if (IS_INCLUDES && el !== el) while (length$1 > index$1) { value = O[index$1++]; if (value !== value) return true; } else for (; length$1 > index$1; index$1++) if ((IS_INCLUDES || index$1 in O) && O[index$1] === el) return IS_INCLUDES || index$1 || 0; return !IS_INCLUDES && -1; }; }; arrayIncludes = { includes: createMethod(true), indexOf: createMethod(false) }; return arrayIncludes; } var hiddenKeys; var hasRequiredHiddenKeys; function requireHiddenKeys() { if (hasRequiredHiddenKeys) return hiddenKeys; hasRequiredHiddenKeys = 1; hiddenKeys = {}; return hiddenKeys; } var objectKeysInternal; var hasRequiredObjectKeysInternal; function requireObjectKeysInternal() { if (hasRequiredObjectKeysInternal) return objectKeysInternal; hasRequiredObjectKeysInternal = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var indexOf$4 = requireArrayIncludes().indexOf; var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys(); var push = uncurryThis([].push); objectKeysInternal = function(object$1, names) { var O = toIndexedObject$2(object$1); var i = 0; var result = []; var key; for (key in O) !hasOwn(hiddenKeys$2, key) && hasOwn(O, key) && push(result, key); while (names.length > i) if (hasOwn(O, key = names[i++])) ~indexOf$4(result, key) || push(result, key); return result; }; return objectKeysInternal; } var enumBugKeys; var hasRequiredEnumBugKeys; function requireEnumBugKeys() { if (hasRequiredEnumBugKeys) return enumBugKeys; hasRequiredEnumBugKeys = 1; enumBugKeys = [ "constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf" ]; return enumBugKeys; } var objectKeys; var hasRequiredObjectKeys; function requireObjectKeys() { if (hasRequiredObjectKeys) return objectKeys; hasRequiredObjectKeys = 1; var internalObjectKeys = /* @__PURE__ */ requireObjectKeysInternal(); var enumBugKeys$2 = /* @__PURE__ */ requireEnumBugKeys(); objectKeys = Object.keys || function keys$8(O) { return internalObjectKeys(O, enumBugKeys$2); }; return objectKeys; } var objectGetOwnPropertySymbols = {}; var hasRequiredObjectGetOwnPropertySymbols; function requireObjectGetOwnPropertySymbols() { if (hasRequiredObjectGetOwnPropertySymbols) return objectGetOwnPropertySymbols; hasRequiredObjectGetOwnPropertySymbols = 1; objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols; return objectGetOwnPropertySymbols; } var objectAssign; var hasRequiredObjectAssign; function requireObjectAssign() { if (hasRequiredObjectAssign) return objectAssign; hasRequiredObjectAssign = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var call = /* @__PURE__ */ requireFunctionCall(); var fails$2 = /* @__PURE__ */ requireFails(); var objectKeys$2 = /* @__PURE__ */ requireObjectKeys(); var getOwnPropertySymbolsModule = /* @__PURE__ */ requireObjectGetOwnPropertySymbols(); var propertyIsEnumerableModule = /* @__PURE__ */ requireObjectPropertyIsEnumerable(); var toObject$2 = /* @__PURE__ */ requireToObject(); var IndexedObject = /* @__PURE__ */ requireIndexedObject(); var $assign = Object.assign; var defineProperty$7 = Object.defineProperty; var concat$5 = uncurryThis([].concat); objectAssign = !$assign || fails$2(function() { if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty$7({}, "a", { enumerable: true, get: function() { defineProperty$7(this, "b", { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return true; var A = {}; var B = {}; var symbol$6 = Symbol("assign detection"); var alphabet = "abcdefghijklmnopqrst"; A[symbol$6] = 7; alphabet.split("").forEach(function(chr) { B[chr] = chr; }); return $assign({}, A)[symbol$6] !== 7 || objectKeys$2($assign({}, B)).join("") !== alphabet; }) ? function assign$6(target, source) { var T = toObject$2(target); var argumentsLength = arguments.length; var index$1 = 1; var getOwnPropertySymbols$4 = getOwnPropertySymbolsModule.f; var propertyIsEnumerable = propertyIsEnumerableModule.f; while (argumentsLength > index$1) { var S = IndexedObject(arguments[index$1++]); var keys$8 = getOwnPropertySymbols$4 ? concat$5(objectKeys$2(S), getOwnPropertySymbols$4(S)) : objectKeys$2(S); var length$1 = keys$8.length; var j = 0; var key; while (length$1 > j) { key = keys$8[j++]; if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key]; } } return T; } : $assign; return objectAssign; } var hasRequiredEs_object_assign; function requireEs_object_assign() { if (hasRequiredEs_object_assign) return es_object_assign; hasRequiredEs_object_assign = 1; var $ = /* @__PURE__ */ require_export(); var assign$6 = /* @__PURE__ */ requireObjectAssign(); $({ target: "Object", stat: true, arity: 2, forced: Object.assign !== assign$6 }, { assign: assign$6 }); return es_object_assign; } var assign$4; var hasRequiredAssign$2; function requireAssign$2() { if (hasRequiredAssign$2) return assign$4; hasRequiredAssign$2 = 1; requireEs_object_assign(); var path$2 = /* @__PURE__ */ requirePath(); assign$4 = path$2.Object.assign; return assign$4; } var assign$3; var hasRequiredAssign$1; function requireAssign$1() { if (hasRequiredAssign$1) return assign$3; hasRequiredAssign$1 = 1; var parent = /* @__PURE__ */ requireAssign$2(); assign$3 = parent; return assign$3; } var assign$2; var hasRequiredAssign; function requireAssign() { if (hasRequiredAssign) return assign$2; hasRequiredAssign = 1; assign$2 = /* @__PURE__ */ requireAssign$1(); return assign$2; } var assignExports = requireAssign(); var _Object$assign = /* @__PURE__ */ getDefaultExportFromCjs(assignExports); var es_function_bind = {}; var arraySlice; var hasRequiredArraySlice; function requireArraySlice() { if (hasRequiredArraySlice) return arraySlice; hasRequiredArraySlice = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); arraySlice = uncurryThis([].slice); return arraySlice; } var functionBind; var hasRequiredFunctionBind; function requireFunctionBind() { if (hasRequiredFunctionBind) return functionBind; hasRequiredFunctionBind = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var aCallable$2 = /* @__PURE__ */ requireACallable(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var arraySlice$2 = /* @__PURE__ */ requireArraySlice(); var NATIVE_BIND = /* @__PURE__ */ requireFunctionBindNative(); var $Function = Function; var concat$5 = uncurryThis([].concat); var join = uncurryThis([].join); var factories = {}; var construct = function(C, argsLength, args) { if (!hasOwn(factories, argsLength)) { var list = []; var i = 0; for (; i < argsLength; i++) list[i] = "a[" + i + "]"; factories[argsLength] = $Function("C,a", "return new C(" + join(list, ",") + ")"); } return factories[argsLength](C, args); }; functionBind = NATIVE_BIND ? $Function.bind : function bind$5(that) { var F = aCallable$2(this); var Prototype = F.prototype; var partArgs = arraySlice$2(arguments, 1); var boundFunction = function bound() { var args = concat$5(partArgs, arraySlice$2(arguments)); return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args); }; if (isObject$3(Prototype)) boundFunction.prototype = Prototype; return boundFunction; }; return functionBind; } var hasRequiredEs_function_bind; function requireEs_function_bind() { if (hasRequiredEs_function_bind) return es_function_bind; hasRequiredEs_function_bind = 1; var $ = /* @__PURE__ */ require_export(); var bind$5 = /* @__PURE__ */ requireFunctionBind(); $({ target: "Function", proto: true, forced: Function.bind !== bind$5 }, { bind: bind$5 }); return es_function_bind; } var getBuiltInPrototypeMethod; var hasRequiredGetBuiltInPrototypeMethod; function requireGetBuiltInPrototypeMethod() { if (hasRequiredGetBuiltInPrototypeMethod) return getBuiltInPrototypeMethod; hasRequiredGetBuiltInPrototypeMethod = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var path$2 = /* @__PURE__ */ requirePath(); getBuiltInPrototypeMethod = function(CONSTRUCTOR, METHOD) { var Namespace = path$2[CONSTRUCTOR + "Prototype"]; var pureMethod = Namespace && Namespace[METHOD]; if (pureMethod) return pureMethod; var NativeConstructor = globalThis$1[CONSTRUCTOR]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; return NativePrototype && NativePrototype[METHOD]; }; return getBuiltInPrototypeMethod; } var bind$3; var hasRequiredBind$3; function requireBind$3() { if (hasRequiredBind$3) return bind$3; hasRequiredBind$3 = 1; requireEs_function_bind(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); bind$3 = getBuiltInPrototypeMethod$2("Function", "bind"); return bind$3; } var bind$2; var hasRequiredBind$2; function requireBind$2() { if (hasRequiredBind$2) return bind$2; hasRequiredBind$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireBind$3(); var FunctionPrototype = Function.prototype; bind$2 = function(it$1) { var own = it$1.bind; return it$1 === FunctionPrototype || isPrototypeOf(FunctionPrototype, it$1) && own === FunctionPrototype.bind ? method : own; }; return bind$2; } var bind$1; var hasRequiredBind$1; function requireBind$1() { if (hasRequiredBind$1) return bind$1; hasRequiredBind$1 = 1; var parent = /* @__PURE__ */ requireBind$2(); bind$1 = parent; return bind$1; } var bind; var hasRequiredBind; function requireBind() { if (hasRequiredBind) return bind; hasRequiredBind = 1; bind = /* @__PURE__ */ requireBind$1(); return bind; } var bindExports = requireBind(); var _bindInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(bindExports); /** * Draw a circle. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param r - The radius of the circle. */ function drawCircle(ctx, x, y, r) { ctx.beginPath(); ctx.arc(x, y, r, 0, 2 * Math.PI, false); ctx.closePath(); } /** * Draw a square. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param r - Half of the width and height of the square. */ function drawSquare(ctx, x, y, r) { ctx.beginPath(); ctx.rect(x - r, y - r, r * 2, r * 2); ctx.closePath(); } /** * Draw an equilateral triangle standing on a side. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param r - Half of the length of the sides. * @remarks * http://en.wikipedia.org/wiki/Equilateral_triangle */ function drawTriangle(ctx, x, y, r) { ctx.beginPath(); r *= 1.15; y += .275 * r; const s = r * 2; const s2 = s / 2; const ir = Math.sqrt(3) / 6 * s; const h = Math.sqrt(s * s - s2 * s2); ctx.moveTo(x, y - (h - ir)); ctx.lineTo(x + s2, y + ir); ctx.lineTo(x - s2, y + ir); ctx.lineTo(x, y - (h - ir)); ctx.closePath(); } /** * Draw an equilateral triangle standing on a vertex. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param r - Half of the length of the sides. * @remarks * http://en.wikipedia.org/wiki/Equilateral_triangle */ function drawTriangleDown(ctx, x, y, r) { ctx.beginPath(); r *= 1.15; y -= .275 * r; const s = r * 2; const s2 = s / 2; const ir = Math.sqrt(3) / 6 * s; const h = Math.sqrt(s * s - s2 * s2); ctx.moveTo(x, y + (h - ir)); ctx.lineTo(x + s2, y - ir); ctx.lineTo(x - s2, y - ir); ctx.lineTo(x, y + (h - ir)); ctx.closePath(); } /** * Draw a star. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param r - The outer radius of the star. */ function drawStar(ctx, x, y, r) { ctx.beginPath(); r *= .82; y += .1 * r; for (let n = 0; n < 10; n++) { const radius = n % 2 === 0 ? r * 1.3 : r * .5; ctx.lineTo(x + radius * Math.sin(n * 2 * Math.PI / 10), y - radius * Math.cos(n * 2 * Math.PI / 10)); } ctx.closePath(); } /** * Draw a diamond. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param r - Half of the width and height of the diamond. * @remarks * http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/ */ function drawDiamond(ctx, x, y, r) { ctx.beginPath(); ctx.lineTo(x, y + r); ctx.lineTo(x + r, y); ctx.lineTo(x, y - r); ctx.lineTo(x - r, y); ctx.closePath(); } /** * Draw a rectangle with rounded corners. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param w - The width of the rectangle. * @param h - The height of the rectangle. * @param r - The radius of the corners. * @remarks * http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas */ function drawRoundRect(ctx, x, y, w, h, r) { const r2d = Math.PI / 180; if (w - 2 * r < 0) r = w / 2; if (h - 2 * r < 0) r = h / 2; ctx.beginPath(); ctx.moveTo(x + r, y); ctx.lineTo(x + w - r, y); ctx.arc(x + w - r, y + r, r, r2d * 270, r2d * 360, false); ctx.lineTo(x + w, y + h - r); ctx.arc(x + w - r, y + h - r, r, 0, r2d * 90, false); ctx.lineTo(x + r, y + h); ctx.arc(x + r, y + h - r, r, r2d * 90, r2d * 180, false); ctx.lineTo(x, y + r); ctx.arc(x + r, y + r, r, r2d * 180, r2d * 270, false); ctx.closePath(); } /** * Draw an ellipse. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param w - The width of the ellipse. * @param h - The height of the ellipse. * @remarks * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas * * Postfix '_vis' added to discern it from standard method ellipse(). */ function drawEllipse(ctx, x, y, w, h) { const kappa = .5522848, ox = w / 2 * kappa, oy = h / 2 * kappa, xe = x + w, ye = y + h, xm = x + w / 2, ym = y + h / 2; ctx.beginPath(); ctx.moveTo(x, ym); ctx.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); ctx.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); ctx.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); ctx.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); ctx.closePath(); } /** * Draw an isometric cylinder. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param w - The width of the database. * @param h - The height of the database. * @remarks * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas */ function drawDatabase(ctx, x, y, w, h) { const f = 1 / 3; const wEllipse = w; const hEllipse = h * f; const kappa = .5522848, ox = wEllipse / 2 * kappa, oy = hEllipse / 2 * kappa, xe = x + wEllipse, ye = y + hEllipse, xm = x + wEllipse / 2, ym = y + hEllipse / 2, ymb = y + (h - hEllipse / 2), yeb = y + h; ctx.beginPath(); ctx.moveTo(xe, ym); ctx.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); ctx.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); ctx.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); ctx.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); ctx.lineTo(xe, ymb); ctx.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb); ctx.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb); ctx.lineTo(x, ym); } /** * Draw a dashed line. * @param ctx - The context this shape will be rendered to. * @param x - The start position on the x axis. * @param y - The start position on the y axis. * @param x2 - The end position on the x axis. * @param y2 - The end position on the y axis. * @param pattern - List of lengths starting with line and then alternating between space and line. * @author David Jordan * @remarks * date 2012-08-08 * http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas */ function drawDashedLine(ctx, x, y, x2, y2, pattern) { ctx.beginPath(); ctx.moveTo(x, y); const patternLength = pattern.length; const dx = x2 - x; const dy = y2 - y; const slope = dy / dx; let distRemaining = Math.sqrt(dx * dx + dy * dy); let patternIndex = 0; let draw = true; let xStep = 0; let dashLength = +pattern[0]; while (distRemaining >= .1) { dashLength = +pattern[patternIndex++ % patternLength]; if (dashLength > distRemaining) dashLength = distRemaining; xStep = Math.sqrt(dashLength * dashLength / (1 + slope * slope)); xStep = dx < 0 ? -xStep : xStep; x += xStep; y += slope * xStep; if (draw === true) ctx.lineTo(x, y); else ctx.moveTo(x, y); distRemaining -= dashLength; draw = !draw; } } /** * Draw a hexagon. * @param ctx - The context this shape will be rendered to. * @param x - The position of the center on the x axis. * @param y - The position of the center on the y axis. * @param r - The radius of the hexagon. */ function drawHexagon(ctx, x, y, r) { ctx.beginPath(); const sides = 6; const a = Math.PI * 2 / sides; ctx.moveTo(x + r, y); for (let i = 1; i < sides; i++) ctx.lineTo(x + r * Math.cos(a * i), y + r * Math.sin(a * i)); ctx.closePath(); } const shapeMap = { circle: drawCircle, dashedLine: drawDashedLine, database: drawDatabase, diamond: drawDiamond, ellipse: drawEllipse, ellipse_vis: drawEllipse, hexagon: drawHexagon, roundRect: drawRoundRect, square: drawSquare, star: drawStar, triangle: drawTriangle, triangleDown: drawTriangleDown }; /** * Returns either custom or native drawing function base on supplied name. * @param name - The name of the function. Either the name of a * CanvasRenderingContext2D property or an export from shapes.ts without the * draw prefix. * @returns The function that can be used for rendering. In case of native * CanvasRenderingContext2D function the API is normalized to * `(ctx: CanvasRenderingContext2D, ...originalArgs) => void`. */ function getShape(name) { if (Object.prototype.hasOwnProperty.call(shapeMap, name)) return shapeMap[name]; else return function(ctx) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key]; CanvasRenderingContext2D.prototype[name].call(ctx, args); }; } var componentEmitter = { exports: {} }; var hasRequiredComponentEmitter; function requireComponentEmitter() { if (hasRequiredComponentEmitter) return componentEmitter.exports; hasRequiredComponentEmitter = 1; (function(module) { module.exports = Emitter$2; /** * Initialize a new `Emitter`. * * @api public */ function Emitter$2(obj) { if (obj) return mixin(obj); } /** * Mixin the emitter properties. * * @param {Object} obj * @return {Object} * @api private */ function mixin(obj) { for (var key in Emitter$2.prototype) obj[key] = Emitter$2.prototype[key]; return obj; } /** * Listen on the given `event` with `fn`. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter$2.prototype.on = Emitter$2.prototype.addEventListener = function(event, fn) { this._callbacks = this._callbacks || {}; (this._callbacks["$" + event] = this._callbacks["$" + event] || []).push(fn); return this; }; /** * Adds an `event` listener that will be invoked a single * time then automatically removed. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter$2.prototype.once = function(event, fn) { function on() { this.off(event, on); fn.apply(this, arguments); } on.fn = fn; this.on(event, on); return this; }; /** * Remove the given callback for `event` or all * registered callbacks. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter$2.prototype.off = Emitter$2.prototype.removeListener = Emitter$2.prototype.removeAllListeners = Emitter$2.prototype.removeEventListener = function(event, fn) { this._callbacks = this._callbacks || {}; if (0 == arguments.length) { this._callbacks = {}; return this; } var callbacks = this._callbacks["$" + event]; if (!callbacks) return this; if (1 == arguments.length) { delete this._callbacks["$" + event]; return this; } var cb; for (var i = 0; i < callbacks.length; i++) { cb = callbacks[i]; if (cb === fn || cb.fn === fn) { callbacks.splice(i, 1); break; } } if (callbacks.length === 0) delete this._callbacks["$" + event]; return this; }; /** * Emit `event` with the given args. * * @param {String} event * @param {Mixed} ... * @return {Emitter} */ Emitter$2.prototype.emit = function(event) { this._callbacks = this._callbacks || {}; var args = new Array(arguments.length - 1), callbacks = this._callbacks["$" + event]; for (var i = 1; i < arguments.length; i++) args[i - 1] = arguments[i]; if (callbacks) { callbacks = callbacks.slice(0); for (var i = 0, len = callbacks.length; i < len; ++i) callbacks[i].apply(this, args); } return this; }; /** * Return array of callbacks for `event`. * * @param {String} event * @return {Array} * @api public */ Emitter$2.prototype.listeners = function(event) { this._callbacks = this._callbacks || {}; return this._callbacks["$" + event] || []; }; /** * Check if this emitter has `event` handlers. * * @param {String} event * @return {Boolean} * @api public */ Emitter$2.prototype.hasListeners = function(event) { return !!this.listeners(event).length; }; })(componentEmitter); return componentEmitter.exports; } var componentEmitterExports = requireComponentEmitter(); var Emitter = /* @__PURE__ */ getDefaultExportFromCjs(componentEmitterExports); /*! Hammer.JS - v2.0.17-rc - 2019-12-16 * http://naver.github.io/egjs * * Forked By Naver egjs * Copyright (c) hammerjs * Licensed under the MIT license */ function _extends() { _extends = Object.assign || function(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; } return target; }; return _extends.apply(this, arguments); } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } function _assertThisInitialized(self$1) { if (self$1 === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return self$1; } /** * @private * extend object. * means that properties in dest will be overwritten by the ones in src. * @param {Object} target * @param {...Object} objects_to_assign * @returns {Object} target */ var assign; if (typeof Object.assign !== "function") assign = function assign$6(target) { if (target === void 0 || target === null) throw new TypeError("Cannot convert undefined or null to object"); var output = Object(target); for (var index$1 = 1; index$1 < arguments.length; index$1++) { var source = arguments[index$1]; if (source !== void 0 && source !== null) { for (var nextKey in source) if (source.hasOwnProperty(nextKey)) output[nextKey] = source[nextKey]; } } return output; }; else assign = Object.assign; var assign$1 = assign; var VENDOR_PREFIXES = [ "", "webkit", "Moz", "MS", "ms", "o" ]; var TEST_ELEMENT = typeof document === "undefined" ? { style: {} } : document.createElement("div"); var TYPE_FUNCTION = "function"; var round = Math.round, abs = Math.abs; var now$3 = Date.now; /** * @private * get the prefixed property * @param {Object} obj * @param {String} property * @returns {String|Undefined} prefixed */ function prefixed(obj, property) { var prefix; var prop; var camelProp = property[0].toUpperCase() + property.slice(1); var i = 0; while (i < VENDOR_PREFIXES.length) { prefix = VENDOR_PREFIXES[i]; prop = prefix ? prefix + camelProp : property; if (prop in obj) return prop; i++; } return void 0; } var win; if (typeof window === "undefined") win = {}; else win = window; var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, "touchAction"); var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== void 0; function getTouchActionProps() { if (!NATIVE_TOUCH_ACTION) return false; var touchMap = {}; var cssSupports = win.CSS && win.CSS.supports; [ "auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none" ].forEach(function(val) { return touchMap[val] = cssSupports ? win.CSS.supports("touch-action", val) : true; }); return touchMap; } var TOUCH_ACTION_COMPUTE = "compute"; var TOUCH_ACTION_AUTO = "auto"; var TOUCH_ACTION_MANIPULATION = "manipulation"; var TOUCH_ACTION_NONE = "none"; var TOUCH_ACTION_PAN_X = "pan-x"; var TOUCH_ACTION_PAN_Y = "pan-y"; var TOUCH_ACTION_MAP = getTouchActionProps(); var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; var SUPPORT_TOUCH = "ontouchstart" in win; var SUPPORT_POINTER_EVENTS = prefixed(win, "PointerEvent") !== void 0; var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); var INPUT_TYPE_TOUCH = "touch"; var INPUT_TYPE_PEN = "pen"; var INPUT_TYPE_MOUSE = "mouse"; var INPUT_TYPE_KINECT = "kinect"; var COMPUTE_INTERVAL = 25; var INPUT_START = 1; var INPUT_MOVE = 2; var INPUT_END = 4; var INPUT_CANCEL = 8; var DIRECTION_NONE = 1; var DIRECTION_LEFT = 2; var DIRECTION_RIGHT = 4; var DIRECTION_UP = 8; var DIRECTION_DOWN = 16; var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; var PROPS_XY = ["x", "y"]; var PROPS_CLIENT_XY = ["clientX", "clientY"]; /** * @private * walk objects and arrays * @param {Object} obj * @param {Function} iterator * @param {Object} context */ function each(obj, iterator$7, context) { var i; if (!obj) return; if (obj.forEach) obj.forEach(iterator$7, context); else if (obj.length !== void 0) { i = 0; while (i < obj.length) { iterator$7.call(context, obj[i], i, obj); i++; } } else for (i in obj) obj.hasOwnProperty(i) && iterator$7.call(context, obj[i], i, obj); } /** * @private * let a boolean value also be a function that must return a boolean * this first item in args will be used as the context * @param {Boolean|Function} val * @param {Array} [args] * @returns {Boolean} */ function boolOrFn(val, args) { if (typeof val === TYPE_FUNCTION) return val.apply(args ? args[0] || void 0 : void 0, args); return val; } /** * @private * small indexOf wrapper * @param {String} str * @param {String} find * @returns {Boolean} found */ function inStr(str, find) { return str.indexOf(find) > -1; } /** * @private * when the touchActions are collected they are not a valid value, so we need to clean things up. * * @param {String} actions * @returns {*} */ function cleanTouchActions(actions) { if (inStr(actions, TOUCH_ACTION_NONE)) return TOUCH_ACTION_NONE; var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); if (hasPanX && hasPanY) return TOUCH_ACTION_NONE; if (hasPanX || hasPanY) return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; if (inStr(actions, TOUCH_ACTION_MANIPULATION)) return TOUCH_ACTION_MANIPULATION; return TOUCH_ACTION_AUTO; } /** * @private * Touch Action * sets the touchAction property or uses the js alternative * @param {Manager} manager * @param {String} value * @constructor */ var TouchAction = /* @__PURE__ */ function() { function TouchAction$2(manager, value) { this.manager = manager; this.set(value); } /** * @private * set the touchAction value on the element or enable the polyfill * @param {String} value */ var _proto = TouchAction$2.prototype; _proto.set = function set$4(value) { if (value === TOUCH_ACTION_COMPUTE) value = this.compute(); if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; this.actions = value.toLowerCase().trim(); }; /** * @private * just re-set the touchAction value */ _proto.update = function update() { this.set(this.manager.options.touchAction); }; /** * @private * compute the value for the touchAction property based on the recognizer's settings * @returns {String} value */ _proto.compute = function compute() { var actions = []; each(this.manager.recognizers, function(recognizer) { if (boolOrFn(recognizer.options.enable, [recognizer])) actions = actions.concat(recognizer.getTouchAction()); }); return cleanTouchActions(actions.join(" ")); }; /** * @private * this method is called on each input cycle and provides the preventing of the browser behavior * @param {Object} input */ _proto.preventDefaults = function preventDefaults(input) { var srcEvent = input.srcEvent; var direction = input.offsetDirection; if (this.manager.session.prevented) { srcEvent.preventDefault(); return; } var actions = this.actions; var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; if (hasNone) { var isTapPointer = input.pointers.length === 1; var isTapMovement = input.distance < 2; var isTapTouchTime = input.deltaTime < 250; if (isTapPointer && isTapMovement && isTapTouchTime) return; } if (hasPanX && hasPanY) return; if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) return this.preventSrc(srcEvent); }; /** * @private * call preventDefault to prevent the browser's default behavior (scrolling in most cases) * @param {Object} srcEvent */ _proto.preventSrc = function preventSrc(srcEvent) { this.manager.session.prevented = true; srcEvent.preventDefault(); }; return TouchAction$2; }(); /** * @private * find if a node is in the given parent * @method hasParent * @param {HTMLElement} node * @param {HTMLElement} parent * @return {Boolean} found */ function hasParent(node, parent) { while (node) { if (node === parent) return true; node = node.parentNode; } return false; } /** * @private * get the center of all the pointers * @param {Array} pointers * @return {Object} center contains `x` and `y` properties */ function getCenter(pointers) { var pointersLength = pointers.length; if (pointersLength === 1) return { x: round(pointers[0].clientX), y: round(pointers[0].clientY) }; var x = 0; var y = 0; var i = 0; while (i < pointersLength) { x += pointers[i].clientX; y += pointers[i].clientY; i++; } return { x: round(x / pointersLength), y: round(y / pointersLength) }; } /** * @private * create a simple clone from the input used for storage of firstInput and firstMultiple * @param {Object} input * @returns {Object} clonedInputData */ function simpleCloneInputData(input) { var pointers = []; var i = 0; while (i < input.pointers.length) { pointers[i] = { clientX: round(input.pointers[i].clientX), clientY: round(input.pointers[i].clientY) }; i++; } return { timeStamp: now$3(), pointers, center: getCenter(pointers), deltaX: input.deltaX, deltaY: input.deltaY }; } /** * @private * calculate the absolute distance between two points * @param {Object} p1 {x, y} * @param {Object} p2 {x, y} * @param {Array} [props] containing x and y keys * @return {Number} distance */ function getDistance(p1, p2, props) { if (!props) props = PROPS_XY; var x = p2[props[0]] - p1[props[0]]; var y = p2[props[1]] - p1[props[1]]; return Math.sqrt(x * x + y * y); } /** * @private * calculate the angle between two coordinates * @param {Object} p1 * @param {Object} p2 * @param {Array} [props] containing x and y keys * @return {Number} angle */ function getAngle(p1, p2, props) { if (!props) props = PROPS_XY; var x = p2[props[0]] - p1[props[0]]; var y = p2[props[1]] - p1[props[1]]; return Math.atan2(y, x) * 180 / Math.PI; } /** * @private * get the direction between two points * @param {Number} x * @param {Number} y * @return {Number} direction */ function getDirection(x, y) { if (x === y) return DIRECTION_NONE; if (abs(x) >= abs(y)) return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; } function computeDeltaXY(session, input) { var center = input.center; var offset = session.offsetDelta || {}; var prevDelta = session.prevDelta || {}; var prevInput = session.prevInput || {}; if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { prevDelta = session.prevDelta = { x: prevInput.deltaX || 0, y: prevInput.deltaY || 0 }; offset = session.offsetDelta = { x: center.x, y: center.y }; } input.deltaX = prevDelta.x + (center.x - offset.x); input.deltaY = prevDelta.y + (center.y - offset.y); } /** * @private * calculate the velocity between two points. unit is in px per ms. * @param {Number} deltaTime * @param {Number} x * @param {Number} y * @return {Object} velocity `x` and `y` */ function getVelocity(deltaTime, x, y) { return { x: x / deltaTime || 0, y: y / deltaTime || 0 }; } /** * @private * calculate the scale factor between two pointersets * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out * @param {Array} start array of pointers * @param {Array} end array of pointers * @return {Number} scale */ function getScale(start, end) { return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); } /** * @private * calculate the rotation degrees between two pointersets * @param {Array} start array of pointers * @param {Array} end array of pointers * @return {Number} rotation */ function getRotation(start, end) { return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); } /** * @private * velocity is calculated every x ms * @param {Object} session * @param {Object} input */ function computeIntervalInputData(session, input) { var last = session.lastInterval || input; var deltaTime = input.timeStamp - last.timeStamp; var velocity; var velocityX; var velocityY; var direction; if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === void 0)) { var deltaX = input.deltaX - last.deltaX; var deltaY = input.deltaY - last.deltaY; var v = getVelocity(deltaTime, deltaX, deltaY); velocityX = v.x; velocityY = v.y; velocity = abs(v.x) > abs(v.y) ? v.x : v.y; direction = getDirection(deltaX, deltaY); session.lastInterval = input; } else { velocity = last.velocity; velocityX = last.velocityX; velocityY = last.velocityY; direction = last.direction; } input.velocity = velocity; input.velocityX = velocityX; input.velocityY = velocityY; input.direction = direction; } /** * @private * extend the data with some usable properties like scale, rotate, velocity etc * @param {Object} manager * @param {Object} input */ function computeInputData(manager, input) { var session = manager.session; var pointers = input.pointers; var pointersLength = pointers.length; if (!session.firstInput) session.firstInput = simpleCloneInputData(input); if (pointersLength > 1 && !session.firstMultiple) session.firstMultiple = simpleCloneInputData(input); else if (pointersLength === 1) session.firstMultiple = false; var firstInput = session.firstInput, firstMultiple = session.firstMultiple; var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; var center = input.center = getCenter(pointers); input.timeStamp = now$3(); input.deltaTime = input.timeStamp - firstInput.timeStamp; input.angle = getAngle(offsetCenter, center); input.distance = getDistance(offsetCenter, center); computeDeltaXY(session, input); input.offsetDirection = getDirection(input.deltaX, input.deltaY); var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); input.overallVelocityX = overallVelocity.x; input.overallVelocityY = overallVelocity.y; input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y; input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers; computeIntervalInputData(session, input); var target = manager.element; var srcEvent = input.srcEvent; var srcEventTarget; if (srcEvent.composedPath) srcEventTarget = srcEvent.composedPath()[0]; else if (srcEvent.path) srcEventTarget = srcEvent.path[0]; else srcEventTarget = srcEvent.target; if (hasParent(srcEventTarget, target)) target = srcEventTarget; input.target = target; } /** * @private * handle input events * @param {Manager} manager * @param {String} eventType * @param {Object} input */ function inputHandler(manager, eventType, input) { var pointersLen = input.pointers.length; var changedPointersLen = input.changedPointers.length; var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0; var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0; input.isFirst = !!isFirst; input.isFinal = !!isFinal; if (isFirst) manager.session = {}; input.eventType = eventType; computeInputData(manager, input); manager.emit("hammer.input", input); manager.recognize(input); manager.session.prevInput = input; } /** * @private * split string on whitespace * @param {String} str * @returns {Array} words */ function splitStr(str) { return str.trim().split(/\s+/g); } /** * @private * addEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ function addEventListeners(target, types, handler) { each(splitStr(types), function(type) { target.addEventListener(type, handler, false); }); } /** * @private * removeEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ function removeEventListeners(target, types, handler) { each(splitStr(types), function(type) { target.removeEventListener(type, handler, false); }); } /** * @private * get the window object of an element * @param {HTMLElement} element * @returns {DocumentView|Window} */ function getWindowForElement(element) { var doc = element.ownerDocument || element; return doc.defaultView || doc.parentWindow || window; } /** * @private * create new input type manager * @param {Manager} manager * @param {Function} callback * @returns {Input} * @constructor */ var Input = /* @__PURE__ */ function() { function Input$2(manager, callback) { var self$1 = this; this.manager = manager; this.callback = callback; this.element = manager.element; this.target = manager.options.inputTarget; this.domHandler = function(ev) { if (boolOrFn(manager.options.enable, [manager])) self$1.handler(ev); }; this.init(); } /** * @private * should handle the inputEvent data and trigger the callback * @virtual */ var _proto = Input$2.prototype; _proto.handler = function handler() {}; /** * @private * bind the events */ _proto.init = function init() { this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); }; /** * @private * unbind the events */ _proto.destroy = function destroy() { this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); }; return Input$2; }(); /** * @private * find if a array contains the object using indexOf or a simple polyFill * @param {Array} src * @param {String} find * @param {String} [findByKey] * @return {Boolean|Number} false when not found, or the index */ function inArray(src, find, findByKey) { if (src.indexOf && !findByKey) return src.indexOf(find); else { var i = 0; while (i < src.length) { if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) return i; i++; } return -1; } } var POINTER_INPUT_MAP = { pointerdown: INPUT_START, pointermove: INPUT_MOVE, pointerup: INPUT_END, pointercancel: INPUT_CANCEL, pointerout: INPUT_CANCEL }; var IE10_POINTER_TYPE_ENUM = { 2: INPUT_TYPE_TOUCH, 3: INPUT_TYPE_PEN, 4: INPUT_TYPE_MOUSE, 5: INPUT_TYPE_KINECT }; var POINTER_ELEMENT_EVENTS = "pointerdown"; var POINTER_WINDOW_EVENTS = "pointermove pointerup pointercancel"; if (win.MSPointerEvent && !win.PointerEvent) { POINTER_ELEMENT_EVENTS = "MSPointerDown"; POINTER_WINDOW_EVENTS = "MSPointerMove MSPointerUp MSPointerCancel"; } /** * @private * Pointer events input * @constructor * @extends Input */ var PointerEventInput = /* @__PURE__ */ function(_Input) { _inheritsLoose(PointerEventInput$2, _Input); function PointerEventInput$2() { var _this; var proto = PointerEventInput$2.prototype; proto.evEl = POINTER_ELEMENT_EVENTS; proto.evWin = POINTER_WINDOW_EVENTS; _this = _Input.apply(this, arguments) || this; _this.store = _this.manager.session.pointerEvents = []; return _this; } /** * @private * handle mouse events * @param {Object} ev */ var _proto = PointerEventInput$2.prototype; _proto.handler = function handler(ev) { var store = this.store; var removePointer = false; var eventTypeNormalized = ev.type.toLowerCase().replace("ms", ""); var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; var isTouch = pointerType === INPUT_TYPE_TOUCH; var storeIndex = inArray(store, ev.pointerId, "pointerId"); if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { if (storeIndex < 0) { store.push(ev); storeIndex = store.length - 1; } } else if (eventType & (INPUT_END | INPUT_CANCEL)) removePointer = true; if (storeIndex < 0) return; store[storeIndex] = ev; this.callback(this.manager, eventType, { pointers: store, changedPointers: [ev], pointerType, srcEvent: ev }); if (removePointer) store.splice(storeIndex, 1); }; return PointerEventInput$2; }(Input); /** * @private * convert array-like objects to real arrays * @param {Object} obj * @returns {Array} */ function toArray(obj) { return Array.prototype.slice.call(obj, 0); } /** * @private * unique array with objects based on a key (like 'id') or just by the array's value * @param {Array} src [{id:1},{id:2},{id:1}] * @param {String} [key] * @param {Boolean} [sort=False] * @returns {Array} [{id:1},{id:2}] */ function uniqueArray(src, key, sort$5) { var results = []; var values$8 = []; var i = 0; while (i < src.length) { var val = key ? src[i][key] : src[i]; if (inArray(values$8, val) < 0) results.push(src[i]); values$8[i] = val; i++; } if (sort$5) if (!key) results = results.sort(); else results = results.sort(function(a, b) { return a[key] > b[key]; }); return results; } var TOUCH_INPUT_MAP = { touchstart: INPUT_START, touchmove: INPUT_MOVE, touchend: INPUT_END, touchcancel: INPUT_CANCEL }; var TOUCH_TARGET_EVENTS = "touchstart touchmove touchend touchcancel"; /** * @private * Multi-user touch events input * @constructor * @extends Input */ var TouchInput = /* @__PURE__ */ function(_Input) { _inheritsLoose(TouchInput$2, _Input); function TouchInput$2() { var _this; TouchInput$2.prototype.evTarget = TOUCH_TARGET_EVENTS; _this = _Input.apply(this, arguments) || this; _this.targetIds = {}; return _this; } var _proto = TouchInput$2.prototype; _proto.handler = function handler(ev) { var type = TOUCH_INPUT_MAP[ev.type]; var touches = getTouches.call(this, ev, type); if (!touches) return; this.callback(this.manager, type, { pointers: touches[0], changedPointers: touches[1], pointerType: INPUT_TYPE_TOUCH, srcEvent: ev }); }; return TouchInput$2; }(Input); function getTouches(ev, type) { var allTouches = toArray(ev.touches); var targetIds = this.targetIds; if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { targetIds[allTouches[0].identifier] = true; return [allTouches, allTouches]; } var i; var targetTouches; var changedTouches = toArray(ev.changedTouches); var changedTargetTouches = []; var target = this.target; targetTouches = allTouches.filter(function(touch) { return hasParent(touch.target, target); }); if (type === INPUT_START) { i = 0; while (i < targetTouches.length) { targetIds[targetTouches[i].identifier] = true; i++; } } i = 0; while (i < changedTouches.length) { if (targetIds[changedTouches[i].identifier]) changedTargetTouches.push(changedTouches[i]); if (type & (INPUT_END | INPUT_CANCEL)) delete targetIds[changedTouches[i].identifier]; i++; } if (!changedTargetTouches.length) return; return [uniqueArray(targetTouches.concat(changedTargetTouches), "identifier", true), changedTargetTouches]; } var MOUSE_INPUT_MAP = { mousedown: INPUT_START, mousemove: INPUT_MOVE, mouseup: INPUT_END }; var MOUSE_ELEMENT_EVENTS = "mousedown"; var MOUSE_WINDOW_EVENTS = "mousemove mouseup"; /** * @private * Mouse events input * @constructor * @extends Input */ var MouseInput = /* @__PURE__ */ function(_Input) { _inheritsLoose(MouseInput$2, _Input); function MouseInput$2() { var _this; var proto = MouseInput$2.prototype; proto.evEl = MOUSE_ELEMENT_EVENTS; proto.evWin = MOUSE_WINDOW_EVENTS; _this = _Input.apply(this, arguments) || this; _this.pressed = false; return _this; } /** * @private * handle mouse events * @param {Object} ev */ var _proto = MouseInput$2.prototype; _proto.handler = function handler(ev) { var eventType = MOUSE_INPUT_MAP[ev.type]; if (eventType & INPUT_START && ev.button === 0) this.pressed = true; if (eventType & INPUT_MOVE && ev.which !== 1) eventType = INPUT_END; if (!this.pressed) return; if (eventType & INPUT_END) this.pressed = false; this.callback(this.manager, eventType, { pointers: [ev], changedPointers: [ev], pointerType: INPUT_TYPE_MOUSE, srcEvent: ev }); }; return MouseInput$2; }(Input); /** * @private * Combined touch and mouse input * * Touch has a higher priority then mouse, and while touching no mouse events are allowed. * This because touch devices also emit mouse events while doing a touch. * * @constructor * @extends Input */ var DEDUP_TIMEOUT = 2500; var DEDUP_DISTANCE = 25; function setLastTouch(eventData) { var _eventData$changedPoi = eventData.changedPointers, touch = _eventData$changedPoi[0]; if (touch.identifier === this.primaryTouch) { var lastTouch = { x: touch.clientX, y: touch.clientY }; var lts = this.lastTouches; this.lastTouches.push(lastTouch); var removeLastTouch = function removeLastTouch$1() { var i = lts.indexOf(lastTouch); if (i > -1) lts.splice(i, 1); }; setTimeout(removeLastTouch, DEDUP_TIMEOUT); } } function recordTouches(eventType, eventData) { if (eventType & INPUT_START) { this.primaryTouch = eventData.changedPointers[0].identifier; setLastTouch.call(this, eventData); } else if (eventType & (INPUT_END | INPUT_CANCEL)) setLastTouch.call(this, eventData); } function isSyntheticEvent(eventData) { var x = eventData.srcEvent.clientX; var y = eventData.srcEvent.clientY; for (var i = 0; i < this.lastTouches.length; i++) { var t = this.lastTouches[i]; var dx = Math.abs(x - t.x); var dy = Math.abs(y - t.y); if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) return true; } return false; } var TouchMouseInput = /* @__PURE__ */ function() { var TouchMouseInput$2 = /* @__PURE__ */ function(_Input) { _inheritsLoose(TouchMouseInput$3, _Input); function TouchMouseInput$3(_manager, callback) { var _this; _this = _Input.call(this, _manager, callback) || this; _this.handler = function(manager, inputEvent, inputData) { var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH; var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE; if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) return; if (isTouch) recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData); else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) return; _this.callback(manager, inputEvent, inputData); }; _this.touch = new TouchInput(_this.manager, _this.handler); _this.mouse = new MouseInput(_this.manager, _this.handler); _this.primaryTouch = null; _this.lastTouches = []; return _this; } /** * @private * handle mouse and touch events * @param {Hammer} manager * @param {String} inputEvent * @param {Object} inputData */ var _proto = TouchMouseInput$3.prototype; /** * @private * remove the event listeners */ _proto.destroy = function destroy() { this.touch.destroy(); this.mouse.destroy(); }; return TouchMouseInput$3; }(Input); return TouchMouseInput$2; }(); /** * @private * create new input type manager * called by the Manager constructor * @param {Hammer} manager * @returns {Input} */ function createInputInstance(manager) { var Type; var inputClass = manager.options.inputClass; if (inputClass) Type = inputClass; else if (SUPPORT_POINTER_EVENTS) Type = PointerEventInput; else if (SUPPORT_ONLY_TOUCH) Type = TouchInput; else if (!SUPPORT_TOUCH) Type = MouseInput; else Type = TouchMouseInput; return new Type(manager, inputHandler); } /** * @private * if the argument is an array, we want to execute the fn on each entry * if it aint an array we don't want to do a thing. * this is used by all the methods that accept a single and array argument. * @param {*|Array} arg * @param {String} fn * @param {Object} [context] * @returns {Boolean} */ function invokeArrayArg(arg, fn, context) { if (Array.isArray(arg)) { each(arg, context[fn], context); return true; } return false; } var STATE_POSSIBLE = 1; var STATE_BEGAN = 2; var STATE_CHANGED = 4; var STATE_ENDED = 8; var STATE_RECOGNIZED = STATE_ENDED; var STATE_CANCELLED = 16; var STATE_FAILED = 32; /** * @private * get a unique id * @returns {number} uniqueId */ var _uniqueId = 1; function uniqueId() { return _uniqueId++; } /** * @private * get a recognizer by name if it is bound to a manager * @param {Recognizer|String} otherRecognizer * @param {Recognizer} recognizer * @returns {Recognizer} */ function getRecognizerByNameIfManager(otherRecognizer, recognizer) { var manager = recognizer.manager; if (manager) return manager.get(otherRecognizer); return otherRecognizer; } /** * @private * get a usable string, used as event postfix * @param {constant} state * @returns {String} state */ function stateStr(state) { if (state & STATE_CANCELLED) return "cancel"; else if (state & STATE_ENDED) return "end"; else if (state & STATE_CHANGED) return "move"; else if (state & STATE_BEGAN) return "start"; return ""; } /** * @private * Recognizer flow explained; * * All recognizers have the initial state of POSSIBLE when a input session starts. * The definition of a input session is from the first input until the last input, with all it's movement in it. * * Example session for mouse-input: mousedown -> mousemove -> mouseup * * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed * which determines with state it should be. * * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to * POSSIBLE to give it another change on the next cycle. * * Possible * | * +-----+---------------+ * | | * +-----+-----+ | * | | | * Failed Cancelled | * +-------+------+ * | | * Recognized Began * | * Changed * | * Ended/Recognized */ /** * @private * Recognizer * Every recognizer needs to extend from this class. * @constructor * @param {Object} options */ var Recognizer = /* @__PURE__ */ function() { function Recognizer$2(options) { if (options === void 0) options = {}; this.options = _extends({ enable: true }, options); this.id = uniqueId(); this.manager = null; this.state = STATE_POSSIBLE; this.simultaneous = {}; this.requireFail = []; } /** * @private * set options * @param {Object} options * @return {Recognizer} */ var _proto = Recognizer$2.prototype; _proto.set = function set$4(options) { assign$1(this.options, options); this.manager && this.manager.touchAction.update(); return this; }; /** * @private * recognize simultaneous with an other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ _proto.recognizeWith = function recognizeWith(otherRecognizer) { if (invokeArrayArg(otherRecognizer, "recognizeWith", this)) return this; var simultaneous = this.simultaneous; otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); if (!simultaneous[otherRecognizer.id]) { simultaneous[otherRecognizer.id] = otherRecognizer; otherRecognizer.recognizeWith(this); } return this; }; /** * @private * drop the simultaneous link. it doesnt remove the link on the other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) { if (invokeArrayArg(otherRecognizer, "dropRecognizeWith", this)) return this; otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); delete this.simultaneous[otherRecognizer.id]; return this; }; /** * @private * recognizer can only run when an other is failing * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ _proto.requireFailure = function requireFailure(otherRecognizer) { if (invokeArrayArg(otherRecognizer, "requireFailure", this)) return this; var requireFail = this.requireFail; otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); if (inArray(requireFail, otherRecognizer) === -1) { requireFail.push(otherRecognizer); otherRecognizer.requireFailure(this); } return this; }; /** * @private * drop the requireFailure link. it does not remove the link on the other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) { if (invokeArrayArg(otherRecognizer, "dropRequireFailure", this)) return this; otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); var index$1 = inArray(this.requireFail, otherRecognizer); if (index$1 > -1) this.requireFail.splice(index$1, 1); return this; }; /** * @private * has require failures boolean * @returns {boolean} */ _proto.hasRequireFailures = function hasRequireFailures() { return this.requireFail.length > 0; }; /** * @private * if the recognizer can recognize simultaneous with an other recognizer * @param {Recognizer} otherRecognizer * @returns {Boolean} */ _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) { return !!this.simultaneous[otherRecognizer.id]; }; /** * @private * You should use `tryEmit` instead of `emit` directly to check * that all the needed recognizers has failed before emitting. * @param {Object} input */ _proto.emit = function emit(input) { var self$1 = this; var state = this.state; function emit(event) { self$1.manager.emit(event, input); } if (state < STATE_ENDED) emit(self$1.options.event + stateStr(state)); emit(self$1.options.event); if (input.additionalEvent) emit(input.additionalEvent); if (state >= STATE_ENDED) emit(self$1.options.event + stateStr(state)); }; /** * @private * Check that all the require failure recognizers has failed, * if true, it emits a gesture event, * otherwise, setup the state to FAILED. * @param {Object} input */ _proto.tryEmit = function tryEmit(input) { if (this.canEmit()) return this.emit(input); this.state = STATE_FAILED; }; /** * @private * can we emit? * @returns {boolean} */ _proto.canEmit = function canEmit() { var i = 0; while (i < this.requireFail.length) { if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) return false; i++; } return true; }; /** * @private * update the recognizer * @param {Object} inputData */ _proto.recognize = function recognize(inputData) { var inputDataClone = assign$1({}, inputData); if (!boolOrFn(this.options.enable, [this, inputDataClone])) { this.reset(); this.state = STATE_FAILED; return; } if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) this.state = STATE_POSSIBLE; this.state = this.process(inputDataClone); if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) this.tryEmit(inputDataClone); }; /** * @private * return the state of the recognizer * the actual recognizing happens in this method * @virtual * @param {Object} inputData * @returns {constant} STATE */ _proto.process = function process(inputData) {}; /** * @private * return the preferred touch-action * @virtual * @returns {Array} */ _proto.getTouchAction = function getTouchAction() {}; /** * @private * called when the gesture isn't allowed to recognize * like when another is being recognized or it is disabled * @virtual */ _proto.reset = function reset() {}; return Recognizer$2; }(); /** * @private * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur * between the given interval and position. The delay option can be used to recognize multi-taps without firing * a single tap. * * The eventData from the emitted event contains the property `tapCount`, which contains the amount of * multi-taps being recognized. * @constructor * @extends Recognizer */ var TapRecognizer = /* @__PURE__ */ function(_Recognizer) { _inheritsLoose(TapRecognizer$2, _Recognizer); function TapRecognizer$2(options) { var _this; if (options === void 0) options = {}; _this = _Recognizer.call(this, _extends({ event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 9, posThreshold: 10 }, options)) || this; _this.pTime = false; _this.pCenter = false; _this._timer = null; _this._input = null; _this.count = 0; return _this; } var _proto = TapRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return [TOUCH_ACTION_MANIPULATION]; }; _proto.process = function process(input) { var _this2 = this; var options = this.options; var validPointers = input.pointers.length === options.pointers; var validMovement = input.distance < options.threshold; var validTouchTime = input.deltaTime < options.time; this.reset(); if (input.eventType & INPUT_START && this.count === 0) return this.failTimeout(); if (validMovement && validTouchTime && validPointers) { if (input.eventType !== INPUT_END) return this.failTimeout(); var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true; var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; this.pTime = input.timeStamp; this.pCenter = input.center; if (!validMultiTap || !validInterval) this.count = 1; else this.count += 1; this._input = input; var tapCount = this.count % options.taps; if (tapCount === 0) if (!this.hasRequireFailures()) return STATE_RECOGNIZED; else { this._timer = setTimeout(function() { _this2.state = STATE_RECOGNIZED; _this2.tryEmit(); }, options.interval); return STATE_BEGAN; } } return STATE_FAILED; }; _proto.failTimeout = function failTimeout() { var _this3 = this; this._timer = setTimeout(function() { _this3.state = STATE_FAILED; }, this.options.interval); return STATE_FAILED; }; _proto.reset = function reset() { clearTimeout(this._timer); }; _proto.emit = function emit() { if (this.state === STATE_RECOGNIZED) { this._input.tapCount = this.count; this.manager.emit(this.options.event, this._input); } }; return TapRecognizer$2; }(Recognizer); /** * @private * This recognizer is just used as a base for the simple attribute recognizers. * @constructor * @extends Recognizer */ var AttrRecognizer = /* @__PURE__ */ function(_Recognizer) { _inheritsLoose(AttrRecognizer$2, _Recognizer); function AttrRecognizer$2(options) { if (options === void 0) options = {}; return _Recognizer.call(this, _extends({ pointers: 1 }, options)) || this; } /** * @private * Used to check if it the recognizer receives valid input, like input.distance > 10. * @memberof AttrRecognizer * @param {Object} input * @returns {Boolean} recognized */ var _proto = AttrRecognizer$2.prototype; _proto.attrTest = function attrTest(input) { var optionPointers = this.options.pointers; return optionPointers === 0 || input.pointers.length === optionPointers; }; /** * @private * Process the input and return the state for the recognizer * @memberof AttrRecognizer * @param {Object} input * @returns {*} State */ _proto.process = function process(input) { var state = this.state; var eventType = input.eventType; var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); var isValid = this.attrTest(input); if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) return state | STATE_CANCELLED; else if (isRecognized || isValid) { if (eventType & INPUT_END) return state | STATE_ENDED; else if (!(state & STATE_BEGAN)) return STATE_BEGAN; return state | STATE_CHANGED; } return STATE_FAILED; }; return AttrRecognizer$2; }(Recognizer); /** * @private * direction cons to string * @param {constant} direction * @returns {String} */ function directionStr(direction) { if (direction === DIRECTION_DOWN) return "down"; else if (direction === DIRECTION_UP) return "up"; else if (direction === DIRECTION_LEFT) return "left"; else if (direction === DIRECTION_RIGHT) return "right"; return ""; } /** * @private * Pan * Recognized when the pointer is down and moved in the allowed direction. * @constructor * @extends AttrRecognizer */ var PanRecognizer = /* @__PURE__ */ function(_AttrRecognizer) { _inheritsLoose(PanRecognizer$2, _AttrRecognizer); function PanRecognizer$2(options) { var _this; if (options === void 0) options = {}; _this = _AttrRecognizer.call(this, _extends({ event: "pan", threshold: 10, pointers: 1, direction: DIRECTION_ALL }, options)) || this; _this.pX = null; _this.pY = null; return _this; } var _proto = PanRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { var direction = this.options.direction; var actions = []; if (direction & DIRECTION_HORIZONTAL) actions.push(TOUCH_ACTION_PAN_Y); if (direction & DIRECTION_VERTICAL) actions.push(TOUCH_ACTION_PAN_X); return actions; }; _proto.directionTest = function directionTest(input) { var options = this.options; var hasMoved = true; var distance = input.distance; var direction = input.direction; var x = input.deltaX; var y = input.deltaY; if (!(direction & options.direction)) if (options.direction & DIRECTION_HORIZONTAL) { direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; hasMoved = x !== this.pX; distance = Math.abs(input.deltaX); } else { direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN; hasMoved = y !== this.pY; distance = Math.abs(input.deltaY); } input.direction = direction; return hasMoved && distance > options.threshold && direction & options.direction; }; _proto.attrTest = function attrTest(input) { return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input)); }; _proto.emit = function emit(input) { this.pX = input.deltaX; this.pY = input.deltaY; var direction = directionStr(input.direction); if (direction) input.additionalEvent = this.options.event + direction; _AttrRecognizer.prototype.emit.call(this, input); }; return PanRecognizer$2; }(AttrRecognizer); /** * @private * Swipe * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. * @constructor * @extends AttrRecognizer */ var SwipeRecognizer = /* @__PURE__ */ function(_AttrRecognizer) { _inheritsLoose(SwipeRecognizer$2, _AttrRecognizer); function SwipeRecognizer$2(options) { if (options === void 0) options = {}; return _AttrRecognizer.call(this, _extends({ event: "swipe", threshold: 10, velocity: .3, direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, pointers: 1 }, options)) || this; } var _proto = SwipeRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return PanRecognizer.prototype.getTouchAction.call(this); }; _proto.attrTest = function attrTest(input) { var direction = this.options.direction; var velocity; if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) velocity = input.overallVelocity; else if (direction & DIRECTION_HORIZONTAL) velocity = input.overallVelocityX; else if (direction & DIRECTION_VERTICAL) velocity = input.overallVelocityY; return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END; }; _proto.emit = function emit(input) { var direction = directionStr(input.offsetDirection); if (direction) this.manager.emit(this.options.event + direction, input); this.manager.emit(this.options.event, input); }; return SwipeRecognizer$2; }(AttrRecognizer); /** * @private * Pinch * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). * @constructor * @extends AttrRecognizer */ var PinchRecognizer = /* @__PURE__ */ function(_AttrRecognizer) { _inheritsLoose(PinchRecognizer$2, _AttrRecognizer); function PinchRecognizer$2(options) { if (options === void 0) options = {}; return _AttrRecognizer.call(this, _extends({ event: "pinch", threshold: 0, pointers: 2 }, options)) || this; } var _proto = PinchRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return [TOUCH_ACTION_NONE]; }; _proto.attrTest = function attrTest(input) { return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); }; _proto.emit = function emit(input) { if (input.scale !== 1) { var inOut = input.scale < 1 ? "in" : "out"; input.additionalEvent = this.options.event + inOut; } _AttrRecognizer.prototype.emit.call(this, input); }; return PinchRecognizer$2; }(AttrRecognizer); /** * @private * Rotate * Recognized when two or more pointer are moving in a circular motion. * @constructor * @extends AttrRecognizer */ var RotateRecognizer = /* @__PURE__ */ function(_AttrRecognizer) { _inheritsLoose(RotateRecognizer$2, _AttrRecognizer); function RotateRecognizer$2(options) { if (options === void 0) options = {}; return _AttrRecognizer.call(this, _extends({ event: "rotate", threshold: 0, pointers: 2 }, options)) || this; } var _proto = RotateRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return [TOUCH_ACTION_NONE]; }; _proto.attrTest = function attrTest(input) { return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); }; return RotateRecognizer$2; }(AttrRecognizer); /** * @private * Press * Recognized when the pointer is down for x ms without any movement. * @constructor * @extends Recognizer */ var PressRecognizer = /* @__PURE__ */ function(_Recognizer) { _inheritsLoose(PressRecognizer$2, _Recognizer); function PressRecognizer$2(options) { var _this; if (options === void 0) options = {}; _this = _Recognizer.call(this, _extends({ event: "press", pointers: 1, time: 251, threshold: 9 }, options)) || this; _this._timer = null; _this._input = null; return _this; } var _proto = PressRecognizer$2.prototype; _proto.getTouchAction = function getTouchAction() { return [TOUCH_ACTION_AUTO]; }; _proto.process = function process(input) { var _this2 = this; var options = this.options; var validPointers = input.pointers.length === options.pointers; var validMovement = input.distance < options.threshold; var validTime = input.deltaTime > options.time; this._input = input; if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) this.reset(); else if (input.eventType & INPUT_START) { this.reset(); this._timer = setTimeout(function() { _this2.state = STATE_RECOGNIZED; _this2.tryEmit(); }, options.time); } else if (input.eventType & INPUT_END) return STATE_RECOGNIZED; return STATE_FAILED; }; _proto.reset = function reset() { clearTimeout(this._timer); }; _proto.emit = function emit(input) { if (this.state !== STATE_RECOGNIZED) return; if (input && input.eventType & INPUT_END) this.manager.emit(this.options.event + "up", input); else { this._input.timeStamp = now$3(); this.manager.emit(this.options.event, this._input); } }; return PressRecognizer$2; }(Recognizer); var defaults = { domEvents: false, touchAction: TOUCH_ACTION_COMPUTE, enable: true, inputTarget: null, inputClass: null, cssProps: { userSelect: "none", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } }; /** * @private * Default recognizer setup when calling `Hammer()` * When creating a new Manager these will be skipped. * This is separated with other defaults because of tree-shaking. * @type {Array} */ var preset = [ [RotateRecognizer, { enable: false }], [ PinchRecognizer, { enable: false }, ["rotate"] ], [SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }], [ PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ["swipe"] ], [TapRecognizer], [ TapRecognizer, { event: "doubletap", taps: 2 }, ["tap"] ], [PressRecognizer] ]; var STOP = 1; var FORCED_STOP = 2; /** * @private * add/remove the css properties as defined in manager.options.cssProps * @param {Manager} manager * @param {Boolean} add */ function toggleCssProps(manager, add) { var element = manager.element; if (!element.style) return; var prop; each(manager.options.cssProps, function(value, name) { prop = prefixed(element.style, name); if (add) { manager.oldCssProps[prop] = element.style[prop]; element.style[prop] = value; } else element.style[prop] = manager.oldCssProps[prop] || ""; }); if (!add) manager.oldCssProps = {}; } /** * @private * trigger dom event * @param {String} event * @param {Object} data */ function triggerDomEvent(event, data) { var gestureEvent = document.createEvent("Event"); gestureEvent.initEvent(event, true, true); gestureEvent.gesture = data; data.target.dispatchEvent(gestureEvent); } /** * @private * Manager * @param {HTMLElement} element * @param {Object} [options] * @constructor */ var Manager = /* @__PURE__ */ function() { function Manager$2(element, options) { var _this = this; this.options = assign$1({}, defaults, options || {}); this.options.inputTarget = this.options.inputTarget || element; this.handlers = {}; this.session = {}; this.recognizers = []; this.oldCssProps = {}; this.element = element; this.input = createInputInstance(this); this.touchAction = new TouchAction(this, this.options.touchAction); toggleCssProps(this, true); each(this.options.recognizers, function(item) { var recognizer = _this.add(new item[0](item[1])); item[2] && recognizer.recognizeWith(item[2]); item[3] && recognizer.requireFailure(item[3]); }, this); } /** * @private * set options * @param {Object} options * @returns {Manager} */ var _proto = Manager$2.prototype; _proto.set = function set$4(options) { assign$1(this.options, options); if (options.touchAction) this.touchAction.update(); if (options.inputTarget) { this.input.destroy(); this.input.target = options.inputTarget; this.input.init(); } return this; }; /** * @private * stop recognizing for this session. * This session will be discarded, when a new [input]start event is fired. * When forced, the recognizer cycle is stopped immediately. * @param {Boolean} [force] */ _proto.stop = function stop(force) { this.session.stopped = force ? FORCED_STOP : STOP; }; /** * @private * run the recognizers! * called by the inputHandler function on every movement of the pointers (touches) * it walks through all the recognizers and tries to detect the gesture that is being made * @param {Object} inputData */ _proto.recognize = function recognize(inputData) { var session = this.session; if (session.stopped) return; this.touchAction.preventDefaults(inputData); var recognizer; var recognizers = this.recognizers; var curRecognizer = session.curRecognizer; if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) { session.curRecognizer = null; curRecognizer = null; } var i = 0; while (i < recognizers.length) { recognizer = recognizers[i]; if (session.stopped !== FORCED_STOP && (!curRecognizer || recognizer === curRecognizer || recognizer.canRecognizeWith(curRecognizer))) recognizer.recognize(inputData); else recognizer.reset(); if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { session.curRecognizer = recognizer; curRecognizer = recognizer; } i++; } }; /** * @private * get a recognizer by its event name. * @param {Recognizer|String} recognizer * @returns {Recognizer|Null} */ _proto.get = function get(recognizer) { if (recognizer instanceof Recognizer) return recognizer; var recognizers = this.recognizers; for (var i = 0; i < recognizers.length; i++) if (recognizers[i].options.event === recognizer) return recognizers[i]; return null; }; /** * @private add a recognizer to the manager * existing recognizers with the same event name will be removed * @param {Recognizer} recognizer * @returns {Recognizer|Manager} */ _proto.add = function add(recognizer) { if (invokeArrayArg(recognizer, "add", this)) return this; var existing = this.get(recognizer.options.event); if (existing) this.remove(existing); this.recognizers.push(recognizer); recognizer.manager = this; this.touchAction.update(); return recognizer; }; /** * @private * remove a recognizer by name or instance * @param {Recognizer|String} recognizer * @returns {Manager} */ _proto.remove = function remove(recognizer) { if (invokeArrayArg(recognizer, "remove", this)) return this; var targetRecognizer = this.get(recognizer); if (recognizer) { var recognizers = this.recognizers; var index$1 = inArray(recognizers, targetRecognizer); if (index$1 !== -1) { recognizers.splice(index$1, 1); this.touchAction.update(); } } return this; }; /** * @private * bind event * @param {String} events * @param {Function} handler * @returns {EventEmitter} this */ _proto.on = function on(events, handler) { if (events === void 0 || handler === void 0) return this; var handlers = this.handlers; each(splitStr(events), function(event) { handlers[event] = handlers[event] || []; handlers[event].push(handler); }); return this; }; /** * @private unbind event, leave emit blank to remove all handlers * @param {String} events * @param {Function} [handler] * @returns {EventEmitter} this */ _proto.off = function off(events, handler) { if (events === void 0) return this; var handlers = this.handlers; each(splitStr(events), function(event) { if (!handler) delete handlers[event]; else handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); }); return this; }; /** * @private emit event to the listeners * @param {String} event * @param {Object} data */ _proto.emit = function emit(event, data) { if (this.options.domEvents) triggerDomEvent(event, data); var handlers = this.handlers[event] && this.handlers[event].slice(); if (!handlers || !handlers.length) return; data.type = event; data.preventDefault = function() { data.srcEvent.preventDefault(); }; var i = 0; while (i < handlers.length) { handlers[i](data); i++; } }; /** * @private * destroy the manager and unbinds all events * it doesn't unbind dom events, that is the user own responsibility */ _proto.destroy = function destroy() { this.element && toggleCssProps(this, false); this.handlers = {}; this.session = {}; this.input.destroy(); this.element = null; }; return Manager$2; }(); var SINGLE_TOUCH_INPUT_MAP = { touchstart: INPUT_START, touchmove: INPUT_MOVE, touchend: INPUT_END, touchcancel: INPUT_CANCEL }; var SINGLE_TOUCH_TARGET_EVENTS = "touchstart"; var SINGLE_TOUCH_WINDOW_EVENTS = "touchstart touchmove touchend touchcancel"; /** * @private * Touch events input * @constructor * @extends Input */ var SingleTouchInput = /* @__PURE__ */ function(_Input) { _inheritsLoose(SingleTouchInput$2, _Input); function SingleTouchInput$2() { var _this; var proto = SingleTouchInput$2.prototype; proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS; proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS; _this = _Input.apply(this, arguments) || this; _this.started = false; return _this; } var _proto = SingleTouchInput$2.prototype; _proto.handler = function handler(ev) { var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; if (type === INPUT_START) this.started = true; if (!this.started) return; var touches = normalizeSingleTouches.call(this, ev, type); if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) this.started = false; this.callback(this.manager, type, { pointers: touches[0], changedPointers: touches[1], pointerType: INPUT_TYPE_TOUCH, srcEvent: ev }); }; return SingleTouchInput$2; }(Input); function normalizeSingleTouches(ev, type) { var all = toArray(ev.touches); var changed = toArray(ev.changedTouches); if (type & (INPUT_END | INPUT_CANCEL)) all = uniqueArray(all.concat(changed), "identifier", true); return [all, changed]; } /** * @private * wrap a method with a deprecation warning and stack trace * @param {Function} method * @param {String} name * @param {String} message * @returns {Function} A new function wrapping the supplied method. */ function deprecate(method, name, message) { var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n"; return function() { var e = new Error("get-stack-trace"); var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace"; var log = window.console && (window.console.warn || window.console.log); if (log) log.call(window.console, deprecationMessage, stack); return method.apply(this, arguments); }; } /** * @private * extend object. * means that properties in dest will be overwritten by the ones in src. * @param {Object} dest * @param {Object} src * @param {Boolean} [merge=false] * @returns {Object} dest */ var extend = deprecate(function(dest, src, merge$3) { var keys$8 = Object.keys(src); var i = 0; while (i < keys$8.length) { if (!merge$3 || merge$3 && dest[keys$8[i]] === void 0) dest[keys$8[i]] = src[keys$8[i]]; i++; } return dest; }, "extend", "Use `assign`."); /** * @private * merge the values from src in the dest. * means that properties that exist in dest will not be overwritten by src * @param {Object} dest * @param {Object} src * @returns {Object} dest */ var merge$1 = deprecate(function(dest, src) { return extend(dest, src, true); }, "merge", "Use `assign`."); /** * @private * simple class inheritance * @param {Function} child * @param {Function} base * @param {Object} [properties] */ function inherit(child, base, properties) { var baseP = base.prototype; var childP; childP = child.prototype = Object.create(baseP); childP.constructor = child; childP._super = baseP; if (properties) assign$1(childP, properties); } /** * @private * simple function bind * @param {Function} fn * @param {Object} context * @returns {Function} */ function bindFn(fn, context) { return function boundFn() { return fn.apply(context, arguments); }; } /** * @private * Simple way to create a manager with a default set of recognizers. * @param {HTMLElement} element * @param {Object} [options] * @constructor */ var Hammer$2 = /* @__PURE__ */ function() { var Hammer$4 = function Hammer$5(element, options) { if (options === void 0) options = {}; return new Manager(element, _extends({ recognizers: preset.concat() }, options)); }; Hammer$4.VERSION = "2.0.17-rc"; Hammer$4.DIRECTION_ALL = DIRECTION_ALL; Hammer$4.DIRECTION_DOWN = DIRECTION_DOWN; Hammer$4.DIRECTION_LEFT = DIRECTION_LEFT; Hammer$4.DIRECTION_RIGHT = DIRECTION_RIGHT; Hammer$4.DIRECTION_UP = DIRECTION_UP; Hammer$4.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; Hammer$4.DIRECTION_VERTICAL = DIRECTION_VERTICAL; Hammer$4.DIRECTION_NONE = DIRECTION_NONE; Hammer$4.DIRECTION_DOWN = DIRECTION_DOWN; Hammer$4.INPUT_START = INPUT_START; Hammer$4.INPUT_MOVE = INPUT_MOVE; Hammer$4.INPUT_END = INPUT_END; Hammer$4.INPUT_CANCEL = INPUT_CANCEL; Hammer$4.STATE_POSSIBLE = STATE_POSSIBLE; Hammer$4.STATE_BEGAN = STATE_BEGAN; Hammer$4.STATE_CHANGED = STATE_CHANGED; Hammer$4.STATE_ENDED = STATE_ENDED; Hammer$4.STATE_RECOGNIZED = STATE_RECOGNIZED; Hammer$4.STATE_CANCELLED = STATE_CANCELLED; Hammer$4.STATE_FAILED = STATE_FAILED; Hammer$4.Manager = Manager; Hammer$4.Input = Input; Hammer$4.TouchAction = TouchAction; Hammer$4.TouchInput = TouchInput; Hammer$4.MouseInput = MouseInput; Hammer$4.PointerEventInput = PointerEventInput; Hammer$4.TouchMouseInput = TouchMouseInput; Hammer$4.SingleTouchInput = SingleTouchInput; Hammer$4.Recognizer = Recognizer; Hammer$4.AttrRecognizer = AttrRecognizer; Hammer$4.Tap = TapRecognizer; Hammer$4.Pan = PanRecognizer; Hammer$4.Swipe = SwipeRecognizer; Hammer$4.Pinch = PinchRecognizer; Hammer$4.Rotate = RotateRecognizer; Hammer$4.Press = PressRecognizer; Hammer$4.on = addEventListeners; Hammer$4.off = removeEventListeners; Hammer$4.each = each; Hammer$4.merge = merge$1; Hammer$4.extend = extend; Hammer$4.bindFn = bindFn; Hammer$4.assign = assign$1; Hammer$4.inherit = inherit; Hammer$4.bindFn = bindFn; Hammer$4.prefixed = prefixed; Hammer$4.toArray = toArray; Hammer$4.inArray = inArray; Hammer$4.uniqueArray = uniqueArray; Hammer$4.splitStr = splitStr; Hammer$4.boolOrFn = boolOrFn; Hammer$4.hasParent = hasParent; Hammer$4.addEventListeners = addEventListeners; Hammer$4.removeEventListeners = removeEventListeners; Hammer$4.defaults = assign$1({}, defaults, { preset }); return Hammer$4; }(); Hammer$2.defaults; /** * vis-util * https://github.com/visjs/vis-util * * utilitie collection for visjs * * @version 6.0.0 * @date 2025-07-12T18:02:43.836Z * * @copyright (c) 2011-2017 Almende B.V, http://almende.com * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs * * @license * vis.js is dual licensed under both * * 1. The Apache 2.0 License * http://www.apache.org/licenses/LICENSE-2.0 * * and * * 2. The MIT License * http://opensource.org/licenses/MIT * * vis.js may be distributed under either license. */ /** * Seedable, fast and reasonably good (not crypto but more than okay for our * needs) random number generator. * @remarks * Adapted from {@link https://web.archive.org/web/20110429100736/http://baagoe.com:80/en/RandomMusings/javascript}. * Original algorithm created by Johannes Baagøe \ in 2010. */ /** * Create a seeded pseudo random generator based on Alea by Johannes Baagøe. * @param seed - All supplied arguments will be used as a seed. In case nothing * is supplied the current time will be used to seed the generator. * @returns A ready to use seeded generator. */ function Alea(...seed) { return AleaImplementation(seed.length ? seed : [Date.now()]); } /** * An implementation of [[Alea]] without user input validation. * @param seed - The data that will be used to seed the generator. * @returns A ready to use seeded generator. */ function AleaImplementation(seed) { let [s0, s1, s2] = mashSeed(seed); let c$1 = 1; const random = () => { const t = 2091639 * s0 + c$1 * 23283064365386963e-26; s0 = s1; s1 = s2; return s2 = t - (c$1 = t | 0); }; random.uint32 = () => random() * 4294967296; random.fract53 = () => random() + (random() * 2097152 | 0) * 11102230246251565e-32; random.algorithm = "Alea"; random.seed = seed; random.version = "0.9"; return random; } /** * Turn arbitrary data into values [[AleaImplementation]] can use to generate * random numbers. * @param seed - Arbitrary data that will be used as the seed. * @returns Three numbers to use as initial values for [[AleaImplementation]]. */ function mashSeed(...seed) { const mash = Mash(); let s0 = mash(" "); let s1 = mash(" "); let s2 = mash(" "); for (let i = 0; i < seed.length; i++) { s0 -= mash(seed[i]); if (s0 < 0) s0 += 1; s1 -= mash(seed[i]); if (s1 < 0) s1 += 1; s2 -= mash(seed[i]); if (s2 < 0) s2 += 1; } return [ s0, s1, s2 ]; } /** * Create a new mash function. * @returns A nonpure function that takes arbitrary [[Mashable]] data and turns * them into numbers. */ function Mash() { let n = 4022871197; return function(data) { const string$1 = data.toString(); for (let i = 0; i < string$1.length; i++) { n += string$1.charCodeAt(i); let h = .02519603282416938 * n; n = h >>> 0; h -= n; h *= n; n = h >>> 0; h -= n; n += h * 4294967296; } return (n >>> 0) * 23283064365386963e-26; }; } /** * Setup a mock hammer.js object, for unit testing. * * Inspiration: https://github.com/uber/deck.gl/pull/658 * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}} */ function hammerMock() { const noop = () => {}; return { on: noop, off: noop, destroy: noop, emit: noop, get() { return { set: noop }; } }; } const Hammer$1 = typeof window !== "undefined" ? window.Hammer || Hammer$2 : function() { return hammerMock(); }; /** * Turn an element into an clickToUse element. * When not active, the element has a transparent overlay. When the overlay is * clicked, the mode is changed to active. * When active, the element is displayed with a blue border around it, and * the interactive contents of the element can be used. When clicked outside * the element, the elements mode is changed to inactive. * @param {Element} container * @class Activator */ function Activator$1(container) { this._cleanupQueue = []; this.active = false; this._dom = { container, overlay: document.createElement("div") }; this._dom.overlay.classList.add("vis-overlay"); this._dom.container.appendChild(this._dom.overlay); this._cleanupQueue.push(() => { this._dom.overlay.parentNode.removeChild(this._dom.overlay); }); const hammer = Hammer$1(this._dom.overlay); hammer.on("tap", this._onTapOverlay.bind(this)); this._cleanupQueue.push(() => { hammer.destroy(); }); const events = [ "tap", "doubletap", "press", "pinch", "pan", "panstart", "panmove", "panend" ]; events.forEach((event) => { hammer.on(event, (event$1) => { event$1.srcEvent.stopPropagation(); }); }); if (document && document.body) { this._onClick = (event) => { if (!_hasParent(event.target, container)) this.deactivate(); }; document.body.addEventListener("click", this._onClick); this._cleanupQueue.push(() => { document.body.removeEventListener("click", this._onClick); }); } this._escListener = (event) => { if ("key" in event ? event.key === "Escape" : event.keyCode === 27) this.deactivate(); }; } Emitter(Activator$1.prototype); Activator$1.current = null; /** * Destroy the activator. Cleans up all created DOM and event listeners */ Activator$1.prototype.destroy = function() { this.deactivate(); for (const callback of this._cleanupQueue.splice(0).reverse()) callback(); }; /** * Activate the element * Overlay is hidden, element is decorated with a blue shadow border */ Activator$1.prototype.activate = function() { if (Activator$1.current) Activator$1.current.deactivate(); Activator$1.current = this; this.active = true; this._dom.overlay.style.display = "none"; this._dom.container.classList.add("vis-active"); this.emit("change"); this.emit("activate"); document.body.addEventListener("keydown", this._escListener); }; /** * Deactivate the element * Overlay is displayed on top of the element */ Activator$1.prototype.deactivate = function() { this.active = false; this._dom.overlay.style.display = "block"; this._dom.container.classList.remove("vis-active"); document.body.removeEventListener("keydown", this._escListener); this.emit("change"); this.emit("deactivate"); }; /** * Handle a tap event: activate the container * @param {Event} event The event * @private */ Activator$1.prototype._onTapOverlay = function(event) { this.activate(); event.srcEvent.stopPropagation(); }; /** * Test whether the element has the requested parent element somewhere in * its chain of parent nodes. * @param {HTMLElement} element * @param {HTMLElement} parent * @returns {boolean} Returns true when the parent is found somewhere in the * chain of parent nodes. * @private */ function _hasParent(element, parent) { while (element) { if (element === parent) return true; element = element.parentNode; } return false; } const fullHexRE = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; const shortHexRE = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; const rgbRE = /^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i; const rgbaRE = /^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i; /** * Remove everything in the DOM object. * @param DOMobject - Node whose child nodes will be recursively deleted. */ function recursiveDOMDelete(DOMobject) { if (DOMobject) while (DOMobject.hasChildNodes() === true) { const child = DOMobject.firstChild; if (child) { recursiveDOMDelete(child); DOMobject.removeChild(child); } } } /** * Test whether given object is a string. * @param value - Input value of unknown type. * @returns True if string, false otherwise. */ function isString(value) { return value instanceof String || typeof value === "string"; } /** * Test whether given object is a object (not primitive or null). * @param value - Input value of unknown type. * @returns True if not null object, false otherwise. */ function isObject(value) { return typeof value === "object" && value !== null; } /** * Copy property from b to a if property present in a. * If property in b explicitly set to null, delete it if `allowDeletion` set. * * Internal helper routine, should not be exported. Not added to `exports` for that reason. * @param a - Target object. * @param b - Source object. * @param prop - Name of property to copy from b to a. * @param allowDeletion - If true, delete property in a if explicitly set to null in b. */ function copyOrDelete(a, b, prop, allowDeletion) { let doDeletion = false; if (allowDeletion === true) doDeletion = b[prop] === null && a[prop] !== void 0; if (doDeletion) delete a[prop]; else a[prop] = b[prop]; } /** * Fill an object with a possibly partially defined other object. * * Only copies values for the properties already present in a. * That means an object is not created on a property if only the b object has it. * @param a - The object that will have it's properties updated. * @param b - The object with property updates. * @param allowDeletion - If true, delete properties in a that are explicitly set to null in b. */ function fillIfDefined(a, b, allowDeletion = false) { for (const prop in a) if (b[prop] !== void 0) if (b[prop] === null || typeof b[prop] !== "object") copyOrDelete(a, b, prop, allowDeletion); else { const aProp = a[prop]; const bProp = b[prop]; if (isObject(aProp) && isObject(bProp)) fillIfDefined(aProp, bProp, allowDeletion); } } /** * Extend object a with selected properties of object b. * Only properties with defined values are copied. * @remarks * Previous version of this routine implied that multiple source objects could * be used; however, the implementation was **wrong**. Since multiple (\>1) * sources weren't used anywhere in the `vis.js` code, this has been removed * @param props - Names of first-level properties to copy over. * @param a - Target object. * @param b - Source object. * @param allowDeletion - If true, delete property in a if explicitly set to null in b. * @returns Argument a. */ function selectiveDeepExtend(props, a, b, allowDeletion = false) { if (Array.isArray(b)) throw new TypeError("Arrays are not supported by deepExtend"); for (let p = 0; p < props.length; p++) { const prop = props[p]; if (Object.prototype.hasOwnProperty.call(b, prop)) if (b[prop] && b[prop].constructor === Object) { if (a[prop] === void 0) a[prop] = {}; if (a[prop].constructor === Object) deepExtend(a[prop], b[prop], false, allowDeletion); else copyOrDelete(a, b, prop, allowDeletion); } else if (Array.isArray(b[prop])) throw new TypeError("Arrays are not supported by deepExtend"); else copyOrDelete(a, b, prop, allowDeletion); } return a; } /** * Extend object `a` with properties of object `b`, ignoring properties which * are explicitly specified to be excluded. * @remarks * The properties of `b` are considered for copying. Properties which are * themselves objects are are also extended. Only properties with defined * values are copied. * @param propsToExclude - Names of properties which should *not* be copied. * @param a - Object to extend. * @param b - Object to take properties from for extension. * @param allowDeletion - If true, delete properties in a that are explicitly * set to null in b. * @returns Argument a. */ function selectiveNotDeepExtend(propsToExclude, a, b, allowDeletion = false) { if (Array.isArray(b)) throw new TypeError("Arrays are not supported by deepExtend"); for (const prop in b) { if (!Object.prototype.hasOwnProperty.call(b, prop)) continue; if (propsToExclude.includes(prop)) continue; if (b[prop] && b[prop].constructor === Object) { if (a[prop] === void 0) a[prop] = {}; if (a[prop].constructor === Object) deepExtend(a[prop], b[prop]); else copyOrDelete(a, b, prop, allowDeletion); } else if (Array.isArray(b[prop])) { a[prop] = []; for (let i = 0; i < b[prop].length; i++) a[prop].push(b[prop][i]); } else copyOrDelete(a, b, prop, allowDeletion); } return a; } /** * Deep extend an object a with the properties of object b. * @param a - Target object. * @param b - Source object. * @param protoExtend - If true, the prototype values will also be extended. * (That is the options objects that inherit from others will also get the * inherited options). * @param allowDeletion - If true, the values of fields that are null will be deleted. * @returns Argument a. */ function deepExtend(a, b, protoExtend = false, allowDeletion = false) { for (const prop in b) if (Object.prototype.hasOwnProperty.call(b, prop) || protoExtend === true) if (typeof b[prop] === "object" && b[prop] !== null && Object.getPrototypeOf(b[prop]) === Object.prototype) if (a[prop] === void 0) a[prop] = deepExtend({}, b[prop], protoExtend); else if (typeof a[prop] === "object" && a[prop] !== null && Object.getPrototypeOf(a[prop]) === Object.prototype) deepExtend(a[prop], b[prop], protoExtend); else copyOrDelete(a, b, prop, allowDeletion); else if (Array.isArray(b[prop])) a[prop] = b[prop].slice(); else copyOrDelete(a, b, prop, allowDeletion); return a; } /** * Used to extend an array and copy it. This is used to propagate paths recursively. * @param arr - First part. * @param newValue - The value to be aadded into the array. * @returns A new array with all items from arr and newValue (which is last). */ function copyAndExtendArray(arr, newValue) { return [...arr, newValue]; } /** * Used to extend an array and copy it. This is used to propagate paths recursively. * @param arr - The array to be copied. * @returns Shallow copy of arr. */ function copyArray(arr) { return arr.slice(); } /** * Retrieve the absolute left value of a DOM element. * @param elem - A dom element, for example a div. * @returns The absolute left position of this element in the browser page. */ function getAbsoluteLeft(elem) { return elem.getBoundingClientRect().left; } /** * Retrieve the absolute top value of a DOM element. * @param elem - A dom element, for example a div. * @returns The absolute top position of this element in the browser page. */ function getAbsoluteTop(elem) { return elem.getBoundingClientRect().top; } /** * For each method for both arrays and objects. * In case of an array, the built-in Array.forEach() is applied (**No, it's not!**). * In case of an Object, the method loops over all properties of the object. * @param object - An Object or Array to be iterated over. * @param callback - Array.forEach-like callback. */ function forEach$4(object$1, callback) { if (Array.isArray(object$1)) { const len = object$1.length; for (let i = 0; i < len; i++) callback(object$1[i], i, object$1); } else for (const key in object$1) if (Object.prototype.hasOwnProperty.call(object$1, key)) callback(object$1[key], key, object$1); } /** * Convert hex color string into RGB color object. * @remarks * {@link http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb} * @param hex - Hex color string (3 or 6 digits, with or without #). * @returns RGB color object. */ function hexToRGB(hex) { let result; switch (hex.length) { case 3: case 4: result = shortHexRE.exec(hex); return result ? { r: parseInt(result[1] + result[1], 16), g: parseInt(result[2] + result[2], 16), b: parseInt(result[3] + result[3], 16) } : null; case 6: case 7: result = fullHexRE.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; default: return null; } } /** * This function takes string color in hex or RGB format and adds the opacity, RGBA is passed through unchanged. * @param color - The color string (hex, RGB, RGBA). * @param opacity - The new opacity. * @returns RGBA string, for example 'rgba(255, 0, 127, 0.3)'. */ function overrideOpacity(color, opacity) { if (color.includes("rgba")) return color; else if (color.includes("rgb")) { const rgb = color.substr(color.indexOf("(") + 1).replace(")", "").split(","); return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")"; } else { const rgb = hexToRGB(color); if (rgb == null) return color; else return "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + opacity + ")"; } } /** * Convert RGB \<0, 255\> into hex color string. * @param red - Red channel. * @param green - Green channel. * @param blue - Blue channel. * @returns Hex color string (for example: '#0acdc0'). */ function RGBToHex(red, green, blue) { return "#" + ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1); } /** * Parse a color property into an object with border, background, and highlight colors. * @param inputColor - Shorthand color string or input color object. * @param defaultColor - Full color object to fill in missing values in inputColor. * @returns Color object. */ function parseColor(inputColor, defaultColor) { if (isString(inputColor)) { let colorStr = inputColor; if (isValidRGB(colorStr)) { const rgb = colorStr.substr(4).substr(0, colorStr.length - 5).split(",").map(function(value) { return parseInt(value); }); colorStr = RGBToHex(rgb[0], rgb[1], rgb[2]); } if (isValidHex(colorStr) === true) { const hsv = hexToHSV(colorStr); const lighterColorHSV = { h: hsv.h, s: hsv.s * .8, v: Math.min(1, hsv.v * 1.02) }; const darkerColorHSV = { h: hsv.h, s: Math.min(1, hsv.s * 1.25), v: hsv.v * .8 }; const darkerColorHex = HSVToHex(darkerColorHSV.h, darkerColorHSV.s, darkerColorHSV.v); const lighterColorHex = HSVToHex(lighterColorHSV.h, lighterColorHSV.s, lighterColorHSV.v); return { background: colorStr, border: darkerColorHex, highlight: { background: lighterColorHex, border: darkerColorHex }, hover: { background: lighterColorHex, border: darkerColorHex } }; } else return { background: colorStr, border: colorStr, highlight: { background: colorStr, border: colorStr }, hover: { background: colorStr, border: colorStr } }; } else { const color = { background: inputColor.background || void 0, border: inputColor.border || void 0, highlight: isString(inputColor.highlight) ? { border: inputColor.highlight, background: inputColor.highlight } : { background: inputColor.highlight && inputColor.highlight.background || void 0, border: inputColor.highlight && inputColor.highlight.border || void 0 }, hover: isString(inputColor.hover) ? { border: inputColor.hover, background: inputColor.hover } : { border: inputColor.hover && inputColor.hover.border || void 0, background: inputColor.hover && inputColor.hover.background || void 0 } }; return color; } } /** * Convert RGB \<0, 255\> into HSV object. * @remarks * {@link http://www.javascripter.net/faq/rgb2hsv.htm} * @param red - Red channel. * @param green - Green channel. * @param blue - Blue channel. * @returns HSV color object. */ function RGBToHSV(red, green, blue) { red = red / 255; green = green / 255; blue = blue / 255; const minRGB = Math.min(red, Math.min(green, blue)); const maxRGB = Math.max(red, Math.max(green, blue)); if (minRGB === maxRGB) return { h: 0, s: 0, v: minRGB }; const d = red === minRGB ? green - blue : blue === minRGB ? red - green : blue - red; const h = red === minRGB ? 3 : blue === minRGB ? 1 : 5; const hue = 60 * (h - d / (maxRGB - minRGB)) / 360; const saturation = (maxRGB - minRGB) / maxRGB; const value = maxRGB; return { h: hue, s: saturation, v: value }; } /** * Convert HSV \<0, 1\> into RGB color object. * @remarks * {@link https://gist.github.com/mjijackson/5311256} * @param h - Hue. * @param s - Saturation. * @param v - Value. * @returns RGB color object. */ function HSVToRGB(h, s, v) { let r; let g; let b; const i = Math.floor(h * 6); const f = h * 6 - i; const p = v * (1 - s); const q = v * (1 - f * s); const t = v * (1 - (1 - f) * s); switch (i % 6) { case 0: r = v, g = t, b = p; break; case 1: r = q, g = v, b = p; break; case 2: r = p, g = v, b = t; break; case 3: r = p, g = q, b = v; break; case 4: r = t, g = p, b = v; break; case 5: r = v, g = p, b = q; break; } return { r: Math.floor(r * 255), g: Math.floor(g * 255), b: Math.floor(b * 255) }; } /** * Convert HSV \<0, 1\> into hex color string. * @param h - Hue. * @param s - Saturation. * @param v - Value. * @returns Hex color string. */ function HSVToHex(h, s, v) { const rgb = HSVToRGB(h, s, v); return RGBToHex(rgb.r, rgb.g, rgb.b); } /** * Convert hex color string into HSV \<0, 1\>. * @param hex - Hex color string. * @returns HSV color object. */ function hexToHSV(hex) { const rgb = hexToRGB(hex); if (!rgb) throw new TypeError(`'${hex}' is not a valid color.`); return RGBToHSV(rgb.r, rgb.g, rgb.b); } /** * Validate hex color string. * @param hex - Unknown string that may contain a color. * @returns True if the string is valid, false otherwise. */ function isValidHex(hex) { const isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); return isOk; } /** * Validate RGB color string. * @param rgb - Unknown string that may contain a color. * @returns True if the string is valid, false otherwise. */ function isValidRGB(rgb) { return rgbRE.test(rgb); } /** * Validate RGBA color string. * @param rgba - Unknown string that may contain a color. * @returns True if the string is valid, false otherwise. */ function isValidRGBA(rgba) { return rgbaRE.test(rgba); } /** * This recursively redirects the prototype of JSON objects to the referenceObject. * This is used for default options. * @param referenceObject - The original object. * @returns The Element if the referenceObject is an Element, or a new object inheriting from the referenceObject. */ function bridgeObject(referenceObject) { if (referenceObject === null || typeof referenceObject !== "object") return null; if (referenceObject instanceof Element) return referenceObject; const objectTo = Object.create(referenceObject); for (const i in referenceObject) if (Object.prototype.hasOwnProperty.call(referenceObject, i)) { if (typeof referenceObject[i] == "object") objectTo[i] = bridgeObject(referenceObject[i]); } return objectTo; } /** * This is used to set the options of subobjects in the options object. * * A requirement of these subobjects is that they have an 'enabled' element * which is optional for the user but mandatory for the program. * * The added value here of the merge is that option 'enabled' is set as required. * @param mergeTarget - Either this.options or the options used for the groups. * @param options - Options. * @param option - Option key in the options argument. * @param globalOptions - Global options, passed in to determine value of option 'enabled'. */ function mergeOptions(mergeTarget, options, option, globalOptions = {}) { const isPresent = function(obj) { return obj !== null && obj !== void 0; }; const isObject$3 = function(obj) { return obj !== null && typeof obj === "object"; }; const isEmpty = function(obj) { for (const x in obj) if (Object.prototype.hasOwnProperty.call(obj, x)) return false; return true; }; if (!isObject$3(mergeTarget)) throw new Error("Parameter mergeTarget must be an object"); if (!isObject$3(options)) throw new Error("Parameter options must be an object"); if (!isPresent(option)) throw new Error("Parameter option must have a value"); if (!isObject$3(globalOptions)) throw new Error("Parameter globalOptions must be an object"); const doMerge = function(target, options$1, option$1) { if (!isObject$3(target[option$1])) target[option$1] = {}; const src = options$1[option$1]; const dst = target[option$1]; for (const prop in src) if (Object.prototype.hasOwnProperty.call(src, prop)) dst[prop] = src[prop]; }; const srcOption = options[option]; const globalPassed = isObject$3(globalOptions) && !isEmpty(globalOptions); const globalOption = globalPassed ? globalOptions[option] : void 0; const globalEnabled = globalOption ? globalOption.enabled : void 0; if (srcOption === void 0) return; if (typeof srcOption === "boolean") { if (!isObject$3(mergeTarget[option])) mergeTarget[option] = {}; mergeTarget[option].enabled = srcOption; return; } if (srcOption === null && !isObject$3(mergeTarget[option])) if (isPresent(globalOption)) mergeTarget[option] = Object.create(globalOption); else return; if (!isObject$3(srcOption)) return; let enabled = true; if (srcOption.enabled !== void 0) enabled = srcOption.enabled; else if (globalEnabled !== void 0) enabled = globalOption.enabled; doMerge(mergeTarget, options, option); mergeTarget[option].enabled = enabled; } const easingFunctions = { linear(t) { return t; }, easeInQuad(t) { return t * t; }, easeOutQuad(t) { return t * (2 - t); }, easeInOutQuad(t) { return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t; }, easeInCubic(t) { return t * t * t; }, easeOutCubic(t) { return --t * t * t + 1; }, easeInOutCubic(t) { return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; }, easeInQuart(t) { return t * t * t * t; }, easeOutQuart(t) { return 1 - --t * t * t * t; }, easeInOutQuart(t) { return t < .5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t; }, easeInQuint(t) { return t * t * t * t * t; }, easeOutQuint(t) { return 1 + --t * t * t * t * t; }, easeInOutQuint(t) { return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t; } }; /** * Get the top most property value from a pile of objects. * @param pile - Array of objects, no required format. * @param accessors - Array of property names. * For example `object['foo']['bar']` → `['foo', 'bar']`. * @returns Value of the property with given accessors path from the first pile item where it's not undefined. */ function topMost(pile, accessors) { let candidate; if (!Array.isArray(accessors)) accessors = [accessors]; for (const member of pile) if (member) { candidate = member[accessors[0]]; for (let i = 1; i < accessors.length; i++) if (candidate) candidate = candidate[accessors[i]]; if (typeof candidate !== "undefined") break; } return candidate; } const htmlColors = { black: "#000000", navy: "#000080", darkblue: "#00008B", mediumblue: "#0000CD", blue: "#0000FF", darkgreen: "#006400", green: "#008000", teal: "#008080", darkcyan: "#008B8B", deepskyblue: "#00BFFF", darkturquoise: "#00CED1", mediumspringgreen: "#00FA9A", lime: "#00FF00", springgreen: "#00FF7F", aqua: "#00FFFF", cyan: "#00FFFF", midnightblue: "#191970", dodgerblue: "#1E90FF", lightseagreen: "#20B2AA", forestgreen: "#228B22", seagreen: "#2E8B57", darkslategray: "#2F4F4F", limegreen: "#32CD32", mediumseagreen: "#3CB371", turquoise: "#40E0D0", royalblue: "#4169E1", steelblue: "#4682B4", darkslateblue: "#483D8B", mediumturquoise: "#48D1CC", indigo: "#4B0082", darkolivegreen: "#556B2F", cadetblue: "#5F9EA0", cornflowerblue: "#6495ED", mediumaquamarine: "#66CDAA", dimgray: "#696969", slateblue: "#6A5ACD", olivedrab: "#6B8E23", slategray: "#708090", lightslategray: "#778899", mediumslateblue: "#7B68EE", lawngreen: "#7CFC00", chartreuse: "#7FFF00", aquamarine: "#7FFFD4", maroon: "#800000", purple: "#800080", olive: "#808000", gray: "#808080", skyblue: "#87CEEB", lightskyblue: "#87CEFA", blueviolet: "#8A2BE2", darkred: "#8B0000", darkmagenta: "#8B008B", saddlebrown: "#8B4513", darkseagreen: "#8FBC8F", lightgreen: "#90EE90", mediumpurple: "#9370D8", darkviolet: "#9400D3", palegreen: "#98FB98", darkorchid: "#9932CC", yellowgreen: "#9ACD32", sienna: "#A0522D", brown: "#A52A2A", darkgray: "#A9A9A9", lightblue: "#ADD8E6", greenyellow: "#ADFF2F", paleturquoise: "#AFEEEE", lightsteelblue: "#B0C4DE", powderblue: "#B0E0E6", firebrick: "#B22222", darkgoldenrod: "#B8860B", mediumorchid: "#BA55D3", rosybrown: "#BC8F8F", darkkhaki: "#BDB76B", silver: "#C0C0C0", mediumvioletred: "#C71585", indianred: "#CD5C5C", peru: "#CD853F", chocolate: "#D2691E", tan: "#D2B48C", lightgrey: "#D3D3D3", palevioletred: "#D87093", thistle: "#D8BFD8", orchid: "#DA70D6", goldenrod: "#DAA520", crimson: "#DC143C", gainsboro: "#DCDCDC", plum: "#DDA0DD", burlywood: "#DEB887", lightcyan: "#E0FFFF", lavender: "#E6E6FA", darksalmon: "#E9967A", violet: "#EE82EE", palegoldenrod: "#EEE8AA", lightcoral: "#F08080", khaki: "#F0E68C", aliceblue: "#F0F8FF", honeydew: "#F0FFF0", azure: "#F0FFFF", sandybrown: "#F4A460", wheat: "#F5DEB3", beige: "#F5F5DC", whitesmoke: "#F5F5F5", mintcream: "#F5FFFA", ghostwhite: "#F8F8FF", salmon: "#FA8072", antiquewhite: "#FAEBD7", linen: "#FAF0E6", lightgoldenrodyellow: "#FAFAD2", oldlace: "#FDF5E6", red: "#FF0000", fuchsia: "#FF00FF", magenta: "#FF00FF", deeppink: "#FF1493", orangered: "#FF4500", tomato: "#FF6347", hotpink: "#FF69B4", coral: "#FF7F50", darkorange: "#FF8C00", lightsalmon: "#FFA07A", orange: "#FFA500", lightpink: "#FFB6C1", pink: "#FFC0CB", gold: "#FFD700", peachpuff: "#FFDAB9", navajowhite: "#FFDEAD", moccasin: "#FFE4B5", bisque: "#FFE4C4", mistyrose: "#FFE4E1", blanchedalmond: "#FFEBCD", papayawhip: "#FFEFD5", lavenderblush: "#FFF0F5", seashell: "#FFF5EE", cornsilk: "#FFF8DC", lemonchiffon: "#FFFACD", floralwhite: "#FFFAF0", snow: "#FFFAFA", yellow: "#FFFF00", lightyellow: "#FFFFE0", ivory: "#FFFFF0", white: "#FFFFFF" }; /** * @param {number} [pixelRatio=1] */ let ColorPicker$1 = class ColorPicker { /** * @param {number} [pixelRatio] */ constructor(pixelRatio = 1) { this.pixelRatio = pixelRatio; this.generated = false; this.centerCoordinates = { x: 289 / 2, y: 289 / 2 }; this.r = 289 * .49; this.color = { r: 255, g: 255, b: 255, a: 1 }; this.hueCircle = void 0; this.initialColor = { r: 255, g: 255, b: 255, a: 1 }; this.previousColor = void 0; this.applied = false; this.updateCallback = () => {}; this.closeCallback = () => {}; this._create(); } /** * this inserts the colorPicker into a div from the DOM * @param {Element} container */ insertTo(container) { if (this.hammer !== void 0) { this.hammer.destroy(); this.hammer = void 0; } this.container = container; this.container.appendChild(this.frame); this._bindHammer(); this._setSize(); } /** * the callback is executed on apply and save. Bind it to the application * @param {Function} callback */ setUpdateCallback(callback) { if (typeof callback === "function") this.updateCallback = callback; else throw new Error("Function attempted to set as colorPicker update callback is not a function."); } /** * the callback is executed on apply and save. Bind it to the application * @param {Function} callback */ setCloseCallback(callback) { if (typeof callback === "function") this.closeCallback = callback; else throw new Error("Function attempted to set as colorPicker closing callback is not a function."); } /** * * @param {string} color * @returns {string} * @private */ _isColorString(color) { if (typeof color === "string") return htmlColors[color]; } /** * Set the color of the colorPicker * Supported formats: * 'red' --> HTML color string * '#ffffff' --> hex string * 'rgb(255,255,255)' --> rgb string * 'rgba(255,255,255,1.0)' --> rgba string * {r:255,g:255,b:255} --> rgb object * {r:255,g:255,b:255,a:1.0} --> rgba object * @param {string | object} color * @param {boolean} [setInitial] */ setColor(color, setInitial = true) { if (color === "none") return; let rgba; const htmlColor = this._isColorString(color); if (htmlColor !== void 0) color = htmlColor; if (isString(color) === true) { if (isValidRGB(color) === true) { const rgbaArray = color.substr(4).substr(0, color.length - 5).split(","); rgba = { r: rgbaArray[0], g: rgbaArray[1], b: rgbaArray[2], a: 1 }; } else if (isValidRGBA(color) === true) { const rgbaArray = color.substr(5).substr(0, color.length - 6).split(","); rgba = { r: rgbaArray[0], g: rgbaArray[1], b: rgbaArray[2], a: rgbaArray[3] }; } else if (isValidHex(color) === true) { const rgbObj = hexToRGB(color); rgba = { r: rgbObj.r, g: rgbObj.g, b: rgbObj.b, a: 1 }; } } else if (color instanceof Object) { if (color.r !== void 0 && color.g !== void 0 && color.b !== void 0) { const alpha = color.a !== void 0 ? color.a : "1.0"; rgba = { r: color.r, g: color.g, b: color.b, a: alpha }; } } if (rgba === void 0) throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + JSON.stringify(color)); else this._setColor(rgba, setInitial); } /** * this shows the color picker. * The hue circle is constructed once and stored. */ show() { if (this.closeCallback !== void 0) { this.closeCallback(); this.closeCallback = void 0; } this.applied = false; this.frame.style.display = "block"; this._generateHueCircle(); } /** * Hide the picker. Is called by the cancel button. * Optional boolean to store the previous color for easy access later on. * @param {boolean} [storePrevious] * @private */ _hide(storePrevious = true) { if (storePrevious === true) this.previousColor = Object.assign({}, this.color); if (this.applied === true) this.updateCallback(this.initialColor); this.frame.style.display = "none"; setTimeout(() => { if (this.closeCallback !== void 0) { this.closeCallback(); this.closeCallback = void 0; } }, 0); } /** * bound to the save button. Saves and hides. * @private */ _save() { this.updateCallback(this.color); this.applied = false; this._hide(); } /** * Bound to apply button. Saves but does not close. Is undone by the cancel button. * @private */ _apply() { this.applied = true; this.updateCallback(this.color); this._updatePicker(this.color); } /** * load the color from the previous session. * @private */ _loadLast() { if (this.previousColor !== void 0) this.setColor(this.previousColor, false); else alert("There is no last color to load..."); } /** * set the color, place the picker * @param {object} rgba * @param {boolean} [setInitial] * @private */ _setColor(rgba, setInitial = true) { if (setInitial === true) this.initialColor = Object.assign({}, rgba); this.color = rgba; const hsv = RGBToHSV(rgba.r, rgba.g, rgba.b); const angleConvert = 2 * Math.PI; const radius = this.r * hsv.s; const x = this.centerCoordinates.x + radius * Math.sin(angleConvert * hsv.h); const y = this.centerCoordinates.y + radius * Math.cos(angleConvert * hsv.h); this.colorPickerSelector.style.left = x - .5 * this.colorPickerSelector.clientWidth + "px"; this.colorPickerSelector.style.top = y - .5 * this.colorPickerSelector.clientHeight + "px"; this._updatePicker(rgba); } /** * bound to opacity control * @param {number} value * @private */ _setOpacity(value) { this.color.a = value / 100; this._updatePicker(this.color); } /** * bound to brightness control * @param {number} value * @private */ _setBrightness(value) { const hsv = RGBToHSV(this.color.r, this.color.g, this.color.b); hsv.v = value / 100; const rgba = HSVToRGB(hsv.h, hsv.s, hsv.v); rgba["a"] = this.color.a; this.color = rgba; this._updatePicker(); } /** * update the color picker. A black circle overlays the hue circle to mimic the brightness decreasing. * @param {object} rgba * @private */ _updatePicker(rgba = this.color) { const hsv = RGBToHSV(rgba.r, rgba.g, rgba.b); const ctx = this.colorPickerCanvas.getContext("2d"); if (this.pixelRation === void 0) this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); const w = this.colorPickerCanvas.clientWidth; const h = this.colorPickerCanvas.clientHeight; ctx.clearRect(0, 0, w, h); ctx.putImageData(this.hueCircle, 0, 0); ctx.fillStyle = "rgba(0,0,0," + (1 - hsv.v) + ")"; ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); ctx.fill(); this.brightnessRange.value = 100 * hsv.v; this.opacityRange.value = 100 * rgba.a; this.initialColorDiv.style.backgroundColor = "rgba(" + this.initialColor.r + "," + this.initialColor.g + "," + this.initialColor.b + "," + this.initialColor.a + ")"; this.newColorDiv.style.backgroundColor = "rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + this.color.a + ")"; } /** * used by create to set the size of the canvas. * @private */ _setSize() { this.colorPickerCanvas.style.width = "100%"; this.colorPickerCanvas.style.height = "100%"; this.colorPickerCanvas.width = 289 * this.pixelRatio; this.colorPickerCanvas.height = 289 * this.pixelRatio; } /** * create all dom elements * TODO: cleanup, lots of similar dom elements * @private */ _create() { this.frame = document.createElement("div"); this.frame.className = "vis-color-picker"; this.colorPickerDiv = document.createElement("div"); this.colorPickerSelector = document.createElement("div"); this.colorPickerSelector.className = "vis-selector"; this.colorPickerDiv.appendChild(this.colorPickerSelector); this.colorPickerCanvas = document.createElement("canvas"); this.colorPickerDiv.appendChild(this.colorPickerCanvas); if (!this.colorPickerCanvas.getContext) { const noCanvas = document.createElement("DIV"); noCanvas.style.color = "red"; noCanvas.style.fontWeight = "bold"; noCanvas.style.padding = "10px"; noCanvas.innerText = "Error: your browser does not support HTML canvas"; this.colorPickerCanvas.appendChild(noCanvas); } else { const ctx = this.colorPickerCanvas.getContext("2d"); this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); } this.colorPickerDiv.className = "vis-color"; this.opacityDiv = document.createElement("div"); this.opacityDiv.className = "vis-opacity"; this.brightnessDiv = document.createElement("div"); this.brightnessDiv.className = "vis-brightness"; this.arrowDiv = document.createElement("div"); this.arrowDiv.className = "vis-arrow"; this.opacityRange = document.createElement("input"); try { this.opacityRange.type = "range"; this.opacityRange.min = "0"; this.opacityRange.max = "100"; } catch (err) {} this.opacityRange.value = "100"; this.opacityRange.className = "vis-range"; this.brightnessRange = document.createElement("input"); try { this.brightnessRange.type = "range"; this.brightnessRange.min = "0"; this.brightnessRange.max = "100"; } catch (err) {} this.brightnessRange.value = "100"; this.brightnessRange.className = "vis-range"; this.opacityDiv.appendChild(this.opacityRange); this.brightnessDiv.appendChild(this.brightnessRange); const me = this; this.opacityRange.onchange = function() { me._setOpacity(this.value); }; this.opacityRange.oninput = function() { me._setOpacity(this.value); }; this.brightnessRange.onchange = function() { me._setBrightness(this.value); }; this.brightnessRange.oninput = function() { me._setBrightness(this.value); }; this.brightnessLabel = document.createElement("div"); this.brightnessLabel.className = "vis-label vis-brightness"; this.brightnessLabel.innerText = "brightness:"; this.opacityLabel = document.createElement("div"); this.opacityLabel.className = "vis-label vis-opacity"; this.opacityLabel.innerText = "opacity:"; this.newColorDiv = document.createElement("div"); this.newColorDiv.className = "vis-new-color"; this.newColorDiv.innerText = "new"; this.initialColorDiv = document.createElement("div"); this.initialColorDiv.className = "vis-initial-color"; this.initialColorDiv.innerText = "initial"; this.cancelButton = document.createElement("div"); this.cancelButton.className = "vis-button vis-cancel"; this.cancelButton.innerText = "cancel"; this.cancelButton.onclick = this._hide.bind(this, false); this.applyButton = document.createElement("div"); this.applyButton.className = "vis-button vis-apply"; this.applyButton.innerText = "apply"; this.applyButton.onclick = this._apply.bind(this); this.saveButton = document.createElement("div"); this.saveButton.className = "vis-button vis-save"; this.saveButton.innerText = "save"; this.saveButton.onclick = this._save.bind(this); this.loadButton = document.createElement("div"); this.loadButton.className = "vis-button vis-load"; this.loadButton.innerText = "load last"; this.loadButton.onclick = this._loadLast.bind(this); this.frame.appendChild(this.colorPickerDiv); this.frame.appendChild(this.arrowDiv); this.frame.appendChild(this.brightnessLabel); this.frame.appendChild(this.brightnessDiv); this.frame.appendChild(this.opacityLabel); this.frame.appendChild(this.opacityDiv); this.frame.appendChild(this.newColorDiv); this.frame.appendChild(this.initialColorDiv); this.frame.appendChild(this.cancelButton); this.frame.appendChild(this.applyButton); this.frame.appendChild(this.saveButton); this.frame.appendChild(this.loadButton); } /** * bind hammer to the color picker * @private */ _bindHammer() { this.drag = {}; this.pinch = {}; this.hammer = new Hammer$1(this.colorPickerCanvas); this.hammer.get("pinch").set({ enable: true }); this.hammer.on("hammer.input", (event) => { if (event.isFirst) this._moveSelector(event); }); this.hammer.on("tap", (event) => { this._moveSelector(event); }); this.hammer.on("panstart", (event) => { this._moveSelector(event); }); this.hammer.on("panmove", (event) => { this._moveSelector(event); }); this.hammer.on("panend", (event) => { this._moveSelector(event); }); } /** * generate the hue circle. This is relatively heavy (200ms) and is done only once on the first time it is shown. * @private */ _generateHueCircle() { if (this.generated === false) { const ctx = this.colorPickerCanvas.getContext("2d"); if (this.pixelRation === void 0) this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); const w = this.colorPickerCanvas.clientWidth; const h = this.colorPickerCanvas.clientHeight; ctx.clearRect(0, 0, w, h); let x, y, hue, sat; this.centerCoordinates = { x: w * .5, y: h * .5 }; this.r = .49 * w; const angleConvert = 2 * Math.PI / 360; const hfac = 1 / 360; const sfac = 1 / this.r; let rgb; for (hue = 0; hue < 360; hue++) for (sat = 0; sat < this.r; sat++) { x = this.centerCoordinates.x + sat * Math.sin(angleConvert * hue); y = this.centerCoordinates.y + sat * Math.cos(angleConvert * hue); rgb = HSVToRGB(hue * hfac, sat * sfac, 1); ctx.fillStyle = "rgb(" + rgb.r + "," + rgb.g + "," + rgb.b + ")"; ctx.fillRect(x - .5, y - .5, 2, 2); } ctx.strokeStyle = "rgba(0,0,0,1)"; ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); ctx.stroke(); this.hueCircle = ctx.getImageData(0, 0, w, h); } this.generated = true; } /** * move the selector. This is called by hammer functions. * @param {Event} event The event * @private */ _moveSelector(event) { const rect = this.colorPickerDiv.getBoundingClientRect(); const left = event.center.x - rect.left; const top = event.center.y - rect.top; const centerY = .5 * this.colorPickerDiv.clientHeight; const centerX = .5 * this.colorPickerDiv.clientWidth; const x = left - centerX; const y = top - centerY; const angle = Math.atan2(x, y); const radius = .98 * Math.min(Math.sqrt(x * x + y * y), centerX); const newTop = Math.cos(angle) * radius + centerY; const newLeft = Math.sin(angle) * radius + centerX; this.colorPickerSelector.style.top = newTop - .5 * this.colorPickerSelector.clientHeight + "px"; this.colorPickerSelector.style.left = newLeft - .5 * this.colorPickerSelector.clientWidth + "px"; let h = angle / (2 * Math.PI); h = h < 0 ? h + 1 : h; const s = radius / this.r; const hsv = RGBToHSV(this.color.r, this.color.g, this.color.b); hsv.h = h; hsv.s = s; const rgba = HSVToRGB(hsv.h, hsv.s, hsv.v); rgba["a"] = this.color.a; this.color = rgba; this.initialColorDiv.style.backgroundColor = "rgba(" + this.initialColor.r + "," + this.initialColor.g + "," + this.initialColor.b + "," + this.initialColor.a + ")"; this.newColorDiv.style.backgroundColor = "rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + this.color.a + ")"; } }; /** * Wrap given text (last argument) in HTML elements (all preceding arguments). * @param {...any} rest - List of tag names followed by inner text. * @returns An element or a text node. */ function wrapInTag(...rest) { if (rest.length < 1) throw new TypeError("Invalid arguments."); else if (rest.length === 1) return document.createTextNode(rest[0]); else { const element = document.createElement(rest[0]); element.appendChild(wrapInTag(...rest.slice(1))); return element; } } /** * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options. * Boolean options are recognised as Boolean * Number options should be written as array: [default value, min value, max value, stepsize] * Colors should be written as array: ['color', '#ffffff'] * Strings with should be written as array: [option1, option2, option3, ..] * * The options are matched with their counterparts in each of the modules and the values used in the configuration are */ let Configurator$1 = class Configurator$2 { /** * @param {object} parentModule | the location where parentModule.setOptions() can be called * @param {object} defaultContainer | the default container of the module * @param {object} configureOptions | the fully configured and predefined options set found in allOptions.js * @param {number} pixelRatio | canvas pixel ratio * @param {Function} hideOption | custom logic to dynamically hide options */ constructor(parentModule, defaultContainer, configureOptions$1, pixelRatio = 1, hideOption = () => false) { this.parent = parentModule; this.changedOptions = []; this.container = defaultContainer; this.allowCreation = false; this.hideOption = hideOption; this.options = {}; this.initialized = false; this.popupCounter = 0; this.defaultOptions = { enabled: false, filter: true, container: void 0, showButton: true }; Object.assign(this.options, this.defaultOptions); this.configureOptions = configureOptions$1; this.moduleOptions = {}; this.domElements = []; this.popupDiv = {}; this.popupLimit = 5; this.popupHistory = {}; this.colorPicker = new ColorPicker$1(pixelRatio); this.wrapper = void 0; } /** * refresh all options. * Because all modules parse their options by themselves, we just use their options. We copy them here. * @param {object} options */ setOptions(options) { if (options !== void 0) { this.popupHistory = {}; this._removePopup(); let enabled = true; if (typeof options === "string") this.options.filter = options; else if (Array.isArray(options)) this.options.filter = options.join(); else if (typeof options === "object") { if (options == null) throw new TypeError("options cannot be null"); if (options.container !== void 0) this.options.container = options.container; if (options.filter !== void 0) this.options.filter = options.filter; if (options.showButton !== void 0) this.options.showButton = options.showButton; if (options.enabled !== void 0) enabled = options.enabled; } else if (typeof options === "boolean") { this.options.filter = true; enabled = options; } else if (typeof options === "function") { this.options.filter = options; enabled = true; } if (this.options.filter === false) enabled = false; this.options.enabled = enabled; } this._clean(); } /** * * @param {object} moduleOptions */ setModuleOptions(moduleOptions) { this.moduleOptions = moduleOptions; if (this.options.enabled === true) { this._clean(); if (this.options.container !== void 0) this.container = this.options.container; this._create(); } } /** * Create all DOM elements * @private */ _create() { this._clean(); this.changedOptions = []; const filter$5 = this.options.filter; let counter = 0; let show = false; for (const option in this.configureOptions) if (Object.prototype.hasOwnProperty.call(this.configureOptions, option)) { this.allowCreation = false; show = false; if (typeof filter$5 === "function") { show = filter$5(option, []); show = show || this._handleObject(this.configureOptions[option], [option], true); } else if (filter$5 === true || filter$5.indexOf(option) !== -1) show = true; if (show !== false) { this.allowCreation = true; if (counter > 0) this._makeItem([]); this._makeHeader(option); this._handleObject(this.configureOptions[option], [option]); } counter++; } this._makeButton(); this._push(); } /** * draw all DOM elements on the screen * @private */ _push() { this.wrapper = document.createElement("div"); this.wrapper.className = "vis-configuration-wrapper"; this.container.appendChild(this.wrapper); for (let i = 0; i < this.domElements.length; i++) this.wrapper.appendChild(this.domElements[i]); this._showPopupIfNeeded(); } /** * delete all DOM elements * @private */ _clean() { for (let i = 0; i < this.domElements.length; i++) this.wrapper.removeChild(this.domElements[i]); if (this.wrapper !== void 0) { this.container.removeChild(this.wrapper); this.wrapper = void 0; } this.domElements = []; this._removePopup(); } /** * get the value from the actualOptions if it exists * @param {Array} path | where to look for the actual option * @returns {*} * @private */ _getValue(path$2) { let base = this.moduleOptions; for (let i = 0; i < path$2.length; i++) if (base[path$2[i]] !== void 0) base = base[path$2[i]]; else { base = void 0; break; } return base; } /** * all option elements are wrapped in an item * @param {Array} path | where to look for the actual option * @param {Array.} domElements * @returns {number} * @private */ _makeItem(path$2, ...domElements) { if (this.allowCreation === true) { const item = document.createElement("div"); item.className = "vis-configuration vis-config-item vis-config-s" + path$2.length; domElements.forEach((element) => { item.appendChild(element); }); this.domElements.push(item); return this.domElements.length; } return 0; } /** * header for major subjects * @param {string} name * @private */ _makeHeader(name) { const div = document.createElement("div"); div.className = "vis-configuration vis-config-header"; div.innerText = name; this._makeItem([], div); } /** * make a label, if it is an object label, it gets different styling. * @param {string} name * @param {Array} path | where to look for the actual option * @param {string} objectLabel * @returns {HTMLElement} * @private */ _makeLabel(name, path$2, objectLabel = false) { const div = document.createElement("div"); div.className = "vis-configuration vis-config-label vis-config-s" + path$2.length; if (objectLabel === true) { while (div.firstChild) div.removeChild(div.firstChild); div.appendChild(wrapInTag("i", "b", name)); } else div.innerText = name + ":"; return div; } /** * make a dropdown list for multiple possible string optoins * @param {Array.} arr * @param {number} value * @param {Array} path | where to look for the actual option * @private */ _makeDropdown(arr, value, path$2) { const select = document.createElement("select"); select.className = "vis-configuration vis-config-select"; let selectedValue = 0; if (value !== void 0) { if (arr.indexOf(value) !== -1) selectedValue = arr.indexOf(value); } for (let i = 0; i < arr.length; i++) { const option = document.createElement("option"); option.value = arr[i]; if (i === selectedValue) option.selected = "selected"; option.innerText = arr[i]; select.appendChild(option); } const me = this; select.onchange = function() { me._update(this.value, path$2); }; const label = this._makeLabel(path$2[path$2.length - 1], path$2); this._makeItem(path$2, label, select); } /** * make a range object for numeric options * @param {Array.} arr * @param {number} value * @param {Array} path | where to look for the actual option * @private */ _makeRange(arr, value, path$2) { const defaultValue = arr[0]; const min = arr[1]; const max = arr[2]; const step = arr[3]; const range = document.createElement("input"); range.className = "vis-configuration vis-config-range"; try { range.type = "range"; range.min = min; range.max = max; } catch (err) {} range.step = step; let popupString = ""; let popupValue = 0; if (value !== void 0) { const factor = 1.2; if (value < 0 && value * factor < min) { range.min = Math.ceil(value * factor); popupValue = range.min; popupString = "range increased"; } else if (value / factor < min) { range.min = Math.ceil(value / factor); popupValue = range.min; popupString = "range increased"; } if (value * factor > max && max !== 1) { range.max = Math.ceil(value * factor); popupValue = range.max; popupString = "range increased"; } range.value = value; } else range.value = defaultValue; const input = document.createElement("input"); input.className = "vis-configuration vis-config-rangeinput"; input.value = range.value; const me = this; range.onchange = function() { input.value = this.value; me._update(Number(this.value), path$2); }; range.oninput = function() { input.value = this.value; }; const label = this._makeLabel(path$2[path$2.length - 1], path$2); const itemIndex = this._makeItem(path$2, label, range, input); if (popupString !== "" && this.popupHistory[itemIndex] !== popupValue) { this.popupHistory[itemIndex] = popupValue; this._setupPopup(popupString, itemIndex); } } /** * make a button object * @private */ _makeButton() { if (this.options.showButton === true) { const generateButton = document.createElement("div"); generateButton.className = "vis-configuration vis-config-button"; generateButton.innerText = "generate options"; generateButton.onclick = () => { this._printOptions(); }; generateButton.onmouseover = () => { generateButton.className = "vis-configuration vis-config-button hover"; }; generateButton.onmouseout = () => { generateButton.className = "vis-configuration vis-config-button"; }; this.optionsContainer = document.createElement("div"); this.optionsContainer.className = "vis-configuration vis-config-option-container"; this.domElements.push(this.optionsContainer); this.domElements.push(generateButton); } } /** * prepare the popup * @param {string} string * @param {number} index * @private */ _setupPopup(string$1, index$1) { if (this.initialized === true && this.allowCreation === true && this.popupCounter < this.popupLimit) { const div = document.createElement("div"); div.id = "vis-configuration-popup"; div.className = "vis-configuration-popup"; div.innerText = string$1; div.onclick = () => { this._removePopup(); }; this.popupCounter += 1; this.popupDiv = { html: div, index: index$1 }; } } /** * remove the popup from the dom * @private */ _removePopup() { if (this.popupDiv.html !== void 0) { this.popupDiv.html.parentNode.removeChild(this.popupDiv.html); clearTimeout(this.popupDiv.hideTimeout); clearTimeout(this.popupDiv.deleteTimeout); this.popupDiv = {}; } } /** * Show the popup if it is needed. * @private */ _showPopupIfNeeded() { if (this.popupDiv.html !== void 0) { const correspondingElement = this.domElements[this.popupDiv.index]; const rect = correspondingElement.getBoundingClientRect(); this.popupDiv.html.style.left = rect.left + "px"; this.popupDiv.html.style.top = rect.top - 30 + "px"; document.body.appendChild(this.popupDiv.html); this.popupDiv.hideTimeout = setTimeout(() => { this.popupDiv.html.style.opacity = 0; }, 1500); this.popupDiv.deleteTimeout = setTimeout(() => { this._removePopup(); }, 1800); } } /** * make a checkbox for boolean options. * @param {number} defaultValue * @param {number} value * @param {Array} path | where to look for the actual option * @private */ _makeCheckbox(defaultValue, value, path$2) { const checkbox = document.createElement("input"); checkbox.type = "checkbox"; checkbox.className = "vis-configuration vis-config-checkbox"; checkbox.checked = defaultValue; if (value !== void 0) { checkbox.checked = value; if (value !== defaultValue) if (typeof defaultValue === "object") { if (value !== defaultValue.enabled) this.changedOptions.push({ path: path$2, value }); } else this.changedOptions.push({ path: path$2, value }); } const me = this; checkbox.onchange = function() { me._update(this.checked, path$2); }; const label = this._makeLabel(path$2[path$2.length - 1], path$2); this._makeItem(path$2, label, checkbox); } /** * make a text input field for string options. * @param {number} defaultValue * @param {number} value * @param {Array} path | where to look for the actual option * @private */ _makeTextInput(defaultValue, value, path$2) { const checkbox = document.createElement("input"); checkbox.type = "text"; checkbox.className = "vis-configuration vis-config-text"; checkbox.value = value; if (value !== defaultValue) this.changedOptions.push({ path: path$2, value }); const me = this; checkbox.onchange = function() { me._update(this.value, path$2); }; const label = this._makeLabel(path$2[path$2.length - 1], path$2); this._makeItem(path$2, label, checkbox); } /** * make a color field with a color picker for color fields * @param {Array.} arr * @param {number} value * @param {Array} path | where to look for the actual option * @private */ _makeColorField(arr, value, path$2) { const defaultColor = arr[1]; const div = document.createElement("div"); value = value === void 0 ? defaultColor : value; if (value !== "none") { div.className = "vis-configuration vis-config-colorBlock"; div.style.backgroundColor = value; } else div.className = "vis-configuration vis-config-colorBlock none"; value = value === void 0 ? defaultColor : value; div.onclick = () => { this._showColorPicker(value, div, path$2); }; const label = this._makeLabel(path$2[path$2.length - 1], path$2); this._makeItem(path$2, label, div); } /** * used by the color buttons to call the color picker. * @param {number} value * @param {HTMLElement} div * @param {Array} path | where to look for the actual option * @private */ _showColorPicker(value, div, path$2) { div.onclick = function() {}; this.colorPicker.insertTo(div); this.colorPicker.show(); this.colorPicker.setColor(value); this.colorPicker.setUpdateCallback((color) => { const colorString = "rgba(" + color.r + "," + color.g + "," + color.b + "," + color.a + ")"; div.style.backgroundColor = colorString; this._update(colorString, path$2); }); this.colorPicker.setCloseCallback(() => { div.onclick = () => { this._showColorPicker(value, div, path$2); }; }); } /** * parse an object and draw the correct items * @param {object} obj * @param {Array} [path] | where to look for the actual option * @param {boolean} [checkOnly] * @returns {boolean} * @private */ _handleObject(obj, path$2 = [], checkOnly = false) { let show = false; const filter$5 = this.options.filter; let visibleInSet = false; for (const subObj in obj) if (Object.prototype.hasOwnProperty.call(obj, subObj)) { show = true; const item = obj[subObj]; const newPath = copyAndExtendArray(path$2, subObj); if (typeof filter$5 === "function") { show = filter$5(subObj, path$2); if (show === false) { if (!Array.isArray(item) && typeof item !== "string" && typeof item !== "boolean" && item instanceof Object) { this.allowCreation = false; show = this._handleObject(item, newPath, true); this.allowCreation = checkOnly === false; } } } if (show !== false) { visibleInSet = true; const value = this._getValue(newPath); if (Array.isArray(item)) this._handleArray(item, value, newPath); else if (typeof item === "string") this._makeTextInput(item, value, newPath); else if (typeof item === "boolean") this._makeCheckbox(item, value, newPath); else if (item instanceof Object) { if (!this.hideOption(path$2, subObj, this.moduleOptions)) if (item.enabled !== void 0) { const enabledPath = copyAndExtendArray(newPath, "enabled"); const enabledValue = this._getValue(enabledPath); if (enabledValue === true) { const label = this._makeLabel(subObj, newPath, true); this._makeItem(newPath, label); visibleInSet = this._handleObject(item, newPath) || visibleInSet; } else this._makeCheckbox(item, enabledValue, newPath); } else { const label = this._makeLabel(subObj, newPath, true); this._makeItem(newPath, label); visibleInSet = this._handleObject(item, newPath) || visibleInSet; } } else console.error("dont know how to handle", item, subObj, newPath); } } return visibleInSet; } /** * handle the array type of option * @param {Array.} arr * @param {number} value * @param {Array} path | where to look for the actual option * @private */ _handleArray(arr, value, path$2) { if (typeof arr[0] === "string" && arr[0] === "color") { this._makeColorField(arr, value, path$2); if (arr[1] !== value) this.changedOptions.push({ path: path$2, value }); } else if (typeof arr[0] === "string") { this._makeDropdown(arr, value, path$2); if (arr[0] !== value) this.changedOptions.push({ path: path$2, value }); } else if (typeof arr[0] === "number") { this._makeRange(arr, value, path$2); if (arr[0] !== value) this.changedOptions.push({ path: path$2, value: Number(value) }); } } /** * called to update the network with the new settings. * @param {number} value * @param {Array} path | where to look for the actual option * @private */ _update(value, path$2) { const options = this._constructOptions(value, path$2); if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) this.parent.body.emitter.emit("configChange", options); this.initialized = true; this.parent.setOptions(options); } /** * * @param {string | boolean} value * @param {Array.} path * @param {{}} optionsObj * @returns {{}} * @private */ _constructOptions(value, path$2, optionsObj = {}) { let pointer = optionsObj; value = value === "true" ? true : value; value = value === "false" ? false : value; for (let i = 0; i < path$2.length; i++) if (path$2[i] !== "global") { if (pointer[path$2[i]] === void 0) pointer[path$2[i]] = {}; if (i !== path$2.length - 1) pointer = pointer[path$2[i]]; else pointer[path$2[i]] = value; } return optionsObj; } /** * @private */ _printOptions() { const options = this.getOptions(); while (this.optionsContainer.firstChild) this.optionsContainer.removeChild(this.optionsContainer.firstChild); this.optionsContainer.appendChild(wrapInTag("pre", "const options = " + JSON.stringify(options, null, 2))); } /** * * @returns {{}} options */ getOptions() { const options = {}; for (let i = 0; i < this.changedOptions.length; i++) this._constructOptions(this.changedOptions[i].value, this.changedOptions[i].path, options); return options; } }; /** * Popup is a class to create a popup window with some text */ let Popup$1 = class Popup$2 { /** * @param {Element} container The container object. * @param {string} overflowMethod How the popup should act to overflowing ('flip' or 'cap') */ constructor(container, overflowMethod) { this.container = container; this.overflowMethod = overflowMethod || "cap"; this.x = 0; this.y = 0; this.padding = 5; this.hidden = false; this.frame = document.createElement("div"); this.frame.className = "vis-tooltip"; this.container.appendChild(this.frame); } /** * @param {number} x Horizontal position of the popup window * @param {number} y Vertical position of the popup window */ setPosition(x, y) { this.x = parseInt(x); this.y = parseInt(y); } /** * Set the content for the popup window. This can be HTML code or text. * @param {string | Element} content */ setText(content) { if (content instanceof Element) { while (this.frame.firstChild) this.frame.removeChild(this.frame.firstChild); this.frame.appendChild(content); } else this.frame.innerText = content; } /** * Show the popup window * @param {boolean} [doShow] Show or hide the window */ show(doShow) { if (doShow === void 0) doShow = true; if (doShow === true) { const height = this.frame.clientHeight; const width = this.frame.clientWidth; const maxHeight = this.frame.parentNode.clientHeight; const maxWidth = this.frame.parentNode.clientWidth; let left = 0, top = 0; if (this.overflowMethod == "flip") { let isLeft = false, isTop = true; if (this.y - height < this.padding) isTop = false; if (this.x + width > maxWidth - this.padding) isLeft = true; if (isLeft) left = this.x - width; else left = this.x; if (isTop) top = this.y - height; else top = this.y; } else { top = this.y - height; if (top + height + this.padding > maxHeight) top = maxHeight - height - this.padding; if (top < this.padding) top = this.padding; left = this.x; if (left + width + this.padding > maxWidth) left = maxWidth - width - this.padding; if (left < this.padding) left = this.padding; } this.frame.style.left = left + "px"; this.frame.style.top = top + "px"; this.frame.style.visibility = "visible"; this.hidden = false; } else this.hide(); } /** * Hide the popup window */ hide() { this.hidden = true; this.frame.style.left = "0"; this.frame.style.top = "0"; this.frame.style.visibility = "hidden"; } /** * Remove the popup window */ destroy() { this.frame.parentNode.removeChild(this.frame); } }; let errorFound = false; let allOptions$1; const VALIDATOR_PRINT_STYLE$1 = "background: #FFeeee; color: #dd0000"; /** * Used to validate options. */ let Validator$1 = class Validator$2 { /** * Main function to be called * @param {object} options * @param {object} referenceOptions * @param {object} subObject * @returns {boolean} * @static */ static validate(options, referenceOptions, subObject) { errorFound = false; allOptions$1 = referenceOptions; let usedOptions = referenceOptions; if (subObject !== void 0) usedOptions = referenceOptions[subObject]; Validator$2.parse(options, usedOptions, []); return errorFound; } /** * Will traverse an object recursively and check every value * @param {object} options * @param {object} referenceOptions * @param {Array} path | where to look for the actual option * @static */ static parse(options, referenceOptions, path$2) { for (const option in options) if (Object.prototype.hasOwnProperty.call(options, option)) Validator$2.check(option, options, referenceOptions, path$2); } /** * Check every value. If the value is an object, call the parse function on that object. * @param {string} option * @param {object} options * @param {object} referenceOptions * @param {Array} path | where to look for the actual option * @static */ static check(option, options, referenceOptions, path$2) { if (referenceOptions[option] === void 0 && referenceOptions.__any__ === void 0) { Validator$2.getSuggestion(option, referenceOptions, path$2); return; } let referenceOption = option; let is_object = true; if (referenceOptions[option] === void 0 && referenceOptions.__any__ !== void 0) { referenceOption = "__any__"; is_object = Validator$2.getType(options[option]) === "object"; } let refOptionObj = referenceOptions[referenceOption]; if (is_object && refOptionObj.__type__ !== void 0) refOptionObj = refOptionObj.__type__; Validator$2.checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path$2); } /** * * @param {string} option | the option property * @param {object} options | The supplied options object * @param {object} referenceOptions | The reference options containing all options and their allowed formats * @param {string} referenceOption | Usually this is the same as option, except when handling an __any__ tag. * @param {string} refOptionObj | This is the type object from the reference options * @param {Array} path | where in the object is the option * @static */ static checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path$2) { const log = function(message) { console.error("%c" + message + Validator$2.printLocation(path$2, option), VALIDATOR_PRINT_STYLE$1); }; const optionType = Validator$2.getType(options[option]); const refOptionType = refOptionObj[optionType]; if (refOptionType !== void 0) { if (Validator$2.getType(refOptionType) === "array" && refOptionType.indexOf(options[option]) === -1) { log("Invalid option detected in \"" + option + "\". Allowed values are:" + Validator$2.print(refOptionType) + " not \"" + options[option] + "\". "); errorFound = true; } else if (optionType === "object" && referenceOption !== "__any__") { path$2 = copyAndExtendArray(path$2, option); Validator$2.parse(options[option], referenceOptions[referenceOption], path$2); } } else if (refOptionObj["any"] === void 0) { log("Invalid type received for \"" + option + "\". Expected: " + Validator$2.print(Object.keys(refOptionObj)) + ". Received [" + optionType + "] \"" + options[option] + "\""); errorFound = true; } } /** * * @param {object | boolean | number | string | Array. | Date | Node | Moment | undefined | null} object * @returns {string} * @static */ static getType(object$1) { const type = typeof object$1; if (type === "object") { if (object$1 === null) return "null"; if (object$1 instanceof Boolean) return "boolean"; if (object$1 instanceof Number) return "number"; if (object$1 instanceof String) return "string"; if (Array.isArray(object$1)) return "array"; if (object$1 instanceof Date) return "date"; if (object$1.nodeType !== void 0) return "dom"; if (object$1._isAMomentObject === true) return "moment"; return "object"; } else if (type === "number") return "number"; else if (type === "boolean") return "boolean"; else if (type === "string") return "string"; else if (type === void 0) return "undefined"; return type; } /** * @param {string} option * @param {object} options * @param {Array.} path * @static */ static getSuggestion(option, options, path$2) { const localSearch = Validator$2.findInOptions(option, options, path$2, false); const globalSearch = Validator$2.findInOptions(option, allOptions$1, [], true); const localSearchThreshold = 8; const globalSearchThreshold = 4; let msg; if (localSearch.indexMatch !== void 0) msg = " in " + Validator$2.printLocation(localSearch.path, option, "") + "Perhaps it was incomplete? Did you mean: \"" + localSearch.indexMatch + "\"?\n\n"; else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) msg = " in " + Validator$2.printLocation(localSearch.path, option, "") + "Perhaps it was misplaced? Matching option found at: " + Validator$2.printLocation(globalSearch.path, globalSearch.closestMatch, ""); else if (localSearch.distance <= localSearchThreshold) msg = ". Did you mean \"" + localSearch.closestMatch + "\"?" + Validator$2.printLocation(localSearch.path, option); else msg = ". Did you mean one of these: " + Validator$2.print(Object.keys(options)) + Validator$2.printLocation(path$2, option); console.error("%cUnknown option detected: \"" + option + "\"" + msg, VALIDATOR_PRINT_STYLE$1); errorFound = true; } /** * traverse the options in search for a match. * @param {string} option * @param {object} options * @param {Array} path | where to look for the actual option * @param {boolean} [recursive] * @returns {{closestMatch: string, path: Array, distance: number}} * @static */ static findInOptions(option, options, path$2, recursive = false) { let min = 1e9; let closestMatch = ""; let closestMatchPath = []; const lowerCaseOption = option.toLowerCase(); let indexMatch = void 0; for (const op in options) { let distance; if (options[op].__type__ !== void 0 && recursive === true) { const result = Validator$2.findInOptions(option, options[op], copyAndExtendArray(path$2, op)); if (min > result.distance) { closestMatch = result.closestMatch; closestMatchPath = result.path; min = result.distance; indexMatch = result.indexMatch; } } else { if (op.toLowerCase().indexOf(lowerCaseOption) !== -1) indexMatch = op; distance = Validator$2.levenshteinDistance(option, op); if (min > distance) { closestMatch = op; closestMatchPath = copyArray(path$2); min = distance; } } } return { closestMatch, path: closestMatchPath, distance: min, indexMatch }; } /** * @param {Array.} path * @param {object} option * @param {string} prefix * @returns {string} * @static */ static printLocation(path$2, option, prefix = "Problem value found at: \n") { let str = "\n\n" + prefix + "options = {\n"; for (let i = 0; i < path$2.length; i++) { for (let j = 0; j < i + 1; j++) str += " "; str += path$2[i] + ": {\n"; } for (let j = 0; j < path$2.length + 1; j++) str += " "; str += option + "\n"; for (let i = 0; i < path$2.length + 1; i++) { for (let j = 0; j < path$2.length - i; j++) str += " "; str += "}\n"; } return str + "\n\n"; } /** * @param {object} options * @returns {string} * @static */ static print(options) { return JSON.stringify(options).replace(/(")|(\[)|(\])|(,"__type__")/g, "").replace(/(,)/g, ", "); } /** * Compute the edit distance between the two given strings * http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript * * Copyright (c) 2011 Andrei Mackenzie * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * @param {string} a * @param {string} b * @returns {Array.>}} * @static */ static levenshteinDistance(a, b) { if (a.length === 0) return b.length; if (b.length === 0) return a.length; const matrix = []; let i; for (i = 0; i <= b.length; i++) matrix[i] = [i]; let j; for (j = 0; j <= a.length; j++) matrix[0][j] = j; for (i = 1; i <= b.length; i++) for (j = 1; j <= a.length; j++) if (b.charAt(i - 1) == a.charAt(j - 1)) matrix[i][j] = matrix[i - 1][j - 1]; else matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1)); return matrix[b.length][a.length]; } }; const Activator = Activator$1; const Configurator = Configurator$1; const Hammer = Hammer$1; const Popup = Popup$1; const VALIDATOR_PRINT_STYLE = VALIDATOR_PRINT_STYLE$1; const Validator = Validator$1; var es_object_create = {}; var objectDefineProperties = {}; var hasRequiredObjectDefineProperties; function requireObjectDefineProperties() { if (hasRequiredObjectDefineProperties) return objectDefineProperties; hasRequiredObjectDefineProperties = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var V8_PROTOTYPE_DEFINE_BUG = /* @__PURE__ */ requireV8PrototypeDefineBug(); var definePropertyModule = /* @__PURE__ */ requireObjectDefineProperty(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var objectKeys$2 = /* @__PURE__ */ requireObjectKeys(); objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties$4(O, Properties) { anObject$2(O); var props = toIndexedObject$2(Properties); var keys$8 = objectKeys$2(Properties); var length$1 = keys$8.length; var index$1 = 0; var key; while (length$1 > index$1) definePropertyModule.f(O, key = keys$8[index$1++], props[key]); return O; }; return objectDefineProperties; } var html; var hasRequiredHtml; function requireHtml() { if (hasRequiredHtml) return html; hasRequiredHtml = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); html = getBuiltIn$2("document", "documentElement"); return html; } var sharedKey; var hasRequiredSharedKey; function requireSharedKey() { if (hasRequiredSharedKey) return sharedKey; hasRequiredSharedKey = 1; var shared$2 = /* @__PURE__ */ requireShared(); var uid$2 = /* @__PURE__ */ requireUid(); var keys$8 = shared$2("keys"); sharedKey = function(key) { return keys$8[key] || (keys$8[key] = uid$2(key)); }; return sharedKey; } var objectCreate; var hasRequiredObjectCreate; function requireObjectCreate() { if (hasRequiredObjectCreate) return objectCreate; hasRequiredObjectCreate = 1; var anObject$2 = /* @__PURE__ */ requireAnObject(); var definePropertiesModule = /* @__PURE__ */ requireObjectDefineProperties(); var enumBugKeys$2 = /* @__PURE__ */ requireEnumBugKeys(); var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys(); var html$2 = /* @__PURE__ */ requireHtml(); var documentCreateElement$2 = /* @__PURE__ */ requireDocumentCreateElement(); var sharedKey$2 = /* @__PURE__ */ requireSharedKey(); var GT = ">"; var LT = "<"; var PROTOTYPE = "prototype"; var SCRIPT = "script"; var IE_PROTO = sharedKey$2("IE_PROTO"); var EmptyConstructor = function() {}; var scriptTag = function(content) { return LT + SCRIPT + GT + content + LT + "/" + SCRIPT + GT; }; var NullProtoObjectViaActiveX = function(activeXDocument$1) { activeXDocument$1.write(scriptTag("")); activeXDocument$1.close(); var temp = activeXDocument$1.parentWindow.Object; activeXDocument$1 = null; return temp; }; var NullProtoObjectViaIFrame = function() { var iframe = documentCreateElement$2("iframe"); var JS = "java" + SCRIPT + ":"; var iframeDocument; iframe.style.display = "none"; html$2.appendChild(iframe); iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag("document.F=Object")); iframeDocument.close(); return iframeDocument.F; }; var activeXDocument; var NullProtoObject = function() { try { activeXDocument = new ActiveXObject("htmlfile"); } catch (error) {} NullProtoObject = typeof document != "undefined" ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); var length$1 = enumBugKeys$2.length; while (length$1--) delete NullProtoObject[PROTOTYPE][enumBugKeys$2[length$1]]; return NullProtoObject(); }; hiddenKeys$2[IE_PROTO] = true; objectCreate = Object.create || function create$4(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject$2(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === void 0 ? result : definePropertiesModule.f(result, Properties); }; return objectCreate; } var hasRequiredEs_object_create; function requireEs_object_create() { if (hasRequiredEs_object_create) return es_object_create; hasRequiredEs_object_create = 1; var $ = /* @__PURE__ */ require_export(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var create$4 = /* @__PURE__ */ requireObjectCreate(); $({ target: "Object", stat: true, sham: !DESCRIPTORS }, { create: create$4 }); return es_object_create; } var create$2; var hasRequiredCreate$2; function requireCreate$2() { if (hasRequiredCreate$2) return create$2; hasRequiredCreate$2 = 1; requireEs_object_create(); var path$2 = /* @__PURE__ */ requirePath(); var Object$1 = path$2.Object; create$2 = function create$4(P, D) { return Object$1.create(P, D); }; return create$2; } var create$1; var hasRequiredCreate$1; function requireCreate$1() { if (hasRequiredCreate$1) return create$1; hasRequiredCreate$1 = 1; var parent = /* @__PURE__ */ requireCreate$2(); create$1 = parent; return create$1; } var create; var hasRequiredCreate; function requireCreate() { if (hasRequiredCreate) return create; hasRequiredCreate = 1; create = /* @__PURE__ */ requireCreate$1(); return create; } var createExports = requireCreate(); var _Object$create = /* @__PURE__ */ getDefaultExportFromCjs(createExports); var es_array_indexOf = {}; var arrayMethodIsStrict; var hasRequiredArrayMethodIsStrict; function requireArrayMethodIsStrict() { if (hasRequiredArrayMethodIsStrict) return arrayMethodIsStrict; hasRequiredArrayMethodIsStrict = 1; var fails$2 = /* @__PURE__ */ requireFails(); arrayMethodIsStrict = function(METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !!method && fails$2(function() { method.call(null, argument || function() { return 1; }, 1); }); }; return arrayMethodIsStrict; } var hasRequiredEs_array_indexOf; function requireEs_array_indexOf() { if (hasRequiredEs_array_indexOf) return es_array_indexOf; hasRequiredEs_array_indexOf = 1; var $ = /* @__PURE__ */ require_export(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThisClause(); var $indexOf = requireArrayIncludes().indexOf; var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict(); var nativeIndexOf = uncurryThis([].indexOf); var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0; var FORCED = NEGATIVE_ZERO || !arrayMethodIsStrict$2("indexOf"); $({ target: "Array", proto: true, forced: FORCED }, { indexOf: function indexOf$4(searchElement) { var fromIndex = arguments.length > 1 ? arguments[1] : void 0; return NEGATIVE_ZERO ? nativeIndexOf(this, searchElement, fromIndex) || 0 : $indexOf(this, searchElement, fromIndex); } }); return es_array_indexOf; } var indexOf$3; var hasRequiredIndexOf$3; function requireIndexOf$3() { if (hasRequiredIndexOf$3) return indexOf$3; hasRequiredIndexOf$3 = 1; requireEs_array_indexOf(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); indexOf$3 = getBuiltInPrototypeMethod$2("Array", "indexOf"); return indexOf$3; } var indexOf$2; var hasRequiredIndexOf$2; function requireIndexOf$2() { if (hasRequiredIndexOf$2) return indexOf$2; hasRequiredIndexOf$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireIndexOf$3(); var ArrayPrototype = Array.prototype; indexOf$2 = function(it$1) { var own = it$1.indexOf; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.indexOf ? method : own; }; return indexOf$2; } var indexOf$1; var hasRequiredIndexOf$1; function requireIndexOf$1() { if (hasRequiredIndexOf$1) return indexOf$1; hasRequiredIndexOf$1 = 1; var parent = /* @__PURE__ */ requireIndexOf$2(); indexOf$1 = parent; return indexOf$1; } var indexOf; var hasRequiredIndexOf; function requireIndexOf() { if (hasRequiredIndexOf) return indexOf; hasRequiredIndexOf = 1; indexOf = /* @__PURE__ */ requireIndexOf$1(); return indexOf; } var indexOfExports = requireIndexOf(); var _indexOfInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(indexOfExports); var es_array_includes = {}; var addToUnscopables; var hasRequiredAddToUnscopables; function requireAddToUnscopables() { if (hasRequiredAddToUnscopables) return addToUnscopables; hasRequiredAddToUnscopables = 1; addToUnscopables = function() {}; return addToUnscopables; } var hasRequiredEs_array_includes; function requireEs_array_includes() { if (hasRequiredEs_array_includes) return es_array_includes; hasRequiredEs_array_includes = 1; var $ = /* @__PURE__ */ require_export(); var $includes = requireArrayIncludes().includes; var fails$2 = /* @__PURE__ */ requireFails(); var addToUnscopables$2 = /* @__PURE__ */ requireAddToUnscopables(); var BROKEN_ON_SPARSE = fails$2(function() { return !Array(1).includes(); }); $({ target: "Array", proto: true, forced: BROKEN_ON_SPARSE }, { includes: function includes$5(el) { return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0); } }); addToUnscopables$2("includes"); return es_array_includes; } var includes$4; var hasRequiredIncludes$4; function requireIncludes$4() { if (hasRequiredIncludes$4) return includes$4; hasRequiredIncludes$4 = 1; requireEs_array_includes(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); includes$4 = getBuiltInPrototypeMethod$2("Array", "includes"); return includes$4; } var es_string_includes = {}; var isRegexp; var hasRequiredIsRegexp; function requireIsRegexp() { if (hasRequiredIsRegexp) return isRegexp; hasRequiredIsRegexp = 1; var isObject$3 = /* @__PURE__ */ requireIsObject(); var classof$2 = /* @__PURE__ */ requireClassofRaw(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var MATCH = wellKnownSymbol$2("match"); isRegexp = function(it$1) { var isRegExp; return isObject$3(it$1) && ((isRegExp = it$1[MATCH]) !== void 0 ? !!isRegExp : classof$2(it$1) === "RegExp"); }; return isRegexp; } var notARegexp; var hasRequiredNotARegexp; function requireNotARegexp() { if (hasRequiredNotARegexp) return notARegexp; hasRequiredNotARegexp = 1; var isRegExp = /* @__PURE__ */ requireIsRegexp(); var $TypeError = TypeError; notARegexp = function(it$1) { if (isRegExp(it$1)) throw new $TypeError("The method doesn't accept regular expressions"); return it$1; }; return notARegexp; } var toStringTagSupport; var hasRequiredToStringTagSupport; function requireToStringTagSupport() { if (hasRequiredToStringTagSupport) return toStringTagSupport; hasRequiredToStringTagSupport = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var TO_STRING_TAG = wellKnownSymbol$2("toStringTag"); var test = {}; test[TO_STRING_TAG] = "z"; toStringTagSupport = String(test) === "[object z]"; return toStringTagSupport; } var classof; var hasRequiredClassof; function requireClassof() { if (hasRequiredClassof) return classof; hasRequiredClassof = 1; var TO_STRING_TAG_SUPPORT = /* @__PURE__ */ requireToStringTagSupport(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var classofRaw$2 = /* @__PURE__ */ requireClassofRaw(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var TO_STRING_TAG = wellKnownSymbol$2("toStringTag"); var $Object = Object; var CORRECT_ARGUMENTS = classofRaw$2(function() { return arguments; }()) === "Arguments"; var tryGet = function(it$1, key) { try { return it$1[key]; } catch (error) {} }; classof = TO_STRING_TAG_SUPPORT ? classofRaw$2 : function(it$1) { var O, tag, result; return it$1 === void 0 ? "Undefined" : it$1 === null ? "Null" : typeof (tag = tryGet(O = $Object(it$1), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw$2(O) : (result = classofRaw$2(O)) === "Object" && isCallable$2(O.callee) ? "Arguments" : result; }; return classof; } var toString; var hasRequiredToString; function requireToString() { if (hasRequiredToString) return toString; hasRequiredToString = 1; var classof$2 = /* @__PURE__ */ requireClassof(); var $String = String; toString = function(argument) { if (classof$2(argument) === "Symbol") throw new TypeError("Cannot convert a Symbol value to a string"); return $String(argument); }; return toString; } var correctIsRegexpLogic; var hasRequiredCorrectIsRegexpLogic; function requireCorrectIsRegexpLogic() { if (hasRequiredCorrectIsRegexpLogic) return correctIsRegexpLogic; hasRequiredCorrectIsRegexpLogic = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var MATCH = wellKnownSymbol$2("match"); correctIsRegexpLogic = function(METHOD_NAME) { var regexp = /./; try { "/./"[METHOD_NAME](regexp); } catch (error1) { try { regexp[MATCH] = false; return "/./"[METHOD_NAME](regexp); } catch (error2) {} } return false; }; return correctIsRegexpLogic; } var hasRequiredEs_string_includes; function requireEs_string_includes() { if (hasRequiredEs_string_includes) return es_string_includes; hasRequiredEs_string_includes = 1; var $ = /* @__PURE__ */ require_export(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var notARegExp = /* @__PURE__ */ requireNotARegexp(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); var toString$2 = /* @__PURE__ */ requireToString(); var correctIsRegExpLogic = /* @__PURE__ */ requireCorrectIsRegexpLogic(); var stringIndexOf = uncurryThis("".indexOf); $({ target: "String", proto: true, forced: !correctIsRegExpLogic("includes") }, { includes: function includes$5(searchString) { return !!~stringIndexOf(toString$2(requireObjectCoercible$2(this)), toString$2(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : void 0); } }); return es_string_includes; } var includes$3; var hasRequiredIncludes$3; function requireIncludes$3() { if (hasRequiredIncludes$3) return includes$3; hasRequiredIncludes$3 = 1; requireEs_string_includes(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); includes$3 = getBuiltInPrototypeMethod$2("String", "includes"); return includes$3; } var includes$2; var hasRequiredIncludes$2; function requireIncludes$2() { if (hasRequiredIncludes$2) return includes$2; hasRequiredIncludes$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var arrayMethod = /* @__PURE__ */ requireIncludes$4(); var stringMethod = /* @__PURE__ */ requireIncludes$3(); var ArrayPrototype = Array.prototype; var StringPrototype = String.prototype; includes$2 = function(it$1) { var own = it$1.includes; if (it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.includes) return arrayMethod; if (typeof it$1 == "string" || it$1 === StringPrototype || isPrototypeOf(StringPrototype, it$1) && own === StringPrototype.includes) return stringMethod; return own; }; return includes$2; } var includes$1; var hasRequiredIncludes$1; function requireIncludes$1() { if (hasRequiredIncludes$1) return includes$1; hasRequiredIncludes$1 = 1; var parent = /* @__PURE__ */ requireIncludes$2(); includes$1 = parent; return includes$1; } var includes; var hasRequiredIncludes; function requireIncludes() { if (hasRequiredIncludes) return includes; hasRequiredIncludes = 1; includes = /* @__PURE__ */ requireIncludes$1(); return includes; } var includesExports = requireIncludes(); var _includesInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(includesExports); var es_array_splice = {}; var isArray$3; var hasRequiredIsArray$3; function requireIsArray$3() { if (hasRequiredIsArray$3) return isArray$3; hasRequiredIsArray$3 = 1; var classof$2 = /* @__PURE__ */ requireClassofRaw(); isArray$3 = Array.isArray || function isArray$5(argument) { return classof$2(argument) === "Array"; }; return isArray$3; } var arraySetLength; var hasRequiredArraySetLength; function requireArraySetLength() { if (hasRequiredArraySetLength) return arraySetLength; hasRequiredArraySetLength = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var isArray$5 = /* @__PURE__ */ requireIsArray$3(); var $TypeError = TypeError; var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor; var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function() { if (this !== void 0) return true; try { Object.defineProperty([], "length", { writable: false }).length = 1; } catch (error) { return error instanceof TypeError; } }(); arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function(O, length$1) { if (isArray$5(O) && !getOwnPropertyDescriptor$4(O, "length").writable) throw new $TypeError("Cannot set read only .length"); return O.length = length$1; } : function(O, length$1) { return O.length = length$1; }; return arraySetLength; } var doesNotExceedSafeInteger; var hasRequiredDoesNotExceedSafeInteger; function requireDoesNotExceedSafeInteger() { if (hasRequiredDoesNotExceedSafeInteger) return doesNotExceedSafeInteger; hasRequiredDoesNotExceedSafeInteger = 1; var $TypeError = TypeError; var MAX_SAFE_INTEGER = 9007199254740991; doesNotExceedSafeInteger = function(it$1) { if (it$1 > MAX_SAFE_INTEGER) throw $TypeError("Maximum allowed index exceeded"); return it$1; }; return doesNotExceedSafeInteger; } var inspectSource; var hasRequiredInspectSource; function requireInspectSource() { if (hasRequiredInspectSource) return inspectSource; hasRequiredInspectSource = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var store = /* @__PURE__ */ requireSharedStore(); var functionToString = uncurryThis(Function.toString); if (!isCallable$2(store.inspectSource)) store.inspectSource = function(it$1) { return functionToString(it$1); }; inspectSource = store.inspectSource; return inspectSource; } var isConstructor; var hasRequiredIsConstructor; function requireIsConstructor() { if (hasRequiredIsConstructor) return isConstructor; hasRequiredIsConstructor = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var fails$2 = /* @__PURE__ */ requireFails(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var classof$2 = /* @__PURE__ */ requireClassof(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var inspectSource$2 = /* @__PURE__ */ requireInspectSource(); var noop = function() {}; var construct = getBuiltIn$2("Reflect", "construct"); var constructorRegExp = /^\s*(?:class|function)\b/; var exec = uncurryThis(constructorRegExp.exec); var INCORRECT_TO_STRING = !constructorRegExp.test(noop); var isConstructorModern = function isConstructor$2(argument) { if (!isCallable$2(argument)) return false; try { construct(noop, [], argument); return true; } catch (error) { return false; } }; var isConstructorLegacy = function isConstructor$2(argument) { if (!isCallable$2(argument)) return false; switch (classof$2(argument)) { case "AsyncFunction": case "GeneratorFunction": case "AsyncGeneratorFunction": return false; } try { return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$2(argument)); } catch (error) { return true; } }; isConstructorLegacy.sham = true; isConstructor = !construct || fails$2(function() { var called; return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() { called = true; }) || called; }) ? isConstructorLegacy : isConstructorModern; return isConstructor; } var arraySpeciesConstructor; var hasRequiredArraySpeciesConstructor; function requireArraySpeciesConstructor() { if (hasRequiredArraySpeciesConstructor) return arraySpeciesConstructor; hasRequiredArraySpeciesConstructor = 1; var isArray$5 = /* @__PURE__ */ requireIsArray$3(); var isConstructor$2 = /* @__PURE__ */ requireIsConstructor(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var SPECIES = wellKnownSymbol$2("species"); var $Array = Array; arraySpeciesConstructor = function(originalArray) { var C; if (isArray$5(originalArray)) { C = originalArray.constructor; if (isConstructor$2(C) && (C === $Array || isArray$5(C.prototype))) C = void 0; else if (isObject$3(C)) { C = C[SPECIES]; if (C === null) C = void 0; } } return C === void 0 ? $Array : C; }; return arraySpeciesConstructor; } var arraySpeciesCreate; var hasRequiredArraySpeciesCreate; function requireArraySpeciesCreate() { if (hasRequiredArraySpeciesCreate) return arraySpeciesCreate; hasRequiredArraySpeciesCreate = 1; var arraySpeciesConstructor$2 = /* @__PURE__ */ requireArraySpeciesConstructor(); arraySpeciesCreate = function(originalArray, length$1) { return new (arraySpeciesConstructor$2(originalArray))(length$1 === 0 ? 0 : length$1); }; return arraySpeciesCreate; } var createProperty; var hasRequiredCreateProperty; function requireCreateProperty() { if (hasRequiredCreateProperty) return createProperty; hasRequiredCreateProperty = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var definePropertyModule = /* @__PURE__ */ requireObjectDefineProperty(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor(); createProperty = function(object$1, key, value) { if (DESCRIPTORS) definePropertyModule.f(object$1, key, createPropertyDescriptor$2(0, value)); else object$1[key] = value; }; return createProperty; } var deletePropertyOrThrow; var hasRequiredDeletePropertyOrThrow; function requireDeletePropertyOrThrow() { if (hasRequiredDeletePropertyOrThrow) return deletePropertyOrThrow; hasRequiredDeletePropertyOrThrow = 1; var tryToString$2 = /* @__PURE__ */ requireTryToString(); var $TypeError = TypeError; deletePropertyOrThrow = function(O, P) { if (!delete O[P]) throw new $TypeError("Cannot delete property " + tryToString$2(P) + " of " + tryToString$2(O)); }; return deletePropertyOrThrow; } var arrayMethodHasSpeciesSupport; var hasRequiredArrayMethodHasSpeciesSupport; function requireArrayMethodHasSpeciesSupport() { if (hasRequiredArrayMethodHasSpeciesSupport) return arrayMethodHasSpeciesSupport; hasRequiredArrayMethodHasSpeciesSupport = 1; var fails$2 = /* @__PURE__ */ requireFails(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var V8_VERSION = /* @__PURE__ */ requireEnvironmentV8Version(); var SPECIES = wellKnownSymbol$2("species"); arrayMethodHasSpeciesSupport = function(METHOD_NAME) { return V8_VERSION >= 51 || !fails$2(function() { var array$1 = []; var constructor = array$1.constructor = {}; constructor[SPECIES] = function() { return { foo: 1 }; }; return array$1[METHOD_NAME](Boolean).foo !== 1; }); }; return arrayMethodHasSpeciesSupport; } var hasRequiredEs_array_splice; function requireEs_array_splice() { if (hasRequiredEs_array_splice) return es_array_splice; hasRequiredEs_array_splice = 1; var $ = /* @__PURE__ */ require_export(); var toObject$2 = /* @__PURE__ */ requireToObject(); var toAbsoluteIndex$2 = /* @__PURE__ */ requireToAbsoluteIndex(); var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); var setArrayLength = /* @__PURE__ */ requireArraySetLength(); var doesNotExceedSafeInteger$2 = /* @__PURE__ */ requireDoesNotExceedSafeInteger(); var arraySpeciesCreate$2 = /* @__PURE__ */ requireArraySpeciesCreate(); var createProperty$2 = /* @__PURE__ */ requireCreateProperty(); var deletePropertyOrThrow$2 = /* @__PURE__ */ requireDeletePropertyOrThrow(); var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport(); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$2("splice"); var max = Math.max; var min = Math.min; $({ target: "Array", proto: true, forced: !HAS_SPECIES_SUPPORT }, { splice: function splice$5(start, deleteCount) { var O = toObject$2(this); var len = lengthOfArrayLike$2(O); var actualStart = toAbsoluteIndex$2(start, len); var argumentsLength = arguments.length; var insertCount, actualDeleteCount, A, k, from, to; if (argumentsLength === 0) insertCount = actualDeleteCount = 0; else if (argumentsLength === 1) { insertCount = 0; actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; actualDeleteCount = min(max(toIntegerOrInfinity$2(deleteCount), 0), len - actualStart); } doesNotExceedSafeInteger$2(len + insertCount - actualDeleteCount); A = arraySpeciesCreate$2(O, actualDeleteCount); for (k = 0; k < actualDeleteCount; k++) { from = actualStart + k; if (from in O) createProperty$2(A, k, O[from]); } A.length = actualDeleteCount; if (insertCount < actualDeleteCount) { for (k = actualStart; k < len - actualDeleteCount; k++) { from = k + actualDeleteCount; to = k + insertCount; if (from in O) O[to] = O[from]; else deletePropertyOrThrow$2(O, to); } for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow$2(O, k - 1); } else if (insertCount > actualDeleteCount) for (k = len - actualDeleteCount; k > actualStart; k--) { from = k + actualDeleteCount - 1; to = k + insertCount - 1; if (from in O) O[to] = O[from]; else deletePropertyOrThrow$2(O, to); } for (k = 0; k < insertCount; k++) O[k + actualStart] = arguments[k + 2]; setArrayLength(O, len - actualDeleteCount + insertCount); return A; } }); return es_array_splice; } var splice$3; var hasRequiredSplice$3; function requireSplice$3() { if (hasRequiredSplice$3) return splice$3; hasRequiredSplice$3 = 1; requireEs_array_splice(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); splice$3 = getBuiltInPrototypeMethod$2("Array", "splice"); return splice$3; } var splice$2; var hasRequiredSplice$2; function requireSplice$2() { if (hasRequiredSplice$2) return splice$2; hasRequiredSplice$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireSplice$3(); var ArrayPrototype = Array.prototype; splice$2 = function(it$1) { var own = it$1.splice; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.splice ? method : own; }; return splice$2; } var splice$1; var hasRequiredSplice$1; function requireSplice$1() { if (hasRequiredSplice$1) return splice$1; hasRequiredSplice$1 = 1; var parent = /* @__PURE__ */ requireSplice$2(); splice$1 = parent; return splice$1; } var splice; var hasRequiredSplice; function requireSplice() { if (hasRequiredSplice) return splice; hasRequiredSplice = 1; splice = /* @__PURE__ */ requireSplice$1(); return splice; } var spliceExports = requireSplice(); var _spliceInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(spliceExports); var es_array_isArray = {}; var hasRequiredEs_array_isArray; function requireEs_array_isArray() { if (hasRequiredEs_array_isArray) return es_array_isArray; hasRequiredEs_array_isArray = 1; var $ = /* @__PURE__ */ require_export(); var isArray$5 = /* @__PURE__ */ requireIsArray$3(); $({ target: "Array", stat: true }, { isArray: isArray$5 }); return es_array_isArray; } var isArray$2; var hasRequiredIsArray$2; function requireIsArray$2() { if (hasRequiredIsArray$2) return isArray$2; hasRequiredIsArray$2 = 1; requireEs_array_isArray(); var path$2 = /* @__PURE__ */ requirePath(); isArray$2 = path$2.Array.isArray; return isArray$2; } var isArray$1; var hasRequiredIsArray$1; function requireIsArray$1() { if (hasRequiredIsArray$1) return isArray$1; hasRequiredIsArray$1 = 1; var parent = /* @__PURE__ */ requireIsArray$2(); isArray$1 = parent; return isArray$1; } var isArray; var hasRequiredIsArray; function requireIsArray() { if (hasRequiredIsArray) return isArray; hasRequiredIsArray = 1; isArray = /* @__PURE__ */ requireIsArray$1(); return isArray; } var isArrayExports = requireIsArray(); var _Array$isArray = /* @__PURE__ */ getDefaultExportFromCjs(isArrayExports); var es_array_forEach = {}; var arrayIteration; var hasRequiredArrayIteration; function requireArrayIteration() { if (hasRequiredArrayIteration) return arrayIteration; hasRequiredArrayIteration = 1; var bind$5 = /* @__PURE__ */ requireFunctionBindContext(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var IndexedObject = /* @__PURE__ */ requireIndexedObject(); var toObject$2 = /* @__PURE__ */ requireToObject(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); var arraySpeciesCreate$2 = /* @__PURE__ */ requireArraySpeciesCreate(); var push = uncurryThis([].push); var createMethod = function(TYPE) { var IS_MAP = TYPE === 1; var IS_FILTER = TYPE === 2; var IS_SOME = TYPE === 3; var IS_EVERY = TYPE === 4; var IS_FIND_INDEX = TYPE === 6; var IS_FILTER_REJECT = TYPE === 7; var NO_HOLES = TYPE === 5 || IS_FIND_INDEX; return function($this, callbackfn, that, specificCreate) { var O = toObject$2($this); var self$1 = IndexedObject(O); var length$1 = lengthOfArrayLike$2(self$1); var boundFunction = bind$5(callbackfn, that); var index$1 = 0; var create$4 = specificCreate || arraySpeciesCreate$2; var target = IS_MAP ? create$4($this, length$1) : IS_FILTER || IS_FILTER_REJECT ? create$4($this, 0) : void 0; var value, result; for (; length$1 > index$1; index$1++) if (NO_HOLES || index$1 in self$1) { value = self$1[index$1]; result = boundFunction(value, index$1, O); if (TYPE) if (IS_MAP) target[index$1] = result; else if (result) switch (TYPE) { case 3: return true; case 5: return value; case 6: return index$1; case 2: push(target, value); } else switch (TYPE) { case 4: return false; case 7: push(target, value); } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; arrayIteration = { forEach: createMethod(0), map: createMethod(1), filter: createMethod(2), some: createMethod(3), every: createMethod(4), find: createMethod(5), findIndex: createMethod(6), filterReject: createMethod(7) }; return arrayIteration; } var arrayForEach; var hasRequiredArrayForEach; function requireArrayForEach() { if (hasRequiredArrayForEach) return arrayForEach; hasRequiredArrayForEach = 1; var $forEach = requireArrayIteration().forEach; var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict(); var STRICT_METHOD = arrayMethodIsStrict$2("forEach"); arrayForEach = !STRICT_METHOD ? function forEach$6(callbackfn) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } : [].forEach; return arrayForEach; } var hasRequiredEs_array_forEach; function requireEs_array_forEach() { if (hasRequiredEs_array_forEach) return es_array_forEach; hasRequiredEs_array_forEach = 1; var $ = /* @__PURE__ */ require_export(); var forEach$6 = /* @__PURE__ */ requireArrayForEach(); $({ target: "Array", proto: true, forced: [].forEach !== forEach$6 }, { forEach: forEach$6 }); return es_array_forEach; } var forEach$3; var hasRequiredForEach$3; function requireForEach$3() { if (hasRequiredForEach$3) return forEach$3; hasRequiredForEach$3 = 1; requireEs_array_forEach(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); forEach$3 = getBuiltInPrototypeMethod$2("Array", "forEach"); return forEach$3; } var forEach$2; var hasRequiredForEach$2; function requireForEach$2() { if (hasRequiredForEach$2) return forEach$2; hasRequiredForEach$2 = 1; var parent = /* @__PURE__ */ requireForEach$3(); forEach$2 = parent; return forEach$2; } var forEach$1; var hasRequiredForEach$1; function requireForEach$1() { if (hasRequiredForEach$1) return forEach$1; hasRequiredForEach$1 = 1; var classof$2 = /* @__PURE__ */ requireClassof(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireForEach$2(); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; forEach$1 = function(it$1) { var own = it$1.forEach; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.forEach || hasOwn(DOMIterables, classof$2(it$1)) ? method : own; }; return forEach$1; } var forEach; var hasRequiredForEach; function requireForEach() { if (hasRequiredForEach) return forEach; hasRequiredForEach = 1; forEach = /* @__PURE__ */ requireForEach$1(); return forEach; } var forEachExports = requireForEach(); var _forEachInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(forEachExports); /** * Parse a text source containing data in DOT language into a JSON object. * The object contains two lists: one with nodes and one with edges. * * DOT language reference: http://www.graphviz.org/doc/info/lang.html * * DOT language attributes: http://graphviz.org/content/attrs * @param {string} data Text containing a graph in DOT-notation * @returns {object} graph An object containing two parameters: * {Object[]} nodes * {Object[]} edges * * ------------------------------------------- * TODO * ==== * * For label handling, this is an incomplete implementation. From docs (quote #3015): * * > the escape sequences "\n", "\l" and "\r" divide the label into lines, centered, * > left-justified, and right-justified, respectively. * * Source: http://www.graphviz.org/content/attrs#kescString * * > As another aid for readability, dot allows double-quoted strings to span multiple physical * > lines using the standard C convention of a backslash immediately preceding a newline * > character * > In addition, double-quoted strings can be concatenated using a '+' operator. * > As HTML strings can contain newline characters, which are used solely for formatting, * > the language does not allow escaped newlines or concatenation operators to be used * > within them. * * - Currently, only '\\n' is handled * - Note that text explicitly says 'labels'; the dot parser currently handles escape * sequences in **all** strings. */ function parseDOT(data) { dot = data; return parseGraph(); } var NODE_ATTR_MAPPING = { fontsize: "font.size", fontcolor: "font.color", labelfontcolor: "font.color", fontname: "font.face", color: ["color.border", "color.background"], fillcolor: "color.background", tooltip: "title", labeltooltip: "title" }; var EDGE_ATTR_MAPPING = _Object$create(NODE_ATTR_MAPPING); EDGE_ATTR_MAPPING.color = "color.color"; EDGE_ATTR_MAPPING.style = "dashes"; var TOKENTYPE = { NULL: 0, DELIMITER: 1, IDENTIFIER: 2, UNKNOWN: 3 }; var DELIMITERS = { "{": true, "}": true, "[": true, "]": true, ";": true, "=": true, ",": true, "->": true, "--": true }; var dot = ""; var index = 0; var c = ""; var token = ""; var tokenType = TOKENTYPE.NULL; /** * Get the first character from the dot file. * The character is stored into the char c. If the end of the dot file is * reached, the function puts an empty string in c. */ function first() { index = 0; c = dot.charAt(0); } /** * Get the next character from the dot file. * The character is stored into the char c. If the end of the dot file is * reached, the function puts an empty string in c. */ function next() { index++; c = dot.charAt(index); } /** * Preview the next character from the dot file. * @returns {string} cNext */ function nextPreview() { return dot.charAt(index + 1); } /** * Test whether given character is alphabetic or numeric ( a-zA-Z_0-9.:# ) * @param {string} c * @returns {boolean} isAlphaNumeric */ function isAlphaNumeric(c$1) { var charCode = c$1.charCodeAt(0); if (charCode < 47) return charCode === 35 || charCode === 46; if (charCode < 59) return charCode > 47; if (charCode < 91) return charCode > 64; if (charCode < 96) return charCode === 95; if (charCode < 123) return charCode > 96; return false; } /** * Merge all options of object b into object b * @param {object} a * @param {object} b * @returns {object} a */ function merge(a, b) { if (!a) a = {}; if (b) { for (var name in b) if (b.hasOwnProperty(name)) a[name] = b[name]; } return a; } /** * Set a value in an object, where the provided parameter name can be a * path with nested parameters. For example: * * var obj = {a: 2}; * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}} * @param {object} obj * @param {string} path A parameter name or dot-separated parameter path, * like "color.highlight.border". * @param {*} value */ function setValue(obj, path$2, value) { var keys$8 = path$2.split("."); var o = obj; while (keys$8.length) { var key = keys$8.shift(); if (keys$8.length) { if (!o[key]) o[key] = {}; o = o[key]; } else o[key] = value; } } /** * Add a node to a graph object. If there is already a node with * the same id, their attributes will be merged. * @param {object} graph * @param {object} node */ function addNode(graph, node) { var i, len; var current = null; var graphs = [graph]; var root = graph; while (root.parent) { graphs.push(root.parent); root = root.parent; } if (root.nodes) { for (i = 0, len = root.nodes.length; i < len; i++) if (node.id === root.nodes[i].id) { current = root.nodes[i]; break; } } if (!current) { current = { id: node.id }; if (graph.node) current.attr = merge(current.attr, graph.node); } for (i = graphs.length - 1; i >= 0; i--) { var _context; var g = graphs[i]; if (!g.nodes) g.nodes = []; if (_indexOfInstanceProperty(_context = g.nodes).call(_context, current) === -1) g.nodes.push(current); } if (node.attr) current.attr = merge(current.attr, node.attr); } /** * Add an edge to a graph object * @param {object} graph * @param {object} edge */ function addEdge(graph, edge) { if (!graph.edges) graph.edges = []; graph.edges.push(edge); if (graph.edge) { var attr = merge({}, graph.edge); edge.attr = merge(attr, edge.attr); } } /** * Create an edge to a graph object * @param {object} graph * @param {string | number | object} from * @param {string | number | object} to * @param {string} type * @param {object | null} attr * @returns {object} edge */ function createEdge(graph, from, to, type, attr) { var edge = { from, to, type }; if (graph.edge) edge.attr = merge({}, graph.edge); edge.attr = merge(edge.attr || {}, attr); if (attr != null) { if (attr.hasOwnProperty("arrows") && attr["arrows"] != null) { edge["arrows"] = { to: { enabled: true, type: attr.arrows.type } }; attr["arrows"] = null; } } return edge; } /** * Get next token in the current dot file. * The token and token type are available as token and tokenType */ function getToken() { tokenType = TOKENTYPE.NULL; token = ""; while (c === " " || c === " " || c === "\n" || c === "\r") next(); do { var isComment = false; if (c === "#") { var i = index - 1; while (dot.charAt(i) === " " || dot.charAt(i) === " ") i--; if (dot.charAt(i) === "\n" || dot.charAt(i) === "") { while (c != "" && c != "\n") next(); isComment = true; } } if (c === "/" && nextPreview() === "/") { while (c != "" && c != "\n") next(); isComment = true; } if (c === "/" && nextPreview() === "*") { while (c != "") if (c === "*" && nextPreview() === "/") { next(); next(); break; } else next(); isComment = true; } while (c === " " || c === " " || c === "\n" || c === "\r") next(); } while (isComment); if (c === "") { tokenType = TOKENTYPE.DELIMITER; return; } var c2 = c + nextPreview(); if (DELIMITERS[c2]) { tokenType = TOKENTYPE.DELIMITER; token = c2; next(); next(); return; } if (DELIMITERS[c]) { tokenType = TOKENTYPE.DELIMITER; token = c; next(); return; } if (isAlphaNumeric(c) || c === "-") { token += c; next(); while (isAlphaNumeric(c)) { token += c; next(); } if (token === "false") token = false; else if (token === "true") token = true; else if (!isNaN(Number(token))) token = Number(token); tokenType = TOKENTYPE.IDENTIFIER; return; } if (c === "\"") { next(); while (c != "" && (c != "\"" || c === "\"" && nextPreview() === "\"")) { if (c === "\"") { token += c; next(); } else if (c === "\\" && nextPreview() === "n") { token += "\n"; next(); } else token += c; next(); } if (c != "\"") throw newSyntaxError("End of string \" expected"); next(); tokenType = TOKENTYPE.IDENTIFIER; return; } tokenType = TOKENTYPE.UNKNOWN; while (c != "") { token += c; next(); } throw new SyntaxError("Syntax error in part \"" + chop(token, 30) + "\""); } /** * Parse a graph. * @returns {object} graph */ function parseGraph() { var graph = {}; first(); getToken(); if (token === "strict") { graph.strict = true; getToken(); } if (token === "graph" || token === "digraph") { graph.type = token; getToken(); } if (tokenType === TOKENTYPE.IDENTIFIER) { graph.id = token; getToken(); } if (token != "{") throw newSyntaxError("Angle bracket { expected"); getToken(); parseStatements(graph); if (token != "}") throw newSyntaxError("Angle bracket } expected"); getToken(); if (token !== "") throw newSyntaxError("End of file expected"); getToken(); delete graph.node; delete graph.edge; delete graph.graph; return graph; } /** * Parse a list with statements. * @param {object} graph */ function parseStatements(graph) { while (token !== "" && token != "}") { parseStatement(graph); if (token === ";") getToken(); } } /** * Parse a single statement. Can be a an attribute statement, node * statement, a series of node statements and edge statements, or a * parameter. * @param {object} graph */ function parseStatement(graph) { var subgraph = parseSubgraph(graph); if (subgraph) { parseEdge(graph, subgraph); return; } var attr = parseAttributeStatement(graph); if (attr) return; if (tokenType != TOKENTYPE.IDENTIFIER) throw newSyntaxError("Identifier expected"); var id = token; getToken(); if (token === "=") { getToken(); if (tokenType != TOKENTYPE.IDENTIFIER) throw newSyntaxError("Identifier expected"); graph[id] = token; getToken(); } else parseNodeStatement(graph, id); } /** * Parse a subgraph * @param {object} graph parent graph object * @returns {object | null} subgraph */ function parseSubgraph(graph) { var subgraph = null; if (token === "subgraph") { subgraph = {}; subgraph.type = "subgraph"; getToken(); if (tokenType === TOKENTYPE.IDENTIFIER) { subgraph.id = token; getToken(); } } if (token === "{") { getToken(); if (!subgraph) subgraph = {}; subgraph.parent = graph; subgraph.node = graph.node; subgraph.edge = graph.edge; subgraph.graph = graph.graph; parseStatements(subgraph); if (token != "}") throw newSyntaxError("Angle bracket } expected"); getToken(); delete subgraph.node; delete subgraph.edge; delete subgraph.graph; delete subgraph.parent; if (!graph.subgraphs) graph.subgraphs = []; graph.subgraphs.push(subgraph); } return subgraph; } /** * parse an attribute statement like "node [shape=circle fontSize=16]". * Available keywords are 'node', 'edge', 'graph'. * The previous list with default attributes will be replaced * @param {object} graph * @returns {string | null} keyword Returns the name of the parsed attribute * (node, edge, graph), or null if nothing * is parsed. */ function parseAttributeStatement(graph) { if (token === "node") { getToken(); graph.node = parseAttributeList(); return "node"; } else if (token === "edge") { getToken(); graph.edge = parseAttributeList(); return "edge"; } else if (token === "graph") { getToken(); graph.graph = parseAttributeList(); return "graph"; } return null; } /** * parse a node statement * @param {object} graph * @param {string | number} id */ function parseNodeStatement(graph, id) { var node = { id }; var attr = parseAttributeList(); if (attr) node.attr = attr; addNode(graph, node); parseEdge(graph, id); } /** * Parse an edge or a series of edges * @param {object} graph * @param {string | number} from Id of the from node */ function parseEdge(graph, from) { while (token === "->" || token === "--") { var to; var type = token; getToken(); var subgraph = parseSubgraph(graph); if (subgraph) to = subgraph; else { if (tokenType != TOKENTYPE.IDENTIFIER) throw newSyntaxError("Identifier or subgraph expected"); to = token; addNode(graph, { id: to }); getToken(); } var attr = parseAttributeList(); var edge = createEdge(graph, from, to, type, attr); addEdge(graph, edge); from = to; } } /** * Parse a set with attributes, * for example [label="1.000", shape=solid] * @returns {object | null} attr */ function parseAttributeList() { var i; var attr = null; var edgeStyles = { dashed: true, solid: false, dotted: [1, 5] }; /** * Define arrow types. * vis currently supports types defined in 'arrowTypes'. * Details of arrow shapes are described in * http://www.graphviz.org/content/arrow-shapes */ var arrowTypes = { dot: "circle", box: "box", crow: "crow", curve: "curve", icurve: "inv_curve", normal: "triangle", inv: "inv_triangle", diamond: "diamond", tee: "bar", vee: "vee" }; /** * 'attr_list' contains attributes for checking if some of them are affected * later. For instance, both of 'arrowhead' and 'dir' (edge style defined * in DOT) make changes to 'arrows' attribute in vis. */ var attr_list = new Array(); var attr_names = new Array(); while (token === "[") { getToken(); attr = {}; while (token !== "" && token != "]") { if (tokenType != TOKENTYPE.IDENTIFIER) throw newSyntaxError("Attribute name expected"); var name = token; getToken(); if (token != "=") throw newSyntaxError("Equal sign = expected"); getToken(); if (tokenType != TOKENTYPE.IDENTIFIER) throw newSyntaxError("Attribute value expected"); var value = token; if (name === "style") value = edgeStyles[value]; var arrowType; if (name === "arrowhead") { arrowType = arrowTypes[value]; name = "arrows"; value = { to: { enabled: true, type: arrowType } }; } if (name === "arrowtail") { arrowType = arrowTypes[value]; name = "arrows"; value = { from: { enabled: true, type: arrowType } }; } attr_list.push({ attr, name, value }); attr_names.push(name); getToken(); if (token == ",") getToken(); } if (token != "]") throw newSyntaxError("Bracket ] expected"); getToken(); } /** * As explained in [1], graphviz has limitations for combination of * arrow[head|tail] and dir. If attribute list includes 'dir', * following cases just be supported. * 1. both or none + arrowhead, arrowtail * 2. forward + arrowhead (arrowtail is not affedted) * 3. back + arrowtail (arrowhead is not affected) * [1] https://www.graphviz.org/doc/info/attrs.html#h:undir_note */ if (_includesInstanceProperty(attr_names).call(attr_names, "dir")) { var idx = {}; idx.arrows = {}; for (i = 0; i < attr_list.length; i++) if (attr_list[i].name === "arrows") if (attr_list[i].value.to != null) idx.arrows.to = i; else if (attr_list[i].value.from != null) idx.arrows.from = i; else throw newSyntaxError("Invalid value of arrows"); else if (attr_list[i].name === "dir") idx.dir = i; var dir_type = attr_list[idx.dir].value; if (!_includesInstanceProperty(attr_names).call(attr_names, "arrows")) if (dir_type === "both") { attr_list.push({ attr: attr_list[idx.dir].attr, name: "arrows", value: { to: { enabled: true } } }); idx.arrows.to = attr_list.length - 1; attr_list.push({ attr: attr_list[idx.dir].attr, name: "arrows", value: { from: { enabled: true } } }); idx.arrows.from = attr_list.length - 1; } else if (dir_type === "forward") { attr_list.push({ attr: attr_list[idx.dir].attr, name: "arrows", value: { to: { enabled: true } } }); idx.arrows.to = attr_list.length - 1; } else if (dir_type === "back") { attr_list.push({ attr: attr_list[idx.dir].attr, name: "arrows", value: { from: { enabled: true } } }); idx.arrows.from = attr_list.length - 1; } else if (dir_type === "none") { attr_list.push({ attr: attr_list[idx.dir].attr, name: "arrows", value: "" }); idx.arrows.to = attr_list.length - 1; } else throw newSyntaxError("Invalid dir type \"" + dir_type + "\""); var from_type; var to_type; if (dir_type === "both") { if (idx.arrows.to && idx.arrows.from) { to_type = attr_list[idx.arrows.to].value.to.type; from_type = attr_list[idx.arrows.from].value.from.type; attr_list[idx.arrows.to] = { attr: attr_list[idx.arrows.to].attr, name: attr_list[idx.arrows.to].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; _spliceInstanceProperty(attr_list).call(attr_list, idx.arrows.from, 1); } else if (idx.arrows.to) { to_type = attr_list[idx.arrows.to].value.to.type; from_type = "arrow"; attr_list[idx.arrows.to] = { attr: attr_list[idx.arrows.to].attr, name: attr_list[idx.arrows.to].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; } else if (idx.arrows.from) { to_type = "arrow"; from_type = attr_list[idx.arrows.from].value.from.type; attr_list[idx.arrows.from] = { attr: attr_list[idx.arrows.from].attr, name: attr_list[idx.arrows.from].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; } } else if (dir_type === "back") { if (idx.arrows.to && idx.arrows.from) { to_type = ""; from_type = attr_list[idx.arrows.from].value.from.type; attr_list[idx.arrows.from] = { attr: attr_list[idx.arrows.from].attr, name: attr_list[idx.arrows.from].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; } else if (idx.arrows.to) { to_type = ""; from_type = "arrow"; idx.arrows.from = idx.arrows.to; attr_list[idx.arrows.from] = { attr: attr_list[idx.arrows.from].attr, name: attr_list[idx.arrows.from].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; } else if (idx.arrows.from) { to_type = ""; from_type = attr_list[idx.arrows.from].value.from.type; attr_list[idx.arrows.to] = { attr: attr_list[idx.arrows.from].attr, name: attr_list[idx.arrows.from].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; } attr_list[idx.arrows.from] = { attr: attr_list[idx.arrows.from].attr, name: attr_list[idx.arrows.from].name, value: { from: { enabled: true, type: attr_list[idx.arrows.from].value.from.type } } }; } else if (dir_type === "none") { var idx_arrow; if (idx.arrows.to) idx_arrow = idx.arrows.to; else idx_arrow = idx.arrows.from; attr_list[idx_arrow] = { attr: attr_list[idx_arrow].attr, name: attr_list[idx_arrow].name, value: "" }; } else if (dir_type === "forward") { if (idx.arrows.to && idx.arrows.from) { to_type = attr_list[idx.arrows.to].value.to.type; from_type = ""; attr_list[idx.arrows.to] = { attr: attr_list[idx.arrows.to].attr, name: attr_list[idx.arrows.to].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; } else if (idx.arrows.to) { to_type = attr_list[idx.arrows.to].value.to.type; from_type = ""; attr_list[idx.arrows.to] = { attr: attr_list[idx.arrows.to].attr, name: attr_list[idx.arrows.to].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; } else if (idx.arrows.from) { to_type = "arrow"; from_type = ""; idx.arrows.to = idx.arrows.from; attr_list[idx.arrows.to] = { attr: attr_list[idx.arrows.to].attr, name: attr_list[idx.arrows.to].name, value: { to: { enabled: true, type: to_type }, from: { enabled: true, type: from_type } } }; } attr_list[idx.arrows.to] = { attr: attr_list[idx.arrows.to].attr, name: attr_list[idx.arrows.to].name, value: { to: { enabled: true, type: attr_list[idx.arrows.to].value.to.type } } }; } else throw newSyntaxError("Invalid dir type \"" + dir_type + "\""); _spliceInstanceProperty(attr_list).call(attr_list, idx.dir, 1); } var nof_attr_list; if (_includesInstanceProperty(attr_names).call(attr_names, "penwidth")) { var tmp_attr_list = []; nof_attr_list = attr_list.length; for (i = 0; i < nof_attr_list; i++) if (attr_list[i].name !== "width") { if (attr_list[i].name === "penwidth") attr_list[i].name = "width"; tmp_attr_list.push(attr_list[i]); } attr_list = tmp_attr_list; } nof_attr_list = attr_list.length; for (i = 0; i < nof_attr_list; i++) setValue(attr_list[i].attr, attr_list[i].name, attr_list[i].value); return attr; } /** * Create a syntax error with extra information on current token and index. * @param {string} message * @returns {SyntaxError} err */ function newSyntaxError(message) { return new SyntaxError(message + ", got \"" + chop(token, 30) + "\" (char " + index + ")"); } /** * Chop off text after a maximum length * @param {string} text * @param {number} maxLength * @returns {string} */ function chop(text, maxLength) { return text.length <= maxLength ? text : text.substr(0, 27) + "..."; } /** * Execute a function fn for each pair of elements in two arrays * @param {Array | *} array1 * @param {Array | *} array2 * @param {Function} fn */ function forEach2(array1, array2, fn) { if (_Array$isArray(array1)) _forEachInstanceProperty(array1).call(array1, function(elem1) { if (_Array$isArray(array2)) _forEachInstanceProperty(array2).call(array2, function(elem2) { fn(elem1, elem2); }); else fn(elem1, array2); }); else if (_Array$isArray(array2)) _forEachInstanceProperty(array2).call(array2, function(elem2) { fn(array1, elem2); }); else fn(array1, array2); } /** * Set a nested property on an object * When nested objects are missing, they will be created. * For example setProp({}, 'font.color', 'red') will return {font: {color: 'red'}} * @param {object} object * @param {string} path A dot separated string like 'font.color' * @param {*} value Value for the property * @returns {object} Returns the original object, allows for chaining. */ function setProp(object$1, path$2, value) { var names = path$2.split("."); var prop = names.pop(); var obj = object$1; for (var i = 0; i < names.length; i++) { var name = names[i]; if (!(name in obj)) obj[name] = {}; obj = obj[name]; } obj[prop] = value; return object$1; } /** * Convert an object with DOT attributes to their vis.js equivalents. * @param {object} attr Object with DOT attributes * @param {object} mapping * @returns {object} Returns an object with vis.js attributes */ function convertAttr(attr, mapping) { var converted = {}; for (var prop in attr) if (attr.hasOwnProperty(prop)) { var visProp = mapping[prop]; if (_Array$isArray(visProp)) _forEachInstanceProperty(visProp).call(visProp, function(visPropI) { setProp(converted, visPropI, attr[prop]); }); else if (typeof visProp === "string") setProp(converted, visProp, attr[prop]); else setProp(converted, prop, attr[prop]); } return converted; } /** * Convert a string containing a graph in DOT language into a map containing * with nodes and edges in the format of graph. * @param {string} data Text containing a graph in DOT-notation * @returns {object} graphData */ function DOTToGraph(data) { var dotData = parseDOT(data); var graphData = { nodes: [], edges: [], options: {} }; if (dotData.nodes) { var _context2; _forEachInstanceProperty(_context2 = dotData.nodes).call(_context2, function(dotNode) { var graphNode = { id: dotNode.id, label: String(dotNode.label || dotNode.id) }; merge(graphNode, convertAttr(dotNode.attr, NODE_ATTR_MAPPING)); if (graphNode.image) graphNode.shape = "image"; graphData.nodes.push(graphNode); }); } if (dotData.edges) { var _context3; /** * Convert an edge in DOT format to an edge with VisGraph format * @param {object} dotEdge * @returns {object} graphEdge */ var convertEdge = function(dotEdge) { var graphEdge = { from: dotEdge.from, to: dotEdge.to }; merge(graphEdge, convertAttr(dotEdge.attr, EDGE_ATTR_MAPPING)); if (graphEdge.arrows == null && dotEdge.type === "->") graphEdge.arrows = "to"; return graphEdge; }; _forEachInstanceProperty(_context3 = dotData.edges).call(_context3, function(dotEdge) { var from, to; if (dotEdge.from instanceof Object) from = dotEdge.from.nodes; else from = { id: dotEdge.from }; if (dotEdge.to instanceof Object) to = dotEdge.to.nodes; else to = { id: dotEdge.to }; if (dotEdge.from instanceof Object && dotEdge.from.edges) { var _context4; _forEachInstanceProperty(_context4 = dotEdge.from.edges).call(_context4, function(subEdge) { var graphEdge = convertEdge(subEdge); graphData.edges.push(graphEdge); }); } forEach2(from, to, function(from$1, to$1) { var subEdge = createEdge(graphData, from$1.id, to$1.id, dotEdge.type, dotEdge.attr); var graphEdge = convertEdge(subEdge); graphData.edges.push(graphEdge); }); if (dotEdge.to instanceof Object && dotEdge.to.edges) { var _context5; _forEachInstanceProperty(_context5 = dotEdge.to.edges).call(_context5, function(subEdge) { var graphEdge = convertEdge(subEdge); graphData.edges.push(graphEdge); }); } }); } if (dotData.attr) graphData.options = dotData.attr; return graphData; } var es_array_map = {}; var hasRequiredEs_array_map; function requireEs_array_map() { if (hasRequiredEs_array_map) return es_array_map; hasRequiredEs_array_map = 1; var $ = /* @__PURE__ */ require_export(); var $map = requireArrayIteration().map; var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport(); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$2("map"); $({ target: "Array", proto: true, forced: !HAS_SPECIES_SUPPORT }, { map: function map$8(callbackfn) { return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } }); return es_array_map; } var map$6; var hasRequiredMap$6; function requireMap$6() { if (hasRequiredMap$6) return map$6; hasRequiredMap$6 = 1; requireEs_array_map(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); map$6 = getBuiltInPrototypeMethod$2("Array", "map"); return map$6; } var map$5; var hasRequiredMap$5; function requireMap$5() { if (hasRequiredMap$5) return map$5; hasRequiredMap$5 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireMap$6(); var ArrayPrototype = Array.prototype; map$5 = function(it$1) { var own = it$1.map; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.map ? method : own; }; return map$5; } var map$4; var hasRequiredMap$4; function requireMap$4() { if (hasRequiredMap$4) return map$4; hasRequiredMap$4 = 1; var parent = /* @__PURE__ */ requireMap$5(); map$4 = parent; return map$4; } var map$3; var hasRequiredMap$3; function requireMap$3() { if (hasRequiredMap$3) return map$3; hasRequiredMap$3 = 1; map$3 = /* @__PURE__ */ requireMap$4(); return map$3; } var mapExports$1 = requireMap$3(); var _mapInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(mapExports$1); /** * Convert Gephi to Vis. * @param gephiJSON - The parsed JSON data in Gephi format. * @param optionsObj - Additional options. * @returns The converted data ready to be used in Vis. */ function parseGephi(gephiJSON, optionsObj) { var _context; const options = { edges: { inheritColor: false }, nodes: { fixed: false, parseColor: false } }; if (optionsObj != null) { if (optionsObj.fixed != null) options.nodes.fixed = optionsObj.fixed; if (optionsObj.parseColor != null) options.nodes.parseColor = optionsObj.parseColor; if (optionsObj.inheritColor != null) options.edges.inheritColor = optionsObj.inheritColor; } const gEdges = gephiJSON.edges; const vEdges = _mapInstanceProperty(gEdges).call(gEdges, (gEdge) => { const vEdge = { from: gEdge.source, id: gEdge.id, to: gEdge.target }; if (gEdge.attributes != null) vEdge.attributes = gEdge.attributes; if (gEdge.label != null) vEdge.label = gEdge.label; if (gEdge.attributes != null && gEdge.attributes.title != null) vEdge.title = gEdge.attributes.title; if (gEdge.type === "Directed") vEdge.arrows = "to"; if (gEdge.color && options.edges.inheritColor === false) vEdge.color = gEdge.color; return vEdge; }); const vNodes = _mapInstanceProperty(_context = gephiJSON.nodes).call(_context, (gNode) => { const vNode = { id: gNode.id, fixed: options.nodes.fixed && gNode.x != null && gNode.y != null }; if (gNode.attributes != null) vNode.attributes = gNode.attributes; if (gNode.label != null) vNode.label = gNode.label; if (gNode.size != null) vNode.size = gNode.size; if (gNode.attributes != null && gNode.attributes.title != null) vNode.title = gNode.attributes.title; if (gNode.title != null) vNode.title = gNode.title; if (gNode.x != null) vNode.x = gNode.x; if (gNode.y != null) vNode.y = gNode.y; if (gNode.color != null) if (options.nodes.parseColor === true) vNode.color = gNode.color; else vNode.color = { background: gNode.color, border: gNode.color, highlight: { background: gNode.color, border: gNode.color }, hover: { background: gNode.color, border: gNode.color } }; return vNode; }); return { nodes: vNodes, edges: vEdges }; } const en = { addDescription: "Click in an empty space to place a new node.", addEdge: "Add Edge", addNode: "Add Node", back: "Back", close: "Close", createEdgeError: "Cannot link edges to a cluster.", del: "Delete selected", deleteClusterError: "Clusters cannot be deleted.", edgeDescription: "Click on a node and drag the edge to another node to connect them.", edit: "Edit", editClusterError: "Clusters cannot be edited.", editEdge: "Edit Edge", editEdgeDescription: "Click on the control points and drag them to a node to connect to it.", editNode: "Edit Node" }; const de = { addDescription: "Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.", addEdge: "Kante hinzufügen", addNode: "Knoten hinzufügen", back: "Zurück", close: "Schließen", createEdgeError: "Es ist nicht möglich, Kanten mit Clustern zu verbinden.", del: "Lösche Auswahl", deleteClusterError: "Cluster können nicht gelöscht werden.", edgeDescription: "Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.", edit: "Editieren", editClusterError: "Cluster können nicht editiert werden.", editEdge: "Kante editieren", editEdgeDescription: "Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.", editNode: "Knoten editieren" }; const es = { addDescription: "Haga clic en un lugar vacío para colocar un nuevo nodo.", addEdge: "Añadir arista", addNode: "Añadir nodo", back: "Atrás", close: "Cerrar", createEdgeError: "No se puede conectar una arista a un grupo.", del: "Eliminar selección", deleteClusterError: "No es posible eliminar grupos.", edgeDescription: "Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.", edit: "Editar", editClusterError: "No es posible editar grupos.", editEdge: "Editar arista", editEdgeDescription: "Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.", editNode: "Editar nodo" }; const it = { addDescription: "Clicca per aggiungere un nuovo nodo", addEdge: "Aggiungi un vertice", addNode: "Aggiungi un nodo", back: "Indietro", close: "Chiudere", createEdgeError: "Non si possono collegare vertici ad un cluster", del: "Cancella la selezione", deleteClusterError: "I cluster non possono essere cancellati", edgeDescription: "Clicca su un nodo e trascinalo ad un altro nodo per connetterli.", edit: "Modifica", editClusterError: "I clusters non possono essere modificati.", editEdge: "Modifica il vertice", editEdgeDescription: "Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.", editNode: "Modifica il nodo" }; const nl = { addDescription: "Klik op een leeg gebied om een nieuwe node te maken.", addEdge: "Link toevoegen", addNode: "Node toevoegen", back: "Terug", close: "Sluiten", createEdgeError: "Kan geen link maken naar een cluster.", del: "Selectie verwijderen", deleteClusterError: "Clusters kunnen niet worden verwijderd.", edgeDescription: "Klik op een node en sleep de link naar een andere node om ze te verbinden.", edit: "Wijzigen", editClusterError: "Clusters kunnen niet worden aangepast.", editEdge: "Link wijzigen", editEdgeDescription: "Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.", editNode: "Node wijzigen" }; const pt = { addDescription: "Clique em um espaço em branco para adicionar um novo nó", addEdge: "Adicionar aresta", addNode: "Adicionar nó", back: "Voltar", close: "Fechar", createEdgeError: "Não foi possível linkar arestas a um cluster.", del: "Remover selecionado", deleteClusterError: "Clusters não puderam ser removidos.", edgeDescription: "Clique em um nó e arraste a aresta até outro nó para conectá-los", edit: "Editar", editClusterError: "Clusters não puderam ser editados.", editEdge: "Editar aresta", editEdgeDescription: "Clique nos pontos de controle e os arraste para um nó para conectá-los", editNode: "Editar nó" }; const ru = { addDescription: "Кликните в свободное место, чтобы добавить новый узел.", addEdge: "Добавить ребро", addNode: "Добавить узел", back: "Назад", close: "Закрывать", createEdgeError: "Невозможно соединить ребра в кластер.", del: "Удалить выбранное", deleteClusterError: "Кластеры не могут быть удалены", edgeDescription: "Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.", edit: "Редактировать", editClusterError: "Кластеры недоступны для редактирования.", editEdge: "Редактировать ребро", editEdgeDescription: "Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.", editNode: "Редактировать узел" }; const cn = { addDescription: "单击空白处放置新节点。", addEdge: "添加连接线", addNode: "添加节点", back: "返回", close: "關閉", createEdgeError: "无法将连接线连接到群集。", del: "删除选定", deleteClusterError: "无法删除群集。", edgeDescription: "单击某个节点并将该连接线拖动到另一个节点以连接它们。", edit: "编辑", editClusterError: "无法编辑群集。", editEdge: "编辑连接线", editEdgeDescription: "单击控制节点并将它们拖到节点上连接。", editNode: "编辑节点" }; const uk = { addDescription: "Kлікніть на вільне місце, щоб додати новий вузол.", addEdge: "Додати край", addNode: "Додати вузол", back: "Назад", close: "Закрити", createEdgeError: "Не можливо об'єднати краї в групу.", del: "Видалити обране", deleteClusterError: "Групи не можуть бути видалені.", edgeDescription: "Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.", edit: "Редагувати", editClusterError: "Групи недоступні для редагування.", editEdge: "Редагувати край", editEdgeDescription: "Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.", editNode: "Редагувати вузол" }; const fr = { addDescription: "Cliquez dans un endroit vide pour placer un nœud.", addEdge: "Ajouter un lien", addNode: "Ajouter un nœud", back: "Retour", close: "Fermer", createEdgeError: "Impossible de créer un lien vers un cluster.", del: "Effacer la sélection", deleteClusterError: "Les clusters ne peuvent pas être effacés.", edgeDescription: "Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.", edit: "Éditer", editClusterError: "Les clusters ne peuvent pas être édités.", editEdge: "Éditer le lien", editEdgeDescription: "Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.", editNode: "Éditer le nœud" }; const cs = { addDescription: "Kluknutím do prázdného prostoru můžete přidat nový vrchol.", addEdge: "Přidat hranu", addNode: "Přidat vrchol", back: "Zpět", close: "Zavřít", createEdgeError: "Nelze připojit hranu ke shluku.", del: "Smazat výběr", deleteClusterError: "Nelze mazat shluky.", edgeDescription: "Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.", edit: "Upravit", editClusterError: "Nelze upravovat shluky.", editEdge: "Upravit hranu", editEdgeDescription: "Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.", editNode: "Upravit vrchol" }; var locales = /* @__PURE__ */ Object.freeze({ __proto__: null, cn, cs, de, en, es, fr, it, nl, pt, ru, uk }); var es_array_concat = {}; var hasRequiredEs_array_concat; function requireEs_array_concat() { if (hasRequiredEs_array_concat) return es_array_concat; hasRequiredEs_array_concat = 1; var $ = /* @__PURE__ */ require_export(); var fails$2 = /* @__PURE__ */ requireFails(); var isArray$5 = /* @__PURE__ */ requireIsArray$3(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var toObject$2 = /* @__PURE__ */ requireToObject(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); var doesNotExceedSafeInteger$2 = /* @__PURE__ */ requireDoesNotExceedSafeInteger(); var createProperty$2 = /* @__PURE__ */ requireCreateProperty(); var arraySpeciesCreate$2 = /* @__PURE__ */ requireArraySpeciesCreate(); var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var V8_VERSION = /* @__PURE__ */ requireEnvironmentV8Version(); var IS_CONCAT_SPREADABLE = wellKnownSymbol$2("isConcatSpreadable"); var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails$2(function() { var array$1 = []; array$1[IS_CONCAT_SPREADABLE] = false; return array$1.concat()[0] !== array$1; }); var isConcatSpreadable = function(O) { if (!isObject$3(O)) return false; var spreadable = O[IS_CONCAT_SPREADABLE]; return spreadable !== void 0 ? !!spreadable : isArray$5(O); }; var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !arrayMethodHasSpeciesSupport$2("concat"); $({ target: "Array", proto: true, arity: 1, forced: FORCED }, { concat: function concat$5(arg) { var O = toObject$2(this); var A = arraySpeciesCreate$2(O, 0); var n = 0; var i, k, length$1, len, E; for (i = -1, length$1 = arguments.length; i < length$1; i++) { E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = lengthOfArrayLike$2(E); doesNotExceedSafeInteger$2(n + len); for (k = 0; k < len; k++, n++) if (k in E) createProperty$2(A, n, E[k]); } else { doesNotExceedSafeInteger$2(n + 1); createProperty$2(A, n++, E); } } A.length = n; return A; } }); return es_array_concat; } var concat$3; var hasRequiredConcat$3; function requireConcat$3() { if (hasRequiredConcat$3) return concat$3; hasRequiredConcat$3 = 1; requireEs_array_concat(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); concat$3 = getBuiltInPrototypeMethod$2("Array", "concat"); return concat$3; } var concat$2; var hasRequiredConcat$2; function requireConcat$2() { if (hasRequiredConcat$2) return concat$2; hasRequiredConcat$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireConcat$3(); var ArrayPrototype = Array.prototype; concat$2 = function(it$1) { var own = it$1.concat; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.concat ? method : own; }; return concat$2; } var concat$1; var hasRequiredConcat$1; function requireConcat$1() { if (hasRequiredConcat$1) return concat$1; hasRequiredConcat$1 = 1; var parent = /* @__PURE__ */ requireConcat$2(); concat$1 = parent; return concat$1; } var concat; var hasRequiredConcat; function requireConcat() { if (hasRequiredConcat) return concat; hasRequiredConcat = 1; concat = /* @__PURE__ */ requireConcat$1(); return concat; } var concatExports = requireConcat(); var _concatInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(concatExports); /** * Normalizes language code into the format used internally. * @param locales - All the available locales. * @param rawCode - The original code as supplied by the user. * @returns Language code in the format language-COUNTRY or language, eventually * fallbacks to en. */ function normalizeLanguageCode(locales$1, rawCode) { try { const [rawLanguage, rawCountry] = rawCode.split(/[-_ /]/, 2); const language = rawLanguage != null ? rawLanguage.toLowerCase() : null; const country = rawCountry != null ? rawCountry.toUpperCase() : null; if (language && country) { const code = language + "-" + country; if (Object.prototype.hasOwnProperty.call(locales$1, code)) return code; else { var _context; console.warn(_concatInstanceProperty(_context = "Unknown variant ".concat(country, " of language ")).call(_context, language, ".")); } } if (language) { const code = language; if (Object.prototype.hasOwnProperty.call(locales$1, code)) return code; else console.warn("Unknown language ".concat(language)); } console.warn("Unknown locale ".concat(rawCode, ", falling back to English.")); return "en"; } catch (error) { console.error(error); console.warn("Unexpected error while normalizing locale ".concat(rawCode, ", falling back to English.")); return "en"; } } var CachedImage = class { /** * @ignore */ constructor() { this.NUM_ITERATIONS = 4; this.image = new Image(); this.canvas = document.createElement("canvas"); } /** * Called when the image has been successfully loaded. */ init() { if (this.initialized()) return; this.src = this.image.src; const w = this.image.width; const h = this.image.height; this.width = w; this.height = h; const h2 = Math.floor(h / 2); const h4 = Math.floor(h / 4); const h8 = Math.floor(h / 8); const h16 = Math.floor(h / 16); const w2 = Math.floor(w / 2); const w4 = Math.floor(w / 4); const w8 = Math.floor(w / 8); const w16 = Math.floor(w / 16); this.canvas.width = 3 * w4; this.canvas.height = h2; this.coordinates = [ [ 0, 0, w2, h2 ], [ w2, 0, w4, h4 ], [ w2, h4, w8, h8 ], [ 5 * w8, h4, w16, h16 ] ]; this._fillMipMap(); } /** * @returns {boolean} true if init() has been called, false otherwise. */ initialized() { return this.coordinates !== void 0; } /** * Redraw main image in various sizes to the context. * * The rationale behind this is to reduce artefacts due to interpolation * at differing zoom levels. * * Source: http://stackoverflow.com/q/18761404/1223531 * * This methods takes the resizing out of the drawing loop, in order to * reduce performance overhead. * * TODO: The code assumes that a 2D context can always be gotten. This is * not necessarily true! OTOH, if not true then usage of this class * is senseless. * @private */ _fillMipMap() { const ctx = this.canvas.getContext("2d"); const to = this.coordinates[0]; ctx.drawImage(this.image, to[0], to[1], to[2], to[3]); for (let iterations = 1; iterations < this.NUM_ITERATIONS; iterations++) { const from = this.coordinates[iterations - 1]; const to$1 = this.coordinates[iterations]; ctx.drawImage(this.canvas, from[0], from[1], from[2], from[3], to$1[0], to$1[1], to$1[2], to$1[3]); } } /** * Draw the image, using the mipmap if necessary. * * MipMap is only used if param factor > 2; otherwise, original bitmap * is resized. This is also used to skip mipmap usage, e.g. by setting factor = 1 * * Credits to 'Alex de Mulder' for original implementation. * @param {CanvasRenderingContext2D} ctx context on which to draw zoomed image * @param {Float} factor scale factor at which to draw * @param {number} left * @param {number} top * @param {number} width * @param {number} height */ drawImageAtPosition(ctx, factor, left, top, width, height) { if (!this.initialized()) return; if (factor > 2) { factor *= .5; let iterations = 0; while (factor > 2 && iterations < this.NUM_ITERATIONS) { factor *= .5; iterations += 1; } if (iterations >= this.NUM_ITERATIONS) iterations = this.NUM_ITERATIONS - 1; const from = this.coordinates[iterations]; ctx.drawImage(this.canvas, from[0], from[1], from[2], from[3], left, top, width, height); } else ctx.drawImage(this.image, left, top, width, height); } }; var Images = class { /** * @param {ImageCallback} callback */ constructor(callback) { this.images = {}; this.imageBroken = {}; this.callback = callback; } /** * @param {string} url The original Url that failed to load, if the broken image is successfully loaded it will be added to the cache using this Url as the key so that subsequent requests for this Url will return the broken image * @param {string} brokenUrl Url the broken image to try and load * @param {Image} imageToLoadBrokenUrlOn The image object */ _tryloadBrokenUrl(url, brokenUrl, imageToLoadBrokenUrlOn) { if (url === void 0 || imageToLoadBrokenUrlOn === void 0) return; if (brokenUrl === void 0) { console.warn("No broken url image defined"); return; } imageToLoadBrokenUrlOn.image.onerror = () => { console.error("Could not load brokenImage:", brokenUrl); }; imageToLoadBrokenUrlOn.image.src = brokenUrl; } /** * * @param {vis.Image} imageToRedrawWith * @private */ _redrawWithImage(imageToRedrawWith) { if (this.callback) this.callback(imageToRedrawWith); } /** * @param {string} url Url of the image * @param {string} brokenUrl Url of an image to use if the url image is not found * @returns {Image} img The image object */ load(url, brokenUrl) { const cachedImage = this.images[url]; if (cachedImage) return cachedImage; const img = new CachedImage(); this.images[url] = img; img.image.onload = () => { this._fixImageCoordinates(img.image); img.init(); this._redrawWithImage(img); }; img.image.onerror = () => { console.error("Could not load image:", url); this._tryloadBrokenUrl(url, brokenUrl, img); }; img.image.src = url; return img; } /** * IE11 fix -- thanks dponch! * * Local helper function * @param {vis.Image} imageToCache * @private */ _fixImageCoordinates(imageToCache) { if (imageToCache.width === 0) { document.body.appendChild(imageToCache); imageToCache.width = imageToCache.offsetWidth; imageToCache.height = imageToCache.offsetHeight; document.body.removeChild(imageToCache); } } }; var iterators; var hasRequiredIterators; function requireIterators() { if (hasRequiredIterators) return iterators; hasRequiredIterators = 1; iterators = {}; return iterators; } var weakMapBasicDetection; var hasRequiredWeakMapBasicDetection; function requireWeakMapBasicDetection() { if (hasRequiredWeakMapBasicDetection) return weakMapBasicDetection; hasRequiredWeakMapBasicDetection = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var WeakMap = globalThis$1.WeakMap; weakMapBasicDetection = isCallable$2(WeakMap) && /native code/.test(String(WeakMap)); return weakMapBasicDetection; } var internalState; var hasRequiredInternalState; function requireInternalState() { if (hasRequiredInternalState) return internalState; hasRequiredInternalState = 1; var NATIVE_WEAK_MAP = /* @__PURE__ */ requireWeakMapBasicDetection(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var shared$2 = /* @__PURE__ */ requireSharedStore(); var sharedKey$2 = /* @__PURE__ */ requireSharedKey(); var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys(); var OBJECT_ALREADY_INITIALIZED = "Object already initialized"; var TypeError$1 = globalThis$1.TypeError; var WeakMap = globalThis$1.WeakMap; var set$4, get, has; var enforce = function(it$1) { return has(it$1) ? get(it$1) : set$4(it$1, {}); }; var getterFor = function(TYPE) { return function(it$1) { var state; if (!isObject$3(it$1) || (state = get(it$1)).type !== TYPE) throw new TypeError$1("Incompatible receiver, " + TYPE + " required"); return state; }; }; if (NATIVE_WEAK_MAP || shared$2.state) { var store = shared$2.state || (shared$2.state = new WeakMap()); store.get = store.get; store.has = store.has; store.set = store.set; set$4 = function(it$1, metadata) { if (store.has(it$1)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED); metadata.facade = it$1; store.set(it$1, metadata); return metadata; }; get = function(it$1) { return store.get(it$1) || {}; }; has = function(it$1) { return store.has(it$1); }; } else { var STATE = sharedKey$2("state"); hiddenKeys$2[STATE] = true; set$4 = function(it$1, metadata) { if (hasOwn(it$1, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED); metadata.facade = it$1; createNonEnumerableProperty$2(it$1, STATE, metadata); return metadata; }; get = function(it$1) { return hasOwn(it$1, STATE) ? it$1[STATE] : {}; }; has = function(it$1) { return hasOwn(it$1, STATE); }; } internalState = { set: set$4, get, has, enforce, getterFor }; return internalState; } var functionName; var hasRequiredFunctionName; function requireFunctionName() { if (hasRequiredFunctionName) return functionName; hasRequiredFunctionName = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var FunctionPrototype = Function.prototype; var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; var EXISTS = hasOwn(FunctionPrototype, "name"); var PROPER = EXISTS && function something() {}.name === "something"; var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable); functionName = { EXISTS, PROPER, CONFIGURABLE }; return functionName; } var correctPrototypeGetter; var hasRequiredCorrectPrototypeGetter; function requireCorrectPrototypeGetter() { if (hasRequiredCorrectPrototypeGetter) return correctPrototypeGetter; hasRequiredCorrectPrototypeGetter = 1; var fails$2 = /* @__PURE__ */ requireFails(); correctPrototypeGetter = !fails$2(function() { function F() {} F.prototype.constructor = null; return Object.getPrototypeOf(new F()) !== F.prototype; }); return correctPrototypeGetter; } var objectGetPrototypeOf; var hasRequiredObjectGetPrototypeOf; function requireObjectGetPrototypeOf() { if (hasRequiredObjectGetPrototypeOf) return objectGetPrototypeOf; hasRequiredObjectGetPrototypeOf = 1; var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var toObject$2 = /* @__PURE__ */ requireToObject(); var sharedKey$2 = /* @__PURE__ */ requireSharedKey(); var CORRECT_PROTOTYPE_GETTER = /* @__PURE__ */ requireCorrectPrototypeGetter(); var IE_PROTO = sharedKey$2("IE_PROTO"); var $Object = Object; var ObjectPrototype = $Object.prototype; objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function(O) { var object$1 = toObject$2(O); if (hasOwn(object$1, IE_PROTO)) return object$1[IE_PROTO]; var constructor = object$1.constructor; if (isCallable$2(constructor) && object$1 instanceof constructor) return constructor.prototype; return object$1 instanceof $Object ? ObjectPrototype : null; }; return objectGetPrototypeOf; } var defineBuiltIn; var hasRequiredDefineBuiltIn; function requireDefineBuiltIn() { if (hasRequiredDefineBuiltIn) return defineBuiltIn; hasRequiredDefineBuiltIn = 1; var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty(); defineBuiltIn = function(target, key, value, options) { if (options && options.enumerable) target[key] = value; else createNonEnumerableProperty$2(target, key, value); return target; }; return defineBuiltIn; } var iteratorsCore; var hasRequiredIteratorsCore; function requireIteratorsCore() { if (hasRequiredIteratorsCore) return iteratorsCore; hasRequiredIteratorsCore = 1; var fails$2 = /* @__PURE__ */ requireFails(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var create$4 = /* @__PURE__ */ requireObjectCreate(); var getPrototypeOf = /* @__PURE__ */ requireObjectGetPrototypeOf(); var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var IS_PURE = /* @__PURE__ */ requireIsPure(); var ITERATOR = wellKnownSymbol$2("iterator"); var BUGGY_SAFARI_ITERATORS = false; var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; if ([].keys) { arrayIterator = [].keys(); if (!("next" in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; else { PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; } } var NEW_ITERATOR_PROTOTYPE = !isObject$3(IteratorPrototype) || fails$2(function() { var test = {}; return IteratorPrototype[ITERATOR].call(test) !== test; }); if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; else if (IS_PURE) IteratorPrototype = create$4(IteratorPrototype); if (!isCallable$2(IteratorPrototype[ITERATOR])) defineBuiltIn$2(IteratorPrototype, ITERATOR, function() { return this; }); iteratorsCore = { IteratorPrototype, BUGGY_SAFARI_ITERATORS }; return iteratorsCore; } var objectToString; var hasRequiredObjectToString; function requireObjectToString() { if (hasRequiredObjectToString) return objectToString; hasRequiredObjectToString = 1; var TO_STRING_TAG_SUPPORT = /* @__PURE__ */ requireToStringTagSupport(); var classof$2 = /* @__PURE__ */ requireClassof(); objectToString = TO_STRING_TAG_SUPPORT ? {}.toString : function toString$2() { return "[object " + classof$2(this) + "]"; }; return objectToString; } var setToStringTag; var hasRequiredSetToStringTag; function requireSetToStringTag() { if (hasRequiredSetToStringTag) return setToStringTag; hasRequiredSetToStringTag = 1; var TO_STRING_TAG_SUPPORT = /* @__PURE__ */ requireToStringTagSupport(); var defineProperty$7 = requireObjectDefineProperty().f; var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var toString$2 = /* @__PURE__ */ requireObjectToString(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var TO_STRING_TAG = wellKnownSymbol$2("toStringTag"); setToStringTag = function(it$1, TAG, STATIC, SET_METHOD) { var target = STATIC ? it$1 : it$1 && it$1.prototype; if (target) { if (!hasOwn(target, TO_STRING_TAG)) defineProperty$7(target, TO_STRING_TAG, { configurable: true, value: TAG }); if (SET_METHOD && !TO_STRING_TAG_SUPPORT) createNonEnumerableProperty$2(target, "toString", toString$2); } }; return setToStringTag; } var iteratorCreateConstructor; var hasRequiredIteratorCreateConstructor; function requireIteratorCreateConstructor() { if (hasRequiredIteratorCreateConstructor) return iteratorCreateConstructor; hasRequiredIteratorCreateConstructor = 1; var IteratorPrototype = requireIteratorsCore().IteratorPrototype; var create$4 = /* @__PURE__ */ requireObjectCreate(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag(); var Iterators = /* @__PURE__ */ requireIterators(); var returnThis = function() { return this; }; iteratorCreateConstructor = function(IteratorConstructor, NAME, next$1, ENUMERABLE_NEXT) { var TO_STRING_TAG = NAME + " Iterator"; IteratorConstructor.prototype = create$4(IteratorPrototype, { next: createPropertyDescriptor$2(+!ENUMERABLE_NEXT, next$1) }); setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false, true); Iterators[TO_STRING_TAG] = returnThis; return IteratorConstructor; }; return iteratorCreateConstructor; } var functionUncurryThisAccessor; var hasRequiredFunctionUncurryThisAccessor; function requireFunctionUncurryThisAccessor() { if (hasRequiredFunctionUncurryThisAccessor) return functionUncurryThisAccessor; hasRequiredFunctionUncurryThisAccessor = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var aCallable$2 = /* @__PURE__ */ requireACallable(); functionUncurryThisAccessor = function(object$1, key, method) { try { return uncurryThis(aCallable$2(Object.getOwnPropertyDescriptor(object$1, key)[method])); } catch (error) {} }; return functionUncurryThisAccessor; } var isPossiblePrototype; var hasRequiredIsPossiblePrototype; function requireIsPossiblePrototype() { if (hasRequiredIsPossiblePrototype) return isPossiblePrototype; hasRequiredIsPossiblePrototype = 1; var isObject$3 = /* @__PURE__ */ requireIsObject(); isPossiblePrototype = function(argument) { return isObject$3(argument) || argument === null; }; return isPossiblePrototype; } var aPossiblePrototype; var hasRequiredAPossiblePrototype; function requireAPossiblePrototype() { if (hasRequiredAPossiblePrototype) return aPossiblePrototype; hasRequiredAPossiblePrototype = 1; var isPossiblePrototype$2 = /* @__PURE__ */ requireIsPossiblePrototype(); var $String = String; var $TypeError = TypeError; aPossiblePrototype = function(argument) { if (isPossiblePrototype$2(argument)) return argument; throw new $TypeError("Can't set " + $String(argument) + " as a prototype"); }; return aPossiblePrototype; } var objectSetPrototypeOf; var hasRequiredObjectSetPrototypeOf; function requireObjectSetPrototypeOf() { if (hasRequiredObjectSetPrototypeOf) return objectSetPrototypeOf; hasRequiredObjectSetPrototypeOf = 1; var uncurryThisAccessor = /* @__PURE__ */ requireFunctionUncurryThisAccessor(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); var aPossiblePrototype$2 = /* @__PURE__ */ requireAPossiblePrototype(); objectSetPrototypeOf = Object.setPrototypeOf || ("__proto__" in {} ? function() { var CORRECT_SETTER = false; var test = {}; var setter; try { setter = uncurryThisAccessor(Object.prototype, "__proto__", "set"); setter(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) {} return function setPrototypeOf(O, proto) { requireObjectCoercible$2(O); aPossiblePrototype$2(proto); if (!isObject$3(O)) return O; if (CORRECT_SETTER) setter(O, proto); else O.__proto__ = proto; return O; }; }() : void 0); return objectSetPrototypeOf; } var iteratorDefine; var hasRequiredIteratorDefine; function requireIteratorDefine() { if (hasRequiredIteratorDefine) return iteratorDefine; hasRequiredIteratorDefine = 1; var $ = /* @__PURE__ */ require_export(); var call = /* @__PURE__ */ requireFunctionCall(); var IS_PURE = /* @__PURE__ */ requireIsPure(); var FunctionName = /* @__PURE__ */ requireFunctionName(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var createIteratorConstructor = /* @__PURE__ */ requireIteratorCreateConstructor(); var getPrototypeOf = /* @__PURE__ */ requireObjectGetPrototypeOf(); var setPrototypeOf = /* @__PURE__ */ requireObjectSetPrototypeOf(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag(); var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty(); var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var Iterators = /* @__PURE__ */ requireIterators(); var IteratorsCore = /* @__PURE__ */ requireIteratorsCore(); var PROPER_FUNCTION_NAME = FunctionName.PROPER; var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR = wellKnownSymbol$2("iterator"); var KEYS = "keys"; var VALUES = "values"; var ENTRIES = "entries"; var returnThis = function() { return this; }; iteratorDefine = function(Iterable, NAME, IteratorConstructor, next$1, DEFAULT, IS_SET, FORCED) { createIteratorConstructor(IteratorConstructor, NAME, next$1); var getIterationMethod = function(KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND]; switch (KIND) { case KEYS: return function keys$8() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values$8() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries$4() { return new IteratorConstructor(this, KIND); }; } return function() { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + " Iterator"; var INCORRECT_VALUES_NAME = false; var IterablePrototype = Iterable.prototype; var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype["@@iterator"] || DEFAULT && IterablePrototype[DEFAULT]; var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); var anyNativeIterator = NAME === "Array" ? IterablePrototype.entries || nativeIterator : nativeIterator; var CurrentIteratorPrototype, methods, KEY; if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf) setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); else if (!isCallable$2(CurrentIteratorPrototype[ITERATOR])) defineBuiltIn$2(CurrentIteratorPrototype, ITERATOR, returnThis); } setToStringTag$2(CurrentIteratorPrototype, TO_STRING_TAG, true, true); if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; } } if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) createNonEnumerableProperty$2(IterablePrototype, "name", VALUES); else { INCORRECT_VALUES_NAME = true; defaultIterator = function values$8() { return call(nativeIterator, this); }; } if (DEFAULT) { methods = { values: getIterationMethod(VALUES), keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), entries: getIterationMethod(ENTRIES) }; if (FORCED) { for (KEY in methods) if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]); } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) defineBuiltIn$2(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT }); Iterators[NAME] = defaultIterator; return methods; }; return iteratorDefine; } var createIterResultObject; var hasRequiredCreateIterResultObject; function requireCreateIterResultObject() { if (hasRequiredCreateIterResultObject) return createIterResultObject; hasRequiredCreateIterResultObject = 1; createIterResultObject = function(value, done) { return { value, done }; }; return createIterResultObject; } var es_array_iterator; var hasRequiredEs_array_iterator; function requireEs_array_iterator() { if (hasRequiredEs_array_iterator) return es_array_iterator; hasRequiredEs_array_iterator = 1; var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var addToUnscopables$2 = /* @__PURE__ */ requireAddToUnscopables(); var Iterators = /* @__PURE__ */ requireIterators(); var InternalStateModule = /* @__PURE__ */ requireInternalState(); var defineProperty$7 = requireObjectDefineProperty().f; var defineIterator = /* @__PURE__ */ requireIteratorDefine(); var createIterResultObject$2 = /* @__PURE__ */ requireCreateIterResultObject(); var IS_PURE = /* @__PURE__ */ requireIsPure(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var ARRAY_ITERATOR = "Array Iterator"; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); es_array_iterator = defineIterator(Array, "Array", function(iterated, kind) { setInternalState(this, { type: ARRAY_ITERATOR, target: toIndexedObject$2(iterated), index: 0, kind }); }, function() { var state = getInternalState(this); var target = state.target; var index$1 = state.index++; if (!target || index$1 >= target.length) { state.target = null; return createIterResultObject$2(void 0, true); } switch (state.kind) { case "keys": return createIterResultObject$2(index$1, false); case "values": return createIterResultObject$2(target[index$1], false); } return createIterResultObject$2([index$1, target[index$1]], false); }, "values"); var values$8 = Iterators.Arguments = Iterators.Array; addToUnscopables$2("keys"); addToUnscopables$2("values"); addToUnscopables$2("entries"); if (!IS_PURE && DESCRIPTORS && values$8.name !== "values") try { defineProperty$7(values$8, "name", { value: "values" }); } catch (error) {} return es_array_iterator; } var es_map = {}; var es_map_constructor = {}; var internalMetadata = { exports: {} }; var objectGetOwnPropertyNames = {}; var hasRequiredObjectGetOwnPropertyNames; function requireObjectGetOwnPropertyNames() { if (hasRequiredObjectGetOwnPropertyNames) return objectGetOwnPropertyNames; hasRequiredObjectGetOwnPropertyNames = 1; var internalObjectKeys = /* @__PURE__ */ requireObjectKeysInternal(); var enumBugKeys$2 = /* @__PURE__ */ requireEnumBugKeys(); var hiddenKeys$2 = enumBugKeys$2.concat("length", "prototype"); objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames$3(O) { return internalObjectKeys(O, hiddenKeys$2); }; return objectGetOwnPropertyNames; } var objectGetOwnPropertyNamesExternal = {}; var hasRequiredObjectGetOwnPropertyNamesExternal; function requireObjectGetOwnPropertyNamesExternal() { if (hasRequiredObjectGetOwnPropertyNamesExternal) return objectGetOwnPropertyNamesExternal; hasRequiredObjectGetOwnPropertyNamesExternal = 1; var classof$2 = /* @__PURE__ */ requireClassofRaw(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var $getOwnPropertyNames = requireObjectGetOwnPropertyNames().f; var arraySlice$2 = /* @__PURE__ */ requireArraySlice(); var windowNames = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function(it$1) { try { return $getOwnPropertyNames(it$1); } catch (error) { return arraySlice$2(windowNames); } }; objectGetOwnPropertyNamesExternal.f = function getOwnPropertyNames$3(it$1) { return windowNames && classof$2(it$1) === "Window" ? getWindowNames(it$1) : $getOwnPropertyNames(toIndexedObject$2(it$1)); }; return objectGetOwnPropertyNamesExternal; } var arrayBufferNonExtensible; var hasRequiredArrayBufferNonExtensible; function requireArrayBufferNonExtensible() { if (hasRequiredArrayBufferNonExtensible) return arrayBufferNonExtensible; hasRequiredArrayBufferNonExtensible = 1; var fails$2 = /* @__PURE__ */ requireFails(); arrayBufferNonExtensible = fails$2(function() { if (typeof ArrayBuffer == "function") { var buffer = new ArrayBuffer(8); if (Object.isExtensible(buffer)) Object.defineProperty(buffer, "a", { value: 8 }); } }); return arrayBufferNonExtensible; } var objectIsExtensible; var hasRequiredObjectIsExtensible; function requireObjectIsExtensible() { if (hasRequiredObjectIsExtensible) return objectIsExtensible; hasRequiredObjectIsExtensible = 1; var fails$2 = /* @__PURE__ */ requireFails(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var classof$2 = /* @__PURE__ */ requireClassofRaw(); var ARRAY_BUFFER_NON_EXTENSIBLE = /* @__PURE__ */ requireArrayBufferNonExtensible(); var $isExtensible = Object.isExtensible; var FAILS_ON_PRIMITIVES = fails$2(function() {}); objectIsExtensible = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it$1) { if (!isObject$3(it$1)) return false; if (ARRAY_BUFFER_NON_EXTENSIBLE && classof$2(it$1) === "ArrayBuffer") return false; return $isExtensible ? $isExtensible(it$1) : true; } : $isExtensible; return objectIsExtensible; } var freezing; var hasRequiredFreezing; function requireFreezing() { if (hasRequiredFreezing) return freezing; hasRequiredFreezing = 1; var fails$2 = /* @__PURE__ */ requireFails(); freezing = !fails$2(function() { return Object.isExtensible(Object.preventExtensions({})); }); return freezing; } var hasRequiredInternalMetadata; function requireInternalMetadata() { if (hasRequiredInternalMetadata) return internalMetadata.exports; hasRequiredInternalMetadata = 1; var $ = /* @__PURE__ */ require_export(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var defineProperty$7 = requireObjectDefineProperty().f; var getOwnPropertyNamesModule = /* @__PURE__ */ requireObjectGetOwnPropertyNames(); var getOwnPropertyNamesExternalModule = /* @__PURE__ */ requireObjectGetOwnPropertyNamesExternal(); var isExtensible = /* @__PURE__ */ requireObjectIsExtensible(); var uid$2 = /* @__PURE__ */ requireUid(); var FREEZING = /* @__PURE__ */ requireFreezing(); var REQUIRED = false; var METADATA = uid$2("meta"); var id = 0; var setMetadata = function(it$1) { defineProperty$7(it$1, METADATA, { value: { objectID: "O" + id++, weakData: {} } }); }; var fastKey = function(it$1, create$4) { if (!isObject$3(it$1)) return typeof it$1 == "symbol" ? it$1 : (typeof it$1 == "string" ? "S" : "P") + it$1; if (!hasOwn(it$1, METADATA)) { if (!isExtensible(it$1)) return "F"; if (!create$4) return "E"; setMetadata(it$1); } return it$1[METADATA].objectID; }; var getWeakData = function(it$1, create$4) { if (!hasOwn(it$1, METADATA)) { if (!isExtensible(it$1)) return true; if (!create$4) return false; setMetadata(it$1); } return it$1[METADATA].weakData; }; var onFreeze = function(it$1) { if (FREEZING && REQUIRED && isExtensible(it$1) && !hasOwn(it$1, METADATA)) setMetadata(it$1); return it$1; }; var enable = function() { meta.enable = function() {}; REQUIRED = true; var getOwnPropertyNames$3 = getOwnPropertyNamesModule.f; var splice$5 = uncurryThis([].splice); var test = {}; test[METADATA] = 1; if (getOwnPropertyNames$3(test).length) { getOwnPropertyNamesModule.f = function(it$1) { var result = getOwnPropertyNames$3(it$1); for (var i = 0, length$1 = result.length; i < length$1; i++) if (result[i] === METADATA) { splice$5(result, i, 1); break; } return result; }; $({ target: "Object", stat: true, forced: true }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f }); } }; var meta = internalMetadata.exports = { enable, fastKey, getWeakData, onFreeze }; hiddenKeys$2[METADATA] = true; return internalMetadata.exports; } var isArrayIteratorMethod; var hasRequiredIsArrayIteratorMethod; function requireIsArrayIteratorMethod() { if (hasRequiredIsArrayIteratorMethod) return isArrayIteratorMethod; hasRequiredIsArrayIteratorMethod = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var Iterators = /* @__PURE__ */ requireIterators(); var ITERATOR = wellKnownSymbol$2("iterator"); var ArrayPrototype = Array.prototype; isArrayIteratorMethod = function(it$1) { return it$1 !== void 0 && (Iterators.Array === it$1 || ArrayPrototype[ITERATOR] === it$1); }; return isArrayIteratorMethod; } var getIteratorMethod; var hasRequiredGetIteratorMethod; function requireGetIteratorMethod() { if (hasRequiredGetIteratorMethod) return getIteratorMethod; hasRequiredGetIteratorMethod = 1; var classof$2 = /* @__PURE__ */ requireClassof(); var getMethod$2 = /* @__PURE__ */ requireGetMethod(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined(); var Iterators = /* @__PURE__ */ requireIterators(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var ITERATOR = wellKnownSymbol$2("iterator"); getIteratorMethod = function(it$1) { if (!isNullOrUndefined$2(it$1)) return getMethod$2(it$1, ITERATOR) || getMethod$2(it$1, "@@iterator") || Iterators[classof$2(it$1)]; }; return getIteratorMethod; } var getIterator; var hasRequiredGetIterator; function requireGetIterator() { if (hasRequiredGetIterator) return getIterator; hasRequiredGetIterator = 1; var call = /* @__PURE__ */ requireFunctionCall(); var aCallable$2 = /* @__PURE__ */ requireACallable(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var tryToString$2 = /* @__PURE__ */ requireTryToString(); var getIteratorMethod$2 = /* @__PURE__ */ requireGetIteratorMethod(); var $TypeError = TypeError; getIterator = function(argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod$2(argument) : usingIterator; if (aCallable$2(iteratorMethod)) return anObject$2(call(iteratorMethod, argument)); throw new $TypeError(tryToString$2(argument) + " is not iterable"); }; return getIterator; } var iteratorClose; var hasRequiredIteratorClose; function requireIteratorClose() { if (hasRequiredIteratorClose) return iteratorClose; hasRequiredIteratorClose = 1; var call = /* @__PURE__ */ requireFunctionCall(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var getMethod$2 = /* @__PURE__ */ requireGetMethod(); iteratorClose = function(iterator$7, kind, value) { var innerResult, innerError; anObject$2(iterator$7); try { innerResult = getMethod$2(iterator$7, "return"); if (!innerResult) { if (kind === "throw") throw value; return value; } innerResult = call(innerResult, iterator$7); } catch (error) { innerError = true; innerResult = error; } if (kind === "throw") throw value; if (innerError) throw innerResult; anObject$2(innerResult); return value; }; return iteratorClose; } var iterate; var hasRequiredIterate; function requireIterate() { if (hasRequiredIterate) return iterate; hasRequiredIterate = 1; var bind$5 = /* @__PURE__ */ requireFunctionBindContext(); var call = /* @__PURE__ */ requireFunctionCall(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var tryToString$2 = /* @__PURE__ */ requireTryToString(); var isArrayIteratorMethod$2 = /* @__PURE__ */ requireIsArrayIteratorMethod(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var getIterator$7 = /* @__PURE__ */ requireGetIterator(); var getIteratorMethod$2 = /* @__PURE__ */ requireGetIteratorMethod(); var iteratorClose$2 = /* @__PURE__ */ requireIteratorClose(); var $TypeError = TypeError; var Result = function(stopped, result) { this.stopped = stopped; this.result = result; }; var ResultPrototype = Result.prototype; iterate = function(iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_RECORD = !!(options && options.IS_RECORD); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = bind$5(unboundFunction, that); var iterator$7, iterFn, index$1, length$1, result, next$1, step; var stop = function(condition) { if (iterator$7) iteratorClose$2(iterator$7, "normal"); return new Result(true, condition); }; var callFn = function(value) { if (AS_ENTRIES) { anObject$2(value); return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; if (IS_RECORD) iterator$7 = iterable.iterator; else if (IS_ITERATOR) iterator$7 = iterable; else { iterFn = getIteratorMethod$2(iterable); if (!iterFn) throw new $TypeError(tryToString$2(iterable) + " is not iterable"); if (isArrayIteratorMethod$2(iterFn)) { for (index$1 = 0, length$1 = lengthOfArrayLike$2(iterable); length$1 > index$1; index$1++) { result = callFn(iterable[index$1]); if (result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); } iterator$7 = getIterator$7(iterable, iterFn); } next$1 = IS_RECORD ? iterable.next : iterator$7.next; while (!(step = call(next$1, iterator$7)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose$2(iterator$7, "throw", error); } if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); }; return iterate; } var anInstance; var hasRequiredAnInstance; function requireAnInstance() { if (hasRequiredAnInstance) return anInstance; hasRequiredAnInstance = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var $TypeError = TypeError; anInstance = function(it$1, Prototype) { if (isPrototypeOf(Prototype, it$1)) return it$1; throw new $TypeError("Incorrect invocation"); }; return anInstance; } var collection; var hasRequiredCollection; function requireCollection() { if (hasRequiredCollection) return collection; hasRequiredCollection = 1; var $ = /* @__PURE__ */ require_export(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var InternalMetadataModule = /* @__PURE__ */ requireInternalMetadata(); var fails$2 = /* @__PURE__ */ requireFails(); var createNonEnumerableProperty$2 = /* @__PURE__ */ requireCreateNonEnumerableProperty(); var iterate$2 = /* @__PURE__ */ requireIterate(); var anInstance$2 = /* @__PURE__ */ requireAnInstance(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag(); var defineProperty$7 = requireObjectDefineProperty().f; var forEach$6 = requireArrayIteration().forEach; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var InternalStateModule = /* @__PURE__ */ requireInternalState(); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; collection = function(CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf("Map") !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf("Weak") !== -1; var ADDER = IS_MAP ? "set" : "add"; var NativeConstructor = globalThis$1[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var exported = {}; var Constructor; if (!DESCRIPTORS || !isCallable$2(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails$2(function() { new NativeConstructor().entries().next(); }))) { Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); InternalMetadataModule.enable(); } else { Constructor = wrapper(function(target, iterable) { setInternalState(anInstance$2(target, Prototype), { type: CONSTRUCTOR_NAME, collection: new NativeConstructor() }); if (!isNullOrUndefined$2(iterable)) iterate$2(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); forEach$6([ "add", "clear", "delete", "forEach", "get", "has", "set", "keys", "values", "entries" ], function(KEY) { var IS_ADDER = KEY === "add" || KEY === "set"; if (KEY in NativePrototype && !(IS_WEAK && KEY === "clear")) createNonEnumerableProperty$2(Prototype, KEY, function(a, b) { var collection$2 = getInternalState(this).collection; if (!IS_ADDER && IS_WEAK && !isObject$3(a)) return KEY === "get" ? void 0 : false; var result = collection$2[KEY](a === 0 ? 0 : a, b); return IS_ADDER ? this : result; }); }); IS_WEAK || defineProperty$7(Prototype, "size", { configurable: true, get: function() { return getInternalState(this).collection.size; } }); } setToStringTag$2(Constructor, CONSTRUCTOR_NAME, false, true); exported[CONSTRUCTOR_NAME] = Constructor; $({ global: true, forced: true }, exported); if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); return Constructor; }; return collection; } var defineBuiltInAccessor; var hasRequiredDefineBuiltInAccessor; function requireDefineBuiltInAccessor() { if (hasRequiredDefineBuiltInAccessor) return defineBuiltInAccessor; hasRequiredDefineBuiltInAccessor = 1; var defineProperty$7 = /* @__PURE__ */ requireObjectDefineProperty(); defineBuiltInAccessor = function(target, name, descriptor) { return defineProperty$7.f(target, name, descriptor); }; return defineBuiltInAccessor; } var defineBuiltIns; var hasRequiredDefineBuiltIns; function requireDefineBuiltIns() { if (hasRequiredDefineBuiltIns) return defineBuiltIns; hasRequiredDefineBuiltIns = 1; var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn(); defineBuiltIns = function(target, src, options) { for (var key in src) if (options && options.unsafe && target[key]) target[key] = src[key]; else defineBuiltIn$2(target, key, src[key], options); return target; }; return defineBuiltIns; } var setSpecies; var hasRequiredSetSpecies; function requireSetSpecies() { if (hasRequiredSetSpecies) return setSpecies; hasRequiredSetSpecies = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var defineBuiltInAccessor$2 = /* @__PURE__ */ requireDefineBuiltInAccessor(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var SPECIES = wellKnownSymbol$2("species"); setSpecies = function(CONSTRUCTOR_NAME) { var Constructor = getBuiltIn$2(CONSTRUCTOR_NAME); if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) defineBuiltInAccessor$2(Constructor, SPECIES, { configurable: true, get: function() { return this; } }); }; return setSpecies; } var collectionStrong; var hasRequiredCollectionStrong; function requireCollectionStrong() { if (hasRequiredCollectionStrong) return collectionStrong; hasRequiredCollectionStrong = 1; var create$4 = /* @__PURE__ */ requireObjectCreate(); var defineBuiltInAccessor$2 = /* @__PURE__ */ requireDefineBuiltInAccessor(); var defineBuiltIns$2 = /* @__PURE__ */ requireDefineBuiltIns(); var bind$5 = /* @__PURE__ */ requireFunctionBindContext(); var anInstance$2 = /* @__PURE__ */ requireAnInstance(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined(); var iterate$2 = /* @__PURE__ */ requireIterate(); var defineIterator = /* @__PURE__ */ requireIteratorDefine(); var createIterResultObject$2 = /* @__PURE__ */ requireCreateIterResultObject(); var setSpecies$2 = /* @__PURE__ */ requireSetSpecies(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var fastKey = requireInternalMetadata().fastKey; var InternalStateModule = /* @__PURE__ */ requireInternalState(); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; collectionStrong = { getConstructor: function(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function(that, iterable) { anInstance$2(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, index: create$4(null), first: null, last: null, size: 0 }); if (!DESCRIPTORS) that.size = 0; if (!isNullOrUndefined$2(iterable)) iterate$2(iterable, that[ADDER], { that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function(that, key, value) { var state = getInternalState(that); var entry = getEntry(that, key); var previous, index$1; if (entry) entry.value = value; else { state.last = entry = { index: index$1 = fastKey(key, true), key, value, previous: previous = state.last, next: null, removed: false }; if (!state.first) state.first = entry; if (previous) previous.next = entry; if (DESCRIPTORS) state.size++; else that.size++; if (index$1 !== "F") state.index[index$1] = entry; } return that; }; var getEntry = function(that, key) { var state = getInternalState(that); var index$1 = fastKey(key); var entry; if (index$1 !== "F") return state.index[index$1]; for (entry = state.first; entry; entry = entry.next) if (entry.key === key) return entry; }; defineBuiltIns$2(Prototype, { clear: function clear() { var that = this; var state = getInternalState(that); var entry = state.first; while (entry) { entry.removed = true; if (entry.previous) entry.previous = entry.previous.next = null; entry = entry.next; } state.first = state.last = null; state.index = create$4(null); if (DESCRIPTORS) state.size = 0; else that.size = 0; }, "delete": function(key) { var that = this; var state = getInternalState(that); var entry = getEntry(that, key); if (entry) { var next$1 = entry.next; var prev = entry.previous; delete state.index[entry.index]; entry.removed = true; if (prev) prev.next = next$1; if (next$1) next$1.previous = prev; if (state.first === entry) state.first = next$1; if (state.last === entry) state.last = prev; if (DESCRIPTORS) state.size--; else that.size--; } return !!entry; }, forEach: function forEach$6(callbackfn) { var state = getInternalState(this); var boundFunction = bind$5(callbackfn, arguments.length > 1 ? arguments[1] : void 0); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); while (entry && entry.removed) entry = entry.previous; } }, has: function has(key) { return !!getEntry(this, key); } }); defineBuiltIns$2(Prototype, IS_MAP ? { get: function get(key) { var entry = getEntry(this, key); return entry && entry.value; }, set: function set$4(key, value) { return define(this, key === 0 ? 0 : key, value); } } : { add: function add(value) { return define(this, value = value === 0 ? 0 : value, value); } }); if (DESCRIPTORS) defineBuiltInAccessor$2(Prototype, "size", { configurable: true, get: function() { return getInternalState(this).size; } }); return Constructor; }, setStrong: function(Constructor, CONSTRUCTOR_NAME, IS_MAP) { var ITERATOR_NAME = CONSTRUCTOR_NAME + " Iterator"; var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); defineIterator(Constructor, CONSTRUCTOR_NAME, function(iterated, kind) { setInternalState(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), kind, last: null }); }, function() { var state = getInternalIteratorState(this); var kind = state.kind; var entry = state.last; while (entry && entry.removed) entry = entry.previous; if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { state.target = null; return createIterResultObject$2(void 0, true); } if (kind === "keys") return createIterResultObject$2(entry.key, false); if (kind === "values") return createIterResultObject$2(entry.value, false); return createIterResultObject$2([entry.key, entry.value], false); }, IS_MAP ? "entries" : "values", !IS_MAP, true); setSpecies$2(CONSTRUCTOR_NAME); } }; return collectionStrong; } var hasRequiredEs_map_constructor; function requireEs_map_constructor() { if (hasRequiredEs_map_constructor) return es_map_constructor; hasRequiredEs_map_constructor = 1; var collection$2 = /* @__PURE__ */ requireCollection(); var collectionStrong$2 = /* @__PURE__ */ requireCollectionStrong(); collection$2("Map", function(init) { return function Map$1() { return init(this, arguments.length ? arguments[0] : void 0); }; }, collectionStrong$2); return es_map_constructor; } var hasRequiredEs_map; function requireEs_map() { if (hasRequiredEs_map) return es_map; hasRequiredEs_map = 1; requireEs_map_constructor(); return es_map; } var es_map_groupBy = {}; var caller; var hasRequiredCaller; function requireCaller() { if (hasRequiredCaller) return caller; hasRequiredCaller = 1; caller = function(methodName, numArgs) { return numArgs === 1 ? function(object$1, arg) { return object$1[methodName](arg); } : function(object$1, arg1, arg2) { return object$1[methodName](arg1, arg2); }; }; return caller; } var mapHelpers; var hasRequiredMapHelpers; function requireMapHelpers() { if (hasRequiredMapHelpers) return mapHelpers; hasRequiredMapHelpers = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var caller$2 = /* @__PURE__ */ requireCaller(); var Map$1 = getBuiltIn$2("Map"); mapHelpers = { Map: Map$1, set: caller$2("set", 2), get: caller$2("get", 1), has: caller$2("has", 1), remove: caller$2("delete", 1), proto: Map$1.prototype }; return mapHelpers; } var hasRequiredEs_map_groupBy; function requireEs_map_groupBy() { if (hasRequiredEs_map_groupBy) return es_map_groupBy; hasRequiredEs_map_groupBy = 1; var $ = /* @__PURE__ */ require_export(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var aCallable$2 = /* @__PURE__ */ requireACallable(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); var iterate$2 = /* @__PURE__ */ requireIterate(); var MapHelpers = /* @__PURE__ */ requireMapHelpers(); var IS_PURE = /* @__PURE__ */ requireIsPure(); var fails$2 = /* @__PURE__ */ requireFails(); var Map$1 = MapHelpers.Map; var has = MapHelpers.has; var get = MapHelpers.get; var set$4 = MapHelpers.set; var push = uncurryThis([].push); var DOES_NOT_WORK_WITH_PRIMITIVES = IS_PURE || fails$2(function() { return Map$1.groupBy("ab", function(it$1) { return it$1; }).get("a").length !== 1; }); $({ target: "Map", stat: true, forced: IS_PURE || DOES_NOT_WORK_WITH_PRIMITIVES }, { groupBy: function groupBy(items, callbackfn) { requireObjectCoercible$2(items); aCallable$2(callbackfn); var map$8 = new Map$1(); var k = 0; iterate$2(items, function(value) { var key = callbackfn(value, k++); if (!has(map$8, key)) set$4(map$8, key, [value]); else push(get(map$8, key), value); }); return map$8; } }); return es_map_groupBy; } var es_string_iterator = {}; var stringMultibyte; var hasRequiredStringMultibyte; function requireStringMultibyte() { if (hasRequiredStringMultibyte) return stringMultibyte; hasRequiredStringMultibyte = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity(); var toString$2 = /* @__PURE__ */ requireToString(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); var charAt = uncurryThis("".charAt); var charCodeAt = uncurryThis("".charCodeAt); var stringSlice = uncurryThis("".slice); var createMethod = function(CONVERT_TO_STRING) { return function($this, pos) { var S = toString$2(requireObjectCoercible$2($this)); var position = toIntegerOrInfinity$2(pos); var size = S.length; var first$1, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? "" : void 0; first$1 = charCodeAt(S, position); return first$1 < 55296 || first$1 > 56319 || position + 1 === size || (second = charCodeAt(S, position + 1)) < 56320 || second > 57343 ? CONVERT_TO_STRING ? charAt(S, position) : first$1 : CONVERT_TO_STRING ? stringSlice(S, position, position + 2) : (first$1 - 55296 << 10) + (second - 56320) + 65536; }; }; stringMultibyte = { codeAt: createMethod(false), charAt: createMethod(true) }; return stringMultibyte; } var hasRequiredEs_string_iterator; function requireEs_string_iterator() { if (hasRequiredEs_string_iterator) return es_string_iterator; hasRequiredEs_string_iterator = 1; var charAt = requireStringMultibyte().charAt; var toString$2 = /* @__PURE__ */ requireToString(); var InternalStateModule = /* @__PURE__ */ requireInternalState(); var defineIterator = /* @__PURE__ */ requireIteratorDefine(); var createIterResultObject$2 = /* @__PURE__ */ requireCreateIterResultObject(); var STRING_ITERATOR = "String Iterator"; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); defineIterator(String, "String", function(iterated) { setInternalState(this, { type: STRING_ITERATOR, string: toString$2(iterated), index: 0 }); }, function next$1() { var state = getInternalState(this); var string$1 = state.string; var index$1 = state.index; var point; if (index$1 >= string$1.length) return createIterResultObject$2(void 0, true); point = charAt(string$1, index$1); state.index += point.length; return createIterResultObject$2(point, false); }); return es_string_iterator; } var map$2; var hasRequiredMap$2; function requireMap$2() { if (hasRequiredMap$2) return map$2; hasRequiredMap$2 = 1; requireEs_array_iterator(); requireEs_map(); requireEs_map_groupBy(); requireEs_string_iterator(); var path$2 = /* @__PURE__ */ requirePath(); map$2 = path$2.Map; return map$2; } var web_domCollections_iterator = {}; var domIterables; var hasRequiredDomIterables; function requireDomIterables() { if (hasRequiredDomIterables) return domIterables; hasRequiredDomIterables = 1; domIterables = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; return domIterables; } var hasRequiredWeb_domCollections_iterator; function requireWeb_domCollections_iterator() { if (hasRequiredWeb_domCollections_iterator) return web_domCollections_iterator; hasRequiredWeb_domCollections_iterator = 1; requireEs_array_iterator(); var DOMIterables = /* @__PURE__ */ requireDomIterables(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag(); var Iterators = /* @__PURE__ */ requireIterators(); for (var COLLECTION_NAME in DOMIterables) { setToStringTag$2(globalThis$1[COLLECTION_NAME], COLLECTION_NAME); Iterators[COLLECTION_NAME] = Iterators.Array; } return web_domCollections_iterator; } var map$1; var hasRequiredMap$1; function requireMap$1() { if (hasRequiredMap$1) return map$1; hasRequiredMap$1 = 1; var parent = /* @__PURE__ */ requireMap$2(); requireWeb_domCollections_iterator(); map$1 = parent; return map$1; } var map; var hasRequiredMap; function requireMap() { if (hasRequiredMap) return map; hasRequiredMap = 1; map = /* @__PURE__ */ requireMap$1(); return map; } var mapExports = requireMap(); var _Map = /* @__PURE__ */ getDefaultExportFromCjs(mapExports); var Groups = class { /** * @ignore */ constructor() { this.clear(); this._defaultIndex = 0; this._groupIndex = 0; this._defaultGroups = [ { border: "#2B7CE9", background: "#97C2FC", highlight: { border: "#2B7CE9", background: "#D2E5FF" }, hover: { border: "#2B7CE9", background: "#D2E5FF" } }, { border: "#FFA500", background: "#FFFF00", highlight: { border: "#FFA500", background: "#FFFFA3" }, hover: { border: "#FFA500", background: "#FFFFA3" } }, { border: "#FA0A10", background: "#FB7E81", highlight: { border: "#FA0A10", background: "#FFAFB1" }, hover: { border: "#FA0A10", background: "#FFAFB1" } }, { border: "#41A906", background: "#7BE141", highlight: { border: "#41A906", background: "#A1EC76" }, hover: { border: "#41A906", background: "#A1EC76" } }, { border: "#E129F0", background: "#EB7DF4", highlight: { border: "#E129F0", background: "#F0B3F5" }, hover: { border: "#E129F0", background: "#F0B3F5" } }, { border: "#7C29F0", background: "#AD85E4", highlight: { border: "#7C29F0", background: "#D3BDF0" }, hover: { border: "#7C29F0", background: "#D3BDF0" } }, { border: "#C37F00", background: "#FFA807", highlight: { border: "#C37F00", background: "#FFCA66" }, hover: { border: "#C37F00", background: "#FFCA66" } }, { border: "#4220FB", background: "#6E6EFD", highlight: { border: "#4220FB", background: "#9B9BFD" }, hover: { border: "#4220FB", background: "#9B9BFD" } }, { border: "#FD5A77", background: "#FFC0CB", highlight: { border: "#FD5A77", background: "#FFD1D9" }, hover: { border: "#FD5A77", background: "#FFD1D9" } }, { border: "#4AD63A", background: "#C2FABC", highlight: { border: "#4AD63A", background: "#E6FFE3" }, hover: { border: "#4AD63A", background: "#E6FFE3" } }, { border: "#990000", background: "#EE0000", highlight: { border: "#BB0000", background: "#FF3333" }, hover: { border: "#BB0000", background: "#FF3333" } }, { border: "#FF6000", background: "#FF6000", highlight: { border: "#FF6000", background: "#FF6000" }, hover: { border: "#FF6000", background: "#FF6000" } }, { border: "#97C2FC", background: "#2B7CE9", highlight: { border: "#D2E5FF", background: "#2B7CE9" }, hover: { border: "#D2E5FF", background: "#2B7CE9" } }, { border: "#399605", background: "#255C03", highlight: { border: "#399605", background: "#255C03" }, hover: { border: "#399605", background: "#255C03" } }, { border: "#B70054", background: "#FF007E", highlight: { border: "#B70054", background: "#FF007E" }, hover: { border: "#B70054", background: "#FF007E" } }, { border: "#AD85E4", background: "#7C29F0", highlight: { border: "#D3BDF0", background: "#7C29F0" }, hover: { border: "#D3BDF0", background: "#7C29F0" } }, { border: "#4557FA", background: "#000EA1", highlight: { border: "#6E6EFD", background: "#000EA1" }, hover: { border: "#6E6EFD", background: "#000EA1" } }, { border: "#FFC0CB", background: "#FD5A77", highlight: { border: "#FFD1D9", background: "#FD5A77" }, hover: { border: "#FFD1D9", background: "#FD5A77" } }, { border: "#C2FABC", background: "#74D66A", highlight: { border: "#E6FFE3", background: "#74D66A" }, hover: { border: "#E6FFE3", background: "#74D66A" } }, { border: "#EE0000", background: "#990000", highlight: { border: "#FF3333", background: "#BB0000" }, hover: { border: "#FF3333", background: "#BB0000" } } ]; this.options = {}; this.defaultOptions = { useDefaultGroups: true }; _Object$assign(this.options, this.defaultOptions); } /** * * @param {object} options */ setOptions(options) { const optionFields = ["useDefaultGroups"]; if (options !== void 0) { for (const groupName in options) if (Object.prototype.hasOwnProperty.call(options, groupName)) { if (_indexOfInstanceProperty(optionFields).call(optionFields, groupName) === -1) { const group = options[groupName]; this.add(groupName, group); } } } } /** * Clear all groups */ clear() { this._groups = new _Map(); this._groupNames = []; } /** * Get group options of a groupname. * If groupname is not found, a new group may be created. * @param {*} groupname Can be a number, string, Date, etc. * @param {boolean} [shouldCreate] If true, create a new group * @returns {object} The found or created group */ get(groupname) { let shouldCreate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; let group = this._groups.get(groupname); if (group === void 0 && shouldCreate) if (this.options.useDefaultGroups === false && this._groupNames.length > 0) { const index$1 = this._groupIndex % this._groupNames.length; ++this._groupIndex; group = {}; group.color = this._groups.get(this._groupNames[index$1]); this._groups.set(groupname, group); } else { const index$1 = this._defaultIndex % this._defaultGroups.length; this._defaultIndex++; group = {}; group.color = this._defaultGroups[index$1]; this._groups.set(groupname, group); } return group; } /** * Add custom group style. * @param {string} groupName - The name of the group, a new group will be * created if a group with the same name doesn't exist, otherwise the old * groups style will be overwritten. * @param {object} style - An object containing borderColor, backgroundColor, * etc. * @returns {object} The created group object. */ add(groupName, style) { if (!this._groups.has(groupName)) this._groupNames.push(groupName); this._groups.set(groupName, style); return style; } }; var es_number_isNan = {}; var hasRequiredEs_number_isNan; function requireEs_number_isNan() { if (hasRequiredEs_number_isNan) return es_number_isNan; hasRequiredEs_number_isNan = 1; var $ = /* @__PURE__ */ require_export(); $({ target: "Number", stat: true }, { isNaN: function isNaN$1(number$1) { return number$1 !== number$1; } }); return es_number_isNan; } var isNan$2; var hasRequiredIsNan$2; function requireIsNan$2() { if (hasRequiredIsNan$2) return isNan$2; hasRequiredIsNan$2 = 1; requireEs_number_isNan(); var path$2 = /* @__PURE__ */ requirePath(); isNan$2 = path$2.Number.isNaN; return isNan$2; } var isNan$1; var hasRequiredIsNan$1; function requireIsNan$1() { if (hasRequiredIsNan$1) return isNan$1; hasRequiredIsNan$1 = 1; var parent = /* @__PURE__ */ requireIsNan$2(); isNan$1 = parent; return isNan$1; } var isNan; var hasRequiredIsNan; function requireIsNan() { if (hasRequiredIsNan) return isNan; hasRequiredIsNan = 1; isNan = /* @__PURE__ */ requireIsNan$1(); return isNan; } var isNanExports = requireIsNan(); var _Number$isNaN = /* @__PURE__ */ getDefaultExportFromCjs(isNanExports); var es_number_isFinite = {}; var numberIsFinite; var hasRequiredNumberIsFinite; function requireNumberIsFinite() { if (hasRequiredNumberIsFinite) return numberIsFinite; hasRequiredNumberIsFinite = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var globalIsFinite = globalThis$1.isFinite; numberIsFinite = Number.isFinite || function isFinite$1(it$1) { return typeof it$1 == "number" && globalIsFinite(it$1); }; return numberIsFinite; } var hasRequiredEs_number_isFinite; function requireEs_number_isFinite() { if (hasRequiredEs_number_isFinite) return es_number_isFinite; hasRequiredEs_number_isFinite = 1; var $ = /* @__PURE__ */ require_export(); var numberIsFinite$1 = /* @__PURE__ */ requireNumberIsFinite(); $({ target: "Number", stat: true }, { isFinite: numberIsFinite$1 }); return es_number_isFinite; } var _isFinite$2; var hasRequired_isFinite$2; function require_isFinite$2() { if (hasRequired_isFinite$2) return _isFinite$2; hasRequired_isFinite$2 = 1; requireEs_number_isFinite(); var path$2 = /* @__PURE__ */ requirePath(); _isFinite$2 = path$2.Number.isFinite; return _isFinite$2; } var _isFinite$1; var hasRequired_isFinite$1; function require_isFinite$1() { if (hasRequired_isFinite$1) return _isFinite$1; hasRequired_isFinite$1 = 1; var parent = /* @__PURE__ */ require_isFinite$2(); _isFinite$1 = parent; return _isFinite$1; } var _isFinite; var hasRequired_isFinite; function require_isFinite() { if (hasRequired_isFinite) return _isFinite; hasRequired_isFinite = 1; _isFinite = /* @__PURE__ */ require_isFinite$1(); return _isFinite; } var _isFiniteExports = require_isFinite(); var _Number$isFinite = /* @__PURE__ */ getDefaultExportFromCjs(_isFiniteExports); var es_object_keys = {}; var hasRequiredEs_object_keys; function requireEs_object_keys() { if (hasRequiredEs_object_keys) return es_object_keys; hasRequiredEs_object_keys = 1; var $ = /* @__PURE__ */ require_export(); var toObject$2 = /* @__PURE__ */ requireToObject(); var nativeKeys = /* @__PURE__ */ requireObjectKeys(); var fails$2 = /* @__PURE__ */ requireFails(); var FAILS_ON_PRIMITIVES = fails$2(function() { nativeKeys(1); }); $({ target: "Object", stat: true, forced: FAILS_ON_PRIMITIVES }, { keys: function keys$8(it$1) { return nativeKeys(toObject$2(it$1)); } }); return es_object_keys; } var keys$2; var hasRequiredKeys$2; function requireKeys$2() { if (hasRequiredKeys$2) return keys$2; hasRequiredKeys$2 = 1; requireEs_object_keys(); var path$2 = /* @__PURE__ */ requirePath(); keys$2 = path$2.Object.keys; return keys$2; } var keys$1; var hasRequiredKeys$1; function requireKeys$1() { if (hasRequiredKeys$1) return keys$1; hasRequiredKeys$1 = 1; var parent = /* @__PURE__ */ requireKeys$2(); keys$1 = parent; return keys$1; } var keys; var hasRequiredKeys; function requireKeys() { if (hasRequiredKeys) return keys; hasRequiredKeys = 1; keys = /* @__PURE__ */ requireKeys$1(); return keys; } var keysExports = requireKeys(); var _Object$keys = /* @__PURE__ */ getDefaultExportFromCjs(keysExports); var es_array_some = {}; var hasRequiredEs_array_some; function requireEs_array_some() { if (hasRequiredEs_array_some) return es_array_some; hasRequiredEs_array_some = 1; var $ = /* @__PURE__ */ require_export(); var $some = requireArrayIteration().some; var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict(); var STRICT_METHOD = arrayMethodIsStrict$2("some"); $({ target: "Array", proto: true, forced: !STRICT_METHOD }, { some: function some$5(callbackfn) { return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } }); return es_array_some; } var some$3; var hasRequiredSome$3; function requireSome$3() { if (hasRequiredSome$3) return some$3; hasRequiredSome$3 = 1; requireEs_array_some(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); some$3 = getBuiltInPrototypeMethod$2("Array", "some"); return some$3; } var some$2; var hasRequiredSome$2; function requireSome$2() { if (hasRequiredSome$2) return some$2; hasRequiredSome$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireSome$3(); var ArrayPrototype = Array.prototype; some$2 = function(it$1) { var own = it$1.some; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.some ? method : own; }; return some$2; } var some$1; var hasRequiredSome$1; function requireSome$1() { if (hasRequiredSome$1) return some$1; hasRequiredSome$1 = 1; var parent = /* @__PURE__ */ requireSome$2(); some$1 = parent; return some$1; } var some; var hasRequiredSome; function requireSome() { if (hasRequiredSome) return some; hasRequiredSome = 1; some = /* @__PURE__ */ requireSome$1(); return some; } var someExports = requireSome(); var _someInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(someExports); var web_timers = {}; var web_setInterval = {}; var environment; var hasRequiredEnvironment; function requireEnvironment() { if (hasRequiredEnvironment) return environment; hasRequiredEnvironment = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var userAgent = /* @__PURE__ */ requireEnvironmentUserAgent(); var classof$2 = /* @__PURE__ */ requireClassofRaw(); var userAgentStartsWith = function(string$1) { return userAgent.slice(0, string$1.length) === string$1; }; environment = function() { if (userAgentStartsWith("Bun/")) return "BUN"; if (userAgentStartsWith("Cloudflare-Workers")) return "CLOUDFLARE"; if (userAgentStartsWith("Deno/")) return "DENO"; if (userAgentStartsWith("Node.js/")) return "NODE"; if (globalThis$1.Bun && typeof Bun.version == "string") return "BUN"; if (globalThis$1.Deno && typeof Deno.version == "object") return "DENO"; if (classof$2(globalThis$1.process) === "process") return "NODE"; if (globalThis$1.window && globalThis$1.document) return "BROWSER"; return "REST"; }(); return environment; } var validateArgumentsLength; var hasRequiredValidateArgumentsLength; function requireValidateArgumentsLength() { if (hasRequiredValidateArgumentsLength) return validateArgumentsLength; hasRequiredValidateArgumentsLength = 1; var $TypeError = TypeError; validateArgumentsLength = function(passed, required) { if (passed < required) throw new $TypeError("Not enough arguments"); return passed; }; return validateArgumentsLength; } var schedulersFix; var hasRequiredSchedulersFix; function requireSchedulersFix() { if (hasRequiredSchedulersFix) return schedulersFix; hasRequiredSchedulersFix = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var apply = /* @__PURE__ */ requireFunctionApply(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var ENVIRONMENT = /* @__PURE__ */ requireEnvironment(); var USER_AGENT = /* @__PURE__ */ requireEnvironmentUserAgent(); var arraySlice$2 = /* @__PURE__ */ requireArraySlice(); var validateArgumentsLength$2 = /* @__PURE__ */ requireValidateArgumentsLength(); var Function$1 = globalThis$1.Function; var WRAP = /MSIE .\./.test(USER_AGENT) || ENVIRONMENT === "BUN" && function() { var version = globalThis$1.Bun.version.split("."); return version.length < 3 || version[0] === "0" && (version[1] < 3 || version[1] === "3" && version[2] === "0"); }(); schedulersFix = function(scheduler, hasTimeArg) { var firstParamIndex = hasTimeArg ? 2 : 1; return WRAP ? function(handler, timeout) { var boundArgs = validateArgumentsLength$2(arguments.length, 1) > firstParamIndex; var fn = isCallable$2(handler) ? handler : Function$1(handler); var params = boundArgs ? arraySlice$2(arguments, firstParamIndex) : []; var callback = boundArgs ? function() { apply(fn, this, params); } : fn; return hasTimeArg ? scheduler(callback, timeout) : scheduler(callback); } : scheduler; }; return schedulersFix; } var hasRequiredWeb_setInterval; function requireWeb_setInterval() { if (hasRequiredWeb_setInterval) return web_setInterval; hasRequiredWeb_setInterval = 1; var $ = /* @__PURE__ */ require_export(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var schedulersFix$2 = /* @__PURE__ */ requireSchedulersFix(); var setInterval$2 = schedulersFix$2(globalThis$1.setInterval, true); $({ global: true, bind: true, forced: globalThis$1.setInterval !== setInterval$2 }, { setInterval: setInterval$2 }); return web_setInterval; } var web_setTimeout = {}; var hasRequiredWeb_setTimeout; function requireWeb_setTimeout() { if (hasRequiredWeb_setTimeout) return web_setTimeout; hasRequiredWeb_setTimeout = 1; var $ = /* @__PURE__ */ require_export(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var schedulersFix$2 = /* @__PURE__ */ requireSchedulersFix(); var setTimeout$3 = schedulersFix$2(globalThis$1.setTimeout, true); $({ global: true, bind: true, forced: globalThis$1.setTimeout !== setTimeout$3 }, { setTimeout: setTimeout$3 }); return web_setTimeout; } var hasRequiredWeb_timers; function requireWeb_timers() { if (hasRequiredWeb_timers) return web_timers; hasRequiredWeb_timers = 1; requireWeb_setInterval(); requireWeb_setTimeout(); return web_timers; } var setTimeout$2; var hasRequiredSetTimeout$1; function requireSetTimeout$1() { if (hasRequiredSetTimeout$1) return setTimeout$2; hasRequiredSetTimeout$1 = 1; requireWeb_timers(); var path$2 = /* @__PURE__ */ requirePath(); setTimeout$2 = path$2.setTimeout; return setTimeout$2; } var setTimeout$1; var hasRequiredSetTimeout; function requireSetTimeout() { if (hasRequiredSetTimeout) return setTimeout$1; hasRequiredSetTimeout = 1; setTimeout$1 = /* @__PURE__ */ requireSetTimeout$1(); return setTimeout$1; } var setTimeoutExports = requireSetTimeout(); var _setTimeout = /* @__PURE__ */ getDefaultExportFromCjs(setTimeoutExports); var defineProperty$5 = { exports: {} }; var es_object_defineProperty = {}; var hasRequiredEs_object_defineProperty; function requireEs_object_defineProperty() { if (hasRequiredEs_object_defineProperty) return es_object_defineProperty; hasRequiredEs_object_defineProperty = 1; var $ = /* @__PURE__ */ require_export(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var defineProperty$7 = requireObjectDefineProperty().f; $({ target: "Object", stat: true, forced: Object.defineProperty !== defineProperty$7, sham: !DESCRIPTORS }, { defineProperty: defineProperty$7 }); return es_object_defineProperty; } var hasRequiredDefineProperty$5; function requireDefineProperty$5() { if (hasRequiredDefineProperty$5) return defineProperty$5.exports; hasRequiredDefineProperty$5 = 1; requireEs_object_defineProperty(); var path$2 = /* @__PURE__ */ requirePath(); var Object$1 = path$2.Object; var defineProperty$7 = defineProperty$5.exports = function defineProperty$8(it$1, key, desc) { return Object$1.defineProperty(it$1, key, desc); }; if (Object$1.defineProperty.sham) defineProperty$7.sham = true; return defineProperty$5.exports; } var defineProperty$4; var hasRequiredDefineProperty$4; function requireDefineProperty$4() { if (hasRequiredDefineProperty$4) return defineProperty$4; hasRequiredDefineProperty$4 = 1; var parent = /* @__PURE__ */ requireDefineProperty$5(); defineProperty$4 = parent; return defineProperty$4; } var defineProperty$3; var hasRequiredDefineProperty$3; function requireDefineProperty$3() { if (hasRequiredDefineProperty$3) return defineProperty$3; hasRequiredDefineProperty$3 = 1; var parent = /* @__PURE__ */ requireDefineProperty$4(); defineProperty$3 = parent; return defineProperty$3; } var defineProperty$2; var hasRequiredDefineProperty$2; function requireDefineProperty$2() { if (hasRequiredDefineProperty$2) return defineProperty$2; hasRequiredDefineProperty$2 = 1; var parent = /* @__PURE__ */ requireDefineProperty$3(); defineProperty$2 = parent; return defineProperty$2; } var defineProperty$1; var hasRequiredDefineProperty$1; function requireDefineProperty$1() { if (hasRequiredDefineProperty$1) return defineProperty$1; hasRequiredDefineProperty$1 = 1; defineProperty$1 = /* @__PURE__ */ requireDefineProperty$2(); return defineProperty$1; } var definePropertyExports$1 = /* @__PURE__ */ requireDefineProperty$1(); var _Object$defineProperty$1 = /* @__PURE__ */ getDefaultExportFromCjs(definePropertyExports$1); var es_symbol = {}; var es_symbol_constructor = {}; var wellKnownSymbolWrapped = {}; var hasRequiredWellKnownSymbolWrapped; function requireWellKnownSymbolWrapped() { if (hasRequiredWellKnownSymbolWrapped) return wellKnownSymbolWrapped; hasRequiredWellKnownSymbolWrapped = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); wellKnownSymbolWrapped.f = wellKnownSymbol$2; return wellKnownSymbolWrapped; } var wellKnownSymbolDefine; var hasRequiredWellKnownSymbolDefine; function requireWellKnownSymbolDefine() { if (hasRequiredWellKnownSymbolDefine) return wellKnownSymbolDefine; hasRequiredWellKnownSymbolDefine = 1; var path$2 = /* @__PURE__ */ requirePath(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var wrappedWellKnownSymbolModule = /* @__PURE__ */ requireWellKnownSymbolWrapped(); var defineProperty$7 = requireObjectDefineProperty().f; wellKnownSymbolDefine = function(NAME) { var Symbol$1 = path$2.Symbol || (path$2.Symbol = {}); if (!hasOwn(Symbol$1, NAME)) defineProperty$7(Symbol$1, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) }); }; return wellKnownSymbolDefine; } var symbolDefineToPrimitive; var hasRequiredSymbolDefineToPrimitive; function requireSymbolDefineToPrimitive() { if (hasRequiredSymbolDefineToPrimitive) return symbolDefineToPrimitive; hasRequiredSymbolDefineToPrimitive = 1; var call = /* @__PURE__ */ requireFunctionCall(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn(); symbolDefineToPrimitive = function() { var Symbol$1 = getBuiltIn$2("Symbol"); var SymbolPrototype = Symbol$1 && Symbol$1.prototype; var valueOf = SymbolPrototype && SymbolPrototype.valueOf; var TO_PRIMITIVE = wellKnownSymbol$2("toPrimitive"); if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) defineBuiltIn$2(SymbolPrototype, TO_PRIMITIVE, function(hint) { return call(valueOf, this); }, { arity: 1 }); }; return symbolDefineToPrimitive; } var hasRequiredEs_symbol_constructor; function requireEs_symbol_constructor() { if (hasRequiredEs_symbol_constructor) return es_symbol_constructor; hasRequiredEs_symbol_constructor = 1; var $ = /* @__PURE__ */ require_export(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var call = /* @__PURE__ */ requireFunctionCall(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var IS_PURE = /* @__PURE__ */ requireIsPure(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection(); var fails$2 = /* @__PURE__ */ requireFails(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var toPropertyKey$3 = /* @__PURE__ */ requireToPropertyKey(); var $toString = /* @__PURE__ */ requireToString(); var createPropertyDescriptor$2 = /* @__PURE__ */ requireCreatePropertyDescriptor(); var nativeObjectCreate = /* @__PURE__ */ requireObjectCreate(); var objectKeys$2 = /* @__PURE__ */ requireObjectKeys(); var getOwnPropertyNamesModule = /* @__PURE__ */ requireObjectGetOwnPropertyNames(); var getOwnPropertyNamesExternal = /* @__PURE__ */ requireObjectGetOwnPropertyNamesExternal(); var getOwnPropertySymbolsModule = /* @__PURE__ */ requireObjectGetOwnPropertySymbols(); var getOwnPropertyDescriptorModule = /* @__PURE__ */ requireObjectGetOwnPropertyDescriptor(); var definePropertyModule = /* @__PURE__ */ requireObjectDefineProperty(); var definePropertiesModule = /* @__PURE__ */ requireObjectDefineProperties(); var propertyIsEnumerableModule = /* @__PURE__ */ requireObjectPropertyIsEnumerable(); var defineBuiltIn$2 = /* @__PURE__ */ requireDefineBuiltIn(); var defineBuiltInAccessor$2 = /* @__PURE__ */ requireDefineBuiltInAccessor(); var shared$2 = /* @__PURE__ */ requireShared(); var sharedKey$2 = /* @__PURE__ */ requireSharedKey(); var hiddenKeys$2 = /* @__PURE__ */ requireHiddenKeys(); var uid$2 = /* @__PURE__ */ requireUid(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var wrappedWellKnownSymbolModule = /* @__PURE__ */ requireWellKnownSymbolWrapped(); var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); var defineSymbolToPrimitive = /* @__PURE__ */ requireSymbolDefineToPrimitive(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag(); var InternalStateModule = /* @__PURE__ */ requireInternalState(); var $forEach = requireArrayIteration().forEach; var HIDDEN = sharedKey$2("hidden"); var SYMBOL = "Symbol"; var PROTOTYPE = "prototype"; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(SYMBOL); var ObjectPrototype = Object[PROTOTYPE]; var $Symbol = globalThis$1.Symbol; var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; var RangeError$1 = globalThis$1.RangeError; var TypeError$1 = globalThis$1.TypeError; var QObject = globalThis$1.QObject; var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; var push = uncurryThis([].push); var AllSymbols = shared$2("symbols"); var ObjectPrototypeSymbols = shared$2("op-symbols"); var WellKnownSymbolsStore = shared$2("wks"); var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; var fallbackDefineProperty = function(O, P, Attributes) { var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; nativeDefineProperty(O, P, Attributes); if (ObjectPrototypeDescriptor && O !== ObjectPrototype) nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); }; var setSymbolDescriptor = DESCRIPTORS && fails$2(function() { return nativeObjectCreate(nativeDefineProperty({}, "a", { get: function() { return nativeDefineProperty(this, "a", { value: 7 }).a; } })).a !== 7; }) ? fallbackDefineProperty : nativeDefineProperty; var wrap = function(tag, description) { var symbol$6 = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype); setInternalState(symbol$6, { type: SYMBOL, tag, description }); if (!DESCRIPTORS) symbol$6.description = description; return symbol$6; }; var $defineProperty = function defineProperty$7(O, P, Attributes) { if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); anObject$2(O); var key = toPropertyKey$3(P); anObject$2(Attributes); if (hasOwn(AllSymbols, key)) { if (!Attributes.enumerable) { if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor$2(1, nativeObjectCreate(null))); O[HIDDEN][key] = true; } else { if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor$2(0, false) }); } return setSymbolDescriptor(O, key, Attributes); } return nativeDefineProperty(O, key, Attributes); }; var $defineProperties = function defineProperties$4(O, Properties) { anObject$2(O); var properties = toIndexedObject$2(Properties); var keys$8 = objectKeys$2(properties).concat($getOwnPropertySymbols(properties)); $forEach(keys$8, function(key) { if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]); }); return O; }; var $create = function create$4(O, Properties) { return Properties === void 0 ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); }; var $propertyIsEnumerable = function propertyIsEnumerable(V) { var P = toPropertyKey$3(V); var enumerable = call(nativePropertyIsEnumerable, this, P); if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false; return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor$4(O, P) { var it$1 = toIndexedObject$2(O); var key = toPropertyKey$3(P); if (it$1 === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return; var descriptor = nativeGetOwnPropertyDescriptor(it$1, key); if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it$1, HIDDEN) && it$1[HIDDEN][key])) descriptor.enumerable = true; return descriptor; }; var $getOwnPropertyNames = function getOwnPropertyNames$3(O) { var names = nativeGetOwnPropertyNames(toIndexedObject$2(O)); var result = []; $forEach(names, function(key) { if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys$2, key)) push(result, key); }); return result; }; var $getOwnPropertySymbols = function(O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject$2(O)); var result = []; $forEach(names, function(key) { if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) push(result, AllSymbols[key]); }); return result; }; if (!NATIVE_SYMBOL) { $Symbol = function Symbol$1() { if (isPrototypeOf(SymbolPrototype, this)) throw new TypeError$1("Symbol is not a constructor"); var description = !arguments.length || arguments[0] === void 0 ? void 0 : $toString(arguments[0]); var tag = uid$2(description); var setter = function(value) { var $this = this === void 0 ? globalThis$1 : this; if ($this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); if (hasOwn($this, HIDDEN) && hasOwn($this[HIDDEN], tag)) $this[HIDDEN][tag] = false; var descriptor = createPropertyDescriptor$2(1, value); try { setSymbolDescriptor($this, tag, descriptor); } catch (error) { if (!(error instanceof RangeError$1)) throw error; fallbackDefineProperty($this, tag, descriptor); } }; if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); return wrap(tag, description); }; SymbolPrototype = $Symbol[PROTOTYPE]; defineBuiltIn$2(SymbolPrototype, "toString", function toString$2() { return getInternalState(this).tag; }); defineBuiltIn$2($Symbol, "withoutSetter", function(description) { return wrap(uid$2(description), description); }); propertyIsEnumerableModule.f = $propertyIsEnumerable; definePropertyModule.f = $defineProperty; definePropertiesModule.f = $defineProperties; getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; wrappedWellKnownSymbolModule.f = function(name) { return wrap(wellKnownSymbol$2(name), name); }; if (DESCRIPTORS) { defineBuiltInAccessor$2(SymbolPrototype, "description", { configurable: true, get: function description() { return getInternalState(this).description; } }); if (!IS_PURE) defineBuiltIn$2(ObjectPrototype, "propertyIsEnumerable", $propertyIsEnumerable, { unsafe: true }); } } $({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, { Symbol: $Symbol }); $forEach(objectKeys$2(WellKnownSymbolsStore), function(name) { defineWellKnownSymbol(name); }); $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, { useSetter: function() { USE_SETTER = true; }, useSimple: function() { USE_SETTER = false; } }); $({ target: "Object", stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { create: $create, defineProperty: $defineProperty, defineProperties: $defineProperties, getOwnPropertyDescriptor: $getOwnPropertyDescriptor }); $({ target: "Object", stat: true, forced: !NATIVE_SYMBOL }, { getOwnPropertyNames: $getOwnPropertyNames }); defineSymbolToPrimitive(); setToStringTag$2($Symbol, SYMBOL); hiddenKeys$2[HIDDEN] = true; return es_symbol_constructor; } var es_symbol_for = {}; var symbolRegistryDetection; var hasRequiredSymbolRegistryDetection; function requireSymbolRegistryDetection() { if (hasRequiredSymbolRegistryDetection) return symbolRegistryDetection; hasRequiredSymbolRegistryDetection = 1; var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection(); symbolRegistryDetection = NATIVE_SYMBOL && !!Symbol["for"] && !!Symbol.keyFor; return symbolRegistryDetection; } var hasRequiredEs_symbol_for; function requireEs_symbol_for() { if (hasRequiredEs_symbol_for) return es_symbol_for; hasRequiredEs_symbol_for = 1; var $ = /* @__PURE__ */ require_export(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var toString$2 = /* @__PURE__ */ requireToString(); var shared$2 = /* @__PURE__ */ requireShared(); var NATIVE_SYMBOL_REGISTRY = /* @__PURE__ */ requireSymbolRegistryDetection(); var StringToSymbolRegistry = shared$2("string-to-symbol-registry"); var SymbolToStringRegistry = shared$2("symbol-to-string-registry"); $({ target: "Symbol", stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { "for": function(key) { var string$1 = toString$2(key); if (hasOwn(StringToSymbolRegistry, string$1)) return StringToSymbolRegistry[string$1]; var symbol$6 = getBuiltIn$2("Symbol")(string$1); StringToSymbolRegistry[string$1] = symbol$6; SymbolToStringRegistry[symbol$6] = string$1; return symbol$6; } }); return es_symbol_for; } var es_symbol_keyFor = {}; var hasRequiredEs_symbol_keyFor; function requireEs_symbol_keyFor() { if (hasRequiredEs_symbol_keyFor) return es_symbol_keyFor; hasRequiredEs_symbol_keyFor = 1; var $ = /* @__PURE__ */ require_export(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol(); var tryToString$2 = /* @__PURE__ */ requireTryToString(); var shared$2 = /* @__PURE__ */ requireShared(); var NATIVE_SYMBOL_REGISTRY = /* @__PURE__ */ requireSymbolRegistryDetection(); var SymbolToStringRegistry = shared$2("symbol-to-string-registry"); $({ target: "Symbol", stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { keyFor: function keyFor(sym) { if (!isSymbol$2(sym)) throw new TypeError(tryToString$2(sym) + " is not a symbol"); if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; } }); return es_symbol_keyFor; } var es_json_stringify = {}; var getJsonReplacerFunction; var hasRequiredGetJsonReplacerFunction; function requireGetJsonReplacerFunction() { if (hasRequiredGetJsonReplacerFunction) return getJsonReplacerFunction; hasRequiredGetJsonReplacerFunction = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var isArray$5 = /* @__PURE__ */ requireIsArray$3(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var classof$2 = /* @__PURE__ */ requireClassofRaw(); var toString$2 = /* @__PURE__ */ requireToString(); var push = uncurryThis([].push); getJsonReplacerFunction = function(replacer) { if (isCallable$2(replacer)) return replacer; if (!isArray$5(replacer)) return; var rawLength = replacer.length; var keys$8 = []; for (var i = 0; i < rawLength; i++) { var element = replacer[i]; if (typeof element == "string") push(keys$8, element); else if (typeof element == "number" || classof$2(element) === "Number" || classof$2(element) === "String") push(keys$8, toString$2(element)); } var keysLength = keys$8.length; var root = true; return function(key, value) { if (root) { root = false; return value; } if (isArray$5(this)) return value; for (var j = 0; j < keysLength; j++) if (keys$8[j] === key) return value; }; }; return getJsonReplacerFunction; } var hasRequiredEs_json_stringify; function requireEs_json_stringify() { if (hasRequiredEs_json_stringify) return es_json_stringify; hasRequiredEs_json_stringify = 1; var $ = /* @__PURE__ */ require_export(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var apply = /* @__PURE__ */ requireFunctionApply(); var call = /* @__PURE__ */ requireFunctionCall(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var fails$2 = /* @__PURE__ */ requireFails(); var isCallable$2 = /* @__PURE__ */ requireIsCallable(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol(); var arraySlice$2 = /* @__PURE__ */ requireArraySlice(); var getReplacerFunction = /* @__PURE__ */ requireGetJsonReplacerFunction(); var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection(); var $String = String; var $stringify = getBuiltIn$2("JSON", "stringify"); var exec = uncurryThis(/./.exec); var charAt = uncurryThis("".charAt); var charCodeAt = uncurryThis("".charCodeAt); var replace = uncurryThis("".replace); var numberToString = uncurryThis(1.1.toString); var tester = /[\uD800-\uDFFF]/g; var low = /^[\uD800-\uDBFF]$/; var hi = /^[\uDC00-\uDFFF]$/; var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails$2(function() { var symbol$6 = getBuiltIn$2("Symbol")("stringify detection"); return $stringify([symbol$6]) !== "[null]" || $stringify({ a: symbol$6 }) !== "{}" || $stringify(Object(symbol$6)) !== "{}"; }); var ILL_FORMED_UNICODE = fails$2(function() { return $stringify('\uDF06\uD834') !== "\"\\udf06\\ud834\"" || $stringify('\uDEAD') !== "\"\\udead\""; }); var stringifyWithSymbolsFix = function(it$1, replacer) { var args = arraySlice$2(arguments); var $replacer = getReplacerFunction(replacer); if (!isCallable$2($replacer) && (it$1 === void 0 || isSymbol$2(it$1))) return; args[1] = function(key, value) { if (isCallable$2($replacer)) value = call($replacer, this, $String(key), value); if (!isSymbol$2(value)) return value; }; return apply($stringify, null, args); }; var fixIllFormed = function(match, offset, string$1) { var prev = charAt(string$1, offset - 1); var next$1 = charAt(string$1, offset + 1); if (exec(low, match) && !exec(hi, next$1) || exec(hi, match) && !exec(low, prev)) return "\\u" + numberToString(charCodeAt(match, 0), 16); return match; }; if ($stringify) $({ target: "JSON", stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, { stringify: function stringify$4(it$1, replacer, space) { var args = arraySlice$2(arguments); var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args); return ILL_FORMED_UNICODE && typeof result == "string" ? replace(result, tester, fixIllFormed) : result; } }); return es_json_stringify; } var es_object_getOwnPropertySymbols = {}; var hasRequiredEs_object_getOwnPropertySymbols; function requireEs_object_getOwnPropertySymbols() { if (hasRequiredEs_object_getOwnPropertySymbols) return es_object_getOwnPropertySymbols; hasRequiredEs_object_getOwnPropertySymbols = 1; var $ = /* @__PURE__ */ require_export(); var NATIVE_SYMBOL = /* @__PURE__ */ requireSymbolConstructorDetection(); var fails$2 = /* @__PURE__ */ requireFails(); var getOwnPropertySymbolsModule = /* @__PURE__ */ requireObjectGetOwnPropertySymbols(); var toObject$2 = /* @__PURE__ */ requireToObject(); var FORCED = !NATIVE_SYMBOL || fails$2(function() { getOwnPropertySymbolsModule.f(1); }); $({ target: "Object", stat: true, forced: FORCED }, { getOwnPropertySymbols: function getOwnPropertySymbols$4(it$1) { var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject$2(it$1)) : []; } }); return es_object_getOwnPropertySymbols; } var hasRequiredEs_symbol; function requireEs_symbol() { if (hasRequiredEs_symbol) return es_symbol; hasRequiredEs_symbol = 1; requireEs_symbol_constructor(); requireEs_symbol_for(); requireEs_symbol_keyFor(); requireEs_json_stringify(); requireEs_object_getOwnPropertySymbols(); return es_symbol; } var es_symbol_asyncDispose = {}; var hasRequiredEs_symbol_asyncDispose; function requireEs_symbol_asyncDispose() { if (hasRequiredEs_symbol_asyncDispose) return es_symbol_asyncDispose; hasRequiredEs_symbol_asyncDispose = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("asyncDispose"); return es_symbol_asyncDispose; } var es_symbol_asyncIterator = {}; var hasRequiredEs_symbol_asyncIterator; function requireEs_symbol_asyncIterator() { if (hasRequiredEs_symbol_asyncIterator) return es_symbol_asyncIterator; hasRequiredEs_symbol_asyncIterator = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("asyncIterator"); return es_symbol_asyncIterator; } var es_symbol_dispose = {}; var hasRequiredEs_symbol_dispose; function requireEs_symbol_dispose() { if (hasRequiredEs_symbol_dispose) return es_symbol_dispose; hasRequiredEs_symbol_dispose = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("dispose"); return es_symbol_dispose; } var es_symbol_hasInstance = {}; var hasRequiredEs_symbol_hasInstance; function requireEs_symbol_hasInstance() { if (hasRequiredEs_symbol_hasInstance) return es_symbol_hasInstance; hasRequiredEs_symbol_hasInstance = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("hasInstance"); return es_symbol_hasInstance; } var es_symbol_isConcatSpreadable = {}; var hasRequiredEs_symbol_isConcatSpreadable; function requireEs_symbol_isConcatSpreadable() { if (hasRequiredEs_symbol_isConcatSpreadable) return es_symbol_isConcatSpreadable; hasRequiredEs_symbol_isConcatSpreadable = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("isConcatSpreadable"); return es_symbol_isConcatSpreadable; } var es_symbol_iterator = {}; var hasRequiredEs_symbol_iterator; function requireEs_symbol_iterator() { if (hasRequiredEs_symbol_iterator) return es_symbol_iterator; hasRequiredEs_symbol_iterator = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("iterator"); return es_symbol_iterator; } var es_symbol_match = {}; var hasRequiredEs_symbol_match; function requireEs_symbol_match() { if (hasRequiredEs_symbol_match) return es_symbol_match; hasRequiredEs_symbol_match = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("match"); return es_symbol_match; } var es_symbol_matchAll = {}; var hasRequiredEs_symbol_matchAll; function requireEs_symbol_matchAll() { if (hasRequiredEs_symbol_matchAll) return es_symbol_matchAll; hasRequiredEs_symbol_matchAll = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("matchAll"); return es_symbol_matchAll; } var es_symbol_replace = {}; var hasRequiredEs_symbol_replace; function requireEs_symbol_replace() { if (hasRequiredEs_symbol_replace) return es_symbol_replace; hasRequiredEs_symbol_replace = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("replace"); return es_symbol_replace; } var es_symbol_search = {}; var hasRequiredEs_symbol_search; function requireEs_symbol_search() { if (hasRequiredEs_symbol_search) return es_symbol_search; hasRequiredEs_symbol_search = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("search"); return es_symbol_search; } var es_symbol_species = {}; var hasRequiredEs_symbol_species; function requireEs_symbol_species() { if (hasRequiredEs_symbol_species) return es_symbol_species; hasRequiredEs_symbol_species = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("species"); return es_symbol_species; } var es_symbol_split = {}; var hasRequiredEs_symbol_split; function requireEs_symbol_split() { if (hasRequiredEs_symbol_split) return es_symbol_split; hasRequiredEs_symbol_split = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("split"); return es_symbol_split; } var es_symbol_toPrimitive = {}; var hasRequiredEs_symbol_toPrimitive; function requireEs_symbol_toPrimitive() { if (hasRequiredEs_symbol_toPrimitive) return es_symbol_toPrimitive; hasRequiredEs_symbol_toPrimitive = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); var defineSymbolToPrimitive = /* @__PURE__ */ requireSymbolDefineToPrimitive(); defineWellKnownSymbol("toPrimitive"); defineSymbolToPrimitive(); return es_symbol_toPrimitive; } var es_symbol_toStringTag = {}; var hasRequiredEs_symbol_toStringTag; function requireEs_symbol_toStringTag() { if (hasRequiredEs_symbol_toStringTag) return es_symbol_toStringTag; hasRequiredEs_symbol_toStringTag = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag(); defineWellKnownSymbol("toStringTag"); setToStringTag$2(getBuiltIn$2("Symbol"), "Symbol"); return es_symbol_toStringTag; } var es_symbol_unscopables = {}; var hasRequiredEs_symbol_unscopables; function requireEs_symbol_unscopables() { if (hasRequiredEs_symbol_unscopables) return es_symbol_unscopables; hasRequiredEs_symbol_unscopables = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("unscopables"); return es_symbol_unscopables; } var es_json_toStringTag = {}; var hasRequiredEs_json_toStringTag; function requireEs_json_toStringTag() { if (hasRequiredEs_json_toStringTag) return es_json_toStringTag; hasRequiredEs_json_toStringTag = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var setToStringTag$2 = /* @__PURE__ */ requireSetToStringTag(); setToStringTag$2(globalThis$1.JSON, "JSON", true); return es_json_toStringTag; } var symbol$4; var hasRequiredSymbol$4; function requireSymbol$4() { if (hasRequiredSymbol$4) return symbol$4; hasRequiredSymbol$4 = 1; requireEs_array_concat(); requireEs_symbol(); requireEs_symbol_asyncDispose(); requireEs_symbol_asyncIterator(); requireEs_symbol_dispose(); requireEs_symbol_hasInstance(); requireEs_symbol_isConcatSpreadable(); requireEs_symbol_iterator(); requireEs_symbol_match(); requireEs_symbol_matchAll(); requireEs_symbol_replace(); requireEs_symbol_search(); requireEs_symbol_species(); requireEs_symbol_split(); requireEs_symbol_toPrimitive(); requireEs_symbol_toStringTag(); requireEs_symbol_unscopables(); requireEs_json_toStringTag(); var path$2 = /* @__PURE__ */ requirePath(); symbol$4 = path$2.Symbol; return symbol$4; } var symbol$3; var hasRequiredSymbol$3; function requireSymbol$3() { if (hasRequiredSymbol$3) return symbol$3; hasRequiredSymbol$3 = 1; var parent = /* @__PURE__ */ requireSymbol$4(); requireWeb_domCollections_iterator(); symbol$3 = parent; return symbol$3; } var esnext_function_metadata = {}; var hasRequiredEsnext_function_metadata; function requireEsnext_function_metadata() { if (hasRequiredEsnext_function_metadata) return esnext_function_metadata; hasRequiredEsnext_function_metadata = 1; var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var defineProperty$7 = requireObjectDefineProperty().f; var METADATA = wellKnownSymbol$2("metadata"); var FunctionPrototype = Function.prototype; if (FunctionPrototype[METADATA] === void 0) defineProperty$7(FunctionPrototype, METADATA, { value: null }); return esnext_function_metadata; } var esnext_symbol_asyncDispose = {}; var hasRequiredEsnext_symbol_asyncDispose; function requireEsnext_symbol_asyncDispose() { if (hasRequiredEsnext_symbol_asyncDispose) return esnext_symbol_asyncDispose; hasRequiredEsnext_symbol_asyncDispose = 1; requireEs_symbol_asyncDispose(); return esnext_symbol_asyncDispose; } var esnext_symbol_dispose = {}; var hasRequiredEsnext_symbol_dispose; function requireEsnext_symbol_dispose() { if (hasRequiredEsnext_symbol_dispose) return esnext_symbol_dispose; hasRequiredEsnext_symbol_dispose = 1; requireEs_symbol_dispose(); return esnext_symbol_dispose; } var esnext_symbol_metadata = {}; var hasRequiredEsnext_symbol_metadata; function requireEsnext_symbol_metadata() { if (hasRequiredEsnext_symbol_metadata) return esnext_symbol_metadata; hasRequiredEsnext_symbol_metadata = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("metadata"); return esnext_symbol_metadata; } var symbol$2; var hasRequiredSymbol$2; function requireSymbol$2() { if (hasRequiredSymbol$2) return symbol$2; hasRequiredSymbol$2 = 1; var parent = /* @__PURE__ */ requireSymbol$3(); requireEsnext_function_metadata(); requireEsnext_symbol_asyncDispose(); requireEsnext_symbol_dispose(); requireEsnext_symbol_metadata(); symbol$2 = parent; return symbol$2; } var esnext_symbol_isRegisteredSymbol = {}; var symbolIsRegistered; var hasRequiredSymbolIsRegistered; function requireSymbolIsRegistered() { if (hasRequiredSymbolIsRegistered) return symbolIsRegistered; hasRequiredSymbolIsRegistered = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var Symbol$1 = getBuiltIn$2("Symbol"); var keyFor = Symbol$1.keyFor; var thisSymbolValue = uncurryThis(Symbol$1.prototype.valueOf); symbolIsRegistered = Symbol$1.isRegisteredSymbol || function isRegisteredSymbol(value) { try { return keyFor(thisSymbolValue(value)) !== void 0; } catch (error) { return false; } }; return symbolIsRegistered; } var hasRequiredEsnext_symbol_isRegisteredSymbol; function requireEsnext_symbol_isRegisteredSymbol() { if (hasRequiredEsnext_symbol_isRegisteredSymbol) return esnext_symbol_isRegisteredSymbol; hasRequiredEsnext_symbol_isRegisteredSymbol = 1; var $ = /* @__PURE__ */ require_export(); var isRegisteredSymbol = /* @__PURE__ */ requireSymbolIsRegistered(); $({ target: "Symbol", stat: true }, { isRegisteredSymbol }); return esnext_symbol_isRegisteredSymbol; } var esnext_symbol_isWellKnownSymbol = {}; var symbolIsWellKnown; var hasRequiredSymbolIsWellKnown; function requireSymbolIsWellKnown() { if (hasRequiredSymbolIsWellKnown) return symbolIsWellKnown; hasRequiredSymbolIsWellKnown = 1; var shared$2 = /* @__PURE__ */ requireShared(); var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var isSymbol$2 = /* @__PURE__ */ requireIsSymbol(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var Symbol$1 = getBuiltIn$2("Symbol"); var $isWellKnownSymbol = Symbol$1.isWellKnownSymbol; var getOwnPropertyNames$3 = getBuiltIn$2("Object", "getOwnPropertyNames"); var thisSymbolValue = uncurryThis(Symbol$1.prototype.valueOf); var WellKnownSymbolsStore = shared$2("wks"); for (var i = 0, symbolKeys = getOwnPropertyNames$3(Symbol$1), symbolKeysLength = symbolKeys.length; i < symbolKeysLength; i++) try { var symbolKey = symbolKeys[i]; if (isSymbol$2(Symbol$1[symbolKey])) wellKnownSymbol$2(symbolKey); } catch (error) {} symbolIsWellKnown = function isWellKnownSymbol(value) { if ($isWellKnownSymbol && $isWellKnownSymbol(value)) return true; try { var symbol$6 = thisSymbolValue(value); for (var j = 0, keys$8 = getOwnPropertyNames$3(WellKnownSymbolsStore), keysLength = keys$8.length; j < keysLength; j++) if (WellKnownSymbolsStore[keys$8[j]] == symbol$6) return true; } catch (error) {} return false; }; return symbolIsWellKnown; } var hasRequiredEsnext_symbol_isWellKnownSymbol; function requireEsnext_symbol_isWellKnownSymbol() { if (hasRequiredEsnext_symbol_isWellKnownSymbol) return esnext_symbol_isWellKnownSymbol; hasRequiredEsnext_symbol_isWellKnownSymbol = 1; var $ = /* @__PURE__ */ require_export(); var isWellKnownSymbol = /* @__PURE__ */ requireSymbolIsWellKnown(); $({ target: "Symbol", stat: true, forced: true }, { isWellKnownSymbol }); return esnext_symbol_isWellKnownSymbol; } var esnext_symbol_customMatcher = {}; var hasRequiredEsnext_symbol_customMatcher; function requireEsnext_symbol_customMatcher() { if (hasRequiredEsnext_symbol_customMatcher) return esnext_symbol_customMatcher; hasRequiredEsnext_symbol_customMatcher = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("customMatcher"); return esnext_symbol_customMatcher; } var esnext_symbol_observable = {}; var hasRequiredEsnext_symbol_observable; function requireEsnext_symbol_observable() { if (hasRequiredEsnext_symbol_observable) return esnext_symbol_observable; hasRequiredEsnext_symbol_observable = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("observable"); return esnext_symbol_observable; } var esnext_symbol_isRegistered = {}; var hasRequiredEsnext_symbol_isRegistered; function requireEsnext_symbol_isRegistered() { if (hasRequiredEsnext_symbol_isRegistered) return esnext_symbol_isRegistered; hasRequiredEsnext_symbol_isRegistered = 1; var $ = /* @__PURE__ */ require_export(); var isRegisteredSymbol = /* @__PURE__ */ requireSymbolIsRegistered(); $({ target: "Symbol", stat: true, name: "isRegisteredSymbol" }, { isRegistered: isRegisteredSymbol }); return esnext_symbol_isRegistered; } var esnext_symbol_isWellKnown = {}; var hasRequiredEsnext_symbol_isWellKnown; function requireEsnext_symbol_isWellKnown() { if (hasRequiredEsnext_symbol_isWellKnown) return esnext_symbol_isWellKnown; hasRequiredEsnext_symbol_isWellKnown = 1; var $ = /* @__PURE__ */ require_export(); var isWellKnownSymbol = /* @__PURE__ */ requireSymbolIsWellKnown(); $({ target: "Symbol", stat: true, name: "isWellKnownSymbol", forced: true }, { isWellKnown: isWellKnownSymbol }); return esnext_symbol_isWellKnown; } var esnext_symbol_matcher = {}; var hasRequiredEsnext_symbol_matcher; function requireEsnext_symbol_matcher() { if (hasRequiredEsnext_symbol_matcher) return esnext_symbol_matcher; hasRequiredEsnext_symbol_matcher = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("matcher"); return esnext_symbol_matcher; } var esnext_symbol_metadataKey = {}; var hasRequiredEsnext_symbol_metadataKey; function requireEsnext_symbol_metadataKey() { if (hasRequiredEsnext_symbol_metadataKey) return esnext_symbol_metadataKey; hasRequiredEsnext_symbol_metadataKey = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("metadataKey"); return esnext_symbol_metadataKey; } var esnext_symbol_patternMatch = {}; var hasRequiredEsnext_symbol_patternMatch; function requireEsnext_symbol_patternMatch() { if (hasRequiredEsnext_symbol_patternMatch) return esnext_symbol_patternMatch; hasRequiredEsnext_symbol_patternMatch = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("patternMatch"); return esnext_symbol_patternMatch; } var esnext_symbol_replaceAll = {}; var hasRequiredEsnext_symbol_replaceAll; function requireEsnext_symbol_replaceAll() { if (hasRequiredEsnext_symbol_replaceAll) return esnext_symbol_replaceAll; hasRequiredEsnext_symbol_replaceAll = 1; var defineWellKnownSymbol = /* @__PURE__ */ requireWellKnownSymbolDefine(); defineWellKnownSymbol("replaceAll"); return esnext_symbol_replaceAll; } var symbol$1; var hasRequiredSymbol$1; function requireSymbol$1() { if (hasRequiredSymbol$1) return symbol$1; hasRequiredSymbol$1 = 1; var parent = /* @__PURE__ */ requireSymbol$2(); requireEsnext_symbol_isRegisteredSymbol(); requireEsnext_symbol_isWellKnownSymbol(); requireEsnext_symbol_customMatcher(); requireEsnext_symbol_observable(); requireEsnext_symbol_isRegistered(); requireEsnext_symbol_isWellKnown(); requireEsnext_symbol_matcher(); requireEsnext_symbol_metadataKey(); requireEsnext_symbol_patternMatch(); requireEsnext_symbol_replaceAll(); symbol$1 = parent; return symbol$1; } var symbol; var hasRequiredSymbol; function requireSymbol() { if (hasRequiredSymbol) return symbol; hasRequiredSymbol = 1; symbol = /* @__PURE__ */ requireSymbol$1(); return symbol; } var symbolExports = /* @__PURE__ */ requireSymbol(); var _Symbol = /* @__PURE__ */ getDefaultExportFromCjs(symbolExports); var iterator$4; var hasRequiredIterator$4; function requireIterator$4() { if (hasRequiredIterator$4) return iterator$4; hasRequiredIterator$4 = 1; requireEs_array_iterator(); requireEs_string_iterator(); requireEs_symbol_iterator(); var WrappedWellKnownSymbolModule = /* @__PURE__ */ requireWellKnownSymbolWrapped(); iterator$4 = WrappedWellKnownSymbolModule.f("iterator"); return iterator$4; } var iterator$3; var hasRequiredIterator$3; function requireIterator$3() { if (hasRequiredIterator$3) return iterator$3; hasRequiredIterator$3 = 1; var parent = /* @__PURE__ */ requireIterator$4(); requireWeb_domCollections_iterator(); iterator$3 = parent; return iterator$3; } var iterator$2; var hasRequiredIterator$2; function requireIterator$2() { if (hasRequiredIterator$2) return iterator$2; hasRequiredIterator$2 = 1; var parent = /* @__PURE__ */ requireIterator$3(); iterator$2 = parent; return iterator$2; } var iterator$1; var hasRequiredIterator$1; function requireIterator$1() { if (hasRequiredIterator$1) return iterator$1; hasRequiredIterator$1 = 1; var parent = /* @__PURE__ */ requireIterator$2(); iterator$1 = parent; return iterator$1; } var iterator; var hasRequiredIterator; function requireIterator() { if (hasRequiredIterator) return iterator; hasRequiredIterator = 1; iterator = /* @__PURE__ */ requireIterator$1(); return iterator; } var iteratorExports = /* @__PURE__ */ requireIterator(); var _Symbol$iterator = /* @__PURE__ */ getDefaultExportFromCjs(iteratorExports); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function(o$1) { return typeof o$1; } : function(o$1) { return o$1 && "function" == typeof _Symbol && o$1.constructor === _Symbol && o$1 !== _Symbol.prototype ? "symbol" : typeof o$1; }, _typeof(o); } var toPrimitive$5; var hasRequiredToPrimitive$4; function requireToPrimitive$4() { if (hasRequiredToPrimitive$4) return toPrimitive$5; hasRequiredToPrimitive$4 = 1; requireEs_symbol_toPrimitive(); var WrappedWellKnownSymbolModule = /* @__PURE__ */ requireWellKnownSymbolWrapped(); toPrimitive$5 = WrappedWellKnownSymbolModule.f("toPrimitive"); return toPrimitive$5; } var toPrimitive$4; var hasRequiredToPrimitive$3; function requireToPrimitive$3() { if (hasRequiredToPrimitive$3) return toPrimitive$4; hasRequiredToPrimitive$3 = 1; var parent = /* @__PURE__ */ requireToPrimitive$4(); toPrimitive$4 = parent; return toPrimitive$4; } var toPrimitive$3; var hasRequiredToPrimitive$2; function requireToPrimitive$2() { if (hasRequiredToPrimitive$2) return toPrimitive$3; hasRequiredToPrimitive$2 = 1; var parent = /* @__PURE__ */ requireToPrimitive$3(); toPrimitive$3 = parent; return toPrimitive$3; } var toPrimitive$2; var hasRequiredToPrimitive$1; function requireToPrimitive$1() { if (hasRequiredToPrimitive$1) return toPrimitive$2; hasRequiredToPrimitive$1 = 1; var parent = /* @__PURE__ */ requireToPrimitive$2(); toPrimitive$2 = parent; return toPrimitive$2; } var toPrimitive$1; var hasRequiredToPrimitive; function requireToPrimitive() { if (hasRequiredToPrimitive) return toPrimitive$1; hasRequiredToPrimitive = 1; toPrimitive$1 = /* @__PURE__ */ requireToPrimitive$1(); return toPrimitive$1; } var toPrimitiveExports = /* @__PURE__ */ requireToPrimitive(); var _Symbol$toPrimitive = /* @__PURE__ */ getDefaultExportFromCjs(toPrimitiveExports); function toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[_Symbol$toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function toPropertyKey(t) { var i = toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _defineProperty(e, r, t) { return (r = toPropertyKey(r)) in e ? _Object$defineProperty$1(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; } var es_parseInt = {}; var whitespaces; var hasRequiredWhitespaces; function requireWhitespaces() { if (hasRequiredWhitespaces) return whitespaces; hasRequiredWhitespaces = 1; whitespaces = " \n\v\f\r \xA0               \u2028\u2029"; return whitespaces; } var stringTrim; var hasRequiredStringTrim; function requireStringTrim() { if (hasRequiredStringTrim) return stringTrim; hasRequiredStringTrim = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); var toString$2 = /* @__PURE__ */ requireToString(); var whitespaces$1 = /* @__PURE__ */ requireWhitespaces(); var replace = uncurryThis("".replace); var ltrim = RegExp("^[" + whitespaces$1 + "]+"); var rtrim = RegExp("(^|[^" + whitespaces$1 + "])[" + whitespaces$1 + "]+$"); var createMethod = function(TYPE) { return function($this) { var string$1 = toString$2(requireObjectCoercible$2($this)); if (TYPE & 1) string$1 = replace(string$1, ltrim, ""); if (TYPE & 2) string$1 = replace(string$1, rtrim, "$1"); return string$1; }; }; stringTrim = { start: createMethod(1), end: createMethod(2), trim: createMethod(3) }; return stringTrim; } var numberParseInt; var hasRequiredNumberParseInt; function requireNumberParseInt() { if (hasRequiredNumberParseInt) return numberParseInt; hasRequiredNumberParseInt = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var fails$2 = /* @__PURE__ */ requireFails(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var toString$2 = /* @__PURE__ */ requireToString(); var trim = requireStringTrim().trim; var whitespaces$1 = /* @__PURE__ */ requireWhitespaces(); var $parseInt = globalThis$1.parseInt; var Symbol$1 = globalThis$1.Symbol; var ITERATOR = Symbol$1 && Symbol$1.iterator; var hex = /^[+-]?0x/i; var exec = uncurryThis(hex.exec); var FORCED = $parseInt(whitespaces$1 + "08") !== 8 || $parseInt(whitespaces$1 + "0x16") !== 22 || ITERATOR && !fails$2(function() { $parseInt(Object(ITERATOR)); }); numberParseInt = FORCED ? function parseInt$1(string$1, radix) { var S = trim(toString$2(string$1)); return $parseInt(S, radix >>> 0 || (exec(hex, S) ? 16 : 10)); } : $parseInt; return numberParseInt; } var hasRequiredEs_parseInt; function requireEs_parseInt() { if (hasRequiredEs_parseInt) return es_parseInt; hasRequiredEs_parseInt = 1; var $ = /* @__PURE__ */ require_export(); var $parseInt = /* @__PURE__ */ requireNumberParseInt(); $({ global: true, forced: parseInt !== $parseInt }, { parseInt: $parseInt }); return es_parseInt; } var _parseInt$3; var hasRequired_parseInt$2; function require_parseInt$2() { if (hasRequired_parseInt$2) return _parseInt$3; hasRequired_parseInt$2 = 1; requireEs_parseInt(); var path$2 = /* @__PURE__ */ requirePath(); _parseInt$3 = path$2.parseInt; return _parseInt$3; } var _parseInt$2; var hasRequired_parseInt$1; function require_parseInt$1() { if (hasRequired_parseInt$1) return _parseInt$2; hasRequired_parseInt$1 = 1; var parent = /* @__PURE__ */ require_parseInt$2(); _parseInt$2 = parent; return _parseInt$2; } var _parseInt$1; var hasRequired_parseInt; function require_parseInt() { if (hasRequired_parseInt) return _parseInt$1; hasRequired_parseInt = 1; _parseInt$1 = /* @__PURE__ */ require_parseInt$1(); return _parseInt$1; } var _parseIntExports = require_parseInt(); var _parseInt = /* @__PURE__ */ getDefaultExportFromCjs(_parseIntExports); var es_parseFloat = {}; var numberParseFloat; var hasRequiredNumberParseFloat; function requireNumberParseFloat() { if (hasRequiredNumberParseFloat) return numberParseFloat; hasRequiredNumberParseFloat = 1; var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var fails$2 = /* @__PURE__ */ requireFails(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var toString$2 = /* @__PURE__ */ requireToString(); var trim = requireStringTrim().trim; var whitespaces$1 = /* @__PURE__ */ requireWhitespaces(); var charAt = uncurryThis("".charAt); var $parseFloat = globalThis$1.parseFloat; var Symbol$1 = globalThis$1.Symbol; var ITERATOR = Symbol$1 && Symbol$1.iterator; var FORCED = 1 / $parseFloat(whitespaces$1 + "-0") !== -Infinity || ITERATOR && !fails$2(function() { $parseFloat(Object(ITERATOR)); }); numberParseFloat = FORCED ? function parseFloat$1(string$1) { var trimmedString = trim(toString$2(string$1)); var result = $parseFloat(trimmedString); return result === 0 && charAt(trimmedString, 0) === "-" ? -0 : result; } : $parseFloat; return numberParseFloat; } var hasRequiredEs_parseFloat; function requireEs_parseFloat() { if (hasRequiredEs_parseFloat) return es_parseFloat; hasRequiredEs_parseFloat = 1; var $ = /* @__PURE__ */ require_export(); var $parseFloat = /* @__PURE__ */ requireNumberParseFloat(); $({ global: true, forced: parseFloat !== $parseFloat }, { parseFloat: $parseFloat }); return es_parseFloat; } var _parseFloat$3; var hasRequired_parseFloat$2; function require_parseFloat$2() { if (hasRequired_parseFloat$2) return _parseFloat$3; hasRequired_parseFloat$2 = 1; requireEs_parseFloat(); var path$2 = /* @__PURE__ */ requirePath(); _parseFloat$3 = path$2.parseFloat; return _parseFloat$3; } var _parseFloat$2; var hasRequired_parseFloat$1; function require_parseFloat$1() { if (hasRequired_parseFloat$1) return _parseFloat$2; hasRequired_parseFloat$1 = 1; var parent = /* @__PURE__ */ require_parseFloat$2(); _parseFloat$2 = parent; return _parseFloat$2; } var _parseFloat$1; var hasRequired_parseFloat; function require_parseFloat() { if (hasRequired_parseFloat) return _parseFloat$1; hasRequired_parseFloat = 1; _parseFloat$1 = /* @__PURE__ */ require_parseFloat$1(); return _parseFloat$1; } var _parseFloatExports = require_parseFloat(); var _parseFloat = /* @__PURE__ */ getDefaultExportFromCjs(_parseFloatExports); var es_array_filter = {}; var hasRequiredEs_array_filter; function requireEs_array_filter() { if (hasRequiredEs_array_filter) return es_array_filter; hasRequiredEs_array_filter = 1; var $ = /* @__PURE__ */ require_export(); var $filter = requireArrayIteration().filter; var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport(); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$2("filter"); $({ target: "Array", proto: true, forced: !HAS_SPECIES_SUPPORT }, { filter: function filter$5(callbackfn) { return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } }); return es_array_filter; } var filter$3; var hasRequiredFilter$3; function requireFilter$3() { if (hasRequiredFilter$3) return filter$3; hasRequiredFilter$3 = 1; requireEs_array_filter(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); filter$3 = getBuiltInPrototypeMethod$2("Array", "filter"); return filter$3; } var filter$2; var hasRequiredFilter$2; function requireFilter$2() { if (hasRequiredFilter$2) return filter$2; hasRequiredFilter$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireFilter$3(); var ArrayPrototype = Array.prototype; filter$2 = function(it$1) { var own = it$1.filter; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.filter ? method : own; }; return filter$2; } var filter$1; var hasRequiredFilter$1; function requireFilter$1() { if (hasRequiredFilter$1) return filter$1; hasRequiredFilter$1 = 1; var parent = /* @__PURE__ */ requireFilter$2(); filter$1 = parent; return filter$1; } var filter; var hasRequiredFilter; function requireFilter() { if (hasRequiredFilter) return filter; hasRequiredFilter = 1; filter = /* @__PURE__ */ requireFilter$1(); return filter; } var filterExports = requireFilter(); var _filterInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(filterExports); var es_object_getOwnPropertyNames = {}; var hasRequiredEs_object_getOwnPropertyNames; function requireEs_object_getOwnPropertyNames() { if (hasRequiredEs_object_getOwnPropertyNames) return es_object_getOwnPropertyNames; hasRequiredEs_object_getOwnPropertyNames = 1; var $ = /* @__PURE__ */ require_export(); var fails$2 = /* @__PURE__ */ requireFails(); var getOwnPropertyNames$3 = requireObjectGetOwnPropertyNamesExternal().f; var FAILS_ON_PRIMITIVES = fails$2(function() { return !Object.getOwnPropertyNames(1); }); $({ target: "Object", stat: true, forced: FAILS_ON_PRIMITIVES }, { getOwnPropertyNames: getOwnPropertyNames$3 }); return es_object_getOwnPropertyNames; } var getOwnPropertyNames$2; var hasRequiredGetOwnPropertyNames$2; function requireGetOwnPropertyNames$2() { if (hasRequiredGetOwnPropertyNames$2) return getOwnPropertyNames$2; hasRequiredGetOwnPropertyNames$2 = 1; requireEs_object_getOwnPropertyNames(); var path$2 = /* @__PURE__ */ requirePath(); var Object$1 = path$2.Object; getOwnPropertyNames$2 = function getOwnPropertyNames$3(it$1) { return Object$1.getOwnPropertyNames(it$1); }; return getOwnPropertyNames$2; } var getOwnPropertyNames$1; var hasRequiredGetOwnPropertyNames$1; function requireGetOwnPropertyNames$1() { if (hasRequiredGetOwnPropertyNames$1) return getOwnPropertyNames$1; hasRequiredGetOwnPropertyNames$1 = 1; var parent = /* @__PURE__ */ requireGetOwnPropertyNames$2(); getOwnPropertyNames$1 = parent; return getOwnPropertyNames$1; } var getOwnPropertyNames; var hasRequiredGetOwnPropertyNames; function requireGetOwnPropertyNames() { if (hasRequiredGetOwnPropertyNames) return getOwnPropertyNames; hasRequiredGetOwnPropertyNames = 1; getOwnPropertyNames = /* @__PURE__ */ requireGetOwnPropertyNames$1(); return getOwnPropertyNames; } var getOwnPropertyNamesExports = requireGetOwnPropertyNames(); var _Object$getOwnPropertyNames = /* @__PURE__ */ getDefaultExportFromCjs(getOwnPropertyNamesExports); var getOwnPropertySymbols$2; var hasRequiredGetOwnPropertySymbols$2; function requireGetOwnPropertySymbols$2() { if (hasRequiredGetOwnPropertySymbols$2) return getOwnPropertySymbols$2; hasRequiredGetOwnPropertySymbols$2 = 1; requireEs_symbol(); var path$2 = /* @__PURE__ */ requirePath(); getOwnPropertySymbols$2 = path$2.Object.getOwnPropertySymbols; return getOwnPropertySymbols$2; } var getOwnPropertySymbols$1; var hasRequiredGetOwnPropertySymbols$1; function requireGetOwnPropertySymbols$1() { if (hasRequiredGetOwnPropertySymbols$1) return getOwnPropertySymbols$1; hasRequiredGetOwnPropertySymbols$1 = 1; var parent = /* @__PURE__ */ requireGetOwnPropertySymbols$2(); getOwnPropertySymbols$1 = parent; return getOwnPropertySymbols$1; } var getOwnPropertySymbols; var hasRequiredGetOwnPropertySymbols; function requireGetOwnPropertySymbols() { if (hasRequiredGetOwnPropertySymbols) return getOwnPropertySymbols; hasRequiredGetOwnPropertySymbols = 1; getOwnPropertySymbols = /* @__PURE__ */ requireGetOwnPropertySymbols$1(); return getOwnPropertySymbols; } var getOwnPropertySymbolsExports = requireGetOwnPropertySymbols(); var _Object$getOwnPropertySymbols = /* @__PURE__ */ getDefaultExportFromCjs(getOwnPropertySymbolsExports); var getOwnPropertyDescriptor$2 = { exports: {} }; var es_object_getOwnPropertyDescriptor = {}; var hasRequiredEs_object_getOwnPropertyDescriptor; function requireEs_object_getOwnPropertyDescriptor() { if (hasRequiredEs_object_getOwnPropertyDescriptor) return es_object_getOwnPropertyDescriptor; hasRequiredEs_object_getOwnPropertyDescriptor = 1; var $ = /* @__PURE__ */ require_export(); var fails$2 = /* @__PURE__ */ requireFails(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var nativeGetOwnPropertyDescriptor = requireObjectGetOwnPropertyDescriptor().f; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var FORCED = !DESCRIPTORS || fails$2(function() { nativeGetOwnPropertyDescriptor(1); }); $({ target: "Object", stat: true, forced: FORCED, sham: !DESCRIPTORS }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor$4(it$1, key) { return nativeGetOwnPropertyDescriptor(toIndexedObject$2(it$1), key); } }); return es_object_getOwnPropertyDescriptor; } var hasRequiredGetOwnPropertyDescriptor$2; function requireGetOwnPropertyDescriptor$2() { if (hasRequiredGetOwnPropertyDescriptor$2) return getOwnPropertyDescriptor$2.exports; hasRequiredGetOwnPropertyDescriptor$2 = 1; requireEs_object_getOwnPropertyDescriptor(); var path$2 = /* @__PURE__ */ requirePath(); var Object$1 = path$2.Object; var getOwnPropertyDescriptor$4 = getOwnPropertyDescriptor$2.exports = function getOwnPropertyDescriptor$5(it$1, key) { return Object$1.getOwnPropertyDescriptor(it$1, key); }; if (Object$1.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor$4.sham = true; return getOwnPropertyDescriptor$2.exports; } var getOwnPropertyDescriptor$1; var hasRequiredGetOwnPropertyDescriptor$1; function requireGetOwnPropertyDescriptor$1() { if (hasRequiredGetOwnPropertyDescriptor$1) return getOwnPropertyDescriptor$1; hasRequiredGetOwnPropertyDescriptor$1 = 1; var parent = /* @__PURE__ */ requireGetOwnPropertyDescriptor$2(); getOwnPropertyDescriptor$1 = parent; return getOwnPropertyDescriptor$1; } var getOwnPropertyDescriptor; var hasRequiredGetOwnPropertyDescriptor; function requireGetOwnPropertyDescriptor() { if (hasRequiredGetOwnPropertyDescriptor) return getOwnPropertyDescriptor; hasRequiredGetOwnPropertyDescriptor = 1; getOwnPropertyDescriptor = /* @__PURE__ */ requireGetOwnPropertyDescriptor$1(); return getOwnPropertyDescriptor; } var getOwnPropertyDescriptorExports = requireGetOwnPropertyDescriptor(); var _Object$getOwnPropertyDescriptor = /* @__PURE__ */ getDefaultExportFromCjs(getOwnPropertyDescriptorExports); var es_object_getOwnPropertyDescriptors = {}; var ownKeys$4; var hasRequiredOwnKeys; function requireOwnKeys() { if (hasRequiredOwnKeys) return ownKeys$4; hasRequiredOwnKeys = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var getOwnPropertyNamesModule = /* @__PURE__ */ requireObjectGetOwnPropertyNames(); var getOwnPropertySymbolsModule = /* @__PURE__ */ requireObjectGetOwnPropertySymbols(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var concat$5 = uncurryThis([].concat); ownKeys$4 = getBuiltIn$2("Reflect", "ownKeys") || function ownKeys$6(it$1) { var keys$8 = getOwnPropertyNamesModule.f(anObject$2(it$1)); var getOwnPropertySymbols$4 = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols$4 ? concat$5(keys$8, getOwnPropertySymbols$4(it$1)) : keys$8; }; return ownKeys$4; } var hasRequiredEs_object_getOwnPropertyDescriptors; function requireEs_object_getOwnPropertyDescriptors() { if (hasRequiredEs_object_getOwnPropertyDescriptors) return es_object_getOwnPropertyDescriptors; hasRequiredEs_object_getOwnPropertyDescriptors = 1; var $ = /* @__PURE__ */ require_export(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var ownKeys$6 = /* @__PURE__ */ requireOwnKeys(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var getOwnPropertyDescriptorModule = /* @__PURE__ */ requireObjectGetOwnPropertyDescriptor(); var createProperty$2 = /* @__PURE__ */ requireCreateProperty(); $({ target: "Object", stat: true, sham: !DESCRIPTORS }, { getOwnPropertyDescriptors: function getOwnPropertyDescriptors$4(object$1) { var O = toIndexedObject$2(object$1); var getOwnPropertyDescriptor$4 = getOwnPropertyDescriptorModule.f; var keys$8 = ownKeys$6(O); var result = {}; var index$1 = 0; var key, descriptor; while (keys$8.length > index$1) { descriptor = getOwnPropertyDescriptor$4(O, key = keys$8[index$1++]); if (descriptor !== void 0) createProperty$2(result, key, descriptor); } return result; } }); return es_object_getOwnPropertyDescriptors; } var getOwnPropertyDescriptors$2; var hasRequiredGetOwnPropertyDescriptors$2; function requireGetOwnPropertyDescriptors$2() { if (hasRequiredGetOwnPropertyDescriptors$2) return getOwnPropertyDescriptors$2; hasRequiredGetOwnPropertyDescriptors$2 = 1; requireEs_object_getOwnPropertyDescriptors(); var path$2 = /* @__PURE__ */ requirePath(); getOwnPropertyDescriptors$2 = path$2.Object.getOwnPropertyDescriptors; return getOwnPropertyDescriptors$2; } var getOwnPropertyDescriptors$1; var hasRequiredGetOwnPropertyDescriptors$1; function requireGetOwnPropertyDescriptors$1() { if (hasRequiredGetOwnPropertyDescriptors$1) return getOwnPropertyDescriptors$1; hasRequiredGetOwnPropertyDescriptors$1 = 1; var parent = /* @__PURE__ */ requireGetOwnPropertyDescriptors$2(); getOwnPropertyDescriptors$1 = parent; return getOwnPropertyDescriptors$1; } var getOwnPropertyDescriptors; var hasRequiredGetOwnPropertyDescriptors; function requireGetOwnPropertyDescriptors() { if (hasRequiredGetOwnPropertyDescriptors) return getOwnPropertyDescriptors; hasRequiredGetOwnPropertyDescriptors = 1; getOwnPropertyDescriptors = /* @__PURE__ */ requireGetOwnPropertyDescriptors$1(); return getOwnPropertyDescriptors; } var getOwnPropertyDescriptorsExports = requireGetOwnPropertyDescriptors(); var _Object$getOwnPropertyDescriptors = /* @__PURE__ */ getDefaultExportFromCjs(getOwnPropertyDescriptorsExports); var defineProperties$2 = { exports: {} }; var es_object_defineProperties = {}; var hasRequiredEs_object_defineProperties; function requireEs_object_defineProperties() { if (hasRequiredEs_object_defineProperties) return es_object_defineProperties; hasRequiredEs_object_defineProperties = 1; var $ = /* @__PURE__ */ require_export(); var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var defineProperties$4 = requireObjectDefineProperties().f; $({ target: "Object", stat: true, forced: Object.defineProperties !== defineProperties$4, sham: !DESCRIPTORS }, { defineProperties: defineProperties$4 }); return es_object_defineProperties; } var hasRequiredDefineProperties$2; function requireDefineProperties$2() { if (hasRequiredDefineProperties$2) return defineProperties$2.exports; hasRequiredDefineProperties$2 = 1; requireEs_object_defineProperties(); var path$2 = /* @__PURE__ */ requirePath(); var Object$1 = path$2.Object; var defineProperties$4 = defineProperties$2.exports = function defineProperties$5(T, D) { return Object$1.defineProperties(T, D); }; if (Object$1.defineProperties.sham) defineProperties$4.sham = true; return defineProperties$2.exports; } var defineProperties$1; var hasRequiredDefineProperties$1; function requireDefineProperties$1() { if (hasRequiredDefineProperties$1) return defineProperties$1; hasRequiredDefineProperties$1 = 1; var parent = /* @__PURE__ */ requireDefineProperties$2(); defineProperties$1 = parent; return defineProperties$1; } var defineProperties; var hasRequiredDefineProperties; function requireDefineProperties() { if (hasRequiredDefineProperties) return defineProperties; hasRequiredDefineProperties = 1; defineProperties = /* @__PURE__ */ requireDefineProperties$1(); return defineProperties; } var definePropertiesExports = requireDefineProperties(); var _Object$defineProperties = /* @__PURE__ */ getDefaultExportFromCjs(definePropertiesExports); var defineProperty; var hasRequiredDefineProperty; function requireDefineProperty() { if (hasRequiredDefineProperty) return defineProperty; hasRequiredDefineProperty = 1; defineProperty = /* @__PURE__ */ requireDefineProperty$4(); return defineProperty; } var definePropertyExports = requireDefineProperty(); var _Object$defineProperty = /* @__PURE__ */ getDefaultExportFromCjs(definePropertyExports); /** * Helper functions for components */ /** * Determine values to use for (sub)options of 'chosen'. * * This option is either a boolean or an object whose values should be examined further. * The relevant structures are: * * - chosen: * - chosen: { subOption: } * * Where subOption is 'node', 'edge' or 'label'. * * The intention of this method appears to be to set a specific priority to the options; * Since most properties are either bridged or merged into the local options objects, there * is not much point in handling them separately. * TODO: examine if 'most' in previous sentence can be replaced with 'all'. In that case, we * should be able to get rid of this method. * @param {string} subOption option within object 'chosen' to consider; either 'node', 'edge' or 'label' * @param {object} pile array of options objects to consider * @returns {boolean | Function} value for passed subOption of 'chosen' to use */ function choosify(subOption, pile) { const allowed = [ "node", "edge", "label" ]; let value = true; const chosen = topMost(pile, "chosen"); if (typeof chosen === "boolean") value = chosen; else if (typeof chosen === "object") { if (_indexOfInstanceProperty(allowed).call(allowed, subOption) === -1) throw new Error("choosify: subOption '" + subOption + "' should be one of '" + allowed.join("', '") + "'"); const chosenEdge = topMost(pile, ["chosen", subOption]); if (typeof chosenEdge === "boolean" || typeof chosenEdge === "function") value = chosenEdge; } return value; } /** * Check if the point falls within the given rectangle. * @param {rect} rect * @param {point} point * @param {rotationPoint} [rotationPoint] if specified, the rotation that applies to the rectangle. * @returns {boolean} true if point within rectangle, false otherwise */ function pointInRect(rect, point, rotationPoint) { if (rect.width <= 0 || rect.height <= 0) return false; if (rotationPoint !== void 0) { const tmp = { x: point.x - rotationPoint.x, y: point.y - rotationPoint.y }; if (rotationPoint.angle !== 0) { const angle = -rotationPoint.angle; const tmp2 = { x: Math.cos(angle) * tmp.x - Math.sin(angle) * tmp.y, y: Math.sin(angle) * tmp.x + Math.cos(angle) * tmp.y }; point = tmp2; } else point = tmp; } const right = rect.x + rect.width; const bottom = rect.y + rect.width; return rect.left < point.x && right > point.x && rect.top < point.y && bottom > point.y; } /** * Check if given value is acceptable as a label text. * @param {*} text value to check; can be anything at this point * @returns {boolean} true if valid label value, false otherwise */ function isValidLabel(text) { return typeof text === "string" && text !== ""; } /** * Returns x, y of self reference circle based on provided angle * @param {object} ctx * @param {number} angle * @param {number} radius * @param {VisNode} node * @returns {object} x and y coordinates */ function getSelfRefCoordinates(ctx, angle, radius, node) { let x = node.x; let y = node.y; if (typeof node.distanceToBorder === "function") { const toBorderDist = node.distanceToBorder(ctx, angle); const yFromNodeCenter = Math.sin(angle) * toBorderDist; const xFromNodeCenter = Math.cos(angle) * toBorderDist; if (xFromNodeCenter === toBorderDist) { x += toBorderDist; y = node.y; } else if (yFromNodeCenter === toBorderDist) { x = node.x; y -= toBorderDist; } else { x += xFromNodeCenter; y -= yFromNodeCenter; } } else if (node.shape.width > node.shape.height) { x = node.x + node.shape.width * .5; y = node.y - radius; } else { x = node.x + radius; y = node.y - node.shape.height * .5; } return { x, y }; } var es_array_slice = {}; var hasRequiredEs_array_slice; function requireEs_array_slice() { if (hasRequiredEs_array_slice) return es_array_slice; hasRequiredEs_array_slice = 1; var $ = /* @__PURE__ */ require_export(); var isArray$5 = /* @__PURE__ */ requireIsArray$3(); var isConstructor$2 = /* @__PURE__ */ requireIsConstructor(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var toAbsoluteIndex$2 = /* @__PURE__ */ requireToAbsoluteIndex(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var createProperty$2 = /* @__PURE__ */ requireCreateProperty(); var wellKnownSymbol$2 = /* @__PURE__ */ requireWellKnownSymbol(); var arrayMethodHasSpeciesSupport$2 = /* @__PURE__ */ requireArrayMethodHasSpeciesSupport(); var nativeSlice = /* @__PURE__ */ requireArraySlice(); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$2("slice"); var SPECIES = wellKnownSymbol$2("species"); var $Array = Array; var max = Math.max; $({ target: "Array", proto: true, forced: !HAS_SPECIES_SUPPORT }, { slice: function slice$4(start, end) { var O = toIndexedObject$2(this); var length$1 = lengthOfArrayLike$2(O); var k = toAbsoluteIndex$2(start, length$1); var fin = toAbsoluteIndex$2(end === void 0 ? length$1 : end, length$1); var Constructor, result, n; if (isArray$5(O)) { Constructor = O.constructor; if (isConstructor$2(Constructor) && (Constructor === $Array || isArray$5(Constructor.prototype))) Constructor = void 0; else if (isObject$3(Constructor)) { Constructor = Constructor[SPECIES]; if (Constructor === null) Constructor = void 0; } if (Constructor === $Array || Constructor === void 0) return nativeSlice(O, k, fin); } result = new (Constructor === void 0 ? $Array : Constructor)(max(fin - k, 0)); for (n = 0; k < fin; k++, n++) if (k in O) createProperty$2(result, n, O[k]); result.length = n; return result; } }); return es_array_slice; } var slice$3; var hasRequiredSlice$3; function requireSlice$3() { if (hasRequiredSlice$3) return slice$3; hasRequiredSlice$3 = 1; requireEs_array_slice(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); slice$3 = getBuiltInPrototypeMethod$2("Array", "slice"); return slice$3; } var slice$2; var hasRequiredSlice$2; function requireSlice$2() { if (hasRequiredSlice$2) return slice$2; hasRequiredSlice$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireSlice$3(); var ArrayPrototype = Array.prototype; slice$2 = function(it$1) { var own = it$1.slice; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.slice ? method : own; }; return slice$2; } var slice$1; var hasRequiredSlice$1; function requireSlice$1() { if (hasRequiredSlice$1) return slice$1; hasRequiredSlice$1 = 1; var parent = /* @__PURE__ */ requireSlice$2(); slice$1 = parent; return slice$1; } var slice; var hasRequiredSlice; function requireSlice() { if (hasRequiredSlice) return slice; hasRequiredSlice = 1; slice = /* @__PURE__ */ requireSlice$1(); return slice; } var sliceExports = requireSlice(); var _sliceInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(sliceExports); var values$6; var hasRequiredValues$6; function requireValues$6() { if (hasRequiredValues$6) return values$6; hasRequiredValues$6 = 1; requireEs_array_iterator(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); values$6 = getBuiltInPrototypeMethod$2("Array", "values"); return values$6; } var values$5; var hasRequiredValues$5; function requireValues$5() { if (hasRequiredValues$5) return values$5; hasRequiredValues$5 = 1; var parent = /* @__PURE__ */ requireValues$6(); values$5 = parent; return values$5; } var values$4; var hasRequiredValues$4; function requireValues$4() { if (hasRequiredValues$4) return values$4; hasRequiredValues$4 = 1; requireWeb_domCollections_iterator(); var classof$2 = /* @__PURE__ */ requireClassof(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireValues$5(); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; values$4 = function(it$1) { var own = it$1.values; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.values || hasOwn(DOMIterables, classof$2(it$1)) ? method : own; }; return values$4; } var values$3; var hasRequiredValues$3; function requireValues$3() { if (hasRequiredValues$3) return values$3; hasRequiredValues$3 = 1; values$3 = /* @__PURE__ */ requireValues$4(); return values$3; } var valuesExports$1 = requireValues$3(); var _valuesInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(valuesExports$1); var LabelAccumulator = class { /** * @param {MeasureText} measureText */ constructor(measureText) { this.measureText = measureText; this.current = 0; this.width = 0; this.height = 0; this.lines = []; } /** * Append given text to the given line. * @param {number} l index of line to add to * @param {string} text string to append to line * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod] * @private */ _add(l, text) { let mod = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "normal"; if (this.lines[l] === void 0) this.lines[l] = { width: 0, height: 0, blocks: [] }; let tmpText = text; if (text === void 0 || text === "") tmpText = " "; const result = this.measureText(tmpText, mod); const block = _Object$assign({}, _valuesInstanceProperty(result)); block.text = text; block.width = result.width; block.mod = mod; if (text === void 0 || text === "") block.width = 0; this.lines[l].blocks.push(block); this.lines[l].width += block.width; } /** * Returns the width in pixels of the current line. * @returns {number} */ curWidth() { const line = this.lines[this.current]; if (line === void 0) return 0; return line.width; } /** * Add text in block to current line * @param {string} text * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod] */ append(text) { let mod = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "normal"; this._add(this.current, text, mod); } /** * Add text in block to current line and start a new line * @param {string} text * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod] */ newLine(text) { let mod = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "normal"; this._add(this.current, text, mod); this.current++; } /** * Determine and set the heights of all the lines currently contained in this instance * * Note that width has already been set. * @private */ determineLineHeights() { for (let k = 0; k < this.lines.length; k++) { const line = this.lines[k]; let height = 0; if (line.blocks !== void 0) for (let l = 0; l < line.blocks.length; l++) { const block = line.blocks[l]; if (height < block.height) height = block.height; } line.height = height; } } /** * Determine the full size of the label text, as determined by current lines and blocks * @private */ determineLabelSize() { let width = 0; let height = 0; for (let k = 0; k < this.lines.length; k++) { const line = this.lines[k]; if (line.width > width) width = line.width; height += line.height; } this.width = width; this.height = height; } /** * Remove all empty blocks and empty lines we don't need * * This must be done after the width/height determination, * so that these are set properly for processing here. * @returns {Array} Lines with empty blocks (and some empty lines) removed * @private */ removeEmptyBlocks() { const tmpLines = []; for (let k = 0; k < this.lines.length; k++) { const line = this.lines[k]; if (line.blocks.length === 0) continue; if (k === this.lines.length - 1) { if (line.width === 0) continue; } const tmpLine = {}; _Object$assign(tmpLine, line); tmpLine.blocks = []; let firstEmptyBlock; const tmpBlocks = []; for (let l = 0; l < line.blocks.length; l++) { const block = line.blocks[l]; if (block.width !== 0) tmpBlocks.push(block); else if (firstEmptyBlock === void 0) firstEmptyBlock = block; } if (tmpBlocks.length === 0 && firstEmptyBlock !== void 0) tmpBlocks.push(firstEmptyBlock); tmpLine.blocks = tmpBlocks; tmpLines.push(tmpLine); } return tmpLines; } /** * Set the sizes for all lines and the whole thing. * @returns {{width: (number|*), height: (number|*), lines: Array}} */ finalize() { this.determineLineHeights(); this.determineLabelSize(); const tmpLines = this.removeEmptyBlocks(); return { width: this.width, height: this.height, lines: tmpLines }; } }; const tagPattern = { "": //, "": //, "": //, "": /<\/b>/, "": /<\/i>/, "": /<\/code>/, "*": /\*/, _: /_/, "`": /`/, afterBold: /[^*]/, afterItal: /[^_]/, afterMono: /[^`]/ }; var MarkupAccumulator = class { /** * Create an instance * @param {string} text text to parse for markup */ constructor(text) { this.text = text; this.bold = false; this.ital = false; this.mono = false; this.spacing = false; this.position = 0; this.buffer = ""; this.modStack = []; this.blocks = []; } /** * Return the mod label currently on the top of the stack * @returns {string} label of topmost mod * @private */ mod() { return this.modStack.length === 0 ? "normal" : this.modStack[0]; } /** * Return the mod label currently active * @returns {string} label of active mod * @private */ modName() { if (this.modStack.length === 0) return "normal"; else if (this.modStack[0] === "mono") return "mono"; else if (this.bold && this.ital) return "boldital"; else if (this.bold) return "bold"; else if (this.ital) return "ital"; } /** * @private */ emitBlock() { if (this.spacing) { this.add(" "); this.spacing = false; } if (this.buffer.length > 0) { this.blocks.push({ text: this.buffer, mod: this.modName() }); this.buffer = ""; } } /** * Output text to buffer * @param {string} text text to add * @private */ add(text) { if (text === " ") this.spacing = true; if (this.spacing) { this.buffer += " "; this.spacing = false; } if (text != " ") this.buffer += text; } /** * Handle parsing of whitespace * @param {string} ch the character to check * @returns {boolean} true if the character was processed as whitespace, false otherwise */ parseWS(ch) { if (/[ \t]/.test(ch)) { if (!this.mono) this.spacing = true; else this.add(ch); return true; } return false; } /** * @param {string} tagName label for block type to set * @private */ setTag(tagName) { this.emitBlock(); this[tagName] = true; this.modStack.unshift(tagName); } /** * @param {string} tagName label for block type to unset * @private */ unsetTag(tagName) { this.emitBlock(); this[tagName] = false; this.modStack.shift(); } /** * @param {string} tagName label for block type we are currently processing * @param {string|RegExp} tag string to match in text * @returns {boolean} true if the tag was processed, false otherwise */ parseStartTag(tagName, tag) { if (!this.mono && !this[tagName] && this.match(tag)) { this.setTag(tagName); return true; } return false; } /** * @param {string|RegExp} tag * @param {number} [advance] if set, advance current position in text * @returns {boolean} true if match at given position, false otherwise * @private */ match(tag) { let advance = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; const [regExp, length$1] = this.prepareRegExp(tag); const matched = regExp.test(this.text.substr(this.position, length$1)); if (matched && advance) this.position += length$1 - 1; return matched; } /** * @param {string} tagName label for block type we are currently processing * @param {string|RegExp} tag string to match in text * @param {RegExp} [nextTag] regular expression to match for characters *following* the current tag * @returns {boolean} true if the tag was processed, false otherwise */ parseEndTag(tagName, tag, nextTag) { let checkTag = this.mod() === tagName; if (tagName === "mono") checkTag = checkTag && this.mono; else checkTag = checkTag && !this.mono; if (checkTag && this.match(tag)) { if (nextTag !== void 0) { if (this.position === this.text.length - 1 || this.match(nextTag, false)) this.unsetTag(tagName); } else this.unsetTag(tagName); return true; } return false; } /** * @param {string|RegExp} tag string to match in text * @param {value} value string to replace tag with, if found at current position * @returns {boolean} true if the tag was processed, false otherwise */ replace(tag, value) { if (this.match(tag)) { this.add(value); this.position += length - 1; return true; } return false; } /** * Create a regular expression for the tag if it isn't already one. * * The return value is an array `[RegExp, number]`, with exactly two value, where: * - RegExp is the regular expression to use * - number is the lenth of the input string to match * @param {string|RegExp} tag string to match in text * @returns {Array} regular expression to use and length of input string to match * @private */ prepareRegExp(tag) { let length$1; let regExp; if (tag instanceof RegExp) { regExp = tag; length$1 = 1; } else { const prepared = tagPattern[tag]; if (prepared !== void 0) regExp = prepared; else regExp = new RegExp(tag); length$1 = tag.length; } return [regExp, length$1]; } }; var LabelSplitter = class { /** * @param {CanvasRenderingContext2D} ctx Canvas rendering context * @param {Label} parent reference to the Label instance using current instance * @param {boolean} selected * @param {boolean} hover */ constructor(ctx, parent, selected, hover) { this.ctx = ctx; this.parent = parent; this.selected = selected; this.hover = hover; /** * Callback to determine text width; passed to LabelAccumulator instance * @param {string} text string to determine width of * @param {string} mod font type to use for this text * @returns {object} { width, values} width in pixels and font attributes */ const textWidth = (text, mod) => { if (text === void 0) return 0; const values$8 = this.parent.getFormattingValues(ctx, selected, hover, mod); let width = 0; if (text !== "") { const measure = this.ctx.measureText(text); width = measure.width; } return { width, values: values$8 }; }; this.lines = new LabelAccumulator(textWidth); } /** * Split passed text of a label into lines and blocks. * * # NOTE * * The handling of spacing is option dependent: * * - if `font.multi : false`, all spaces are retained * - if `font.multi : true`, every sequence of spaces is compressed to a single space * * This might not be the best way to do it, but this is as it has been working till now. * In order not to break existing functionality, for the time being this behaviour will * be retained in any code changes. * @param {string} text text to split * @returns {Array} */ process(text) { if (!isValidLabel(text)) return this.lines.finalize(); const font = this.parent.fontOptions; text = text.replace(/\r\n/g, "\n"); text = text.replace(/\r/g, "\n"); const nlLines = String(text).split("\n"); const lineCount = nlLines.length; if (font.multi) for (let i = 0; i < lineCount; i++) { const blocks = this.splitBlocks(nlLines[i], font.multi); if (blocks === void 0) continue; if (blocks.length === 0) { this.lines.newLine(""); continue; } if (font.maxWdt > 0) for (let j = 0; j < blocks.length; j++) { const mod = blocks[j].mod; const text$1 = blocks[j].text; this.splitStringIntoLines(text$1, mod, true); } else for (let j = 0; j < blocks.length; j++) { const mod = blocks[j].mod; const text$1 = blocks[j].text; this.lines.append(text$1, mod); } this.lines.newLine(); } else if (font.maxWdt > 0) for (let i = 0; i < lineCount; i++) this.splitStringIntoLines(nlLines[i]); else for (let i = 0; i < lineCount; i++) this.lines.newLine(nlLines[i]); return this.lines.finalize(); } /** * normalize the markup system * @param {boolean|'md'|'markdown'|'html'} markupSystem * @returns {string} */ decodeMarkupSystem(markupSystem) { let system = "none"; if (markupSystem === "markdown" || markupSystem === "md") system = "markdown"; else if (markupSystem === true || markupSystem === "html") system = "html"; return system; } /** * * @param {string} text * @returns {Array} */ splitHtmlBlocks(text) { const s = new MarkupAccumulator(text); const parseEntities = (ch) => { if (/&/.test(ch)) { const parsed = s.replace(s.text, "<", "<") || s.replace(s.text, "&", "&"); if (!parsed) s.add("&"); return true; } return false; }; while (s.position < s.text.length) { const ch = s.text.charAt(s.position); const parsed = s.parseWS(ch) || /") || s.parseStartTag("ital", "") || s.parseStartTag("mono", "") || s.parseEndTag("bold", "") || s.parseEndTag("ital", "") || s.parseEndTag("mono", "")) || parseEntities(ch); if (!parsed) s.add(ch); s.position++; } s.emitBlock(); return s.blocks; } /** * * @param {string} text * @returns {Array} */ splitMarkdownBlocks(text) { const s = new MarkupAccumulator(text); let beginable = true; const parseOverride = (ch) => { if (/\\/.test(ch)) { if (s.position < this.text.length + 1) { s.position++; ch = this.text.charAt(s.position); if (/ \t/.test(ch)) s.spacing = true; else { s.add(ch); beginable = false; } } return true; } return false; }; while (s.position < s.text.length) { const ch = s.text.charAt(s.position); const parsed = s.parseWS(ch) || parseOverride(ch) || (beginable || s.spacing) && (s.parseStartTag("bold", "*") || s.parseStartTag("ital", "_") || s.parseStartTag("mono", "`")) || s.parseEndTag("bold", "*", "afterBold") || s.parseEndTag("ital", "_", "afterItal") || s.parseEndTag("mono", "`", "afterMono"); if (!parsed) { s.add(ch); beginable = false; } s.position++; } s.emitBlock(); return s.blocks; } /** * Explodes a piece of text into single-font blocks using a given markup * @param {string} text * @param {boolean|'md'|'markdown'|'html'} markupSystem * @returns {Array.<{text: string, mod: string}>} * @private */ splitBlocks(text, markupSystem) { const system = this.decodeMarkupSystem(markupSystem); if (system === "none") return [{ text, mod: "normal" }]; else if (system === "markdown") return this.splitMarkdownBlocks(text); else if (system === "html") return this.splitHtmlBlocks(text); } /** * @param {string} text * @returns {boolean} true if text length over the current max with * @private */ overMaxWidth(text) { const width = this.ctx.measureText(text).width; return this.lines.curWidth() + width > this.parent.fontOptions.maxWdt; } /** * Determine the longest part of the sentence which still fits in the * current max width. * @param {Array} words Array of strings signifying a text lines * @returns {number} index of first item in string making string go over max * @private */ getLongestFit(words) { let text = ""; let w = 0; while (w < words.length) { const pre = text === "" ? "" : " "; const newText = text + pre + words[w]; if (this.overMaxWidth(newText)) break; text = newText; w++; } return w; } /** * Determine the longest part of the string which still fits in the * current max width. * @param {Array} words Array of strings signifying a text lines * @returns {number} index of first item in string making string go over max */ getLongestFitWord(words) { let w = 0; while (w < words.length) { if (this.overMaxWidth(_sliceInstanceProperty(words).call(words, 0, w))) break; w++; } return w; } /** * Split the passed text into lines, according to width constraint (if any). * * The method assumes that the input string is a single line, i.e. without lines break. * * This method retains spaces, if still present (case `font.multi: false`). * A space which falls on an internal line break, will be replaced by a newline. * There is no special handling of tabs; these go along with the flow. * @param {string} str * @param {string} [mod] * @param {boolean} [appendLast] * @private */ splitStringIntoLines(str) { let mod = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "normal"; let appendLast = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; this.parent.getFormattingValues(this.ctx, this.selected, this.hover, mod); str = str.replace(/^( +)/g, "$1\r"); str = str.replace(/([^\r][^ ]*)( +)/g, "$1\r$2\r"); let words = str.split("\r"); while (words.length > 0) { let w = this.getLongestFit(words); if (w === 0) { const word = words[0]; const x = this.getLongestFitWord(word); this.lines.newLine(_sliceInstanceProperty(word).call(word, 0, x), mod); words[0] = _sliceInstanceProperty(word).call(word, x); } else { let newW = w; if (words[w - 1] === " ") w--; else if (words[newW] === " ") newW++; const text = _sliceInstanceProperty(words).call(words, 0, w).join(""); if (w == words.length && appendLast) this.lines.append(text, mod); else this.lines.newLine(text, mod); words = _sliceInstanceProperty(words).call(words, newW); } } } }; /** * List of special styles for multi-fonts * @private */ const multiFontStyle = [ "bold", "ital", "boldital", "mono" ]; var Label = class Label { /** * @param {object} body * @param {object} options * @param {boolean} [edgelabel] */ constructor(body, options) { let edgelabel = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; this.body = body; this.pointToSelf = false; this.baseSize = void 0; this.fontOptions = {}; this.setOptions(options); this.size = { top: 0, left: 0, width: 0, height: 0, yLine: 0 }; this.isEdgeLabel = edgelabel; } /** * @param {object} options the options of the parent Node-instance */ setOptions(options) { this.elementOptions = options; this.initFontOptions(options.font); if (isValidLabel(options.label)) this.labelDirty = true; else options.label = void 0; if (options.font !== void 0 && options.font !== null) { if (typeof options.font === "string") this.baseSize = this.fontOptions.size; else if (typeof options.font === "object") { const size = options.font.size; if (size !== void 0) this.baseSize = size; } } } /** * Init the font Options structure. * * Member fontOptions serves as an accumulator for the current font options. * As such, it needs to be completely separated from the node options. * @param {object} newFontOptions the new font options to process * @private */ initFontOptions(newFontOptions) { forEach$4(multiFontStyle, (style) => { this.fontOptions[style] = {}; }); if (Label.parseFontString(this.fontOptions, newFontOptions)) { this.fontOptions.vadjust = 0; return; } forEach$4(newFontOptions, (prop, n) => { if (prop !== void 0 && prop !== null && typeof prop !== "object") this.fontOptions[n] = prop; }); } /** * If in-variable is a string, parse it as a font specifier. * * Note that following is not done here and have to be done after the call: * - Not all font options are set (vadjust, mod) * @param {object} outOptions out-parameter, object in which to store the parse results (if any) * @param {object} inOptions font options to parse * @returns {boolean} true if font parsed as string, false otherwise * @static */ static parseFontString(outOptions, inOptions) { if (!inOptions || typeof inOptions !== "string") return false; const newOptionsArray = inOptions.split(" "); outOptions.size = +newOptionsArray[0].replace("px", ""); outOptions.face = newOptionsArray[1]; outOptions.color = newOptionsArray[2]; return true; } /** * Set the width and height constraints based on 'nearest' value * @param {Array} pile array of option objects to consider * @returns {object} the actual constraint values to use * @private */ constrain(pile) { const fontOptions = { constrainWidth: false, maxWdt: -1, minWdt: -1, constrainHeight: false, minHgt: -1, valign: "middle" }; const widthConstraint = topMost(pile, "widthConstraint"); if (typeof widthConstraint === "number") { fontOptions.maxWdt = Number(widthConstraint); fontOptions.minWdt = Number(widthConstraint); } else if (typeof widthConstraint === "object") { const widthConstraintMaximum = topMost(pile, ["widthConstraint", "maximum"]); if (typeof widthConstraintMaximum === "number") fontOptions.maxWdt = Number(widthConstraintMaximum); const widthConstraintMinimum = topMost(pile, ["widthConstraint", "minimum"]); if (typeof widthConstraintMinimum === "number") fontOptions.minWdt = Number(widthConstraintMinimum); } const heightConstraint = topMost(pile, "heightConstraint"); if (typeof heightConstraint === "number") fontOptions.minHgt = Number(heightConstraint); else if (typeof heightConstraint === "object") { const heightConstraintMinimum = topMost(pile, ["heightConstraint", "minimum"]); if (typeof heightConstraintMinimum === "number") fontOptions.minHgt = Number(heightConstraintMinimum); const heightConstraintValign = topMost(pile, ["heightConstraint", "valign"]); if (typeof heightConstraintValign === "string") { if (heightConstraintValign === "top" || heightConstraintValign === "bottom") fontOptions.valign = heightConstraintValign; } } return fontOptions; } /** * Set options and update internal state * @param {object} options options to set * @param {Array} pile array of option objects to consider for option 'chosen' */ update(options, pile) { this.setOptions(options, true); this.propagateFonts(pile); deepExtend(this.fontOptions, this.constrain(pile)); this.fontOptions.chooser = choosify("label", pile); } /** * When margins are set in an element, adjust sizes is called to remove them * from the width/height constraints. This must be done prior to label sizing. * @param {{top: number, right: number, bottom: number, left: number}} margins */ adjustSizes(margins) { const widthBias = margins ? margins.right + margins.left : 0; if (this.fontOptions.constrainWidth) { this.fontOptions.maxWdt -= widthBias; this.fontOptions.minWdt -= widthBias; } const heightBias = margins ? margins.top + margins.bottom : 0; if (this.fontOptions.constrainHeight) this.fontOptions.minHgt -= heightBias; } /** * Add the font members of the passed list of option objects to the pile. * @param {Pile} dstPile pile of option objects add to * @param {Pile} srcPile pile of option objects to take font options from * @private */ addFontOptionsToPile(dstPile, srcPile) { for (let i = 0; i < srcPile.length; ++i) this.addFontToPile(dstPile, srcPile[i]); } /** * Add given font option object to the list of objects (the 'pile') to consider for determining * multi-font option values. * @param {Pile} pile pile of option objects to use * @param {object} options instance to add to pile * @private */ addFontToPile(pile, options) { if (options === void 0) return; if (options.font === void 0 || options.font === null) return; const item = options.font; pile.push(item); } /** * Collect all own-property values from the font pile that aren't multi-font option objectss. * @param {Pile} pile pile of option objects to use * @returns {object} object with all current own basic font properties * @private */ getBasicOptions(pile) { const ret = {}; for (let n = 0; n < pile.length; ++n) { let fontOptions = pile[n]; const tmpShorthand = {}; if (Label.parseFontString(tmpShorthand, fontOptions)) fontOptions = tmpShorthand; forEach$4(fontOptions, (opt, name) => { if (opt === void 0) return; if (Object.prototype.hasOwnProperty.call(ret, name)) return; if (_indexOfInstanceProperty(multiFontStyle).call(multiFontStyle, name) !== -1) ret[name] = {}; else ret[name] = opt; }); } return ret; } /** * Return the value for given option for the given multi-font. * * All available option objects are trawled in the set order to construct the option values. * * --------------------------------------------------------------------- * ## Traversal of pile for multi-fonts * * The determination of multi-font option values is a special case, because any values not * present in the multi-font options should by definition be taken from the main font options, * i.e. from the current 'parent' object of the multi-font option. * * ### Search order for multi-fonts * * 'bold' used as example: * * - search in option group 'bold' in local properties * - search in main font option group in local properties * * --------------------------------------------------------------------- * @param {Pile} pile pile of option objects to use * @param {MultiFontStyle} multiName sub path for the multi-font * @param {string} option the option to search for, for the given multi-font * @returns {string|number} the value for the given option * @private */ getFontOption(pile, multiName, option) { let multiFont; for (let n = 0; n < pile.length; ++n) { const fontOptions = pile[n]; if (Object.prototype.hasOwnProperty.call(fontOptions, multiName)) { multiFont = fontOptions[multiName]; if (multiFont === void 0 || multiFont === null) continue; const tmpShorthand = {}; if (Label.parseFontString(tmpShorthand, multiFont)) multiFont = tmpShorthand; if (Object.prototype.hasOwnProperty.call(multiFont, option)) return multiFont[option]; } } if (Object.prototype.hasOwnProperty.call(this.fontOptions, option)) return this.fontOptions[option]; throw new Error("Did not find value for multi-font for property: '" + option + "'"); } /** * Return all options values for the given multi-font. * * All available option objects are trawled in the set order to construct the option values. * @param {Pile} pile pile of option objects to use * @param {MultiFontStyle} multiName sub path for the mod-font * @returns {MultiFontOptions} * @private */ getFontOptions(pile, multiName) { const result = {}; const optionNames = [ "color", "size", "face", "mod", "vadjust" ]; for (let i = 0; i < optionNames.length; ++i) { const mod = optionNames[i]; result[mod] = this.getFontOption(pile, multiName, mod); } return result; } /** * Collapse the font options for the multi-font to single objects, from * the chain of option objects passed (the 'pile'). * @param {Pile} pile sequence of option objects to consider. * First item in list assumed to be the newly set options. */ propagateFonts(pile) { const fontPile = []; this.addFontOptionsToPile(fontPile, pile); this.fontOptions = this.getBasicOptions(fontPile); for (let i = 0; i < multiFontStyle.length; ++i) { const mod = multiFontStyle[i]; const modOptions = this.fontOptions[mod]; const tmpMultiFontOptions = this.getFontOptions(fontPile, mod); forEach$4(tmpMultiFontOptions, (option, n) => { modOptions[n] = option; }); modOptions.size = Number(modOptions.size); modOptions.vadjust = Number(modOptions.vadjust); } } /** * Main function. This is called from anything that wants to draw a label. * @param {CanvasRenderingContext2D} ctx * @param {number} x * @param {number} y * @param {boolean} selected * @param {boolean} hover * @param {string} [baseline] */ draw(ctx, x, y, selected, hover) { let baseline = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "middle"; if (this.elementOptions.label === void 0) return; let viewFontSize = this.fontOptions.size * this.body.view.scale; if (this.elementOptions.label && viewFontSize < this.elementOptions.scaling.label.drawThreshold - 1) return; if (viewFontSize >= this.elementOptions.scaling.label.maxVisible) viewFontSize = Number(this.elementOptions.scaling.label.maxVisible) / this.body.view.scale; this.calculateLabelSize(ctx, selected, hover, x, y, baseline); this._drawBackground(ctx); this._drawText(ctx, x, this.size.yLine, baseline, viewFontSize); } /** * Draws the label background * @param {CanvasRenderingContext2D} ctx * @private */ _drawBackground(ctx) { if (this.fontOptions.background !== void 0 && this.fontOptions.background !== "none") { ctx.fillStyle = this.fontOptions.background; const size = this.getSize(); ctx.fillRect(size.left, size.top, size.width, size.height); } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x * @param {number} y * @param {string} [baseline] * @param {number} viewFontSize * @private */ _drawText(ctx, x, y) { let baseline = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "middle"; let viewFontSize = arguments.length > 4 ? arguments[4] : void 0; [x, y] = this._setAlignment(ctx, x, y, baseline); ctx.textAlign = "left"; x = x - this.size.width / 2; if (this.fontOptions.valign && this.size.height > this.size.labelHeight) { if (this.fontOptions.valign === "top") y -= (this.size.height - this.size.labelHeight) / 2; if (this.fontOptions.valign === "bottom") y += (this.size.height - this.size.labelHeight) / 2; } for (let i = 0; i < this.lineCount; i++) { const line = this.lines[i]; if (line && line.blocks) { let width = 0; if (this.isEdgeLabel || this.fontOptions.align === "center") width += (this.size.width - line.width) / 2; else if (this.fontOptions.align === "right") width += this.size.width - line.width; for (let j = 0; j < line.blocks.length; j++) { const block = line.blocks[j]; ctx.font = block.font; const [fontColor, strokeColor] = this._getColor(block.color, viewFontSize, block.strokeColor); if (block.strokeWidth > 0) { ctx.lineWidth = block.strokeWidth; ctx.strokeStyle = strokeColor; ctx.lineJoin = "round"; } ctx.fillStyle = fontColor; if (block.strokeWidth > 0) ctx.strokeText(block.text, x + width, y + block.vadjust); ctx.fillText(block.text, x + width, y + block.vadjust); width += block.width; } y += line.height; } } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x * @param {number} y * @param {string} baseline * @returns {Array.} * @private */ _setAlignment(ctx, x, y, baseline) { if (this.isEdgeLabel && this.fontOptions.align !== "horizontal" && this.pointToSelf === false) { x = 0; y = 0; const lineMargin = 2; if (this.fontOptions.align === "top") { ctx.textBaseline = "alphabetic"; y -= 2 * lineMargin; } else if (this.fontOptions.align === "bottom") { ctx.textBaseline = "hanging"; y += 2 * lineMargin; } else ctx.textBaseline = "middle"; } else ctx.textBaseline = baseline; return [x, y]; } /** * fade in when relative scale is between threshold and threshold - 1. * If the relative scale would be smaller than threshold -1 the draw function would have returned before coming here. * @param {string} color The font color to use * @param {number} viewFontSize * @param {string} initialStrokeColor * @returns {Array.} An array containing the font color and stroke color * @private */ _getColor(color, viewFontSize, initialStrokeColor) { let fontColor = color || "#000000"; let strokeColor = initialStrokeColor || "#ffffff"; if (viewFontSize <= this.elementOptions.scaling.label.drawThreshold) { const opacity = Math.max(0, Math.min(1, 1 - (this.elementOptions.scaling.label.drawThreshold - viewFontSize))); fontColor = overrideOpacity(fontColor, opacity); strokeColor = overrideOpacity(strokeColor, opacity); } return [fontColor, strokeColor]; } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover * @returns {{width: number, height: number}} */ getTextSize(ctx) { let selected = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; let hover = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; this._processLabel(ctx, selected, hover); return { width: this.size.width, height: this.size.height, lineCount: this.lineCount }; } /** * Get the current dimensions of the label * @returns {rect} */ getSize() { const lineMargin = 2; let x = this.size.left; let y = this.size.top - .5 * lineMargin; if (this.isEdgeLabel) { const x2 = -this.size.width * .5; switch (this.fontOptions.align) { case "middle": x = x2; y = -this.size.height * .5; break; case "top": x = x2; y = -(this.size.height + lineMargin); break; case "bottom": x = x2; y = lineMargin; break; } } const ret = { left: x, top: y, width: this.size.width, height: this.size.height }; return ret; } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover * @param {number} [x] * @param {number} [y] * @param {'middle'|'hanging'} [baseline] */ calculateLabelSize(ctx, selected, hover) { let x = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0; let y = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0; let baseline = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "middle"; this._processLabel(ctx, selected, hover); this.size.left = x - this.size.width * .5; this.size.top = y - this.size.height * .5; this.size.yLine = y + (1 - this.lineCount) * .5 * this.fontOptions.size; if (baseline === "hanging") { this.size.top += .5 * this.fontOptions.size; this.size.top += 4; this.size.yLine += 4; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover * @param {string} mod * @returns {{color, size, face, mod, vadjust, strokeWidth: *, strokeColor: (*|string|allOptions.edges.font.strokeColor|{string}|allOptions.nodes.font.strokeColor|Array)}} */ getFormattingValues(ctx, selected, hover, mod) { const getValue = function(fontOptions, mod$1, option) { if (mod$1 === "normal") { if (option === "mod") return ""; return fontOptions[option]; } if (fontOptions[mod$1][option] !== void 0) return fontOptions[mod$1][option]; else return fontOptions[option]; }; const values$8 = { color: getValue(this.fontOptions, mod, "color"), size: getValue(this.fontOptions, mod, "size"), face: getValue(this.fontOptions, mod, "face"), mod: getValue(this.fontOptions, mod, "mod"), vadjust: getValue(this.fontOptions, mod, "vadjust"), strokeWidth: this.fontOptions.strokeWidth, strokeColor: this.fontOptions.strokeColor }; if (selected || hover) { if (mod === "normal" && this.fontOptions.chooser === true && this.elementOptions.labelHighlightBold) values$8.mod = "bold"; else if (typeof this.fontOptions.chooser === "function") this.fontOptions.chooser(values$8, this.elementOptions.id, selected, hover); } let fontString = ""; if (values$8.mod !== void 0 && values$8.mod !== "") fontString += values$8.mod + " "; fontString += values$8.size + "px " + values$8.face; ctx.font = fontString.replace(/"/g, ""); values$8.font = ctx.font; values$8.height = values$8.size; return values$8; } /** * * @param {boolean} selected * @param {boolean} hover * @returns {boolean} */ differentState(selected, hover) { return selected !== this.selectedState || hover !== this.hoverState; } /** * This explodes the passed text into lines and determines the width, height and number of lines. * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover * @param {string} inText the text to explode * @returns {{width, height, lines}|*} * @private */ _processLabelText(ctx, selected, hover, inText) { const splitter = new LabelSplitter(ctx, this, selected, hover); return splitter.process(inText); } /** * This explodes the label string into lines and sets the width, height and number of lines. * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover * @private */ _processLabel(ctx, selected, hover) { if (this.labelDirty === false && !this.differentState(selected, hover)) return; const state = this._processLabelText(ctx, selected, hover, this.elementOptions.label); if (this.fontOptions.minWdt > 0 && state.width < this.fontOptions.minWdt) state.width = this.fontOptions.minWdt; this.size.labelHeight = state.height; if (this.fontOptions.minHgt > 0 && state.height < this.fontOptions.minHgt) state.height = this.fontOptions.minHgt; this.lines = state.lines; this.lineCount = state.lines.length; this.size.width = state.width; this.size.height = state.height; this.selectedState = selected; this.hoverState = hover; this.labelDirty = false; } /** * Check if this label is visible * @returns {boolean} true if this label will be show, false otherwise */ visible() { if (this.size.width === 0 || this.size.height === 0 || this.elementOptions.label === void 0) return false; const viewFontSize = this.fontOptions.size * this.body.view.scale; if (viewFontSize < this.elementOptions.scaling.label.drawThreshold - 1) return false; return true; } }; var es_array_fill = {}; var arrayFill; var hasRequiredArrayFill; function requireArrayFill() { if (hasRequiredArrayFill) return arrayFill; hasRequiredArrayFill = 1; var toObject$2 = /* @__PURE__ */ requireToObject(); var toAbsoluteIndex$2 = /* @__PURE__ */ requireToAbsoluteIndex(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); arrayFill = function fill$4(value) { var O = toObject$2(this); var length$1 = lengthOfArrayLike$2(O); var argumentsLength = arguments.length; var index$1 = toAbsoluteIndex$2(argumentsLength > 1 ? arguments[1] : void 0, length$1); var end = argumentsLength > 2 ? arguments[2] : void 0; var endPos = end === void 0 ? length$1 : toAbsoluteIndex$2(end, length$1); while (endPos > index$1) O[index$1++] = value; return O; }; return arrayFill; } var hasRequiredEs_array_fill; function requireEs_array_fill() { if (hasRequiredEs_array_fill) return es_array_fill; hasRequiredEs_array_fill = 1; var $ = /* @__PURE__ */ require_export(); var fill$4 = /* @__PURE__ */ requireArrayFill(); var addToUnscopables$2 = /* @__PURE__ */ requireAddToUnscopables(); $({ target: "Array", proto: true }, { fill: fill$4 }); addToUnscopables$2("fill"); return es_array_fill; } var fill$3; var hasRequiredFill$3; function requireFill$3() { if (hasRequiredFill$3) return fill$3; hasRequiredFill$3 = 1; requireEs_array_fill(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); fill$3 = getBuiltInPrototypeMethod$2("Array", "fill"); return fill$3; } var fill$2; var hasRequiredFill$2; function requireFill$2() { if (hasRequiredFill$2) return fill$2; hasRequiredFill$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireFill$3(); var ArrayPrototype = Array.prototype; fill$2 = function(it$1) { var own = it$1.fill; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.fill ? method : own; }; return fill$2; } var fill$1; var hasRequiredFill$1; function requireFill$1() { if (hasRequiredFill$1) return fill$1; hasRequiredFill$1 = 1; var parent = /* @__PURE__ */ requireFill$2(); fill$1 = parent; return fill$1; } var fill; var hasRequiredFill; function requireFill() { if (hasRequiredFill) return fill; hasRequiredFill = 1; fill = /* @__PURE__ */ requireFill$1(); return fill; } var fillExports = requireFill(); var _fillInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(fillExports); var NodeBase = class { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { this.body = body; this.labelModule = labelModule; this.setOptions(options); this.top = void 0; this.left = void 0; this.height = void 0; this.width = void 0; this.radius = void 0; this.margin = void 0; this.refreshNeeded = true; this.boundingBox = { top: 0, left: 0, right: 0, bottom: 0 }; } /** * * @param {object} options */ setOptions(options) { this.options = options; } /** * * @param {Label} labelModule * @private */ _setMargins(labelModule) { this.margin = {}; if (this.options.margin) if (typeof this.options.margin == "object") { this.margin.top = this.options.margin.top; this.margin.right = this.options.margin.right; this.margin.bottom = this.options.margin.bottom; this.margin.left = this.options.margin.left; } else { this.margin.top = this.options.margin; this.margin.right = this.options.margin; this.margin.bottom = this.options.margin; this.margin.left = this.options.margin; } labelModule.adjustSizes(this.margin); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} * @private */ _distanceToBorder(ctx, angle) { const borderWidth = this.options.borderWidth; if (ctx) this.resize(ctx); return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; } /** * * @param {CanvasRenderingContext2D} ctx * @param {ArrowOptions} values */ enableShadow(ctx, values$8) { if (values$8.shadow) { ctx.shadowColor = values$8.shadowColor; ctx.shadowBlur = values$8.shadowSize; ctx.shadowOffsetX = values$8.shadowX; ctx.shadowOffsetY = values$8.shadowY; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {ArrowOptions} values */ disableShadow(ctx, values$8) { if (values$8.shadow) { ctx.shadowColor = "rgba(0,0,0,0)"; ctx.shadowBlur = 0; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 0; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {ArrowOptions} values */ enableBorderDashes(ctx, values$8) { if (values$8.borderDashes !== false) if (ctx.setLineDash !== void 0) { let dashes = values$8.borderDashes; if (dashes === true) dashes = [5, 15]; ctx.setLineDash(dashes); } else { console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."); this.options.shapeProperties.borderDashes = false; values$8.borderDashes = false; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {ArrowOptions} values */ disableBorderDashes(ctx, values$8) { if (values$8.borderDashes !== false) if (ctx.setLineDash !== void 0) ctx.setLineDash([0]); else { console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."); this.options.shapeProperties.borderDashes = false; values$8.borderDashes = false; } } /** * Determine if the shape of a node needs to be recalculated. * @param {boolean} selected * @param {boolean} hover * @returns {boolean} * @protected */ needsRefresh(selected, hover) { if (this.refreshNeeded === true) { this.refreshNeeded = false; return true; } return this.width === void 0 || this.labelModule.differentState(selected, hover); } /** * * @param {CanvasRenderingContext2D} ctx * @param {ArrowOptions} values */ initContextForDraw(ctx, values$8) { const borderWidth = values$8.borderWidth / this.body.view.scale; ctx.lineWidth = Math.min(this.width, borderWidth); ctx.strokeStyle = values$8.borderColor; ctx.fillStyle = values$8.color; } /** * * @param {CanvasRenderingContext2D} ctx * @param {ArrowOptions} values */ performStroke(ctx, values$8) { const borderWidth = values$8.borderWidth / this.body.view.scale; ctx.save(); if (borderWidth > 0) { this.enableBorderDashes(ctx, values$8); ctx.stroke(); this.disableBorderDashes(ctx, values$8); } ctx.restore(); } /** * * @param {CanvasRenderingContext2D} ctx * @param {ArrowOptions} values */ performFill(ctx, values$8) { ctx.save(); ctx.fillStyle = values$8.color; this.enableShadow(ctx, values$8); _fillInstanceProperty(ctx).call(ctx); this.disableShadow(ctx, values$8); ctx.restore(); this.performStroke(ctx, values$8); } /** * * @param {number} margin * @private */ _addBoundingBoxMargin(margin) { this.boundingBox.left -= margin; this.boundingBox.top -= margin; this.boundingBox.bottom += margin; this.boundingBox.right += margin; } /** * Actual implementation of this method call. * * Doing it like this makes it easier to override * in the child classes. * @param {number} x width * @param {number} y height * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover * @private */ _updateBoundingBox(x, y, ctx, selected, hover) { if (ctx !== void 0) this.resize(ctx, selected, hover); this.left = x - this.width / 2; this.top = y - this.height / 2; this.boundingBox.left = this.left; this.boundingBox.top = this.top; this.boundingBox.bottom = this.top + this.height; this.boundingBox.right = this.left + this.width; } /** * Default implementation of this method call. * This acts as a stub which can be overridden. * @param {number} x width * @param {number} y height * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover */ updateBoundingBox(x, y, ctx, selected, hover) { this._updateBoundingBox(x, y, ctx, selected, hover); } /** * Determine the dimensions to use for nodes with an internal label * * Currently, these are: Circle, Ellipse, Database, Box * The other nodes have external labels, and will not call this method * * If there is no label, decent default values are supplied. * @param {CanvasRenderingContext2D} ctx * @param {boolean} [selected] * @param {boolean} [hover] * @returns {{width:number, height:number}} */ getDimensionsFromLabel(ctx, selected, hover) { this.textSize = this.labelModule.getTextSize(ctx, selected, hover); let width = this.textSize.width; let height = this.textSize.height; const DEFAULT_SIZE = 14; if (width === 0) { width = DEFAULT_SIZE; height = DEFAULT_SIZE; } return { width, height }; } }; /** * A Box Node/Cluster shape. * @augments NodeBase */ let Box$1 = class Box$2 extends NodeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); this._setMargins(labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} [selected] * @param {boolean} [hover] */ resize(ctx) { let selected = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.selected; let hover = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.hover; if (this.needsRefresh(selected, hover)) { const dimensions = this.getDimensionsFromLabel(ctx, selected, hover); this.width = dimensions.width + this.margin.right + this.margin.left; this.height = dimensions.height + this.margin.top + this.margin.bottom; this.radius = this.width / 2; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values */ draw(ctx, x, y, selected, hover, values$8) { this.resize(ctx, selected, hover); this.left = x - this.width / 2; this.top = y - this.height / 2; this.initContextForDraw(ctx, values$8); drawRoundRect(ctx, this.left, this.top, this.width, this.height, values$8.borderRadius); this.performFill(ctx, values$8); this.updateBoundingBox(x, y, ctx, selected, hover); this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); } /** * * @param {number} x width * @param {number} y height * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover */ updateBoundingBox(x, y, ctx, selected, hover) { this._updateBoundingBox(x, y, ctx, selected, hover); const borderRadius = this.options.shapeProperties.borderRadius; this._addBoundingBoxMargin(borderRadius); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { if (ctx) this.resize(ctx); const borderWidth = this.options.borderWidth; return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; } }; var CircleImageBase = class extends NodeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); this.labelOffset = 0; this.selected = false; } /** * * @param {object} options * @param {object} [imageObj] * @param {object} [imageObjAlt] */ setOptions(options, imageObj, imageObjAlt) { this.options = options; if (!(imageObj === void 0 && imageObjAlt === void 0)) this.setImages(imageObj, imageObjAlt); } /** * Set the images for this node. * * The images can be updated after the initial setting of options; * therefore, this method needs to be reentrant. * * For correct working in error cases, it is necessary to properly set * field 'nodes.brokenImage' in the options. * @param {Image} imageObj required; main image to show for this node * @param {Image|undefined} imageObjAlt optional; image to show when node is selected */ setImages(imageObj, imageObjAlt) { if (imageObjAlt && this.selected) { this.imageObj = imageObjAlt; this.imageObjAlt = imageObj; } else { this.imageObj = imageObj; this.imageObjAlt = imageObjAlt; } } /** * Set selection and switch between the base and the selected image. * * Do the switch only if imageObjAlt exists. * @param {boolean} selected value of new selected state for current node */ switchImages(selected) { const selection_changed = selected && !this.selected || !selected && this.selected; this.selected = selected; if (this.imageObjAlt !== void 0 && selection_changed) { const imageTmp = this.imageObj; this.imageObj = this.imageObjAlt; this.imageObjAlt = imageTmp; } } /** * Returns Image Padding from node options * @returns {{top: number,left: number,bottom: number,right: number}} image padding inside this shape * @private */ _getImagePadding() { const imgPadding = { top: 0, right: 0, bottom: 0, left: 0 }; if (this.options.imagePadding) { const optImgPadding = this.options.imagePadding; if (typeof optImgPadding == "object") { imgPadding.top = optImgPadding.top; imgPadding.right = optImgPadding.right; imgPadding.bottom = optImgPadding.bottom; imgPadding.left = optImgPadding.left; } else { imgPadding.top = optImgPadding; imgPadding.right = optImgPadding; imgPadding.bottom = optImgPadding; imgPadding.left = optImgPadding; } } return imgPadding; } /** * Adjust the node dimensions for a loaded image. * * Pre: this.imageObj is valid */ _resizeImage() { let width, height; if (this.options.shapeProperties.useImageSize === false) { let ratio_width = 1; let ratio_height = 1; if (this.imageObj.width && this.imageObj.height) if (this.imageObj.width > this.imageObj.height) ratio_width = this.imageObj.width / this.imageObj.height; else ratio_height = this.imageObj.height / this.imageObj.width; width = this.options.size * 2 * ratio_width; height = this.options.size * 2 * ratio_height; } else { const imgPadding = this._getImagePadding(); width = this.imageObj.width + imgPadding.left + imgPadding.right; height = this.imageObj.height + imgPadding.top + imgPadding.bottom; } this.width = width; this.height = height; this.radius = .5 * this.width; } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {ArrowOptions} values * @private */ _drawRawCircle(ctx, x, y, values$8) { this.initContextForDraw(ctx, values$8); drawCircle(ctx, x, y, values$8.size); this.performFill(ctx, values$8); } /** * * @param {CanvasRenderingContext2D} ctx * @param {ArrowOptions} values * @private */ _drawImageAtPosition(ctx, values$8) { if (this.imageObj.width != 0) { ctx.globalAlpha = values$8.opacity !== void 0 ? values$8.opacity : 1; this.enableShadow(ctx, values$8); let factor = 1; if (this.options.shapeProperties.interpolation === true) factor = this.imageObj.width / this.width / this.body.view.scale; const imgPadding = this._getImagePadding(); const imgPosLeft = this.left + imgPadding.left; const imgPosTop = this.top + imgPadding.top; const imgWidth = this.width - imgPadding.left - imgPadding.right; const imgHeight = this.height - imgPadding.top - imgPadding.bottom; this.imageObj.drawImageAtPosition(ctx, factor, imgPosLeft, imgPosTop, imgWidth, imgHeight); this.disableShadow(ctx, values$8); } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @private */ _drawImageLabel(ctx, x, y, selected, hover) { let offset = 0; if (this.height !== void 0) { offset = this.height * .5; const labelDimensions = this.labelModule.getTextSize(ctx, selected, hover); if (labelDimensions.lineCount >= 1) offset += labelDimensions.height / 2; } const yLabel = y + offset; if (this.options.label) this.labelOffset = offset; this.labelModule.draw(ctx, x, yLabel, selected, hover, "hanging"); } }; /** * A Circle Node/Cluster shape. * @augments CircleImageBase */ let Circle$1 = class Circle$2 extends CircleImageBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); this._setMargins(labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} [selected] * @param {boolean} [hover] */ resize(ctx) { let selected = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.selected; let hover = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.hover; if (this.needsRefresh(selected, hover)) { const dimensions = this.getDimensionsFromLabel(ctx, selected, hover); const diameter = Math.max(dimensions.width + this.margin.right + this.margin.left, dimensions.height + this.margin.top + this.margin.bottom); this.options.size = diameter / 2; this.width = diameter; this.height = diameter; this.radius = this.width / 2; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values */ draw(ctx, x, y, selected, hover, values$8) { this.resize(ctx, selected, hover); this.left = x - this.width / 2; this.top = y - this.height / 2; this._drawRawCircle(ctx, x, y, values$8); this.updateBoundingBox(x, y); this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, y, selected, hover); } /** * * @param {number} x width * @param {number} y height */ updateBoundingBox(x, y) { this.boundingBox.top = y - this.options.size; this.boundingBox.left = x - this.options.size; this.boundingBox.right = x + this.options.size; this.boundingBox.bottom = y + this.options.size; } /** * * @param {CanvasRenderingContext2D} ctx * @returns {number} */ distanceToBorder(ctx) { if (ctx) this.resize(ctx); return this.width * .5; } }; var CircularImage = class extends CircleImageBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule * @param {Image} imageObj * @param {Image} imageObjAlt */ constructor(options, body, labelModule, imageObj, imageObjAlt) { super(options, body, labelModule); this.setImages(imageObj, imageObjAlt); } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} [selected] * @param {boolean} [hover] */ resize(ctx) { let selected = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.selected; let hover = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.hover; const imageAbsent = this.imageObj.src === void 0 || this.imageObj.width === void 0 || this.imageObj.height === void 0; if (imageAbsent) { const diameter = this.options.size * 2; this.width = diameter; this.height = diameter; this.radius = .5 * this.width; return; } if (this.needsRefresh(selected, hover)) this._resizeImage(); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values */ draw(ctx, x, y, selected, hover, values$8) { this.switchImages(selected); this.resize(); let labelX = x, labelY = y; if (this.options.shapeProperties.coordinateOrigin === "top-left") { this.left = x; this.top = y; labelX += this.width / 2; labelY += this.height / 2; } else { this.left = x - this.width / 2; this.top = y - this.height / 2; } this._drawRawCircle(ctx, labelX, labelY, values$8); ctx.save(); ctx.clip(); this._drawImageAtPosition(ctx, values$8); ctx.restore(); this._drawImageLabel(ctx, labelX, labelY, selected, hover); this.updateBoundingBox(x, y); } /** * * @param {number} x width * @param {number} y height */ updateBoundingBox(x, y) { if (this.options.shapeProperties.coordinateOrigin === "top-left") { this.boundingBox.top = y; this.boundingBox.left = x; this.boundingBox.right = x + this.options.size * 2; this.boundingBox.bottom = y + this.options.size * 2; } else { this.boundingBox.top = y - this.options.size; this.boundingBox.left = x - this.options.size; this.boundingBox.right = x + this.options.size; this.boundingBox.bottom = y + this.options.size; } this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset); } /** * * @param {CanvasRenderingContext2D} ctx * @returns {number} */ distanceToBorder(ctx) { if (ctx) this.resize(ctx); return this.width * .5; } }; var ShapeBase = class extends NodeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} [selected] * @param {boolean} [hover] * @param {object} [values] */ resize(ctx) { let selected = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.selected; let hover = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.hover; let values$8 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : { size: this.options.size }; if (this.needsRefresh(selected, hover)) { var _this$customSizeWidth, _this$customSizeHeigh; this.labelModule.getTextSize(ctx, selected, hover); const size = 2 * values$8.size; this.width = (_this$customSizeWidth = this.customSizeWidth) !== null && _this$customSizeWidth !== void 0 ? _this$customSizeWidth : size; this.height = (_this$customSizeHeigh = this.customSizeHeight) !== null && _this$customSizeHeigh !== void 0 ? _this$customSizeHeigh : size; this.radius = .5 * this.width; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {string} shape * @param {number} sizeMultiplier - Unused! TODO: Remove next major release * @param {number} x * @param {number} y * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @private * @returns {object} Callbacks to draw later on higher layers. */ _drawShape(ctx, shape, sizeMultiplier, x, y, selected, hover, values$8) { this.resize(ctx, selected, hover, values$8); this.left = x - this.width / 2; this.top = y - this.height / 2; this.initContextForDraw(ctx, values$8); getShape(shape)(ctx, x, y, values$8.size); this.performFill(ctx, values$8); if (this.options.icon !== void 0) { if (this.options.icon.code !== void 0) { ctx.font = (selected ? "bold " : "") + this.height / 2 + "px " + (this.options.icon.face || "FontAwesome"); ctx.fillStyle = this.options.icon.color || "black"; ctx.textAlign = "center"; ctx.textBaseline = "middle"; ctx.fillText(this.options.icon.code, x, y); } } return { drawExternalLabel: () => { if (this.options.label !== void 0) { this.labelModule.calculateLabelSize(ctx, selected, hover, x, y, "hanging"); const yLabel = y + .5 * this.height + .5 * this.labelModule.size.height; this.labelModule.draw(ctx, x, yLabel, selected, hover, "hanging"); } this.updateBoundingBox(x, y); } }; } /** * * @param {number} x * @param {number} y */ updateBoundingBox(x, y) { this.boundingBox.top = y - this.options.size; this.boundingBox.left = x - this.options.size; this.boundingBox.right = x + this.options.size; this.boundingBox.bottom = y + this.options.size; if (this.options.label !== void 0 && this.labelModule.size.width > 0) { this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height); } } }; function ownKeys$3(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function(r$1) { return _Object$getOwnPropertyDescriptor(e, r$1).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$3(Object(t), true)).call(_context, function(r$1) { _defineProperty(e, r$1, t[r$1]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$3(Object(t))).call(_context2, function(r$1) { _Object$defineProperty(e, r$1, _Object$getOwnPropertyDescriptor(t, r$1)); }); } return e; } var CustomShape = class extends ShapeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule * @param {Function} ctxRenderer */ constructor(options, body, labelModule, ctxRenderer) { super(options, body, labelModule, ctxRenderer); this.ctxRenderer = ctxRenderer; } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on different layers. */ draw(ctx, x, y, selected, hover, values$8) { this.resize(ctx, selected, hover, values$8); this.left = x - this.width / 2; this.top = y - this.height / 2; ctx.save(); const drawLater = this.ctxRenderer({ ctx, id: this.options.id, x, y, state: { selected, hover }, style: _objectSpread$3({}, values$8), label: this.options.label }); if (drawLater.drawNode != null) drawLater.drawNode(); ctx.restore(); if (drawLater.drawExternalLabel) { const drawExternalLabel = drawLater.drawExternalLabel; drawLater.drawExternalLabel = () => { ctx.save(); drawExternalLabel(); ctx.restore(); }; } if (drawLater.nodeDimensions) { this.customSizeWidth = drawLater.nodeDimensions.width; this.customSizeHeight = drawLater.nodeDimensions.height; } return drawLater; } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; var Database = class extends NodeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); this._setMargins(labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover */ resize(ctx, selected, hover) { if (this.needsRefresh(selected, hover)) { const dimensions = this.getDimensionsFromLabel(ctx, selected, hover); const size = dimensions.width + this.margin.right + this.margin.left; this.width = size; this.height = size; this.radius = this.width / 2; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values */ draw(ctx, x, y, selected, hover, values$8) { this.resize(ctx, selected, hover); this.left = x - this.width / 2; this.top = y - this.height / 2; this.initContextForDraw(ctx, values$8); drawDatabase(ctx, x - this.width / 2, y - this.height / 2, this.width, this.height); this.performFill(ctx, values$8); this.updateBoundingBox(x, y, ctx, selected, hover); this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; /** * A Diamond Node/Cluster shape. * @augments ShapeBase */ let Diamond$1 = class Diamond$2 extends ShapeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx, x, y, selected, hover, values$8) { return this._drawShape(ctx, "diamond", 4, x, y, selected, hover, values$8); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; var Dot = class extends ShapeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx, x, y, selected, hover, values$8) { return this._drawShape(ctx, "circle", 2, x, y, selected, hover, values$8); } /** * * @param {CanvasRenderingContext2D} ctx * @returns {number} */ distanceToBorder(ctx) { if (ctx) this.resize(ctx); return this.options.size; } }; var Ellipse = class extends NodeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} [selected] * @param {boolean} [hover] */ resize(ctx) { let selected = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.selected; let hover = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.hover; if (this.needsRefresh(selected, hover)) { const dimensions = this.getDimensionsFromLabel(ctx, selected, hover); this.height = dimensions.height * 2; this.width = dimensions.width + dimensions.height; this.radius = .5 * this.width; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values */ draw(ctx, x, y, selected, hover, values$8) { this.resize(ctx, selected, hover); this.left = x - this.width * .5; this.top = y - this.height * .5; this.initContextForDraw(ctx, values$8); drawEllipse(ctx, this.left, this.top, this.width, this.height); this.performFill(ctx, values$8); this.updateBoundingBox(x, y, ctx, selected, hover); this.labelModule.draw(ctx, x, y, selected, hover); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { if (ctx) this.resize(ctx); const a = this.width * .5; const b = this.height * .5; const w = Math.sin(angle) * a; const h = Math.cos(angle) * b; return a * b / Math.sqrt(w * w + h * h); } }; var Icon = class extends NodeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); this._setMargins(labelModule); } /** * * @param {CanvasRenderingContext2D} ctx - Unused. * @param {boolean} [selected] * @param {boolean} [hover] */ resize(ctx, selected, hover) { if (this.needsRefresh(selected, hover)) { this.iconSize = { width: Number(this.options.icon.size), height: Number(this.options.icon.size) }; this.width = this.iconSize.width + this.margin.right + this.margin.left; this.height = this.iconSize.height + this.margin.top + this.margin.bottom; this.radius = .5 * this.width; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx, x, y, selected, hover, values$8) { this.resize(ctx, selected, hover); this.options.icon.size = this.options.icon.size || 50; this.left = x - this.width / 2; this.top = y - this.height / 2; this._icon(ctx, x, y, selected, hover, values$8); return { drawExternalLabel: () => { if (this.options.label !== void 0) { const iconTextSpacing = 5; this.labelModule.draw(ctx, this.left + this.iconSize.width / 2 + this.margin.left, y + this.height / 2 + iconTextSpacing, selected); } this.updateBoundingBox(x, y); } }; } /** * * @param {number} x * @param {number} y */ updateBoundingBox(x, y) { this.boundingBox.top = y - this.options.icon.size * .5; this.boundingBox.left = x - this.options.icon.size * .5; this.boundingBox.right = x + this.options.icon.size * .5; this.boundingBox.bottom = y + this.options.icon.size * .5; if (this.options.label !== void 0 && this.labelModule.size.width > 0) { const iconTextSpacing = 5; this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height + iconTextSpacing); } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover - Unused * @param {ArrowOptions} values */ _icon(ctx, x, y, selected, hover, values$8) { const iconSize = Number(this.options.icon.size); if (this.options.icon.code !== void 0) { ctx.font = [ this.options.icon.weight != null ? this.options.icon.weight : selected ? "bold" : "", (this.options.icon.weight != null && selected ? 5 : 0) + iconSize + "px", this.options.icon.face ].join(" "); ctx.fillStyle = this.options.icon.color || "black"; ctx.textAlign = "center"; ctx.textBaseline = "middle"; this.enableShadow(ctx, values$8); ctx.fillText(this.options.icon.code, x, y); this.disableShadow(ctx, values$8); } else console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally."); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; /** * An image-based replacement for the default Node shape. * @augments CircleImageBase */ let Image$2 = class Image$3 extends CircleImageBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule * @param {Image} imageObj * @param {Image} imageObjAlt */ constructor(options, body, labelModule, imageObj, imageObjAlt) { super(options, body, labelModule); this.setImages(imageObj, imageObjAlt); } /** * * @param {CanvasRenderingContext2D} ctx - Unused. * @param {boolean} [selected] * @param {boolean} [hover] */ resize(ctx) { let selected = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.selected; let hover = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.hover; const imageAbsent = this.imageObj.src === void 0 || this.imageObj.width === void 0 || this.imageObj.height === void 0; if (imageAbsent) { const side = this.options.size * 2; this.width = side; this.height = side; return; } if (this.needsRefresh(selected, hover)) this._resizeImage(); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values */ draw(ctx, x, y, selected, hover, values$8) { ctx.save(); this.switchImages(selected); this.resize(); let labelX = x, labelY = y; if (this.options.shapeProperties.coordinateOrigin === "top-left") { this.left = x; this.top = y; labelX += this.width / 2; labelY += this.height / 2; } else { this.left = x - this.width / 2; this.top = y - this.height / 2; } if (this.options.shapeProperties.useBorderWithImage === true) { const neutralborderWidth = this.options.borderWidth; const selectionLineWidth = this.options.borderWidthSelected || 2 * this.options.borderWidth; const borderWidth = (selected ? selectionLineWidth : neutralborderWidth) / this.body.view.scale; ctx.lineWidth = Math.min(this.width, borderWidth); ctx.beginPath(); let strokeStyle = selected ? this.options.color.highlight.border : hover ? this.options.color.hover.border : this.options.color.border; let fillStyle = selected ? this.options.color.highlight.background : hover ? this.options.color.hover.background : this.options.color.background; if (values$8.opacity !== void 0) { strokeStyle = overrideOpacity(strokeStyle, values$8.opacity); fillStyle = overrideOpacity(fillStyle, values$8.opacity); } ctx.strokeStyle = strokeStyle; ctx.fillStyle = fillStyle; ctx.rect(this.left - .5 * ctx.lineWidth, this.top - .5 * ctx.lineWidth, this.width + ctx.lineWidth, this.height + ctx.lineWidth); _fillInstanceProperty(ctx).call(ctx); this.performStroke(ctx, values$8); ctx.closePath(); } this._drawImageAtPosition(ctx, values$8); this._drawImageLabel(ctx, labelX, labelY, selected, hover); this.updateBoundingBox(x, y); ctx.restore(); } /** * * @param {number} x * @param {number} y */ updateBoundingBox(x, y) { this.resize(); if (this.options.shapeProperties.coordinateOrigin === "top-left") { this.left = x; this.top = y; } else { this.left = x - this.width / 2; this.top = y - this.height / 2; } this.boundingBox.left = this.left; this.boundingBox.top = this.top; this.boundingBox.bottom = this.top + this.height; this.boundingBox.right = this.left + this.width; if (this.options.label !== void 0 && this.labelModule.size.width > 0) { this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset); } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; var Square = class extends ShapeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx, x, y, selected, hover, values$8) { return this._drawShape(ctx, "square", 2, x, y, selected, hover, values$8); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; var Hexagon = class extends ShapeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx, x, y, selected, hover, values$8) { return this._drawShape(ctx, "hexagon", 4, x, y, selected, hover, values$8); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; var Star = class extends ShapeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx, x, y, selected, hover, values$8) { return this._drawShape(ctx, "star", 4, x, y, selected, hover, values$8); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; var Text = class extends NodeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); this._setMargins(labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {boolean} selected * @param {boolean} hover */ resize(ctx, selected, hover) { if (this.needsRefresh(selected, hover)) { this.textSize = this.labelModule.getTextSize(ctx, selected, hover); this.width = this.textSize.width + this.margin.right + this.margin.left; this.height = this.textSize.height + this.margin.top + this.margin.bottom; this.radius = .5 * this.width; } } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x width * @param {number} y height * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values */ draw(ctx, x, y, selected, hover, values$8) { this.resize(ctx, selected, hover); this.left = x - this.width / 2; this.top = y - this.height / 2; this.enableShadow(ctx, values$8); this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); this.disableShadow(ctx, values$8); this.updateBoundingBox(x, y, ctx, selected, hover); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; /** * A Triangle Node/Cluster shape. * @augments ShapeBase */ let Triangle$1 = class Triangle$2 extends ShapeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x * @param {number} y * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx, x, y, selected, hover, values$8) { return this._drawShape(ctx, "triangle", 3, x, y, selected, hover, values$8); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; var TriangleDown = class extends ShapeBase { /** * @param {object} options * @param {object} body * @param {Label} labelModule */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} x * @param {number} y * @param {boolean} selected * @param {boolean} hover * @param {ArrowOptions} values * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx, x, y, selected, hover, values$8) { return this._drawShape(ctx, "triangleDown", 3, x, y, selected, hover, values$8); } /** * * @param {CanvasRenderingContext2D} ctx * @param {number} angle * @returns {number} */ distanceToBorder(ctx, angle) { return this._distanceToBorder(ctx, angle); } }; function ownKeys$2(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function(r$1) { return _Object$getOwnPropertyDescriptor(e, r$1).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys$2(Object(t), true)).call(_context5, function(r$1) { _defineProperty(e, r$1, t[r$1]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys$2(Object(t))).call(_context6, function(r$1) { _Object$defineProperty(e, r$1, _Object$getOwnPropertyDescriptor(t, r$1)); }); } return e; } var Node = class Node { /** * * @param {object} options An object containing options for the node. All * options are optional, except for the id. * {number} id Id of the node. Required * {string} label Text label for the node * {number} x Horizontal position of the node * {number} y Vertical position of the node * {string} shape Node shape * {string} image An image url * {string} title A title text, can be HTML * {anytype} group A group name or number * @param {object} body Shared state of current network instance * @param {Network.Images} imagelist A list with images. Only needed when the node has an image * @param {Groups} grouplist A list with groups. Needed for retrieving group options * @param {object} globalOptions Current global node options; these serve as defaults for the node instance * @param {object} defaultOptions Global default options for nodes; note that this is also the prototype * for parameter `globalOptions`. */ constructor(options, body, imagelist, grouplist, globalOptions, defaultOptions) { this.options = bridgeObject(globalOptions); this.globalOptions = globalOptions; this.defaultOptions = defaultOptions; this.body = body; this.edges = []; this.id = void 0; this.imagelist = imagelist; this.grouplist = grouplist; this.x = void 0; this.y = void 0; this.baseSize = this.options.size; this.baseFontSize = this.options.font.size; this.predefinedPosition = false; this.selected = false; this.hover = false; this.labelModule = new Label( this.body, this.options, false /* Not edge label */ ); this.setOptions(options); } /** * Attach a edge to the node * @param {Edge} edge */ attachEdge(edge) { var _context; if (_indexOfInstanceProperty(_context = this.edges).call(_context, edge) === -1) this.edges.push(edge); } /** * Detach a edge from the node * @param {Edge} edge */ detachEdge(edge) { var _context2; const index$1 = _indexOfInstanceProperty(_context2 = this.edges).call(_context2, edge); if (index$1 != -1) { var _context3; _spliceInstanceProperty(_context3 = this.edges).call(_context3, index$1, 1); } } /** * Set or overwrite options for the node * @param {object} options an object with options * @returns {null|boolean} */ setOptions(options) { const currentShape = this.options.shape; if (!options) return; if (typeof options.color !== "undefined") this._localColor = options.color; if (options.id !== void 0) this.id = options.id; if (this.id === void 0) throw new Error("Node must have an id"); Node.checkMass(options, this.id); if (options.x !== void 0) if (options.x === null) { this.x = void 0; this.predefinedPosition = false; } else { this.x = _parseInt(options.x); this.predefinedPosition = true; } if (options.y !== void 0) if (options.y === null) { this.y = void 0; this.predefinedPosition = false; } else { this.y = _parseInt(options.y); this.predefinedPosition = true; } if (options.size !== void 0) this.baseSize = options.size; if (options.value !== void 0) options.value = _parseFloat(options.value); Node.parseOptions(this.options, options, true, this.globalOptions, this.grouplist); const pile = [ options, this.options, this.defaultOptions ]; this.chooser = choosify("node", pile); this._load_images(); this.updateLabelModule(options); if (options.opacity !== void 0 && Node.checkOpacity(options.opacity)) this.options.opacity = options.opacity; this.updateShape(currentShape); return options.hidden !== void 0 || options.physics !== void 0; } /** * Load the images from the options, for the nodes that need them. * * Images are always loaded, even if they are not used in the current shape. * The user may switch to an image shape later on. * @private */ _load_images() { if (this.options.shape === "circularImage" || this.options.shape === "image") { if (this.options.image === void 0) throw new Error("Option image must be defined for node type '" + this.options.shape + "'"); } if (this.options.image === void 0) return; if (this.imagelist === void 0) throw new Error("Internal Error: No images provided"); if (typeof this.options.image === "string") this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id); else { if (this.options.image.unselected === void 0) throw new Error("No unselected image provided"); this.imageObj = this.imagelist.load(this.options.image.unselected, this.options.brokenImage, this.id); if (this.options.image.selected !== void 0) this.imageObjAlt = this.imagelist.load(this.options.image.selected, this.options.brokenImage, this.id); else this.imageObjAlt = void 0; } } /** * Check that opacity is only between 0 and 1 * @param {number} opacity * @returns {boolean} */ static checkOpacity(opacity) { return 0 <= opacity && opacity <= 1; } /** * Check that origin is 'center' or 'top-left' * @param {string} origin * @returns {boolean} */ static checkCoordinateOrigin(origin) { return origin === void 0 || origin === "center" || origin === "top-left"; } /** * Copy group option values into the node options. * * The group options override the global node options, so the copy of group options * must happen *after* the global node options have been set. * * This method must also be called also if the global node options have changed and the group options did not. * @param {object} parentOptions * @param {object} newOptions new values for the options, currently only passed in for check * @param {object} groupList */ static updateGroupOptions(parentOptions, newOptions, groupList) { var _context4; if (groupList === void 0) return; const group = parentOptions.group; if (newOptions !== void 0 && newOptions.group !== void 0 && group !== newOptions.group) throw new Error("updateGroupOptions: group values in options don't match."); const hasGroup = typeof group === "number" || typeof group === "string" && group != ""; if (!hasGroup) return; const groupObj = groupList.get(group); if (groupObj.opacity !== void 0 && newOptions.opacity === void 0) { if (!Node.checkOpacity(groupObj.opacity)) { console.error("Invalid option for node opacity. Value must be between 0 and 1, found: " + groupObj.opacity); groupObj.opacity = void 0; } } const skipProperties = _filterInstanceProperty(_context4 = _Object$getOwnPropertyNames(newOptions)).call(_context4, (p) => newOptions[p] != null); skipProperties.push("font"); selectiveNotDeepExtend(skipProperties, parentOptions, groupObj); parentOptions.color = parseColor(parentOptions.color); } /** * This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined. * Static so it can also be used by the handler. * @param {object} parentOptions * @param {object} newOptions * @param {boolean} [allowDeletion] * @param {object} [globalOptions] * @param {object} [groupList] * @static */ static parseOptions(parentOptions, newOptions) { let allowDeletion = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; let globalOptions = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; let groupList = arguments.length > 4 ? arguments[4] : void 0; const fields = [ "color", "fixed", "shadow" ]; selectiveNotDeepExtend(fields, parentOptions, newOptions, allowDeletion); Node.checkMass(newOptions); if (parentOptions.opacity !== void 0) { if (!Node.checkOpacity(parentOptions.opacity)) { console.error("Invalid option for node opacity. Value must be between 0 and 1, found: " + parentOptions.opacity); parentOptions.opacity = void 0; } } if (newOptions.opacity !== void 0) { if (!Node.checkOpacity(newOptions.opacity)) { console.error("Invalid option for node opacity. Value must be between 0 and 1, found: " + newOptions.opacity); newOptions.opacity = void 0; } } if (newOptions.shapeProperties && !Node.checkCoordinateOrigin(newOptions.shapeProperties.coordinateOrigin)) console.error("Invalid option for node coordinateOrigin, found: " + newOptions.shapeProperties.coordinateOrigin); mergeOptions(parentOptions, newOptions, "shadow", globalOptions); if (newOptions.color !== void 0 && newOptions.color !== null) { const parsedColor = parseColor(newOptions.color); fillIfDefined(parentOptions.color, parsedColor); } else if (allowDeletion === true && newOptions.color === null) parentOptions.color = bridgeObject(globalOptions.color); if (newOptions.fixed !== void 0 && newOptions.fixed !== null) if (typeof newOptions.fixed === "boolean") { parentOptions.fixed.x = newOptions.fixed; parentOptions.fixed.y = newOptions.fixed; } else { if (newOptions.fixed.x !== void 0 && typeof newOptions.fixed.x === "boolean") parentOptions.fixed.x = newOptions.fixed.x; if (newOptions.fixed.y !== void 0 && typeof newOptions.fixed.y === "boolean") parentOptions.fixed.y = newOptions.fixed.y; } if (allowDeletion === true && newOptions.font === null) parentOptions.font = bridgeObject(globalOptions.font); Node.updateGroupOptions(parentOptions, newOptions, groupList); if (newOptions.scaling !== void 0) mergeOptions(parentOptions.scaling, newOptions.scaling, "label", globalOptions.scaling); } /** * * @returns {{color: *, borderWidth: *, borderColor: *, size: *, borderDashes: (boolean|Array|allOptions.nodes.shapeProperties.borderDashes|{boolean, array}), borderRadius: (number|allOptions.nodes.shapeProperties.borderRadius|{number}|Array), shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *}} */ getFormattingValues() { const values$8 = { color: this.options.color.background, opacity: this.options.opacity, borderWidth: this.options.borderWidth, borderColor: this.options.color.border, size: this.options.size, borderDashes: this.options.shapeProperties.borderDashes, borderRadius: this.options.shapeProperties.borderRadius, shadow: this.options.shadow.enabled, shadowColor: this.options.shadow.color, shadowSize: this.options.shadow.size, shadowX: this.options.shadow.x, shadowY: this.options.shadow.y }; if (this.selected || this.hover) { if (this.chooser === true) { if (this.selected) { if (this.options.borderWidthSelected != null) values$8.borderWidth = this.options.borderWidthSelected; else values$8.borderWidth *= 2; values$8.color = this.options.color.highlight.background; values$8.borderColor = this.options.color.highlight.border; values$8.shadow = this.options.shadow.enabled; } else if (this.hover) { values$8.color = this.options.color.hover.background; values$8.borderColor = this.options.color.hover.border; values$8.shadow = this.options.shadow.enabled; } } else if (typeof this.chooser === "function") { this.chooser(values$8, this.options.id, this.selected, this.hover); if (values$8.shadow === false) { if (values$8.shadowColor !== this.options.shadow.color || values$8.shadowSize !== this.options.shadow.size || values$8.shadowX !== this.options.shadow.x || values$8.shadowY !== this.options.shadow.y) values$8.shadow = true; } } } else values$8.shadow = this.options.shadow.enabled; if (this.options.opacity !== void 0) { const opacity = this.options.opacity; values$8.borderColor = overrideOpacity(values$8.borderColor, opacity); values$8.color = overrideOpacity(values$8.color, opacity); values$8.shadowColor = overrideOpacity(values$8.shadowColor, opacity); } return values$8; } /** * * @param {object} options */ updateLabelModule(options) { if (this.options.label === void 0 || this.options.label === null) this.options.label = ""; Node.updateGroupOptions(this.options, _objectSpread$2(_objectSpread$2({}, options), {}, { color: options && options.color || this._localColor || void 0 }), this.grouplist); const currentGroup = this.grouplist.get(this.options.group, false); const pile = [ options, this.options, currentGroup, this.globalOptions, this.defaultOptions ]; this.labelModule.update(this.options, pile); if (this.labelModule.baseSize !== void 0) this.baseFontSize = this.labelModule.baseSize; } /** * * @param {string} currentShape */ updateShape(currentShape) { if (currentShape === this.options.shape && this.shape) this.shape.setOptions(this.options, this.imageObj, this.imageObjAlt); else switch (this.options.shape) { case "box": this.shape = new Box$1(this.options, this.body, this.labelModule); break; case "circle": this.shape = new Circle$1(this.options, this.body, this.labelModule); break; case "circularImage": this.shape = new CircularImage(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt); break; case "custom": this.shape = new CustomShape(this.options, this.body, this.labelModule, this.options.ctxRenderer); break; case "database": this.shape = new Database(this.options, this.body, this.labelModule); break; case "diamond": this.shape = new Diamond$1(this.options, this.body, this.labelModule); break; case "dot": this.shape = new Dot(this.options, this.body, this.labelModule); break; case "ellipse": this.shape = new Ellipse(this.options, this.body, this.labelModule); break; case "icon": this.shape = new Icon(this.options, this.body, this.labelModule); break; case "image": this.shape = new Image$2(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt); break; case "square": this.shape = new Square(this.options, this.body, this.labelModule); break; case "hexagon": this.shape = new Hexagon(this.options, this.body, this.labelModule); break; case "star": this.shape = new Star(this.options, this.body, this.labelModule); break; case "text": this.shape = new Text(this.options, this.body, this.labelModule); break; case "triangle": this.shape = new Triangle$1(this.options, this.body, this.labelModule); break; case "triangleDown": this.shape = new TriangleDown(this.options, this.body, this.labelModule); break; default: this.shape = new Ellipse(this.options, this.body, this.labelModule); break; } this.needsRefresh(); } /** * select this node */ select() { this.selected = true; this.needsRefresh(); } /** * unselect this node */ unselect() { this.selected = false; this.needsRefresh(); } /** * Reset the calculated size of the node, forces it to recalculate its size */ needsRefresh() { this.shape.refreshNeeded = true; } /** * get the title of this node. * @returns {string} title The title of the node, or undefined when no title * has been set. */ getTitle() { return this.options.title; } /** * Calculate the distance to the border of the Node * @param {CanvasRenderingContext2D} ctx * @param {number} angle Angle in radians * @returns {number} distance Distance to the border in pixels */ distanceToBorder(ctx, angle) { return this.shape.distanceToBorder(ctx, angle); } /** * Check if this node has a fixed x and y position * @returns {boolean} true if fixed, false if not */ isFixed() { return this.options.fixed.x && this.options.fixed.y; } /** * check if this node is selecte * @returns {boolean} selected True if node is selected, else false */ isSelected() { return this.selected; } /** * Retrieve the value of the node. Can be undefined * @returns {number} value */ getValue() { return this.options.value; } /** * Get the current dimensions of the label * @returns {rect} */ getLabelSize() { return this.labelModule.size(); } /** * Adjust the value range of the node. The node will adjust it's size * based on its value. * @param {number} min * @param {number} max * @param {number} total */ setValueRange(min, max, total) { if (this.options.value !== void 0) { const scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value); const sizeDiff = this.options.scaling.max - this.options.scaling.min; if (this.options.scaling.label.enabled === true) { const fontDiff = this.options.scaling.label.max - this.options.scaling.label.min; this.options.font.size = this.options.scaling.label.min + scale * fontDiff; } this.options.size = this.options.scaling.min + scale * sizeDiff; } else { this.options.size = this.baseSize; this.options.font.size = this.baseFontSize; } this.updateLabelModule(); } /** * Draw this node in the given canvas * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); * @param {CanvasRenderingContext2D} ctx * @returns {object} Callbacks to draw later on higher layers. */ draw(ctx) { const values$8 = this.getFormattingValues(); return this.shape.draw(ctx, this.x, this.y, this.selected, this.hover, values$8) || {}; } /** * Update the bounding box of the shape * @param {CanvasRenderingContext2D} ctx */ updateBoundingBox(ctx) { this.shape.updateBoundingBox(this.x, this.y, ctx); } /** * Recalculate the size of this node in the given canvas * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); * @param {CanvasRenderingContext2D} ctx */ resize(ctx) { const values$8 = this.getFormattingValues(); this.shape.resize(ctx, this.selected, this.hover, values$8); } /** * Determine all visual elements of this node instance, in which the given * point falls within the bounding shape. * @param {point} point * @returns {Array.} list with the items which are on the point */ getItemsOnPoint(point) { const ret = []; if (this.labelModule.visible()) { if (pointInRect(this.labelModule.getSize(), point)) ret.push({ nodeId: this.id, labelId: 0 }); } if (pointInRect(this.shape.boundingBox, point)) ret.push({ nodeId: this.id }); return ret; } /** * Check if this object is overlapping with the provided object * @param {object} obj an object with parameters left, top, right, bottom * @returns {boolean} True if location is located on node */ isOverlappingWith(obj) { return this.shape.left < obj.right && this.shape.left + this.shape.width > obj.left && this.shape.top < obj.bottom && this.shape.top + this.shape.height > obj.top; } /** * Check if this object is overlapping with the provided object * @param {object} obj an object with parameters left, top, right, bottom * @returns {boolean} True if location is located on node */ isBoundingBoxOverlappingWith(obj) { return this.shape.boundingBox.left < obj.right && this.shape.boundingBox.right > obj.left && this.shape.boundingBox.top < obj.bottom && this.shape.boundingBox.bottom > obj.top; } /** * Check valid values for mass * * The mass may not be negative or zero. If it is, reset to 1 * @param {object} options * @param {Node.id} id * @static */ static checkMass(options, id) { if (options.mass !== void 0 && options.mass <= 0) { let strId = ""; if (id !== void 0) strId = " in node id: " + id; console.error("%cNegative or zero mass disallowed" + strId + ", setting mass to 1.", VALIDATOR_PRINT_STYLE); options.mass = 1; } } }; var NodesHandler = class { /** * @param {object} body * @param {Images} images * @param {Array.} groups * @param {LayoutEngine} layoutEngine */ constructor(body, images, groups, layoutEngine) { var _context; this.body = body; this.images = images; this.groups = groups; this.layoutEngine = layoutEngine; this.body.functions.createNode = _bindInstanceProperty(_context = this.create).call(_context, this); this.nodesListeners = { add: (event, params) => { this.add(params.items); }, update: (event, params) => { this.update(params.items, params.data, params.oldData); }, remove: (event, params) => { this.remove(params.items); } }; this.defaultOptions = { borderWidth: 1, borderWidthSelected: void 0, brokenImage: void 0, color: { border: "#2B7CE9", background: "#97C2FC", highlight: { border: "#2B7CE9", background: "#D2E5FF" }, hover: { border: "#2B7CE9", background: "#D2E5FF" } }, opacity: void 0, fixed: { x: false, y: false }, font: { color: "#343434", size: 14, face: "arial", background: "none", strokeWidth: 0, strokeColor: "#ffffff", align: "center", vadjust: 0, multi: false, bold: { mod: "bold" }, boldital: { mod: "bold italic" }, ital: { mod: "italic" }, mono: { mod: "", size: 15, face: "monospace", vadjust: 2 } }, group: void 0, hidden: false, icon: { face: "FontAwesome", code: void 0, size: 50, color: "#2B7CE9" }, image: void 0, imagePadding: { top: 0, right: 0, bottom: 0, left: 0 }, label: void 0, labelHighlightBold: true, level: void 0, margin: { top: 5, right: 5, bottom: 5, left: 5 }, mass: 1, physics: true, scaling: { min: 10, max: 30, label: { enabled: false, min: 14, max: 30, maxVisible: 30, drawThreshold: 5 }, customScalingFunction: function(min, max, total, value) { if (max === min) return .5; else { const scale = 1 / (max - min); return Math.max(0, (value - min) * scale); } } }, shadow: { enabled: false, color: "rgba(0,0,0,0.5)", size: 10, x: 5, y: 5 }, shape: "ellipse", shapeProperties: { borderDashes: false, borderRadius: 6, interpolation: true, useImageSize: false, useBorderWithImage: false, coordinateOrigin: "center" }, size: 25, title: void 0, value: void 0, x: void 0, y: void 0 }; if (this.defaultOptions.mass <= 0) throw "Internal error: mass in defaultOptions of NodesHandler may not be zero or negative"; this.options = bridgeObject(this.defaultOptions); this.bindEventListeners(); } /** * Binds event listeners */ bindEventListeners() { var _context2, _context3; this.body.emitter.on("refreshNodes", _bindInstanceProperty(_context2 = this.refresh).call(_context2, this)); this.body.emitter.on("refresh", _bindInstanceProperty(_context3 = this.refresh).call(_context3, this)); this.body.emitter.on("destroy", () => { forEach$4(this.nodesListeners, (callback, event) => { if (this.body.data.nodes) this.body.data.nodes.off(event, callback); }); delete this.body.functions.createNode; delete this.nodesListeners.add; delete this.nodesListeners.update; delete this.nodesListeners.remove; delete this.nodesListeners; }); } /** * * @param {object} options */ setOptions(options) { if (options !== void 0) { Node.parseOptions(this.options, options); if (options.opacity !== void 0) if (_Number$isNaN(options.opacity) || !_Number$isFinite(options.opacity) || options.opacity < 0 || options.opacity > 1) console.error("Invalid option for node opacity. Value must be between 0 and 1, found: " + options.opacity); else this.options.opacity = options.opacity; if (options.shape !== void 0) { for (const nodeId in this.body.nodes) if (Object.prototype.hasOwnProperty.call(this.body.nodes, nodeId)) this.body.nodes[nodeId].updateShape(); } if (typeof options.font !== "undefined" || typeof options.widthConstraint !== "undefined" || typeof options.heightConstraint !== "undefined") for (const nodeId of _Object$keys(this.body.nodes)) { this.body.nodes[nodeId].updateLabelModule(); this.body.nodes[nodeId].needsRefresh(); } if (options.size !== void 0) { for (const nodeId in this.body.nodes) if (Object.prototype.hasOwnProperty.call(this.body.nodes, nodeId)) this.body.nodes[nodeId].needsRefresh(); } if (options.hidden !== void 0 || options.physics !== void 0) this.body.emitter.emit("_dataChanged"); } } /** * Set a data set with nodes for the network * @param {Array | DataSet | DataView} nodes The data containing the nodes. * @param {boolean} [doNotEmit] - Suppress data changed event. * @private */ setData(nodes) { let doNotEmit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; const oldNodesData = this.body.data.nodes; if (isDataViewLike("id", nodes)) this.body.data.nodes = nodes; else if (_Array$isArray(nodes)) { this.body.data.nodes = new DataSet(); this.body.data.nodes.add(nodes); } else if (!nodes) this.body.data.nodes = new DataSet(); else throw new TypeError("Array or DataSet expected"); if (oldNodesData) forEach$4(this.nodesListeners, function(callback, event) { oldNodesData.off(event, callback); }); this.body.nodes = {}; if (this.body.data.nodes) { const me = this; forEach$4(this.nodesListeners, function(callback, event) { me.body.data.nodes.on(event, callback); }); const ids = this.body.data.nodes.getIds(); this.add(ids, true); } if (doNotEmit === false) this.body.emitter.emit("_dataChanged"); } /** * Add nodes * @param {number[] | string[]} ids * @param {boolean} [doNotEmit] * @private */ add(ids) { let doNotEmit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; let id; const newNodes = []; for (let i = 0; i < ids.length; i++) { id = ids[i]; const properties = this.body.data.nodes.get(id); const node = this.create(properties); newNodes.push(node); this.body.nodes[id] = node; } this.layoutEngine.positionInitially(newNodes); if (doNotEmit === false) this.body.emitter.emit("_dataChanged"); } /** * Update existing nodes, or create them when not yet existing * @param {number[] | string[]} ids id's of changed nodes * @param {Array} changedData array with changed data * @param {Array|undefined} oldData optional; array with previous data * @private */ update(ids, changedData, oldData) { const nodes = this.body.nodes; let dataChanged = false; for (let i = 0; i < ids.length; i++) { const id = ids[i]; let node = nodes[id]; const data = changedData[i]; if (node !== void 0) { if (node.setOptions(data)) dataChanged = true; } else { dataChanged = true; node = this.create(data); nodes[id] = node; } } if (!dataChanged && oldData !== void 0) dataChanged = _someInstanceProperty(changedData).call(changedData, function(newValue, index$1) { const oldValue = oldData[index$1]; return oldValue && oldValue.level !== newValue.level; }); if (dataChanged === true) this.body.emitter.emit("_dataChanged"); else this.body.emitter.emit("_dataUpdated"); } /** * Remove existing nodes. If nodes do not exist, the method will just ignore it. * @param {number[] | string[]} ids * @private */ remove(ids) { const nodes = this.body.nodes; for (let i = 0; i < ids.length; i++) { const id = ids[i]; delete nodes[id]; } this.body.emitter.emit("_dataChanged"); } /** * create a node * @param {object} properties * @param {class} [constructorClass] * @returns {*} */ create(properties) { let constructorClass = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Node; return new constructorClass(properties, this.body, this.images, this.groups, this.options, this.defaultOptions); } /** * * @param {boolean} [clearPositions] */ refresh() { let clearPositions = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; forEach$4(this.body.nodes, (node, nodeId) => { const data = this.body.data.nodes.get(nodeId); if (data !== void 0) { if (clearPositions === true) node.setOptions({ x: null, y: null }); node.setOptions({ fixed: false }); node.setOptions(data); } }); } /** * Returns the positions of the nodes. * @param {Array. | string} [ids] --> optional, can be array of nodeIds, can be string * @returns {{}} */ getPositions(ids) { const dataArray = {}; if (ids !== void 0) { if (_Array$isArray(ids) === true) { for (let i = 0; i < ids.length; i++) if (this.body.nodes[ids[i]] !== void 0) { const node = this.body.nodes[ids[i]]; dataArray[ids[i]] = { x: Math.round(node.x), y: Math.round(node.y) }; } } else if (this.body.nodes[ids] !== void 0) { const node = this.body.nodes[ids]; dataArray[ids] = { x: Math.round(node.x), y: Math.round(node.y) }; } } else for (let i = 0; i < this.body.nodeIndices.length; i++) { const node = this.body.nodes[this.body.nodeIndices[i]]; dataArray[this.body.nodeIndices[i]] = { x: Math.round(node.x), y: Math.round(node.y) }; } return dataArray; } /** * Retrieves the x y position of a specific id. * @param {string} id The id to retrieve. * @throws {TypeError} If no id is included. * @throws {ReferenceError} If an invalid id is provided. * @returns {{ x: number, y: number }} Returns X, Y canvas position of the node with given id. */ getPosition(id) { if (id == void 0) throw new TypeError("No id was specified for getPosition method."); else if (this.body.nodes[id] == void 0) throw new ReferenceError("NodeId provided for getPosition does not exist. Provided: ".concat(id)); else return { x: Math.round(this.body.nodes[id].x), y: Math.round(this.body.nodes[id].y) }; } /** * Load the XY positions of the nodes into the dataset. */ storePositions() { const dataArray = []; const dataset = this.body.data.nodes.getDataSet(); for (const dsNode of dataset.get()) { const id = dsNode.id; const bodyNode = this.body.nodes[id]; const x = Math.round(bodyNode.x); const y = Math.round(bodyNode.y); if (dsNode.x !== x || dsNode.y !== y) dataArray.push({ id, x, y }); } dataset.update(dataArray); } /** * get the bounding box of a node. * @param {Node.id} nodeId * @returns {j|*} */ getBoundingBox(nodeId) { if (this.body.nodes[nodeId] !== void 0) return this.body.nodes[nodeId].shape.boundingBox; } /** * Get the Ids of nodes connected to this node. * @param {Node.id} nodeId * @param {'to'|'from'|undefined} direction values 'from' and 'to' select respectively parent and child nodes only. * Any other value returns both parent and child nodes. * @returns {Array} */ getConnectedNodes(nodeId, direction) { const nodeList = []; if (this.body.nodes[nodeId] !== void 0) { const node = this.body.nodes[nodeId]; const nodeObj = {}; for (let i = 0; i < node.edges.length; i++) { const edge = node.edges[i]; if (direction !== "to" && edge.toId == node.id) { if (nodeObj[edge.fromId] === void 0) { nodeList.push(edge.fromId); nodeObj[edge.fromId] = true; } } else if (direction !== "from" && edge.fromId == node.id) { if (nodeObj[edge.toId] === void 0) { nodeList.push(edge.toId); nodeObj[edge.toId] = true; } } } } return nodeList; } /** * Get the ids of the edges connected to this node. * @param {Node.id} nodeId * @returns {*} */ getConnectedEdges(nodeId) { const edgeList = []; if (this.body.nodes[nodeId] !== void 0) { const node = this.body.nodes[nodeId]; for (let i = 0; i < node.edges.length; i++) edgeList.push(node.edges[i].id); } else console.error("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId); return edgeList; } /** * Move a node. * @param {Node.id} nodeId * @param {number} x * @param {number} y */ moveNode(nodeId, x, y) { if (this.body.nodes[nodeId] !== void 0) { this.body.nodes[nodeId].x = Number(x); this.body.nodes[nodeId].y = Number(y); _setTimeout(() => { this.body.emitter.emit("startSimulation"); }, 0); } else console.error("Node id supplied to moveNode does not exist. Provided: ", nodeId); } }; var es_date_toJson = {}; var stringRepeat; var hasRequiredStringRepeat; function requireStringRepeat() { if (hasRequiredStringRepeat) return stringRepeat; hasRequiredStringRepeat = 1; var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity(); var toString$2 = /* @__PURE__ */ requireToString(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); var $RangeError = RangeError; stringRepeat = function repeat(count) { var str = toString$2(requireObjectCoercible$2(this)); var result = ""; var n = toIntegerOrInfinity$2(count); if (n < 0 || n === Infinity) throw new $RangeError("Wrong number of repetitions"); for (; n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str; return result; }; return stringRepeat; } var stringPad; var hasRequiredStringPad; function requireStringPad() { if (hasRequiredStringPad) return stringPad; hasRequiredStringPad = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var toLength$2 = /* @__PURE__ */ requireToLength(); var toString$2 = /* @__PURE__ */ requireToString(); var $repeat = /* @__PURE__ */ requireStringRepeat(); var requireObjectCoercible$2 = /* @__PURE__ */ requireRequireObjectCoercible(); var repeat = uncurryThis($repeat); var stringSlice = uncurryThis("".slice); var ceil = Math.ceil; var createMethod = function(IS_END) { return function($this, maxLength, fillString) { var S = toString$2(requireObjectCoercible$2($this)); var intMaxLength = toLength$2(maxLength); var stringLength = S.length; var fillStr = fillString === void 0 ? " " : toString$2(fillString); var fillLen, stringFiller; if (intMaxLength <= stringLength || fillStr === "") return S; fillLen = intMaxLength - stringLength; stringFiller = repeat(fillStr, ceil(fillLen / fillStr.length)); if (stringFiller.length > fillLen) stringFiller = stringSlice(stringFiller, 0, fillLen); return IS_END ? S + stringFiller : stringFiller + S; }; }; stringPad = { start: createMethod(false), end: createMethod(true) }; return stringPad; } var dateToIsoString; var hasRequiredDateToIsoString; function requireDateToIsoString() { if (hasRequiredDateToIsoString) return dateToIsoString; hasRequiredDateToIsoString = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var fails$2 = /* @__PURE__ */ requireFails(); var padStart = requireStringPad().start; var $RangeError = RangeError; var $isFinite = isFinite; var abs$2 = Math.abs; var DatePrototype = Date.prototype; var nativeDateToISOString = DatePrototype.toISOString; var thisTimeValue = uncurryThis(DatePrototype.getTime); var getUTCDate = uncurryThis(DatePrototype.getUTCDate); var getUTCFullYear = uncurryThis(DatePrototype.getUTCFullYear); var getUTCHours = uncurryThis(DatePrototype.getUTCHours); var getUTCMilliseconds = uncurryThis(DatePrototype.getUTCMilliseconds); var getUTCMinutes = uncurryThis(DatePrototype.getUTCMinutes); var getUTCMonth = uncurryThis(DatePrototype.getUTCMonth); var getUTCSeconds = uncurryThis(DatePrototype.getUTCSeconds); dateToIsoString = fails$2(function() { return nativeDateToISOString.call(new Date(-50000000000001)) !== "0385-07-25T07:06:39.999Z"; }) || !fails$2(function() { nativeDateToISOString.call(new Date(NaN)); }) ? function toISOString() { if (!$isFinite(thisTimeValue(this))) throw new $RangeError("Invalid time value"); var date = this; var year = getUTCFullYear(date); var milliseconds = getUTCMilliseconds(date); var sign = year < 0 ? "-" : year > 9999 ? "+" : ""; return sign + padStart(abs$2(year), sign ? 6 : 4, 0) + "-" + padStart(getUTCMonth(date) + 1, 2, 0) + "-" + padStart(getUTCDate(date), 2, 0) + "T" + padStart(getUTCHours(date), 2, 0) + ":" + padStart(getUTCMinutes(date), 2, 0) + ":" + padStart(getUTCSeconds(date), 2, 0) + "." + padStart(milliseconds, 3, 0) + "Z"; } : nativeDateToISOString; return dateToIsoString; } var hasRequiredEs_date_toJson; function requireEs_date_toJson() { if (hasRequiredEs_date_toJson) return es_date_toJson; hasRequiredEs_date_toJson = 1; var $ = /* @__PURE__ */ require_export(); var call = /* @__PURE__ */ requireFunctionCall(); var toObject$2 = /* @__PURE__ */ requireToObject(); var toPrimitive$8 = /* @__PURE__ */ requireToPrimitive$5(); var toISOString = /* @__PURE__ */ requireDateToIsoString(); var classof$2 = /* @__PURE__ */ requireClassofRaw(); var fails$2 = /* @__PURE__ */ requireFails(); var FORCED = fails$2(function() { return new Date(NaN).toJSON() !== null || call(Date.prototype.toJSON, { toISOString: function() { return 1; } }) !== 1; }); $({ target: "Date", proto: true, forced: FORCED }, { toJSON: function toJSON(key) { var O = toObject$2(this); var pv = toPrimitive$8(O, "number"); return typeof pv == "number" && !isFinite(pv) ? null : !("toISOString" in O) && classof$2(O) === "Date" ? call(toISOString, O) : O.toISOString(); } }); return es_date_toJson; } var stringify$2; var hasRequiredStringify$2; function requireStringify$2() { if (hasRequiredStringify$2) return stringify$2; hasRequiredStringify$2 = 1; requireEs_date_toJson(); requireEs_json_stringify(); var path$2 = /* @__PURE__ */ requirePath(); var apply = /* @__PURE__ */ requireFunctionApply(); if (!path$2.JSON) path$2.JSON = { stringify: JSON.stringify }; stringify$2 = function stringify$4(it$1, replacer, space) { return apply(path$2.JSON.stringify, null, arguments); }; return stringify$2; } var stringify$1; var hasRequiredStringify$1; function requireStringify$1() { if (hasRequiredStringify$1) return stringify$1; hasRequiredStringify$1 = 1; var parent = /* @__PURE__ */ requireStringify$2(); stringify$1 = parent; return stringify$1; } var stringify; var hasRequiredStringify; function requireStringify() { if (hasRequiredStringify) return stringify; hasRequiredStringify = 1; stringify = /* @__PURE__ */ requireStringify$1(); return stringify; } var stringifyExports = requireStringify(); var _JSON$stringify = /* @__PURE__ */ getDefaultExportFromCjs(stringifyExports); var es_math_hypot = {}; var hasRequiredEs_math_hypot; function requireEs_math_hypot() { if (hasRequiredEs_math_hypot) return es_math_hypot; hasRequiredEs_math_hypot = 1; var $ = /* @__PURE__ */ require_export(); var $hypot = Math.hypot; var abs$2 = Math.abs; var sqrt = Math.sqrt; var FORCED = !!$hypot && $hypot(Infinity, NaN) !== Infinity; $({ target: "Math", stat: true, arity: 2, forced: FORCED }, { hypot: function hypot$3(value1, value2) { var sum = 0; var i = 0; var aLen = arguments.length; var larg = 0; var arg, div; while (i < aLen) { arg = abs$2(arguments[i++]); if (larg < arg) { div = larg / arg; sum = sum * div * div + 1; larg = arg; } else if (arg > 0) { div = arg / larg; sum += div * div; } else sum += arg; } return larg === Infinity ? Infinity : larg * sqrt(sum); } }); return es_math_hypot; } var hypot$2; var hasRequiredHypot$2; function requireHypot$2() { if (hasRequiredHypot$2) return hypot$2; hasRequiredHypot$2 = 1; requireEs_math_hypot(); var path$2 = /* @__PURE__ */ requirePath(); hypot$2 = path$2.Math.hypot; return hypot$2; } var hypot$1; var hasRequiredHypot$1; function requireHypot$1() { if (hasRequiredHypot$1) return hypot$1; hasRequiredHypot$1 = 1; var parent = /* @__PURE__ */ requireHypot$2(); hypot$1 = parent; return hypot$1; } var hypot; var hasRequiredHypot; function requireHypot() { if (hasRequiredHypot) return hypot; hasRequiredHypot = 1; hypot = /* @__PURE__ */ requireHypot$1(); return hypot; } var hypotExports = requireHypot(); var _Math$hypot = /* @__PURE__ */ getDefaultExportFromCjs(hypotExports); var EndPoint = class { /** * Apply transformation on points for display. * * The following is done: * - rotate by the specified angle * - multiply the (normalized) coordinates by the passed length * - offset by the target coordinates * @param points - The point(s) to be transformed. * @param arrowData - The data determining the result of the transformation. */ static transform(points, arrowData) { if (!_Array$isArray(points)) points = [points]; const x = arrowData.point.x; const y = arrowData.point.y; const angle = arrowData.angle; const length$1 = arrowData.length; for (let i = 0; i < points.length; ++i) { const p = points[i]; const xt = p.x * Math.cos(angle) - p.y * Math.sin(angle); const yt = p.x * Math.sin(angle) + p.y * Math.cos(angle); p.x = x + length$1 * xt; p.y = y + length$1 * yt; } } /** * Draw a closed path using the given real coordinates. * @param ctx - The path will be rendered into this context. * @param points - The points of the path. */ static drawPath(ctx, points) { ctx.beginPath(); ctx.moveTo(points[0].x, points[0].y); for (let i = 1; i < points.length; ++i) ctx.lineTo(points[i].x, points[i].y); ctx.closePath(); } }; /** * Drawing methods for the arrow endpoint. */ let Image$1 = class Image$3 extends EndPoint { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns False as there is no way to fill an image. */ static draw(ctx, arrowData) { if (arrowData.image) { ctx.save(); ctx.translate(arrowData.point.x, arrowData.point.y); ctx.rotate(Math.PI / 2 + arrowData.angle); const width = arrowData.imageWidth != null ? arrowData.imageWidth : arrowData.image.width; const height = arrowData.imageHeight != null ? arrowData.imageHeight : arrowData.image.height; arrowData.image.drawImageAtPosition( ctx, 1, // scale -width / 2, // x 0, // y width, height ); ctx.restore(); } return false; } }; var Arrow = class extends EndPoint { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const points = [ { x: 0, y: 0 }, { x: -1, y: .3 }, { x: -.9, y: 0 }, { x: -1, y: -.3 } ]; EndPoint.transform(points, arrowData); EndPoint.drawPath(ctx, points); return true; } }; var Crow = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const points = [ { x: -1, y: 0 }, { x: 0, y: .3 }, { x: -.4, y: 0 }, { x: 0, y: -.3 } ]; EndPoint.transform(points, arrowData); EndPoint.drawPath(ctx, points); return true; } }; var Curve = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const point = { x: -.4, y: 0 }; EndPoint.transform(point, arrowData); ctx.strokeStyle = ctx.fillStyle; ctx.fillStyle = "rgba(0, 0, 0, 0)"; const pi = Math.PI; const startAngle = arrowData.angle - pi / 2; const endAngle = arrowData.angle + pi / 2; ctx.beginPath(); ctx.arc(point.x, point.y, arrowData.length * .4, startAngle, endAngle, false); ctx.stroke(); return true; } }; var InvertedCurve = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const point = { x: -.3, y: 0 }; EndPoint.transform(point, arrowData); ctx.strokeStyle = ctx.fillStyle; ctx.fillStyle = "rgba(0, 0, 0, 0)"; const pi = Math.PI; const startAngle = arrowData.angle + pi / 2; const endAngle = arrowData.angle + 3 * pi / 2; ctx.beginPath(); ctx.arc(point.x, point.y, arrowData.length * .4, startAngle, endAngle, false); ctx.stroke(); return true; } }; var Triangle = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const points = [ { x: .02, y: 0 }, { x: -1, y: .3 }, { x: -1, y: -.3 } ]; EndPoint.transform(points, arrowData); EndPoint.drawPath(ctx, points); return true; } }; var InvertedTriangle = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const points = [ { x: 0, y: .3 }, { x: 0, y: -.3 }, { x: -1, y: 0 } ]; EndPoint.transform(points, arrowData); EndPoint.drawPath(ctx, points); return true; } }; var Circle = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const point = { x: -.4, y: 0 }; EndPoint.transform(point, arrowData); drawCircle(ctx, point.x, point.y, arrowData.length * .4); return true; } }; var Bar = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const points = [ { x: 0, y: .5 }, { x: 0, y: -.5 }, { x: -.15, y: -.5 }, { x: -.15, y: .5 } ]; EndPoint.transform(points, arrowData); EndPoint.drawPath(ctx, points); return true; } }; var Box = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const points = [ { x: 0, y: .3 }, { x: 0, y: -.3 }, { x: -.6, y: -.3 }, { x: -.6, y: .3 } ]; EndPoint.transform(points, arrowData); EndPoint.drawPath(ctx, points); return true; } }; var Diamond = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const points = [ { x: 0, y: 0 }, { x: -.5, y: -.3 }, { x: -1, y: 0 }, { x: -.5, y: .3 } ]; EndPoint.transform(points, arrowData); EndPoint.drawPath(ctx, points); return true; } }; var Vee = class { /** * Draw this shape at the end of a line. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True because ctx.fill() can be used to fill the arrow. */ static draw(ctx, arrowData) { const points = [ { x: -1, y: .3 }, { x: -.5, y: 0 }, { x: -1, y: -.3 }, { x: 0, y: 0 } ]; EndPoint.transform(points, arrowData); EndPoint.drawPath(ctx, points); return true; } }; var EndPoints = class { /** * Draw an endpoint. * @param ctx - The shape will be rendered into this context. * @param arrowData - The data determining the shape. * @returns True if ctx.fill() can be used to fill the arrow, false otherwise. */ static draw(ctx, arrowData) { let type; if (arrowData.type) type = arrowData.type.toLowerCase(); switch (type) { case "image": return Image$1.draw(ctx, arrowData); case "circle": return Circle.draw(ctx, arrowData); case "box": return Box.draw(ctx, arrowData); case "crow": return Crow.draw(ctx, arrowData); case "curve": return Curve.draw(ctx, arrowData); case "diamond": return Diamond.draw(ctx, arrowData); case "inv_curve": return InvertedCurve.draw(ctx, arrowData); case "triangle": return Triangle.draw(ctx, arrowData); case "inv_triangle": return InvertedTriangle.draw(ctx, arrowData); case "bar": return Bar.draw(ctx, arrowData); case "vee": return Vee.draw(ctx, arrowData); case "arrow": default: return Arrow.draw(ctx, arrowData); } } }; function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function(r$1) { return _Object$getOwnPropertyDescriptor(e, r$1).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$1(Object(t), true)).call(_context2, function(r$1) { _defineProperty(e, r$1, t[r$1]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$1(Object(t))).call(_context3, function(r$1) { _Object$defineProperty(e, r$1, _Object$getOwnPropertyDescriptor(t, r$1)); }); } return e; } var EdgeBase = class { /** * Create a new instance. * @param options - The options object of given edge. * @param body - The body of the network. * @param labelModule - Label module. */ constructor(options, body, labelModule) { _defineProperty(this, "color", {}); _defineProperty(this, "colorDirty", true); _defineProperty(this, "hoverWidth", 1.5); _defineProperty(this, "selectionWidth", 2); this._body = body; this._labelModule = labelModule; this.setOptions(options); this.fromPoint = this.from; this.toPoint = this.to; } /** @inheritDoc */ connect() { this.from = this._body.nodes[this.options.from]; this.to = this._body.nodes[this.options.to]; } /** @inheritDoc */ cleanup() { return false; } /** * Set new edge options. * @param options - The new edge options object. */ setOptions(options) { this.options = options; this.from = this._body.nodes[this.options.from]; this.to = this._body.nodes[this.options.to]; this.id = this.options.id; } /** @inheritDoc */ drawLine(ctx, values$8, _selected, _hover) { let viaNode = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.getViaNode(); ctx.strokeStyle = this.getColor(ctx, values$8); ctx.lineWidth = values$8.width; if (values$8.dashes !== false) this._drawDashedLine(ctx, values$8, viaNode); else this._drawLine(ctx, values$8, viaNode); } /** * Draw a line with given style between two nodes through supplied node(s). * @param ctx - The context that will be used for rendering. * @param values - Formatting values like color, opacity or shadow. * @param viaNode - Additional control point(s) for the edge. * @param fromPoint - TODO: Seems ignored, remove? * @param toPoint - TODO: Seems ignored, remove? */ _drawLine(ctx, values$8, viaNode, fromPoint, toPoint) { if (this.from != this.to) this._line(ctx, values$8, viaNode, fromPoint, toPoint); else { const [x, y, radius] = this._getCircleData(ctx); this._circle(ctx, values$8, x, y, radius); } } /** * Draw a dashed line with given style between two nodes through supplied node(s). * @param ctx - The context that will be used for rendering. * @param values - Formatting values like color, opacity or shadow. * @param viaNode - Additional control point(s) for the edge. * @param _fromPoint - Ignored (TODO: remove in the future). * @param _toPoint - Ignored (TODO: remove in the future). */ _drawDashedLine(ctx, values$8, viaNode, _fromPoint, _toPoint) { ctx.lineCap = "round"; const pattern = _Array$isArray(values$8.dashes) ? values$8.dashes : [5, 5]; if (ctx.setLineDash !== void 0) { ctx.save(); ctx.setLineDash(pattern); ctx.lineDashOffset = 0; if (this.from != this.to) this._line(ctx, values$8, viaNode); else { const [x, y, radius] = this._getCircleData(ctx); this._circle(ctx, values$8, x, y, radius); } ctx.setLineDash([0]); ctx.lineDashOffset = 0; ctx.restore(); } else { if (this.from != this.to) drawDashedLine(ctx, this.from.x, this.from.y, this.to.x, this.to.y, pattern); else { const [x, y, radius] = this._getCircleData(ctx); this._circle(ctx, values$8, x, y, radius); } this.enableShadow(ctx, values$8); ctx.stroke(); this.disableShadow(ctx, values$8); } } /** * Find the intersection between the border of the node and the edge. * @param node - The node (either from or to node of the edge). * @param ctx - The context that will be used for rendering. * @param options - Additional options. * @returns Cartesian coordinates of the intersection between the border of the node and the edge. */ findBorderPosition(node, ctx, options) { if (this.from != this.to) return this._findBorderPosition(node, ctx, options); else return this._findBorderPositionCircle(node, ctx, options); } /** @inheritDoc */ findBorderPositions(ctx) { if (this.from != this.to) return { from: this._findBorderPosition(this.from, ctx), to: this._findBorderPosition(this.to, ctx) }; else { var _context; const [x, y] = _sliceInstanceProperty(_context = this._getCircleData(ctx)).call(_context, 0, 2); return { from: this._findBorderPositionCircle(this.from, ctx, { x, y, low: .25, high: .6, direction: -1 }), to: this._findBorderPositionCircle(this.from, ctx, { x, y, low: .6, high: .8, direction: 1 }) }; } } /** * Compute the center point and radius of an edge connected to the same node at both ends. * @param ctx - The context that will be used for rendering. * @returns `[x, y, radius]` */ _getCircleData(ctx) { const radius = this.options.selfReference.size; if (ctx !== void 0) { if (this.from.shape.width === void 0) this.from.shape.resize(ctx); } const coordinates = getSelfRefCoordinates(ctx, this.options.selfReference.angle, radius, this.from); return [ coordinates.x, coordinates.y, radius ]; } /** * Get a point on a circle. * @param x - Center of the circle on the x axis. * @param y - Center of the circle on the y axis. * @param radius - Radius of the circle. * @param position - Value between 0 (line start) and 1 (line end). * @returns Cartesian coordinates of requested point on the circle. */ _pointOnCircle(x, y, radius, position) { const angle = position * 2 * Math.PI; return { x: x + radius * Math.cos(angle), y: y - radius * Math.sin(angle) }; } /** * Find the intersection between the border of the node and the edge. * @remarks * This function uses binary search to look for the point where the circle crosses the border of the node. * @param nearNode - The node (either from or to node of the edge). * @param ctx - The context that will be used for rendering. * @param options - Additional options. * @returns Cartesian coordinates of the intersection between the border of the node and the edge. */ _findBorderPositionCircle(nearNode, ctx, options) { const x = options.x; const y = options.y; let low = options.low; let high = options.high; const direction = options.direction; const maxIterations = 10; const radius = this.options.selfReference.size; const threshold = .05; let pos; let middle = (low + high) * .5; let endPointOffset = 0; if (this.options.arrowStrikethrough === true) { if (direction === -1) endPointOffset = this.options.endPointOffset.from; else if (direction === 1) endPointOffset = this.options.endPointOffset.to; } let iteration = 0; do { middle = (low + high) * .5; pos = this._pointOnCircle(x, y, radius, middle); const angle = Math.atan2(nearNode.y - pos.y, nearNode.x - pos.x); const distanceToBorder = nearNode.distanceToBorder(ctx, angle) + endPointOffset; const distanceToPoint = Math.sqrt(Math.pow(pos.x - nearNode.x, 2) + Math.pow(pos.y - nearNode.y, 2)); const difference = distanceToBorder - distanceToPoint; if (Math.abs(difference) < threshold) break; else if (difference > 0) if (direction > 0) low = middle; else high = middle; else if (direction > 0) high = middle; else low = middle; ++iteration; } while (low <= high && iteration < maxIterations); return _objectSpread$1(_objectSpread$1({}, pos), {}, { t: middle }); } /** * Get the line width of the edge. Depends on width and whether one of the connected nodes is selected. * @param selected - Determines wheter the line is selected. * @param hover - Determines wheter the line is being hovered, only applies if selected is false. * @returns The width of the line. */ getLineWidth(selected, hover) { if (selected === true) return Math.max(this.selectionWidth, .3 / this._body.view.scale); else if (hover === true) return Math.max(this.hoverWidth, .3 / this._body.view.scale); else return Math.max(this.options.width, .3 / this._body.view.scale); } /** * Compute the color or gradient for given edge. * @param ctx - The context that will be used for rendering. * @param values - Formatting values like color, opacity or shadow. * @param _selected - Ignored (TODO: remove in the future). * @param _hover - Ignored (TODO: remove in the future). * @returns Color string if single color is inherited or gradient if two. */ getColor(ctx, values$8) { if (values$8.inheritsColor !== false) { if (values$8.inheritsColor === "both" && this.from.id !== this.to.id) { const grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y); let fromColor = this.from.options.color.highlight.border; let toColor = this.to.options.color.highlight.border; if (this.from.selected === false && this.to.selected === false) { fromColor = overrideOpacity(this.from.options.color.border, values$8.opacity); toColor = overrideOpacity(this.to.options.color.border, values$8.opacity); } else if (this.from.selected === true && this.to.selected === false) toColor = this.to.options.color.border; else if (this.from.selected === false && this.to.selected === true) fromColor = this.from.options.color.border; grd.addColorStop(0, fromColor); grd.addColorStop(1, toColor); return grd; } if (values$8.inheritsColor === "to") return overrideOpacity(this.to.options.color.border, values$8.opacity); else return overrideOpacity(this.from.options.color.border, values$8.opacity); } else return overrideOpacity(values$8.color, values$8.opacity); } /** * Draw a line from a node to itself, a circle. * @param ctx - The context that will be used for rendering. * @param values - Formatting values like color, opacity or shadow. * @param x - Center of the circle on the x axis. * @param y - Center of the circle on the y axis. * @param radius - Radius of the circle. */ _circle(ctx, values$8, x, y, radius) { this.enableShadow(ctx, values$8); let angleFrom = 0; let angleTo = Math.PI * 2; if (!this.options.selfReference.renderBehindTheNode) { const low = this.options.selfReference.angle; const high = this.options.selfReference.angle + Math.PI; const pointTFrom = this._findBorderPositionCircle(this.from, ctx, { x, y, low, high, direction: -1 }); const pointTTo = this._findBorderPositionCircle(this.from, ctx, { x, y, low, high, direction: 1 }); angleFrom = Math.atan2(pointTFrom.y - y, pointTFrom.x - x); angleTo = Math.atan2(pointTTo.y - y, pointTTo.x - x); } ctx.beginPath(); ctx.arc(x, y, radius, angleFrom, angleTo, false); ctx.stroke(); this.disableShadow(ctx, values$8); } /** * @inheritDoc * @remarks * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment */ getDistanceToEdge(x1, y1, x2, y2, x3, y3) { if (this.from != this.to) return this._getDistanceToEdge(x1, y1, x2, y2, x3, y3); else { const [x, y, radius] = this._getCircleData(void 0); const dx = x - x3; const dy = y - y3; return Math.abs(Math.sqrt(dx * dx + dy * dy) - radius); } } /** * Calculate the distance between a point (x3, y3) and a line segment from (x1, y1) to (x2, y2). * @param x1 - First end of the line segment on the x axis. * @param y1 - First end of the line segment on the y axis. * @param x2 - Second end of the line segment on the x axis. * @param y2 - Second end of the line segment on the y axis. * @param x3 - Position of the point on the x axis. * @param y3 - Position of the point on the y axis. * @returns The distance between the line segment and the point. */ _getDistanceToLine(x1, y1, x2, y2, x3, y3) { const px = x2 - x1; const py = y2 - y1; const something = px * px + py * py; let u = ((x3 - x1) * px + (y3 - y1) * py) / something; if (u > 1) u = 1; else if (u < 0) u = 0; const x = x1 + u * px; const y = y1 + u * py; const dx = x - x3; const dy = y - y3; return Math.sqrt(dx * dx + dy * dy); } /** @inheritDoc */ getArrowData(ctx, position, viaNode, _selected, _hover, values$8) { let angle; let arrowPoint; let node1; let node2; let reversed; let scaleFactor; let type; const lineWidth = values$8.width; if (position === "from") { node1 = this.from; node2 = this.to; reversed = values$8.fromArrowScale < 0; scaleFactor = Math.abs(values$8.fromArrowScale); type = values$8.fromArrowType; } else if (position === "to") { node1 = this.to; node2 = this.from; reversed = values$8.toArrowScale < 0; scaleFactor = Math.abs(values$8.toArrowScale); type = values$8.toArrowType; } else { node1 = this.to; node2 = this.from; reversed = values$8.middleArrowScale < 0; scaleFactor = Math.abs(values$8.middleArrowScale); type = values$8.middleArrowType; } const length$1 = 15 * scaleFactor + 3 * lineWidth; if (node1 != node2) { const approximateEdgeLength = _Math$hypot(node1.x - node2.x, node1.y - node2.y); const relativeLength = length$1 / approximateEdgeLength; if (position !== "middle") if (this.options.smooth.enabled === true) { const pointT = this._findBorderPosition(node1, ctx, { via: viaNode }); const guidePos = this.getPoint(pointT.t + relativeLength * (position === "from" ? 1 : -1), viaNode); angle = Math.atan2(pointT.y - guidePos.y, pointT.x - guidePos.x); arrowPoint = pointT; } else { angle = Math.atan2(node1.y - node2.y, node1.x - node2.x); arrowPoint = this._findBorderPosition(node1, ctx); } else { const halfLength = (reversed ? -relativeLength : relativeLength) / 2; const guidePos1 = this.getPoint(.5 + halfLength, viaNode); const guidePos2 = this.getPoint(.5 - halfLength, viaNode); angle = Math.atan2(guidePos1.y - guidePos2.y, guidePos1.x - guidePos2.x); arrowPoint = this.getPoint(.5, viaNode); } } else { const [x, y, radius] = this._getCircleData(ctx); if (position === "from") { const low = this.options.selfReference.angle; const high = this.options.selfReference.angle + Math.PI; const pointT = this._findBorderPositionCircle(this.from, ctx, { x, y, low, high, direction: -1 }); angle = pointT.t * -2 * Math.PI + 1.5 * Math.PI + .1 * Math.PI; arrowPoint = pointT; } else if (position === "to") { const low = this.options.selfReference.angle; const high = this.options.selfReference.angle + Math.PI; const pointT = this._findBorderPositionCircle(this.from, ctx, { x, y, low, high, direction: 1 }); angle = pointT.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI; arrowPoint = pointT; } else { const pos = this.options.selfReference.angle / (2 * Math.PI); arrowPoint = this._pointOnCircle(x, y, radius, pos); angle = pos * -2 * Math.PI + 1.5 * Math.PI + .1 * Math.PI; } } const xi = arrowPoint.x - length$1 * .9 * Math.cos(angle); const yi = arrowPoint.y - length$1 * .9 * Math.sin(angle); const arrowCore = { x: xi, y: yi }; return { point: arrowPoint, core: arrowCore, angle, length: length$1, type }; } /** @inheritDoc */ drawArrowHead(ctx, values$8, _selected, _hover, arrowData) { ctx.strokeStyle = this.getColor(ctx, values$8); ctx.fillStyle = ctx.strokeStyle; ctx.lineWidth = values$8.width; const canFill = EndPoints.draw(ctx, arrowData); if (canFill) { this.enableShadow(ctx, values$8); _fillInstanceProperty(ctx).call(ctx); this.disableShadow(ctx, values$8); } } /** * Set the shadow formatting values in the context if enabled, do nothing otherwise. * @param ctx - The context that will be used for rendering. * @param values - Formatting values for the shadow. */ enableShadow(ctx, values$8) { if (values$8.shadow === true) { ctx.shadowColor = values$8.shadowColor; ctx.shadowBlur = values$8.shadowSize; ctx.shadowOffsetX = values$8.shadowX; ctx.shadowOffsetY = values$8.shadowY; } } /** * Reset the shadow formatting values in the context if enabled, do nothing otherwise. * @param ctx - The context that will be used for rendering. * @param values - Formatting values for the shadow. */ disableShadow(ctx, values$8) { if (values$8.shadow === true) { ctx.shadowColor = "rgba(0,0,0,0)"; ctx.shadowBlur = 0; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 0; } } /** * Render the background according to the formatting values. * @param ctx - The context that will be used for rendering. * @param values - Formatting values for the background. */ drawBackground(ctx, values$8) { if (values$8.background !== false) { const origCtxAttr = { strokeStyle: ctx.strokeStyle, lineWidth: ctx.lineWidth, dashes: ctx.dashes }; ctx.strokeStyle = values$8.backgroundColor; ctx.lineWidth = values$8.backgroundSize; this.setStrokeDashed(ctx, values$8.backgroundDashes); ctx.stroke(); ctx.strokeStyle = origCtxAttr.strokeStyle; ctx.lineWidth = origCtxAttr.lineWidth; ctx.dashes = origCtxAttr.dashes; this.setStrokeDashed(ctx, values$8.dashes); } } /** * Set the line dash pattern if supported. Logs a warning to the console if it isn't supported. * @param ctx - The context that will be used for rendering. * @param dashes - The pattern [line, space, line…], true for default dashed line or false for normal line. */ setStrokeDashed(ctx, dashes) { if (dashes !== false) if (ctx.setLineDash !== void 0) { const pattern = _Array$isArray(dashes) ? dashes : [5, 5]; ctx.setLineDash(pattern); } else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used."); else if (ctx.setLineDash !== void 0) ctx.setLineDash([]); else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used."); } }; function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function(r$1) { return _Object$getOwnPropertyDescriptor(e, r$1).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), true)).call(_context, function(r$1) { _defineProperty(e, r$1, t[r$1]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function(r$1) { _Object$defineProperty(e, r$1, _Object$getOwnPropertyDescriptor(t, r$1)); }); } return e; } var BezierEdgeBase = class extends EdgeBase { /** * Create a new instance. * @param options - The options object of given edge. * @param body - The body of the network. * @param labelModule - Label module. */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * Find the intersection between the border of the node and the edge. * @remarks * This function uses binary search to look for the point where the bezier curve crosses the border of the node. * @param nearNode - The node (either from or to node of the edge). * @param ctx - The context that will be used for rendering. * @param viaNode - Additional node(s) the edge passes through. * @returns Cartesian coordinates of the intersection between the border of the node and the edge. */ _findBorderPositionBezier(nearNode, ctx) { let viaNode = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this._getViaCoordinates(); const maxIterations = 10; const threshold = .2; let from = false; let high = 1; let low = 0; let node = this.to; let pos; let middle; let endPointOffset = this.options.endPointOffset ? this.options.endPointOffset.to : 0; if (nearNode.id === this.from.id) { node = this.from; from = true; endPointOffset = this.options.endPointOffset ? this.options.endPointOffset.from : 0; } if (this.options.arrowStrikethrough === false) endPointOffset = 0; let iteration = 0; do { middle = (low + high) * .5; pos = this.getPoint(middle, viaNode); const angle = Math.atan2(node.y - pos.y, node.x - pos.x); const distanceToBorder = node.distanceToBorder(ctx, angle) + endPointOffset; const distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2)); const difference = distanceToBorder - distanceToPoint; if (Math.abs(difference) < threshold) break; else if (difference < 0) if (from === false) low = middle; else high = middle; else if (from === false) high = middle; else low = middle; ++iteration; } while (low <= high && iteration < maxIterations); return _objectSpread(_objectSpread({}, pos), {}, { t: middle }); } /** * Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2). * @remarks * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment * @param x1 - First end of the line segment on the x axis. * @param y1 - First end of the line segment on the y axis. * @param x2 - Second end of the line segment on the x axis. * @param y2 - Second end of the line segment on the y axis. * @param x3 - Position of the point on the x axis. * @param y3 - Position of the point on the y axis. * @param via - The control point for the edge. * @returns The distance between the line segment and the point. */ _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via) { let minDistance = 1e9; let distance; let i, t, x, y; let lastX = x1; let lastY = y1; for (i = 1; i < 10; i++) { t = .1 * i; x = Math.pow(1 - t, 2) * x1 + 2 * t * (1 - t) * via.x + Math.pow(t, 2) * x2; y = Math.pow(1 - t, 2) * y1 + 2 * t * (1 - t) * via.y + Math.pow(t, 2) * y2; if (i > 0) { distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3); minDistance = distance < minDistance ? distance : minDistance; } lastX = x; lastY = y; } return minDistance; } /** * Render a bezier curve between two nodes. * @remarks * The method accepts zero, one or two control points. * Passing zero control points just draws a straight line. * @param ctx - The context that will be used for rendering. * @param values - Style options for edge drawing. * @param viaNode1 - First control point for curve drawing. * @param viaNode2 - Second control point for curve drawing. */ _bezierCurve(ctx, values$8, viaNode1, viaNode2) { ctx.beginPath(); ctx.moveTo(this.fromPoint.x, this.fromPoint.y); if (viaNode1 != null && viaNode1.x != null) if (viaNode2 != null && viaNode2.x != null) ctx.bezierCurveTo(viaNode1.x, viaNode1.y, viaNode2.x, viaNode2.y, this.toPoint.x, this.toPoint.y); else ctx.quadraticCurveTo(viaNode1.x, viaNode1.y, this.toPoint.x, this.toPoint.y); else ctx.lineTo(this.toPoint.x, this.toPoint.y); this.drawBackground(ctx, values$8); this.enableShadow(ctx, values$8); ctx.stroke(); this.disableShadow(ctx, values$8); } /** @inheritDoc */ getViaNode() { return this._getViaCoordinates(); } }; var BezierEdgeDynamic = class extends BezierEdgeBase { /** * Create a new instance. * @param options - The options object of given edge. * @param body - The body of the network. * @param labelModule - Label module. */ constructor(options, body, labelModule) { super(options, body, labelModule); _defineProperty(this, "via", this.via); this._boundFunction = () => { this.positionBezierNode(); }; this._body.emitter.on("_repositionBezierNodes", this._boundFunction); } /** @inheritDoc */ setOptions(options) { super.setOptions(options); let physicsChange = false; if (this.options.physics !== options.physics) physicsChange = true; this.options = options; this.id = this.options.id; this.from = this._body.nodes[this.options.from]; this.to = this._body.nodes[this.options.to]; this.setupSupportNode(); this.connect(); if (physicsChange === true) { this.via.setOptions({ physics: this.options.physics }); this.positionBezierNode(); } } /** @inheritDoc */ connect() { this.from = this._body.nodes[this.options.from]; this.to = this._body.nodes[this.options.to]; if (this.from === void 0 || this.to === void 0 || this.options.physics === false) this.via.setOptions({ physics: false }); else if (this.from.id === this.to.id) this.via.setOptions({ physics: false }); else this.via.setOptions({ physics: true }); } /** @inheritDoc */ cleanup() { this._body.emitter.off("_repositionBezierNodes", this._boundFunction); if (this.via !== void 0) { delete this._body.nodes[this.via.id]; this.via = void 0; return true; } return false; } /** * Create and add a support node if not already present. * @remarks * Bezier curves require an anchor point to calculate the smooth flow. * These points are nodes. * These nodes are invisible but are used for the force calculation. * * The changed data is not called, if needed, it is returned by the main edge constructor. */ setupSupportNode() { if (this.via === void 0) { const nodeId = "edgeId:" + this.id; const node = this._body.functions.createNode({ id: nodeId, shape: "circle", physics: true, hidden: true }); this._body.nodes[nodeId] = node; this.via = node; this.via.parentEdgeId = this.id; this.positionBezierNode(); } } /** * Position bezier node. */ positionBezierNode() { if (this.via !== void 0 && this.from !== void 0 && this.to !== void 0) { this.via.x = .5 * (this.from.x + this.to.x); this.via.y = .5 * (this.from.y + this.to.y); } else if (this.via !== void 0) { this.via.x = 0; this.via.y = 0; } } /** @inheritDoc */ _line(ctx, values$8, viaNode) { this._bezierCurve(ctx, values$8, viaNode); } /** @inheritDoc */ _getViaCoordinates() { return this.via; } /** @inheritDoc */ getViaNode() { return this.via; } /** @inheritDoc */ getPoint(position) { let viaNode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.via; if (this.from === this.to) { const [cx, cy, cr] = this._getCircleData(); const a = 2 * Math.PI * (1 - position); return { x: cx + cr * Math.sin(a), y: cy + cr - cr * (1 - Math.cos(a)) }; } else return { x: Math.pow(1 - position, 2) * this.fromPoint.x + 2 * position * (1 - position) * viaNode.x + Math.pow(position, 2) * this.toPoint.x, y: Math.pow(1 - position, 2) * this.fromPoint.y + 2 * position * (1 - position) * viaNode.y + Math.pow(position, 2) * this.toPoint.y }; } /** @inheritDoc */ _findBorderPosition(nearNode, ctx) { return this._findBorderPositionBezier(nearNode, ctx, this.via); } /** @inheritDoc */ _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, this.via); } }; var BezierEdgeStatic = class extends BezierEdgeBase { /** * Create a new instance. * @param options - The options object of given edge. * @param body - The body of the network. * @param labelModule - Label module. */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** @inheritDoc */ _line(ctx, values$8, viaNode) { this._bezierCurve(ctx, values$8, viaNode); } /** @inheritDoc */ getViaNode() { return this._getViaCoordinates(); } /** * Compute the coordinates of the via node. * @remarks * We do not use the to and fromPoints here to make the via nodes the same as edges without arrows. * @returns Cartesian coordinates of the via node. */ _getViaCoordinates() { const factor = this.options.smooth.roundness; const type = this.options.smooth.type; let dx = Math.abs(this.from.x - this.to.x); let dy = Math.abs(this.from.y - this.to.y); if (type === "discrete" || type === "diagonalCross") { let stepX; let stepY; if (dx <= dy) stepX = stepY = factor * dy; else stepX = stepY = factor * dx; if (this.from.x > this.to.x) stepX = -stepX; if (this.from.y >= this.to.y) stepY = -stepY; let xVia = this.from.x + stepX; let yVia = this.from.y + stepY; if (type === "discrete") if (dx <= dy) xVia = dx < factor * dy ? this.from.x : xVia; else yVia = dy < factor * dx ? this.from.y : yVia; return { x: xVia, y: yVia }; } else if (type === "straightCross") { let stepX = (1 - factor) * dx; let stepY = (1 - factor) * dy; if (dx <= dy) { stepX = 0; if (this.from.y < this.to.y) stepY = -stepY; } else { if (this.from.x < this.to.x) stepX = -stepX; stepY = 0; } return { x: this.to.x + stepX, y: this.to.y + stepY }; } else if (type === "horizontal") { let stepX = (1 - factor) * dx; if (this.from.x < this.to.x) stepX = -stepX; return { x: this.to.x + stepX, y: this.from.y }; } else if (type === "vertical") { let stepY = (1 - factor) * dy; if (this.from.y < this.to.y) stepY = -stepY; return { x: this.from.x, y: this.to.y + stepY }; } else if (type === "curvedCW") { dx = this.to.x - this.from.x; dy = this.from.y - this.to.y; const radius = Math.sqrt(dx * dx + dy * dy); const pi = Math.PI; const originalAngle = Math.atan2(dy, dx); const myAngle = (originalAngle + (factor * .5 + .5) * pi) % (2 * pi); return { x: this.from.x + (factor * .5 + .5) * radius * Math.sin(myAngle), y: this.from.y + (factor * .5 + .5) * radius * Math.cos(myAngle) }; } else if (type === "curvedCCW") { dx = this.to.x - this.from.x; dy = this.from.y - this.to.y; const radius = Math.sqrt(dx * dx + dy * dy); const pi = Math.PI; const originalAngle = Math.atan2(dy, dx); const myAngle = (originalAngle + (-factor * .5 + .5) * pi) % (2 * pi); return { x: this.from.x + (factor * .5 + .5) * radius * Math.sin(myAngle), y: this.from.y + (factor * .5 + .5) * radius * Math.cos(myAngle) }; } else { let stepX; let stepY; if (dx <= dy) stepX = stepY = factor * dy; else stepX = stepY = factor * dx; if (this.from.x > this.to.x) stepX = -stepX; if (this.from.y >= this.to.y) stepY = -stepY; let xVia = this.from.x + stepX; let yVia = this.from.y + stepY; if (dx <= dy) if (this.from.x <= this.to.x) xVia = this.to.x < xVia ? this.to.x : xVia; else xVia = this.to.x > xVia ? this.to.x : xVia; else if (this.from.y >= this.to.y) yVia = this.to.y > yVia ? this.to.y : yVia; else yVia = this.to.y < yVia ? this.to.y : yVia; return { x: xVia, y: yVia }; } } /** @inheritDoc */ _findBorderPosition(nearNode, ctx) { let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; return this._findBorderPositionBezier(nearNode, ctx, options.via); } /** @inheritDoc */ _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { let viaNode = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : this._getViaCoordinates(); return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, viaNode); } /** @inheritDoc */ getPoint(position) { let viaNode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this._getViaCoordinates(); const t = position; const x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x; const y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y; return { x, y }; } }; var CubicBezierEdgeBase = class extends BezierEdgeBase { /** * Create a new instance. * @param options - The options object of given edge. * @param body - The body of the network. * @param labelModule - Label module. */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** * Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2). * @remarks * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment * https://en.wikipedia.org/wiki/B%C3%A9zier_curve * @param x1 - First end of the line segment on the x axis. * @param y1 - First end of the line segment on the y axis. * @param x2 - Second end of the line segment on the x axis. * @param y2 - Second end of the line segment on the y axis. * @param x3 - Position of the point on the x axis. * @param y3 - Position of the point on the y axis. * @param via1 - The first point this edge passes through. * @param via2 - The second point this edge passes through. * @returns The distance between the line segment and the point. */ _getDistanceToBezierEdge2(x1, y1, x2, y2, x3, y3, via1, via2) { let minDistance = 1e9; let lastX = x1; let lastY = y1; const vec = [ 0, 0, 0, 0 ]; for (let i = 1; i < 10; i++) { const t = .1 * i; vec[0] = Math.pow(1 - t, 3); vec[1] = 3 * t * Math.pow(1 - t, 2); vec[2] = 3 * Math.pow(t, 2) * (1 - t); vec[3] = Math.pow(t, 3); const x = vec[0] * x1 + vec[1] * via1.x + vec[2] * via2.x + vec[3] * x2; const y = vec[0] * y1 + vec[1] * via1.y + vec[2] * via2.y + vec[3] * y2; if (i > 0) { const distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3); minDistance = distance < minDistance ? distance : minDistance; } lastX = x; lastY = y; } return minDistance; } }; var CubicBezierEdge = class extends CubicBezierEdgeBase { /** * Create a new instance. * @param options - The options object of given edge. * @param body - The body of the network. * @param labelModule - Label module. */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** @inheritDoc */ _line(ctx, values$8, viaNodes) { const via1 = viaNodes[0]; const via2 = viaNodes[1]; this._bezierCurve(ctx, values$8, via1, via2); } /** * Compute the additional points the edge passes through. * @returns Cartesian coordinates of the points the edge passes through. */ _getViaCoordinates() { const dx = this.from.x - this.to.x; const dy = this.from.y - this.to.y; let x1; let y1; let x2; let y2; const roundness = this.options.smooth.roundness; if ((Math.abs(dx) > Math.abs(dy) || this.options.smooth.forceDirection === true || this.options.smooth.forceDirection === "horizontal") && this.options.smooth.forceDirection !== "vertical") { y1 = this.from.y; y2 = this.to.y; x1 = this.from.x - roundness * dx; x2 = this.to.x + roundness * dx; } else { y1 = this.from.y - roundness * dy; y2 = this.to.y + roundness * dy; x1 = this.from.x; x2 = this.to.x; } return [{ x: x1, y: y1 }, { x: x2, y: y2 }]; } /** @inheritDoc */ getViaNode() { return this._getViaCoordinates(); } /** @inheritDoc */ _findBorderPosition(nearNode, ctx) { return this._findBorderPositionBezier(nearNode, ctx); } /** @inheritDoc */ _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { let [via1, via2] = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : this._getViaCoordinates(); return this._getDistanceToBezierEdge2(x1, y1, x2, y2, x3, y3, via1, via2); } /** @inheritDoc */ getPoint(position) { let [via1, via2] = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this._getViaCoordinates(); const t = position; const vec = [ Math.pow(1 - t, 3), 3 * t * Math.pow(1 - t, 2), 3 * Math.pow(t, 2) * (1 - t), Math.pow(t, 3) ]; const x = vec[0] * this.fromPoint.x + vec[1] * via1.x + vec[2] * via2.x + vec[3] * this.toPoint.x; const y = vec[0] * this.fromPoint.y + vec[1] * via1.y + vec[2] * via2.y + vec[3] * this.toPoint.y; return { x, y }; } }; var StraightEdge = class extends EdgeBase { /** * Create a new instance. * @param options - The options object of given edge. * @param body - The body of the network. * @param labelModule - Label module. */ constructor(options, body, labelModule) { super(options, body, labelModule); } /** @inheritDoc */ _line(ctx, values$8) { ctx.beginPath(); ctx.moveTo(this.fromPoint.x, this.fromPoint.y); ctx.lineTo(this.toPoint.x, this.toPoint.y); this.enableShadow(ctx, values$8); ctx.stroke(); this.disableShadow(ctx, values$8); } /** @inheritDoc */ getViaNode() { return void 0; } /** @inheritDoc */ getPoint(position) { return { x: (1 - position) * this.fromPoint.x + position * this.toPoint.x, y: (1 - position) * this.fromPoint.y + position * this.toPoint.y }; } /** @inheritDoc */ _findBorderPosition(nearNode, ctx) { let node1 = this.to; let node2 = this.from; if (nearNode.id === this.from.id) { node1 = this.from; node2 = this.to; } const angle = Math.atan2(node1.y - node2.y, node1.x - node2.x); const dx = node1.x - node2.x; const dy = node1.y - node2.y; const edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); const toBorderDist = nearNode.distanceToBorder(ctx, angle); const toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; return { x: (1 - toBorderPoint) * node2.x + toBorderPoint * node1.x, y: (1 - toBorderPoint) * node2.y + toBorderPoint * node1.y, t: 0 }; } /** @inheritDoc */ _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { return this._getDistanceToLine(x1, y1, x2, y2, x3, y3); } }; var Edge = class Edge { /** * @param {object} options values specific to this edge, must contain at least 'from' and 'to' * @param {object} body shared state from Network instance * @param {Network.Images} imagelist A list with images. Only needed when the edge has image arrows. * @param {object} globalOptions options from the EdgesHandler instance * @param {object} defaultOptions default options from the EdgeHandler instance. Value and reference are constant */ constructor(options, body, imagelist, globalOptions, defaultOptions) { if (body === void 0) throw new Error("No body provided"); this.options = bridgeObject(globalOptions); this.globalOptions = globalOptions; this.defaultOptions = defaultOptions; this.body = body; this.imagelist = imagelist; this.id = void 0; this.fromId = void 0; this.toId = void 0; this.selected = false; this.hover = false; this.labelDirty = true; this.baseWidth = this.options.width; this.baseFontSize = this.options.font.size; this.from = void 0; this.to = void 0; this.edgeType = void 0; this.connected = false; this.labelModule = new Label( this.body, this.options, true /* It's an edge label */ ); this.setOptions(options); } /** * Set or overwrite options for the edge * @param {object} options an object with options * @returns {undefined|boolean} undefined if no options, true if layout affecting data changed, false otherwise. */ setOptions(options) { if (!options) return; let affectsLayout = typeof options.physics !== "undefined" && this.options.physics !== options.physics || typeof options.hidden !== "undefined" && (this.options.hidden || false) !== (options.hidden || false) || typeof options.from !== "undefined" && this.options.from !== options.from || typeof options.to !== "undefined" && this.options.to !== options.to; Edge.parseOptions(this.options, options, true, this.globalOptions); if (options.id !== void 0) this.id = options.id; if (options.from !== void 0) this.fromId = options.from; if (options.to !== void 0) this.toId = options.to; if (options.title !== void 0) this.title = options.title; if (options.value !== void 0) options.value = _parseFloat(options.value); const pile = [ options, this.options, this.defaultOptions ]; this.chooser = choosify("edge", pile); this.updateLabelModule(options); affectsLayout = this.updateEdgeType() || affectsLayout; this._setInteractionWidths(); this.connect(); return affectsLayout; } /** * * @param {object} parentOptions * @param {object} newOptions * @param {boolean} [allowDeletion] * @param {object} [globalOptions] * @param {boolean} [copyFromGlobals] */ static parseOptions(parentOptions, newOptions) { let allowDeletion = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; let globalOptions = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; let copyFromGlobals = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false; const fields = [ "endPointOffset", "arrowStrikethrough", "id", "from", "hidden", "hoverWidth", "labelHighlightBold", "length", "line", "opacity", "physics", "scaling", "selectionWidth", "selfReferenceSize", "selfReference", "to", "title", "value", "width", "font", "chosen", "widthConstraint" ]; selectiveDeepExtend(fields, parentOptions, newOptions, allowDeletion); if (newOptions.endPointOffset !== void 0 && newOptions.endPointOffset.from !== void 0) if (_Number$isFinite(newOptions.endPointOffset.from)) parentOptions.endPointOffset.from = newOptions.endPointOffset.from; else { parentOptions.endPointOffset.from = globalOptions.endPointOffset.from !== void 0 ? globalOptions.endPointOffset.from : 0; console.error("endPointOffset.from is not a valid number"); } if (newOptions.endPointOffset !== void 0 && newOptions.endPointOffset.to !== void 0) if (_Number$isFinite(newOptions.endPointOffset.to)) parentOptions.endPointOffset.to = newOptions.endPointOffset.to; else { parentOptions.endPointOffset.to = globalOptions.endPointOffset.to !== void 0 ? globalOptions.endPointOffset.to : 0; console.error("endPointOffset.to is not a valid number"); } if (isValidLabel(newOptions.label)) parentOptions.label = newOptions.label; else if (!isValidLabel(parentOptions.label)) parentOptions.label = void 0; mergeOptions(parentOptions, newOptions, "smooth", globalOptions); mergeOptions(parentOptions, newOptions, "shadow", globalOptions); mergeOptions(parentOptions, newOptions, "background", globalOptions); if (newOptions.dashes !== void 0 && newOptions.dashes !== null) parentOptions.dashes = newOptions.dashes; else if (allowDeletion === true && newOptions.dashes === null) parentOptions.dashes = _Object$create(globalOptions.dashes); if (newOptions.scaling !== void 0 && newOptions.scaling !== null) { if (newOptions.scaling.min !== void 0) parentOptions.scaling.min = newOptions.scaling.min; if (newOptions.scaling.max !== void 0) parentOptions.scaling.max = newOptions.scaling.max; mergeOptions(parentOptions.scaling, newOptions.scaling, "label", globalOptions.scaling); } else if (allowDeletion === true && newOptions.scaling === null) parentOptions.scaling = _Object$create(globalOptions.scaling); if (newOptions.arrows !== void 0 && newOptions.arrows !== null) if (typeof newOptions.arrows === "string") { const arrows = newOptions.arrows.toLowerCase(); parentOptions.arrows.to.enabled = _indexOfInstanceProperty(arrows).call(arrows, "to") != -1; parentOptions.arrows.middle.enabled = _indexOfInstanceProperty(arrows).call(arrows, "middle") != -1; parentOptions.arrows.from.enabled = _indexOfInstanceProperty(arrows).call(arrows, "from") != -1; } else if (typeof newOptions.arrows === "object") { mergeOptions(parentOptions.arrows, newOptions.arrows, "to", globalOptions.arrows); mergeOptions(parentOptions.arrows, newOptions.arrows, "middle", globalOptions.arrows); mergeOptions(parentOptions.arrows, newOptions.arrows, "from", globalOptions.arrows); } else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:" + _JSON$stringify(newOptions.arrows)); else if (allowDeletion === true && newOptions.arrows === null) parentOptions.arrows = _Object$create(globalOptions.arrows); if (newOptions.color !== void 0 && newOptions.color !== null) { const fromColor = isString(newOptions.color) ? { color: newOptions.color, highlight: newOptions.color, hover: newOptions.color, inherit: false, opacity: 1 } : newOptions.color; const toColor = parentOptions.color; if (copyFromGlobals) deepExtend(toColor, globalOptions.color, false, allowDeletion); else for (const i in toColor) if (Object.prototype.hasOwnProperty.call(toColor, i)) delete toColor[i]; if (isString(toColor)) { toColor.color = toColor; toColor.highlight = toColor; toColor.hover = toColor; toColor.inherit = false; if (fromColor.opacity === void 0) toColor.opacity = 1; } else { let colorsDefined = false; if (fromColor.color !== void 0) { toColor.color = fromColor.color; colorsDefined = true; } if (fromColor.highlight !== void 0) { toColor.highlight = fromColor.highlight; colorsDefined = true; } if (fromColor.hover !== void 0) { toColor.hover = fromColor.hover; colorsDefined = true; } if (fromColor.inherit !== void 0) toColor.inherit = fromColor.inherit; if (fromColor.opacity !== void 0) toColor.opacity = Math.min(1, Math.max(0, fromColor.opacity)); if (colorsDefined === true) toColor.inherit = false; else if (toColor.inherit === void 0) toColor.inherit = "from"; } } else if (allowDeletion === true && newOptions.color === null) parentOptions.color = bridgeObject(globalOptions.color); if (allowDeletion === true && newOptions.font === null) parentOptions.font = bridgeObject(globalOptions.font); if (Object.prototype.hasOwnProperty.call(newOptions, "selfReferenceSize")) { console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"); parentOptions.selfReference.size = newOptions.selfReferenceSize; } } /** * * @returns {ArrowOptions} */ getFormattingValues() { const toArrow = this.options.arrows.to === true || this.options.arrows.to.enabled === true; const fromArrow = this.options.arrows.from === true || this.options.arrows.from.enabled === true; const middleArrow = this.options.arrows.middle === true || this.options.arrows.middle.enabled === true; const inheritsColor = this.options.color.inherit; const values$8 = { toArrow, toArrowScale: this.options.arrows.to.scaleFactor, toArrowType: this.options.arrows.to.type, toArrowSrc: this.options.arrows.to.src, toArrowImageWidth: this.options.arrows.to.imageWidth, toArrowImageHeight: this.options.arrows.to.imageHeight, middleArrow, middleArrowScale: this.options.arrows.middle.scaleFactor, middleArrowType: this.options.arrows.middle.type, middleArrowSrc: this.options.arrows.middle.src, middleArrowImageWidth: this.options.arrows.middle.imageWidth, middleArrowImageHeight: this.options.arrows.middle.imageHeight, fromArrow, fromArrowScale: this.options.arrows.from.scaleFactor, fromArrowType: this.options.arrows.from.type, fromArrowSrc: this.options.arrows.from.src, fromArrowImageWidth: this.options.arrows.from.imageWidth, fromArrowImageHeight: this.options.arrows.from.imageHeight, arrowStrikethrough: this.options.arrowStrikethrough, color: inheritsColor ? void 0 : this.options.color.color, inheritsColor, opacity: this.options.color.opacity, hidden: this.options.hidden, length: this.options.length, shadow: this.options.shadow.enabled, shadowColor: this.options.shadow.color, shadowSize: this.options.shadow.size, shadowX: this.options.shadow.x, shadowY: this.options.shadow.y, dashes: this.options.dashes, width: this.options.width, background: this.options.background.enabled, backgroundColor: this.options.background.color, backgroundSize: this.options.background.size, backgroundDashes: this.options.background.dashes }; if (this.selected || this.hover) { if (this.chooser === true) { if (this.selected) { const selectedWidth = this.options.selectionWidth; if (typeof selectedWidth === "function") values$8.width = selectedWidth(values$8.width); else if (typeof selectedWidth === "number") values$8.width += selectedWidth; values$8.width = Math.max(values$8.width, .3 / this.body.view.scale); values$8.color = this.options.color.highlight; values$8.shadow = this.options.shadow.enabled; } else if (this.hover) { const hoverWidth = this.options.hoverWidth; if (typeof hoverWidth === "function") values$8.width = hoverWidth(values$8.width); else if (typeof hoverWidth === "number") values$8.width += hoverWidth; values$8.width = Math.max(values$8.width, .3 / this.body.view.scale); values$8.color = this.options.color.hover; values$8.shadow = this.options.shadow.enabled; } } else if (typeof this.chooser === "function") { this.chooser(values$8, this.options.id, this.selected, this.hover); if (values$8.color !== void 0) values$8.inheritsColor = false; if (values$8.shadow === false) { if (values$8.shadowColor !== this.options.shadow.color || values$8.shadowSize !== this.options.shadow.size || values$8.shadowX !== this.options.shadow.x || values$8.shadowY !== this.options.shadow.y) values$8.shadow = true; } } } else { values$8.shadow = this.options.shadow.enabled; values$8.width = Math.max(values$8.width, .3 / this.body.view.scale); } return values$8; } /** * update the options in the label module * @param {object} options */ updateLabelModule(options) { const pile = [ options, this.options, this.globalOptions, this.defaultOptions ]; this.labelModule.update(this.options, pile); if (this.labelModule.baseSize !== void 0) this.baseFontSize = this.labelModule.baseSize; } /** * update the edge type, set the options * @returns {boolean} */ updateEdgeType() { const smooth = this.options.smooth; let dataChanged = false; let changeInType = true; if (this.edgeType !== void 0) { if (this.edgeType instanceof BezierEdgeDynamic && smooth.enabled === true && smooth.type === "dynamic" || this.edgeType instanceof CubicBezierEdge && smooth.enabled === true && smooth.type === "cubicBezier" || this.edgeType instanceof BezierEdgeStatic && smooth.enabled === true && smooth.type !== "dynamic" && smooth.type !== "cubicBezier" || this.edgeType instanceof StraightEdge && smooth.type.enabled === false) changeInType = false; if (changeInType === true) dataChanged = this.cleanup(); } if (changeInType === true) if (smooth.enabled === true) if (smooth.type === "dynamic") { dataChanged = true; this.edgeType = new BezierEdgeDynamic(this.options, this.body, this.labelModule); } else if (smooth.type === "cubicBezier") this.edgeType = new CubicBezierEdge(this.options, this.body, this.labelModule); else this.edgeType = new BezierEdgeStatic(this.options, this.body, this.labelModule); else this.edgeType = new StraightEdge(this.options, this.body, this.labelModule); else this.edgeType.setOptions(this.options); return dataChanged; } /** * Connect an edge to its nodes */ connect() { this.disconnect(); this.from = this.body.nodes[this.fromId] || void 0; this.to = this.body.nodes[this.toId] || void 0; this.connected = this.from !== void 0 && this.to !== void 0; if (this.connected === true) { this.from.attachEdge(this); this.to.attachEdge(this); } else { if (this.from) this.from.detachEdge(this); if (this.to) this.to.detachEdge(this); } this.edgeType.connect(); } /** * Disconnect an edge from its nodes */ disconnect() { if (this.from) { this.from.detachEdge(this); this.from = void 0; } if (this.to) { this.to.detachEdge(this); this.to = void 0; } this.connected = false; } /** * get the title of this edge. * @returns {string} title The title of the edge, or undefined when no title * has been set. */ getTitle() { return this.title; } /** * check if this node is selecte * @returns {boolean} selected True if node is selected, else false */ isSelected() { return this.selected; } /** * Retrieve the value of the edge. Can be undefined * @returns {number} value */ getValue() { return this.options.value; } /** * Adjust the value range of the edge. The edge will adjust it's width * based on its value. * @param {number} min * @param {number} max * @param {number} total */ setValueRange(min, max, total) { if (this.options.value !== void 0) { const scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value); const widthDiff = this.options.scaling.max - this.options.scaling.min; if (this.options.scaling.label.enabled === true) { const fontDiff = this.options.scaling.label.max - this.options.scaling.label.min; this.options.font.size = this.options.scaling.label.min + scale * fontDiff; } this.options.width = this.options.scaling.min + scale * widthDiff; } else { this.options.width = this.baseWidth; this.options.font.size = this.baseFontSize; } this._setInteractionWidths(); this.updateLabelModule(); } /** * * @private */ _setInteractionWidths() { if (typeof this.options.hoverWidth === "function") this.edgeType.hoverWidth = this.options.hoverWidth(this.options.width); else this.edgeType.hoverWidth = this.options.hoverWidth + this.options.width; if (typeof this.options.selectionWidth === "function") this.edgeType.selectionWidth = this.options.selectionWidth(this.options.width); else this.edgeType.selectionWidth = this.options.selectionWidth + this.options.width; } /** * Redraw a edge * Draw this edge in the given canvas * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); * @param {CanvasRenderingContext2D} ctx */ draw(ctx) { const values$8 = this.getFormattingValues(); if (values$8.hidden) return; const viaNode = this.edgeType.getViaNode(); this.edgeType.drawLine(ctx, values$8, this.selected, this.hover, viaNode); this.drawLabel(ctx, viaNode); } /** * Redraw arrows * Draw this arrows in the given canvas * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); * @param {CanvasRenderingContext2D} ctx */ drawArrows(ctx) { const values$8 = this.getFormattingValues(); if (values$8.hidden) return; const viaNode = this.edgeType.getViaNode(); const arrowData = {}; this.edgeType.fromPoint = this.edgeType.from; this.edgeType.toPoint = this.edgeType.to; if (values$8.fromArrow) { arrowData.from = this.edgeType.getArrowData(ctx, "from", viaNode, this.selected, this.hover, values$8); if (values$8.arrowStrikethrough === false) this.edgeType.fromPoint = arrowData.from.core; if (values$8.fromArrowSrc) arrowData.from.image = this.imagelist.load(values$8.fromArrowSrc); if (values$8.fromArrowImageWidth) arrowData.from.imageWidth = values$8.fromArrowImageWidth; if (values$8.fromArrowImageHeight) arrowData.from.imageHeight = values$8.fromArrowImageHeight; } if (values$8.toArrow) { arrowData.to = this.edgeType.getArrowData(ctx, "to", viaNode, this.selected, this.hover, values$8); if (values$8.arrowStrikethrough === false) this.edgeType.toPoint = arrowData.to.core; if (values$8.toArrowSrc) arrowData.to.image = this.imagelist.load(values$8.toArrowSrc); if (values$8.toArrowImageWidth) arrowData.to.imageWidth = values$8.toArrowImageWidth; if (values$8.toArrowImageHeight) arrowData.to.imageHeight = values$8.toArrowImageHeight; } if (values$8.middleArrow) { arrowData.middle = this.edgeType.getArrowData(ctx, "middle", viaNode, this.selected, this.hover, values$8); if (values$8.middleArrowSrc) arrowData.middle.image = this.imagelist.load(values$8.middleArrowSrc); if (values$8.middleArrowImageWidth) arrowData.middle.imageWidth = values$8.middleArrowImageWidth; if (values$8.middleArrowImageHeight) arrowData.middle.imageHeight = values$8.middleArrowImageHeight; } if (values$8.fromArrow) this.edgeType.drawArrowHead(ctx, values$8, this.selected, this.hover, arrowData.from); if (values$8.middleArrow) this.edgeType.drawArrowHead(ctx, values$8, this.selected, this.hover, arrowData.middle); if (values$8.toArrow) this.edgeType.drawArrowHead(ctx, values$8, this.selected, this.hover, arrowData.to); } /** * * @param {CanvasRenderingContext2D} ctx * @param {Node} viaNode */ drawLabel(ctx, viaNode) { if (this.options.label !== void 0) { const node1 = this.from; const node2 = this.to; if (this.labelModule.differentState(this.selected, this.hover)) this.labelModule.getTextSize(ctx, this.selected, this.hover); let point; if (node1.id != node2.id) { this.labelModule.pointToSelf = false; point = this.edgeType.getPoint(.5, viaNode); ctx.save(); const rotationPoint = this._getRotation(ctx); if (rotationPoint.angle != 0) { ctx.translate(rotationPoint.x, rotationPoint.y); ctx.rotate(rotationPoint.angle); } this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover); ctx.restore(); } else { this.labelModule.pointToSelf = true; const coordinates = getSelfRefCoordinates(ctx, this.options.selfReference.angle, this.options.selfReference.size, node1); point = this._pointOnCircle(coordinates.x, coordinates.y, this.options.selfReference.size, this.options.selfReference.angle); this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover); } } } /** * Determine all visual elements of this edge instance, in which the given * point falls within the bounding shape. * @param {point} point * @returns {Array.} list with the items which are on the point */ getItemsOnPoint(point) { const ret = []; if (this.labelModule.visible()) { const rotationPoint = this._getRotation(); if (pointInRect(this.labelModule.getSize(), point, rotationPoint)) ret.push({ edgeId: this.id, labelId: 0 }); } const obj = { left: point.x, top: point.y }; if (this.isOverlappingWith(obj)) ret.push({ edgeId: this.id }); return ret; } /** * Check if this object is overlapping with the provided object * @param {object} obj an object with parameters left, top * @returns {boolean} True if location is located on the edge */ isOverlappingWith(obj) { if (this.connected) { const distMax = 10; const xFrom = this.from.x; const yFrom = this.from.y; const xTo = this.to.x; const yTo = this.to.y; const xObj = obj.left; const yObj = obj.top; const dist = this.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj); return dist < distMax; } else return false; } /** * Determine the rotation point, if any. * @param {CanvasRenderingContext2D} [ctx] if passed, do a recalculation of the label size * @returns {rotationPoint} the point to rotate around and the angle in radians to rotate * @private */ _getRotation(ctx) { const viaNode = this.edgeType.getViaNode(); const point = this.edgeType.getPoint(.5, viaNode); if (ctx !== void 0) this.labelModule.calculateLabelSize(ctx, this.selected, this.hover, point.x, point.y); const ret = { x: point.x, y: this.labelModule.size.yLine, angle: 0 }; if (!this.labelModule.visible()) return ret; if (this.options.font.align === "horizontal") return ret; const dy = this.from.y - this.to.y; const dx = this.from.x - this.to.x; let angle = Math.atan2(dy, dx); if (angle < -1 && dx < 0 || angle > 0 && dx < 0) angle += Math.PI; ret.angle = angle; return ret; } /** * Get a point on a circle * @param {number} x * @param {number} y * @param {number} radius * @param {number} angle * @returns {object} point * @private */ _pointOnCircle(x, y, radius, angle) { return { x: x + radius * Math.cos(angle), y: y - radius * Math.sin(angle) }; } /** * Sets selected state to true */ select() { this.selected = true; } /** * Sets selected state to false */ unselect() { this.selected = false; } /** * cleans all required things on delete * @returns {*} */ cleanup() { return this.edgeType.cleanup(); } /** * Remove edge from the list and perform necessary cleanup. */ remove() { this.cleanup(); this.disconnect(); delete this.body.edges[this.id]; } /** * Check if both connecting nodes exist * @returns {boolean} */ endPointsValid() { return this.body.nodes[this.fromId] !== void 0 && this.body.nodes[this.toId] !== void 0; } }; var EdgesHandler = class { /** * @param {object} body * @param {Array.} images * @param {Array.} groups */ constructor(body, images, groups) { var _context; this.body = body; this.images = images; this.groups = groups; this.body.functions.createEdge = _bindInstanceProperty(_context = this.create).call(_context, this); this.edgesListeners = { add: (event, params) => { this.add(params.items); }, update: (event, params) => { this.update(params.items); }, remove: (event, params) => { this.remove(params.items); } }; this.options = {}; this.defaultOptions = { arrows: { to: { enabled: false, scaleFactor: 1, type: "arrow" }, middle: { enabled: false, scaleFactor: 1, type: "arrow" }, from: { enabled: false, scaleFactor: 1, type: "arrow" } }, endPointOffset: { from: 0, to: 0 }, arrowStrikethrough: true, color: { color: "#848484", highlight: "#848484", hover: "#848484", inherit: "from", opacity: 1 }, dashes: false, font: { color: "#343434", size: 14, face: "arial", background: "none", strokeWidth: 2, strokeColor: "#ffffff", align: "horizontal", multi: false, vadjust: 0, bold: { mod: "bold" }, boldital: { mod: "bold italic" }, ital: { mod: "italic" }, mono: { mod: "", size: 15, face: "courier new", vadjust: 2 } }, hidden: false, hoverWidth: 1.5, label: void 0, labelHighlightBold: true, length: void 0, physics: true, scaling: { min: 1, max: 15, label: { enabled: true, min: 14, max: 30, maxVisible: 30, drawThreshold: 5 }, customScalingFunction: function(min, max, total, value) { if (max === min) return .5; else { const scale = 1 / (max - min); return Math.max(0, (value - min) * scale); } } }, selectionWidth: 1.5, selfReference: { size: 20, angle: Math.PI / 4, renderBehindTheNode: true }, shadow: { enabled: false, color: "rgba(0,0,0,0.5)", size: 10, x: 5, y: 5 }, background: { enabled: false, color: "rgba(111,111,111,1)", size: 10, dashes: false }, smooth: { enabled: true, type: "dynamic", forceDirection: "none", roundness: .5 }, title: void 0, width: 1, value: void 0 }; deepExtend(this.options, this.defaultOptions); this.bindEventListeners(); } /** * Binds event listeners */ bindEventListeners() { var _this = this, _context2, _context3; this.body.emitter.on("_forceDisableDynamicCurves", function(type) { let emit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; if (type === "dynamic") type = "continuous"; let dataChanged = false; for (const edgeId in _this.body.edges) if (Object.prototype.hasOwnProperty.call(_this.body.edges, edgeId)) { const edge = _this.body.edges[edgeId]; const edgeData = _this.body.data.edges.get(edgeId); if (edgeData != null) { const smoothOptions = edgeData.smooth; if (smoothOptions !== void 0) { if (smoothOptions.enabled === true && smoothOptions.type === "dynamic") { if (type === void 0) edge.setOptions({ smooth: false }); else edge.setOptions({ smooth: { type } }); dataChanged = true; } } } } if (emit === true && dataChanged === true) _this.body.emitter.emit("_dataChanged"); }); this.body.emitter.on("_dataUpdated", () => { this.reconnectEdges(); }); this.body.emitter.on("refreshEdges", _bindInstanceProperty(_context2 = this.refresh).call(_context2, this)); this.body.emitter.on("refresh", _bindInstanceProperty(_context3 = this.refresh).call(_context3, this)); this.body.emitter.on("destroy", () => { forEach$4(this.edgesListeners, (callback, event) => { if (this.body.data.edges) this.body.data.edges.off(event, callback); }); delete this.body.functions.createEdge; delete this.edgesListeners.add; delete this.edgesListeners.update; delete this.edgesListeners.remove; delete this.edgesListeners; }); } /** * * @param {object} options */ setOptions(options) { if (options !== void 0) { Edge.parseOptions(this.options, options, true, this.defaultOptions, true); let dataChanged = false; if (options.smooth !== void 0) { for (const edgeId in this.body.edges) if (Object.prototype.hasOwnProperty.call(this.body.edges, edgeId)) dataChanged = this.body.edges[edgeId].updateEdgeType() || dataChanged; } if (options.font !== void 0) { for (const edgeId in this.body.edges) if (Object.prototype.hasOwnProperty.call(this.body.edges, edgeId)) this.body.edges[edgeId].updateLabelModule(); } if (options.hidden !== void 0 || options.physics !== void 0 || dataChanged === true) this.body.emitter.emit("_dataChanged"); } } /** * Load edges by reading the data table * @param {Array | DataSet | DataView} edges The data containing the edges. * @param {boolean} [doNotEmit] - Suppress data changed event. * @private */ setData(edges) { let doNotEmit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; const oldEdgesData = this.body.data.edges; if (isDataViewLike("id", edges)) this.body.data.edges = edges; else if (_Array$isArray(edges)) { this.body.data.edges = new DataSet(); this.body.data.edges.add(edges); } else if (!edges) this.body.data.edges = new DataSet(); else throw new TypeError("Array or DataSet expected"); if (oldEdgesData) forEach$4(this.edgesListeners, (callback, event) => { oldEdgesData.off(event, callback); }); this.body.edges = {}; if (this.body.data.edges) { forEach$4(this.edgesListeners, (callback, event) => { this.body.data.edges.on(event, callback); }); const ids = this.body.data.edges.getIds(); this.add(ids, true); } this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"); if (doNotEmit === false) this.body.emitter.emit("_dataChanged"); } /** * Add edges * @param {number[] | string[]} ids * @param {boolean} [doNotEmit] * @private */ add(ids) { let doNotEmit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; const edges = this.body.edges; const edgesData = this.body.data.edges; for (let i = 0; i < ids.length; i++) { const id = ids[i]; const oldEdge = edges[id]; if (oldEdge) oldEdge.disconnect(); const data = edgesData.get(id, { showInternalIds: true }); edges[id] = this.create(data); } this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"); if (doNotEmit === false) this.body.emitter.emit("_dataChanged"); } /** * Update existing edges, or create them when not yet existing * @param {number[] | string[]} ids * @private */ update(ids) { const edges = this.body.edges; const edgesData = this.body.data.edges; let dataChanged = false; for (let i = 0; i < ids.length; i++) { const id = ids[i]; const data = edgesData.get(id); const edge = edges[id]; if (edge !== void 0) { edge.disconnect(); dataChanged = edge.setOptions(data) || dataChanged; edge.connect(); } else { this.body.edges[id] = this.create(data); dataChanged = true; } } if (dataChanged === true) { this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"); this.body.emitter.emit("_dataChanged"); } else this.body.emitter.emit("_dataUpdated"); } /** * Remove existing edges. Non existing ids will be ignored * @param {number[] | string[]} ids * @param {boolean} [emit] * @private */ remove(ids) { let emit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; if (ids.length === 0) return; const edges = this.body.edges; forEach$4(ids, (id) => { const edge = edges[id]; if (edge !== void 0) edge.remove(); }); if (emit) this.body.emitter.emit("_dataChanged"); } /** * Refreshes Edge Handler */ refresh() { forEach$4(this.body.edges, (edge, edgeId) => { const data = this.body.data.edges.get(edgeId); if (data !== void 0) edge.setOptions(data); }); } /** * * @param {object} properties * @returns {Edge} */ create(properties) { return new Edge(properties, this.body, this.images, this.options, this.defaultOptions); } /** * Reconnect all edges * @private */ reconnectEdges() { let id; const nodes = this.body.nodes; const edges = this.body.edges; for (id in nodes) if (Object.prototype.hasOwnProperty.call(nodes, id)) nodes[id].edges = []; for (id in edges) if (Object.prototype.hasOwnProperty.call(edges, id)) { const edge = edges[id]; edge.from = null; edge.to = null; edge.connect(); } } /** * * @param {Edge.id} edgeId * @returns {Array} */ getConnectedNodes(edgeId) { const nodeList = []; if (this.body.edges[edgeId] !== void 0) { const edge = this.body.edges[edgeId]; if (edge.fromId !== void 0) nodeList.push(edge.fromId); if (edge.toId !== void 0) nodeList.push(edge.toId); } return nodeList; } /** * There is no direct relation between the nodes and the edges DataSet, * so the right place to do call this is in the handler for event `_dataUpdated`. */ _updateState() { this._addMissingEdges(); this._removeInvalidEdges(); } /** * Scan for missing nodes and remove corresponding edges, if any. * @private */ _removeInvalidEdges() { const edgesToDelete = []; forEach$4(this.body.edges, (edge, id) => { const toNode = this.body.nodes[edge.toId]; const fromNode = this.body.nodes[edge.fromId]; if (toNode !== void 0 && toNode.isCluster === true || fromNode !== void 0 && fromNode.isCluster === true) return; if (toNode === void 0 || fromNode === void 0) edgesToDelete.push(id); }); this.remove(edgesToDelete, false); } /** * add all edges from dataset that are not in the cached state * @private */ _addMissingEdges() { const edgesData = this.body.data.edges; if (edgesData === void 0 || edgesData === null) return; const edges = this.body.edges; const addIds = []; _forEachInstanceProperty(edgesData).call(edgesData, (edgeData, edgeId) => { const edge = edges[edgeId]; if (edge === void 0) addIds.push(edgeId); }); this.add(addIds, true); } }; var es_date_now = {}; var hasRequiredEs_date_now; function requireEs_date_now() { if (hasRequiredEs_date_now) return es_date_now; hasRequiredEs_date_now = 1; var $ = /* @__PURE__ */ require_export(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var $Date = Date; var thisTimeValue = uncurryThis($Date.prototype.getTime); $({ target: "Date", stat: true }, { now: function now$5() { return thisTimeValue(new $Date()); } }); return es_date_now; } var now$2; var hasRequiredNow$2; function requireNow$2() { if (hasRequiredNow$2) return now$2; hasRequiredNow$2 = 1; requireEs_date_now(); var path$2 = /* @__PURE__ */ requirePath(); now$2 = path$2.Date.now; return now$2; } var now$1; var hasRequiredNow$1; function requireNow$1() { if (hasRequiredNow$1) return now$1; hasRequiredNow$1 = 1; var parent = /* @__PURE__ */ requireNow$2(); now$1 = parent; return now$1; } var now; var hasRequiredNow; function requireNow() { if (hasRequiredNow) return now; hasRequiredNow = 1; now = /* @__PURE__ */ requireNow$1(); return now; } var nowExports = requireNow(); var _Date$now = /* @__PURE__ */ getDefaultExportFromCjs(nowExports); var BarnesHutSolver = class { /** * @param {object} body * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody * @param {object} options */ constructor(body, physicsBody, options) { this.body = body; this.physicsBody = physicsBody; this.barnesHutTree; this.setOptions(options); this._rng = Alea("BARNES HUT SOLVER"); } /** * * @param {object} options */ setOptions(options) { this.options = options; this.thetaInversed = 1 / this.options.theta; this.overlapAvoidanceFactor = 1 - Math.max(0, Math.min(1, this.options.avoidOverlap)); } /** * This function calculates the forces the nodes apply on each other based on a gravitational model. * The Barnes Hut method is used to speed up this N-body simulation. * @private */ solve() { if (this.options.gravitationalConstant !== 0 && this.physicsBody.physicsNodeIndices.length > 0) { let node; const nodes = this.body.nodes; const nodeIndices = this.physicsBody.physicsNodeIndices; const nodeCount = nodeIndices.length; const barnesHutTree = this._formBarnesHutTree(nodes, nodeIndices); this.barnesHutTree = barnesHutTree; for (let i = 0; i < nodeCount; i++) { node = nodes[nodeIndices[i]]; if (node.options.mass > 0) this._getForceContributions(barnesHutTree.root, node); } } } /** * @param {object} parentBranch * @param {Node} node * @private */ _getForceContributions(parentBranch, node) { this._getForceContribution(parentBranch.children.NW, node); this._getForceContribution(parentBranch.children.NE, node); this._getForceContribution(parentBranch.children.SW, node); this._getForceContribution(parentBranch.children.SE, node); } /** * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. * If a region contains a single node, we check if it is not itself, then we apply the force. * @param {object} parentBranch * @param {Node} node * @private */ _getForceContribution(parentBranch, node) { if (parentBranch.childrenCount > 0) { const dx = parentBranch.centerOfMass.x - node.x; const dy = parentBranch.centerOfMass.y - node.y; const distance = Math.sqrt(dx * dx + dy * dy); if (distance * parentBranch.calcSize > this.thetaInversed) this._calculateForces(distance, dx, dy, node, parentBranch); else if (parentBranch.childrenCount === 4) this._getForceContributions(parentBranch, node); else if (parentBranch.children.data.id != node.id) this._calculateForces(distance, dx, dy, node, parentBranch); } } /** * Calculate the forces based on the distance. * @param {number} distance * @param {number} dx * @param {number} dy * @param {Node} node * @param {object} parentBranch * @private */ _calculateForces(distance, dx, dy, node, parentBranch) { if (distance === 0) { distance = .1; dx = distance; } if (this.overlapAvoidanceFactor < 1 && node.shape.radius) distance = Math.max(.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius); const gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass / Math.pow(distance, 3); const fx = dx * gravityForce; const fy = dy * gravityForce; this.physicsBody.forces[node.id].x += fx; this.physicsBody.forces[node.id].y += fy; } /** * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. * @param {Array.} nodes * @param {Array.} nodeIndices * @returns {{root: {centerOfMass: {x: number, y: number}, mass: number, range: {minX: number, maxX: number, minY: number, maxY: number}, size: number, calcSize: number, children: {data: null}, maxWidth: number, level: number, childrenCount: number}}} BarnesHutTree * @private */ _formBarnesHutTree(nodes, nodeIndices) { let node; const nodeCount = nodeIndices.length; let minX = nodes[nodeIndices[0]].x; let minY = nodes[nodeIndices[0]].y; let maxX = nodes[nodeIndices[0]].x; let maxY = nodes[nodeIndices[0]].y; for (let i = 1; i < nodeCount; i++) { const node$1 = nodes[nodeIndices[i]]; const x = node$1.x; const y = node$1.y; if (node$1.options.mass > 0) { if (x < minX) minX = x; if (x > maxX) maxX = x; if (y < minY) minY = y; if (y > maxY) maxY = y; } } const sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); if (sizeDiff > 0) { minY -= .5 * sizeDiff; maxY += .5 * sizeDiff; } else { minX += .5 * sizeDiff; maxX -= .5 * sizeDiff; } const minimumTreeSize = 1e-5; const rootSize = Math.max(minimumTreeSize, Math.abs(maxX - minX)); const halfRootSize = .5 * rootSize; const centerX = .5 * (minX + maxX), centerY = .5 * (minY + maxY); const barnesHutTree = { root: { centerOfMass: { x: 0, y: 0 }, mass: 0, range: { minX: centerX - halfRootSize, maxX: centerX + halfRootSize, minY: centerY - halfRootSize, maxY: centerY + halfRootSize }, size: rootSize, calcSize: 1 / rootSize, children: { data: null }, maxWidth: 0, level: 0, childrenCount: 4 } }; this._splitBranch(barnesHutTree.root); for (let i = 0; i < nodeCount; i++) { node = nodes[nodeIndices[i]]; if (node.options.mass > 0) this._placeInTree(barnesHutTree.root, node); } return barnesHutTree; } /** * this updates the mass of a branch. this is increased by adding a node. * @param {object} parentBranch * @param {Node} node * @private */ _updateBranchMass(parentBranch, node) { const centerOfMass = parentBranch.centerOfMass; const totalMass = parentBranch.mass + node.options.mass; const totalMassInv = 1 / totalMass; centerOfMass.x = centerOfMass.x * parentBranch.mass + node.x * node.options.mass; centerOfMass.x *= totalMassInv; centerOfMass.y = centerOfMass.y * parentBranch.mass + node.y * node.options.mass; centerOfMass.y *= totalMassInv; parentBranch.mass = totalMass; const biggestSize = Math.max(Math.max(node.height, node.radius), node.width); parentBranch.maxWidth = parentBranch.maxWidth < biggestSize ? biggestSize : parentBranch.maxWidth; } /** * determine in which branch the node will be placed. * @param {object} parentBranch * @param {Node} node * @param {boolean} skipMassUpdate * @private */ _placeInTree(parentBranch, node, skipMassUpdate) { if (skipMassUpdate != true || skipMassUpdate === void 0) this._updateBranchMass(parentBranch, node); const range = parentBranch.children.NW.range; let region; if (range.maxX > node.x) if (range.maxY > node.y) region = "NW"; else region = "SW"; else if (range.maxY > node.y) region = "NE"; else region = "SE"; this._placeInRegion(parentBranch, node, region); } /** * actually place the node in a region (or branch) * @param {object} parentBranch * @param {Node} node * @param {'NW'| 'NE' | 'SW' | 'SE'} region * @private */ _placeInRegion(parentBranch, node, region) { const children = parentBranch.children[region]; switch (children.childrenCount) { case 0: children.children.data = node; children.childrenCount = 1; this._updateBranchMass(children, node); break; case 1: if (children.children.data.x === node.x && children.children.data.y === node.y) { node.x += this._rng(); node.y += this._rng(); } else { this._splitBranch(children); this._placeInTree(children, node); } break; case 4: this._placeInTree(children, node); break; } } /** * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch * after the split is complete. * @param {object} parentBranch * @private */ _splitBranch(parentBranch) { let containedNode = null; if (parentBranch.childrenCount === 1) { containedNode = parentBranch.children.data; parentBranch.mass = 0; parentBranch.centerOfMass.x = 0; parentBranch.centerOfMass.y = 0; } parentBranch.childrenCount = 4; parentBranch.children.data = null; this._insertRegion(parentBranch, "NW"); this._insertRegion(parentBranch, "NE"); this._insertRegion(parentBranch, "SW"); this._insertRegion(parentBranch, "SE"); if (containedNode != null) this._placeInTree(parentBranch, containedNode); } /** * This function subdivides the region into four new segments. * Specifically, this inserts a single new segment. * It fills the children section of the parentBranch * @param {object} parentBranch * @param {'NW'| 'NE' | 'SW' | 'SE'} region * @private */ _insertRegion(parentBranch, region) { let minX, maxX, minY, maxY; const childSize = .5 * parentBranch.size; switch (region) { case "NW": minX = parentBranch.range.minX; maxX = parentBranch.range.minX + childSize; minY = parentBranch.range.minY; maxY = parentBranch.range.minY + childSize; break; case "NE": minX = parentBranch.range.minX + childSize; maxX = parentBranch.range.maxX; minY = parentBranch.range.minY; maxY = parentBranch.range.minY + childSize; break; case "SW": minX = parentBranch.range.minX; maxX = parentBranch.range.minX + childSize; minY = parentBranch.range.minY + childSize; maxY = parentBranch.range.maxY; break; case "SE": minX = parentBranch.range.minX + childSize; maxX = parentBranch.range.maxX; minY = parentBranch.range.minY + childSize; maxY = parentBranch.range.maxY; break; } parentBranch.children[region] = { centerOfMass: { x: 0, y: 0 }, mass: 0, range: { minX, maxX, minY, maxY }, size: .5 * parentBranch.size, calcSize: 2 * parentBranch.calcSize, children: { data: null }, maxWidth: 0, level: parentBranch.level + 1, childrenCount: 0 }; } /** * This function is for debugging purposed, it draws the tree. * @param {CanvasRenderingContext2D} ctx * @param {string} color * @private */ _debug(ctx, color) { if (this.barnesHutTree !== void 0) { ctx.lineWidth = 1; this._drawBranch(this.barnesHutTree.root, ctx, color); } } /** * This function is for debugging purposes. It draws the branches recursively. * @param {object} branch * @param {CanvasRenderingContext2D} ctx * @param {string} color * @private */ _drawBranch(branch, ctx, color) { if (color === void 0) color = "#FF0000"; if (branch.childrenCount === 4) { this._drawBranch(branch.children.NW, ctx); this._drawBranch(branch.children.NE, ctx); this._drawBranch(branch.children.SE, ctx); this._drawBranch(branch.children.SW, ctx); } ctx.strokeStyle = color; ctx.beginPath(); ctx.moveTo(branch.range.minX, branch.range.minY); ctx.lineTo(branch.range.maxX, branch.range.minY); ctx.stroke(); ctx.beginPath(); ctx.moveTo(branch.range.maxX, branch.range.minY); ctx.lineTo(branch.range.maxX, branch.range.maxY); ctx.stroke(); ctx.beginPath(); ctx.moveTo(branch.range.maxX, branch.range.maxY); ctx.lineTo(branch.range.minX, branch.range.maxY); ctx.stroke(); ctx.beginPath(); ctx.moveTo(branch.range.minX, branch.range.maxY); ctx.lineTo(branch.range.minX, branch.range.minY); ctx.stroke(); } }; var RepulsionSolver = class { /** * @param {object} body * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody * @param {object} options */ constructor(body, physicsBody, options) { this._rng = Alea("REPULSION SOLVER"); this.body = body; this.physicsBody = physicsBody; this.setOptions(options); } /** * * @param {object} options */ setOptions(options) { this.options = options; } /** * Calculate the forces the nodes apply on each other based on a repulsion field. * This field is linearly approximated. * @private */ solve() { let dx, dy, distance, fx, fy, repulsingForce, node1, node2; const nodes = this.body.nodes; const nodeIndices = this.physicsBody.physicsNodeIndices; const forces = this.physicsBody.forces; const nodeDistance = this.options.nodeDistance; const a = -2 / 3 / nodeDistance; const b = 4 / 3; for (let i = 0; i < nodeIndices.length - 1; i++) { node1 = nodes[nodeIndices[i]]; for (let j = i + 1; j < nodeIndices.length; j++) { node2 = nodes[nodeIndices[j]]; dx = node2.x - node1.x; dy = node2.y - node1.y; distance = Math.sqrt(dx * dx + dy * dy); if (distance === 0) { distance = .1 * this._rng(); dx = distance; } if (distance < 2 * nodeDistance) { if (distance < .5 * nodeDistance) repulsingForce = 1; else repulsingForce = a * distance + b; repulsingForce = repulsingForce / distance; fx = dx * repulsingForce; fy = dy * repulsingForce; forces[node1.id].x -= fx; forces[node1.id].y -= fy; forces[node2.id].x += fx; forces[node2.id].y += fy; } } } } }; var HierarchicalRepulsionSolver = class { /** * @param {object} body * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody * @param {object} options */ constructor(body, physicsBody, options) { this.body = body; this.physicsBody = physicsBody; this.setOptions(options); } /** * * @param {object} options */ setOptions(options) { this.options = options; this.overlapAvoidanceFactor = Math.max(0, Math.min(1, this.options.avoidOverlap || 0)); } /** * Calculate the forces the nodes apply on each other based on a repulsion field. * This field is linearly approximated. * @private */ solve() { const nodes = this.body.nodes; const nodeIndices = this.physicsBody.physicsNodeIndices; const forces = this.physicsBody.forces; const nodeDistance = this.options.nodeDistance; for (let i = 0; i < nodeIndices.length - 1; i++) { const node1 = nodes[nodeIndices[i]]; for (let j = i + 1; j < nodeIndices.length; j++) { const node2 = nodes[nodeIndices[j]]; if (node1.level === node2.level) { const theseNodesDistance = nodeDistance + this.overlapAvoidanceFactor * ((node1.shape.radius || 0) / 2 + (node2.shape.radius || 0) / 2); const dx = node2.x - node1.x; const dy = node2.y - node1.y; const distance = Math.sqrt(dx * dx + dy * dy); const steepness = .05; let repulsingForce; if (distance < theseNodesDistance) repulsingForce = -Math.pow(steepness * distance, 2) + Math.pow(steepness * theseNodesDistance, 2); else repulsingForce = 0; if (distance !== 0) repulsingForce = repulsingForce / distance; const fx = dx * repulsingForce; const fy = dy * repulsingForce; forces[node1.id].x -= fx; forces[node1.id].y -= fy; forces[node2.id].x += fx; forces[node2.id].y += fy; } } } } }; var SpringSolver = class { /** * @param {object} body * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody * @param {object} options */ constructor(body, physicsBody, options) { this.body = body; this.physicsBody = physicsBody; this.setOptions(options); } /** * * @param {object} options */ setOptions(options) { this.options = options; } /** * This function calculates the springforces on the nodes, accounting for the support nodes. * @private */ solve() { let edgeLength, edge; const edgeIndices = this.physicsBody.physicsEdgeIndices; const edges = this.body.edges; let node1, node2, node3; for (let i = 0; i < edgeIndices.length; i++) { edge = edges[edgeIndices[i]]; if (edge.connected === true && edge.toId !== edge.fromId) { if (this.body.nodes[edge.toId] !== void 0 && this.body.nodes[edge.fromId] !== void 0) if (edge.edgeType.via !== void 0) { edgeLength = edge.options.length === void 0 ? this.options.springLength : edge.options.length; node1 = edge.to; node2 = edge.edgeType.via; node3 = edge.from; this._calculateSpringForce(node1, node2, .5 * edgeLength); this._calculateSpringForce(node2, node3, .5 * edgeLength); } else { edgeLength = edge.options.length === void 0 ? this.options.springLength * 1.5 : edge.options.length; this._calculateSpringForce(edge.from, edge.to, edgeLength); } } } } /** * This is the code actually performing the calculation for the function above. * @param {Node} node1 * @param {Node} node2 * @param {number} edgeLength * @private */ _calculateSpringForce(node1, node2, edgeLength) { const dx = node1.x - node2.x; const dy = node1.y - node2.y; const distance = Math.max(Math.sqrt(dx * dx + dy * dy), .01); const springForce = this.options.springConstant * (edgeLength - distance) / distance; const fx = dx * springForce; const fy = dy * springForce; if (this.physicsBody.forces[node1.id] !== void 0) { this.physicsBody.forces[node1.id].x += fx; this.physicsBody.forces[node1.id].y += fy; } if (this.physicsBody.forces[node2.id] !== void 0) { this.physicsBody.forces[node2.id].x -= fx; this.physicsBody.forces[node2.id].y -= fy; } } }; var HierarchicalSpringSolver = class { /** * @param {object} body * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody * @param {object} options */ constructor(body, physicsBody, options) { this.body = body; this.physicsBody = physicsBody; this.setOptions(options); } /** * * @param {object} options */ setOptions(options) { this.options = options; } /** * This function calculates the springforces on the nodes, accounting for the support nodes. * @private */ solve() { let edgeLength, edge; let dx, dy, fx, fy, springForce, distance; const edges = this.body.edges; const factor = .5; const edgeIndices = this.physicsBody.physicsEdgeIndices; const nodeIndices = this.physicsBody.physicsNodeIndices; const forces = this.physicsBody.forces; for (let i = 0; i < nodeIndices.length; i++) { const nodeId = nodeIndices[i]; forces[nodeId].springFx = 0; forces[nodeId].springFy = 0; } for (let i = 0; i < edgeIndices.length; i++) { edge = edges[edgeIndices[i]]; if (edge.connected === true) { edgeLength = edge.options.length === void 0 ? this.options.springLength : edge.options.length; dx = edge.from.x - edge.to.x; dy = edge.from.y - edge.to.y; distance = Math.sqrt(dx * dx + dy * dy); distance = distance === 0 ? .01 : distance; springForce = this.options.springConstant * (edgeLength - distance) / distance; fx = dx * springForce; fy = dy * springForce; if (edge.to.level != edge.from.level) { if (forces[edge.toId] !== void 0) { forces[edge.toId].springFx -= fx; forces[edge.toId].springFy -= fy; } if (forces[edge.fromId] !== void 0) { forces[edge.fromId].springFx += fx; forces[edge.fromId].springFy += fy; } } else { if (forces[edge.toId] !== void 0) { forces[edge.toId].x -= factor * fx; forces[edge.toId].y -= factor * fy; } if (forces[edge.fromId] !== void 0) { forces[edge.fromId].x += factor * fx; forces[edge.fromId].y += factor * fy; } } } } springForce = 1; let springFx, springFy; for (let i = 0; i < nodeIndices.length; i++) { const nodeId = nodeIndices[i]; springFx = Math.min(springForce, Math.max(-springForce, forces[nodeId].springFx)); springFy = Math.min(springForce, Math.max(-springForce, forces[nodeId].springFy)); forces[nodeId].x += springFx; forces[nodeId].y += springFy; } let totalFx = 0; let totalFy = 0; for (let i = 0; i < nodeIndices.length; i++) { const nodeId = nodeIndices[i]; totalFx += forces[nodeId].x; totalFy += forces[nodeId].y; } const correctionFx = totalFx / nodeIndices.length; const correctionFy = totalFy / nodeIndices.length; for (let i = 0; i < nodeIndices.length; i++) { const nodeId = nodeIndices[i]; forces[nodeId].x -= correctionFx; forces[nodeId].y -= correctionFy; } } }; var CentralGravitySolver = class { /** * @param {object} body * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody * @param {object} options */ constructor(body, physicsBody, options) { this.body = body; this.physicsBody = physicsBody; this.setOptions(options); } /** * * @param {object} options */ setOptions(options) { this.options = options; } /** * Calculates forces for each node */ solve() { let dx, dy, distance, node; const nodes = this.body.nodes; const nodeIndices = this.physicsBody.physicsNodeIndices; const forces = this.physicsBody.forces; for (let i = 0; i < nodeIndices.length; i++) { const nodeId = nodeIndices[i]; node = nodes[nodeId]; dx = -node.x; dy = -node.y; distance = Math.sqrt(dx * dx + dy * dy); this._calculateForces(distance, dx, dy, forces, node); } } /** * Calculate the forces based on the distance. * @param {number} distance * @param {number} dx * @param {number} dy * @param {Object} forces * @param {Node} node * @private */ _calculateForces(distance, dx, dy, forces, node) { const gravityForce = distance === 0 ? 0 : this.options.centralGravity / distance; forces[node.id].x = dx * gravityForce; forces[node.id].y = dy * gravityForce; } }; var ForceAtlas2BasedRepulsionSolver = class extends BarnesHutSolver { /** * @param {object} body * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody * @param {object} options */ constructor(body, physicsBody, options) { super(body, physicsBody, options); this._rng = Alea("FORCE ATLAS 2 BASED REPULSION SOLVER"); } /** * Calculate the forces based on the distance. * @param {number} distance * @param {number} dx * @param {number} dy * @param {Node} node * @param {object} parentBranch * @private */ _calculateForces(distance, dx, dy, node, parentBranch) { if (distance === 0) { distance = .1 * this._rng(); dx = distance; } if (this.overlapAvoidanceFactor < 1 && node.shape.radius) distance = Math.max(.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius); const degree = node.edges.length + 1; const gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass * degree / Math.pow(distance, 2); const fx = dx * gravityForce; const fy = dy * gravityForce; this.physicsBody.forces[node.id].x += fx; this.physicsBody.forces[node.id].y += fy; } }; var ForceAtlas2BasedCentralGravitySolver = class extends CentralGravitySolver { /** * @param {object} body * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody * @param {object} options */ constructor(body, physicsBody, options) { super(body, physicsBody, options); } /** * Calculate the forces based on the distance. * @param {number} distance * @param {number} dx * @param {number} dy * @param {Object} forces * @param {Node} node * @private */ _calculateForces(distance, dx, dy, forces, node) { if (distance > 0) { const degree = node.edges.length + 1; const gravityForce = this.options.centralGravity * degree * node.options.mass; forces[node.id].x = dx * gravityForce; forces[node.id].y = dy * gravityForce; } } }; var PhysicsEngine = class { /** * @param {object} body */ constructor(body) { this.body = body; this.physicsBody = { physicsNodeIndices: [], physicsEdgeIndices: [], forces: {}, velocities: {} }; this.physicsEnabled = true; this.simulationInterval = 1e3 / 60; this.requiresTimeout = true; this.previousStates = {}; this.referenceState = {}; this.freezeCache = {}; this.renderTimer = void 0; this.adaptiveTimestep = false; this.adaptiveTimestepEnabled = false; this.adaptiveCounter = 0; this.adaptiveInterval = 3; this.stabilized = false; this.startedStabilization = false; this.stabilizationIterations = 0; this.ready = false; this.options = {}; this.defaultOptions = { enabled: true, barnesHut: { theta: .5, gravitationalConstant: -2e3, centralGravity: .3, springLength: 95, springConstant: .04, damping: .09, avoidOverlap: 0 }, forceAtlas2Based: { theta: .5, gravitationalConstant: -50, centralGravity: .01, springConstant: .08, springLength: 100, damping: .4, avoidOverlap: 0 }, repulsion: { centralGravity: .2, springLength: 200, springConstant: .05, nodeDistance: 100, damping: .09, avoidOverlap: 0 }, hierarchicalRepulsion: { centralGravity: 0, springLength: 100, springConstant: .01, nodeDistance: 120, damping: .09 }, maxVelocity: 50, minVelocity: .75, solver: "barnesHut", stabilization: { enabled: true, iterations: 1e3, updateInterval: 50, onlyDynamicEdges: false, fit: true }, timestep: .5, adaptiveTimestep: true, wind: { x: 0, y: 0 } }; _Object$assign(this.options, this.defaultOptions); this.timestep = .5; this.layoutFailed = false; this.bindEventListeners(); } /** * Binds event listeners */ bindEventListeners() { this.body.emitter.on("initPhysics", () => { this.initPhysics(); }); this.body.emitter.on("_layoutFailed", () => { this.layoutFailed = true; }); this.body.emitter.on("resetPhysics", () => { this.stopSimulation(); this.ready = false; }); this.body.emitter.on("disablePhysics", () => { this.physicsEnabled = false; this.stopSimulation(); }); this.body.emitter.on("restorePhysics", () => { this.setOptions(this.options); if (this.ready === true) this.startSimulation(); }); this.body.emitter.on("startSimulation", () => { if (this.ready === true) this.startSimulation(); }); this.body.emitter.on("stopSimulation", () => { this.stopSimulation(); }); this.body.emitter.on("destroy", () => { this.stopSimulation(false); this.body.emitter.off(); }); this.body.emitter.on("_dataChanged", () => { this.updatePhysicsData(); }); } /** * set the physics options * @param {object} options */ setOptions(options) { if (options !== void 0) if (options === false) { this.options.enabled = false; this.physicsEnabled = false; this.stopSimulation(); } else if (options === true) { this.options.enabled = true; this.physicsEnabled = true; this.startSimulation(); } else { this.physicsEnabled = true; selectiveNotDeepExtend(["stabilization"], this.options, options); mergeOptions(this.options, options, "stabilization"); if (options.enabled === void 0) this.options.enabled = true; if (this.options.enabled === false) { this.physicsEnabled = false; this.stopSimulation(); } const wind = this.options.wind; if (wind) { if (typeof wind.x !== "number" || _Number$isNaN(wind.x)) wind.x = 0; if (typeof wind.y !== "number" || _Number$isNaN(wind.y)) wind.y = 0; } this.timestep = this.options.timestep; } this.init(); } /** * configure the engine. */ init() { let options; if (this.options.solver === "forceAtlas2Based") { options = this.options.forceAtlas2Based; this.nodesSolver = new ForceAtlas2BasedRepulsionSolver(this.body, this.physicsBody, options); this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); this.gravitySolver = new ForceAtlas2BasedCentralGravitySolver(this.body, this.physicsBody, options); } else if (this.options.solver === "repulsion") { options = this.options.repulsion; this.nodesSolver = new RepulsionSolver(this.body, this.physicsBody, options); this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); } else if (this.options.solver === "hierarchicalRepulsion") { options = this.options.hierarchicalRepulsion; this.nodesSolver = new HierarchicalRepulsionSolver(this.body, this.physicsBody, options); this.edgesSolver = new HierarchicalSpringSolver(this.body, this.physicsBody, options); this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); } else { options = this.options.barnesHut; this.nodesSolver = new BarnesHutSolver(this.body, this.physicsBody, options); this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); } this.modelOptions = options; } /** * initialize the engine */ initPhysics() { if (this.physicsEnabled === true && this.options.enabled === true) if (this.options.stabilization.enabled === true) this.stabilize(); else { this.stabilized = false; this.ready = true; this.body.emitter.emit("fit", {}, this.layoutFailed); this.startSimulation(); } else { this.ready = true; this.body.emitter.emit("fit"); } } /** * Start the simulation */ startSimulation() { if (this.physicsEnabled === true && this.options.enabled === true) { this.stabilized = false; this.adaptiveTimestep = false; this.body.emitter.emit("_resizeNodes"); if (this.viewFunction === void 0) { var _context; this.viewFunction = _bindInstanceProperty(_context = this.simulationStep).call(_context, this); this.body.emitter.on("initRedraw", this.viewFunction); this.body.emitter.emit("_startRendering"); } } else this.body.emitter.emit("_redraw"); } /** * Stop the simulation, force stabilization. * @param {boolean} [emit] */ stopSimulation() { let emit = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; this.stabilized = true; if (emit === true) this._emitStabilized(); if (this.viewFunction !== void 0) { this.body.emitter.off("initRedraw", this.viewFunction); this.viewFunction = void 0; if (emit === true) this.body.emitter.emit("_stopRendering"); } } /** * The viewFunction inserts this step into each render loop. It calls the physics tick and handles the cleanup at stabilized. * */ simulationStep() { const startTime = _Date$now(); this.physicsTick(); const physicsTime = _Date$now() - startTime; if ((physicsTime < .4 * this.simulationInterval || this.runDoubleSpeed === true) && this.stabilized === false) { this.physicsTick(); this.runDoubleSpeed = true; } if (this.stabilized === true) this.stopSimulation(); } /** * trigger the stabilized event. * @param {number} [amountOfIterations] * @private */ _emitStabilized() { let amountOfIterations = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.stabilizationIterations; if (this.stabilizationIterations > 1 || this.startedStabilization === true) _setTimeout(() => { this.body.emitter.emit("stabilized", { iterations: amountOfIterations }); this.startedStabilization = false; this.stabilizationIterations = 0; }, 0); } /** * Calculate the forces for one physics iteration and move the nodes. * @private */ physicsStep() { this.gravitySolver.solve(); this.nodesSolver.solve(); this.edgesSolver.solve(); this.moveNodes(); } /** * Make dynamic adjustments to the timestep, based on current state. * * Helper function for physicsTick(). * @private */ adjustTimeStep() { const factor = 1.2; if (this._evaluateStepQuality() === true) this.timestep = factor * this.timestep; else if (this.timestep / factor < this.options.timestep) this.timestep = this.options.timestep; else { this.adaptiveCounter = -1; this.timestep = Math.max(this.options.timestep, this.timestep / factor); } } /** * A single simulation step (or 'tick') in the physics simulation * @private */ physicsTick() { this._startStabilizing(); if (this.stabilized === true) return; if (this.adaptiveTimestep === true && this.adaptiveTimestepEnabled === true) { const doAdaptive = this.adaptiveCounter % this.adaptiveInterval === 0; if (doAdaptive) { this.timestep = 2 * this.timestep; this.physicsStep(); this.revert(); this.timestep = .5 * this.timestep; this.physicsStep(); this.physicsStep(); this.adjustTimeStep(); } else this.physicsStep(); this.adaptiveCounter += 1; } else { this.timestep = this.options.timestep; this.physicsStep(); } if (this.stabilized === true) this.revert(); this.stabilizationIterations++; } /** * Nodes and edges can have the physics toggles on or off. A collection of indices is created here so we can skip the check all the time. * @private */ updatePhysicsData() { this.physicsBody.forces = {}; this.physicsBody.physicsNodeIndices = []; this.physicsBody.physicsEdgeIndices = []; const nodes = this.body.nodes; const edges = this.body.edges; for (const nodeId in nodes) if (Object.prototype.hasOwnProperty.call(nodes, nodeId)) { if (nodes[nodeId].options.physics === true) this.physicsBody.physicsNodeIndices.push(nodes[nodeId].id); } for (const edgeId in edges) if (Object.prototype.hasOwnProperty.call(edges, edgeId)) { if (edges[edgeId].options.physics === true) this.physicsBody.physicsEdgeIndices.push(edges[edgeId].id); } for (let i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) { const nodeId = this.physicsBody.physicsNodeIndices[i]; this.physicsBody.forces[nodeId] = { x: 0, y: 0 }; if (this.physicsBody.velocities[nodeId] === void 0) this.physicsBody.velocities[nodeId] = { x: 0, y: 0 }; } for (const nodeId in this.physicsBody.velocities) if (nodes[nodeId] === void 0) delete this.physicsBody.velocities[nodeId]; } /** * Revert the simulation one step. This is done so after stabilization, every new start of the simulation will also say stabilized. */ revert() { const nodeIds = _Object$keys(this.previousStates); const nodes = this.body.nodes; const velocities = this.physicsBody.velocities; this.referenceState = {}; for (let i = 0; i < nodeIds.length; i++) { const nodeId = nodeIds[i]; if (nodes[nodeId] !== void 0) { if (nodes[nodeId].options.physics === true) { this.referenceState[nodeId] = { positions: { x: nodes[nodeId].x, y: nodes[nodeId].y } }; velocities[nodeId].x = this.previousStates[nodeId].vx; velocities[nodeId].y = this.previousStates[nodeId].vy; nodes[nodeId].x = this.previousStates[nodeId].x; nodes[nodeId].y = this.previousStates[nodeId].y; } } else delete this.previousStates[nodeId]; } } /** * This compares the reference state to the current state * @returns {boolean} * @private */ _evaluateStepQuality() { let dx, dy, dpos; const nodes = this.body.nodes; const reference = this.referenceState; const posThreshold = .3; for (const nodeId in this.referenceState) if (Object.prototype.hasOwnProperty.call(this.referenceState, nodeId) && nodes[nodeId] !== void 0) { dx = nodes[nodeId].x - reference[nodeId].positions.x; dy = nodes[nodeId].y - reference[nodeId].positions.y; dpos = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); if (dpos > posThreshold) return false; } return true; } /** * move the nodes one timestep and check if they are stabilized */ moveNodes() { const nodeIndices = this.physicsBody.physicsNodeIndices; let maxNodeVelocity = 0; let averageNodeVelocity = 0; const velocityAdaptiveThreshold = 5; for (let i = 0; i < nodeIndices.length; i++) { const nodeId = nodeIndices[i]; const nodeVelocity = this._performStep(nodeId); maxNodeVelocity = Math.max(maxNodeVelocity, nodeVelocity); averageNodeVelocity += nodeVelocity; } this.adaptiveTimestepEnabled = averageNodeVelocity / nodeIndices.length < velocityAdaptiveThreshold; this.stabilized = maxNodeVelocity < this.options.minVelocity; } /** * Calculate new velocity for a coordinate direction * @param {number} v velocity for current coordinate * @param {number} f regular force for current coordinate * @param {number} m mass of current node * @returns {number} new velocity for current coordinate * @private */ calculateComponentVelocity(v, f, m) { const df = this.modelOptions.damping * v; const a = (f - df) / m; v += a * this.timestep; const maxV = this.options.maxVelocity || 1e9; if (Math.abs(v) > maxV) v = v > 0 ? maxV : -maxV; return v; } /** * Perform the actual step * @param {Node.id} nodeId * @returns {number} the new velocity of given node * @private */ _performStep(nodeId) { const node = this.body.nodes[nodeId]; const force = this.physicsBody.forces[nodeId]; if (this.options.wind) { force.x += this.options.wind.x; force.y += this.options.wind.y; } const velocity = this.physicsBody.velocities[nodeId]; this.previousStates[nodeId] = { x: node.x, y: node.y, vx: velocity.x, vy: velocity.y }; if (node.options.fixed.x === false) { velocity.x = this.calculateComponentVelocity(velocity.x, force.x, node.options.mass); node.x += velocity.x * this.timestep; } else { force.x = 0; velocity.x = 0; } if (node.options.fixed.y === false) { velocity.y = this.calculateComponentVelocity(velocity.y, force.y, node.options.mass); node.y += velocity.y * this.timestep; } else { force.y = 0; velocity.y = 0; } const totalVelocity = Math.sqrt(Math.pow(velocity.x, 2) + Math.pow(velocity.y, 2)); return totalVelocity; } /** * When initializing and stabilizing, we can freeze nodes with a predefined position. * This greatly speeds up stabilization because only the supportnodes for the smoothCurves have to settle. * @private */ _freezeNodes() { const nodes = this.body.nodes; for (const id in nodes) if (Object.prototype.hasOwnProperty.call(nodes, id)) { if (nodes[id].x && nodes[id].y) { const fixed = nodes[id].options.fixed; this.freezeCache[id] = { x: fixed.x, y: fixed.y }; fixed.x = true; fixed.y = true; } } } /** * Unfreezes the nodes that have been frozen by _freezeDefinedNodes. * @private */ _restoreFrozenNodes() { const nodes = this.body.nodes; for (const id in nodes) if (Object.prototype.hasOwnProperty.call(nodes, id)) { if (this.freezeCache[id] !== void 0) { nodes[id].options.fixed.x = this.freezeCache[id].x; nodes[id].options.fixed.y = this.freezeCache[id].y; } } this.freezeCache = {}; } /** * Find a stable position for all nodes * @param {number} [iterations] */ stabilize() { let iterations = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.stabilization.iterations; if (typeof iterations !== "number") { iterations = this.options.stabilization.iterations; console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ", iterations); } if (this.physicsBody.physicsNodeIndices.length === 0) { this.ready = true; return; } this.adaptiveTimestep = this.options.adaptiveTimestep; this.body.emitter.emit("_resizeNodes"); this.stopSimulation(); this.stabilized = false; this.body.emitter.emit("_blockRedraw"); this.targetIterations = iterations; if (this.options.stabilization.onlyDynamicEdges === true) this._freezeNodes(); this.stabilizationIterations = 0; _setTimeout(() => this._stabilizationBatch(), 0); } /** * If not already stabilizing, start it and emit a start event. * @returns {boolean} true if stabilization started with this call * @private */ _startStabilizing() { if (this.startedStabilization === true) return false; this.body.emitter.emit("startStabilizing"); this.startedStabilization = true; return true; } /** * One batch of stabilization * @private */ _stabilizationBatch() { const running = () => this.stabilized === false && this.stabilizationIterations < this.targetIterations; const sendProgress = () => { this.body.emitter.emit("stabilizationProgress", { iterations: this.stabilizationIterations, total: this.targetIterations }); }; if (this._startStabilizing()) sendProgress(); let count = 0; while (running() && count < this.options.stabilization.updateInterval) { this.physicsTick(); count++; } sendProgress(); if (running()) { var _context2; _setTimeout(_bindInstanceProperty(_context2 = this._stabilizationBatch).call(_context2, this), 0); } else this._finalizeStabilization(); } /** * Wrap up the stabilization, fit and emit the events. * @private */ _finalizeStabilization() { this.body.emitter.emit("_allowRedraw"); if (this.options.stabilization.fit === true) this.body.emitter.emit("fit"); if (this.options.stabilization.onlyDynamicEdges === true) this._restoreFrozenNodes(); this.body.emitter.emit("stabilizationIterationsDone"); this.body.emitter.emit("_requestRedraw"); if (this.stabilized === true) this._emitStabilized(); else this.startSimulation(); this.ready = true; } /** * Debug function that display arrows for the forces currently active in the network. * * Use this when debugging only. * @param {CanvasRenderingContext2D} ctx * @private */ _drawForces(ctx) { for (let i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) { const index$1 = this.physicsBody.physicsNodeIndices[i]; const node = this.body.nodes[index$1]; const force = this.physicsBody.forces[index$1]; const factor = 20; const colorFactor = .03; const forceSize = Math.sqrt(Math.pow(force.x, 2) + Math.pow(force.x, 2)); const size = Math.min(Math.max(5, forceSize), 15); const arrowSize = 3 * size; const color = HSVToHex((180 - Math.min(1, Math.max(0, colorFactor * forceSize)) * 180) / 360, 1, 1); const point = { x: node.x + factor * force.x, y: node.y + factor * force.y }; ctx.lineWidth = size; ctx.strokeStyle = color; ctx.beginPath(); ctx.moveTo(node.x, node.y); ctx.lineTo(point.x, point.y); ctx.stroke(); const angle = Math.atan2(force.y, force.x); ctx.fillStyle = color; EndPoints.draw(ctx, { type: "arrow", point, angle, length: arrowSize }); _fillInstanceProperty(ctx).call(ctx); } } }; var es_array_reverse = {}; var hasRequiredEs_array_reverse; function requireEs_array_reverse() { if (hasRequiredEs_array_reverse) return es_array_reverse; hasRequiredEs_array_reverse = 1; var $ = /* @__PURE__ */ require_export(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var isArray$5 = /* @__PURE__ */ requireIsArray$3(); var nativeReverse = uncurryThis([].reverse); var test = [1, 2]; $({ target: "Array", proto: true, forced: String(test) === String(test.reverse()) }, { reverse: function reverse$4() { if (isArray$5(this)) this.length = this.length; return nativeReverse(this); } }); return es_array_reverse; } var reverse$3; var hasRequiredReverse$3; function requireReverse$3() { if (hasRequiredReverse$3) return reverse$3; hasRequiredReverse$3 = 1; requireEs_array_reverse(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); reverse$3 = getBuiltInPrototypeMethod$2("Array", "reverse"); return reverse$3; } var reverse$2; var hasRequiredReverse$2; function requireReverse$2() { if (hasRequiredReverse$2) return reverse$2; hasRequiredReverse$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireReverse$3(); var ArrayPrototype = Array.prototype; reverse$2 = function(it$1) { var own = it$1.reverse; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.reverse ? method : own; }; return reverse$2; } var reverse$1; var hasRequiredReverse$1; function requireReverse$1() { if (hasRequiredReverse$1) return reverse$1; hasRequiredReverse$1 = 1; var parent = /* @__PURE__ */ requireReverse$2(); reverse$1 = parent; return reverse$1; } var reverse; var hasRequiredReverse; function requireReverse() { if (hasRequiredReverse) return reverse; hasRequiredReverse = 1; reverse = /* @__PURE__ */ requireReverse$1(); return reverse; } var reverseExports = requireReverse(); var _reverseInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(reverseExports); const byteToHex = []; for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1)); function unsafeStringify(arr, offset = 0) { return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); } let getRandomValues; const rnds8 = new Uint8Array(16); function rng() { if (!getRandomValues) { if (typeof crypto === "undefined" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); getRandomValues = crypto.getRandomValues.bind(crypto); } return getRandomValues(rnds8); } const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto); var native = { randomUUID }; function v4(options, buf, offset) { if (native.randomUUID && !options) return native.randomUUID(); options = options || {}; const rnds = options.random ?? options.rng?.() ?? rng(); if (rnds.length < 16) throw new Error("Random bytes length must be >= 16"); rnds[6] = rnds[6] & 15 | 64; rnds[8] = rnds[8] & 63 | 128; return unsafeStringify(rnds); } var NetworkUtil = class { /** * @ignore */ constructor() {} /** * Find the center position of the network considering the bounding boxes * @param {Array.} allNodes * @param {Array.} [specificNodes] * @returns {{minX: number, maxX: number, minY: number, maxY: number}} * @static */ static getRange(allNodes) { let specificNodes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; let minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; if (specificNodes.length > 0) for (let i = 0; i < specificNodes.length; i++) { node = allNodes[specificNodes[i]]; if (minX > node.shape.boundingBox.left) minX = node.shape.boundingBox.left; if (maxX < node.shape.boundingBox.right) maxX = node.shape.boundingBox.right; if (minY > node.shape.boundingBox.top) minY = node.shape.boundingBox.top; if (maxY < node.shape.boundingBox.bottom) maxY = node.shape.boundingBox.bottom; } if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) minY = 0, maxY = 0, minX = 0, maxX = 0; return { minX, maxX, minY, maxY }; } /** * Find the center position of the network * @param {Array.} allNodes * @param {Array.} [specificNodes] * @returns {{minX: number, maxX: number, minY: number, maxY: number}} * @static */ static getRangeCore(allNodes) { let specificNodes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; let minY = 1e9, maxY = -1e9, minX = 1e9, maxX = -1e9, node; if (specificNodes.length > 0) for (let i = 0; i < specificNodes.length; i++) { node = allNodes[specificNodes[i]]; if (minX > node.x) minX = node.x; if (maxX < node.x) maxX = node.x; if (minY > node.y) minY = node.y; if (maxY < node.y) maxY = node.y; } if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) minY = 0, maxY = 0, minX = 0, maxX = 0; return { minX, maxX, minY, maxY }; } /** * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; * @returns {{x: number, y: number}} * @static */ static findCenter(range) { return { x: .5 * (range.maxX + range.minX), y: .5 * (range.maxY + range.minY) }; } /** * This returns a clone of the options or options of the edge or node to be used for construction of new edges or check functions for new nodes. * @param {vis.Item} item * @param {'node'|undefined} type * @returns {{}} * @static */ static cloneOptions(item, type) { const clonedOptions = {}; if (type === void 0 || type === "node") { deepExtend(clonedOptions, item.options, true); clonedOptions.x = item.x; clonedOptions.y = item.y; clonedOptions.amountOfConnections = item.edges.length; } else deepExtend(clonedOptions, item.options, true); return clonedOptions; } }; var Cluster = class extends Node { /** * @param {object} options * @param {object} body * @param {Array.}imagelist * @param {Array} grouplist * @param {object} globalOptions * @param {object} defaultOptions Global default options for nodes */ constructor(options, body, imagelist, grouplist, globalOptions, defaultOptions) { super(options, body, imagelist, grouplist, globalOptions, defaultOptions); this.isCluster = true; this.containedNodes = {}; this.containedEdges = {}; } /** * Transfer child cluster data to current and disconnect the child cluster. * * Please consult the header comment in 'Clustering.js' for the fields set here. * @param {string|number} childClusterId id of child cluster to open */ _openChildCluster(childClusterId) { const childCluster = this.body.nodes[childClusterId]; if (this.containedNodes[childClusterId] === void 0) throw new Error("node with id: " + childClusterId + " not in current cluster"); if (!childCluster.isCluster) throw new Error("node with id: " + childClusterId + " is not a cluster"); delete this.containedNodes[childClusterId]; forEach$4(childCluster.edges, (edge) => { delete this.containedEdges[edge.id]; }); forEach$4(childCluster.containedNodes, (node, nodeId) => { this.containedNodes[nodeId] = node; }); childCluster.containedNodes = {}; forEach$4(childCluster.containedEdges, (edge, edgeId) => { this.containedEdges[edgeId] = edge; }); childCluster.containedEdges = {}; forEach$4(childCluster.edges, (clusterEdge) => { forEach$4(this.edges, (parentClusterEdge) => { var _context, _context2; const index$1 = _indexOfInstanceProperty(_context = parentClusterEdge.clusteringEdgeReplacingIds).call(_context, clusterEdge.id); if (index$1 === -1) return; forEach$4(clusterEdge.clusteringEdgeReplacingIds, (srcId) => { parentClusterEdge.clusteringEdgeReplacingIds.push(srcId); this.body.edges[srcId].edgeReplacedById = parentClusterEdge.id; }); _spliceInstanceProperty(_context2 = parentClusterEdge.clusteringEdgeReplacingIds).call(_context2, index$1, 1); }); }); childCluster.edges = []; } }; var ClusterEngine = class { /** * @param {object} body */ constructor(body) { this.body = body; this.clusteredNodes = {}; this.clusteredEdges = {}; this.options = {}; this.defaultOptions = {}; _Object$assign(this.options, this.defaultOptions); this.body.emitter.on("_resetData", () => { this.clusteredNodes = {}; this.clusteredEdges = {}; }); } /** * * @param {number} hubsize * @param {object} options */ clusterByHubsize(hubsize, options) { if (hubsize === void 0) hubsize = this._getHubSize(); else if (typeof hubsize === "object") { options = this._checkOptions(hubsize); hubsize = this._getHubSize(); } const nodesToCluster = []; for (let i = 0; i < this.body.nodeIndices.length; i++) { const node = this.body.nodes[this.body.nodeIndices[i]]; if (node.edges.length >= hubsize) nodesToCluster.push(node.id); } for (let i = 0; i < nodesToCluster.length; i++) this.clusterByConnection(nodesToCluster[i], options, true); this.body.emitter.emit("_dataChanged"); } /** * loop over all nodes, check if they adhere to the condition and cluster if needed. * @param {object} options * @param {boolean} [refreshData] */ cluster() { let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; let refreshData = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; if (options.joinCondition === void 0) throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options."); options = this._checkOptions(options); const childNodesObj = {}; const childEdgesObj = {}; forEach$4(this.body.nodes, (node, nodeId) => { if (node.options && options.joinCondition(node.options) === true) { childNodesObj[nodeId] = node; forEach$4(node.edges, (edge) => { if (this.clusteredEdges[edge.id] === void 0) childEdgesObj[edge.id] = edge; }); } }); this._cluster(childNodesObj, childEdgesObj, options, refreshData); } /** * Cluster all nodes in the network that have only X edges * @param {number} edgeCount * @param {object} options * @param {boolean} [refreshData] */ clusterByEdgeCount(edgeCount, options) { let refreshData = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; options = this._checkOptions(options); const clusters = []; const usedNodes = {}; let edge, edges, relevantEdgeCount; for (let i = 0; i < this.body.nodeIndices.length; i++) { const childNodesObj = {}; const childEdgesObj = {}; const nodeId = this.body.nodeIndices[i]; const node = this.body.nodes[nodeId]; if (usedNodes[nodeId] === void 0) { relevantEdgeCount = 0; edges = []; for (let j = 0; j < node.edges.length; j++) { edge = node.edges[j]; if (this.clusteredEdges[edge.id] === void 0) { if (edge.toId !== edge.fromId) relevantEdgeCount++; edges.push(edge); } } if (relevantEdgeCount === edgeCount) { const checkJoinCondition = function(node$1) { if (options.joinCondition === void 0 || options.joinCondition === null) return true; const clonedOptions = NetworkUtil.cloneOptions(node$1); return options.joinCondition(clonedOptions); }; let gatheringSuccessful = true; for (let j = 0; j < edges.length; j++) { edge = edges[j]; const childNodeId = this._getConnectedId(edge, nodeId); if (checkJoinCondition(node)) { childEdgesObj[edge.id] = edge; childNodesObj[nodeId] = node; childNodesObj[childNodeId] = this.body.nodes[childNodeId]; usedNodes[nodeId] = true; } else { gatheringSuccessful = false; break; } } if (_Object$keys(childNodesObj).length > 0 && _Object$keys(childEdgesObj).length > 0 && gatheringSuccessful === true) { /** * Search for cluster data that contains any of the node id's * @returns {boolean} true if no joinCondition, otherwise return value of joinCondition */ const findClusterData = function() { for (let n = 0; n < clusters.length; ++n) for (const m in childNodesObj) if (clusters[n].nodes[m] !== void 0) return clusters[n]; return void 0; }; const foundCluster = findClusterData(); if (foundCluster !== void 0) { for (const m in childNodesObj) if (foundCluster.nodes[m] === void 0) foundCluster.nodes[m] = childNodesObj[m]; for (const m in childEdgesObj) if (foundCluster.edges[m] === void 0) foundCluster.edges[m] = childEdgesObj[m]; } else clusters.push({ nodes: childNodesObj, edges: childEdgesObj }); } } } } for (let i = 0; i < clusters.length; i++) this._cluster(clusters[i].nodes, clusters[i].edges, options, false); if (refreshData === true) this.body.emitter.emit("_dataChanged"); } /** * Cluster all nodes in the network that have only 1 edge * @param {object} options * @param {boolean} [refreshData] */ clusterOutliers(options) { let refreshData = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; this.clusterByEdgeCount(1, options, refreshData); } /** * Cluster all nodes in the network that have only 2 edge * @param {object} options * @param {boolean} [refreshData] */ clusterBridges(options) { let refreshData = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; this.clusterByEdgeCount(2, options, refreshData); } /** * suck all connected nodes of a node into the node. * @param {Node.id} nodeId * @param {object} options * @param {boolean} [refreshData] */ clusterByConnection(nodeId, options) { var _context; let refreshData = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; if (nodeId === void 0) throw new Error("No nodeId supplied to clusterByConnection!"); if (this.body.nodes[nodeId] === void 0) throw new Error("The nodeId given to clusterByConnection does not exist!"); const node = this.body.nodes[nodeId]; options = this._checkOptions(options, node); if (options.clusterNodeProperties.x === void 0) options.clusterNodeProperties.x = node.x; if (options.clusterNodeProperties.y === void 0) options.clusterNodeProperties.y = node.y; if (options.clusterNodeProperties.fixed === void 0) { options.clusterNodeProperties.fixed = {}; options.clusterNodeProperties.fixed.x = node.options.fixed.x; options.clusterNodeProperties.fixed.y = node.options.fixed.y; } const childNodesObj = {}; const childEdgesObj = {}; const parentNodeId = node.id; const parentClonedOptions = NetworkUtil.cloneOptions(node); childNodesObj[parentNodeId] = node; for (let i = 0; i < node.edges.length; i++) { const edge = node.edges[i]; if (this.clusteredEdges[edge.id] === void 0) { const childNodeId = this._getConnectedId(edge, parentNodeId); if (this.clusteredNodes[childNodeId] === void 0) if (childNodeId !== parentNodeId) if (options.joinCondition === void 0) { childEdgesObj[edge.id] = edge; childNodesObj[childNodeId] = this.body.nodes[childNodeId]; } else { const childClonedOptions = NetworkUtil.cloneOptions(this.body.nodes[childNodeId]); if (options.joinCondition(parentClonedOptions, childClonedOptions) === true) { childEdgesObj[edge.id] = edge; childNodesObj[childNodeId] = this.body.nodes[childNodeId]; } } else childEdgesObj[edge.id] = edge; } } const childNodeIDs = _mapInstanceProperty(_context = _Object$keys(childNodesObj)).call(_context, function(childNode) { return childNodesObj[childNode].id; }); for (const childNodeKey in childNodesObj) { if (!Object.prototype.hasOwnProperty.call(childNodesObj, childNodeKey)) continue; const childNode = childNodesObj[childNodeKey]; for (let y = 0; y < childNode.edges.length; y++) { const childEdge = childNode.edges[y]; if (_indexOfInstanceProperty(childNodeIDs).call(childNodeIDs, this._getConnectedId(childEdge, childNode.id)) > -1) childEdgesObj[childEdge.id] = childEdge; } } this._cluster(childNodesObj, childEdgesObj, options, refreshData); } /** * This function creates the edges that will be attached to the cluster * It looks for edges that are connected to the nodes from the "outside' of the cluster. * @param {{Node.id: vis.Node}} childNodesObj * @param {{vis.Edge.id: vis.Edge}} childEdgesObj * @param {object} clusterNodeProperties * @param {object} clusterEdgeProperties * @private */ _createClusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, clusterEdgeProperties) { let edge, childNodeId, childNode, toId, fromId, otherNodeId; const childKeys = _Object$keys(childNodesObj); const createEdges = []; for (let i = 0; i < childKeys.length; i++) { childNodeId = childKeys[i]; childNode = childNodesObj[childNodeId]; for (let j = 0; j < childNode.edges.length; j++) { edge = childNode.edges[j]; if (this.clusteredEdges[edge.id] === void 0) { if (edge.toId == edge.fromId) childEdgesObj[edge.id] = edge; else if (edge.toId == childNodeId) { toId = clusterNodeProperties.id; fromId = edge.fromId; otherNodeId = fromId; } else { toId = edge.toId; fromId = clusterNodeProperties.id; otherNodeId = toId; } if (childNodesObj[otherNodeId] === void 0) createEdges.push({ edge, fromId, toId }); } } } const newEdges = []; /** * Find a cluster edge which matches the given created edge. * @param {vis.Edge} createdEdge * @returns {vis.Edge} */ const getNewEdge = function(createdEdge) { for (let j = 0; j < newEdges.length; j++) { const newEdge = newEdges[j]; const matchToDirection = createdEdge.fromId === newEdge.fromId && createdEdge.toId === newEdge.toId; const matchFromDirection = createdEdge.fromId === newEdge.toId && createdEdge.toId === newEdge.fromId; if (matchToDirection || matchFromDirection) return newEdge; } return null; }; for (let j = 0; j < createEdges.length; j++) { const createdEdge = createEdges[j]; const edge$1 = createdEdge.edge; let newEdge = getNewEdge(createdEdge); if (newEdge === null) { newEdge = this._createClusteredEdge(createdEdge.fromId, createdEdge.toId, edge$1, clusterEdgeProperties); newEdges.push(newEdge); } else newEdge.clusteringEdgeReplacingIds.push(edge$1.id); this.body.edges[edge$1.id].edgeReplacedById = newEdge.id; this._backupEdgeOptions(edge$1); edge$1.setOptions({ physics: false }); } } /** * This function checks the options that can be supplied to the different cluster functions * for certain fields and inserts defaults if needed * @param {object} options * @returns {*} * @private */ _checkOptions() { let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; if (options.clusterEdgeProperties === void 0) options.clusterEdgeProperties = {}; if (options.clusterNodeProperties === void 0) options.clusterNodeProperties = {}; return options; } /** * * @param {object} childNodesObj | object with node objects, id as keys, same as childNodes except it also contains a source node * @param {object} childEdgesObj | object with edge objects, id as keys * @param {Array} options | object with {clusterNodeProperties, clusterEdgeProperties, processProperties} * @param {boolean} refreshData | when true, do not wrap up * @private */ _cluster(childNodesObj, childEdgesObj, options) { let refreshData = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true; const tmpNodesToRemove = []; for (const nodeId in childNodesObj) if (Object.prototype.hasOwnProperty.call(childNodesObj, nodeId)) { if (this.clusteredNodes[nodeId] !== void 0) tmpNodesToRemove.push(nodeId); } for (let n = 0; n < tmpNodesToRemove.length; ++n) delete childNodesObj[tmpNodesToRemove[n]]; if (_Object$keys(childNodesObj).length == 0) return; if (_Object$keys(childNodesObj).length == 1 && options.clusterNodeProperties.allowSingleNodeCluster != true) return; let clusterNodeProperties = deepExtend({}, options.clusterNodeProperties); if (options.processProperties !== void 0) { const childNodesOptions = []; for (const nodeId in childNodesObj) if (Object.prototype.hasOwnProperty.call(childNodesObj, nodeId)) { const clonedOptions = NetworkUtil.cloneOptions(childNodesObj[nodeId]); childNodesOptions.push(clonedOptions); } const childEdgesOptions = []; for (const edgeId in childEdgesObj) if (Object.prototype.hasOwnProperty.call(childEdgesObj, edgeId)) { if (edgeId.substr(0, 12) !== "clusterEdge:") { const clonedOptions = NetworkUtil.cloneOptions(childEdgesObj[edgeId], "edge"); childEdgesOptions.push(clonedOptions); } } clusterNodeProperties = options.processProperties(clusterNodeProperties, childNodesOptions, childEdgesOptions); if (!clusterNodeProperties) throw new Error("The processProperties function does not return properties!"); } if (clusterNodeProperties.id === void 0) clusterNodeProperties.id = "cluster:" + v4(); const clusterId = clusterNodeProperties.id; if (clusterNodeProperties.label === void 0) clusterNodeProperties.label = "cluster"; let pos = void 0; if (clusterNodeProperties.x === void 0) { pos = this._getClusterPosition(childNodesObj); clusterNodeProperties.x = pos.x; } if (clusterNodeProperties.y === void 0) { if (pos === void 0) pos = this._getClusterPosition(childNodesObj); clusterNodeProperties.y = pos.y; } clusterNodeProperties.id = clusterId; const clusterNode = this.body.functions.createNode(clusterNodeProperties, Cluster); clusterNode.containedNodes = childNodesObj; clusterNode.containedEdges = childEdgesObj; clusterNode.clusterEdgeProperties = options.clusterEdgeProperties; this.body.nodes[clusterNodeProperties.id] = clusterNode; this._clusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, options.clusterEdgeProperties); clusterNodeProperties.id = void 0; if (refreshData === true) this.body.emitter.emit("_dataChanged"); } /** * * @param {Edge} edge * @private */ _backupEdgeOptions(edge) { if (this.clusteredEdges[edge.id] === void 0) this.clusteredEdges[edge.id] = { physics: edge.options.physics }; } /** * * @param {Edge} edge * @private */ _restoreEdge(edge) { const originalOptions = this.clusteredEdges[edge.id]; if (originalOptions !== void 0) { edge.setOptions({ physics: originalOptions.physics }); delete this.clusteredEdges[edge.id]; } } /** * Check if a node is a cluster. * @param {Node.id} nodeId * @returns {*} */ isCluster(nodeId) { if (this.body.nodes[nodeId] !== void 0) return this.body.nodes[nodeId].isCluster === true; else { console.error("Node does not exist."); return false; } } /** * get the position of the cluster node based on what's inside * @param {object} childNodesObj | object with node objects, id as keys * @returns {{x: number, y: number}} * @private */ _getClusterPosition(childNodesObj) { const childKeys = _Object$keys(childNodesObj); let minX = childNodesObj[childKeys[0]].x; let maxX = childNodesObj[childKeys[0]].x; let minY = childNodesObj[childKeys[0]].y; let maxY = childNodesObj[childKeys[0]].y; let node; for (let i = 1; i < childKeys.length; i++) { node = childNodesObj[childKeys[i]]; minX = node.x < minX ? node.x : minX; maxX = node.x > maxX ? node.x : maxX; minY = node.y < minY ? node.y : minY; maxY = node.y > maxY ? node.y : maxY; } return { x: .5 * (minX + maxX), y: .5 * (minY + maxY) }; } /** * Open a cluster by calling this function. * @param {vis.Edge.id} clusterNodeId | the ID of the cluster node * @param {object} options * @param {boolean} refreshData | wrap up afterwards if not true */ openCluster(clusterNodeId, options) { let refreshData = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; if (clusterNodeId === void 0) throw new Error("No clusterNodeId supplied to openCluster."); const clusterNode = this.body.nodes[clusterNodeId]; if (clusterNode === void 0) throw new Error("The clusterNodeId supplied to openCluster does not exist."); if (clusterNode.isCluster !== true || clusterNode.containedNodes === void 0 || clusterNode.containedEdges === void 0) throw new Error("The node:" + clusterNodeId + " is not a valid cluster."); const stack = this.findNode(clusterNodeId); const parentIndex = _indexOfInstanceProperty(stack).call(stack, clusterNodeId) - 1; if (parentIndex >= 0) { const parentClusterNodeId = stack[parentIndex]; const parentClusterNode = this.body.nodes[parentClusterNodeId]; parentClusterNode._openChildCluster(clusterNodeId); delete this.body.nodes[clusterNodeId]; if (refreshData === true) this.body.emitter.emit("_dataChanged"); return; } const containedNodes = clusterNode.containedNodes; const containedEdges = clusterNode.containedEdges; if (options !== void 0 && options.releaseFunction !== void 0 && typeof options.releaseFunction === "function") { const positions = {}; const clusterPosition = { x: clusterNode.x, y: clusterNode.y }; for (const nodeId in containedNodes) if (Object.prototype.hasOwnProperty.call(containedNodes, nodeId)) { const containedNode = this.body.nodes[nodeId]; positions[nodeId] = { x: containedNode.x, y: containedNode.y }; } const newPositions = options.releaseFunction(clusterPosition, positions); for (const nodeId in containedNodes) if (Object.prototype.hasOwnProperty.call(containedNodes, nodeId)) { const containedNode = this.body.nodes[nodeId]; if (newPositions[nodeId] !== void 0) { containedNode.x = newPositions[nodeId].x === void 0 ? clusterNode.x : newPositions[nodeId].x; containedNode.y = newPositions[nodeId].y === void 0 ? clusterNode.y : newPositions[nodeId].y; } } } else forEach$4(containedNodes, function(containedNode) { if (containedNode.options.fixed.x === false) containedNode.x = clusterNode.x; if (containedNode.options.fixed.y === false) containedNode.y = clusterNode.y; }); for (const nodeId in containedNodes) if (Object.prototype.hasOwnProperty.call(containedNodes, nodeId)) { const containedNode = this.body.nodes[nodeId]; containedNode.vx = clusterNode.vx; containedNode.vy = clusterNode.vy; containedNode.setOptions({ physics: true }); delete this.clusteredNodes[nodeId]; } const edgesToBeDeleted = []; for (let i = 0; i < clusterNode.edges.length; i++) edgesToBeDeleted.push(clusterNode.edges[i]); for (let i = 0; i < edgesToBeDeleted.length; i++) { const edge = edgesToBeDeleted[i]; const otherNodeId = this._getConnectedId(edge, clusterNodeId); const otherNode = this.clusteredNodes[otherNodeId]; for (let j = 0; j < edge.clusteringEdgeReplacingIds.length; j++) { const transferId = edge.clusteringEdgeReplacingIds[j]; const transferEdge = this.body.edges[transferId]; if (transferEdge === void 0) continue; if (otherNode !== void 0) { const otherCluster = this.body.nodes[otherNode.clusterId]; otherCluster.containedEdges[transferEdge.id] = transferEdge; delete containedEdges[transferEdge.id]; let fromId = transferEdge.fromId; let toId = transferEdge.toId; if (transferEdge.toId == otherNodeId) toId = otherNode.clusterId; else fromId = otherNode.clusterId; this._createClusteredEdge(fromId, toId, transferEdge, otherCluster.clusterEdgeProperties, { hidden: false, physics: true }); } else this._restoreEdge(transferEdge); } edge.remove(); } for (const edgeId in containedEdges) if (Object.prototype.hasOwnProperty.call(containedEdges, edgeId)) this._restoreEdge(containedEdges[edgeId]); delete this.body.nodes[clusterNodeId]; if (refreshData === true) this.body.emitter.emit("_dataChanged"); } /** * * @param {Cluster.id} clusterId * @returns {Array.} */ getNodesInCluster(clusterId) { const nodesArray = []; if (this.isCluster(clusterId) === true) { const containedNodes = this.body.nodes[clusterId].containedNodes; for (const nodeId in containedNodes) if (Object.prototype.hasOwnProperty.call(containedNodes, nodeId)) nodesArray.push(this.body.nodes[nodeId].id); } return nodesArray; } /** * Get the stack clusterId's that a certain node resides in. cluster A -> cluster B -> cluster C -> node * * If a node can't be found in the chain, return an empty array. * @param {string|number} nodeId * @returns {Array} */ findNode(nodeId) { const stack = []; const max = 100; let counter = 0; let node; while (this.clusteredNodes[nodeId] !== void 0 && counter < max) { node = this.body.nodes[nodeId]; if (node === void 0) return []; stack.push(node.id); nodeId = this.clusteredNodes[nodeId].clusterId; counter++; } node = this.body.nodes[nodeId]; if (node === void 0) return []; stack.push(node.id); _reverseInstanceProperty(stack).call(stack); return stack; } /** * Using a clustered nodeId, update with the new options * @param {Node.id} clusteredNodeId * @param {object} newOptions */ updateClusteredNode(clusteredNodeId, newOptions) { if (clusteredNodeId === void 0) throw new Error("No clusteredNodeId supplied to updateClusteredNode."); if (newOptions === void 0) throw new Error("No newOptions supplied to updateClusteredNode."); if (this.body.nodes[clusteredNodeId] === void 0) throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist."); this.body.nodes[clusteredNodeId].setOptions(newOptions); this.body.emitter.emit("_dataChanged"); } /** * Using a base edgeId, update all related clustered edges with the new options * @param {vis.Edge.id} startEdgeId * @param {object} newOptions */ updateEdge(startEdgeId, newOptions) { if (startEdgeId === void 0) throw new Error("No startEdgeId supplied to updateEdge."); if (newOptions === void 0) throw new Error("No newOptions supplied to updateEdge."); if (this.body.edges[startEdgeId] === void 0) throw new Error("The startEdgeId supplied to updateEdge does not exist."); const allEdgeIds = this.getClusteredEdges(startEdgeId); for (let i = 0; i < allEdgeIds.length; i++) { const edge = this.body.edges[allEdgeIds[i]]; edge.setOptions(newOptions); } this.body.emitter.emit("_dataChanged"); } /** * Get a stack of clusterEdgeId's (+base edgeid) that a base edge is the same as. cluster edge C -> cluster edge B -> cluster edge A -> base edge(edgeId) * @param {vis.Edge.id} edgeId * @returns {Array.} */ getClusteredEdges(edgeId) { const stack = []; const max = 100; let counter = 0; while (edgeId !== void 0 && this.body.edges[edgeId] !== void 0 && counter < max) { stack.push(this.body.edges[edgeId].id); edgeId = this.body.edges[edgeId].edgeReplacedById; counter++; } _reverseInstanceProperty(stack).call(stack); return stack; } /** * Get the base edge id of clusterEdgeId. cluster edge (clusteredEdgeId) -> cluster edge B -> cluster edge C -> base edge * @param {vis.Edge.id} clusteredEdgeId * @returns {vis.Edge.id} baseEdgeId * * TODO: deprecate in 5.0.0. Method getBaseEdges() is the correct one to use. */ getBaseEdge(clusteredEdgeId) { return this.getBaseEdges(clusteredEdgeId)[0]; } /** * Get all regular edges for this clustered edge id. * @param {vis.Edge.id} clusteredEdgeId * @returns {Array.} all baseEdgeId's under this clustered edge */ getBaseEdges(clusteredEdgeId) { const IdsToHandle = [clusteredEdgeId]; const doneIds = []; const foundIds = []; const max = 100; let counter = 0; while (IdsToHandle.length > 0 && counter < max) { const nextId = IdsToHandle.pop(); if (nextId === void 0) continue; const nextEdge = this.body.edges[nextId]; if (nextEdge === void 0) continue; counter++; const replacingIds = nextEdge.clusteringEdgeReplacingIds; if (replacingIds === void 0) foundIds.push(nextId); else for (let i = 0; i < replacingIds.length; ++i) { const replacingId = replacingIds[i]; if (_indexOfInstanceProperty(IdsToHandle).call(IdsToHandle, replacingIds) !== -1 || _indexOfInstanceProperty(doneIds).call(doneIds, replacingIds) !== -1) continue; IdsToHandle.push(replacingId); } doneIds.push(nextId); } return foundIds; } /** * Get the Id the node is connected to * @param {vis.Edge} edge * @param {Node.id} nodeId * @returns {*} * @private */ _getConnectedId(edge, nodeId) { if (edge.toId != nodeId) return edge.toId; else if (edge.fromId != nodeId) return edge.fromId; else return edge.fromId; } /** * We determine how many connections denote an important hub. * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%) * @returns {number} * @private */ _getHubSize() { let average = 0; let averageSquared = 0; let hubCounter = 0; let largestHub = 0; for (let i = 0; i < this.body.nodeIndices.length; i++) { const node = this.body.nodes[this.body.nodeIndices[i]]; if (node.edges.length > largestHub) largestHub = node.edges.length; average += node.edges.length; averageSquared += Math.pow(node.edges.length, 2); hubCounter += 1; } average = average / hubCounter; averageSquared = averageSquared / hubCounter; const variance = averageSquared - Math.pow(average, 2); const standardDeviation = Math.sqrt(variance); let hubThreshold = Math.floor(average + 2 * standardDeviation); if (hubThreshold > largestHub) hubThreshold = largestHub; return hubThreshold; } /** * Create an edge for the cluster representation. * @param {Node.id} fromId * @param {Node.id} toId * @param {vis.Edge} baseEdge * @param {object} clusterEdgeProperties * @param {object} extraOptions * @returns {Edge} newly created clustered edge * @private */ _createClusteredEdge(fromId, toId, baseEdge, clusterEdgeProperties, extraOptions) { const clonedOptions = NetworkUtil.cloneOptions(baseEdge, "edge"); deepExtend(clonedOptions, clusterEdgeProperties); clonedOptions.from = fromId; clonedOptions.to = toId; clonedOptions.id = "clusterEdge:" + v4(); if (extraOptions !== void 0) deepExtend(clonedOptions, extraOptions); const newEdge = this.body.functions.createEdge(clonedOptions); newEdge.clusteringEdgeReplacingIds = [baseEdge.id]; newEdge.connect(); this.body.edges[newEdge.id] = newEdge; return newEdge; } /** * Add the passed child nodes and edges to the given cluster node. * @param {object | Node} childNodes hash of nodes or single node to add in cluster * @param {object | Edge} childEdges hash of edges or single edge to take into account when clustering * @param {Node} clusterNode cluster node to add nodes and edges to * @param {object} [clusterEdgeProperties] * @private */ _clusterEdges(childNodes, childEdges, clusterNode, clusterEdgeProperties) { if (childEdges instanceof Edge) { const edge = childEdges; const obj = {}; obj[edge.id] = edge; childEdges = obj; } if (childNodes instanceof Node) { const node = childNodes; const obj = {}; obj[node.id] = node; childNodes = obj; } if (clusterNode === void 0 || clusterNode === null) throw new Error("_clusterEdges: parameter clusterNode required"); if (clusterEdgeProperties === void 0) clusterEdgeProperties = clusterNode.clusterEdgeProperties; this._createClusterEdges(childNodes, childEdges, clusterNode, clusterEdgeProperties); for (const edgeId in childEdges) if (Object.prototype.hasOwnProperty.call(childEdges, edgeId)) { if (this.body.edges[edgeId] !== void 0) { const edge = this.body.edges[edgeId]; this._backupEdgeOptions(edge); edge.setOptions({ physics: false }); } } for (const nodeId in childNodes) if (Object.prototype.hasOwnProperty.call(childNodes, nodeId)) { this.clusteredNodes[nodeId] = { clusterId: clusterNode.id, node: this.body.nodes[nodeId] }; this.body.nodes[nodeId].setOptions({ physics: false }); } } /** * Determine in which cluster given nodeId resides. * * If not in cluster, return undefined. * * NOTE: If you know a cleaner way to do this, please enlighten me (wimrijnders). * @param {Node.id} nodeId * @returns {Node|undefined} Node instance for cluster, if present * @private */ _getClusterNodeForNode(nodeId) { if (nodeId === void 0) return void 0; const clusteredNode = this.clusteredNodes[nodeId]; if (clusteredNode === void 0) return void 0; const clusterId = clusteredNode.clusterId; if (clusterId === void 0) return void 0; return this.body.nodes[clusterId]; } /** * Internal helper function for conditionally removing items in array * * Done like this because Array.filter() is not fully supported by all IE's. * @param {Array} arr * @param {Function} callback * @returns {Array} * @private */ _filter(arr, callback) { const ret = []; forEach$4(arr, (item) => { if (callback(item)) ret.push(item); }); return ret; } /** * Scan all edges for changes in clustering and adjust this if necessary. * * Call this (internally) after there has been a change in node or edge data. * * Pre: States of this.body.nodes and this.body.edges consistent * Pre: this.clusteredNodes and this.clusteredEdge consistent with containedNodes and containedEdges * of cluster nodes. */ _updateState() { let nodeId; const deletedNodeIds = []; const deletedEdgeIds = {}; /** * Utility function to iterate over clustering nodes only * @param {Function} callback function to call for each cluster node */ const eachClusterNode = (callback) => { forEach$4(this.body.nodes, (node) => { if (node.isCluster === true) callback(node); }); }; for (nodeId in this.clusteredNodes) { if (!Object.prototype.hasOwnProperty.call(this.clusteredNodes, nodeId)) continue; const node = this.body.nodes[nodeId]; if (node === void 0) deletedNodeIds.push(nodeId); } eachClusterNode(function(clusterNode) { for (let n = 0; n < deletedNodeIds.length; n++) delete clusterNode.containedNodes[deletedNodeIds[n]]; }); for (let n = 0; n < deletedNodeIds.length; n++) delete this.clusteredNodes[deletedNodeIds[n]]; forEach$4(this.clusteredEdges, (edgeId) => { const edge = this.body.edges[edgeId]; if (edge === void 0 || !edge.endPointsValid()) deletedEdgeIds[edgeId] = edgeId; }); eachClusterNode(function(clusterNode) { forEach$4(clusterNode.containedEdges, (edge, edgeId) => { if (!edge.endPointsValid() && !deletedEdgeIds[edgeId]) deletedEdgeIds[edgeId] = edgeId; }); }); forEach$4(this.body.edges, (edge, edgeId) => { let isValid = true; const replacedIds = edge.clusteringEdgeReplacingIds; if (replacedIds !== void 0) { let numValid = 0; forEach$4(replacedIds, (containedEdgeId) => { const containedEdge = this.body.edges[containedEdgeId]; if (containedEdge !== void 0 && containedEdge.endPointsValid()) numValid += 1; }); isValid = numValid > 0; } if (!edge.endPointsValid() || !isValid) deletedEdgeIds[edgeId] = edgeId; }); eachClusterNode((clusterNode) => { forEach$4(deletedEdgeIds, (deletedEdgeId) => { delete clusterNode.containedEdges[deletedEdgeId]; forEach$4(clusterNode.edges, (edge, m) => { if (edge.id === deletedEdgeId) { clusterNode.edges[m] = null; return; } edge.clusteringEdgeReplacingIds = this._filter(edge.clusteringEdgeReplacingIds, function(id) { return !deletedEdgeIds[id]; }); }); clusterNode.edges = this._filter(clusterNode.edges, function(item) { return item !== null; }); }); }); forEach$4(deletedEdgeIds, (edgeId) => { delete this.clusteredEdges[edgeId]; }); forEach$4(deletedEdgeIds, (edgeId) => { delete this.body.edges[edgeId]; }); const ids = _Object$keys(this.body.edges); forEach$4(ids, (edgeId) => { const edge = this.body.edges[edgeId]; const shouldBeClustered = this._isClusteredNode(edge.fromId) || this._isClusteredNode(edge.toId); if (shouldBeClustered === this._isClusteredEdge(edge.id)) return; if (shouldBeClustered) { const clusterFrom = this._getClusterNodeForNode(edge.fromId); if (clusterFrom !== void 0) this._clusterEdges(this.body.nodes[edge.fromId], edge, clusterFrom); const clusterTo = this._getClusterNodeForNode(edge.toId); if (clusterTo !== void 0) this._clusterEdges(this.body.nodes[edge.toId], edge, clusterTo); } else { delete this._clusterEdges[edgeId]; this._restoreEdge(edge); } }); let changed = false; let continueLoop = true; while (continueLoop) { const clustersToOpen = []; eachClusterNode(function(clusterNode) { const numNodes = _Object$keys(clusterNode.containedNodes).length; const allowSingle = clusterNode.options.allowSingleNodeCluster === true; if (allowSingle && numNodes < 1 || !allowSingle && numNodes < 2) clustersToOpen.push(clusterNode.id); }); for (let n = 0; n < clustersToOpen.length; ++n) this.openCluster( clustersToOpen[n], {}, false /* Don't refresh, we're in an refresh/update already */ ); continueLoop = clustersToOpen.length > 0; changed = changed || continueLoop; } if (changed) this._updateState(); } /** * Determine if node with given id is part of a cluster. * @param {Node.id} nodeId * @returns {boolean} true if part of a cluster. */ _isClusteredNode(nodeId) { return this.clusteredNodes[nodeId] !== void 0; } /** * Determine if edge with given id is not visible due to clustering. * * An edge is considered clustered if: * - it is directly replaced by a clustering edge * - any of its connecting nodes is in a cluster * @param {vis.Edge.id} edgeId * @returns {boolean} true if part of a cluster. */ _isClusteredEdge(edgeId) { return this.clusteredEdges[edgeId] !== void 0; } }; var CanvasRenderer = class { /** * @param {object} body * @param {Canvas} canvas */ constructor(body, canvas) { this.body = body; this.canvas = canvas; this.redrawRequested = false; this.requestAnimationFrameRequestId = void 0; this.renderingActive = false; this.renderRequests = 0; this.allowRedraw = true; this.dragging = false; this.zooming = false; this.options = {}; this.defaultOptions = { hideEdgesOnDrag: false, hideEdgesOnZoom: false, hideNodesOnDrag: false }; _Object$assign(this.options, this.defaultOptions); this.bindEventListeners(); } /** * Binds event listeners */ bindEventListeners() { var _context2; this.body.emitter.on("dragStart", () => { this.dragging = true; }); this.body.emitter.on("dragEnd", () => { this.dragging = false; }); this.body.emitter.on("zoom", () => { this.zooming = true; window.clearTimeout(this.zoomTimeoutId); this.zoomTimeoutId = _setTimeout(() => { var _context; this.zooming = false; _bindInstanceProperty(_context = this._requestRedraw).call(_context, this)(); }, 250); }); this.body.emitter.on("_resizeNodes", () => { this._resizeNodes(); }); this.body.emitter.on("_redraw", () => { if (this.renderingActive === false) this._redraw(); }); this.body.emitter.on("_blockRedraw", () => { this.allowRedraw = false; }); this.body.emitter.on("_allowRedraw", () => { this.allowRedraw = true; this.redrawRequested = false; }); this.body.emitter.on("_requestRedraw", _bindInstanceProperty(_context2 = this._requestRedraw).call(_context2, this)); this.body.emitter.on("_startRendering", () => { this.renderRequests += 1; this.renderingActive = true; this._startRendering(); }); this.body.emitter.on("_stopRendering", () => { this.renderRequests -= 1; this.renderingActive = this.renderRequests > 0; this.requestAnimationFrameRequestId = void 0; }); this.body.emitter.on("destroy", () => { this.renderRequests = 0; this.allowRedraw = false; this.renderingActive = false; window.cancelAnimationFrame(this.requestAnimationFrameRequestId); this.body.emitter.off(); }); } /** * * @param {object} options */ setOptions(options) { if (options !== void 0) { const fields = [ "hideEdgesOnDrag", "hideEdgesOnZoom", "hideNodesOnDrag" ]; selectiveDeepExtend(fields, this.options, options); } } /** * * @private */ _startRendering() { if (this.renderingActive === true) { if (this.requestAnimationFrameRequestId === void 0) { var _context3; this.requestAnimationFrameRequestId = window.requestAnimationFrame(_bindInstanceProperty(_context3 = this._renderStep).call(_context3, this), this.simulationInterval); } } } /** * * @private */ _renderStep() { if (this.renderingActive === true) { this.requestAnimationFrameRequestId = void 0; this._startRendering(); this._redraw(); } } /** * Redraw the network with the current data * chart will be resized too. */ redraw() { this.body.emitter.emit("setSize"); this._redraw(); } /** * Redraw the network with the current data * @private */ _requestRedraw() { if (this.redrawRequested !== true && this.renderingActive === false && this.allowRedraw === true) { this.redrawRequested = true; window.requestAnimationFrame(() => { this._redraw(false); }); } } /** * Redraw the network with the current data * @param {boolean} [hidden] | Used to get the first estimate of the node sizes. * Only the nodes are drawn after which they are quickly drawn over. * @private */ _redraw() { let hidden = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; if (this.allowRedraw === true) { this.body.emitter.emit("initRedraw"); this.redrawRequested = false; const drawLater = { drawExternalLabels: null }; if (this.canvas.frame.canvas.width === 0 || this.canvas.frame.canvas.height === 0) this.canvas.setSize(); this.canvas.setTransform(); const ctx = this.canvas.getContext(); const w = this.canvas.frame.canvas.clientWidth; const h = this.canvas.frame.canvas.clientHeight; ctx.clearRect(0, 0, w, h); if (this.canvas.frame.clientWidth === 0) return; ctx.save(); ctx.translate(this.body.view.translation.x, this.body.view.translation.y); ctx.scale(this.body.view.scale, this.body.view.scale); ctx.beginPath(); this.body.emitter.emit("beforeDrawing", ctx); ctx.closePath(); if (hidden === false) { if ((this.dragging === false || this.dragging === true && this.options.hideEdgesOnDrag === false) && (this.zooming === false || this.zooming === true && this.options.hideEdgesOnZoom === false)) this._drawEdges(ctx); } if (this.dragging === false || this.dragging === true && this.options.hideNodesOnDrag === false) { const { drawExternalLabels } = this._drawNodes(ctx, hidden); drawLater.drawExternalLabels = drawExternalLabels; } if (hidden === false) { if ((this.dragging === false || this.dragging === true && this.options.hideEdgesOnDrag === false) && (this.zooming === false || this.zooming === true && this.options.hideEdgesOnZoom === false)) this._drawArrows(ctx); } if (drawLater.drawExternalLabels != null) drawLater.drawExternalLabels(); if (hidden === false) this._drawSelectionBox(ctx); ctx.beginPath(); this.body.emitter.emit("afterDrawing", ctx); ctx.closePath(); ctx.restore(); if (hidden === true) ctx.clearRect(0, 0, w, h); } } /** * Redraw all nodes * @param {CanvasRenderingContext2D} ctx * @param {boolean} [alwaysShow] * @private */ _resizeNodes() { this.canvas.setTransform(); const ctx = this.canvas.getContext(); ctx.save(); ctx.translate(this.body.view.translation.x, this.body.view.translation.y); ctx.scale(this.body.view.scale, this.body.view.scale); const nodes = this.body.nodes; let node; for (const nodeId in nodes) if (Object.prototype.hasOwnProperty.call(nodes, nodeId)) { node = nodes[nodeId]; node.resize(ctx); node.updateBoundingBox(ctx, node.selected); } ctx.restore(); } /** * Redraw all nodes * @param {CanvasRenderingContext2D} ctx 2D context of a HTML canvas * @param {boolean} [alwaysShow] * @private * @returns {object} Callbacks to draw later on higher layers. */ _drawNodes(ctx) { let alwaysShow = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; const nodes = this.body.nodes; const nodeIndices = this.body.nodeIndices; let node; const selected = []; const hovered = []; const margin = 20; const topLeft = this.canvas.DOMtoCanvas({ x: -margin, y: -margin }); const bottomRight = this.canvas.DOMtoCanvas({ x: this.canvas.frame.canvas.clientWidth + margin, y: this.canvas.frame.canvas.clientHeight + margin }); const viewableArea = { top: topLeft.y, left: topLeft.x, bottom: bottomRight.y, right: bottomRight.x }; const drawExternalLabels = []; for (let i$1 = 0; i$1 < nodeIndices.length; i$1++) { node = nodes[nodeIndices[i$1]]; if (node.hover) hovered.push(nodeIndices[i$1]); else if (node.isSelected()) selected.push(nodeIndices[i$1]); else if (alwaysShow === true) { const drawLater = node.draw(ctx); if (drawLater.drawExternalLabel != null) drawExternalLabels.push(drawLater.drawExternalLabel); } else if (node.isBoundingBoxOverlappingWith(viewableArea) === true) { const drawLater = node.draw(ctx); if (drawLater.drawExternalLabel != null) drawExternalLabels.push(drawLater.drawExternalLabel); } else node.updateBoundingBox(ctx, node.selected); } let i; const selectedLength = selected.length; const hoveredLength = hovered.length; for (i = 0; i < selectedLength; i++) { node = nodes[selected[i]]; const drawLater = node.draw(ctx); if (drawLater.drawExternalLabel != null) drawExternalLabels.push(drawLater.drawExternalLabel); } for (i = 0; i < hoveredLength; i++) { node = nodes[hovered[i]]; const drawLater = node.draw(ctx); if (drawLater.drawExternalLabel != null) drawExternalLabels.push(drawLater.drawExternalLabel); } return { drawExternalLabels: () => { for (const draw of drawExternalLabels) draw(); } }; } /** * Redraw all edges * @param {CanvasRenderingContext2D} ctx 2D context of a HTML canvas * @private */ _drawEdges(ctx) { const edges = this.body.edges; const edgeIndices = this.body.edgeIndices; for (let i = 0; i < edgeIndices.length; i++) { const edge = edges[edgeIndices[i]]; if (edge.connected === true) edge.draw(ctx); } } /** * Redraw all arrows * @param {CanvasRenderingContext2D} ctx 2D context of a HTML canvas * @private */ _drawArrows(ctx) { const edges = this.body.edges; const edgeIndices = this.body.edgeIndices; for (let i = 0; i < edgeIndices.length; i++) { const edge = edges[edgeIndices[i]]; if (edge.connected === true) edge.drawArrows(ctx); } } /** * Redraw selection box * @param {CanvasRenderingContext2D} ctx 2D context of a HTML canvas * @private */ _drawSelectionBox(ctx) { if (this.body.selectionBox.show) { ctx.beginPath(); const width = this.body.selectionBox.position.end.x - this.body.selectionBox.position.start.x; const height = this.body.selectionBox.position.end.y - this.body.selectionBox.position.start.y; ctx.rect(this.body.selectionBox.position.start.x, this.body.selectionBox.position.start.y, width, height); ctx.fillStyle = "rgba(151, 194, 252, 0.2)"; ctx.fillRect(this.body.selectionBox.position.start.x, this.body.selectionBox.position.start.y, width, height); ctx.strokeStyle = "rgba(151, 194, 252, 1)"; ctx.stroke(); } else ctx.closePath(); } }; var setInterval$1; var hasRequiredSetInterval$1; function requireSetInterval$1() { if (hasRequiredSetInterval$1) return setInterval$1; hasRequiredSetInterval$1 = 1; requireWeb_timers(); var path$2 = /* @__PURE__ */ requirePath(); setInterval$1 = path$2.setInterval; return setInterval$1; } var setInterval; var hasRequiredSetInterval; function requireSetInterval() { if (hasRequiredSetInterval) return setInterval; hasRequiredSetInterval = 1; setInterval = /* @__PURE__ */ requireSetInterval$1(); return setInterval; } var setIntervalExports = requireSetInterval(); var _setInterval = /* @__PURE__ */ getDefaultExportFromCjs(setIntervalExports); /** * Register a touch event, taking place before a gesture * @param {Hammer} hammer A hammer instance * @param {Function} callback Callback, called as callback(event) */ function onTouch(hammer, callback) { callback.inputHandler = function(event) { if (event.isFirst) callback(event); }; hammer.on("hammer.input", callback.inputHandler); } /** * Register a release event, taking place after a gesture * @param {Hammer} hammer A hammer instance * @param {Function} callback Callback, called as callback(event) * @returns {*} */ function onRelease(hammer, callback) { callback.inputHandler = function(event) { if (event.isFinal) callback(event); }; return hammer.on("hammer.input", callback.inputHandler); } var Canvas = class { /** * @param {object} body */ constructor(body) { this.body = body; this.pixelRatio = 1; this.cameraState = {}; this.initialized = false; this.canvasViewCenter = {}; this._cleanupCallbacks = []; this.options = {}; this.defaultOptions = { autoResize: true, height: "100%", width: "100%" }; _Object$assign(this.options, this.defaultOptions); this.bindEventListeners(); } /** * Binds event listeners */ bindEventListeners() { var _context; this.body.emitter.once("resize", (obj) => { if (obj.width !== 0) this.body.view.translation.x = obj.width * .5; if (obj.height !== 0) this.body.view.translation.y = obj.height * .5; }); this.body.emitter.on("setSize", _bindInstanceProperty(_context = this.setSize).call(_context, this)); this.body.emitter.on("destroy", () => { this.hammerFrame.destroy(); this.hammer.destroy(); this._cleanUp(); }); } /** * @param {object} options */ setOptions(options) { if (options !== void 0) { const fields = [ "width", "height", "autoResize" ]; selectiveDeepExtend(fields, this.options, options); } this._cleanUp(); if (this.options.autoResize === true) { var _context2; if (window.ResizeObserver) { const observer = new ResizeObserver(() => { const changed = this.setSize(); if (changed === true) this.body.emitter.emit("_requestRedraw"); }); const { frame } = this; observer.observe(frame); this._cleanupCallbacks.push(() => { observer.unobserve(frame); }); } else { const resizeTimer = _setInterval(() => { const changed = this.setSize(); if (changed === true) this.body.emitter.emit("_requestRedraw"); }, 1e3); this._cleanupCallbacks.push(() => { clearInterval(resizeTimer); }); } const resizeFunction = _bindInstanceProperty(_context2 = this._onResize).call(_context2, this); window.addEventListener("resize", resizeFunction); this._cleanupCallbacks.push(() => { window.removeEventListener("resize", resizeFunction); }); } } /** * @private */ _cleanUp() { var _context3, _context4, _context5; _forEachInstanceProperty(_context3 = _reverseInstanceProperty(_context4 = _spliceInstanceProperty(_context5 = this._cleanupCallbacks).call(_context5, 0)).call(_context4)).call(_context3, (callback) => { try { callback(); } catch (error) { console.error(error); } }); } /** * @private */ _onResize() { this.setSize(); this.body.emitter.emit("_redraw"); } /** * Get and store the cameraState * @param {number} [pixelRatio] * @private */ _getCameraState() { let pixelRatio = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.pixelRatio; if (this.initialized === true) { this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio; this.cameraState.previousHeight = this.frame.canvas.height / pixelRatio; this.cameraState.scale = this.body.view.scale; this.cameraState.position = this.DOMtoCanvas({ x: .5 * this.frame.canvas.width / pixelRatio, y: .5 * this.frame.canvas.height / pixelRatio }); } } /** * Set the cameraState * @private */ _setCameraState() { if (this.cameraState.scale !== void 0 && this.frame.canvas.clientWidth !== 0 && this.frame.canvas.clientHeight !== 0 && this.pixelRatio !== 0 && this.cameraState.previousWidth > 0 && this.cameraState.previousHeight > 0) { const widthRatio = this.frame.canvas.width / this.pixelRatio / this.cameraState.previousWidth; const heightRatio = this.frame.canvas.height / this.pixelRatio / this.cameraState.previousHeight; let newScale = this.cameraState.scale; if (widthRatio != 1 && heightRatio != 1) newScale = this.cameraState.scale * .5 * (widthRatio + heightRatio); else if (widthRatio != 1) newScale = this.cameraState.scale * widthRatio; else if (heightRatio != 1) newScale = this.cameraState.scale * heightRatio; this.body.view.scale = newScale; const currentViewCenter = this.DOMtoCanvas({ x: .5 * this.frame.canvas.clientWidth, y: .5 * this.frame.canvas.clientHeight }); const distanceFromCenter = { x: currentViewCenter.x - this.cameraState.position.x, y: currentViewCenter.y - this.cameraState.position.y }; this.body.view.translation.x += distanceFromCenter.x * this.body.view.scale; this.body.view.translation.y += distanceFromCenter.y * this.body.view.scale; } } /** * * @param {number|string} value * @returns {string} * @private */ _prepareValue(value) { if (typeof value === "number") return value + "px"; else if (typeof value === "string") { if (_indexOfInstanceProperty(value).call(value, "%") !== -1 || _indexOfInstanceProperty(value).call(value, "px") !== -1) return value; else if (_indexOfInstanceProperty(value).call(value, "%") === -1) return value + "px"; } throw new Error("Could not use the value supplied for width or height:" + value); } /** * Create the HTML */ _create() { while (this.body.container.hasChildNodes()) this.body.container.removeChild(this.body.container.firstChild); this.frame = document.createElement("div"); this.frame.className = "vis-network"; this.frame.style.position = "relative"; this.frame.style.overflow = "hidden"; this.frame.tabIndex = 0; this.frame.canvas = document.createElement("canvas"); this.frame.canvas.style.position = "relative"; this.frame.appendChild(this.frame.canvas); if (!this.frame.canvas.getContext) { const noCanvas = document.createElement("DIV"); noCanvas.style.color = "red"; noCanvas.style.fontWeight = "bold"; noCanvas.style.padding = "10px"; noCanvas.innerText = "Error: your browser does not support HTML canvas"; this.frame.canvas.appendChild(noCanvas); } else { this._setPixelRatio(); this.setTransform(); } this.body.container.appendChild(this.frame); this.body.view.scale = 1; this.body.view.translation = { x: .5 * this.frame.canvas.clientWidth, y: .5 * this.frame.canvas.clientHeight }; this._bindHammer(); } /** * This function binds hammer, it can be repeated over and over due to the uniqueness check. * @private */ _bindHammer() { if (this.hammer !== void 0) this.hammer.destroy(); this.drag = {}; this.pinch = {}; this.hammer = new Hammer(this.frame.canvas); this.hammer.get("pinch").set({ enable: true }); this.hammer.get("pan").set({ threshold: 5, direction: Hammer.DIRECTION_ALL }); onTouch(this.hammer, (event) => { this.body.eventListeners.onTouch(event); }); this.hammer.on("tap", (event) => { this.body.eventListeners.onTap(event); }); this.hammer.on("doubletap", (event) => { this.body.eventListeners.onDoubleTap(event); }); this.hammer.on("press", (event) => { this.body.eventListeners.onHold(event); }); this.hammer.on("panstart", (event) => { this.body.eventListeners.onDragStart(event); }); this.hammer.on("panmove", (event) => { this.body.eventListeners.onDrag(event); }); this.hammer.on("panend", (event) => { this.body.eventListeners.onDragEnd(event); }); this.hammer.on("pinch", (event) => { this.body.eventListeners.onPinch(event); }); this.frame.canvas.addEventListener("wheel", (event) => { this.body.eventListeners.onMouseWheel(event); }); this.frame.canvas.addEventListener("mousemove", (event) => { this.body.eventListeners.onMouseMove(event); }); this.frame.canvas.addEventListener("contextmenu", (event) => { this.body.eventListeners.onContext(event); }); this.hammerFrame = new Hammer(this.frame); onRelease(this.hammerFrame, (event) => { this.body.eventListeners.onRelease(event); }); } /** * Set a new size for the network * @param {string} width Width in pixels or percentage (for example '800px' * or '50%') * @param {string} height Height in pixels or percentage (for example '400px' * or '30%') * @returns {boolean} */ setSize() { let width = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.width; let height = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.height; width = this._prepareValue(width); height = this._prepareValue(height); let emitEvent = false; const oldWidth = this.frame.canvas.width; const oldHeight = this.frame.canvas.height; const previousRatio = this.pixelRatio; this._setPixelRatio(); if (width != this.options.width || height != this.options.height || this.frame.style.width != width || this.frame.style.height != height) { this._getCameraState(previousRatio); this.frame.style.width = width; this.frame.style.height = height; this.frame.canvas.style.width = "100%"; this.frame.canvas.style.height = "100%"; this.frame.canvas.width = Math.round(this.frame.canvas.clientWidth * this.pixelRatio); this.frame.canvas.height = Math.round(this.frame.canvas.clientHeight * this.pixelRatio); this.options.width = width; this.options.height = height; this.canvasViewCenter = { x: .5 * this.frame.clientWidth, y: .5 * this.frame.clientHeight }; emitEvent = true; } else { const newWidth = Math.round(this.frame.canvas.clientWidth * this.pixelRatio); const newHeight = Math.round(this.frame.canvas.clientHeight * this.pixelRatio); if (this.frame.canvas.width !== newWidth || this.frame.canvas.height !== newHeight) this._getCameraState(previousRatio); if (this.frame.canvas.width !== newWidth) { this.frame.canvas.width = newWidth; emitEvent = true; } if (this.frame.canvas.height !== newHeight) { this.frame.canvas.height = newHeight; emitEvent = true; } } if (emitEvent === true) { this.body.emitter.emit("resize", { width: Math.round(this.frame.canvas.width / this.pixelRatio), height: Math.round(this.frame.canvas.height / this.pixelRatio), oldWidth: Math.round(oldWidth / this.pixelRatio), oldHeight: Math.round(oldHeight / this.pixelRatio) }); this._setCameraState(); } this.initialized = true; return emitEvent; } /** * * @returns {CanvasRenderingContext2D} */ getContext() { return this.frame.canvas.getContext("2d"); } /** * Determine the pixel ratio for various browsers. * @returns {number} * @private */ _determinePixelRatio() { const ctx = this.getContext(); if (ctx === void 0) throw new Error("Could not get canvax context"); let numerator = 1; if (typeof window !== "undefined") numerator = window.devicePixelRatio || 1; const denominator = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1; return numerator / denominator; } /** * Lazy determination of pixel ratio. * @private */ _setPixelRatio() { this.pixelRatio = this._determinePixelRatio(); } /** * Set the transform in the contained context, based on its pixelRatio */ setTransform() { const ctx = this.getContext(); if (ctx === void 0) throw new Error("Could not get canvax context"); ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); } /** * Convert the X coordinate in DOM-space (coordinate point in browser relative to the container div) to * the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) * @param {number} x * @returns {number} * @private */ _XconvertDOMtoCanvas(x) { return (x - this.body.view.translation.x) / this.body.view.scale; } /** * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to * the X coordinate in DOM-space (coordinate point in browser relative to the container div) * @param {number} x * @returns {number} * @private */ _XconvertCanvasToDOM(x) { return x * this.body.view.scale + this.body.view.translation.x; } /** * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to * the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) * @param {number} y * @returns {number} * @private */ _YconvertDOMtoCanvas(y) { return (y - this.body.view.translation.y) / this.body.view.scale; } /** * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to * the Y coordinate in DOM-space (coordinate point in browser relative to the container div) * @param {number} y * @returns {number} * @private */ _YconvertCanvasToDOM(y) { return y * this.body.view.scale + this.body.view.translation.y; } /** * @param {point} pos * @returns {point} */ canvasToDOM(pos) { return { x: this._XconvertCanvasToDOM(pos.x), y: this._YconvertCanvasToDOM(pos.y) }; } /** * * @param {point} pos * @returns {point} */ DOMtoCanvas(pos) { return { x: this._XconvertDOMtoCanvas(pos.x), y: this._YconvertDOMtoCanvas(pos.y) }; } }; /** * Validate the fit options, replace missing optional values by defaults etc. * @param rawOptions - The raw options. * @param allNodeIds - All node ids that will be used if nodes are omitted in * the raw options. * @returns Options with everything filled in and validated. */ function normalizeFitOptions(rawOptions, allNodeIds) { const options = _Object$assign({ nodes: allNodeIds, minZoomLevel: Number.MIN_VALUE, maxZoomLevel: 1 }, rawOptions !== null && rawOptions !== void 0 ? rawOptions : {}); if (!_Array$isArray(options.nodes)) throw new TypeError("Nodes has to be an array of ids."); if (options.nodes.length === 0) options.nodes = allNodeIds; if (!(typeof options.minZoomLevel === "number" && options.minZoomLevel > 0)) throw new TypeError("Min zoom level has to be a number higher than zero."); if (!(typeof options.maxZoomLevel === "number" && options.minZoomLevel <= options.maxZoomLevel)) throw new TypeError("Max zoom level has to be a number higher than min zoom level."); return options; } var View = class { /** * @param {object} body * @param {Canvas} canvas */ constructor(body, canvas) { var _context, _context2; this.body = body; this.canvas = canvas; this.animationSpeed = 1 / this.renderRefreshRate; this.animationEasingFunction = "easeInOutQuint"; this.easingTime = 0; this.sourceScale = 0; this.targetScale = 0; this.sourceTranslation = 0; this.targetTranslation = 0; this.lockedOnNodeId = void 0; this.lockedOnNodeOffset = void 0; this.touchTime = 0; this.viewFunction = void 0; this.body.emitter.on("fit", _bindInstanceProperty(_context = this.fit).call(_context, this)); this.body.emitter.on("animationFinished", () => { this.body.emitter.emit("_stopRendering"); }); this.body.emitter.on("unlockNode", _bindInstanceProperty(_context2 = this.releaseNode).call(_context2, this)); } /** * * @param {object} [options] */ setOptions() { let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.options = options; } /** * This function zooms out to fit all data on screen based on amount of nodes * @param {object} [options={{nodes=Array}}] * @param options * @param {boolean} [initialZoom] | zoom based on fitted formula or range, true = fitted, default = false; */ fit(options) { let initialZoom = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; options = normalizeFitOptions(options, this.body.nodeIndices); const canvasWidth = this.canvas.frame.canvas.clientWidth; const canvasHeight = this.canvas.frame.canvas.clientHeight; let range; let zoomLevel; if (canvasWidth === 0 || canvasHeight === 0) { zoomLevel = 1; range = NetworkUtil.getRange(this.body.nodes, options.nodes); } else if (initialZoom === true) { let positionDefined = 0; for (const nodeId in this.body.nodes) if (Object.prototype.hasOwnProperty.call(this.body.nodes, nodeId)) { const node = this.body.nodes[nodeId]; if (node.predefinedPosition === true) positionDefined += 1; } if (positionDefined > .5 * this.body.nodeIndices.length) { this.fit(options, false); return; } range = NetworkUtil.getRange(this.body.nodes, options.nodes); const numberOfNodes = this.body.nodeIndices.length; zoomLevel = 12.662 / (numberOfNodes + 7.4147) + .0964822; const factor = Math.min(canvasWidth / 600, canvasHeight / 600); zoomLevel *= factor; } else { this.body.emitter.emit("_resizeNodes"); range = NetworkUtil.getRange(this.body.nodes, options.nodes); const xDistance = Math.abs(range.maxX - range.minX) * 1.1; const yDistance = Math.abs(range.maxY - range.minY) * 1.1; const xZoomLevel = canvasWidth / xDistance; const yZoomLevel = canvasHeight / yDistance; zoomLevel = xZoomLevel <= yZoomLevel ? xZoomLevel : yZoomLevel; } if (zoomLevel > options.maxZoomLevel) zoomLevel = options.maxZoomLevel; else if (zoomLevel < options.minZoomLevel) zoomLevel = options.minZoomLevel; const center = NetworkUtil.findCenter(range); const animationOptions = { position: center, scale: zoomLevel, animation: options.animation }; this.moveTo(animationOptions); } /** * Center a node in view. * @param {number} nodeId * @param {number} [options] */ focus(nodeId) { let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (this.body.nodes[nodeId] !== void 0) { const nodePosition = { x: this.body.nodes[nodeId].x, y: this.body.nodes[nodeId].y }; options.position = nodePosition; options.lockedOnNode = nodeId; this.moveTo(options); } else console.error("Node: " + nodeId + " cannot be found."); } /** * * @param {object} options | options.offset = {x:number, y:number} // offset from the center in DOM pixels * | options.scale = number // scale to move to * | options.position = {x:number, y:number} // position to move to * | options.animation = {duration:number, easingFunction:String} || Boolean // position to move to */ moveTo(options) { if (options === void 0) { options = {}; return; } if (options.offset != null) { if (options.offset.x != null) { options.offset.x = +options.offset.x; if (!_Number$isFinite(options.offset.x)) throw new TypeError("The option \"offset.x\" has to be a finite number."); } else options.offset.x = 0; if (options.offset.y != null) { options.offset.y = +options.offset.y; if (!_Number$isFinite(options.offset.y)) throw new TypeError("The option \"offset.y\" has to be a finite number."); } else options.offset.x = 0; } else options.offset = { x: 0, y: 0 }; if (options.position != null) { if (options.position.x != null) { options.position.x = +options.position.x; if (!_Number$isFinite(options.position.x)) throw new TypeError("The option \"position.x\" has to be a finite number."); } else options.position.x = 0; if (options.position.y != null) { options.position.y = +options.position.y; if (!_Number$isFinite(options.position.y)) throw new TypeError("The option \"position.y\" has to be a finite number."); } else options.position.x = 0; } else options.position = this.getViewPosition(); if (options.scale != null) { options.scale = +options.scale; if (!(options.scale > 0)) throw new TypeError("The option \"scale\" has to be a number greater than zero."); } else options.scale = this.body.view.scale; if (options.animation === void 0) options.animation = { duration: 0 }; if (options.animation === false) options.animation = { duration: 0 }; if (options.animation === true) options.animation = {}; if (options.animation.duration === void 0) options.animation.duration = 1e3; if (options.animation.easingFunction === void 0) options.animation.easingFunction = "easeInOutQuad"; this.animateView(options); } /** * * @param {object} options | options.offset = {x:number, y:number} // offset from the center in DOM pixels * | options.time = number // animation time in milliseconds * | options.scale = number // scale to animate to * | options.position = {x:number, y:number} // position to animate to * | options.easingFunction = String // linear, easeInQuad, easeOutQuad, easeInOutQuad, * // easeInCubic, easeOutCubic, easeInOutCubic, * // easeInQuart, easeOutQuart, easeInOutQuart, * // easeInQuint, easeOutQuint, easeInOutQuint */ animateView(options) { if (options === void 0) return; this.animationEasingFunction = options.animation.easingFunction; this.releaseNode(); if (options.locked === true) { this.lockedOnNodeId = options.lockedOnNode; this.lockedOnNodeOffset = options.offset; } if (this.easingTime != 0) this._transitionRedraw(true); this.sourceScale = this.body.view.scale; this.sourceTranslation = this.body.view.translation; this.targetScale = options.scale; this.body.view.scale = this.targetScale; const viewCenter = this.canvas.DOMtoCanvas({ x: .5 * this.canvas.frame.canvas.clientWidth, y: .5 * this.canvas.frame.canvas.clientHeight }); const distanceFromCenter = { x: viewCenter.x - options.position.x, y: viewCenter.y - options.position.y }; this.targetTranslation = { x: this.sourceTranslation.x + distanceFromCenter.x * this.targetScale + options.offset.x, y: this.sourceTranslation.y + distanceFromCenter.y * this.targetScale + options.offset.y }; if (options.animation.duration === 0) if (this.lockedOnNodeId != void 0) { var _context3; this.viewFunction = _bindInstanceProperty(_context3 = this._lockedRedraw).call(_context3, this); this.body.emitter.on("initRedraw", this.viewFunction); } else { this.body.view.scale = this.targetScale; this.body.view.translation = this.targetTranslation; this.body.emitter.emit("_requestRedraw"); } else { var _context4; this.animationSpeed = 1 / (60 * options.animation.duration * .001) || 1 / 60; this.animationEasingFunction = options.animation.easingFunction; this.viewFunction = _bindInstanceProperty(_context4 = this._transitionRedraw).call(_context4, this); this.body.emitter.on("initRedraw", this.viewFunction); this.body.emitter.emit("_startRendering"); } } /** * used to animate smoothly by hijacking the redraw function. * @private */ _lockedRedraw() { const nodePosition = { x: this.body.nodes[this.lockedOnNodeId].x, y: this.body.nodes[this.lockedOnNodeId].y }; const viewCenter = this.canvas.DOMtoCanvas({ x: .5 * this.canvas.frame.canvas.clientWidth, y: .5 * this.canvas.frame.canvas.clientHeight }); const distanceFromCenter = { x: viewCenter.x - nodePosition.x, y: viewCenter.y - nodePosition.y }; const sourceTranslation = this.body.view.translation; const targetTranslation = { x: sourceTranslation.x + distanceFromCenter.x * this.body.view.scale + this.lockedOnNodeOffset.x, y: sourceTranslation.y + distanceFromCenter.y * this.body.view.scale + this.lockedOnNodeOffset.y }; this.body.view.translation = targetTranslation; } /** * Resets state of a locked on Node */ releaseNode() { if (this.lockedOnNodeId !== void 0 && this.viewFunction !== void 0) { this.body.emitter.off("initRedraw", this.viewFunction); this.lockedOnNodeId = void 0; this.lockedOnNodeOffset = void 0; } } /** * @param {boolean} [finished] * @private */ _transitionRedraw() { let finished = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; this.easingTime += this.animationSpeed; this.easingTime = finished === true ? 1 : this.easingTime; const progress = easingFunctions[this.animationEasingFunction](this.easingTime); this.body.view.scale = this.sourceScale + (this.targetScale - this.sourceScale) * progress; this.body.view.translation = { x: this.sourceTranslation.x + (this.targetTranslation.x - this.sourceTranslation.x) * progress, y: this.sourceTranslation.y + (this.targetTranslation.y - this.sourceTranslation.y) * progress }; if (this.easingTime >= 1) { this.body.emitter.off("initRedraw", this.viewFunction); this.easingTime = 0; if (this.lockedOnNodeId != void 0) { var _context5; this.viewFunction = _bindInstanceProperty(_context5 = this._lockedRedraw).call(_context5, this); this.body.emitter.on("initRedraw", this.viewFunction); } this.body.emitter.emit("animationFinished"); } } /** * * @returns {number} */ getScale() { return this.body.view.scale; } /** * * @returns {{x: number, y: number}} */ getViewPosition() { return this.canvas.DOMtoCanvas({ x: .5 * this.canvas.frame.canvas.clientWidth, y: .5 * this.canvas.frame.canvas.clientHeight }); } }; /** * Created by Alex on 11/6/2014. */ function keycharm(options) { var preventDefault = options && options.preventDefault || false; var container = options && options.container || window; var _exportFunctions = {}; var _bound = { keydown: {}, keyup: {} }; var _keys = {}; var i; for (i = 97; i <= 122; i++) _keys[String.fromCharCode(i)] = { code: 65 + (i - 97), shift: false }; for (i = 65; i <= 90; i++) _keys[String.fromCharCode(i)] = { code: i, shift: true }; for (i = 0; i <= 9; i++) _keys["" + i] = { code: 48 + i, shift: false }; for (i = 1; i <= 12; i++) _keys["F" + i] = { code: 111 + i, shift: false }; for (i = 0; i <= 9; i++) _keys["num" + i] = { code: 96 + i, shift: false }; _keys["num*"] = { code: 106, shift: false }; _keys["num+"] = { code: 107, shift: false }; _keys["num-"] = { code: 109, shift: false }; _keys["num/"] = { code: 111, shift: false }; _keys["num."] = { code: 110, shift: false }; _keys["left"] = { code: 37, shift: false }; _keys["up"] = { code: 38, shift: false }; _keys["right"] = { code: 39, shift: false }; _keys["down"] = { code: 40, shift: false }; _keys["space"] = { code: 32, shift: false }; _keys["enter"] = { code: 13, shift: false }; _keys["shift"] = { code: 16, shift: void 0 }; _keys["esc"] = { code: 27, shift: false }; _keys["backspace"] = { code: 8, shift: false }; _keys["tab"] = { code: 9, shift: false }; _keys["ctrl"] = { code: 17, shift: false }; _keys["alt"] = { code: 18, shift: false }; _keys["delete"] = { code: 46, shift: false }; _keys["pageup"] = { code: 33, shift: false }; _keys["pagedown"] = { code: 34, shift: false }; _keys["="] = { code: 187, shift: false }; _keys["-"] = { code: 189, shift: false }; _keys["]"] = { code: 221, shift: false }; _keys["["] = { code: 219, shift: false }; var down = function(event) { handleEvent(event, "keydown"); }; var up = function(event) { handleEvent(event, "keyup"); }; var handleEvent = function(event, type) { if (_bound[type][event.keyCode] !== void 0) { var bound = _bound[type][event.keyCode]; for (var i$1 = 0; i$1 < bound.length; i$1++) if (bound[i$1].shift === void 0) bound[i$1].fn(event); else if (bound[i$1].shift == true && event.shiftKey == true) bound[i$1].fn(event); else if (bound[i$1].shift == false && event.shiftKey == false) bound[i$1].fn(event); if (preventDefault == true) event.preventDefault(); } }; _exportFunctions.bind = function(key, callback, type) { if (type === void 0) type = "keydown"; if (_keys[key] === void 0) throw new Error("unsupported key: " + key); if (_bound[type][_keys[key].code] === void 0) _bound[type][_keys[key].code] = []; _bound[type][_keys[key].code].push({ fn: callback, shift: _keys[key].shift }); }; _exportFunctions.bindAll = function(callback, type) { if (type === void 0) type = "keydown"; for (var key in _keys) if (_keys.hasOwnProperty(key)) _exportFunctions.bind(key, callback, type); }; _exportFunctions.getKey = function(event) { for (var key in _keys) if (_keys.hasOwnProperty(key)) { if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) return key; else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) return key; else if (event.keyCode == _keys[key].code && key == "shift") return key; } return "unknown key, currently not supported"; }; _exportFunctions.unbind = function(key, callback, type) { if (type === void 0) type = "keydown"; if (_keys[key] === void 0) throw new Error("unsupported key: " + key); if (callback !== void 0) { var newBindings = []; var bound = _bound[type][_keys[key].code]; if (bound !== void 0) { for (var i$1 = 0; i$1 < bound.length; i$1++) if (!(bound[i$1].fn == callback && bound[i$1].shift == _keys[key].shift)) newBindings.push(_bound[type][_keys[key].code][i$1]); } _bound[type][_keys[key].code] = newBindings; } else _bound[type][_keys[key].code] = []; }; _exportFunctions.reset = function() { _bound = { keydown: {}, keyup: {} }; }; _exportFunctions.destroy = function() { _bound = { keydown: {}, keyup: {} }; container.removeEventListener("keydown", down, true); container.removeEventListener("keyup", up, true); }; container.addEventListener("keydown", down, true); container.addEventListener("keyup", up, true); return _exportFunctions; } var NavigationHandler = class { /** * @param {object} body * @param {Canvas} canvas */ constructor(body, canvas) { this.body = body; this.canvas = canvas; this.iconsCreated = false; this.navigationHammers = []; this.boundFunctions = {}; this.touchTime = 0; this.activated = false; this.body.emitter.on("activate", () => { this.activated = true; this.configureKeyboardBindings(); }); this.body.emitter.on("deactivate", () => { this.activated = false; this.configureKeyboardBindings(); }); this.body.emitter.on("destroy", () => { if (this.keycharm !== void 0) this.keycharm.destroy(); }); this.options = {}; } /** * * @param {object} options */ setOptions(options) { if (options !== void 0) { this.options = options; this.create(); } } /** * Creates or refreshes navigation and sets key bindings */ create() { if (this.options.navigationButtons === true) { if (this.iconsCreated === false) this.loadNavigationElements(); } else if (this.iconsCreated === true) this.cleanNavigation(); this.configureKeyboardBindings(); } /** * Cleans up previous navigation items */ cleanNavigation() { if (this.navigationHammers.length != 0) { for (let i = 0; i < this.navigationHammers.length; i++) this.navigationHammers[i].destroy(); this.navigationHammers = []; } if (this.navigationDOM && this.navigationDOM["wrapper"] && this.navigationDOM["wrapper"].parentNode) this.navigationDOM["wrapper"].parentNode.removeChild(this.navigationDOM["wrapper"]); this.iconsCreated = false; } /** * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. * @private */ loadNavigationElements() { this.cleanNavigation(); this.navigationDOM = {}; const navigationDivs = [ "up", "down", "left", "right", "zoomIn", "zoomOut", "zoomExtends" ]; const navigationDivActions = [ "_moveUp", "_moveDown", "_moveLeft", "_moveRight", "_zoomIn", "_zoomOut", "_fit" ]; this.navigationDOM["wrapper"] = document.createElement("div"); this.navigationDOM["wrapper"].className = "vis-navigation"; this.canvas.frame.appendChild(this.navigationDOM["wrapper"]); for (let i = 0; i < navigationDivs.length; i++) { this.navigationDOM[navigationDivs[i]] = document.createElement("div"); this.navigationDOM[navigationDivs[i]].className = "vis-button vis-" + navigationDivs[i]; this.navigationDOM["wrapper"].appendChild(this.navigationDOM[navigationDivs[i]]); const hammer = new Hammer(this.navigationDOM[navigationDivs[i]]); if (navigationDivActions[i] === "_fit") { var _context; onTouch(hammer, _bindInstanceProperty(_context = this._fit).call(_context, this)); } else { var _context2; onTouch(hammer, _bindInstanceProperty(_context2 = this.bindToRedraw).call(_context2, this, navigationDivActions[i])); } this.navigationHammers.push(hammer); } const hammerFrame = new Hammer(this.canvas.frame); onRelease(hammerFrame, () => { this._stopMovement(); }); this.navigationHammers.push(hammerFrame); this.iconsCreated = true; } /** * * @param {string} action */ bindToRedraw(action) { if (this.boundFunctions[action] === void 0) { var _context3; this.boundFunctions[action] = _bindInstanceProperty(_context3 = this[action]).call(_context3, this); this.body.emitter.on("initRedraw", this.boundFunctions[action]); this.body.emitter.emit("_startRendering"); } } /** * * @param {string} action */ unbindFromRedraw(action) { if (this.boundFunctions[action] !== void 0) { this.body.emitter.off("initRedraw", this.boundFunctions[action]); this.body.emitter.emit("_stopRendering"); delete this.boundFunctions[action]; } } /** * this stops all movement induced by the navigation buttons * @private */ _fit() { if (new Date().valueOf() - this.touchTime > 700) { this.body.emitter.emit("fit", { duration: 700 }); this.touchTime = new Date().valueOf(); } } /** * this stops all movement induced by the navigation buttons * @private */ _stopMovement() { for (const boundAction in this.boundFunctions) if (Object.prototype.hasOwnProperty.call(this.boundFunctions, boundAction)) { this.body.emitter.off("initRedraw", this.boundFunctions[boundAction]); this.body.emitter.emit("_stopRendering"); } this.boundFunctions = {}; } /** * * @private */ _moveUp() { this.body.view.translation.y += this.options.keyboard.speed.y; } /** * * @private */ _moveDown() { this.body.view.translation.y -= this.options.keyboard.speed.y; } /** * * @private */ _moveLeft() { this.body.view.translation.x += this.options.keyboard.speed.x; } /** * * @private */ _moveRight() { this.body.view.translation.x -= this.options.keyboard.speed.x; } /** * * @private */ _zoomIn() { const scaleOld = this.body.view.scale; const scale = this.body.view.scale * (1 + this.options.keyboard.speed.zoom); const translation = this.body.view.translation; const scaleFrac = scale / scaleOld; const tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac; const ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac; this.body.view.scale = scale; this.body.view.translation = { x: tx, y: ty }; this.body.emitter.emit("zoom", { direction: "+", scale: this.body.view.scale, pointer: null }); } /** * * @private */ _zoomOut() { const scaleOld = this.body.view.scale; const scale = this.body.view.scale / (1 + this.options.keyboard.speed.zoom); const translation = this.body.view.translation; const scaleFrac = scale / scaleOld; const tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac; const ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac; this.body.view.scale = scale; this.body.view.translation = { x: tx, y: ty }; this.body.emitter.emit("zoom", { direction: "-", scale: this.body.view.scale, pointer: null }); } /** * bind all keys using keycharm. */ configureKeyboardBindings() { if (this.keycharm !== void 0) this.keycharm.destroy(); if (this.options.keyboard.enabled === true) { if (this.options.keyboard.bindToWindow === true) this.keycharm = keycharm({ container: window, preventDefault: true }); else this.keycharm = keycharm({ container: this.canvas.frame, preventDefault: true }); this.keycharm.reset(); if (this.activated === true) { var _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25; _bindInstanceProperty(_context4 = this.keycharm).call(_context4, "up", () => { this.bindToRedraw("_moveUp"); }, "keydown"); _bindInstanceProperty(_context5 = this.keycharm).call(_context5, "down", () => { this.bindToRedraw("_moveDown"); }, "keydown"); _bindInstanceProperty(_context6 = this.keycharm).call(_context6, "left", () => { this.bindToRedraw("_moveLeft"); }, "keydown"); _bindInstanceProperty(_context7 = this.keycharm).call(_context7, "right", () => { this.bindToRedraw("_moveRight"); }, "keydown"); _bindInstanceProperty(_context8 = this.keycharm).call(_context8, "=", () => { this.bindToRedraw("_zoomIn"); }, "keydown"); _bindInstanceProperty(_context9 = this.keycharm).call(_context9, "num+", () => { this.bindToRedraw("_zoomIn"); }, "keydown"); _bindInstanceProperty(_context0 = this.keycharm).call(_context0, "num-", () => { this.bindToRedraw("_zoomOut"); }, "keydown"); _bindInstanceProperty(_context1 = this.keycharm).call(_context1, "-", () => { this.bindToRedraw("_zoomOut"); }, "keydown"); _bindInstanceProperty(_context10 = this.keycharm).call(_context10, "[", () => { this.bindToRedraw("_zoomOut"); }, "keydown"); _bindInstanceProperty(_context11 = this.keycharm).call(_context11, "]", () => { this.bindToRedraw("_zoomIn"); }, "keydown"); _bindInstanceProperty(_context12 = this.keycharm).call(_context12, "pageup", () => { this.bindToRedraw("_zoomIn"); }, "keydown"); _bindInstanceProperty(_context13 = this.keycharm).call(_context13, "pagedown", () => { this.bindToRedraw("_zoomOut"); }, "keydown"); _bindInstanceProperty(_context14 = this.keycharm).call(_context14, "up", () => { this.unbindFromRedraw("_moveUp"); }, "keyup"); _bindInstanceProperty(_context15 = this.keycharm).call(_context15, "down", () => { this.unbindFromRedraw("_moveDown"); }, "keyup"); _bindInstanceProperty(_context16 = this.keycharm).call(_context16, "left", () => { this.unbindFromRedraw("_moveLeft"); }, "keyup"); _bindInstanceProperty(_context17 = this.keycharm).call(_context17, "right", () => { this.unbindFromRedraw("_moveRight"); }, "keyup"); _bindInstanceProperty(_context18 = this.keycharm).call(_context18, "=", () => { this.unbindFromRedraw("_zoomIn"); }, "keyup"); _bindInstanceProperty(_context19 = this.keycharm).call(_context19, "num+", () => { this.unbindFromRedraw("_zoomIn"); }, "keyup"); _bindInstanceProperty(_context20 = this.keycharm).call(_context20, "num-", () => { this.unbindFromRedraw("_zoomOut"); }, "keyup"); _bindInstanceProperty(_context21 = this.keycharm).call(_context21, "-", () => { this.unbindFromRedraw("_zoomOut"); }, "keyup"); _bindInstanceProperty(_context22 = this.keycharm).call(_context22, "[", () => { this.unbindFromRedraw("_zoomOut"); }, "keyup"); _bindInstanceProperty(_context23 = this.keycharm).call(_context23, "]", () => { this.unbindFromRedraw("_zoomIn"); }, "keyup"); _bindInstanceProperty(_context24 = this.keycharm).call(_context24, "pageup", () => { this.unbindFromRedraw("_zoomIn"); }, "keyup"); _bindInstanceProperty(_context25 = this.keycharm).call(_context25, "pagedown", () => { this.unbindFromRedraw("_zoomOut"); }, "keyup"); } } } }; var InteractionHandler = class { /** * @param {object} body * @param {Canvas} canvas * @param {SelectionHandler} selectionHandler */ constructor(body, canvas, selectionHandler) { var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1, _context10, _context11; this.body = body; this.canvas = canvas; this.selectionHandler = selectionHandler; this.navigationHandler = new NavigationHandler(body, canvas); this.body.eventListeners.onTap = _bindInstanceProperty(_context = this.onTap).call(_context, this); this.body.eventListeners.onTouch = _bindInstanceProperty(_context2 = this.onTouch).call(_context2, this); this.body.eventListeners.onDoubleTap = _bindInstanceProperty(_context3 = this.onDoubleTap).call(_context3, this); this.body.eventListeners.onHold = _bindInstanceProperty(_context4 = this.onHold).call(_context4, this); this.body.eventListeners.onDragStart = _bindInstanceProperty(_context5 = this.onDragStart).call(_context5, this); this.body.eventListeners.onDrag = _bindInstanceProperty(_context6 = this.onDrag).call(_context6, this); this.body.eventListeners.onDragEnd = _bindInstanceProperty(_context7 = this.onDragEnd).call(_context7, this); this.body.eventListeners.onMouseWheel = _bindInstanceProperty(_context8 = this.onMouseWheel).call(_context8, this); this.body.eventListeners.onPinch = _bindInstanceProperty(_context9 = this.onPinch).call(_context9, this); this.body.eventListeners.onMouseMove = _bindInstanceProperty(_context0 = this.onMouseMove).call(_context0, this); this.body.eventListeners.onRelease = _bindInstanceProperty(_context1 = this.onRelease).call(_context1, this); this.body.eventListeners.onContext = _bindInstanceProperty(_context10 = this.onContext).call(_context10, this); this.touchTime = 0; this.drag = {}; this.pinch = {}; this.popup = void 0; this.popupObj = void 0; this.popupTimer = void 0; this.body.functions.getPointer = _bindInstanceProperty(_context11 = this.getPointer).call(_context11, this); this.options = {}; this.defaultOptions = { dragNodes: true, dragView: true, hover: false, keyboard: { enabled: false, speed: { x: 10, y: 10, zoom: .02 }, bindToWindow: true, autoFocus: true }, navigationButtons: false, tooltipDelay: 300, zoomView: true, zoomSpeed: 1 }; _Object$assign(this.options, this.defaultOptions); this.bindEventListeners(); } /** * Binds event listeners */ bindEventListeners() { this.body.emitter.on("destroy", () => { clearTimeout(this.popupTimer); delete this.body.functions.getPointer; }); } /** * * @param {object} options */ setOptions(options) { if (options !== void 0) { const fields = [ "hideEdgesOnDrag", "hideEdgesOnZoom", "hideNodesOnDrag", "keyboard", "multiselect", "selectable", "selectConnectedEdges" ]; selectiveNotDeepExtend(fields, this.options, options); mergeOptions(this.options, options, "keyboard"); if (options.tooltip) { _Object$assign(this.options.tooltip, options.tooltip); if (options.tooltip.color) this.options.tooltip.color = parseColor(options.tooltip.color); } } this.navigationHandler.setOptions(this.options); } /** * Get the pointer location from a touch location * @param {{x: number, y: number}} touch * @returns {{x: number, y: number}} pointer * @private */ getPointer(touch) { return { x: touch.x - getAbsoluteLeft(this.canvas.frame.canvas), y: touch.y - getAbsoluteTop(this.canvas.frame.canvas) }; } /** * On start of a touch gesture, store the pointer * @param {Event} event The event * @private */ onTouch(event) { if (new Date().valueOf() - this.touchTime > 50) { this.drag.pointer = this.getPointer(event.center); this.drag.pinched = false; this.pinch.scale = this.body.view.scale; this.touchTime = new Date().valueOf(); } } /** * handle tap/click event: select/unselect a node * @param {Event} event * @private */ onTap(event) { const pointer = this.getPointer(event.center); const multiselect = this.selectionHandler.options.multiselect && (event.changedPointers[0].ctrlKey || event.changedPointers[0].metaKey); this.checkSelectionChanges(pointer, multiselect); this.selectionHandler.commitAndEmit(pointer, event); this.selectionHandler.generateClickEvent("click", event, pointer); } /** * handle doubletap event * @param {Event} event * @private */ onDoubleTap(event) { const pointer = this.getPointer(event.center); this.selectionHandler.generateClickEvent("doubleClick", event, pointer); } /** * handle long tap event: multi select nodes * @param {Event} event * @private */ onHold(event) { const pointer = this.getPointer(event.center); const multiselect = this.selectionHandler.options.multiselect; this.checkSelectionChanges(pointer, multiselect); this.selectionHandler.commitAndEmit(pointer, event); this.selectionHandler.generateClickEvent("click", event, pointer); this.selectionHandler.generateClickEvent("hold", event, pointer); } /** * handle the release of the screen * @param {Event} event * @private */ onRelease(event) { if (new Date().valueOf() - this.touchTime > 10) { const pointer = this.getPointer(event.center); this.selectionHandler.generateClickEvent("release", event, pointer); this.touchTime = new Date().valueOf(); } } /** * * @param {Event} event */ onContext(event) { const pointer = this.getPointer({ x: event.clientX, y: event.clientY }); this.selectionHandler.generateClickEvent("oncontext", event, pointer); } /** * Select and deselect nodes depending current selection change. * @param {{x: number, y: number}} pointer * @param {boolean} [add] */ checkSelectionChanges(pointer) { let add = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; if (add === true) this.selectionHandler.selectAdditionalOnPoint(pointer); else this.selectionHandler.selectOnPoint(pointer); } /** * Remove all node and edge id's from the first set that are present in the second one. * @param {{nodes: Array., edges: Array.}} firstSet * @param {{nodes: Array., edges: Array.}} secondSet * @returns {{nodes: Array., edges: Array.}} * @private */ _determineDifference(firstSet, secondSet) { const arrayDiff = function(firstArr, secondArr) { const result = []; for (let i = 0; i < firstArr.length; i++) { const value = firstArr[i]; if (_indexOfInstanceProperty(secondArr).call(secondArr, value) === -1) result.push(value); } return result; }; return { nodes: arrayDiff(firstSet.nodes, secondSet.nodes), edges: arrayDiff(firstSet.edges, secondSet.edges) }; } /** * This function is called by onDragStart. * It is separated out because we can then overload it for the datamanipulation system. * @param {Event} event * @private */ onDragStart(event) { if (this.drag.dragging) return; if (this.drag.pointer === void 0) this.onTouch(event); const node = this.selectionHandler.getNodeAt(this.drag.pointer); this.drag.dragging = true; this.drag.selection = []; this.drag.translation = _Object$assign({}, this.body.view.translation); this.drag.nodeId = void 0; if (event.srcEvent.shiftKey) { this.body.selectionBox.show = true; const pointer = this.getPointer(event.center); this.body.selectionBox.position.start = { x: this.canvas._XconvertDOMtoCanvas(pointer.x), y: this.canvas._YconvertDOMtoCanvas(pointer.y) }; this.body.selectionBox.position.end = { x: this.canvas._XconvertDOMtoCanvas(pointer.x), y: this.canvas._YconvertDOMtoCanvas(pointer.y) }; } else if (node !== void 0 && this.options.dragNodes === true) { this.drag.nodeId = node.id; if (node.isSelected() === false) this.selectionHandler.setSelection({ nodes: [node.id] }); this.selectionHandler.generateClickEvent("dragStart", event, this.drag.pointer); for (const node$1 of this.selectionHandler.getSelectedNodes()) { const s = { id: node$1.id, node: node$1, x: node$1.x, y: node$1.y, xFixed: node$1.options.fixed.x, yFixed: node$1.options.fixed.y }; node$1.options.fixed.x = true; node$1.options.fixed.y = true; this.drag.selection.push(s); } } else this.selectionHandler.generateClickEvent("dragStart", event, this.drag.pointer, void 0, true); } /** * handle drag event * @param {Event} event * @private */ onDrag(event) { if (this.drag.pinched === true) return; this.body.emitter.emit("unlockNode"); const pointer = this.getPointer(event.center); const selection = this.drag.selection; if (selection && selection.length && this.options.dragNodes === true) { this.selectionHandler.generateClickEvent("dragging", event, pointer); const deltaX = pointer.x - this.drag.pointer.x; const deltaY = pointer.y - this.drag.pointer.y; _forEachInstanceProperty(selection).call(selection, (selection$1) => { const node = selection$1.node; if (selection$1.xFixed === false) node.x = this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(selection$1.x) + deltaX); if (selection$1.yFixed === false) node.y = this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(selection$1.y) + deltaY); }); this.body.emitter.emit("startSimulation"); } else { if (event.srcEvent.shiftKey) { this.selectionHandler.generateClickEvent("dragging", event, pointer, void 0, true); if (this.drag.pointer === void 0) { this.onDragStart(event); return; } this.body.selectionBox.position.end = { x: this.canvas._XconvertDOMtoCanvas(pointer.x), y: this.canvas._YconvertDOMtoCanvas(pointer.y) }; this.body.emitter.emit("_requestRedraw"); } if (this.options.dragView === true && !event.srcEvent.shiftKey) { this.selectionHandler.generateClickEvent("dragging", event, pointer, void 0, true); if (this.drag.pointer === void 0) { this.onDragStart(event); return; } const diffX = pointer.x - this.drag.pointer.x; const diffY = pointer.y - this.drag.pointer.y; this.body.view.translation = { x: this.drag.translation.x + diffX, y: this.drag.translation.y + diffY }; this.body.emitter.emit("_requestRedraw"); } } } /** * handle drag start event * @param {Event} event * @private */ onDragEnd(event) { this.drag.dragging = false; if (this.body.selectionBox.show) { var _context12; this.body.selectionBox.show = false; const selectionBoxPosition = this.body.selectionBox.position; const selectionBoxPositionMinMax = { minX: Math.min(selectionBoxPosition.start.x, selectionBoxPosition.end.x), minY: Math.min(selectionBoxPosition.start.y, selectionBoxPosition.end.y), maxX: Math.max(selectionBoxPosition.start.x, selectionBoxPosition.end.x), maxY: Math.max(selectionBoxPosition.start.y, selectionBoxPosition.end.y) }; const toBeSelectedNodes = _filterInstanceProperty(_context12 = this.body.nodeIndices).call(_context12, (nodeId) => { const node = this.body.nodes[nodeId]; return node.x >= selectionBoxPositionMinMax.minX && node.x <= selectionBoxPositionMinMax.maxX && node.y >= selectionBoxPositionMinMax.minY && node.y <= selectionBoxPositionMinMax.maxY; }); _forEachInstanceProperty(toBeSelectedNodes).call(toBeSelectedNodes, (nodeId) => this.selectionHandler.selectObject(this.body.nodes[nodeId])); const pointer = this.getPointer(event.center); this.selectionHandler.commitAndEmit(pointer, event); this.selectionHandler.generateClickEvent("dragEnd", event, this.getPointer(event.center), void 0, true); this.body.emitter.emit("_requestRedraw"); } else { const selection = this.drag.selection; if (selection && selection.length) { _forEachInstanceProperty(selection).call(selection, function(s) { s.node.options.fixed.x = s.xFixed; s.node.options.fixed.y = s.yFixed; }); this.selectionHandler.generateClickEvent("dragEnd", event, this.getPointer(event.center)); this.body.emitter.emit("startSimulation"); } else { this.selectionHandler.generateClickEvent("dragEnd", event, this.getPointer(event.center), void 0, true); this.body.emitter.emit("_requestRedraw"); } } } /** * Handle pinch event * @param {Event} event The event * @private */ onPinch(event) { const pointer = this.getPointer(event.center); this.drag.pinched = true; if (this.pinch["scale"] === void 0) this.pinch.scale = 1; const scale = this.pinch.scale * event.scale; this.zoom(scale, pointer); } /** * Zoom the network in or out * @param {number} scale a number around 1, and between 0.01 and 10 * @param {{x: number, y: number}} pointer Position on screen * @private */ zoom(scale, pointer) { if (this.options.zoomView === true) { const scaleOld = this.body.view.scale; if (scale < 1e-5) scale = 1e-5; if (scale > 10) scale = 10; let preScaleDragPointer = void 0; if (this.drag !== void 0) { if (this.drag.dragging === true) preScaleDragPointer = this.canvas.DOMtoCanvas(this.drag.pointer); } const translation = this.body.view.translation; const scaleFrac = scale / scaleOld; const tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac; const ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac; this.body.view.scale = scale; this.body.view.translation = { x: tx, y: ty }; if (preScaleDragPointer != void 0) { const postScaleDragPointer = this.canvas.canvasToDOM(preScaleDragPointer); this.drag.pointer.x = postScaleDragPointer.x; this.drag.pointer.y = postScaleDragPointer.y; } this.body.emitter.emit("_requestRedraw"); if (scaleOld < scale) this.body.emitter.emit("zoom", { direction: "+", scale: this.body.view.scale, pointer }); else this.body.emitter.emit("zoom", { direction: "-", scale: this.body.view.scale, pointer }); } } /** * Event handler for mouse wheel event, used to zoom the timeline * See http://adomas.org/javascript-mouse-wheel/ * https://github.com/EightMedia/hammer.js/issues/256 * @param {MouseEvent} event * @private */ onMouseWheel(event) { if (this.options.zoomView === true) { if (event.deltaY !== 0) { let scale = this.body.view.scale; scale *= 1 + (event.deltaY < 0 ? 1 : -1) * (this.options.zoomSpeed * .1); const pointer = this.getPointer({ x: event.clientX, y: event.clientY }); this.zoom(scale, pointer); } event.preventDefault(); } } /** * Mouse move handler for checking whether the title moves over a node with a title. * @param {Event} event * @private */ onMouseMove(event) { const pointer = this.getPointer({ x: event.clientX, y: event.clientY }); let popupVisible = false; if (this.popup !== void 0) { if (this.popup.hidden === false) this._checkHidePopup(pointer); if (this.popup.hidden === false) { popupVisible = true; this.popup.setPosition(pointer.x + 3, pointer.y - 5); this.popup.show(); } } if (this.options.keyboard.autoFocus && this.options.keyboard.bindToWindow === false && this.options.keyboard.enabled === true) this.canvas.frame.focus(); if (popupVisible === false) { if (this.popupTimer !== void 0) { clearInterval(this.popupTimer); this.popupTimer = void 0; } if (!this.drag.dragging) this.popupTimer = _setTimeout(() => this._checkShowPopup(pointer), this.options.tooltipDelay); } if (this.options.hover === true) this.selectionHandler.hoverObject(event, pointer); } /** * Check if there is an element on the given position in the network * (a node or edge). If so, and if this element has a title, * show a popup window with its title. * @param {{x:number, y:number}} pointer * @private */ _checkShowPopup(pointer) { const x = this.canvas._XconvertDOMtoCanvas(pointer.x); const y = this.canvas._YconvertDOMtoCanvas(pointer.y); const pointerObj = { left: x, top: y, right: x, bottom: y }; const previousPopupObjId = this.popupObj === void 0 ? void 0 : this.popupObj.id; let nodeUnderCursor = false; let popupType = "node"; if (this.popupObj === void 0) { const nodeIndices = this.body.nodeIndices; const nodes = this.body.nodes; let node; const overlappingNodes = []; for (let i = 0; i < nodeIndices.length; i++) { node = nodes[nodeIndices[i]]; if (node.isOverlappingWith(pointerObj) === true) { nodeUnderCursor = true; if (node.getTitle() !== void 0) overlappingNodes.push(nodeIndices[i]); } } if (overlappingNodes.length > 0) { this.popupObj = nodes[overlappingNodes[overlappingNodes.length - 1]]; nodeUnderCursor = true; } } if (this.popupObj === void 0 && nodeUnderCursor === false) { const edgeIndices = this.body.edgeIndices; const edges = this.body.edges; let edge; const overlappingEdges = []; for (let i = 0; i < edgeIndices.length; i++) { edge = edges[edgeIndices[i]]; if (edge.isOverlappingWith(pointerObj) === true) { if (edge.connected === true && edge.getTitle() !== void 0) overlappingEdges.push(edgeIndices[i]); } } if (overlappingEdges.length > 0) { this.popupObj = edges[overlappingEdges[overlappingEdges.length - 1]]; popupType = "edge"; } } if (this.popupObj !== void 0) { if (this.popupObj.id !== previousPopupObjId) { if (this.popup === void 0) this.popup = new Popup(this.canvas.frame); this.popup.popupTargetType = popupType; this.popup.popupTargetId = this.popupObj.id; this.popup.setPosition(pointer.x + 3, pointer.y - 5); this.popup.setText(this.popupObj.getTitle()); this.popup.show(); this.body.emitter.emit("showPopup", this.popupObj.id); } } else if (this.popup !== void 0) { this.popup.hide(); this.body.emitter.emit("hidePopup"); } } /** * Check if the popup must be hidden, which is the case when the mouse is no * longer hovering on the object * @param {{x:number, y:number}} pointer * @private */ _checkHidePopup(pointer) { const pointerObj = this.selectionHandler._pointerToPositionObject(pointer); let stillOnObj = false; if (this.popup.popupTargetType === "node") { if (this.body.nodes[this.popup.popupTargetId] !== void 0) { stillOnObj = this.body.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj); if (stillOnObj === true) { const overNode = this.selectionHandler.getNodeAt(pointer); stillOnObj = overNode === void 0 ? false : overNode.id === this.popup.popupTargetId; } } } else if (this.selectionHandler.getNodeAt(pointer) === void 0) { if (this.body.edges[this.popup.popupTargetId] !== void 0) stillOnObj = this.body.edges[this.popup.popupTargetId].isOverlappingWith(pointerObj); } if (stillOnObj === false) { this.popupObj = void 0; this.popup.hide(); this.body.emitter.emit("hidePopup"); } } }; var es_set = {}; var es_set_constructor = {}; var hasRequiredEs_set_constructor; function requireEs_set_constructor() { if (hasRequiredEs_set_constructor) return es_set_constructor; hasRequiredEs_set_constructor = 1; var collection$2 = /* @__PURE__ */ requireCollection(); var collectionStrong$2 = /* @__PURE__ */ requireCollectionStrong(); collection$2("Set", function(init) { return function Set$1() { return init(this, arguments.length ? arguments[0] : void 0); }; }, collectionStrong$2); return es_set_constructor; } var hasRequiredEs_set; function requireEs_set() { if (hasRequiredEs_set) return es_set; hasRequiredEs_set = 1; requireEs_set_constructor(); return es_set; } var es_set_difference_v2 = {}; var aSet; var hasRequiredASet; function requireASet() { if (hasRequiredASet) return aSet; hasRequiredASet = 1; var tryToString$2 = /* @__PURE__ */ requireTryToString(); var $TypeError = TypeError; aSet = function(it$1) { if (typeof it$1 == "object" && "size" in it$1 && "has" in it$1 && "add" in it$1 && "delete" in it$1 && "keys" in it$1) return it$1; throw new $TypeError(tryToString$2(it$1) + " is not a set"); }; return aSet; } var setHelpers; var hasRequiredSetHelpers; function requireSetHelpers() { if (hasRequiredSetHelpers) return setHelpers; hasRequiredSetHelpers = 1; var getBuiltIn$2 = /* @__PURE__ */ requireGetBuiltIn(); var caller$2 = /* @__PURE__ */ requireCaller(); var Set$1 = getBuiltIn$2("Set"); var SetPrototype = Set$1.prototype; setHelpers = { Set: Set$1, add: caller$2("add", 1), has: caller$2("has", 1), remove: caller$2("delete", 1), proto: SetPrototype }; return setHelpers; } var iterateSimple; var hasRequiredIterateSimple; function requireIterateSimple() { if (hasRequiredIterateSimple) return iterateSimple; hasRequiredIterateSimple = 1; var call = /* @__PURE__ */ requireFunctionCall(); iterateSimple = function(record, fn, ITERATOR_INSTEAD_OF_RECORD) { var iterator$7 = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator; var next$1 = record.next; var step, result; while (!(step = call(next$1, iterator$7)).done) { result = fn(step.value); if (result !== void 0) return result; } }; return iterateSimple; } var setIterate; var hasRequiredSetIterate; function requireSetIterate() { if (hasRequiredSetIterate) return setIterate; hasRequiredSetIterate = 1; var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple(); setIterate = function(set$4, fn, interruptible) { return interruptible ? iterateSimple$2(set$4.keys(), fn, true) : set$4.forEach(fn); }; return setIterate; } var setClone; var hasRequiredSetClone; function requireSetClone() { if (hasRequiredSetClone) return setClone; hasRequiredSetClone = 1; var SetHelpers = /* @__PURE__ */ requireSetHelpers(); var iterate$2 = /* @__PURE__ */ requireSetIterate(); var Set$1 = SetHelpers.Set; var add = SetHelpers.add; setClone = function(set$4) { var result = new Set$1(); iterate$2(set$4, function(it$1) { add(result, it$1); }); return result; }; return setClone; } var setSize; var hasRequiredSetSize; function requireSetSize() { if (hasRequiredSetSize) return setSize; hasRequiredSetSize = 1; setSize = function(set$4) { return set$4.size; }; return setSize; } var getIteratorDirect; var hasRequiredGetIteratorDirect; function requireGetIteratorDirect() { if (hasRequiredGetIteratorDirect) return getIteratorDirect; hasRequiredGetIteratorDirect = 1; getIteratorDirect = function(obj) { return { iterator: obj, next: obj.next, done: false }; }; return getIteratorDirect; } var getSetRecord; var hasRequiredGetSetRecord; function requireGetSetRecord() { if (hasRequiredGetSetRecord) return getSetRecord; hasRequiredGetSetRecord = 1; var aCallable$2 = /* @__PURE__ */ requireACallable(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var call = /* @__PURE__ */ requireFunctionCall(); var toIntegerOrInfinity$2 = /* @__PURE__ */ requireToIntegerOrInfinity(); var getIteratorDirect$2 = /* @__PURE__ */ requireGetIteratorDirect(); var INVALID_SIZE = "Invalid size"; var $RangeError = RangeError; var $TypeError = TypeError; var max = Math.max; var SetRecord = function(set$4, intSize) { this.set = set$4; this.size = max(intSize, 0); this.has = aCallable$2(set$4.has); this.keys = aCallable$2(set$4.keys); }; SetRecord.prototype = { getIterator: function() { return getIteratorDirect$2(anObject$2(call(this.keys, this.set))); }, includes: function(it$1) { return call(this.has, this.set, it$1); } }; getSetRecord = function(obj) { anObject$2(obj); var numSize = +obj.size; if (numSize !== numSize) throw new $TypeError(INVALID_SIZE); var intSize = toIntegerOrInfinity$2(numSize); if (intSize < 0) throw new $RangeError(INVALID_SIZE); return new SetRecord(obj, intSize); }; return getSetRecord; } var setDifference; var hasRequiredSetDifference; function requireSetDifference() { if (hasRequiredSetDifference) return setDifference; hasRequiredSetDifference = 1; var aSet$2 = /* @__PURE__ */ requireASet(); var SetHelpers = /* @__PURE__ */ requireSetHelpers(); var clone$1 = /* @__PURE__ */ requireSetClone(); var size = /* @__PURE__ */ requireSetSize(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord(); var iterateSet = /* @__PURE__ */ requireSetIterate(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple(); var has = SetHelpers.has; var remove = SetHelpers.remove; setDifference = function difference(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); var result = clone$1(O); if (size(O) <= otherRec.size) iterateSet(O, function(e) { if (otherRec.includes(e)) remove(result, e); }); else iterateSimple$2(otherRec.getIterator(), function(e) { if (has(result, e)) remove(result, e); }); return result; }; return setDifference; } var setMethodAcceptSetLike; var hasRequiredSetMethodAcceptSetLike; function requireSetMethodAcceptSetLike() { if (hasRequiredSetMethodAcceptSetLike) return setMethodAcceptSetLike; hasRequiredSetMethodAcceptSetLike = 1; setMethodAcceptSetLike = function() { return false; }; return setMethodAcceptSetLike; } var hasRequiredEs_set_difference_v2; function requireEs_set_difference_v2() { if (hasRequiredEs_set_difference_v2) return es_set_difference_v2; hasRequiredEs_set_difference_v2 = 1; var $ = /* @__PURE__ */ require_export(); var difference = /* @__PURE__ */ requireSetDifference(); var fails$2 = /* @__PURE__ */ requireFails(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike(); var SET_LIKE_INCORRECT_BEHAVIOR = !setMethodAcceptSetLike$2("difference", function(result) { return result.size === 0; }); var FORCED = SET_LIKE_INCORRECT_BEHAVIOR || fails$2(function() { var setLike = { size: 1, has: function() { return true; }, keys: function() { var index$1 = 0; return { next: function() { var done = index$1++ > 1; if (baseSet.has(1)) baseSet.clear(); return { done, value: 2 }; } }; } }; var baseSet = new Set([ 1, 2, 3, 4 ]); return baseSet.difference(setLike).size !== 3; }); $({ target: "Set", proto: true, real: true, forced: FORCED }, { difference }); return es_set_difference_v2; } var es_set_intersection_v2 = {}; var setIntersection; var hasRequiredSetIntersection; function requireSetIntersection() { if (hasRequiredSetIntersection) return setIntersection; hasRequiredSetIntersection = 1; var aSet$2 = /* @__PURE__ */ requireASet(); var SetHelpers = /* @__PURE__ */ requireSetHelpers(); var size = /* @__PURE__ */ requireSetSize(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord(); var iterateSet = /* @__PURE__ */ requireSetIterate(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple(); var Set$1 = SetHelpers.Set; var add = SetHelpers.add; var has = SetHelpers.has; setIntersection = function intersection(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); var result = new Set$1(); if (size(O) > otherRec.size) iterateSimple$2(otherRec.getIterator(), function(e) { if (has(O, e)) add(result, e); }); else iterateSet(O, function(e) { if (otherRec.includes(e)) add(result, e); }); return result; }; return setIntersection; } var hasRequiredEs_set_intersection_v2; function requireEs_set_intersection_v2() { if (hasRequiredEs_set_intersection_v2) return es_set_intersection_v2; hasRequiredEs_set_intersection_v2 = 1; var $ = /* @__PURE__ */ require_export(); var fails$2 = /* @__PURE__ */ requireFails(); var intersection = /* @__PURE__ */ requireSetIntersection(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike(); var INCORRECT = !setMethodAcceptSetLike$2("intersection", function(result) { return result.size === 2 && result.has(1) && result.has(2); }) || fails$2(function() { return String(Array.from(new Set([ 1, 2, 3 ]).intersection(new Set([3, 2])))) !== "3,2"; }); $({ target: "Set", proto: true, real: true, forced: INCORRECT }, { intersection }); return es_set_intersection_v2; } var es_set_isDisjointFrom_v2 = {}; var setIsDisjointFrom; var hasRequiredSetIsDisjointFrom; function requireSetIsDisjointFrom() { if (hasRequiredSetIsDisjointFrom) return setIsDisjointFrom; hasRequiredSetIsDisjointFrom = 1; var aSet$2 = /* @__PURE__ */ requireASet(); var has = requireSetHelpers().has; var size = /* @__PURE__ */ requireSetSize(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord(); var iterateSet = /* @__PURE__ */ requireSetIterate(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple(); var iteratorClose$2 = /* @__PURE__ */ requireIteratorClose(); setIsDisjointFrom = function isDisjointFrom(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); if (size(O) <= otherRec.size) return iterateSet(O, function(e) { if (otherRec.includes(e)) return false; }, true) !== false; var iterator$7 = otherRec.getIterator(); return iterateSimple$2(iterator$7, function(e) { if (has(O, e)) return iteratorClose$2(iterator$7, "normal", false); }) !== false; }; return setIsDisjointFrom; } var hasRequiredEs_set_isDisjointFrom_v2; function requireEs_set_isDisjointFrom_v2() { if (hasRequiredEs_set_isDisjointFrom_v2) return es_set_isDisjointFrom_v2; hasRequiredEs_set_isDisjointFrom_v2 = 1; var $ = /* @__PURE__ */ require_export(); var isDisjointFrom = /* @__PURE__ */ requireSetIsDisjointFrom(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike(); var INCORRECT = !setMethodAcceptSetLike$2("isDisjointFrom", function(result) { return !result; }); $({ target: "Set", proto: true, real: true, forced: INCORRECT }, { isDisjointFrom }); return es_set_isDisjointFrom_v2; } var es_set_isSubsetOf_v2 = {}; var setIsSubsetOf; var hasRequiredSetIsSubsetOf; function requireSetIsSubsetOf() { if (hasRequiredSetIsSubsetOf) return setIsSubsetOf; hasRequiredSetIsSubsetOf = 1; var aSet$2 = /* @__PURE__ */ requireASet(); var size = /* @__PURE__ */ requireSetSize(); var iterate$2 = /* @__PURE__ */ requireSetIterate(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord(); setIsSubsetOf = function isSubsetOf(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); if (size(O) > otherRec.size) return false; return iterate$2(O, function(e) { if (!otherRec.includes(e)) return false; }, true) !== false; }; return setIsSubsetOf; } var hasRequiredEs_set_isSubsetOf_v2; function requireEs_set_isSubsetOf_v2() { if (hasRequiredEs_set_isSubsetOf_v2) return es_set_isSubsetOf_v2; hasRequiredEs_set_isSubsetOf_v2 = 1; var $ = /* @__PURE__ */ require_export(); var isSubsetOf = /* @__PURE__ */ requireSetIsSubsetOf(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike(); var INCORRECT = !setMethodAcceptSetLike$2("isSubsetOf", function(result) { return result; }); $({ target: "Set", proto: true, real: true, forced: INCORRECT }, { isSubsetOf }); return es_set_isSubsetOf_v2; } var es_set_isSupersetOf_v2 = {}; var setIsSupersetOf; var hasRequiredSetIsSupersetOf; function requireSetIsSupersetOf() { if (hasRequiredSetIsSupersetOf) return setIsSupersetOf; hasRequiredSetIsSupersetOf = 1; var aSet$2 = /* @__PURE__ */ requireASet(); var has = requireSetHelpers().has; var size = /* @__PURE__ */ requireSetSize(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple(); var iteratorClose$2 = /* @__PURE__ */ requireIteratorClose(); setIsSupersetOf = function isSupersetOf(other) { var O = aSet$2(this); var otherRec = getSetRecord$2(other); if (size(O) < otherRec.size) return false; var iterator$7 = otherRec.getIterator(); return iterateSimple$2(iterator$7, function(e) { if (!has(O, e)) return iteratorClose$2(iterator$7, "normal", false); }) !== false; }; return setIsSupersetOf; } var hasRequiredEs_set_isSupersetOf_v2; function requireEs_set_isSupersetOf_v2() { if (hasRequiredEs_set_isSupersetOf_v2) return es_set_isSupersetOf_v2; hasRequiredEs_set_isSupersetOf_v2 = 1; var $ = /* @__PURE__ */ require_export(); var isSupersetOf = /* @__PURE__ */ requireSetIsSupersetOf(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike(); var INCORRECT = !setMethodAcceptSetLike$2("isSupersetOf", function(result) { return !result; }); $({ target: "Set", proto: true, real: true, forced: INCORRECT }, { isSupersetOf }); return es_set_isSupersetOf_v2; } var es_set_symmetricDifference_v2 = {}; var setSymmetricDifference; var hasRequiredSetSymmetricDifference; function requireSetSymmetricDifference() { if (hasRequiredSetSymmetricDifference) return setSymmetricDifference; hasRequiredSetSymmetricDifference = 1; var aSet$2 = /* @__PURE__ */ requireASet(); var SetHelpers = /* @__PURE__ */ requireSetHelpers(); var clone$1 = /* @__PURE__ */ requireSetClone(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple(); var add = SetHelpers.add; var has = SetHelpers.has; var remove = SetHelpers.remove; setSymmetricDifference = function symmetricDifference(other) { var O = aSet$2(this); var keysIter = getSetRecord$2(other).getIterator(); var result = clone$1(O); iterateSimple$2(keysIter, function(e) { if (has(O, e)) remove(result, e); else add(result, e); }); return result; }; return setSymmetricDifference; } var setMethodGetKeysBeforeCloningDetection; var hasRequiredSetMethodGetKeysBeforeCloningDetection; function requireSetMethodGetKeysBeforeCloningDetection() { if (hasRequiredSetMethodGetKeysBeforeCloningDetection) return setMethodGetKeysBeforeCloningDetection; hasRequiredSetMethodGetKeysBeforeCloningDetection = 1; setMethodGetKeysBeforeCloningDetection = function(METHOD_NAME) { try { var baseSet = new Set(); var setLike = { size: 0, has: function() { return true; }, keys: function() { return Object.defineProperty({}, "next", { get: function() { baseSet.clear(); baseSet.add(4); return function() { return { done: true }; }; } }); } }; var result = baseSet[METHOD_NAME](setLike); return result.size === 1 && result.values().next().value === 4; } catch (error) { return false; } }; return setMethodGetKeysBeforeCloningDetection; } var hasRequiredEs_set_symmetricDifference_v2; function requireEs_set_symmetricDifference_v2() { if (hasRequiredEs_set_symmetricDifference_v2) return es_set_symmetricDifference_v2; hasRequiredEs_set_symmetricDifference_v2 = 1; var $ = /* @__PURE__ */ require_export(); var symmetricDifference = /* @__PURE__ */ requireSetSymmetricDifference(); var setMethodGetKeysBeforeCloning = /* @__PURE__ */ requireSetMethodGetKeysBeforeCloningDetection(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike(); var FORCED = !setMethodAcceptSetLike$2("symmetricDifference") || !setMethodGetKeysBeforeCloning("symmetricDifference"); $({ target: "Set", proto: true, real: true, forced: FORCED }, { symmetricDifference }); return es_set_symmetricDifference_v2; } var es_set_union_v2 = {}; var setUnion; var hasRequiredSetUnion; function requireSetUnion() { if (hasRequiredSetUnion) return setUnion; hasRequiredSetUnion = 1; var aSet$2 = /* @__PURE__ */ requireASet(); var add = requireSetHelpers().add; var clone$1 = /* @__PURE__ */ requireSetClone(); var getSetRecord$2 = /* @__PURE__ */ requireGetSetRecord(); var iterateSimple$2 = /* @__PURE__ */ requireIterateSimple(); setUnion = function union(other) { var O = aSet$2(this); var keysIter = getSetRecord$2(other).getIterator(); var result = clone$1(O); iterateSimple$2(keysIter, function(it$1) { add(result, it$1); }); return result; }; return setUnion; } var hasRequiredEs_set_union_v2; function requireEs_set_union_v2() { if (hasRequiredEs_set_union_v2) return es_set_union_v2; hasRequiredEs_set_union_v2 = 1; var $ = /* @__PURE__ */ require_export(); var union = /* @__PURE__ */ requireSetUnion(); var setMethodGetKeysBeforeCloning = /* @__PURE__ */ requireSetMethodGetKeysBeforeCloningDetection(); var setMethodAcceptSetLike$2 = /* @__PURE__ */ requireSetMethodAcceptSetLike(); var FORCED = !setMethodAcceptSetLike$2("union") || !setMethodGetKeysBeforeCloning("union"); $({ target: "Set", proto: true, real: true, forced: FORCED }, { union }); return es_set_union_v2; } var set$2; var hasRequiredSet$2; function requireSet$2() { if (hasRequiredSet$2) return set$2; hasRequiredSet$2 = 1; requireEs_array_iterator(); requireEs_set(); requireEs_set_difference_v2(); requireEs_set_intersection_v2(); requireEs_set_isDisjointFrom_v2(); requireEs_set_isSubsetOf_v2(); requireEs_set_isSupersetOf_v2(); requireEs_set_symmetricDifference_v2(); requireEs_set_union_v2(); requireEs_string_iterator(); var path$2 = /* @__PURE__ */ requirePath(); set$2 = path$2.Set; return set$2; } var set$1; var hasRequiredSet$1; function requireSet$1() { if (hasRequiredSet$1) return set$1; hasRequiredSet$1 = 1; var parent = /* @__PURE__ */ requireSet$2(); requireWeb_domCollections_iterator(); set$1 = parent; return set$1; } var set; var hasRequiredSet; function requireSet() { if (hasRequiredSet) return set; hasRequiredSet = 1; set = /* @__PURE__ */ requireSet$1(); return set; } var setExports = requireSet(); var _Set = /* @__PURE__ */ getDefaultExportFromCjs(setExports); var es_weakMap = {}; var es_weakMap_constructor = {}; var collectionWeak; var hasRequiredCollectionWeak; function requireCollectionWeak() { if (hasRequiredCollectionWeak) return collectionWeak; hasRequiredCollectionWeak = 1; var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var defineBuiltIns$2 = /* @__PURE__ */ requireDefineBuiltIns(); var getWeakData = requireInternalMetadata().getWeakData; var anInstance$2 = /* @__PURE__ */ requireAnInstance(); var anObject$2 = /* @__PURE__ */ requireAnObject(); var isNullOrUndefined$2 = /* @__PURE__ */ requireIsNullOrUndefined(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var iterate$2 = /* @__PURE__ */ requireIterate(); var ArrayIterationModule = /* @__PURE__ */ requireArrayIteration(); var hasOwn = /* @__PURE__ */ requireHasOwnProperty(); var InternalStateModule = /* @__PURE__ */ requireInternalState(); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; var find = ArrayIterationModule.find; var findIndex = ArrayIterationModule.findIndex; var splice$5 = uncurryThis([].splice); var id = 0; var uncaughtFrozenStore = function(state) { return state.frozen || (state.frozen = new UncaughtFrozenStore()); }; var UncaughtFrozenStore = function() { this.entries = []; }; var findUncaughtFrozen = function(store, key) { return find(store.entries, function(it$1) { return it$1[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function(key) { var entry = findUncaughtFrozen(this, key); if (entry) return entry[1]; }, has: function(key) { return !!findUncaughtFrozen(this, key); }, set: function(key, value) { var entry = findUncaughtFrozen(this, key); if (entry) entry[1] = value; else this.entries.push([key, value]); }, "delete": function(key) { var index$1 = findIndex(this.entries, function(it$1) { return it$1[0] === key; }); if (~index$1) splice$5(this.entries, index$1, 1); return !!~index$1; } }; collectionWeak = { getConstructor: function(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function(that, iterable) { anInstance$2(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, id: id++, frozen: null }); if (!isNullOrUndefined$2(iterable)) iterate$2(iterable, that[ADDER], { that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function(that, key, value) { var state = getInternalState(that); var data = getWeakData(anObject$2(key), true); if (data === true) uncaughtFrozenStore(state).set(key, value); else data[state.id] = value; return that; }; defineBuiltIns$2(Prototype, { "delete": function(key) { var state = getInternalState(this); if (!isObject$3(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state)["delete"](key); return data && hasOwn(data, state.id) && delete data[state.id]; }, has: function has(key) { var state = getInternalState(this); if (!isObject$3(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).has(key); return data && hasOwn(data, state.id); } }); defineBuiltIns$2(Prototype, IS_MAP ? { get: function get(key) { var state = getInternalState(this); if (isObject$3(key)) { var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).get(key); if (data) return data[state.id]; } }, set: function set$4(key, value) { return define(this, key, value); } } : { add: function add(value) { return define(this, value, true); } }); return Constructor; } }; return collectionWeak; } var hasRequiredEs_weakMap_constructor; function requireEs_weakMap_constructor() { if (hasRequiredEs_weakMap_constructor) return es_weakMap_constructor; hasRequiredEs_weakMap_constructor = 1; var FREEZING = /* @__PURE__ */ requireFreezing(); var globalThis$1 = /* @__PURE__ */ requireGlobalThis(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var defineBuiltIns$2 = /* @__PURE__ */ requireDefineBuiltIns(); var InternalMetadataModule = /* @__PURE__ */ requireInternalMetadata(); var collection$2 = /* @__PURE__ */ requireCollection(); var collectionWeak$1 = /* @__PURE__ */ requireCollectionWeak(); var isObject$3 = /* @__PURE__ */ requireIsObject(); var enforceInternalState = requireInternalState().enforce; var fails$2 = /* @__PURE__ */ requireFails(); var NATIVE_WEAK_MAP = /* @__PURE__ */ requireWeakMapBasicDetection(); var $Object = Object; var isArray$5 = Array.isArray; var isExtensible = $Object.isExtensible; var isFrozen = $Object.isFrozen; var isSealed = $Object.isSealed; var freeze = $Object.freeze; var seal = $Object.seal; var IS_IE11 = !globalThis$1.ActiveXObject && "ActiveXObject" in globalThis$1; var InternalWeakMap; var wrapper = function(init) { return function WeakMap() { return init(this, arguments.length ? arguments[0] : void 0); }; }; var $WeakMap = collection$2("WeakMap", wrapper, collectionWeak$1); var WeakMapPrototype = $WeakMap.prototype; var nativeSet = uncurryThis(WeakMapPrototype.set); var hasMSEdgeFreezingBug = function() { return FREEZING && fails$2(function() { var frozenArray = freeze([]); nativeSet(new $WeakMap(), frozenArray, 1); return !isFrozen(frozenArray); }); }; if (NATIVE_WEAK_MAP) { if (IS_IE11) { InternalWeakMap = collectionWeak$1.getConstructor(wrapper, "WeakMap", true); InternalMetadataModule.enable(); var nativeDelete = uncurryThis(WeakMapPrototype["delete"]); var nativeHas = uncurryThis(WeakMapPrototype.has); var nativeGet = uncurryThis(WeakMapPrototype.get); defineBuiltIns$2(WeakMapPrototype, { "delete": function(key) { if (isObject$3(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeDelete(this, key) || state.frozen["delete"](key); } return nativeDelete(this, key); }, has: function has(key) { if (isObject$3(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) || state.frozen.has(key); } return nativeHas(this, key); }, get: function get(key) { if (isObject$3(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); } return nativeGet(this, key); }, set: function set$4(key, value) { if (isObject$3(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); } else nativeSet(this, key, value); return this; } }); } else if (hasMSEdgeFreezingBug()) defineBuiltIns$2(WeakMapPrototype, { set: function set$4(key, value) { var arrayIntegrityLevel; if (isArray$5(key)) { if (isFrozen(key)) arrayIntegrityLevel = freeze; else if (isSealed(key)) arrayIntegrityLevel = seal; } nativeSet(this, key, value); if (arrayIntegrityLevel) arrayIntegrityLevel(key); return this; } }); } return es_weakMap_constructor; } var hasRequiredEs_weakMap; function requireEs_weakMap() { if (hasRequiredEs_weakMap) return es_weakMap; hasRequiredEs_weakMap = 1; requireEs_weakMap_constructor(); return es_weakMap; } var weakMap$2; var hasRequiredWeakMap$2; function requireWeakMap$2() { if (hasRequiredWeakMap$2) return weakMap$2; hasRequiredWeakMap$2 = 1; requireEs_array_iterator(); requireEs_weakMap(); var path$2 = /* @__PURE__ */ requirePath(); weakMap$2 = path$2.WeakMap; return weakMap$2; } var weakMap$1; var hasRequiredWeakMap$1; function requireWeakMap$1() { if (hasRequiredWeakMap$1) return weakMap$1; hasRequiredWeakMap$1 = 1; var parent = /* @__PURE__ */ requireWeakMap$2(); requireWeb_domCollections_iterator(); weakMap$1 = parent; return weakMap$1; } var weakMap; var hasRequiredWeakMap; function requireWeakMap() { if (hasRequiredWeakMap) return weakMap; hasRequiredWeakMap = 1; weakMap = /* @__PURE__ */ requireWeakMap$1(); return weakMap; } var weakMapExports = requireWeakMap(); var _WeakMap = /* @__PURE__ */ getDefaultExportFromCjs(weakMapExports); function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); } function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; } function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); } function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } /** * @param prev * @param next */ function diffSets(prev, next$1) { const diff = new _Set(); for (const item of next$1) if (!prev.has(item)) diff.add(item); return diff; } var _previousSelection = /* @__PURE__ */ new _WeakMap(); var _selection = /* @__PURE__ */ new _WeakMap(); var SingleTypeSelectionAccumulator = class { constructor() { _classPrivateFieldInitSpec(this, _previousSelection, new _Set()); _classPrivateFieldInitSpec(this, _selection, new _Set()); } get size() { return _classPrivateFieldGet(_selection, this).size; } add() { for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) items[_key] = arguments[_key]; for (const item of items) _classPrivateFieldGet(_selection, this).add(item); } delete() { for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) items[_key2] = arguments[_key2]; for (const item of items) _classPrivateFieldGet(_selection, this).delete(item); } clear() { _classPrivateFieldGet(_selection, this).clear(); } getSelection() { return [..._classPrivateFieldGet(_selection, this)]; } getChanges() { return { added: [...diffSets(_classPrivateFieldGet(_previousSelection, this), _classPrivateFieldGet(_selection, this))], deleted: [...diffSets(_classPrivateFieldGet(_selection, this), _classPrivateFieldGet(_previousSelection, this))], previous: [...new _Set(_classPrivateFieldGet(_previousSelection, this))], current: [...new _Set(_classPrivateFieldGet(_selection, this))] }; } commit() { const changes = this.getChanges(); _classPrivateFieldSet(_previousSelection, this, _classPrivateFieldGet(_selection, this)); _classPrivateFieldSet(_selection, this, new _Set(_classPrivateFieldGet(_previousSelection, this))); for (const item of changes.added) item.select(); for (const item of changes.deleted) item.unselect(); return changes; } }; var _nodes = /* @__PURE__ */ new _WeakMap(); var _edges = /* @__PURE__ */ new _WeakMap(); var _commitHandler = /* @__PURE__ */ new _WeakMap(); var SelectionAccumulator = class { constructor() { let commitHandler = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : () => {}; _classPrivateFieldInitSpec(this, _nodes, new SingleTypeSelectionAccumulator()); _classPrivateFieldInitSpec(this, _edges, new SingleTypeSelectionAccumulator()); _classPrivateFieldInitSpec(this, _commitHandler, void 0); _classPrivateFieldSet(_commitHandler, this, commitHandler); } get sizeNodes() { return _classPrivateFieldGet(_nodes, this).size; } get sizeEdges() { return _classPrivateFieldGet(_edges, this).size; } getNodes() { return _classPrivateFieldGet(_nodes, this).getSelection(); } getEdges() { return _classPrivateFieldGet(_edges, this).getSelection(); } addNodes() { _classPrivateFieldGet(_nodes, this).add(...arguments); } addEdges() { _classPrivateFieldGet(_edges, this).add(...arguments); } deleteNodes(node) { _classPrivateFieldGet(_nodes, this).delete(node); } deleteEdges(edge) { _classPrivateFieldGet(_edges, this).delete(edge); } clear() { _classPrivateFieldGet(_nodes, this).clear(); _classPrivateFieldGet(_edges, this).clear(); } commit() { const summary = { nodes: _classPrivateFieldGet(_nodes, this).commit(), edges: _classPrivateFieldGet(_edges, this).commit() }; for (var _len3 = arguments.length, rest = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) rest[_key3] = arguments[_key3]; _classPrivateFieldGet(_commitHandler, this).call(this, summary, ...rest); return summary; } }; var SelectionHandler = class { /** * @param {object} body * @param {Canvas} canvas */ constructor(body, canvas) { this.body = body; this.canvas = canvas; this._selectionAccumulator = new SelectionAccumulator(); this.hoverObj = { nodes: {}, edges: {} }; this.options = {}; this.defaultOptions = { multiselect: false, selectable: true, selectConnectedEdges: true, hoverConnectedEdges: true }; _Object$assign(this.options, this.defaultOptions); this.body.emitter.on("_dataChanged", () => { this.updateSelection(); }); } /** * * @param {object} [options] */ setOptions(options) { if (options !== void 0) { const fields = [ "multiselect", "hoverConnectedEdges", "selectable", "selectConnectedEdges" ]; selectiveDeepExtend(fields, this.options, options); } } /** * handles the selection part of the tap; * @param {{x: number, y: number}} pointer * @returns {boolean} */ selectOnPoint(pointer) { let selected = false; if (this.options.selectable === true) { const obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer); this.unselectAll(); if (obj !== void 0) selected = this.selectObject(obj); this.body.emitter.emit("_requestRedraw"); } return selected; } /** * * @param {{x: number, y: number}} pointer * @returns {boolean} */ selectAdditionalOnPoint(pointer) { let selectionChanged = false; if (this.options.selectable === true) { const obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer); if (obj !== void 0) { selectionChanged = true; if (obj.isSelected() === true) this.deselectObject(obj); else this.selectObject(obj); this.body.emitter.emit("_requestRedraw"); } } return selectionChanged; } /** * Create an object containing the standard fields for an event. * @param {Event} event * @param {{x: number, y: number}} pointer Object with the x and y screen coordinates of the mouse * @returns {{}} * @private */ _initBaseEvent(event, pointer) { const properties = {}; properties["pointer"] = { DOM: { x: pointer.x, y: pointer.y }, canvas: this.canvas.DOMtoCanvas(pointer) }; properties["event"] = event; return properties; } /** * Generate an event which the user can catch. * * This adds some extra data to the event with respect to cursor position and * selected nodes and edges. * @param {string} eventType Name of event to send * @param {Event} event * @param {{x: number, y: number}} pointer Object with the x and y screen coordinates of the mouse * @param {object | undefined} oldSelection If present, selection state before event occured * @param {boolean|undefined} [emptySelection] Indicate if selection data should be passed */ generateClickEvent(eventType, event, pointer, oldSelection) { let emptySelection = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false; const properties = this._initBaseEvent(event, pointer); if (emptySelection === true) { properties.nodes = []; properties.edges = []; } else { const tmp = this.getSelection(); properties.nodes = tmp.nodes; properties.edges = tmp.edges; } if (oldSelection !== void 0) properties["previousSelection"] = oldSelection; if (eventType == "click") properties.items = this.getClickedItems(pointer); if (event.controlEdge !== void 0) properties.controlEdge = event.controlEdge; this.body.emitter.emit(eventType, properties); } /** * * @param {object} obj * @param {boolean} [highlightEdges] * @returns {boolean} */ selectObject(obj) { let highlightEdges = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.selectConnectedEdges; if (obj !== void 0) { if (obj instanceof Node) { if (highlightEdges === true) this._selectionAccumulator.addEdges(...obj.edges); this._selectionAccumulator.addNodes(obj); } else this._selectionAccumulator.addEdges(obj); return true; } return false; } /** * * @param {object} obj */ deselectObject(obj) { if (obj.isSelected() === true) { obj.selected = false; this._removeFromSelection(obj); } } /** * retrieve all nodes overlapping with given object * @param {object} object An object with parameters left, top, right, bottom * @returns {number[]} An array with id's of the overlapping nodes * @private */ _getAllNodesOverlappingWith(object$1) { const overlappingNodes = []; const nodes = this.body.nodes; for (let i = 0; i < this.body.nodeIndices.length; i++) { const nodeId = this.body.nodeIndices[i]; if (nodes[nodeId].isOverlappingWith(object$1)) overlappingNodes.push(nodeId); } return overlappingNodes; } /** * Return a position object in canvasspace from a single point in screenspace * @param {{x: number, y: number}} pointer * @returns {{left: number, top: number, right: number, bottom: number}} * @private */ _pointerToPositionObject(pointer) { const canvasPos = this.canvas.DOMtoCanvas(pointer); return { left: canvasPos.x - 1, top: canvasPos.y + 1, right: canvasPos.x + 1, bottom: canvasPos.y - 1 }; } /** * Get the top node at the passed point (like a click) * @param {{x: number, y: number}} pointer * @param {boolean} [returnNode] * @returns {Node | undefined} node */ getNodeAt(pointer) { let returnNode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; const positionObject = this._pointerToPositionObject(pointer); const overlappingNodes = this._getAllNodesOverlappingWith(positionObject); if (overlappingNodes.length > 0) if (returnNode === true) return this.body.nodes[overlappingNodes[overlappingNodes.length - 1]]; else return overlappingNodes[overlappingNodes.length - 1]; else return void 0; } /** * retrieve all edges overlapping with given object, selector is around center * @param {object} object An object with parameters left, top, right, bottom * @param {number[]} overlappingEdges An array with id's of the overlapping nodes * @private */ _getEdgesOverlappingWith(object$1, overlappingEdges) { const edges = this.body.edges; for (let i = 0; i < this.body.edgeIndices.length; i++) { const edgeId = this.body.edgeIndices[i]; if (edges[edgeId].isOverlappingWith(object$1)) overlappingEdges.push(edgeId); } } /** * retrieve all nodes overlapping with given object * @param {object} object An object with parameters left, top, right, bottom * @returns {number[]} An array with id's of the overlapping nodes * @private */ _getAllEdgesOverlappingWith(object$1) { const overlappingEdges = []; this._getEdgesOverlappingWith(object$1, overlappingEdges); return overlappingEdges; } /** * Get the edges nearest to the passed point (like a click) * @param {{x: number, y: number}} pointer * @param {boolean} [returnEdge] * @returns {Edge | undefined} node */ getEdgeAt(pointer) { let returnEdge = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; const canvasPos = this.canvas.DOMtoCanvas(pointer); let mindist = 10; let overlappingEdge = null; const edges = this.body.edges; for (let i = 0; i < this.body.edgeIndices.length; i++) { const edgeId = this.body.edgeIndices[i]; const edge = edges[edgeId]; if (edge.connected) { const xFrom = edge.from.x; const yFrom = edge.from.y; const xTo = edge.to.x; const yTo = edge.to.y; const dist = edge.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, canvasPos.x, canvasPos.y); if (dist < mindist) { overlappingEdge = edgeId; mindist = dist; } } } if (overlappingEdge !== null) if (returnEdge === true) return this.body.edges[overlappingEdge]; else return overlappingEdge; else return void 0; } /** * Add object to the selection array. * @param {object} obj * @private */ _addToHover(obj) { if (obj instanceof Node) this.hoverObj.nodes[obj.id] = obj; else this.hoverObj.edges[obj.id] = obj; } /** * Remove a single option from selection. * @param {object} obj * @private */ _removeFromSelection(obj) { if (obj instanceof Node) { this._selectionAccumulator.deleteNodes(obj); this._selectionAccumulator.deleteEdges(...obj.edges); } else this._selectionAccumulator.deleteEdges(obj); } /** * Unselect all nodes and edges. */ unselectAll() { this._selectionAccumulator.clear(); } /** * return the number of selected nodes * @returns {number} */ getSelectedNodeCount() { return this._selectionAccumulator.sizeNodes; } /** * return the number of selected edges * @returns {number} */ getSelectedEdgeCount() { return this._selectionAccumulator.sizeEdges; } /** * select the edges connected to the node that is being selected * @param {Node} node * @private */ _hoverConnectedEdges(node) { for (let i = 0; i < node.edges.length; i++) { const edge = node.edges[i]; edge.hover = true; this._addToHover(edge); } } /** * Remove the highlight from a node or edge, in response to mouse movement * @param {Event} event * @param {{x: number, y: number}} pointer object with the x and y screen coordinates of the mouse * @param {Node|vis.Edge} object * @private */ emitBlurEvent(event, pointer, object$1) { const properties = this._initBaseEvent(event, pointer); if (object$1.hover === true) { object$1.hover = false; if (object$1 instanceof Node) { properties.node = object$1.id; this.body.emitter.emit("blurNode", properties); } else { properties.edge = object$1.id; this.body.emitter.emit("blurEdge", properties); } } } /** * Create the highlight for a node or edge, in response to mouse movement * @param {Event} event * @param {{x: number, y: number}} pointer object with the x and y screen coordinates of the mouse * @param {Node|vis.Edge} object * @returns {boolean} hoverChanged * @private */ emitHoverEvent(event, pointer, object$1) { const properties = this._initBaseEvent(event, pointer); let hoverChanged = false; if (object$1.hover === false) { object$1.hover = true; this._addToHover(object$1); hoverChanged = true; if (object$1 instanceof Node) { properties.node = object$1.id; this.body.emitter.emit("hoverNode", properties); } else { properties.edge = object$1.id; this.body.emitter.emit("hoverEdge", properties); } } return hoverChanged; } /** * Perform actions in response to a mouse movement. * @param {Event} event * @param {{x: number, y: number}} pointer | object with the x and y screen coordinates of the mouse */ hoverObject(event, pointer) { let object$1 = this.getNodeAt(pointer); if (object$1 === void 0) object$1 = this.getEdgeAt(pointer); let hoverChanged = false; for (const nodeId in this.hoverObj.nodes) if (Object.prototype.hasOwnProperty.call(this.hoverObj.nodes, nodeId)) { if (object$1 === void 0 || object$1 instanceof Node && object$1.id != nodeId || object$1 instanceof Edge) { this.emitBlurEvent(event, pointer, this.hoverObj.nodes[nodeId]); delete this.hoverObj.nodes[nodeId]; hoverChanged = true; } } for (const edgeId in this.hoverObj.edges) if (Object.prototype.hasOwnProperty.call(this.hoverObj.edges, edgeId)) { if (hoverChanged === true) { this.hoverObj.edges[edgeId].hover = false; delete this.hoverObj.edges[edgeId]; } else if (object$1 === void 0 || object$1 instanceof Edge && object$1.id != edgeId || object$1 instanceof Node && !object$1.hover) { this.emitBlurEvent(event, pointer, this.hoverObj.edges[edgeId]); delete this.hoverObj.edges[edgeId]; hoverChanged = true; } } if (object$1 !== void 0) { const hoveredEdgesCount = _Object$keys(this.hoverObj.edges).length; const hoveredNodesCount = _Object$keys(this.hoverObj.nodes).length; const newOnlyHoveredEdge = object$1 instanceof Edge && hoveredEdgesCount === 0 && hoveredNodesCount === 0; const newOnlyHoveredNode = object$1 instanceof Node && hoveredEdgesCount === 0 && hoveredNodesCount === 0; if (hoverChanged || newOnlyHoveredEdge || newOnlyHoveredNode) hoverChanged = this.emitHoverEvent(event, pointer, object$1); if (object$1 instanceof Node && this.options.hoverConnectedEdges === true) this._hoverConnectedEdges(object$1); } if (hoverChanged === true) this.body.emitter.emit("_requestRedraw"); } /** * Commit the selection changes but don't emit any events. */ commitWithoutEmitting() { this._selectionAccumulator.commit(); } /** * Select and deselect nodes depending current selection change. * * For changing nodes, select/deselect events are fired. * * NOTE: For a given edge, if one connecting node is deselected and with the * same click the other node is selected, no events for the edge will fire. It * was selected and it will remain selected. * @param {{x: number, y: number}} pointer - The x and y coordinates of the * click, tap, dragend… that triggered this. * @param {UIEvent} event - The event that triggered this. */ commitAndEmit(pointer, event) { let selected = false; const selectionChanges = this._selectionAccumulator.commit(); const previousSelection = { nodes: selectionChanges.nodes.previous, edges: selectionChanges.edges.previous }; if (selectionChanges.edges.deleted.length > 0) { this.generateClickEvent("deselectEdge", event, pointer, previousSelection); selected = true; } if (selectionChanges.nodes.deleted.length > 0) { this.generateClickEvent("deselectNode", event, pointer, previousSelection); selected = true; } if (selectionChanges.nodes.added.length > 0) { this.generateClickEvent("selectNode", event, pointer); selected = true; } if (selectionChanges.edges.added.length > 0) { this.generateClickEvent("selectEdge", event, pointer); selected = true; } if (selected === true) this.generateClickEvent("select", event, pointer); } /** * Retrieve the currently selected node and edge ids. * @returns {{nodes: Array., edges: Array.}} Arrays with the * ids of the selected nodes and edges. */ getSelection() { return { nodes: this.getSelectedNodeIds(), edges: this.getSelectedEdgeIds() }; } /** * Retrieve the currently selected nodes. * @returns {Array} An array with selected nodes. */ getSelectedNodes() { return this._selectionAccumulator.getNodes(); } /** * Retrieve the currently selected edges. * @returns {Array} An array with selected edges. */ getSelectedEdges() { return this._selectionAccumulator.getEdges(); } /** * Retrieve the currently selected node ids. * @returns {Array} An array with the ids of the selected nodes. */ getSelectedNodeIds() { var _context; return _mapInstanceProperty(_context = this._selectionAccumulator.getNodes()).call(_context, (node) => node.id); } /** * Retrieve the currently selected edge ids. * @returns {Array} An array with the ids of the selected edges. */ getSelectedEdgeIds() { var _context2; return _mapInstanceProperty(_context2 = this._selectionAccumulator.getEdges()).call(_context2, (edge) => edge.id); } /** * Updates the current selection * @param {{nodes: Array., edges: Array.}} selection * @param {object} options Options */ setSelection(selection) { let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (!selection || !selection.nodes && !selection.edges) throw new TypeError("Selection must be an object with nodes and/or edges properties"); if (options.unselectAll || options.unselectAll === void 0) this.unselectAll(); if (selection.nodes) for (const id of selection.nodes) { const node = this.body.nodes[id]; if (!node) throw new RangeError("Node with id \"" + id + "\" not found"); this.selectObject(node, options.highlightEdges); } if (selection.edges) for (const id of selection.edges) { const edge = this.body.edges[id]; if (!edge) throw new RangeError("Edge with id \"" + id + "\" not found"); this.selectObject(edge); } this.body.emitter.emit("_requestRedraw"); this._selectionAccumulator.commit(); } /** * select zero or more nodes with the option to highlight edges * @param {number[] | string[]} selection An array with the ids of the * selected nodes. * @param {boolean} [highlightEdges] */ selectNodes(selection) { let highlightEdges = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; if (!selection || selection.length === void 0) throw "Selection must be an array with ids"; this.setSelection({ nodes: selection }, { highlightEdges }); } /** * select zero or more edges * @param {number[] | string[]} selection An array with the ids of the * selected nodes. */ selectEdges(selection) { if (!selection || selection.length === void 0) throw "Selection must be an array with ids"; this.setSelection({ edges: selection }); } /** * Validate the selection: remove ids of nodes which no longer exist * @private */ updateSelection() { for (const node in this._selectionAccumulator.getNodes()) if (!Object.prototype.hasOwnProperty.call(this.body.nodes, node.id)) this._selectionAccumulator.deleteNodes(node); for (const edge in this._selectionAccumulator.getEdges()) if (!Object.prototype.hasOwnProperty.call(this.body.edges, edge.id)) this._selectionAccumulator.deleteEdges(edge); } /** * Determine all the visual elements clicked which are on the given point. * * All elements are returned; this includes nodes, edges and their labels. * The order returned is from highest to lowest, i.e. element 0 of the return * value is the topmost item clicked on. * * The return value consists of an array of the following possible elements: * * - `{nodeId:number}` - node with given id clicked on * - `{nodeId:number, labelId:0}` - label of node with given id clicked on * - `{edgeId:number}` - edge with given id clicked on * - `{edge:number, labelId:0}` - label of edge with given id clicked on * * ## NOTES * * - Currently, there is only one label associated with a node or an edge, * but this is expected to change somewhere in the future. * - Since there is no z-indexing yet, it is not really possible to set the nodes and * edges in the correct order. For the time being, nodes come first. * @param {point} pointer mouse position in screen coordinates * @returns {Array.} * @private */ getClickedItems(pointer) { const point = this.canvas.DOMtoCanvas(pointer); const items = []; const nodeIndices = this.body.nodeIndices; const nodes = this.body.nodes; for (let i = nodeIndices.length - 1; i >= 0; i--) { const node = nodes[nodeIndices[i]]; const ret = node.getItemsOnPoint(point); items.push.apply(items, ret); } const edgeIndices = this.body.edgeIndices; const edges = this.body.edges; for (let i = edgeIndices.length - 1; i >= 0; i--) { const edge = edges[edgeIndices[i]]; const ret = edge.getItemsOnPoint(point); items.push.apply(items, ret); } return items; } }; var es_array_sort = {}; var arraySort; var hasRequiredArraySort; function requireArraySort() { if (hasRequiredArraySort) return arraySort; hasRequiredArraySort = 1; var arraySlice$2 = /* @__PURE__ */ requireArraySlice(); var floor = Math.floor; var sort$5 = function(array$1, comparefn) { var length$1 = array$1.length; if (length$1 < 8) { var i = 1; var element, j; while (i < length$1) { j = i; element = array$1[i]; while (j && comparefn(array$1[j - 1], element) > 0) array$1[j] = array$1[--j]; if (j !== i++) array$1[j] = element; } } else { var middle = floor(length$1 / 2); var left = sort$5(arraySlice$2(array$1, 0, middle), comparefn); var right = sort$5(arraySlice$2(array$1, middle), comparefn); var llength = left.length; var rlength = right.length; var lindex = 0; var rindex = 0; while (lindex < llength || rindex < rlength) array$1[lindex + rindex] = lindex < llength && rindex < rlength ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++] : lindex < llength ? left[lindex++] : right[rindex++]; } return array$1; }; arraySort = sort$5; return arraySort; } var environmentFfVersion; var hasRequiredEnvironmentFfVersion; function requireEnvironmentFfVersion() { if (hasRequiredEnvironmentFfVersion) return environmentFfVersion; hasRequiredEnvironmentFfVersion = 1; var userAgent = /* @__PURE__ */ requireEnvironmentUserAgent(); var firefox = userAgent.match(/firefox\/(\d+)/i); environmentFfVersion = !!firefox && +firefox[1]; return environmentFfVersion; } var environmentIsIeOrEdge; var hasRequiredEnvironmentIsIeOrEdge; function requireEnvironmentIsIeOrEdge() { if (hasRequiredEnvironmentIsIeOrEdge) return environmentIsIeOrEdge; hasRequiredEnvironmentIsIeOrEdge = 1; var UA = /* @__PURE__ */ requireEnvironmentUserAgent(); environmentIsIeOrEdge = /MSIE|Trident/.test(UA); return environmentIsIeOrEdge; } var environmentWebkitVersion; var hasRequiredEnvironmentWebkitVersion; function requireEnvironmentWebkitVersion() { if (hasRequiredEnvironmentWebkitVersion) return environmentWebkitVersion; hasRequiredEnvironmentWebkitVersion = 1; var userAgent = /* @__PURE__ */ requireEnvironmentUserAgent(); var webkit = userAgent.match(/AppleWebKit\/(\d+)\./); environmentWebkitVersion = !!webkit && +webkit[1]; return environmentWebkitVersion; } var hasRequiredEs_array_sort; function requireEs_array_sort() { if (hasRequiredEs_array_sort) return es_array_sort; hasRequiredEs_array_sort = 1; var $ = /* @__PURE__ */ require_export(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var aCallable$2 = /* @__PURE__ */ requireACallable(); var toObject$2 = /* @__PURE__ */ requireToObject(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); var deletePropertyOrThrow$2 = /* @__PURE__ */ requireDeletePropertyOrThrow(); var toString$2 = /* @__PURE__ */ requireToString(); var fails$2 = /* @__PURE__ */ requireFails(); var internalSort = /* @__PURE__ */ requireArraySort(); var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict(); var FF = /* @__PURE__ */ requireEnvironmentFfVersion(); var IE_OR_EDGE = /* @__PURE__ */ requireEnvironmentIsIeOrEdge(); var V8 = /* @__PURE__ */ requireEnvironmentV8Version(); var WEBKIT = /* @__PURE__ */ requireEnvironmentWebkitVersion(); var test = []; var nativeSort = uncurryThis(test.sort); var push = uncurryThis(test.push); var FAILS_ON_UNDEFINED = fails$2(function() { test.sort(void 0); }); var FAILS_ON_NULL = fails$2(function() { test.sort(null); }); var STRICT_METHOD = arrayMethodIsStrict$2("sort"); var STABLE_SORT = !fails$2(function() { if (V8) return V8 < 70; if (FF && FF > 3) return; if (IE_OR_EDGE) return true; if (WEBKIT) return WEBKIT < 603; var result = ""; var code, chr, value, index$1; for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index$1 = 0; index$1 < 47; index$1++) test.push({ k: chr + index$1, v: value }); } test.sort(function(a, b) { return b.v - a.v; }); for (index$1 = 0; index$1 < test.length; index$1++) { chr = test[index$1].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } return result !== "DGBEFHACIJK"; }); var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT; var getSortCompare = function(comparefn) { return function(x, y) { if (y === void 0) return -1; if (x === void 0) return 1; if (comparefn !== void 0) return +comparefn(x, y) || 0; return toString$2(x) > toString$2(y) ? 1 : -1; }; }; $({ target: "Array", proto: true, forced: FORCED }, { sort: function sort$5(comparefn) { if (comparefn !== void 0) aCallable$2(comparefn); var array$1 = toObject$2(this); if (STABLE_SORT) return comparefn === void 0 ? nativeSort(array$1) : nativeSort(array$1, comparefn); var items = []; var arrayLength = lengthOfArrayLike$2(array$1); var itemsLength, index$1; for (index$1 = 0; index$1 < arrayLength; index$1++) if (index$1 in array$1) push(items, array$1[index$1]); internalSort(items, getSortCompare(comparefn)); itemsLength = lengthOfArrayLike$2(items); index$1 = 0; while (index$1 < itemsLength) array$1[index$1] = items[index$1++]; while (index$1 < arrayLength) deletePropertyOrThrow$2(array$1, index$1++); return array$1; } }); return es_array_sort; } var sort$3; var hasRequiredSort$3; function requireSort$3() { if (hasRequiredSort$3) return sort$3; hasRequiredSort$3 = 1; requireEs_array_sort(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); sort$3 = getBuiltInPrototypeMethod$2("Array", "sort"); return sort$3; } var sort$2; var hasRequiredSort$2; function requireSort$2() { if (hasRequiredSort$2) return sort$2; hasRequiredSort$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireSort$3(); var ArrayPrototype = Array.prototype; sort$2 = function(it$1) { var own = it$1.sort; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.sort ? method : own; }; return sort$2; } var sort$1; var hasRequiredSort$1; function requireSort$1() { if (hasRequiredSort$1) return sort$1; hasRequiredSort$1 = 1; var parent = /* @__PURE__ */ requireSort$2(); sort$1 = parent; return sort$1; } var sort; var hasRequiredSort; function requireSort() { if (hasRequiredSort) return sort; hasRequiredSort = 1; sort = /* @__PURE__ */ requireSort$1(); return sort; } var sortExports = requireSort(); var _sortInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(sortExports); var es_object_values = {}; var objectToArray; var hasRequiredObjectToArray; function requireObjectToArray() { if (hasRequiredObjectToArray) return objectToArray; hasRequiredObjectToArray = 1; var DESCRIPTORS = /* @__PURE__ */ requireDescriptors(); var fails$2 = /* @__PURE__ */ requireFails(); var uncurryThis = /* @__PURE__ */ requireFunctionUncurryThis(); var objectGetPrototypeOf$2 = /* @__PURE__ */ requireObjectGetPrototypeOf(); var objectKeys$2 = /* @__PURE__ */ requireObjectKeys(); var toIndexedObject$2 = /* @__PURE__ */ requireToIndexedObject(); var $propertyIsEnumerable = requireObjectPropertyIsEnumerable().f; var propertyIsEnumerable = uncurryThis($propertyIsEnumerable); var push = uncurryThis([].push); var IE_BUG = DESCRIPTORS && fails$2(function() { var O = Object.create(null); O[2] = 2; return !propertyIsEnumerable(O, 2); }); var createMethod = function(TO_ENTRIES) { return function(it$1) { var O = toIndexedObject$2(it$1); var keys$8 = objectKeys$2(O); var IE_WORKAROUND = IE_BUG && objectGetPrototypeOf$2(O) === null; var length$1 = keys$8.length; var i = 0; var result = []; var key; while (length$1 > i) { key = keys$8[i++]; if (!DESCRIPTORS || (IE_WORKAROUND ? key in O : propertyIsEnumerable(O, key))) push(result, TO_ENTRIES ? [key, O[key]] : O[key]); } return result; }; }; objectToArray = { entries: createMethod(true), values: createMethod(false) }; return objectToArray; } var hasRequiredEs_object_values; function requireEs_object_values() { if (hasRequiredEs_object_values) return es_object_values; hasRequiredEs_object_values = 1; var $ = /* @__PURE__ */ require_export(); var $values = requireObjectToArray().values; $({ target: "Object", stat: true }, { values: function values$8(O) { return $values(O); } }); return es_object_values; } var values$2; var hasRequiredValues$2; function requireValues$2() { if (hasRequiredValues$2) return values$2; hasRequiredValues$2 = 1; requireEs_object_values(); var path$2 = /* @__PURE__ */ requirePath(); values$2 = path$2.Object.values; return values$2; } var values$1; var hasRequiredValues$1; function requireValues$1() { if (hasRequiredValues$1) return values$1; hasRequiredValues$1 = 1; var parent = /* @__PURE__ */ requireValues$2(); values$1 = parent; return values$1; } var values; var hasRequiredValues; function requireValues() { if (hasRequiredValues) return values; hasRequiredValues = 1; values = /* @__PURE__ */ requireValues$1(); return values; } var valuesExports = requireValues(); var _Object$values = /* @__PURE__ */ getDefaultExportFromCjs(valuesExports); var es_array_reduce = {}; var arrayReduce; var hasRequiredArrayReduce; function requireArrayReduce() { if (hasRequiredArrayReduce) return arrayReduce; hasRequiredArrayReduce = 1; var aCallable$2 = /* @__PURE__ */ requireACallable(); var toObject$2 = /* @__PURE__ */ requireToObject(); var IndexedObject = /* @__PURE__ */ requireIndexedObject(); var lengthOfArrayLike$2 = /* @__PURE__ */ requireLengthOfArrayLike(); var $TypeError = TypeError; var REDUCE_EMPTY = "Reduce of empty array with no initial value"; var createMethod = function(IS_RIGHT) { return function(that, callbackfn, argumentsLength, memo) { var O = toObject$2(that); var self$1 = IndexedObject(O); var length$1 = lengthOfArrayLike$2(O); aCallable$2(callbackfn); if (length$1 === 0 && argumentsLength < 2) throw new $TypeError(REDUCE_EMPTY); var index$1 = IS_RIGHT ? length$1 - 1 : 0; var i = IS_RIGHT ? -1 : 1; if (argumentsLength < 2) while (true) { if (index$1 in self$1) { memo = self$1[index$1]; index$1 += i; break; } index$1 += i; if (IS_RIGHT ? index$1 < 0 : length$1 <= index$1) throw new $TypeError(REDUCE_EMPTY); } for (; IS_RIGHT ? index$1 >= 0 : length$1 > index$1; index$1 += i) if (index$1 in self$1) memo = callbackfn(memo, self$1[index$1], index$1, O); return memo; }; }; arrayReduce = { left: createMethod(false), right: createMethod(true) }; return arrayReduce; } var environmentIsNode; var hasRequiredEnvironmentIsNode; function requireEnvironmentIsNode() { if (hasRequiredEnvironmentIsNode) return environmentIsNode; hasRequiredEnvironmentIsNode = 1; var ENVIRONMENT = /* @__PURE__ */ requireEnvironment(); environmentIsNode = ENVIRONMENT === "NODE"; return environmentIsNode; } var hasRequiredEs_array_reduce; function requireEs_array_reduce() { if (hasRequiredEs_array_reduce) return es_array_reduce; hasRequiredEs_array_reduce = 1; var $ = /* @__PURE__ */ require_export(); var $reduce = requireArrayReduce().left; var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict(); var CHROME_VERSION = /* @__PURE__ */ requireEnvironmentV8Version(); var IS_NODE = /* @__PURE__ */ requireEnvironmentIsNode(); var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83; var FORCED = CHROME_BUG || !arrayMethodIsStrict$2("reduce"); $({ target: "Array", proto: true, forced: FORCED }, { reduce: function reduce$5(callbackfn) { var length$1 = arguments.length; return $reduce(this, callbackfn, length$1, length$1 > 1 ? arguments[1] : void 0); } }); return es_array_reduce; } var reduce$3; var hasRequiredReduce$3; function requireReduce$3() { if (hasRequiredReduce$3) return reduce$3; hasRequiredReduce$3 = 1; requireEs_array_reduce(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); reduce$3 = getBuiltInPrototypeMethod$2("Array", "reduce"); return reduce$3; } var reduce$2; var hasRequiredReduce$2; function requireReduce$2() { if (hasRequiredReduce$2) return reduce$2; hasRequiredReduce$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireReduce$3(); var ArrayPrototype = Array.prototype; reduce$2 = function(it$1) { var own = it$1.reduce; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.reduce ? method : own; }; return reduce$2; } var reduce$1; var hasRequiredReduce$1; function requireReduce$1() { if (hasRequiredReduce$1) return reduce$1; hasRequiredReduce$1 = 1; var parent = /* @__PURE__ */ requireReduce$2(); reduce$1 = parent; return reduce$1; } var reduce; var hasRequiredReduce; function requireReduce() { if (hasRequiredReduce) return reduce; hasRequiredReduce = 1; reduce = /* @__PURE__ */ requireReduce$1(); return reduce; } var reduceExports = requireReduce(); var _reduceInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(reduceExports); var DirectionInterface = class { /** * @ignore */ abstract() { throw new Error("Can't instantiate abstract class!"); } /** * This is a dummy call which is used to suppress the jsdoc errors of type: * * "'param' is assigned a value but never used" * @ignore */ fake_use() {} /** * Type to use to translate dynamic curves to, in the case of hierarchical layout. * Dynamic curves do not work for these. * * The value should be perpendicular to the actual direction of the layout. * @returns {string} Direction, either 'vertical' or 'horizontal' */ curveType() { return this.abstract(); } /** * Return the value of the coordinate that is not fixed for this direction. * @param {Node} node The node to read * @returns {number} Value of the unfixed coordinate */ getPosition(node) { this.fake_use(node); return this.abstract(); } /** * Set the value of the coordinate that is not fixed for this direction. * @param {Node} node The node to adjust * @param {number} position * @param {number} [level] if specified, the hierarchy level that this node should be fixed to */ setPosition(node, position) { let level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0; this.fake_use(node, position, level); this.abstract(); } /** * Get the width of a tree. * * A `tree` here is a subset of nodes within the network which are not connected to other nodes, * only among themselves. In essence, it is a sub-network. * @param {number} index The index number of a tree * @returns {number} the width of a tree in the view coordinates */ getTreeSize(index$1) { this.fake_use(index$1); return this.abstract(); } /** * Sort array of nodes on the unfixed coordinates. * * Note:** chrome has non-stable sorting implementation, which * has a tendency to change the order of the array items, * even if the custom sort function returns 0. * * For this reason, an external sort implementation is used, * which has the added benefit of being faster than the standard * platforms implementation. This has been verified on `node.js`, * `firefox` and `chrome` (all linux). * @param {Array.} nodeArray array of nodes to sort */ sort(nodeArray) { this.fake_use(nodeArray); this.abstract(); } /** * Assign the fixed coordinate of the node to the given level * @param {Node} node The node to adjust * @param {number} level The level to fix to */ fix(node, level) { this.fake_use(node, level); this.abstract(); } /** * Add an offset to the unfixed coordinate of the given node. * @param {NodeId} nodeId Id of the node to adjust * @param {number} diff Offset to add to the unfixed coordinate */ shift(nodeId, diff) { this.fake_use(nodeId, diff); this.abstract(); } }; var VerticalStrategy = class extends DirectionInterface { /** * Constructor * @param {object} layout reference to the parent LayoutEngine instance. */ constructor(layout) { super(); this.layout = layout; } /** @inheritDoc */ curveType() { return "horizontal"; } /** @inheritDoc */ getPosition(node) { return node.x; } /** @inheritDoc */ setPosition(node, position) { let level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0; if (level !== void 0) this.layout.hierarchical.addToOrdering(node, level); node.x = position; } /** @inheritDoc */ getTreeSize(index$1) { const res = this.layout.hierarchical.getTreeSize(this.layout.body.nodes, index$1); return { min: res.min_x, max: res.max_x }; } /** @inheritDoc */ sort(nodeArray) { _sortInstanceProperty(nodeArray).call(nodeArray, function(a, b) { return a.x - b.x; }); } /** @inheritDoc */ fix(node, level) { node.y = this.layout.options.hierarchical.levelSeparation * level; node.options.fixed.y = true; } /** @inheritDoc */ shift(nodeId, diff) { this.layout.body.nodes[nodeId].x += diff; } }; var HorizontalStrategy = class extends DirectionInterface { /** * Constructor * @param {object} layout reference to the parent LayoutEngine instance. */ constructor(layout) { super(); this.layout = layout; } /** @inheritDoc */ curveType() { return "vertical"; } /** @inheritDoc */ getPosition(node) { return node.y; } /** @inheritDoc */ setPosition(node, position) { let level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0; if (level !== void 0) this.layout.hierarchical.addToOrdering(node, level); node.y = position; } /** @inheritDoc */ getTreeSize(index$1) { const res = this.layout.hierarchical.getTreeSize(this.layout.body.nodes, index$1); return { min: res.min_y, max: res.max_y }; } /** @inheritDoc */ sort(nodeArray) { _sortInstanceProperty(nodeArray).call(nodeArray, function(a, b) { return a.y - b.y; }); } /** @inheritDoc */ fix(node, level) { node.x = this.layout.options.hierarchical.levelSeparation * level; node.options.fixed.x = true; } /** @inheritDoc */ shift(nodeId, diff) { this.layout.body.nodes[nodeId].y += diff; } }; var es_array_every = {}; var hasRequiredEs_array_every; function requireEs_array_every() { if (hasRequiredEs_array_every) return es_array_every; hasRequiredEs_array_every = 1; var $ = /* @__PURE__ */ require_export(); var $every = requireArrayIteration().every; var arrayMethodIsStrict$2 = /* @__PURE__ */ requireArrayMethodIsStrict(); var STRICT_METHOD = arrayMethodIsStrict$2("every"); $({ target: "Array", proto: true, forced: !STRICT_METHOD }, { every: function every$4(callbackfn) { return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : void 0); } }); return es_array_every; } var every$3; var hasRequiredEvery$3; function requireEvery$3() { if (hasRequiredEvery$3) return every$3; hasRequiredEvery$3 = 1; requireEs_array_every(); var getBuiltInPrototypeMethod$2 = /* @__PURE__ */ requireGetBuiltInPrototypeMethod(); every$3 = getBuiltInPrototypeMethod$2("Array", "every"); return every$3; } var every$2; var hasRequiredEvery$2; function requireEvery$2() { if (hasRequiredEvery$2) return every$2; hasRequiredEvery$2 = 1; var isPrototypeOf = /* @__PURE__ */ requireObjectIsPrototypeOf(); var method = /* @__PURE__ */ requireEvery$3(); var ArrayPrototype = Array.prototype; every$2 = function(it$1) { var own = it$1.every; return it$1 === ArrayPrototype || isPrototypeOf(ArrayPrototype, it$1) && own === ArrayPrototype.every ? method : own; }; return every$2; } var every$1; var hasRequiredEvery$1; function requireEvery$1() { if (hasRequiredEvery$1) return every$1; hasRequiredEvery$1 = 1; var parent = /* @__PURE__ */ requireEvery$2(); every$1 = parent; return every$1; } var every; var hasRequiredEvery; function requireEvery() { if (hasRequiredEvery) return every; hasRequiredEvery = 1; every = /* @__PURE__ */ requireEvery$1(); return every; } var everyExports = requireEvery(); var _everyInstanceProperty = /* @__PURE__ */ getDefaultExportFromCjs(everyExports); /** * Try to assign levels to nodes according to their positions in the cyclic “hierarchy”. * @param nodes - Visible nodes of the graph. * @param levels - If present levels will be added to it, if not a new object will be created. * @returns Populated node levels. */ function fillLevelsByDirectionCyclic(nodes, levels) { const edges = new _Set(); _forEachInstanceProperty(nodes).call(nodes, (node) => { var _context; _forEachInstanceProperty(_context = node.edges).call(_context, (edge) => { if (edge.connected) edges.add(edge); }); }); _forEachInstanceProperty(edges).call(edges, (edge) => { const fromId = edge.from.id; const toId = edge.to.id; if (levels[fromId] == null) levels[fromId] = 0; if (levels[toId] == null || levels[fromId] >= levels[toId]) levels[toId] = levels[fromId] + 1; }); return levels; } /** * Assign levels to nodes according to their positions in the hierarchy. Leaves will be lined up at the bottom and all other nodes as close to their children as possible. * @param nodes - Visible nodes of the graph. * @returns Populated node levels. */ function fillLevelsByDirectionLeaves(nodes) { return fillLevelsByDirection( // Pick only leaves (nodes without children). (node) => { var _context2, _context3; return _everyInstanceProperty( _context2 = _filterInstanceProperty( _context3 = node.edges // Take only visible nodes into account. ).call(_context3, (edge) => nodes.has(edge.toId)) // Check that all edges lead to this node (leaf). ).call(_context2, (edge) => edge.to === node); }, // Use the lowest level. (newLevel, oldLevel) => oldLevel > newLevel, // Go against the direction of the edges. "from", nodes ); } /** * Assign levels to nodes according to their positions in the hierarchy. Roots will be lined up at the top and all nodes as close to their parents as possible. * @param nodes - Visible nodes of the graph. * @returns Populated node levels. */ function fillLevelsByDirectionRoots(nodes) { return fillLevelsByDirection( // Pick only roots (nodes without parents). (node) => { var _context4, _context5; return _everyInstanceProperty( _context4 = _filterInstanceProperty( _context5 = node.edges // Take only visible nodes into account. ).call(_context5, (edge) => nodes.has(edge.toId)) // Check that all edges lead from this node (root). ).call(_context4, (edge) => edge.from === node); }, // Use the highest level. (newLevel, oldLevel) => oldLevel < newLevel, // Go in the direction of the edges. "to", nodes ); } /** * Assign levels to nodes according to their positions in the hierarchy. * @param isEntryNode - Checks and return true if the graph should be traversed from this node. * @param shouldLevelBeReplaced - Checks and returns true if the level of given node should be updated to the new value. * @param direction - Wheter the graph should be traversed in the direction of the edges `"to"` or in the other way `"from"`. * @param nodes - Visible nodes of the graph. * @returns Populated node levels. */ function fillLevelsByDirection(isEntryNode, shouldLevelBeReplaced, direction, nodes) { var _context6; const levels = _Object$create(null); const limit = _reduceInstanceProperty(_context6 = [..._valuesInstanceProperty(nodes).call(nodes)]).call(_context6, (acc, node) => acc + 1 + node.edges.length, 0); const edgeIdProp = direction + "Id"; const newLevelDiff = direction === "to" ? 1 : -1; for (const [entryNodeId, entryNode] of nodes) { if (!nodes.has(entryNodeId) || !isEntryNode(entryNode)) continue; levels[entryNodeId] = 0; const stack = [entryNode]; let done = 0; let node; while (node = stack.pop()) { var _context7, _context8; if (!nodes.has(entryNodeId)) continue; const newLevel = levels[node.id] + newLevelDiff; _forEachInstanceProperty(_context7 = _filterInstanceProperty(_context8 = node.edges).call(_context8, (edge) => edge.connected && edge.to !== edge.from && edge[direction] !== node && nodes.has(edge.toId) && nodes.has(edge.fromId))).call(_context7, (edge) => { const targetNodeId = edge[edgeIdProp]; const oldLevel = levels[targetNodeId]; if (oldLevel == null || shouldLevelBeReplaced(newLevel, oldLevel)) { levels[targetNodeId] = newLevel; stack.push(edge[direction]); } }); if (done > limit) return fillLevelsByDirectionCyclic(nodes, levels); else ++done; } } return levels; } var HierarchicalStatus = class { /** * @ignore */ constructor() { this.childrenReference = {}; this.parentReference = {}; this.trees = {}; this.distributionOrdering = {}; this.levels = {}; this.distributionIndex = {}; this.isTree = false; this.treeIndex = -1; } /** * Add the relation between given nodes to the current state. * @param {Node.id} parentNodeId * @param {Node.id} childNodeId */ addRelation(parentNodeId, childNodeId) { if (this.childrenReference[parentNodeId] === void 0) this.childrenReference[parentNodeId] = []; this.childrenReference[parentNodeId].push(childNodeId); if (this.parentReference[childNodeId] === void 0) this.parentReference[childNodeId] = []; this.parentReference[childNodeId].push(parentNodeId); } /** * Check if the current state is for a formal tree or formal forest. * * This is the case if every node has at most one parent. * * Pre: parentReference init'ed properly for current network */ checkIfTree() { for (const i in this.parentReference) if (this.parentReference[i].length > 1) { this.isTree = false; return; } this.isTree = true; } /** * Return the number of separate trees in the current network. * @returns {number} */ numTrees() { return this.treeIndex + 1; } /** * Assign a tree id to a node * @param {Node} node * @param {string|number} treeId */ setTreeIndex(node, treeId) { if (treeId === void 0) return; if (this.trees[node.id] === void 0) { this.trees[node.id] = treeId; this.treeIndex = Math.max(treeId, this.treeIndex); } } /** * Ensure level for given id is defined. * * Sets level to zero for given node id if not already present * @param {Node.id} nodeId */ ensureLevel(nodeId) { if (this.levels[nodeId] === void 0) this.levels[nodeId] = 0; } /** * get the maximum level of a branch. * * TODO: Never entered; find a test case to test this! * @param {Node.id} nodeId * @returns {number} */ getMaxLevel(nodeId) { const accumulator = {}; const _getMaxLevel = (nodeId$1) => { if (accumulator[nodeId$1] !== void 0) return accumulator[nodeId$1]; let level = this.levels[nodeId$1]; if (this.childrenReference[nodeId$1]) { const children = this.childrenReference[nodeId$1]; if (children.length > 0) for (let i = 0; i < children.length; i++) level = Math.max(level, _getMaxLevel(children[i])); } accumulator[nodeId$1] = level; return level; }; return _getMaxLevel(nodeId); } /** * * @param {Node} nodeA * @param {Node} nodeB */ levelDownstream(nodeA, nodeB) { if (this.levels[nodeB.id] === void 0) { if (this.levels[nodeA.id] === void 0) this.levels[nodeA.id] = 0; this.levels[nodeB.id] = this.levels[nodeA.id] + 1; } } /** * Small util method to set the minimum levels of the nodes to zero and * eliminate gaps (for cyclic). */ setMinLevelToZero() { var _context; const remap = new _Map(); let newLevel = 0; const uniqueSortedLevels = _sortInstanceProperty(_context = [...new _Set(_Object$values(this.levels))]).call(_context, (a, b) => a - b); for (const level of uniqueSortedLevels) remap.set(level, newLevel++); for (const nodeId in this.levels) if (Object.prototype.hasOwnProperty.call(this.levels, nodeId)) this.levels[nodeId] = remap.get(this.levels[nodeId]); } /** * Get the min and max xy-coordinates of a given tree * @param {Array.} nodes * @param {number} index * @returns {{min_x: number, max_x: number, min_y: number, max_y: number}} */ getTreeSize(nodes, index$1) { let min_x = 1e9; let max_x = -1e9; let min_y = 1e9; let max_y = -1e9; for (const nodeId in this.trees) if (Object.prototype.hasOwnProperty.call(this.trees, nodeId)) { if (this.trees[nodeId] === index$1) { const node = nodes[nodeId]; min_x = Math.min(node.x, min_x); max_x = Math.max(node.x, max_x); min_y = Math.min(node.y, min_y); max_y = Math.max(node.y, max_y); } } return { min_x, max_x, min_y, max_y }; } /** * Check if two nodes have the same parent(s) * @param {Node} node1 * @param {Node} node2 * @returns {boolean} true if the two nodes have a same ancestor node, false otherwise */ hasSameParent(node1, node2) { const parents1 = this.parentReference[node1.id]; const parents2 = this.parentReference[node2.id]; if (parents1 === void 0 || parents2 === void 0) return false; for (let i = 0; i < parents1.length; i++) for (let j = 0; j < parents2.length; j++) if (parents1[i] == parents2[j]) return true; return false; } /** * Check if two nodes are in the same tree. * @param {Node} node1 * @param {Node} node2 * @returns {boolean} true if this is so, false otherwise */ inSameSubNetwork(node1, node2) { return this.trees[node1.id] === this.trees[node2.id]; } /** * Get a list of the distinct levels in the current network * @returns {Array} */ getLevels() { return _Object$keys(this.distributionOrdering); } /** * Add a node to the ordering per level * @param {Node} node * @param {number} level */ addToOrdering(node, level) { if (this.distributionOrdering[level] === void 0) this.distributionOrdering[level] = []; let isPresent = false; const curLevel = this.distributionOrdering[level]; for (const n in curLevel) if (curLevel[n] === node) { isPresent = true; break; } if (!isPresent) { this.distributionOrdering[level].push(node); this.distributionIndex[node.id] = this.distributionOrdering[level].length - 1; } } }; var LayoutEngine = class { /** * @param {object} body */ constructor(body) { this.body = body; this._resetRNG(Math.random() + ":" + _Date$now()); this.setPhysics = false; this.options = {}; this.optionsBackup = { physics: {} }; this.defaultOptions = { randomSeed: void 0, improvedLayout: true, clusterThreshold: 150, hierarchical: { enabled: false, levelSeparation: 150, nodeSpacing: 100, treeSpacing: 200, blockShifting: true, edgeMinimization: true, parentCentralization: true, direction: "UD", sortMethod: "hubsize" } }; _Object$assign(this.options, this.defaultOptions); this.bindEventListeners(); } /** * Binds event listeners */ bindEventListeners() { this.body.emitter.on("_dataChanged", () => { this.setupHierarchicalLayout(); }); this.body.emitter.on("_dataLoaded", () => { this.layoutNetwork(); }); this.body.emitter.on("_resetHierarchicalLayout", () => { this.setupHierarchicalLayout(); }); this.body.emitter.on("_adjustEdgesForHierarchicalLayout", () => { if (this.options.hierarchical.enabled !== true) return; const type = this.direction.curveType(); this.body.emitter.emit("_forceDisableDynamicCurves", type, false); }); } /** * * @param {object} options * @param {object} allOptions * @returns {object} */ setOptions(options, allOptions$2) { if (options !== void 0) { const hierarchical = this.options.hierarchical; const prevHierarchicalState = hierarchical.enabled; selectiveDeepExtend([ "randomSeed", "improvedLayout", "clusterThreshold" ], this.options, options); mergeOptions(this.options, options, "hierarchical"); if (options.randomSeed !== void 0) this._resetRNG(options.randomSeed); if (hierarchical.enabled === true) { if (prevHierarchicalState === true) this.body.emitter.emit("refresh", true); if (hierarchical.direction === "RL" || hierarchical.direction === "DU") { if (hierarchical.levelSeparation > 0) hierarchical.levelSeparation *= -1; } else if (hierarchical.levelSeparation < 0) hierarchical.levelSeparation *= -1; this.setDirectionStrategy(); this.body.emitter.emit("_resetHierarchicalLayout"); return this.adaptAllOptionsForHierarchicalLayout(allOptions$2); } else if (prevHierarchicalState === true) { this.body.emitter.emit("refresh"); return deepExtend(allOptions$2, this.optionsBackup); } } return allOptions$2; } /** * Reset the random number generator with given seed. * @param {any} seed - The seed that will be forwarded the the RNG. */ _resetRNG(seed) { this.initialRandomSeed = seed; this._rng = Alea(this.initialRandomSeed); } /** * * @param {object} allOptions * @returns {object} */ adaptAllOptionsForHierarchicalLayout(allOptions$2) { if (this.options.hierarchical.enabled === true) { const backupPhysics = this.optionsBackup.physics; if (allOptions$2.physics === void 0 || allOptions$2.physics === true) { allOptions$2.physics = { enabled: backupPhysics.enabled === void 0 ? true : backupPhysics.enabled, solver: "hierarchicalRepulsion" }; backupPhysics.enabled = backupPhysics.enabled === void 0 ? true : backupPhysics.enabled; backupPhysics.solver = backupPhysics.solver || "barnesHut"; } else if (typeof allOptions$2.physics === "object") { backupPhysics.enabled = allOptions$2.physics.enabled === void 0 ? true : allOptions$2.physics.enabled; backupPhysics.solver = allOptions$2.physics.solver || "barnesHut"; allOptions$2.physics.solver = "hierarchicalRepulsion"; } else if (allOptions$2.physics !== false) { backupPhysics.solver = "barnesHut"; allOptions$2.physics = { solver: "hierarchicalRepulsion" }; } let type = this.direction.curveType(); if (allOptions$2.edges === void 0) { this.optionsBackup.edges = { smooth: { enabled: true, type: "dynamic" } }; allOptions$2.edges = { smooth: false }; } else if (allOptions$2.edges.smooth === void 0) { this.optionsBackup.edges = { smooth: { enabled: true, type: "dynamic" } }; allOptions$2.edges.smooth = false; } else if (typeof allOptions$2.edges.smooth === "boolean") { this.optionsBackup.edges = { smooth: allOptions$2.edges.smooth }; allOptions$2.edges.smooth = { enabled: allOptions$2.edges.smooth, type }; } else { const smooth = allOptions$2.edges.smooth; if (smooth.type !== void 0 && smooth.type !== "dynamic") type = smooth.type; this.optionsBackup.edges = { smooth: { enabled: smooth.enabled === void 0 ? true : smooth.enabled, type: smooth.type === void 0 ? "dynamic" : smooth.type, roundness: smooth.roundness === void 0 ? .5 : smooth.roundness, forceDirection: smooth.forceDirection === void 0 ? false : smooth.forceDirection } }; allOptions$2.edges.smooth = { enabled: smooth.enabled === void 0 ? true : smooth.enabled, type, roundness: smooth.roundness === void 0 ? .5 : smooth.roundness, forceDirection: smooth.forceDirection === void 0 ? false : smooth.forceDirection }; } this.body.emitter.emit("_forceDisableDynamicCurves", type); } return allOptions$2; } /** * * @param {Array.} nodesArray */ positionInitially(nodesArray) { if (this.options.hierarchical.enabled !== true) { this._resetRNG(this.initialRandomSeed); const radius = nodesArray.length + 50; for (let i = 0; i < nodesArray.length; i++) { const node = nodesArray[i]; const angle = 2 * Math.PI * this._rng(); if (node.x === void 0) node.x = radius * Math.cos(angle); if (node.y === void 0) node.y = radius * Math.sin(angle); } } } /** * Use Kamada Kawai to position nodes. This is quite a heavy algorithm so if there are a lot of nodes we * cluster them first to reduce the amount. */ layoutNetwork() { if (this.options.hierarchical.enabled !== true && this.options.improvedLayout === true) { const indices = this.body.nodeIndices; let positionDefined = 0; for (let i = 0; i < indices.length; i++) { const node = this.body.nodes[indices[i]]; if (node.predefinedPosition === true) positionDefined += 1; } if (positionDefined < .5 * indices.length) { const MAX_LEVELS = 10; let level = 0; const clusterThreshold = this.options.clusterThreshold; const clusterOptions = { clusterNodeProperties: { shape: "ellipse", label: "", group: "", font: { multi: false } }, clusterEdgeProperties: { label: "", font: { multi: false }, smooth: { enabled: false } } }; if (indices.length > clusterThreshold) { const startLength = indices.length; while (indices.length > clusterThreshold && level <= MAX_LEVELS) { level += 1; const before = indices.length; if (level % 3 === 0) this.body.modules.clustering.clusterBridges(clusterOptions); else this.body.modules.clustering.clusterOutliers(clusterOptions); const after = indices.length; if (before == after && level % 3 !== 0) { this._declusterAll(); this.body.emitter.emit("_layoutFailed"); console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance."); return; } } this.body.modules.kamadaKawai.setOptions({ springLength: Math.max(150, 2 * startLength) }); } if (level > MAX_LEVELS) console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."); this.body.modules.kamadaKawai.solve(indices, this.body.edgeIndices, true); this._shiftToCenter(); const offset = 70; for (let i = 0; i < indices.length; i++) { const node = this.body.nodes[indices[i]]; if (node.predefinedPosition === false) { node.x += (.5 - this._rng()) * offset; node.y += (.5 - this._rng()) * offset; } } this._declusterAll(); this.body.emitter.emit("_repositionBezierNodes"); } } } /** * Move all the nodes towards to the center so gravitational pull wil not move the nodes away from view * @private */ _shiftToCenter() { const range = NetworkUtil.getRangeCore(this.body.nodes, this.body.nodeIndices); const center = NetworkUtil.findCenter(range); for (let i = 0; i < this.body.nodeIndices.length; i++) { const node = this.body.nodes[this.body.nodeIndices[i]]; node.x -= center.x; node.y -= center.y; } } /** * Expands all clusters * @private */ _declusterAll() { let clustersPresent = true; while (clustersPresent === true) { clustersPresent = false; for (let i = 0; i < this.body.nodeIndices.length; i++) if (this.body.nodes[this.body.nodeIndices[i]].isCluster === true) { clustersPresent = true; this.body.modules.clustering.openCluster(this.body.nodeIndices[i], {}, false); } if (clustersPresent === true) this.body.emitter.emit("_dataChanged"); } } /** * * @returns {number|*} */ getSeed() { return this.initialRandomSeed; } /** * This is the main function to layout the nodes in a hierarchical way. * It checks if the node details are supplied correctly * @private */ setupHierarchicalLayout() { if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) { let node, nodeId; let definedLevel = false; let undefinedLevel = false; this.lastNodeOnLevel = {}; this.hierarchical = new HierarchicalStatus(); for (nodeId in this.body.nodes) if (Object.prototype.hasOwnProperty.call(this.body.nodes, nodeId)) { node = this.body.nodes[nodeId]; if (node.options.level !== void 0) { definedLevel = true; this.hierarchical.levels[nodeId] = node.options.level; } else undefinedLevel = true; } if (undefinedLevel === true && definedLevel === true) throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes."); else { if (undefinedLevel === true) { const sortMethod = this.options.hierarchical.sortMethod; if (sortMethod === "hubsize") this._determineLevelsByHubsize(); else if (sortMethod === "directed") this._determineLevelsDirected(); else if (sortMethod === "custom") this._determineLevelsCustomCallback(); } for (const nodeId$1 in this.body.nodes) if (Object.prototype.hasOwnProperty.call(this.body.nodes, nodeId$1)) this.hierarchical.ensureLevel(nodeId$1); const distribution = this._getDistribution(); this._generateMap(); this._placeNodesByHierarchy(distribution); this._condenseHierarchy(); this._shiftToCenter(); } } } /** * @private */ _condenseHierarchy() { var _this = this; let stillShifting = false; const branches = {}; const shiftTrees = () => { const treeSizes = getTreeSizes(); let shiftBy = 0; for (let i = 0; i < treeSizes.length - 1; i++) { const diff = treeSizes[i].max - treeSizes[i + 1].min; shiftBy += diff + this.options.hierarchical.treeSpacing; shiftTree(i + 1, shiftBy); } }; const shiftTree = (index$1, offset) => { const trees = this.hierarchical.trees; for (const nodeId in trees) if (Object.prototype.hasOwnProperty.call(trees, nodeId)) { if (trees[nodeId] === index$1) this.direction.shift(nodeId, offset); } }; const getTreeSizes = () => { const treeWidths = []; for (let i = 0; i < this.hierarchical.numTrees(); i++) treeWidths.push(this.direction.getTreeSize(i)); return treeWidths; }; const getBranchNodes = (source, map$8) => { if (map$8[source.id]) return; map$8[source.id] = true; if (this.hierarchical.childrenReference[source.id]) { const children = this.hierarchical.childrenReference[source.id]; if (children.length > 0) for (let i = 0; i < children.length; i++) getBranchNodes(this.body.nodes[children[i]], map$8); } }; const getBranchBoundary = function(branchMap) { let maxLevel = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e9; let minSpace = 1e9; let maxSpace = 1e9; let min = 1e9; let max = -1e9; for (const branchNode in branchMap) if (Object.prototype.hasOwnProperty.call(branchMap, branchNode)) { const node = _this.body.nodes[branchNode]; const level = _this.hierarchical.levels[node.id]; const position = _this.direction.getPosition(node); const [minSpaceNode, maxSpaceNode] = _this._getSpaceAroundNode(node, branchMap); minSpace = Math.min(minSpaceNode, minSpace); maxSpace = Math.min(maxSpaceNode, maxSpace); if (level <= maxLevel) { min = Math.min(position, min); max = Math.max(position, max); } } return [ min, max, minSpace, maxSpace ]; }; const getCollisionLevel = (node1, node2) => { const maxLevel1 = this.hierarchical.getMaxLevel(node1.id); const maxLevel2 = this.hierarchical.getMaxLevel(node2.id); return Math.min(maxLevel1, maxLevel2); }; /** * Condense elements. These can be nodes or branches depending on the callback. * @param {Function} callback * @param {Array.} levels * @param {*} centerParents */ const shiftElementsCloser = (callback, levels, centerParents) => { const hier = this.hierarchical; for (let i = 0; i < levels.length; i++) { const level = levels[i]; const levelNodes = hier.distributionOrdering[level]; if (levelNodes.length > 1) for (let j = 0; j < levelNodes.length - 1; j++) { const node1 = levelNodes[j]; const node2 = levelNodes[j + 1]; if (hier.hasSameParent(node1, node2) && hier.inSameSubNetwork(node1, node2)) callback(node1, node2, centerParents); } } }; const branchShiftCallback = function(node1, node2) { let centerParent = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; const pos1 = _this.direction.getPosition(node1); const pos2 = _this.direction.getPosition(node2); const diffAbs = Math.abs(pos2 - pos1); const nodeSpacing = _this.options.hierarchical.nodeSpacing; if (diffAbs > nodeSpacing) { const branchNodes1 = {}; const branchNodes2 = {}; getBranchNodes(node1, branchNodes1); getBranchNodes(node2, branchNodes2); const maxLevel = getCollisionLevel(node1, node2); const branchNodeBoundary1 = getBranchBoundary(branchNodes1, maxLevel); const branchNodeBoundary2 = getBranchBoundary(branchNodes2, maxLevel); const max1 = branchNodeBoundary1[1]; const min2 = branchNodeBoundary2[0]; const minSpace2 = branchNodeBoundary2[2]; const diffBranch = Math.abs(max1 - min2); if (diffBranch > nodeSpacing) { let offset = max1 - min2 + nodeSpacing; if (offset < -minSpace2 + nodeSpacing) offset = -minSpace2 + nodeSpacing; if (offset < 0) { _this._shiftBlock(node2.id, offset); stillShifting = true; if (centerParent === true) _this._centerParent(node2); } } } }; const minimizeEdgeLength = (iterations, node) => { const nodeId = node.id; const allEdges = node.edges; const nodeLevel = this.hierarchical.levels[node.id]; const C2 = this.options.hierarchical.levelSeparation * this.options.hierarchical.levelSeparation; const referenceNodes = {}; const aboveEdges = []; for (let i = 0; i < allEdges.length; i++) { const edge = allEdges[i]; if (edge.toId != edge.fromId) { const otherNode = edge.toId == nodeId ? edge.from : edge.to; referenceNodes[allEdges[i].id] = otherNode; if (this.hierarchical.levels[otherNode.id] < nodeLevel) aboveEdges.push(edge); } } const getFx = (point, edges) => { let sum = 0; for (let i = 0; i < edges.length; i++) if (referenceNodes[edges[i].id] !== void 0) { const a = this.direction.getPosition(referenceNodes[edges[i].id]) - point; sum += a / Math.sqrt(a * a + C2); } return sum; }; const getDFx = (point, edges) => { let sum = 0; for (let i = 0; i < edges.length; i++) if (referenceNodes[edges[i].id] !== void 0) { const a = this.direction.getPosition(referenceNodes[edges[i].id]) - point; sum -= C2 * Math.pow(a * a + C2, -1.5); } return sum; }; const getGuess = (iterations$1, edges) => { let guess$1 = this.direction.getPosition(node); const guessMap = {}; for (let i = 0; i < iterations$1; i++) { const fx = getFx(guess$1, edges); const dfx = getDFx(guess$1, edges); const limit = 40; const ratio = Math.max(-limit, Math.min(limit, Math.round(fx / dfx))); guess$1 = guess$1 - ratio; if (guessMap[guess$1] !== void 0) break; guessMap[guess$1] = i; } return guess$1; }; const moveBranch = (guess$1) => { const nodePosition = this.direction.getPosition(node); if (branches[node.id] === void 0) { const branchNodes = {}; getBranchNodes(node, branchNodes); branches[node.id] = branchNodes; } const branchBoundary = getBranchBoundary(branches[node.id]); const minSpaceBranch = branchBoundary[2]; const maxSpaceBranch = branchBoundary[3]; const diff = guess$1 - nodePosition; let branchOffset = 0; if (diff > 0) branchOffset = Math.min(diff, maxSpaceBranch - this.options.hierarchical.nodeSpacing); else if (diff < 0) branchOffset = -Math.min(-diff, minSpaceBranch - this.options.hierarchical.nodeSpacing); if (branchOffset != 0) { this._shiftBlock(node.id, branchOffset); stillShifting = true; } }; const moveNode = (guess$1) => { const nodePosition = this.direction.getPosition(node); const [minSpace, maxSpace] = this._getSpaceAroundNode(node); const diff = guess$1 - nodePosition; let newPosition = nodePosition; if (diff > 0) newPosition = Math.min(nodePosition + (maxSpace - this.options.hierarchical.nodeSpacing), guess$1); else if (diff < 0) newPosition = Math.max(nodePosition - (minSpace - this.options.hierarchical.nodeSpacing), guess$1); if (newPosition !== nodePosition) { this.direction.setPosition(node, newPosition); stillShifting = true; } }; let guess = getGuess(iterations, aboveEdges); moveBranch(guess); guess = getGuess(iterations, allEdges); moveNode(guess); }; const minimizeEdgeLengthBottomUp = (iterations) => { let levels = this.hierarchical.getLevels(); levels = _reverseInstanceProperty(levels).call(levels); for (let i = 0; i < iterations; i++) { stillShifting = false; for (let j = 0; j < levels.length; j++) { const level = levels[j]; const levelNodes = this.hierarchical.distributionOrdering[level]; for (let k = 0; k < levelNodes.length; k++) minimizeEdgeLength(1e3, levelNodes[k]); } if (stillShifting !== true) break; } }; const shiftBranchesCloserBottomUp = (iterations) => { let levels = this.hierarchical.getLevels(); levels = _reverseInstanceProperty(levels).call(levels); for (let i = 0; i < iterations; i++) { stillShifting = false; shiftElementsCloser(branchShiftCallback, levels, true); if (stillShifting !== true) break; } }; const centerAllParents = () => { for (const nodeId in this.body.nodes) if (Object.prototype.hasOwnProperty.call(this.body.nodes, nodeId)) this._centerParent(this.body.nodes[nodeId]); }; const centerAllParentsBottomUp = () => { let levels = this.hierarchical.getLevels(); levels = _reverseInstanceProperty(levels).call(levels); for (let i = 0; i < levels.length; i++) { const level = levels[i]; const levelNodes = this.hierarchical.distributionOrdering[level]; for (let j = 0; j < levelNodes.length; j++) this._centerParent(levelNodes[j]); } }; if (this.options.hierarchical.blockShifting === true) { shiftBranchesCloserBottomUp(5); centerAllParents(); } if (this.options.hierarchical.edgeMinimization === true) minimizeEdgeLengthBottomUp(20); if (this.options.hierarchical.parentCentralization === true) centerAllParentsBottomUp(); shiftTrees(); } /** * This gives the space around the node. IF a map is supplied, it will only check against nodes NOT in the map. * This is used to only get the distances to nodes outside of a branch. * @param {Node} node * @param {{Node.id: vis.Node}} map * @returns {number[]} * @private */ _getSpaceAroundNode(node, map$8) { let useMap = true; if (map$8 === void 0) useMap = false; const level = this.hierarchical.levels[node.id]; if (level !== void 0) { const index$1 = this.hierarchical.distributionIndex[node.id]; const position = this.direction.getPosition(node); const ordering = this.hierarchical.distributionOrdering[level]; let minSpace = 1e9; let maxSpace = 1e9; if (index$1 !== 0) { const prevNode = ordering[index$1 - 1]; if (useMap === true && map$8[prevNode.id] === void 0 || useMap === false) { const prevPos = this.direction.getPosition(prevNode); minSpace = position - prevPos; } } if (index$1 != ordering.length - 1) { const nextNode = ordering[index$1 + 1]; if (useMap === true && map$8[nextNode.id] === void 0 || useMap === false) { const nextPos = this.direction.getPosition(nextNode); maxSpace = Math.min(maxSpace, nextPos - position); } } return [minSpace, maxSpace]; } else return [0, 0]; } /** * We use this method to center a parent node and check if it does not cross other nodes when it does. * @param {Node} node * @private */ _centerParent(node) { if (this.hierarchical.parentReference[node.id]) { const parents = this.hierarchical.parentReference[node.id]; for (let i = 0; i < parents.length; i++) { const parentId = parents[i]; const parentNode = this.body.nodes[parentId]; const children = this.hierarchical.childrenReference[parentId]; if (children !== void 0) { const newPosition = this._getCenterPosition(children); const position = this.direction.getPosition(parentNode); const [minSpace, maxSpace] = this._getSpaceAroundNode(parentNode); const diff = position - newPosition; if (diff < 0 && Math.abs(diff) < maxSpace - this.options.hierarchical.nodeSpacing || diff > 0 && Math.abs(diff) < minSpace - this.options.hierarchical.nodeSpacing) this.direction.setPosition(parentNode, newPosition); } } } } /** * This function places the nodes on the canvas based on the hierarchial distribution. * @param {object} distribution | obtained by the function this._getDistribution() * @private */ _placeNodesByHierarchy(distribution) { this.positionedNodes = {}; for (const level in distribution) if (Object.prototype.hasOwnProperty.call(distribution, level)) { var _context2; let nodeArray = _Object$keys(distribution[level]); nodeArray = this._indexArrayToNodes(nodeArray); _sortInstanceProperty(_context2 = this.direction).call(_context2, nodeArray); let handledNodeCount = 0; for (let i = 0; i < nodeArray.length; i++) { const node = nodeArray[i]; if (this.positionedNodes[node.id] === void 0) { const spacing = this.options.hierarchical.nodeSpacing; let pos = spacing * handledNodeCount; if (handledNodeCount > 0) pos = this.direction.getPosition(nodeArray[i - 1]) + spacing; this.direction.setPosition(node, pos, level); this._validatePositionAndContinue(node, level, pos); handledNodeCount++; } } } } /** * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes * on a X position that ensures there will be no overlap. * @param {Node.id} parentId * @param {number} parentLevel * @private */ _placeBranchNodes(parentId, parentLevel) { var _context3; const childRef = this.hierarchical.childrenReference[parentId]; if (childRef === void 0) return; const childNodes = []; for (let i = 0; i < childRef.length; i++) childNodes.push(this.body.nodes[childRef[i]]); _sortInstanceProperty(_context3 = this.direction).call(_context3, childNodes); for (let i = 0; i < childNodes.length; i++) { const childNode = childNodes[i]; const childNodeLevel = this.hierarchical.levels[childNode.id]; if (childNodeLevel > parentLevel && this.positionedNodes[childNode.id] === void 0) { const spacing = this.options.hierarchical.nodeSpacing; let pos; if (i === 0) pos = this.direction.getPosition(this.body.nodes[parentId]); else pos = this.direction.getPosition(childNodes[i - 1]) + spacing; this.direction.setPosition(childNode, pos, childNodeLevel); this._validatePositionAndContinue(childNode, childNodeLevel, pos); } else return; } const center = this._getCenterPosition(childNodes); this.direction.setPosition(this.body.nodes[parentId], center, parentLevel); } /** * This method checks for overlap and if required shifts the branch. It also keeps records of positioned nodes. * Finally it will call _placeBranchNodes to place the branch nodes. * @param {Node} node * @param {number} level * @param {number} pos * @private */ _validatePositionAndContinue(node, level, pos) { if (!this.hierarchical.isTree) return; if (this.lastNodeOnLevel[level] !== void 0) { const previousPos = this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[level]]); if (pos - previousPos < this.options.hierarchical.nodeSpacing) { const diff = previousPos + this.options.hierarchical.nodeSpacing - pos; const sharedParent = this._findCommonParent(this.lastNodeOnLevel[level], node.id); this._shiftBlock(sharedParent.withChild, diff); } } this.lastNodeOnLevel[level] = node.id; this.positionedNodes[node.id] = true; this._placeBranchNodes(node.id, level); } /** * Receives an array with node indices and returns an array with the actual node references. * Used for sorting based on node properties. * @param {Array.} idArray * @returns {Array.} */ _indexArrayToNodes(idArray) { const array$1 = []; for (let i = 0; i < idArray.length; i++) array$1.push(this.body.nodes[idArray[i]]); return array$1; } /** * This function get the distribution of levels based on hubsize * @returns {object} * @private */ _getDistribution() { const distribution = {}; let nodeId, node; for (nodeId in this.body.nodes) if (Object.prototype.hasOwnProperty.call(this.body.nodes, nodeId)) { node = this.body.nodes[nodeId]; const level = this.hierarchical.levels[nodeId] === void 0 ? 0 : this.hierarchical.levels[nodeId]; this.direction.fix(node, level); if (distribution[level] === void 0) distribution[level] = {}; distribution[level][nodeId] = node; } return distribution; } /** * Return the active (i.e. visible) edges for this node * @param {Node} node * @returns {Array.} Array of edge instances * @private */ _getActiveEdges(node) { const result = []; forEach$4(node.edges, (edge) => { var _context4; if (_indexOfInstanceProperty(_context4 = this.body.edgeIndices).call(_context4, edge.id) !== -1) result.push(edge); }); return result; } /** * Get the hubsizes for all active nodes. * @returns {number} * @private */ _getHubSizes() { const hubSizes = {}; const nodeIds = this.body.nodeIndices; forEach$4(nodeIds, (nodeId) => { const node = this.body.nodes[nodeId]; const hubSize = this._getActiveEdges(node).length; hubSizes[hubSize] = true; }); const result = []; forEach$4(hubSizes, (size) => { result.push(Number(size)); }); _sortInstanceProperty(result).call(result, function(a, b) { return b - a; }); return result; } /** * this function allocates nodes in levels based on the recursive branching from the largest hubs. * @private */ _determineLevelsByHubsize() { const levelDownstream = (nodeA, nodeB) => { this.hierarchical.levelDownstream(nodeA, nodeB); }; const hubSizes = this._getHubSizes(); for (let i = 0; i < hubSizes.length; ++i) { const hubSize = hubSizes[i]; if (hubSize === 0) break; forEach$4(this.body.nodeIndices, (nodeId) => { const node = this.body.nodes[nodeId]; if (hubSize === this._getActiveEdges(node).length) this._crawlNetwork(levelDownstream, nodeId); }); } } /** * TODO: release feature * TODO: Determine if this feature is needed at all * @private */ _determineLevelsCustomCallback() { const minLevel = 1e5; const customCallback = function(nodeA, nodeB, edge) {}; const levelByDirection = (nodeA, nodeB, edge) => { let levelA = this.hierarchical.levels[nodeA.id]; if (levelA === void 0) levelA = this.hierarchical.levels[nodeA.id] = minLevel; const diff = customCallback(NetworkUtil.cloneOptions(nodeA, "node"), NetworkUtil.cloneOptions(nodeB, "node"), NetworkUtil.cloneOptions(edge, "edge")); this.hierarchical.levels[nodeB.id] = levelA + diff; }; this._crawlNetwork(levelByDirection); this.hierarchical.setMinLevelToZero(); } /** * Allocate nodes in levels based on the direction of the edges. * @private */ _determineLevelsDirected() { var _context5; const nodes = _reduceInstanceProperty(_context5 = this.body.nodeIndices).call(_context5, (acc, id) => { acc.set(id, this.body.nodes[id]); return acc; }, new _Map()); if (this.options.hierarchical.shakeTowards === "roots") this.hierarchical.levels = fillLevelsByDirectionRoots(nodes); else this.hierarchical.levels = fillLevelsByDirectionLeaves(nodes); this.hierarchical.setMinLevelToZero(); } /** * Update the bookkeeping of parent and child. * @private */ _generateMap() { const fillInRelations = (parentNode, childNode) => { if (this.hierarchical.levels[childNode.id] > this.hierarchical.levels[parentNode.id]) this.hierarchical.addRelation(parentNode.id, childNode.id); }; this._crawlNetwork(fillInRelations); this.hierarchical.checkIfTree(); } /** * Crawl over the entire network and use a callback on each node couple that is connected to each other. * @param {Function} [callback] | will receive nodeA, nodeB and the connecting edge. A and B are distinct. * @param {Node.id} startingNodeId * @private */ _crawlNetwork() { let callback = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function() {}; let startingNodeId = arguments.length > 1 ? arguments[1] : void 0; const progress = {}; const crawler = (node, tree) => { if (progress[node.id] === void 0) { this.hierarchical.setTreeIndex(node, tree); progress[node.id] = true; let childNode; const edges = this._getActiveEdges(node); for (let i = 0; i < edges.length; i++) { const edge = edges[i]; if (edge.connected === true) { if (edge.toId == node.id) childNode = edge.from; else childNode = edge.to; if (node.id != childNode.id) { callback(node, childNode, edge); crawler(childNode, tree); } } } } }; if (startingNodeId === void 0) { let treeIndex = 0; for (let i = 0; i < this.body.nodeIndices.length; i++) { const nodeId = this.body.nodeIndices[i]; if (progress[nodeId] === void 0) { const node = this.body.nodes[nodeId]; crawler(node, treeIndex); treeIndex += 1; } } } else { const node = this.body.nodes[startingNodeId]; if (node === void 0) { console.error("Node not found:", startingNodeId); return; } crawler(node); } } /** * Shift a branch a certain distance * @param {Node.id} parentId * @param {number} diff * @private */ _shiftBlock(parentId, diff) { const progress = {}; const shifter = (parentId$1) => { if (progress[parentId$1]) return; progress[parentId$1] = true; this.direction.shift(parentId$1, diff); const childRef = this.hierarchical.childrenReference[parentId$1]; if (childRef !== void 0) for (let i = 0; i < childRef.length; i++) shifter(childRef[i]); }; shifter(parentId); } /** * Find a common parent between branches. * @param {Node.id} childA * @param {Node.id} childB * @returns {{foundParent, withChild}} * @private */ _findCommonParent(childA, childB) { const parents = {}; const iterateParents = (parents$1, child) => { const parentRef = this.hierarchical.parentReference[child]; if (parentRef !== void 0) for (let i = 0; i < parentRef.length; i++) { const parent = parentRef[i]; parents$1[parent] = true; iterateParents(parents$1, parent); } }; const findParent = (parents$1, child) => { const parentRef = this.hierarchical.parentReference[child]; if (parentRef !== void 0) for (let i = 0; i < parentRef.length; i++) { const parent = parentRef[i]; if (parents$1[parent] !== void 0) return { foundParent: parent, withChild: child }; const branch = findParent(parents$1, parent); if (branch.foundParent !== null) return branch; } return { foundParent: null, withChild: child }; }; iterateParents(parents, childA); return findParent(parents, childB); } /** * Set the strategy pattern for handling the coordinates given the current direction. * * The individual instances contain all the operations and data specific to a layout direction. * @param {Node} node * @param {{x: number, y: number}} position * @param {number} level * @param {boolean} [doNotUpdate] * @private */ setDirectionStrategy() { const isVertical = this.options.hierarchical.direction === "UD" || this.options.hierarchical.direction === "DU"; if (isVertical) this.direction = new VerticalStrategy(this); else this.direction = new HorizontalStrategy(this); } /** * Determine the center position of a branch from the passed list of child nodes * * This takes into account the positions of all the child nodes. * @param {Array.} childNodes Array of either child nodes or node id's * @returns {number} * @private */ _getCenterPosition(childNodes) { let minPos = 1e9; let maxPos = -1e9; for (let i = 0; i < childNodes.length; i++) { let childNode; if (childNodes[i].id !== void 0) childNode = childNodes[i]; else { const childNodeId = childNodes[i]; childNode = this.body.nodes[childNodeId]; } const position = this.direction.getPosition(childNode); minPos = Math.min(minPos, position); maxPos = Math.max(maxPos, position); } return .5 * (minPos + maxPos); } }; var ManipulationSystem = class { /** * @param {object} body * @param {Canvas} canvas * @param {SelectionHandler} selectionHandler * @param {InteractionHandler} interactionHandler */ constructor(body, canvas, selectionHandler, interactionHandler) { var _context, _context2; this.body = body; this.canvas = canvas; this.selectionHandler = selectionHandler; this.interactionHandler = interactionHandler; this.editMode = false; this.manipulationDiv = void 0; this.editModeDiv = void 0; this.closeDiv = void 0; this._domEventListenerCleanupQueue = []; this.temporaryUIFunctions = {}; this.temporaryEventFunctions = []; this.touchTime = 0; this.temporaryIds = { nodes: [], edges: [] }; this.guiEnabled = false; this.inMode = false; this.selectedControlNode = void 0; this.options = {}; this.defaultOptions = { enabled: false, initiallyActive: false, addNode: true, addEdge: true, editNode: void 0, editEdge: true, deleteNode: true, deleteEdge: true, controlNodeStyle: { shape: "dot", size: 6, color: { background: "#ff0000", border: "#3c3c3c", highlight: { background: "#07f968", border: "#3c3c3c" } }, borderWidth: 2, borderWidthSelected: 2 } }; _Object$assign(this.options, this.defaultOptions); this.body.emitter.on("destroy", () => { this._clean(); }); this.body.emitter.on("_dataChanged", _bindInstanceProperty(_context = this._restore).call(_context, this)); this.body.emitter.on("_resetData", _bindInstanceProperty(_context2 = this._restore).call(_context2, this)); } /** * If something changes in the data during editing, switch back to the initial datamanipulation state and close all edit modes. * @private */ _restore() { if (this.inMode !== false) if (this.options.initiallyActive === true) this.enableEditMode(); else this.disableEditMode(); } /** * Set the Options * @param {object} options * @param {object} allOptions * @param {object} globalOptions */ setOptions(options, allOptions$2, globalOptions) { if (allOptions$2 !== void 0) { if (allOptions$2.locale !== void 0) this.options.locale = allOptions$2.locale; else this.options.locale = globalOptions.locale; if (allOptions$2.locales !== void 0) this.options.locales = allOptions$2.locales; else this.options.locales = globalOptions.locales; } if (options !== void 0) { if (typeof options === "boolean") this.options.enabled = options; else { this.options.enabled = true; deepExtend(this.options, options); } if (this.options.initiallyActive === true) this.editMode = true; this._setup(); } } /** * Enable or disable edit-mode. Draws the DOM required and cleans up after itself. * @private */ toggleEditMode() { if (this.editMode === true) this.disableEditMode(); else this.enableEditMode(); } /** * Enables Edit Mode */ enableEditMode() { this.editMode = true; this._clean(); if (this.guiEnabled === true) { this.manipulationDiv.style.display = "block"; this.closeDiv.style.display = "block"; this.editModeDiv.style.display = "none"; this.showManipulatorToolbar(); } } /** * Disables Edit Mode */ disableEditMode() { this.editMode = false; this._clean(); if (this.guiEnabled === true) { this.manipulationDiv.style.display = "none"; this.closeDiv.style.display = "none"; this.editModeDiv.style.display = "block"; this._createEditButton(); } } /** * Creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. * @private */ showManipulatorToolbar() { this._clean(); this.manipulationDOM = {}; if (this.guiEnabled === true) { var _context3, _context4; this.editMode = true; this.manipulationDiv.style.display = "block"; this.closeDiv.style.display = "block"; const selectedNodeCount = this.selectionHandler.getSelectedNodeCount(); const selectedEdgeCount = this.selectionHandler.getSelectedEdgeCount(); const selectedTotalCount = selectedNodeCount + selectedEdgeCount; const locale = this.options.locales[this.options.locale]; let needSeperator = false; if (this.options.addNode !== false) { this._createAddNodeButton(locale); needSeperator = true; } if (this.options.addEdge !== false) { if (needSeperator === true) this._createSeperator(1); else needSeperator = true; this._createAddEdgeButton(locale); } if (selectedNodeCount === 1 && typeof this.options.editNode === "function") { if (needSeperator === true) this._createSeperator(2); else needSeperator = true; this._createEditNodeButton(locale); } else if (selectedEdgeCount === 1 && selectedNodeCount === 0 && this.options.editEdge !== false) { if (needSeperator === true) this._createSeperator(3); else needSeperator = true; this._createEditEdgeButton(locale); } if (selectedTotalCount !== 0) { if (selectedNodeCount > 0 && this.options.deleteNode !== false) { if (needSeperator === true) this._createSeperator(4); this._createDeleteButton(locale); } else if (selectedNodeCount === 0 && this.options.deleteEdge !== false) { if (needSeperator === true) this._createSeperator(4); this._createDeleteButton(locale); } } this._bindElementEvents(this.closeDiv, _bindInstanceProperty(_context3 = this.toggleEditMode).call(_context3, this)); this._temporaryBindEvent("select", _bindInstanceProperty(_context4 = this.showManipulatorToolbar).call(_context4, this)); } this.body.emitter.emit("_redraw"); } /** * Create the toolbar for adding Nodes */ addNodeMode() { var _context6; if (this.editMode !== true) this.enableEditMode(); this._clean(); this.inMode = "addNode"; if (this.guiEnabled === true) { var _context5; const locale = this.options.locales[this.options.locale]; this.manipulationDOM = {}; this._createBackButton(locale); this._createSeperator(); this._createDescription(locale["addDescription"] || this.options.locales["en"]["addDescription"]); this._bindElementEvents(this.closeDiv, _bindInstanceProperty(_context5 = this.toggleEditMode).call(_context5, this)); } this._temporaryBindEvent("click", _bindInstanceProperty(_context6 = this._performAddNode).call(_context6, this)); } /** * call the bound function to handle the editing of the node. The node has to be selected. */ editNode() { if (this.editMode !== true) this.enableEditMode(); this._clean(); const node = this.selectionHandler.getSelectedNodes()[0]; if (node !== void 0) { this.inMode = "editNode"; if (typeof this.options.editNode === "function") if (node.isCluster !== true) { const data = deepExtend({}, node.options, false); data.x = node.x; data.y = node.y; if (this.options.editNode.length === 2) this.options.editNode(data, (finalizedData) => { if (finalizedData !== null && finalizedData !== void 0 && this.inMode === "editNode") this.body.data.nodes.getDataSet().update(finalizedData); this.showManipulatorToolbar(); }); else throw new Error("The function for edit does not support two arguments (data, callback)"); } else alert(this.options.locales[this.options.locale]["editClusterError"] || this.options.locales["en"]["editClusterError"]); else throw new Error("No function has been configured to handle the editing of nodes."); } else this.showManipulatorToolbar(); } /** * create the toolbar to connect nodes */ addEdgeMode() { var _context8, _context9, _context0, _context1, _context10; if (this.editMode !== true) this.enableEditMode(); this._clean(); this.inMode = "addEdge"; if (this.guiEnabled === true) { var _context7; const locale = this.options.locales[this.options.locale]; this.manipulationDOM = {}; this._createBackButton(locale); this._createSeperator(); this._createDescription(locale["edgeDescription"] || this.options.locales["en"]["edgeDescription"]); this._bindElementEvents(this.closeDiv, _bindInstanceProperty(_context7 = this.toggleEditMode).call(_context7, this)); } this._temporaryBindUI("onTouch", _bindInstanceProperty(_context8 = this._handleConnect).call(_context8, this)); this._temporaryBindUI("onDragEnd", _bindInstanceProperty(_context9 = this._finishConnect).call(_context9, this)); this._temporaryBindUI("onDrag", _bindInstanceProperty(_context0 = this._dragControlNode).call(_context0, this)); this._temporaryBindUI("onRelease", _bindInstanceProperty(_context1 = this._finishConnect).call(_context1, this)); this._temporaryBindUI("onDragStart", _bindInstanceProperty(_context10 = this._dragStartEdge).call(_context10, this)); this._temporaryBindUI("onHold", () => {}); } /** * create the toolbar to edit edges */ editEdgeMode() { if (this.editMode !== true) this.enableEditMode(); this._clean(); this.inMode = "editEdge"; if (typeof this.options.editEdge === "object" && typeof this.options.editEdge.editWithoutDrag === "function") { this.edgeBeingEditedId = this.selectionHandler.getSelectedEdgeIds()[0]; if (this.edgeBeingEditedId !== void 0) { const edge = this.body.edges[this.edgeBeingEditedId]; this._performEditEdge(edge.from.id, edge.to.id); return; } } if (this.guiEnabled === true) { var _context11; const locale = this.options.locales[this.options.locale]; this.manipulationDOM = {}; this._createBackButton(locale); this._createSeperator(); this._createDescription(locale["editEdgeDescription"] || this.options.locales["en"]["editEdgeDescription"]); this._bindElementEvents(this.closeDiv, _bindInstanceProperty(_context11 = this.toggleEditMode).call(_context11, this)); } this.edgeBeingEditedId = this.selectionHandler.getSelectedEdgeIds()[0]; if (this.edgeBeingEditedId !== void 0) { var _context12, _context13, _context14, _context15; const edge = this.body.edges[this.edgeBeingEditedId]; const controlNodeFrom = this._getNewTargetNode(edge.from.x, edge.from.y); const controlNodeTo = this._getNewTargetNode(edge.to.x, edge.to.y); this.temporaryIds.nodes.push(controlNodeFrom.id); this.temporaryIds.nodes.push(controlNodeTo.id); this.body.nodes[controlNodeFrom.id] = controlNodeFrom; this.body.nodeIndices.push(controlNodeFrom.id); this.body.nodes[controlNodeTo.id] = controlNodeTo; this.body.nodeIndices.push(controlNodeTo.id); this._temporaryBindUI("onTouch", _bindInstanceProperty(_context12 = this._controlNodeTouch).call(_context12, this)); this._temporaryBindUI("onTap", () => {}); this._temporaryBindUI("onHold", () => {}); this._temporaryBindUI("onDragStart", _bindInstanceProperty(_context13 = this._controlNodeDragStart).call(_context13, this)); this._temporaryBindUI("onDrag", _bindInstanceProperty(_context14 = this._controlNodeDrag).call(_context14, this)); this._temporaryBindUI("onDragEnd", _bindInstanceProperty(_context15 = this._controlNodeDragEnd).call(_context15, this)); this._temporaryBindUI("onMouseMove", () => {}); this._temporaryBindEvent("beforeDrawing", (ctx) => { const positions = edge.edgeType.findBorderPositions(ctx); if (controlNodeFrom.selected === false) { controlNodeFrom.x = positions.from.x; controlNodeFrom.y = positions.from.y; } if (controlNodeTo.selected === false) { controlNodeTo.x = positions.to.x; controlNodeTo.y = positions.to.y; } }); this.body.emitter.emit("_redraw"); } else this.showManipulatorToolbar(); } /** * delete everything in the selection */ deleteSelected() { if (this.editMode !== true) this.enableEditMode(); this._clean(); this.inMode = "delete"; const selectedNodes = this.selectionHandler.getSelectedNodeIds(); const selectedEdges = this.selectionHandler.getSelectedEdgeIds(); let deleteFunction = void 0; if (selectedNodes.length > 0) { for (let i = 0; i < selectedNodes.length; i++) if (this.body.nodes[selectedNodes[i]].isCluster === true) { alert(this.options.locales[this.options.locale]["deleteClusterError"] || this.options.locales["en"]["deleteClusterError"]); return; } if (typeof this.options.deleteNode === "function") deleteFunction = this.options.deleteNode; } else if (selectedEdges.length > 0) { if (typeof this.options.deleteEdge === "function") deleteFunction = this.options.deleteEdge; } if (typeof deleteFunction === "function") { const data = { nodes: selectedNodes, edges: selectedEdges }; if (deleteFunction.length === 2) deleteFunction(data, (finalizedData) => { if (finalizedData !== null && finalizedData !== void 0 && this.inMode === "delete") { this.body.data.edges.getDataSet().remove(finalizedData.edges); this.body.data.nodes.getDataSet().remove(finalizedData.nodes); this.body.emitter.emit("startSimulation"); this.showManipulatorToolbar(); } else { this.body.emitter.emit("startSimulation"); this.showManipulatorToolbar(); } }); else throw new Error("The function for delete does not support two arguments (data, callback)"); } else { this.body.data.edges.getDataSet().remove(selectedEdges); this.body.data.nodes.getDataSet().remove(selectedNodes); this.body.emitter.emit("startSimulation"); this.showManipulatorToolbar(); } } /** * draw or remove the DOM * @private */ _setup() { if (this.options.enabled === true) { this.guiEnabled = true; this._createWrappers(); if (this.editMode === false) this._createEditButton(); else this.showManipulatorToolbar(); } else { this._removeManipulationDOM(); this.guiEnabled = false; } } /** * create the div overlays that contain the DOM * @private */ _createWrappers() { if (this.manipulationDiv === void 0) { this.manipulationDiv = document.createElement("div"); this.manipulationDiv.className = "vis-manipulation"; if (this.editMode === true) this.manipulationDiv.style.display = "block"; else this.manipulationDiv.style.display = "none"; this.canvas.frame.appendChild(this.manipulationDiv); } if (this.editModeDiv === void 0) { this.editModeDiv = document.createElement("div"); this.editModeDiv.className = "vis-edit-mode"; if (this.editMode === true) this.editModeDiv.style.display = "none"; else this.editModeDiv.style.display = "block"; this.canvas.frame.appendChild(this.editModeDiv); } if (this.closeDiv === void 0) { var _this$options$locales, _this$options$locales2; this.closeDiv = document.createElement("button"); this.closeDiv.className = "vis-close"; this.closeDiv.setAttribute("aria-label", (_this$options$locales = (_this$options$locales2 = this.options.locales[this.options.locale]) === null || _this$options$locales2 === void 0 ? void 0 : _this$options$locales2["close"]) !== null && _this$options$locales !== void 0 ? _this$options$locales : this.options.locales["en"]["close"]); this.closeDiv.style.display = this.manipulationDiv.style.display; this.canvas.frame.appendChild(this.closeDiv); } } /** * generate a new target node. Used for creating new edges and editing edges * @param {number} x * @param {number} y * @returns {Node} * @private */ _getNewTargetNode(x, y) { const controlNodeStyle = deepExtend({}, this.options.controlNodeStyle); controlNodeStyle.id = "targetNode" + v4(); controlNodeStyle.hidden = false; controlNodeStyle.physics = false; controlNodeStyle.x = x; controlNodeStyle.y = y; const node = this.body.functions.createNode(controlNodeStyle); node.shape.boundingBox = { left: x, right: x, top: y, bottom: y }; return node; } /** * Create the edit button */ _createEditButton() { var _context16; this._clean(); this.manipulationDOM = {}; recursiveDOMDelete(this.editModeDiv); const locale = this.options.locales[this.options.locale]; const button = this._createButton("editMode", "vis-edit vis-edit-mode", locale["edit"] || this.options.locales["en"]["edit"]); this.editModeDiv.appendChild(button); this._bindElementEvents(button, _bindInstanceProperty(_context16 = this.toggleEditMode).call(_context16, this)); } /** * this function cleans up after everything this module does. Temporary elements, functions and events are removed, physics restored, hammers removed. * @private */ _clean() { this.inMode = false; if (this.guiEnabled === true) { recursiveDOMDelete(this.editModeDiv); recursiveDOMDelete(this.manipulationDiv); this._cleanupDOMEventListeners(); } this._cleanupTemporaryNodesAndEdges(); this._unbindTemporaryUIs(); this._unbindTemporaryEvents(); this.body.emitter.emit("restorePhysics"); } /** * Each dom element has it's own hammer. They are stored in this.manipulationHammers. This cleans them up. * @private */ _cleanupDOMEventListeners() { for (const callback of _spliceInstanceProperty(_context17 = this._domEventListenerCleanupQueue).call(_context17, 0)) { var _context17; callback(); } } /** * Remove all DOM elements created by this module. * @private */ _removeManipulationDOM() { this._clean(); recursiveDOMDelete(this.manipulationDiv); recursiveDOMDelete(this.editModeDiv); recursiveDOMDelete(this.closeDiv); if (this.manipulationDiv) this.canvas.frame.removeChild(this.manipulationDiv); if (this.editModeDiv) this.canvas.frame.removeChild(this.editModeDiv); if (this.closeDiv) this.canvas.frame.removeChild(this.closeDiv); this.manipulationDiv = void 0; this.editModeDiv = void 0; this.closeDiv = void 0; } /** * create a seperator line. the index is to differentiate in the manipulation dom * @param {number} [index] * @private */ _createSeperator() { let index$1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1; this.manipulationDOM["seperatorLineDiv" + index$1] = document.createElement("div"); this.manipulationDOM["seperatorLineDiv" + index$1].className = "vis-separator-line"; this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv" + index$1]); } /** * * @param {Locale} locale * @private */ _createAddNodeButton(locale) { var _context18; const button = this._createButton("addNode", "vis-add", locale["addNode"] || this.options.locales["en"]["addNode"]); this.manipulationDiv.appendChild(button); this._bindElementEvents(button, _bindInstanceProperty(_context18 = this.addNodeMode).call(_context18, this)); } /** * * @param {Locale} locale * @private */ _createAddEdgeButton(locale) { var _context19; const button = this._createButton("addEdge", "vis-connect", locale["addEdge"] || this.options.locales["en"]["addEdge"]); this.manipulationDiv.appendChild(button); this._bindElementEvents(button, _bindInstanceProperty(_context19 = this.addEdgeMode).call(_context19, this)); } /** * * @param {Locale} locale * @private */ _createEditNodeButton(locale) { var _context20; const button = this._createButton("editNode", "vis-edit", locale["editNode"] || this.options.locales["en"]["editNode"]); this.manipulationDiv.appendChild(button); this._bindElementEvents(button, _bindInstanceProperty(_context20 = this.editNode).call(_context20, this)); } /** * * @param {Locale} locale * @private */ _createEditEdgeButton(locale) { var _context21; const button = this._createButton("editEdge", "vis-edit", locale["editEdge"] || this.options.locales["en"]["editEdge"]); this.manipulationDiv.appendChild(button); this._bindElementEvents(button, _bindInstanceProperty(_context21 = this.editEdgeMode).call(_context21, this)); } /** * * @param {Locale} locale * @private */ _createDeleteButton(locale) { var _context22; let deleteBtnClass; if (this.options.rtl) deleteBtnClass = "vis-delete-rtl"; else deleteBtnClass = "vis-delete"; const button = this._createButton("delete", deleteBtnClass, locale["del"] || this.options.locales["en"]["del"]); this.manipulationDiv.appendChild(button); this._bindElementEvents(button, _bindInstanceProperty(_context22 = this.deleteSelected).call(_context22, this)); } /** * * @param {Locale} locale * @private */ _createBackButton(locale) { var _context23; const button = this._createButton("back", "vis-back", locale["back"] || this.options.locales["en"]["back"]); this.manipulationDiv.appendChild(button); this._bindElementEvents(button, _bindInstanceProperty(_context23 = this.showManipulatorToolbar).call(_context23, this)); } /** * * @param {number|string} id * @param {string} className * @param {label} label * @param {string} labelClassName * @returns {HTMLElement} * @private */ _createButton(id, className, label) { let labelClassName = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "vis-label"; this.manipulationDOM[id + "Div"] = document.createElement("button"); this.manipulationDOM[id + "Div"].className = "vis-button " + className; this.manipulationDOM[id + "Label"] = document.createElement("div"); this.manipulationDOM[id + "Label"].className = labelClassName; this.manipulationDOM[id + "Label"].innerText = label; this.manipulationDOM[id + "Div"].appendChild(this.manipulationDOM[id + "Label"]); return this.manipulationDOM[id + "Div"]; } /** * * @param {Label} label * @private */ _createDescription(label) { this.manipulationDOM["descriptionLabel"] = document.createElement("div"); this.manipulationDOM["descriptionLabel"].className = "vis-none"; this.manipulationDOM["descriptionLabel"].innerText = label; this.manipulationDiv.appendChild(this.manipulationDOM["descriptionLabel"]); } /** * this binds an event until cleanup by the clean functions. * @param {Event} event The event * @param {Function} newFunction * @private */ _temporaryBindEvent(event, newFunction) { this.temporaryEventFunctions.push({ event, boundFunction: newFunction }); this.body.emitter.on(event, newFunction); } /** * this overrides an UI function until cleanup by the clean function * @param {string} UIfunctionName * @param {Function} newFunction * @private */ _temporaryBindUI(UIfunctionName, newFunction) { if (this.body.eventListeners[UIfunctionName] !== void 0) { this.temporaryUIFunctions[UIfunctionName] = this.body.eventListeners[UIfunctionName]; this.body.eventListeners[UIfunctionName] = newFunction; } else throw new Error("This UI function does not exist. Typo? You tried: " + UIfunctionName + " possible are: " + _JSON$stringify(_Object$keys(this.body.eventListeners))); } /** * Restore the overridden UI functions to their original state. * @private */ _unbindTemporaryUIs() { for (const functionName$2 in this.temporaryUIFunctions) if (Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions, functionName$2)) { this.body.eventListeners[functionName$2] = this.temporaryUIFunctions[functionName$2]; delete this.temporaryUIFunctions[functionName$2]; } this.temporaryUIFunctions = {}; } /** * Unbind the events created by _temporaryBindEvent * @private */ _unbindTemporaryEvents() { for (let i = 0; i < this.temporaryEventFunctions.length; i++) { const eventName = this.temporaryEventFunctions[i].event; const boundFunction = this.temporaryEventFunctions[i].boundFunction; this.body.emitter.off(eventName, boundFunction); } this.temporaryEventFunctions = []; } /** * Bind an hammer instance to a DOM element. * @param {Element} domElement * @param {Function} boundFunction */ _bindElementEvents(domElement, boundFunction) { const hammer = new Hammer(domElement, {}); onTouch(hammer, boundFunction); this._domEventListenerCleanupQueue.push(() => { hammer.destroy(); }); const keyupListener = (_ref) => { let { keyCode, key } = _ref; if (key === "Enter" || key === " " || keyCode === 13 || keyCode === 32) boundFunction(); }; domElement.addEventListener("keyup", keyupListener, false); this._domEventListenerCleanupQueue.push(() => { domElement.removeEventListener("keyup", keyupListener, false); }); } /** * Neatly clean up temporary edges and nodes * @private */ _cleanupTemporaryNodesAndEdges() { for (let i = 0; i < this.temporaryIds.edges.length; i++) { var _context24; this.body.edges[this.temporaryIds.edges[i]].disconnect(); delete this.body.edges[this.temporaryIds.edges[i]]; const indexTempEdge = _indexOfInstanceProperty(_context24 = this.body.edgeIndices).call(_context24, this.temporaryIds.edges[i]); if (indexTempEdge !== -1) { var _context25; _spliceInstanceProperty(_context25 = this.body.edgeIndices).call(_context25, indexTempEdge, 1); } } for (let i = 0; i < this.temporaryIds.nodes.length; i++) { var _context26; delete this.body.nodes[this.temporaryIds.nodes[i]]; const indexTempNode = _indexOfInstanceProperty(_context26 = this.body.nodeIndices).call(_context26, this.temporaryIds.nodes[i]); if (indexTempNode !== -1) { var _context27; _spliceInstanceProperty(_context27 = this.body.nodeIndices).call(_context27, indexTempNode, 1); } } this.temporaryIds = { nodes: [], edges: [] }; } /** * the touch is used to get the position of the initial click * @param {Event} event The event * @private */ _controlNodeTouch(event) { this.selectionHandler.unselectAll(); this.lastTouch = this.body.functions.getPointer(event.center); this.lastTouch.translation = _Object$assign({}, this.body.view.translation); } /** * the drag start is used to mark one of the control nodes as selected. * @private */ _controlNodeDragStart() { const pointer = this.lastTouch; const pointerObj = this.selectionHandler._pointerToPositionObject(pointer); const from = this.body.nodes[this.temporaryIds.nodes[0]]; const to = this.body.nodes[this.temporaryIds.nodes[1]]; const edge = this.body.edges[this.edgeBeingEditedId]; this.selectedControlNode = void 0; const fromSelect = from.isOverlappingWith(pointerObj); const toSelect = to.isOverlappingWith(pointerObj); if (fromSelect === true) { this.selectedControlNode = from; edge.edgeType.from = from; } else if (toSelect === true) { this.selectedControlNode = to; edge.edgeType.to = to; } if (this.selectedControlNode !== void 0) this.selectionHandler.selectObject(this.selectedControlNode); this.body.emitter.emit("_redraw"); } /** * dragging the control nodes or the canvas * @param {Event} event The event * @private */ _controlNodeDrag(event) { this.body.emitter.emit("disablePhysics"); const pointer = this.body.functions.getPointer(event.center); const pos = this.canvas.DOMtoCanvas(pointer); if (this.selectedControlNode !== void 0) { this.selectedControlNode.x = pos.x; this.selectedControlNode.y = pos.y; } else this.interactionHandler.onDrag(event); this.body.emitter.emit("_redraw"); } /** * connecting or restoring the control nodes. * @param {Event} event The event * @private */ _controlNodeDragEnd(event) { const pointer = this.body.functions.getPointer(event.center); const pointerObj = this.selectionHandler._pointerToPositionObject(pointer); const edge = this.body.edges[this.edgeBeingEditedId]; if (this.selectedControlNode === void 0) return; this.selectionHandler.unselectAll(); const overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj); let node = void 0; for (let i = overlappingNodeIds.length - 1; i >= 0; i--) if (overlappingNodeIds[i] !== this.selectedControlNode.id) { node = this.body.nodes[overlappingNodeIds[i]]; break; } if (node !== void 0 && this.selectedControlNode !== void 0) if (node.isCluster === true) alert(this.options.locales[this.options.locale]["createEdgeError"] || this.options.locales["en"]["createEdgeError"]); else { const from = this.body.nodes[this.temporaryIds.nodes[0]]; if (this.selectedControlNode.id === from.id) this._performEditEdge(node.id, edge.to.id); else this._performEditEdge(edge.from.id, node.id); } else { edge.updateEdgeType(); this.body.emitter.emit("restorePhysics"); } this.body.emitter.emit("_redraw"); } /** * the function bound to the selection event. It checks if you want to connect a cluster and changes the description * to walk the user through the process. * @param {Event} event * @private */ _handleConnect(event) { if (new Date().valueOf() - this.touchTime > 100) { this.lastTouch = this.body.functions.getPointer(event.center); this.lastTouch.translation = _Object$assign({}, this.body.view.translation); this.interactionHandler.drag.pointer = this.lastTouch; this.interactionHandler.drag.translation = this.lastTouch.translation; const pointer = this.lastTouch; const node = this.selectionHandler.getNodeAt(pointer); if (node !== void 0) if (node.isCluster === true) alert(this.options.locales[this.options.locale]["createEdgeError"] || this.options.locales["en"]["createEdgeError"]); else { const targetNode = this._getNewTargetNode(node.x, node.y); this.body.nodes[targetNode.id] = targetNode; this.body.nodeIndices.push(targetNode.id); const connectionEdge = this.body.functions.createEdge({ id: "connectionEdge" + v4(), from: node.id, to: targetNode.id, physics: false, smooth: { enabled: true, type: "continuous", roundness: .5 } }); this.body.edges[connectionEdge.id] = connectionEdge; this.body.edgeIndices.push(connectionEdge.id); this.temporaryIds.nodes.push(targetNode.id); this.temporaryIds.edges.push(connectionEdge.id); } this.touchTime = new Date().valueOf(); } } /** * * @param {Event} event * @private */ _dragControlNode(event) { const pointer = this.body.functions.getPointer(event.center); const pointerObj = this.selectionHandler._pointerToPositionObject(pointer); let connectFromId = void 0; if (this.temporaryIds.edges[0] !== void 0) connectFromId = this.body.edges[this.temporaryIds.edges[0]].fromId; const overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj); let node = void 0; for (let i = overlappingNodeIds.length - 1; i >= 0; i--) { var _context28; if (_indexOfInstanceProperty(_context28 = this.temporaryIds.nodes).call(_context28, overlappingNodeIds[i]) === -1) { node = this.body.nodes[overlappingNodeIds[i]]; break; } } event.controlEdge = { from: connectFromId, to: node ? node.id : void 0 }; this.selectionHandler.generateClickEvent("controlNodeDragging", event, pointer); if (this.temporaryIds.nodes[0] !== void 0) { const targetNode = this.body.nodes[this.temporaryIds.nodes[0]]; targetNode.x = this.canvas._XconvertDOMtoCanvas(pointer.x); targetNode.y = this.canvas._YconvertDOMtoCanvas(pointer.y); this.body.emitter.emit("_redraw"); } else this.interactionHandler.onDrag(event); } /** * Connect the new edge to the target if one exists, otherwise remove temp line * @param {Event} event The event * @private */ _finishConnect(event) { const pointer = this.body.functions.getPointer(event.center); const pointerObj = this.selectionHandler._pointerToPositionObject(pointer); let connectFromId = void 0; if (this.temporaryIds.edges[0] !== void 0) connectFromId = this.body.edges[this.temporaryIds.edges[0]].fromId; const overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj); let node = void 0; for (let i = overlappingNodeIds.length - 1; i >= 0; i--) { var _context29; if (_indexOfInstanceProperty(_context29 = this.temporaryIds.nodes).call(_context29, overlappingNodeIds[i]) === -1) { node = this.body.nodes[overlappingNodeIds[i]]; break; } } this._cleanupTemporaryNodesAndEdges(); if (node !== void 0) { if (node.isCluster === true) alert(this.options.locales[this.options.locale]["createEdgeError"] || this.options.locales["en"]["createEdgeError"]); else if (this.body.nodes[connectFromId] !== void 0 && this.body.nodes[node.id] !== void 0) this._performAddEdge(connectFromId, node.id); } event.controlEdge = { from: connectFromId, to: node ? node.id : void 0 }; this.selectionHandler.generateClickEvent("controlNodeDragEnd", event, pointer); this.body.emitter.emit("_redraw"); } /** * * @param {Event} event * @private */ _dragStartEdge(event) { const pointer = this.lastTouch; this.selectionHandler.generateClickEvent("dragStart", event, pointer, void 0, true); } /** * Adds a node on the specified location * @param {object} clickData * @private */ _performAddNode(clickData) { const defaultData = { id: v4(), x: clickData.pointer.canvas.x, y: clickData.pointer.canvas.y, label: "new" }; if (typeof this.options.addNode === "function") if (this.options.addNode.length === 2) this.options.addNode(defaultData, (finalizedData) => { if (finalizedData !== null && finalizedData !== void 0 && this.inMode === "addNode") this.body.data.nodes.getDataSet().add(finalizedData); this.showManipulatorToolbar(); }); else { this.showManipulatorToolbar(); throw new Error("The function for add does not support two arguments (data,callback)"); } else { this.body.data.nodes.getDataSet().add(defaultData); this.showManipulatorToolbar(); } } /** * connect two nodes with a new edge. * @param {Node.id} sourceNodeId * @param {Node.id} targetNodeId * @private */ _performAddEdge(sourceNodeId, targetNodeId) { const defaultData = { from: sourceNodeId, to: targetNodeId }; if (typeof this.options.addEdge === "function") if (this.options.addEdge.length === 2) this.options.addEdge(defaultData, (finalizedData) => { if (finalizedData !== null && finalizedData !== void 0 && this.inMode === "addEdge") { this.body.data.edges.getDataSet().add(finalizedData); this.selectionHandler.unselectAll(); this.showManipulatorToolbar(); } }); else throw new Error("The function for connect does not support two arguments (data,callback)"); else { this.body.data.edges.getDataSet().add(defaultData); this.selectionHandler.unselectAll(); this.showManipulatorToolbar(); } } /** * connect two nodes with a new edge. * @param {Node.id} sourceNodeId * @param {Node.id} targetNodeId * @private */ _performEditEdge(sourceNodeId, targetNodeId) { const defaultData = { id: this.edgeBeingEditedId, from: sourceNodeId, to: targetNodeId, label: this.body.data.edges.get(this.edgeBeingEditedId).label }; let eeFunct = this.options.editEdge; if (typeof eeFunct === "object") eeFunct = eeFunct.editWithoutDrag; if (typeof eeFunct === "function") if (eeFunct.length === 2) eeFunct(defaultData, (finalizedData) => { if (finalizedData === null || finalizedData === void 0 || this.inMode !== "editEdge") { this.body.edges[defaultData.id].updateEdgeType(); this.body.emitter.emit("_redraw"); this.showManipulatorToolbar(); } else { this.body.data.edges.getDataSet().update(finalizedData); this.selectionHandler.unselectAll(); this.showManipulatorToolbar(); } }); else throw new Error("The function for edit does not support two arguments (data, callback)"); else { this.body.data.edges.getDataSet().update(defaultData); this.selectionHandler.unselectAll(); this.showManipulatorToolbar(); } } }; /** * This object contains all possible options. It will check if the types are correct, if required if the option is one * of the allowed values. * * __any__ means that the name of the property does not matter. * __type__ is a required field for all objects and contains the allowed types of all objects */ const string = "string"; const bool = "boolean"; const number = "number"; const array = "array"; const object = "object"; const dom = "dom"; const any = "any"; const endPoints = [ "arrow", "bar", "box", "circle", "crow", "curve", "diamond", "image", "inv_curve", "inv_triangle", "triangle", "vee" ]; const nodeOptions = { borderWidth: { number }, borderWidthSelected: { number, undefined: "undefined" }, brokenImage: { string, undefined: "undefined" }, chosen: { label: { boolean: bool, function: "function" }, node: { boolean: bool, function: "function" }, __type__: { object, boolean: bool } }, color: { border: { string }, background: { string }, highlight: { border: { string }, background: { string }, __type__: { object, string } }, hover: { border: { string }, background: { string }, __type__: { object, string } }, __type__: { object, string } }, opacity: { number, undefined: "undefined" }, fixed: { x: { boolean: bool }, y: { boolean: bool }, __type__: { object, boolean: bool } }, font: { align: { string }, color: { string }, size: { number }, face: { string }, background: { string }, strokeWidth: { number }, strokeColor: { string }, vadjust: { number }, multi: { boolean: bool, string }, bold: { color: { string }, size: { number }, face: { string }, mod: { string }, vadjust: { number }, __type__: { object, string } }, boldital: { color: { string }, size: { number }, face: { string }, mod: { string }, vadjust: { number }, __type__: { object, string } }, ital: { color: { string }, size: { number }, face: { string }, mod: { string }, vadjust: { number }, __type__: { object, string } }, mono: { color: { string }, size: { number }, face: { string }, mod: { string }, vadjust: { number }, __type__: { object, string } }, __type__: { object, string } }, group: { string, number, undefined: "undefined" }, heightConstraint: { minimum: { number }, valign: { string }, __type__: { object, boolean: bool, number } }, hidden: { boolean: bool }, icon: { face: { string }, code: { string }, size: { number }, color: { string }, weight: { string, number }, __type__: { object } }, id: { string, number }, image: { selected: { string, undefined: "undefined" }, unselected: { string, undefined: "undefined" }, __type__: { object, string } }, imagePadding: { top: { number }, right: { number }, bottom: { number }, left: { number }, __type__: { object, number } }, label: { string, undefined: "undefined" }, labelHighlightBold: { boolean: bool }, level: { number, undefined: "undefined" }, margin: { top: { number }, right: { number }, bottom: { number }, left: { number }, __type__: { object, number } }, mass: { number }, physics: { boolean: bool }, scaling: { min: { number }, max: { number }, label: { enabled: { boolean: bool }, min: { number }, max: { number }, maxVisible: { number }, drawThreshold: { number }, __type__: { object, boolean: bool } }, customScalingFunction: { function: "function" }, __type__: { object } }, shadow: { enabled: { boolean: bool }, color: { string }, size: { number }, x: { number }, y: { number }, __type__: { object, boolean: bool } }, shape: { string: [ "custom", "ellipse", "circle", "database", "box", "text", "image", "circularImage", "diamond", "dot", "star", "triangle", "triangleDown", "square", "icon", "hexagon" ] }, ctxRenderer: { function: "function" }, shapeProperties: { borderDashes: { boolean: bool, array }, borderRadius: { number }, interpolation: { boolean: bool }, useImageSize: { boolean: bool }, useBorderWithImage: { boolean: bool }, coordinateOrigin: { string: ["center", "top-left"] }, __type__: { object } }, size: { number }, title: { string, dom, undefined: "undefined" }, value: { number, undefined: "undefined" }, widthConstraint: { minimum: { number }, maximum: { number }, __type__: { object, boolean: bool, number } }, x: { number }, y: { number }, __type__: { object } }; const allOptions = { configure: { enabled: { boolean: bool }, filter: { boolean: bool, string, array, function: "function" }, container: { dom }, showButton: { boolean: bool }, __type__: { object, boolean: bool, string, array, function: "function" } }, edges: { arrows: { to: { enabled: { boolean: bool }, scaleFactor: { number }, type: { string: endPoints }, imageHeight: { number }, imageWidth: { number }, src: { string }, __type__: { object, boolean: bool } }, middle: { enabled: { boolean: bool }, scaleFactor: { number }, type: { string: endPoints }, imageWidth: { number }, imageHeight: { number }, src: { string }, __type__: { object, boolean: bool } }, from: { enabled: { boolean: bool }, scaleFactor: { number }, type: { string: endPoints }, imageWidth: { number }, imageHeight: { number }, src: { string }, __type__: { object, boolean: bool } }, __type__: { string: [ "from", "to", "middle" ], object } }, endPointOffset: { from: { number }, to: { number }, __type__: { object, number } }, arrowStrikethrough: { boolean: bool }, background: { enabled: { boolean: bool }, color: { string }, size: { number }, dashes: { boolean: bool, array }, __type__: { object, boolean: bool } }, chosen: { label: { boolean: bool, function: "function" }, edge: { boolean: bool, function: "function" }, __type__: { object, boolean: bool } }, color: { color: { string }, highlight: { string }, hover: { string }, inherit: { string: [ "from", "to", "both" ], boolean: bool }, opacity: { number }, __type__: { object, string } }, dashes: { boolean: bool, array }, font: { color: { string }, size: { number }, face: { string }, background: { string }, strokeWidth: { number }, strokeColor: { string }, align: { string: [ "horizontal", "top", "middle", "bottom" ] }, vadjust: { number }, multi: { boolean: bool, string }, bold: { color: { string }, size: { number }, face: { string }, mod: { string }, vadjust: { number }, __type__: { object, string } }, boldital: { color: { string }, size: { number }, face: { string }, mod: { string }, vadjust: { number }, __type__: { object, string } }, ital: { color: { string }, size: { number }, face: { string }, mod: { string }, vadjust: { number }, __type__: { object, string } }, mono: { color: { string }, size: { number }, face: { string }, mod: { string }, vadjust: { number }, __type__: { object, string } }, __type__: { object, string } }, hidden: { boolean: bool }, hoverWidth: { function: "function", number }, label: { string, undefined: "undefined" }, labelHighlightBold: { boolean: bool }, length: { number, undefined: "undefined" }, physics: { boolean: bool }, scaling: { min: { number }, max: { number }, label: { enabled: { boolean: bool }, min: { number }, max: { number }, maxVisible: { number }, drawThreshold: { number }, __type__: { object, boolean: bool } }, customScalingFunction: { function: "function" }, __type__: { object } }, selectionWidth: { function: "function", number }, selfReferenceSize: { number }, selfReference: { size: { number }, angle: { number }, renderBehindTheNode: { boolean: bool }, __type__: { object } }, shadow: { enabled: { boolean: bool }, color: { string }, size: { number }, x: { number }, y: { number }, __type__: { object, boolean: bool } }, smooth: { enabled: { boolean: bool }, type: { string: [ "dynamic", "continuous", "discrete", "diagonalCross", "straightCross", "horizontal", "vertical", "curvedCW", "curvedCCW", "cubicBezier" ] }, roundness: { number }, forceDirection: { string: [ "horizontal", "vertical", "none" ], boolean: bool }, __type__: { object, boolean: bool } }, title: { string, undefined: "undefined" }, width: { number }, widthConstraint: { maximum: { number }, __type__: { object, boolean: bool, number } }, value: { number, undefined: "undefined" }, __type__: { object } }, groups: { useDefaultGroups: { boolean: bool }, __any__: nodeOptions, __type__: { object } }, interaction: { dragNodes: { boolean: bool }, dragView: { boolean: bool }, hideEdgesOnDrag: { boolean: bool }, hideEdgesOnZoom: { boolean: bool }, hideNodesOnDrag: { boolean: bool }, hover: { boolean: bool }, keyboard: { enabled: { boolean: bool }, speed: { x: { number }, y: { number }, zoom: { number }, __type__: { object } }, bindToWindow: { boolean: bool }, autoFocus: { boolean: bool }, __type__: { object, boolean: bool } }, multiselect: { boolean: bool }, navigationButtons: { boolean: bool }, selectable: { boolean: bool }, selectConnectedEdges: { boolean: bool }, hoverConnectedEdges: { boolean: bool }, tooltipDelay: { number }, zoomView: { boolean: bool }, zoomSpeed: { number }, __type__: { object } }, layout: { randomSeed: { undefined: "undefined", number, string }, improvedLayout: { boolean: bool }, clusterThreshold: { number }, hierarchical: { enabled: { boolean: bool }, levelSeparation: { number }, nodeSpacing: { number }, treeSpacing: { number }, blockShifting: { boolean: bool }, edgeMinimization: { boolean: bool }, parentCentralization: { boolean: bool }, direction: { string: [ "UD", "DU", "LR", "RL" ] }, sortMethod: { string: ["hubsize", "directed"] }, shakeTowards: { string: ["leaves", "roots"] }, __type__: { object, boolean: bool } }, __type__: { object } }, manipulation: { enabled: { boolean: bool }, initiallyActive: { boolean: bool }, addNode: { boolean: bool, function: "function" }, addEdge: { boolean: bool, function: "function" }, editNode: { function: "function" }, editEdge: { editWithoutDrag: { function: "function" }, __type__: { object, boolean: bool, function: "function" } }, deleteNode: { boolean: bool, function: "function" }, deleteEdge: { boolean: bool, function: "function" }, controlNodeStyle: nodeOptions, __type__: { object, boolean: bool } }, nodes: nodeOptions, physics: { enabled: { boolean: bool }, barnesHut: { theta: { number }, gravitationalConstant: { number }, centralGravity: { number }, springLength: { number }, springConstant: { number }, damping: { number }, avoidOverlap: { number }, __type__: { object } }, forceAtlas2Based: { theta: { number }, gravitationalConstant: { number }, centralGravity: { number }, springLength: { number }, springConstant: { number }, damping: { number }, avoidOverlap: { number }, __type__: { object } }, repulsion: { centralGravity: { number }, springLength: { number }, springConstant: { number }, nodeDistance: { number }, damping: { number }, __type__: { object } }, hierarchicalRepulsion: { centralGravity: { number }, springLength: { number }, springConstant: { number }, nodeDistance: { number }, damping: { number }, avoidOverlap: { number }, __type__: { object } }, maxVelocity: { number }, minVelocity: { number }, solver: { string: [ "barnesHut", "repulsion", "hierarchicalRepulsion", "forceAtlas2Based" ] }, stabilization: { enabled: { boolean: bool }, iterations: { number }, updateInterval: { number }, onlyDynamicEdges: { boolean: bool }, fit: { boolean: bool }, __type__: { object, boolean: bool } }, timestep: { number }, adaptiveTimestep: { boolean: bool }, wind: { x: { number }, y: { number }, __type__: { object } }, __type__: { object, boolean: bool } }, autoResize: { boolean: bool }, clickToUse: { boolean: bool }, locale: { string }, locales: { __any__: { any }, __type__: { object } }, height: { string }, width: { string }, __type__: { object } }; /** * This provides ranges, initial values, steps and dropdown menu choices for the * configuration. * @remarks * Checkbox: `boolean` * The value supllied will be used as the initial value. * * Text field: `string` * The passed text will be used as the initial value. Any text will be * accepted afterwards. * * Number range: `[number, number, number, number]` * The meanings are `[initial value, min, max, step]`. * * Dropdown: `[Exclude, ...(string | number | boolean)[]]` * Translations for people with poor understanding of TypeScript: the first * value always has to be a string but never `"color"`, the rest can be any * combination of strings, numbers and booleans. * * Color picker: `["color", string]` * The first value says this will be a color picker not a dropdown menu. The * next value is the initial color. */ const configureOptions = { nodes: { borderWidth: [ 1, 0, 10, 1 ], borderWidthSelected: [ 2, 0, 10, 1 ], color: { border: ["color", "#2B7CE9"], background: ["color", "#97C2FC"], highlight: { border: ["color", "#2B7CE9"], background: ["color", "#D2E5FF"] }, hover: { border: ["color", "#2B7CE9"], background: ["color", "#D2E5FF"] } }, opacity: [ 0, 0, 1, .1 ], fixed: { x: false, y: false }, font: { color: ["color", "#343434"], size: [ 14, 0, 100, 1 ], face: [ "arial", "verdana", "tahoma" ], background: ["color", "none"], strokeWidth: [ 0, 0, 50, 1 ], strokeColor: ["color", "#ffffff"] }, hidden: false, labelHighlightBold: true, physics: true, scaling: { min: [ 10, 0, 200, 1 ], max: [ 30, 0, 200, 1 ], label: { enabled: false, min: [ 14, 0, 200, 1 ], max: [ 30, 0, 200, 1 ], maxVisible: [ 30, 0, 200, 1 ], drawThreshold: [ 5, 0, 20, 1 ] } }, shadow: { enabled: false, color: "rgba(0,0,0,0.5)", size: [ 10, 0, 20, 1 ], x: [ 5, -30, 30, 1 ], y: [ 5, -30, 30, 1 ] }, shape: [ "ellipse", "box", "circle", "database", "diamond", "dot", "square", "star", "text", "triangle", "triangleDown", "hexagon" ], shapeProperties: { borderDashes: false, borderRadius: [ 6, 0, 20, 1 ], interpolation: true, useImageSize: false }, size: [ 25, 0, 200, 1 ] }, edges: { arrows: { to: { enabled: false, scaleFactor: [ 1, 0, 3, .05 ], type: "arrow" }, middle: { enabled: false, scaleFactor: [ 1, 0, 3, .05 ], type: "arrow" }, from: { enabled: false, scaleFactor: [ 1, 0, 3, .05 ], type: "arrow" } }, endPointOffset: { from: [ 0, -10, 10, 1 ], to: [ 0, -10, 10, 1 ] }, arrowStrikethrough: true, color: { color: ["color", "#848484"], highlight: ["color", "#848484"], hover: ["color", "#848484"], inherit: [ "from", "to", "both", true, false ], opacity: [ 1, 0, 1, .05 ] }, dashes: false, font: { color: ["color", "#343434"], size: [ 14, 0, 100, 1 ], face: [ "arial", "verdana", "tahoma" ], background: ["color", "none"], strokeWidth: [ 2, 0, 50, 1 ], strokeColor: ["color", "#ffffff"], align: [ "horizontal", "top", "middle", "bottom" ] }, hidden: false, hoverWidth: [ 1.5, 0, 5, .1 ], labelHighlightBold: true, physics: true, scaling: { min: [ 1, 0, 100, 1 ], max: [ 15, 0, 100, 1 ], label: { enabled: true, min: [ 14, 0, 200, 1 ], max: [ 30, 0, 200, 1 ], maxVisible: [ 30, 0, 200, 1 ], drawThreshold: [ 5, 0, 20, 1 ] } }, selectionWidth: [ 1.5, 0, 5, .1 ], selfReferenceSize: [ 20, 0, 200, 1 ], selfReference: { size: [ 20, 0, 200, 1 ], angle: [ Math.PI / 2, -6 * Math.PI, 6 * Math.PI, Math.PI / 8 ], renderBehindTheNode: true }, shadow: { enabled: false, color: "rgba(0,0,0,0.5)", size: [ 10, 0, 20, 1 ], x: [ 5, -30, 30, 1 ], y: [ 5, -30, 30, 1 ] }, smooth: { enabled: true, type: [ "dynamic", "continuous", "discrete", "diagonalCross", "straightCross", "horizontal", "vertical", "curvedCW", "curvedCCW", "cubicBezier" ], forceDirection: [ "horizontal", "vertical", "none" ], roundness: [ .5, 0, 1, .05 ] }, width: [ 1, 0, 30, 1 ] }, layout: { hierarchical: { enabled: false, levelSeparation: [ 150, 20, 500, 5 ], nodeSpacing: [ 100, 20, 500, 5 ], treeSpacing: [ 200, 20, 500, 5 ], blockShifting: true, edgeMinimization: true, parentCentralization: true, direction: [ "UD", "DU", "LR", "RL" ], sortMethod: ["hubsize", "directed"], shakeTowards: ["leaves", "roots"] } }, interaction: { dragNodes: true, dragView: true, hideEdgesOnDrag: false, hideEdgesOnZoom: false, hideNodesOnDrag: false, hover: false, keyboard: { enabled: false, speed: { x: [ 10, 0, 40, 1 ], y: [ 10, 0, 40, 1 ], zoom: [ .02, 0, .1, .005 ] }, bindToWindow: true, autoFocus: true }, multiselect: false, navigationButtons: false, selectable: true, selectConnectedEdges: true, hoverConnectedEdges: true, tooltipDelay: [ 300, 0, 1e3, 25 ], zoomView: true, zoomSpeed: [ 1, .1, 2, .1 ] }, manipulation: { enabled: false, initiallyActive: false }, physics: { enabled: true, barnesHut: { theta: [ .5, .1, 1, .05 ], gravitationalConstant: [ -2e3, -3e4, 0, 50 ], centralGravity: [ .3, 0, 10, .05 ], springLength: [ 95, 0, 500, 5 ], springConstant: [ .04, 0, 1.2, .005 ], damping: [ .09, 0, 1, .01 ], avoidOverlap: [ 0, 0, 1, .01 ] }, forceAtlas2Based: { theta: [ .5, .1, 1, .05 ], gravitationalConstant: [ -50, -500, 0, 1 ], centralGravity: [ .01, 0, 1, .005 ], springLength: [ 95, 0, 500, 5 ], springConstant: [ .08, 0, 1.2, .005 ], damping: [ .4, 0, 1, .01 ], avoidOverlap: [ 0, 0, 1, .01 ] }, repulsion: { centralGravity: [ .2, 0, 10, .05 ], springLength: [ 200, 0, 500, 5 ], springConstant: [ .05, 0, 1.2, .005 ], nodeDistance: [ 100, 0, 500, 5 ], damping: [ .09, 0, 1, .01 ] }, hierarchicalRepulsion: { centralGravity: [ .2, 0, 10, .05 ], springLength: [ 100, 0, 500, 5 ], springConstant: [ .01, 0, 1.2, .005 ], nodeDistance: [ 120, 0, 500, 5 ], damping: [ .09, 0, 1, .01 ], avoidOverlap: [ 0, 0, 1, .01 ] }, maxVelocity: [ 50, 0, 150, 1 ], minVelocity: [ .1, .01, .5, .01 ], solver: [ "barnesHut", "forceAtlas2Based", "repulsion", "hierarchicalRepulsion" ], timestep: [ .5, .01, 1, .01 ], wind: { x: [ 0, -10, 10, .1 ], y: [ 0, -10, 10, .1 ] } } }; const configuratorHideOption = (parentPath, optionName, options) => { var _context; if (_includesInstanceProperty(parentPath).call(parentPath, "physics") && _includesInstanceProperty(_context = configureOptions.physics.solver).call(_context, optionName) && options.physics.solver !== optionName && optionName !== "wind") return true; return false; }; var FloydWarshall = class { /** * @ignore */ constructor() {} /** * * @param {object} body * @param {Array.} nodesArray * @param {Array.} edgesArray * @returns {{}} */ getDistances(body, nodesArray, edgesArray) { const D_matrix = {}; const edges = body.edges; for (let i = 0; i < nodesArray.length; i++) { const node = nodesArray[i]; const cell = {}; D_matrix[node] = cell; for (let j = 0; j < nodesArray.length; j++) cell[nodesArray[j]] = i == j ? 0 : 1e9; } for (let i = 0; i < edgesArray.length; i++) { const edge = edges[edgesArray[i]]; if (edge.connected === true && D_matrix[edge.fromId] !== void 0 && D_matrix[edge.toId] !== void 0) { D_matrix[edge.fromId][edge.toId] = 1; D_matrix[edge.toId][edge.fromId] = 1; } } const nodeCount = nodesArray.length; for (let k = 0; k < nodeCount; k++) { const knode = nodesArray[k]; const kcolm = D_matrix[knode]; for (let i = 0; i < nodeCount - 1; i++) { const inode = nodesArray[i]; const icolm = D_matrix[inode]; for (let j = i + 1; j < nodeCount; j++) { const jnode = nodesArray[j]; const jcolm = D_matrix[jnode]; const val = Math.min(icolm[jnode], icolm[knode] + kcolm[jnode]); icolm[jnode] = val; jcolm[inode] = val; } } } return D_matrix; } }; var KamadaKawai = class { /** * @param {object} body * @param {number} edgeLength * @param {number} edgeStrength */ constructor(body, edgeLength, edgeStrength) { this.body = body; this.springLength = edgeLength; this.springConstant = edgeStrength; this.distanceSolver = new FloydWarshall(); } /** * Not sure if needed but can be used to update the spring length and spring constant * @param {object} options */ setOptions(options) { if (options) { if (options.springLength) this.springLength = options.springLength; if (options.springConstant) this.springConstant = options.springConstant; } } /** * Position the system * @param {Array.} nodesArray * @param {Array.} edgesArray * @param {boolean} [ignoreClusters] */ solve(nodesArray, edgesArray) { let ignoreClusters = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; const D_matrix = this.distanceSolver.getDistances(this.body, nodesArray, edgesArray); this._createL_matrix(D_matrix); this._createK_matrix(D_matrix); this._createE_matrix(); const threshold = .01; const innerThreshold = 1; let iterations = 0; const maxIterations = Math.max(1e3, Math.min(10 * this.body.nodeIndices.length, 6e3)); const maxInnerIterations = 5; let maxEnergy = 1e9; let highE_nodeId = 0, dE_dx = 0, dE_dy = 0, delta_m = 0, subIterations = 0; while (maxEnergy > threshold && iterations < maxIterations) { iterations += 1; [highE_nodeId, maxEnergy, dE_dx, dE_dy] = this._getHighestEnergyNode(ignoreClusters); delta_m = maxEnergy; subIterations = 0; while (delta_m > innerThreshold && subIterations < maxInnerIterations) { subIterations += 1; this._moveNode(highE_nodeId, dE_dx, dE_dy); [delta_m, dE_dx, dE_dy] = this._getEnergy(highE_nodeId); } } } /** * get the node with the highest energy * @param {boolean} ignoreClusters * @returns {number[]} * @private */ _getHighestEnergyNode(ignoreClusters) { const nodesArray = this.body.nodeIndices; const nodes = this.body.nodes; let maxEnergy = 0; let maxEnergyNodeId = nodesArray[0]; let dE_dx_max = 0, dE_dy_max = 0; for (let nodeIdx = 0; nodeIdx < nodesArray.length; nodeIdx++) { const m = nodesArray[nodeIdx]; if (nodes[m].predefinedPosition !== true || nodes[m].isCluster === true && ignoreClusters === true || nodes[m].options.fixed.x !== true || nodes[m].options.fixed.y !== true) { const [delta_m, dE_dx, dE_dy] = this._getEnergy(m); if (maxEnergy < delta_m) { maxEnergy = delta_m; maxEnergyNodeId = m; dE_dx_max = dE_dx; dE_dy_max = dE_dy; } } } return [ maxEnergyNodeId, maxEnergy, dE_dx_max, dE_dy_max ]; } /** * calculate the energy of a single node * @param {Node.id} m * @returns {number[]} * @private */ _getEnergy(m) { const [dE_dx, dE_dy] = this.E_sums[m]; const delta_m = Math.sqrt(dE_dx ** 2 + dE_dy ** 2); return [ delta_m, dE_dx, dE_dy ]; } /** * move the node based on it's energy * the dx and dy are calculated from the linear system proposed by Kamada and Kawai * @param {number} m * @param {number} dE_dx * @param {number} dE_dy * @private */ _moveNode(m, dE_dx, dE_dy) { const nodesArray = this.body.nodeIndices; const nodes = this.body.nodes; let d2E_dx2 = 0; let d2E_dxdy = 0; let d2E_dy2 = 0; const x_m = nodes[m].x; const y_m = nodes[m].y; const km = this.K_matrix[m]; const lm = this.L_matrix[m]; for (let iIdx = 0; iIdx < nodesArray.length; iIdx++) { const i = nodesArray[iIdx]; if (i !== m) { const x_i = nodes[i].x; const y_i = nodes[i].y; const kmat = km[i]; const lmat = lm[i]; const denominator = 1 / ((x_m - x_i) ** 2 + (y_m - y_i) ** 2) ** 1.5; d2E_dx2 += kmat * (1 - lmat * (y_m - y_i) ** 2 * denominator); d2E_dxdy += kmat * (lmat * (x_m - x_i) * (y_m - y_i) * denominator); d2E_dy2 += kmat * (1 - lmat * (x_m - x_i) ** 2 * denominator); } } const A = d2E_dx2, B = d2E_dxdy, C = dE_dx, D = d2E_dy2, E = dE_dy; const dy = (C / A + E / B) / (B / A - D / B); const dx = -(B * dy + C) / A; nodes[m].x += dx; nodes[m].y += dy; this._updateE_matrix(m); } /** * Create the L matrix: edge length times shortest path * @param {object} D_matrix * @private */ _createL_matrix(D_matrix) { const nodesArray = this.body.nodeIndices; const edgeLength = this.springLength; this.L_matrix = []; for (let i = 0; i < nodesArray.length; i++) { this.L_matrix[nodesArray[i]] = {}; for (let j = 0; j < nodesArray.length; j++) this.L_matrix[nodesArray[i]][nodesArray[j]] = edgeLength * D_matrix[nodesArray[i]][nodesArray[j]]; } } /** * Create the K matrix: spring constants times shortest path * @param {object} D_matrix * @private */ _createK_matrix(D_matrix) { const nodesArray = this.body.nodeIndices; const edgeStrength = this.springConstant; this.K_matrix = []; for (let i = 0; i < nodesArray.length; i++) { this.K_matrix[nodesArray[i]] = {}; for (let j = 0; j < nodesArray.length; j++) this.K_matrix[nodesArray[i]][nodesArray[j]] = edgeStrength * D_matrix[nodesArray[i]][nodesArray[j]] ** -2; } } /** * Create matrix with all energies between nodes * @private */ _createE_matrix() { const nodesArray = this.body.nodeIndices; const nodes = this.body.nodes; this.E_matrix = {}; this.E_sums = {}; for (let mIdx = 0; mIdx < nodesArray.length; mIdx++) this.E_matrix[nodesArray[mIdx]] = []; for (let mIdx = 0; mIdx < nodesArray.length; mIdx++) { const m = nodesArray[mIdx]; const x_m = nodes[m].x; const y_m = nodes[m].y; let dE_dx = 0; let dE_dy = 0; for (let iIdx = mIdx; iIdx < nodesArray.length; iIdx++) { const i = nodesArray[iIdx]; if (i !== m) { const x_i = nodes[i].x; const y_i = nodes[i].y; const denominator = 1 / Math.sqrt((x_m - x_i) ** 2 + (y_m - y_i) ** 2); this.E_matrix[m][iIdx] = [this.K_matrix[m][i] * (x_m - x_i - this.L_matrix[m][i] * (x_m - x_i) * denominator), this.K_matrix[m][i] * (y_m - y_i - this.L_matrix[m][i] * (y_m - y_i) * denominator)]; this.E_matrix[i][mIdx] = this.E_matrix[m][iIdx]; dE_dx += this.E_matrix[m][iIdx][0]; dE_dy += this.E_matrix[m][iIdx][1]; } } this.E_sums[m] = [dE_dx, dE_dy]; } } /** * Update method, just doing single column (rows are auto-updated) (update all sums) * @param {number} m * @private */ _updateE_matrix(m) { const nodesArray = this.body.nodeIndices; const nodes = this.body.nodes; const colm = this.E_matrix[m]; const kcolm = this.K_matrix[m]; const lcolm = this.L_matrix[m]; const x_m = nodes[m].x; const y_m = nodes[m].y; let dE_dx = 0; let dE_dy = 0; for (let iIdx = 0; iIdx < nodesArray.length; iIdx++) { const i = nodesArray[iIdx]; if (i !== m) { const cell = colm[iIdx]; const oldDx = cell[0]; const oldDy = cell[1]; const x_i = nodes[i].x; const y_i = nodes[i].y; const denominator = 1 / Math.sqrt((x_m - x_i) ** 2 + (y_m - y_i) ** 2); const dx = kcolm[i] * (x_m - x_i - lcolm[i] * (x_m - x_i) * denominator); const dy = kcolm[i] * (y_m - y_i - lcolm[i] * (y_m - y_i) * denominator); colm[iIdx] = [dx, dy]; dE_dx += dx; dE_dy += dy; const sum = this.E_sums[i]; sum[0] += dx - oldDx; sum[1] += dy - oldDy; } } this.E_sums[m] = [dE_dx, dE_dy]; } }; /** * Create a network visualization, displaying nodes and edges. * @param {Element} container The DOM element in which the Network will * be created. Normally a div element. * @param {object} data An object containing parameters * {Array} nodes * {Array} edges * @param {object} options Options * @class Network */ function Network(container, data, options) { var _context, _context2, _context3, _context4; if (!(this instanceof Network)) throw new SyntaxError("Constructor must be called with the new operator"); this.options = {}; this.defaultOptions = { locale: "en", locales, clickToUse: false }; _Object$assign(this.options, this.defaultOptions); /** * Containers for nodes and edges. * * 'edges' and 'nodes' contain the full definitions of all the network elements. * 'nodeIndices' and 'edgeIndices' contain the id's of the active elements. * * The distinction is important, because a defined node need not be active, i.e. * visible on the canvas. This happens in particular when clusters are defined, in * that case there will be nodes and edges not displayed. * The bottom line is that all code with actions related to visibility, *must* use * 'nodeIndices' and 'edgeIndices', not 'nodes' and 'edges' directly. */ this.body = { container, nodes: {}, nodeIndices: [], edges: {}, edgeIndices: [], emitter: { on: _bindInstanceProperty(_context = this.on).call(_context, this), off: _bindInstanceProperty(_context2 = this.off).call(_context2, this), emit: _bindInstanceProperty(_context3 = this.emit).call(_context3, this), once: _bindInstanceProperty(_context4 = this.once).call(_context4, this) }, eventListeners: { onTap: function() {}, onTouch: function() {}, onDoubleTap: function() {}, onHold: function() {}, onDragStart: function() {}, onDrag: function() {}, onDragEnd: function() {}, onMouseWheel: function() {}, onPinch: function() {}, onMouseMove: function() {}, onRelease: function() {}, onContext: function() {} }, data: { nodes: null, edges: null }, functions: { createNode: function() {}, createEdge: function() {}, getPointer: function() {} }, modules: {}, view: { scale: 1, translation: { x: 0, y: 0 } }, selectionBox: { show: false, position: { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } } } }; this.bindEventListeners(); this.images = new Images(() => this.body.emitter.emit("_requestRedraw")); this.groups = new Groups(); this.canvas = new Canvas(this.body); this.selectionHandler = new SelectionHandler(this.body, this.canvas); this.interactionHandler = new InteractionHandler(this.body, this.canvas, this.selectionHandler); this.view = new View(this.body, this.canvas); this.renderer = new CanvasRenderer(this.body, this.canvas); this.physics = new PhysicsEngine(this.body); this.layoutEngine = new LayoutEngine(this.body); this.clustering = new ClusterEngine(this.body); this.manipulation = new ManipulationSystem(this.body, this.canvas, this.selectionHandler, this.interactionHandler); this.nodesHandler = new NodesHandler(this.body, this.images, this.groups, this.layoutEngine); this.edgesHandler = new EdgesHandler(this.body, this.images, this.groups); this.body.modules["kamadaKawai"] = new KamadaKawai(this.body, 150, .05); this.body.modules["clustering"] = this.clustering; this.canvas._create(); this.setOptions(options); this.setData(data); } Emitter(Network.prototype); /** * Set options * @param {object} options */ Network.prototype.setOptions = function(options) { if (options === null) options = void 0; if (options !== void 0) { const errorFound$1 = Validator.validate(options, allOptions); if (errorFound$1 === true) console.error("%cErrors have been found in the supplied options object.", VALIDATOR_PRINT_STYLE); const fields = [ "locale", "locales", "clickToUse" ]; selectiveDeepExtend(fields, this.options, options); if (options.locale !== void 0) options.locale = normalizeLanguageCode(options.locales || this.options.locales, options.locale); options = this.layoutEngine.setOptions(options.layout, options); this.canvas.setOptions(options); this.groups.setOptions(options.groups); this.nodesHandler.setOptions(options.nodes); this.edgesHandler.setOptions(options.edges); this.physics.setOptions(options.physics); this.manipulation.setOptions(options.manipulation, options, this.options); this.interactionHandler.setOptions(options.interaction); this.renderer.setOptions(options.interaction); this.selectionHandler.setOptions(options.interaction); if (options.groups !== void 0) this.body.emitter.emit("refreshNodes"); if ("configure" in options) { if (!this.configurator) this.configurator = new Configurator(this, this.body.container, configureOptions, this.canvas.pixelRatio, configuratorHideOption); this.configurator.setOptions(options.configure); } if (this.configurator && this.configurator.options.enabled === true) { const networkOptions = { nodes: {}, edges: {}, layout: {}, interaction: {}, manipulation: {}, physics: {}, global: {} }; deepExtend(networkOptions.nodes, this.nodesHandler.options); deepExtend(networkOptions.edges, this.edgesHandler.options); deepExtend(networkOptions.layout, this.layoutEngine.options); deepExtend(networkOptions.interaction, this.selectionHandler.options); deepExtend(networkOptions.interaction, this.renderer.options); deepExtend(networkOptions.interaction, this.interactionHandler.options); deepExtend(networkOptions.manipulation, this.manipulation.options); deepExtend(networkOptions.physics, this.physics.options); deepExtend(networkOptions.global, this.canvas.options); deepExtend(networkOptions.global, this.options); this.configurator.setModuleOptions(networkOptions); } if (options.clickToUse !== void 0) if (options.clickToUse === true) { if (this.activator === void 0) { this.activator = new Activator(this.canvas.frame); this.activator.on("change", () => { this.body.emitter.emit("activate"); }); } } else { if (this.activator !== void 0) { this.activator.destroy(); delete this.activator; } this.body.emitter.emit("activate"); } else this.body.emitter.emit("activate"); this.canvas.setSize(); this.body.emitter.emit("startSimulation"); } }; /** * Update the visible nodes and edges list with the most recent node state. * * Visible nodes are stored in this.body.nodeIndices. * Visible edges are stored in this.body.edgeIndices. * A node or edges is visible if it is not hidden or clustered. * @private */ Network.prototype._updateVisibleIndices = function() { const nodes = this.body.nodes; const edges = this.body.edges; this.body.nodeIndices = []; this.body.edgeIndices = []; for (const nodeId in nodes) if (Object.prototype.hasOwnProperty.call(nodes, nodeId)) { if (!this.clustering._isClusteredNode(nodeId) && nodes[nodeId].options.hidden === false) this.body.nodeIndices.push(nodes[nodeId].id); } for (const edgeId in edges) if (Object.prototype.hasOwnProperty.call(edges, edgeId)) { const edge = edges[edgeId]; const fromNode = nodes[edge.fromId]; const toNode = nodes[edge.toId]; const edgeNodesPresent = fromNode !== void 0 && toNode !== void 0; const isVisible = !this.clustering._isClusteredEdge(edgeId) && edge.options.hidden === false && edgeNodesPresent && fromNode.options.hidden === false && toNode.options.hidden === false; if (isVisible) this.body.edgeIndices.push(edge.id); } }; /** * Bind all events */ Network.prototype.bindEventListeners = function() { this.body.emitter.on("_dataChanged", () => { this.edgesHandler._updateState(); this.body.emitter.emit("_dataUpdated"); }); this.body.emitter.on("_dataUpdated", () => { this.clustering._updateState(); this._updateVisibleIndices(); this._updateValueRange(this.body.nodes); this._updateValueRange(this.body.edges); this.body.emitter.emit("startSimulation"); this.body.emitter.emit("_requestRedraw"); }); }; /** * Set nodes and edges, and optionally options as well. * @param {object} data Object containing parameters: * {Array | DataSet | DataView} [nodes] Array with nodes * {Array | DataSet | DataView} [edges] Array with edges * {String} [dot] String containing data in DOT format * {String} [gephi] String containing data in gephi JSON format * {Options} [options] Object with options */ Network.prototype.setData = function(data) { this.body.emitter.emit("resetPhysics"); this.body.emitter.emit("_resetData"); this.selectionHandler.unselectAll(); if (data && data.dot && (data.nodes || data.edges)) throw new SyntaxError("Data must contain either parameter \"dot\" or parameter pair \"nodes\" and \"edges\", but not both."); this.setOptions(data && data.options); if (data && data.dot) { console.warn("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);"); const dotData = DOTToGraph(data.dot); this.setData(dotData); return; } else if (data && data.gephi) { console.warn("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);"); const gephiData = parseGephi(data.gephi); this.setData(gephiData); return; } else { this.nodesHandler.setData(data && data.nodes, true); this.edgesHandler.setData(data && data.edges, true); } this.body.emitter.emit("_dataChanged"); this.body.emitter.emit("_dataLoaded"); this.body.emitter.emit("initPhysics"); }; /** * Cleans up all bindings of the network, removing it fully from the memory IF the variable is set to null after calling this function. * var network = new vis.Network(..); * network.destroy(); * network = null; */ Network.prototype.destroy = function() { this.body.emitter.emit("destroy"); this.body.emitter.off(); this.off(); delete this.groups; delete this.canvas; delete this.selectionHandler; delete this.interactionHandler; delete this.view; delete this.renderer; delete this.physics; delete this.layoutEngine; delete this.clustering; delete this.manipulation; delete this.nodesHandler; delete this.edgesHandler; delete this.configurator; delete this.images; for (const nodeId in this.body.nodes) { if (!Object.prototype.hasOwnProperty.call(this.body.nodes, nodeId)) continue; delete this.body.nodes[nodeId]; } for (const edgeId in this.body.edges) { if (!Object.prototype.hasOwnProperty.call(this.body.edges, edgeId)) continue; delete this.body.edges[edgeId]; } recursiveDOMDelete(this.body.container); }; /** * Update the values of all object in the given array according to the current * value range of the objects in the array. * @param {object} obj An object containing a set of Edges or Nodes * The objects must have a method getValue() and * setValueRange(min, max). * @private */ Network.prototype._updateValueRange = function(obj) { let id; let valueMin = void 0; let valueMax = void 0; let valueTotal = 0; for (id in obj) if (Object.prototype.hasOwnProperty.call(obj, id)) { const value = obj[id].getValue(); if (value !== void 0) { valueMin = valueMin === void 0 ? value : Math.min(value, valueMin); valueMax = valueMax === void 0 ? value : Math.max(value, valueMax); valueTotal += value; } } if (valueMin !== void 0 && valueMax !== void 0) { for (id in obj) if (Object.prototype.hasOwnProperty.call(obj, id)) obj[id].setValueRange(valueMin, valueMax, valueTotal); } }; /** * Returns true when the Network is active. * @returns {boolean} */ Network.prototype.isActive = function() { return !this.activator || this.activator.active; }; Network.prototype.setSize = function() { return this.canvas.setSize.apply(this.canvas, arguments); }; Network.prototype.canvasToDOM = function() { return this.canvas.canvasToDOM.apply(this.canvas, arguments); }; Network.prototype.DOMtoCanvas = function() { return this.canvas.DOMtoCanvas.apply(this.canvas, arguments); }; /** * Nodes can be in clusters. Clusters can also be in clusters. This function returns and array of * nodeIds showing where the node is. * * If any nodeId in the chain, especially the first passed in as a parameter, is not present in * the current nodes list, an empty array is returned. * * Example: * cluster 'A' contains cluster 'B', * cluster 'B' contains cluster 'C', * cluster 'C' contains node 'fred'. * `jsnetwork.clustering.findNode('fred')` will return `['A','B','C','fred']`. * @param {string|number} nodeId * @returns {Array} */ Network.prototype.findNode = function() { return this.clustering.findNode.apply(this.clustering, arguments); }; Network.prototype.isCluster = function() { return this.clustering.isCluster.apply(this.clustering, arguments); }; Network.prototype.openCluster = function() { return this.clustering.openCluster.apply(this.clustering, arguments); }; Network.prototype.cluster = function() { return this.clustering.cluster.apply(this.clustering, arguments); }; Network.prototype.getNodesInCluster = function() { return this.clustering.getNodesInCluster.apply(this.clustering, arguments); }; Network.prototype.clusterByConnection = function() { return this.clustering.clusterByConnection.apply(this.clustering, arguments); }; Network.prototype.clusterByHubsize = function() { return this.clustering.clusterByHubsize.apply(this.clustering, arguments); }; Network.prototype.updateClusteredNode = function() { return this.clustering.updateClusteredNode.apply(this.clustering, arguments); }; Network.prototype.getClusteredEdges = function() { return this.clustering.getClusteredEdges.apply(this.clustering, arguments); }; Network.prototype.getBaseEdge = function() { return this.clustering.getBaseEdge.apply(this.clustering, arguments); }; Network.prototype.getBaseEdges = function() { return this.clustering.getBaseEdges.apply(this.clustering, arguments); }; Network.prototype.updateEdge = function() { return this.clustering.updateEdge.apply(this.clustering, arguments); }; /** * This method will cluster all nodes with 1 edge with their respective connected node. * The options object is explained in full below. * @param {object} [options] * @returns {undefined} */ Network.prototype.clusterOutliers = function() { return this.clustering.clusterOutliers.apply(this.clustering, arguments); }; Network.prototype.getSeed = function() { return this.layoutEngine.getSeed.apply(this.layoutEngine, arguments); }; Network.prototype.enableEditMode = function() { return this.manipulation.enableEditMode.apply(this.manipulation, arguments); }; Network.prototype.disableEditMode = function() { return this.manipulation.disableEditMode.apply(this.manipulation, arguments); }; Network.prototype.addNodeMode = function() { return this.manipulation.addNodeMode.apply(this.manipulation, arguments); }; Network.prototype.editNode = function() { return this.manipulation.editNode.apply(this.manipulation, arguments); }; Network.prototype.editNodeMode = function() { console.warn("Deprecated: Please use editNode instead of editNodeMode."); return this.manipulation.editNode.apply(this.manipulation, arguments); }; Network.prototype.addEdgeMode = function() { return this.manipulation.addEdgeMode.apply(this.manipulation, arguments); }; Network.prototype.editEdgeMode = function() { return this.manipulation.editEdgeMode.apply(this.manipulation, arguments); }; Network.prototype.deleteSelected = function() { return this.manipulation.deleteSelected.apply(this.manipulation, arguments); }; Network.prototype.getPositions = function() { return this.nodesHandler.getPositions.apply(this.nodesHandler, arguments); }; Network.prototype.getPosition = function() { return this.nodesHandler.getPosition.apply(this.nodesHandler, arguments); }; Network.prototype.storePositions = function() { return this.nodesHandler.storePositions.apply(this.nodesHandler, arguments); }; Network.prototype.moveNode = function() { return this.nodesHandler.moveNode.apply(this.nodesHandler, arguments); }; Network.prototype.getBoundingBox = function() { return this.nodesHandler.getBoundingBox.apply(this.nodesHandler, arguments); }; Network.prototype.getConnectedNodes = function(objectId) { if (this.body.nodes[objectId] !== void 0) return this.nodesHandler.getConnectedNodes.apply(this.nodesHandler, arguments); else return this.edgesHandler.getConnectedNodes.apply(this.edgesHandler, arguments); }; Network.prototype.getConnectedEdges = function() { return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler, arguments); }; Network.prototype.startSimulation = function() { return this.physics.startSimulation.apply(this.physics, arguments); }; Network.prototype.stopSimulation = function() { return this.physics.stopSimulation.apply(this.physics, arguments); }; Network.prototype.stabilize = function() { return this.physics.stabilize.apply(this.physics, arguments); }; Network.prototype.getSelection = function() { return this.selectionHandler.getSelection.apply(this.selectionHandler, arguments); }; Network.prototype.setSelection = function() { return this.selectionHandler.setSelection.apply(this.selectionHandler, arguments); }; Network.prototype.getSelectedNodes = function() { return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler, arguments); }; Network.prototype.getSelectedEdges = function() { return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler, arguments); }; Network.prototype.getNodeAt = function() { const node = this.selectionHandler.getNodeAt.apply(this.selectionHandler, arguments); if (node !== void 0 && node.id !== void 0) return node.id; return node; }; Network.prototype.getEdgeAt = function() { const edge = this.selectionHandler.getEdgeAt.apply(this.selectionHandler, arguments); if (edge !== void 0 && edge.id !== void 0) return edge.id; return edge; }; Network.prototype.selectNodes = function() { return this.selectionHandler.selectNodes.apply(this.selectionHandler, arguments); }; Network.prototype.selectEdges = function() { return this.selectionHandler.selectEdges.apply(this.selectionHandler, arguments); }; Network.prototype.unselectAll = function() { this.selectionHandler.unselectAll.apply(this.selectionHandler, arguments); this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler); this.redraw(); }; Network.prototype.redraw = function() { return this.renderer.redraw.apply(this.renderer, arguments); }; Network.prototype.getScale = function() { return this.view.getScale.apply(this.view, arguments); }; Network.prototype.getViewPosition = function() { return this.view.getViewPosition.apply(this.view, arguments); }; Network.prototype.fit = function() { return this.view.fit.apply(this.view, arguments); }; Network.prototype.moveTo = function() { return this.view.moveTo.apply(this.view, arguments); }; Network.prototype.focus = function() { return this.view.focus.apply(this.view, arguments); }; Network.prototype.releaseNode = function() { return this.view.releaseNode.apply(this.view, arguments); }; Network.prototype.getOptionsFromConfigurator = function() { let options = {}; if (this.configurator) options = this.configurator.getOptions.apply(this.configurator); return options; }; const _hoisted_1$2 = { key: 0 }; const _hoisted_2$2 = { border: "~ main", flex: "~ col", absolute: "", "bottom-3": "", "right-3": "", "w-38": "", "select-none": "", rounded: "", "bg-main": "", "bg-opacity-75": "", p3: "", "text-sm": "", shadow: "", "backdrop-blur-8": "" }; const _hoisted_3$2 = { border: "~ main", absolute: "", "bottom-3": "", "left-3": "", rounded: "", "bg-main": "", "bg-opacity-75": "", p3: "", "text-sm": "", shadow: "", "backdrop-blur-8": "", flex: "~ col gap-1" }; var Graph_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({ __name: "Graph", setup(__props) { const search = useSearchResults(); const options = useOptionsStore(); function colorPair(color) { return { color, font: { color } }; } const colors = { vue: colorPair("#42b883"), ts: colorPair("#41b1e0"), js: colorPair("#d6cb2d"), json: colorPair("#cf8f30"), css: colorPair("#e6659a"), html: colorPair("#e34c26"), svelte: colorPair("#ff3e00"), jsx: colorPair("#7d6fe8"), tsx: colorPair("#6f99e8"), faded: colorPair("#888") }; function getModuleWeight(mod, mode) { const value = 10 + (mode === "deps" ? Math.min(mod.deps.length, 30) : Math.min(mod.plugins.reduce((total, plg) => total + (plg[mode] || 0), 0) / 20, 30)); return value; } const container = ref(); const weightItems = [ { value: "deps", label: "dependency count" }, { value: "transform", label: "transform time" }, { value: "resolveId", label: "resolveId time" } ]; const shapes = [ { type: "source", icon: "i-ic-outline-circle" }, { type: "virtual", icon: "i-ic-outline-square rotate-45 scale-85" }, { type: "node_modules", icon: "i-ic-outline-hexagon" } ]; const router = useRouter(); const data = computed(() => { const modules = search.filtered; const nodes = new DataSet(modules.map((mod) => { const path$2 = mod.id.replace(/\?.*$/, "").replace(/#.*$/, ""); const group = path$2.match(/\.(\w+)$/)?.[1] || "unknown"; return { id: mod.id, label: path$2.split("/").splice(-1)[0], group, defaultGroup: group, size: getModuleWeight(mod, options.view.graphWeightMode), shape: mod.id.includes("/node_modules/") ? "hexagon" : mod.virtual ? "diamond" : "dot" }; })); const edges = modules.flatMap((mod) => mod.deps.map((dep) => ({ from: mod.id, to: dep, arrows: { to: { enabled: true, scaleFactor: .8 } }, color: { opacity: .8 } }))); return { nodes, edges }; }); onMounted(() => { const options$1 = { nodes: { shape: "dot", size: 16 }, physics: { maxVelocity: 146, solver: "forceAtlas2Based", timestep: .35, stabilization: { enabled: true, iterations: 200 } }, groups: colors }; const network = new Network(container.value, data.value, options$1); const clicking = ref(false); network.on("click", () => { clicking.value = true; }); network.on("hold", () => { clicking.value = false; }); network.on("dragStart", () => { clicking.value = false; }); network.on("release", (data$1) => { const node = data$1.nodes?.[0]; if (clicking.value && node) { router.push(`/module?id=${encodeURIComponent(node)}`); clicking.value = false; } }); watch(data, () => { network.setData(data.value); }); watch(() => search.results, () => { const nodes = data.value.nodes; nodes.forEach((node) => { const mod = search.results.find((mod$1) => mod$1.id === node.id); nodes.update({ id: node.id, group: mod ? node.defaultGroup : "faded" }); }); }); }); return (_ctx, _cache) => { const _component_RadioGroup = RadioGroup_default; return unref(search).filtered ? (openBlock(), createElementBlock("div", _hoisted_1$2, [ createBaseVNode("div", { ref_key: "container", ref: container, "h-100vh": "", "w-full": "" }, null, 512), createBaseVNode("div", _hoisted_2$2, [ (openBlock(), createElementBlock(Fragment, null, renderList(colors, (value, key) => { return createBaseVNode("div", { key, flex: "~ gap-2 items-center" }, [createBaseVNode("div", { "h-3": "", "w-3": "", "rounded-full": "", style: normalizeStyle({ backgroundColor: value.color }) }, null, 4), createBaseVNode("div", null, toDisplayString(key), 1)]); }), 64)), _cache[1] || (_cache[1] = createBaseVNode("div", { border: "t base", my3: "", "h-1px": "" }, null, -1)), (openBlock(), createElementBlock(Fragment, null, renderList(shapes, (shape) => { return createBaseVNode("div", { key: shape.type, flex: "~ gap-2 items-center" }, [createBaseVNode("div", { class: normalizeClass(shape.icon), "flex-none": "" }, null, 2), createBaseVNode("div", null, toDisplayString(shape.type), 1)]); }), 64)) ]), createBaseVNode("div", _hoisted_3$2, [_cache[2] || (_cache[2] = createBaseVNode("span", { "text-sm": "", op50: "" }, "weight by", -1)), createVNode(_component_RadioGroup, { modelValue: unref(options).view.graphWeightMode, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(options).view.graphWeightMode = $event), "flex-col": "", "text-sm": "", name: "weight", options: weightItems }, null, 8, ["modelValue"])]) ])) : createCommentVNode("", true); }; } }); var Graph_default = Graph_vue_vue_type_script_setup_true_lang_default; const _hoisted_1$1 = { class: "h-min flex flex-col select-none gap-1 whitespace-nowrap text-xs" }; const _hoisted_2$1 = { class: "flex gap-2" }; const _hoisted_3$1 = { class: "flex" }; const _hoisted_4$1 = { class: "flex gap-2" }; const _hoisted_5 = { class: "flex" }; const _hoisted_6 = { class: "flex" }; const _hoisted_7 = { class: "flex" }; var SearchBox_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({ __name: "SearchBox", setup(__props) { const options = useOptionsStore(); return (_ctx, _cache) => { return openBlock(), createElementBlock(Fragment, null, [withDirectives(createBaseVNode("input", { "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(options).search.text = $event), type: "text", class: "border border-main rounded bg-transparent px-3 py-1 !outline-none", placeholder: "Search..." }, null, 512), [[vModelText, unref(options).search.text]]), createBaseVNode("div", _hoisted_1$1, [createBaseVNode("div", _hoisted_2$1, [createBaseVNode("label", _hoisted_3$1, [withDirectives(createBaseVNode("input", { "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(options).search.exactSearch = $event), type: "checkbox", class: "my-auto" }, null, 512), [[vModelCheckbox, unref(options).search.exactSearch]]), _cache[5] || (_cache[5] = createBaseVNode("div", { class: "ml-1" }, "exact search", -1))])]), createBaseVNode("div", _hoisted_4$1, [ createBaseVNode("label", _hoisted_5, [withDirectives(createBaseVNode("input", { "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(options).search.includeNodeModules = $event), type: "checkbox", class: "my-auto" }, null, 512), [[vModelCheckbox, unref(options).search.includeNodeModules]]), _cache[6] || (_cache[6] = createBaseVNode("div", { class: "ml-1" }, "node_modules", -1))]), createBaseVNode("label", _hoisted_6, [withDirectives(createBaseVNode("input", { "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(options).search.includeVirtual = $event), type: "checkbox", class: "my-auto" }, null, 512), [[vModelCheckbox, unref(options).search.includeVirtual]]), _cache[7] || (_cache[7] = createBaseVNode("div", { class: "ml-1" }, "virtual", -1))]), createBaseVNode("label", _hoisted_7, [withDirectives(createBaseVNode("input", { "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(options).search.includeUnreached = $event), type: "checkbox", class: "my-auto" }, null, 512), [[vModelCheckbox, unref(options).search.includeUnreached]]), _cache[8] || (_cache[8] = createBaseVNode("div", { class: "ml-1" }, "unreached", -1))]) ])])], 64); }; } }); var SearchBox_default = SearchBox_vue_vue_type_script_setup_true_lang_default; const _hoisted_1 = ["disabled"]; const _hoisted_2 = { key: 0, "i-carbon-list-boxes": "" }; const _hoisted_3 = { key: 1, "i-carbon-list": "" }; const _hoisted_4 = { key: 2, "i-carbon-network-4": "" }; var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({ __name: "index", setup(__props) { const options = useOptionsStore(); const payload = usePayloadStore(); const search = useSearchResults(); const route = useRoute(); const isRoot = computed(() => route.path === "/"); return (_ctx, _cache) => { const _component_SearchBox = SearchBox_default; const _component_QuerySelector = QuerySelector_default; const _component_RouterLink = resolveComponent("RouterLink"); const _component_NavBar = NavBar_default; const _component_Graph = Graph_default; const _component_ModuleList = ModuleList_default; const _component_Container = Container_default; const _component_RouterView = resolveComponent("RouterView"); return openBlock(), createElementBlock(Fragment, null, [ createVNode(_component_NavBar, null, { default: withCtx(() => [ _cache[14] || (_cache[14] = createBaseVNode("div", { "i-carbon-ibm-watson-discovery": "", title: "Vite Inspect", "text-xl": "" }, null, -1)), createVNode(_component_SearchBox), _cache[15] || (_cache[15] = createBaseVNode("div", { "flex-auto": "" }, null, -1)), createVNode(_component_QuerySelector), _cache[16] || (_cache[16] = createBaseVNode("div", { mx1: "", "h-full": "", "w-0": "", border: "r main" }, null, -1)), unref(options).view.listMode === "detailed" ? (openBlock(), createElementBlock("button", { key: 0, "icon-btn": "", "text-lg": "", title: "Sort", flex: "~ items-center", disabled: !!unref(options).search.text, class: normalizeClass(unref(options).search.text ? "op50 pointer-events-none" : ""), onClick: _cache[0] || (_cache[0] = ($event) => unref(options).toggleSort()) }, [unref(options).search.text ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[3] || (_cache[3] = createBaseVNode("span", { "i-carbon-search": "" }, null, -1)), _cache[4] || (_cache[4] = createBaseVNode("span", { "i-carbon-arrow-down": "", "text-sm": "", op70: "" }, null, -1))], 64)) : unref(options).view.sort === "time-asc" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [_cache[5] || (_cache[5] = createBaseVNode("span", { "i-carbon-time": "" }, null, -1)), _cache[6] || (_cache[6] = createBaseVNode("span", { "i-carbon-arrow-down": "", "text-sm": "", op70: "" }, null, -1))], 64)) : unref(options).view.sort === "time-desc" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [_cache[7] || (_cache[7] = createBaseVNode("span", { "i-carbon-time": "" }, null, -1)), _cache[8] || (_cache[8] = createBaseVNode("span", { "i-carbon-arrow-up": "", "text-sm": "", op70: "" }, null, -1))], 64)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [_cache[9] || (_cache[9] = createBaseVNode("span", { "i-carbon-menu": "" }, null, -1)), _cache[10] || (_cache[10] = createBaseVNode("span", { "i-carbon-chevron-sort": "", "text-sm": "", op70: "" }, null, -1))], 64))], 10, _hoisted_1)) : createCommentVNode("", true), createBaseVNode("button", { "icon-btn": "", "text-lg": "", title: "View Mode", onClick: _cache[1] || (_cache[1] = ($event) => unref(options).toggleListMode()) }, [unref(options).view.listMode === "detailed" ? (openBlock(), createElementBlock("span", _hoisted_2)) : unref(options).view.listMode === "list" ? (openBlock(), createElementBlock("span", _hoisted_3)) : (openBlock(), createElementBlock("span", _hoisted_4))]), _cache[17] || (_cache[17] = createBaseVNode("div", { mx2: "", "h-full": "", "w-1": "", border: "r main" }, null, -1)), createVNode(_component_RouterLink, { "icon-btn": "", "text-lg": "", to: { path: "/metric", query: unref(route).query }, title: "Metrics" }, { default: withCtx(() => [..._cache[11] || (_cache[11] = [createBaseVNode("span", { "i-carbon-meter": "" }, null, -1)])]), _: 1 }, 8, ["to"]), createVNode(_component_RouterLink, { "icon-btn": "", "text-lg": "", to: { path: "/plugins", query: unref(route).query }, title: "Plugins" }, { default: withCtx(() => [..._cache[12] || (_cache[12] = [createBaseVNode("span", { "i-carbon-microservices-1": "" }, null, -1)])]), _: 1 }, 8, ["to"]), !unref(payload).isStatic ? (openBlock(), createElementBlock("button", { key: 1, class: "icon-btn text-lg", title: "Refetch", onClick: _cache[2] || (_cache[2] = ($event) => unref(payload).refetch()) }, [..._cache[13] || (_cache[13] = [createBaseVNode("span", { "i-carbon-renew": "" }, null, -1)])])) : createCommentVNode("", true) ]), _: 1 }), createVNode(_component_Container, { "of-auto": "" }, { default: withCtx(() => [(openBlock(), createBlock(KeepAlive, null, [unref(options).view.listMode === "graph" ? (openBlock(), createBlock(_component_Graph, { key: 0 })) : (openBlock(), createBlock(_component_ModuleList, { key: 1, modules: unref(search).resultsSorted }, null, 8, ["modules"]))], 1024))]), _: 1 }), createBaseVNode("div", { pos: "fixed bottom-0 left-0 right-0 top-0", flex: "", "overflow-hidden": "", "bg-black:50": "", "transition-all": "", class: normalizeClass(unref(isRoot) ? "pointer-events-none opacity-0" : "opacity-100") }, [createVNode(_component_RouterLink, { "h-full": "", "min-w-70px": "", "flex-auto": "", to: "/" }), createBaseVNode("div", { class: normalizeClass(["h-full w-[calc(100vw-100px)] transform overflow-hidden bg-main shadow-lg transition-transform duration-300", unref(isRoot) ? "translate-x-1/2" : "translate-x-0"]), border: "l main" }, [(openBlock(), createBlock(Suspense, null, { fallback: withCtx(() => [..._cache[18] || (_cache[18] = [createTextVNode(" Loading... ", -1)])]), default: withCtx(() => [createVNode(_component_RouterView, null, { default: withCtx(({ Component }) => [(openBlock(), createBlock(KeepAlive, null, [(openBlock(), createBlock(resolveDynamicComponent(Component)))], 1024))]), _: 1 })]), _: 1 }))], 2)], 2) ], 64); }; } }); var pages_default = index_vue_vue_type_script_setup_true_lang_default; export { pages_default as default };