From b16e4c0ca7eebed4f9780ceb5d356c519f7a60b1 Mon Sep 17 00:00:00 2001 From: JP Cen Date: Thu, 25 Jul 2024 13:45:46 -0400 Subject: [PATCH] 0.9.993 --- main.js | 9686 +++++++++-------- manifest.json | 2 +- src/adapters/mdb/db/db.ts | 2 +- src/adapters/mdb/localCache/localCache.ts | 3 +- .../obsidian/filetypes/markdownAdapter.ts | 32 +- src/adapters/obsidian/settings.ts | 58 +- src/adapters/obsidian/types/obsidian.d.ts | 6 + .../obsidian/ui/editors/FlowEditor.tsx | 33 +- .../markdownView/flowEditor/flowEditor.tsx | 19 +- .../menus/inlineStylerView/InlineMenu.tsx | 236 + .../menus/inlineStylerView/styles/default.ts | 7 +- src/adapters/obsidian/ui/showMainMenu.tsx | 19 + src/adapters/obsidian/ui/ui.tsx | 3 +- src/adapters/obsidian/utils/file.ts | 7 +- .../obsidian/utils/flow/flowEditor.ts | 2 +- src/adapters/obsidian/utils/patches.ts | 41 +- src/core/assets/icons.ts | 117 +- src/core/i18n.ts | 21 +- .../react/components/Blink/BlinkComponent.tsx | 21 +- .../react/components/Explorer/Explorer.tsx | 8 +- .../components/Explorer/PropertiesView.tsx | 7 +- .../MarkdownEditor/MarkdownHeaderView.tsx | 3 +- ...reaEditor.tsx => NavigatorFocusEditor.tsx} | 42 +- .../Navigator/SpaceTree/SpaceTreeItem.tsx | 34 +- .../Navigator/SpaceTree/SpaceTreeView.tsx | 93 +- .../SpaceTree/SpaceTreeVirtualized.tsx | 1 - .../Navigator/Waypoints/Waypoint.tsx | 10 +- .../SpaceEditor/Actions/SpaceActions.tsx | 2 +- .../SpaceEditor/SpacePropertyEditor.tsx | 391 - .../components/SpaceEditor/SpaceQuery.tsx | 3 +- .../SpaceEditor/SpaceTemplateProperty.tsx | 2 +- .../DataTypeView/DataPropertyView.tsx | 1 + .../Contexts/DataTypeView/ObjectCell.tsx | 1 + .../Contexts/FilterBar/FilterBar.tsx | 12 +- .../SpaceEditor/HeaderPropertiesView.tsx | 6 +- .../Contexts/TableView/ColumnHeader.tsx | 10 +- .../Contexts/TableView/TableView.tsx | 9 +- .../components/SpaceView/TitleComponent.tsx | 31 +- .../Menus/contexts/newSpacePropertyMenu.tsx | 11 +- .../UI/Menus/contexts/spacePropertyMenu.tsx | 28 +- .../UI/Menus/navigator/pathContextMenu.tsx | 5 +- src/core/react/context/SidebarContext.tsx | 62 +- src/core/schemas/settings.ts | 4 + .../filesystemAdapter/filesystemAdapter.ts | 6 +- .../filesystemAdapter/spaceInfo.ts | 3 +- src/core/spaceManager/spaceManager.ts | 8 +- .../spaceManager/webAdapter/webAdapter.ts | 6 +- src/core/superstate/api.ts | 3 +- src/core/superstate/cacheParsers.ts | 12 +- src/core/superstate/superstate.ts | 14 +- src/core/superstate/utils/spaces.ts | 5 +- src/core/superstate/workers/search/impl.ts | 3 +- src/core/test/TestComponent.tsx | 20 +- src/core/types/{area.ts => focus.ts} | 2 +- src/core/types/settings.ts | 4 + src/core/types/space.ts | 2 +- src/core/types/superstate.ts | 2 + src/core/utils/formula/formulas.ts | 84 +- src/core/utils/spaces/query.ts | 5 +- src/core/utils/strings.ts | 3 +- src/css/Editor/Flow/FlowEditor.css | 1 + src/css/Editor/Flow/FlowState.css | 33 + src/css/Menus/InlineMenu.css | 35 +- src/css/Panels/FileContext.css | 23 +- src/css/Panels/Navigator/FileTree.css | 4 +- src/css/Panels/Navigator/Navigator.css | 19 +- src/css/SpaceViewer/SpaceView.css | 30 + src/main.ts | 6 +- styles.css | 137 +- 69 files changed, 6136 insertions(+), 5425 deletions(-) rename src/core/react/components/Navigator/SpaceTree/{SpaceTreeAreaEditor.tsx => NavigatorFocusEditor.tsx} (76%) delete mode 100644 src/core/react/components/SpaceEditor/SpacePropertyEditor.tsx rename src/core/types/{area.ts => focus.ts} (73%) create mode 100644 src/css/Editor/Flow/FlowState.css diff --git a/main.js b/main.js index 0526615..f03fc73 100644 --- a/main.js +++ b/main.js @@ -3853,18 +3853,18 @@ var require_moment = __commonJS({ proto$1.weekdaysMinRegex = weekdaysMinRegex; proto$1.isPM = localeIsPM; proto$1.meridiem = localeMeridiem; - function get$1(format9, index2, field, setter) { - var locale3 = getLocale(), utc = createUTC().set(setter, index2); + function get$1(format9, index3, field, setter) { + var locale3 = getLocale(), utc = createUTC().set(setter, index3); return locale3[field](utc, format9); } - function listMonthsImpl(format9, index2, field) { + function listMonthsImpl(format9, index3, field) { if (isNumber4(format9)) { - index2 = format9; + index3 = format9; format9 = void 0; } format9 = format9 || ""; - if (index2 != null) { - return get$1(format9, index2, field, "month"); + if (index3 != null) { + return get$1(format9, index3, field, "month"); } var i4, out = []; for (i4 = 0; i4 < 12; i4++) { @@ -3872,46 +3872,46 @@ var require_moment = __commonJS({ } return out; } - function listWeekdaysImpl(localeSorted, format9, index2, field) { + function listWeekdaysImpl(localeSorted, format9, index3, field) { if (typeof localeSorted === "boolean") { if (isNumber4(format9)) { - index2 = format9; + index3 = format9; format9 = void 0; } format9 = format9 || ""; } else { format9 = localeSorted; - index2 = format9; + index3 = format9; localeSorted = false; if (isNumber4(format9)) { - index2 = format9; + index3 = format9; format9 = void 0; } format9 = format9 || ""; } var locale3 = getLocale(), shift = localeSorted ? locale3._week.dow : 0, i4, out = []; - if (index2 != null) { - return get$1(format9, (index2 + shift) % 7, field, "day"); + if (index3 != null) { + return get$1(format9, (index3 + shift) % 7, field, "day"); } for (i4 = 0; i4 < 7; i4++) { out[i4] = get$1(format9, (i4 + shift) % 7, field, "day"); } return out; } - function listMonths(format9, index2) { - return listMonthsImpl(format9, index2, "months"); + function listMonths(format9, index3) { + return listMonthsImpl(format9, index3, "months"); } - function listMonthsShort(format9, index2) { - return listMonthsImpl(format9, index2, "monthsShort"); + function listMonthsShort(format9, index3) { + return listMonthsImpl(format9, index3, "monthsShort"); } - function listWeekdays(localeSorted, format9, index2) { - return listWeekdaysImpl(localeSorted, format9, index2, "weekdays"); + function listWeekdays(localeSorted, format9, index3) { + return listWeekdaysImpl(localeSorted, format9, index3, "weekdays"); } - function listWeekdaysShort(localeSorted, format9, index2) { - return listWeekdaysImpl(localeSorted, format9, index2, "weekdaysShort"); + function listWeekdaysShort(localeSorted, format9, index3) { + return listWeekdaysImpl(localeSorted, format9, index3, "weekdaysShort"); } - function listWeekdaysMin(localeSorted, format9, index2) { - return listWeekdaysImpl(localeSorted, format9, index2, "weekdaysMin"); + function listWeekdaysMin(localeSorted, format9, index3) { + return listWeekdaysImpl(localeSorted, format9, index3, "weekdaysMin"); } getSetGlobalLocale("en", { eras: [ @@ -4622,17 +4622,17 @@ var require_lodash = __commonJS({ return func.apply(thisArg, args); } function arrayAggregator(array, setter, iteratee, accumulator) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - var value = array[index2]; + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + var value = array[index3]; setter(accumulator, value, iteratee(value), array); } return accumulator; } function arrayEach(array, iteratee) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - if (iteratee(array[index2], index2, array) === false) { + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + if (iteratee(array[index3], index3, array) === false) { break; } } @@ -4648,19 +4648,19 @@ var require_lodash = __commonJS({ return array; } function arrayEvery(array, predicate) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - if (!predicate(array[index2], index2, array)) { + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + if (!predicate(array[index3], index3, array)) { return false; } } return true; } function arrayFilter(array, predicate) { - var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; - while (++index2 < length) { - var value = array[index2]; - if (predicate(value, index2, array)) { + var index3 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; + while (++index3 < length) { + var value = array[index3]; + if (predicate(value, index3, array)) { result[resIndex++] = value; } } @@ -4671,35 +4671,35 @@ var require_lodash = __commonJS({ return !!length && baseIndexOf(array, value, 0) > -1; } function arrayIncludesWith(array, value, comparator) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - if (comparator(value, array[index2])) { + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + if (comparator(value, array[index3])) { return true; } } return false; } function arrayMap(array, iteratee) { - var index2 = -1, length = array == null ? 0 : array.length, result = Array(length); - while (++index2 < length) { - result[index2] = iteratee(array[index2], index2, array); + var index3 = -1, length = array == null ? 0 : array.length, result = Array(length); + while (++index3 < length) { + result[index3] = iteratee(array[index3], index3, array); } return result; } function arrayPush(array, values2) { - var index2 = -1, length = values2.length, offset2 = array.length; - while (++index2 < length) { - array[offset2 + index2] = values2[index2]; + var index3 = -1, length = values2.length, offset2 = array.length; + while (++index3 < length) { + array[offset2 + index3] = values2[index3]; } return array; } function arrayReduce(array, iteratee, accumulator, initAccum) { - var index2 = -1, length = array == null ? 0 : array.length; + var index3 = -1, length = array == null ? 0 : array.length; if (initAccum && length) { - accumulator = array[++index2]; + accumulator = array[++index3]; } - while (++index2 < length) { - accumulator = iteratee(accumulator, array[index2], index2, array); + while (++index3 < length) { + accumulator = iteratee(accumulator, array[index3], index3, array); } return accumulator; } @@ -4714,9 +4714,9 @@ var require_lodash = __commonJS({ return accumulator; } function arraySome(array, predicate) { - var index2 = -1, length = array == null ? 0 : array.length; - while (++index2 < length) { - if (predicate(array[index2], index2, array)) { + var index3 = -1, length = array == null ? 0 : array.length; + while (++index3 < length) { + if (predicate(array[index3], index3, array)) { return true; } } @@ -4740,10 +4740,10 @@ var require_lodash = __commonJS({ return result; } function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, index2 = fromIndex + (fromRight ? 1 : -1); - while (fromRight ? index2-- : ++index2 < length) { - if (predicate(array[index2], index2, array)) { - return index2; + var length = array.length, index3 = fromIndex + (fromRight ? 1 : -1); + while (fromRight ? index3-- : ++index3 < length) { + if (predicate(array[index3], index3, array)) { + return index3; } } return -1; @@ -4752,10 +4752,10 @@ var require_lodash = __commonJS({ return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); } function baseIndexOfWith(array, value, fromIndex, comparator) { - var index2 = fromIndex - 1, length = array.length; - while (++index2 < length) { - if (comparator(array[index2], value)) { - return index2; + var index3 = fromIndex - 1, length = array.length; + while (++index3 < length) { + if (comparator(array[index3], value)) { + return index3; } } return -1; @@ -4778,8 +4778,8 @@ var require_lodash = __commonJS({ }; } function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index2, collection2) { - accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index2, collection2); + eachFunc(collection, function(value, index3, collection2) { + accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index3, collection2); }); return accumulator; } @@ -4792,9 +4792,9 @@ var require_lodash = __commonJS({ return array; } function baseSum(array, iteratee) { - var result, index2 = -1, length = array.length; - while (++index2 < length) { - var current3 = iteratee(array[index2]); + var result, index3 = -1, length = array.length; + while (++index3 < length) { + var current3 = iteratee(array[index3]); if (current3 !== undefined2) { result = result === undefined2 ? current3 : result + current3; } @@ -4802,9 +4802,9 @@ var require_lodash = __commonJS({ return result; } function baseTimes(n3, iteratee) { - var index2 = -1, result = Array(n3); - while (++index2 < n3) { - result[index2] = iteratee(index2); + var index3 = -1, result = Array(n3); + while (++index3 < n3) { + result[index3] = iteratee(index3); } return result; } @@ -4830,16 +4830,16 @@ var require_lodash = __commonJS({ return cache2.has(key2); } function charsStartIndex(strSymbols, chrSymbols) { - var index2 = -1, length = strSymbols.length; - while (++index2 < length && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) { + var index3 = -1, length = strSymbols.length; + while (++index3 < length && baseIndexOf(chrSymbols, strSymbols[index3], 0) > -1) { } - return index2; + return index3; } function charsEndIndex(strSymbols, chrSymbols) { - var index2 = strSymbols.length; - while (index2-- && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) { + var index3 = strSymbols.length; + while (index3-- && baseIndexOf(chrSymbols, strSymbols[index3], 0) > -1) { } - return index2; + return index3; } function countHolders(array, placeholder2) { var length = array.length, result = 0; @@ -4872,9 +4872,9 @@ var require_lodash = __commonJS({ return result; } function mapToArray(map4) { - var index2 = -1, result = Array(map4.size); + var index3 = -1, result = Array(map4.size); map4.forEach(function(value, key2) { - result[++index2] = [key2, value]; + result[++index3] = [key2, value]; }); return result; } @@ -4884,47 +4884,47 @@ var require_lodash = __commonJS({ }; } function replaceHolders(array, placeholder2) { - var index2 = -1, length = array.length, resIndex = 0, result = []; - while (++index2 < length) { - var value = array[index2]; + var index3 = -1, length = array.length, resIndex = 0, result = []; + while (++index3 < length) { + var value = array[index3]; if (value === placeholder2 || value === PLACEHOLDER) { - array[index2] = PLACEHOLDER; - result[resIndex++] = index2; + array[index3] = PLACEHOLDER; + result[resIndex++] = index3; } } return result; } function setToArray(set) { - var index2 = -1, result = Array(set.size); + var index3 = -1, result = Array(set.size); set.forEach(function(value) { - result[++index2] = value; + result[++index3] = value; }); return result; } function setToPairs(set) { - var index2 = -1, result = Array(set.size); + var index3 = -1, result = Array(set.size); set.forEach(function(value) { - result[++index2] = [value, value]; + result[++index3] = [value, value]; }); return result; } function strictIndexOf(array, value, fromIndex) { - var index2 = fromIndex - 1, length = array.length; - while (++index2 < length) { - if (array[index2] === value) { - return index2; + var index3 = fromIndex - 1, length = array.length; + while (++index3 < length) { + if (array[index3] === value) { + return index3; } } return -1; } function strictLastIndexOf(array, value, fromIndex) { - var index2 = fromIndex + 1; - while (index2--) { - if (array[index2] === value) { - return index2; + var index3 = fromIndex + 1; + while (index3--) { + if (array[index3] === value) { + return index3; } } - return index2; + return index3; } function stringSize(string6) { return hasUnicode(string6) ? unicodeSize(string6) : asciiSize(string6); @@ -4933,10 +4933,10 @@ var require_lodash = __commonJS({ return hasUnicode(string6) ? unicodeToArray(string6) : asciiToArray(string6); } function trimmedEndIndex(string6) { - var index2 = string6.length; - while (index2-- && reWhitespace.test(string6.charAt(index2))) { + var index3 = string6.length; + while (index3-- && reWhitespace.test(string6.charAt(index3))) { } - return index2; + return index3; } var unescapeHtmlChar = basePropertyOf(htmlUnescapes); function unicodeSize(string6) { @@ -4953,7 +4953,7 @@ var require_lodash = __commonJS({ return string6.match(reUnicodeWord) || []; } var runInContext = function runInContext2(context) { - context = context == null ? root : _15.defaults(root.Object(), context, _15.pick(root, contextProps)); + context = context == null ? root : _16.defaults(root.Object(), context, _16.pick(root, contextProps)); var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError; var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype; var coreJsData = context["__core-js_shared__"]; @@ -5066,15 +5066,15 @@ var require_lodash = __commonJS({ return result2; } function lazyValue() { - var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray5(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index2 = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); + var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray5(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index3 = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || !isRight && arrLength == length && takeCount == length) { return baseWrapperValue(array, this.__actions__); } var result2 = []; outer: while (length-- && resIndex < takeCount) { - index2 += dir; - var iterIndex = -1, value = array[index2]; + index3 += dir; + var iterIndex = -1, value = array[index3]; while (++iterIndex < iterLength) { var data2 = iteratees[iterIndex], iteratee2 = data2.iteratee, type = data2.type, computed = iteratee2(value); if (type == LAZY_MAP_FLAG) { @@ -5094,10 +5094,10 @@ var require_lodash = __commonJS({ LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; function Hash(entries) { - var index2 = -1, length = entries == null ? 0 : entries.length; + var index3 = -1, length = entries == null ? 0 : entries.length; this.clear(); - while (++index2 < length) { - var entry = entries[index2]; + while (++index3 < length) { + var entry = entries[index3]; this.set(entry[0], entry[1]); } } @@ -5134,10 +5134,10 @@ var require_lodash = __commonJS({ Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; function ListCache(entries) { - var index2 = -1, length = entries == null ? 0 : entries.length; + var index3 = -1, length = entries == null ? 0 : entries.length; this.clear(); - while (++index2 < length) { - var entry = entries[index2]; + while (++index3 < length) { + var entry = entries[index3]; this.set(entry[0], entry[1]); } } @@ -5146,33 +5146,33 @@ var require_lodash = __commonJS({ this.size = 0; } function listCacheDelete(key2) { - var data2 = this.__data__, index2 = assocIndexOf(data2, key2); - if (index2 < 0) { + var data2 = this.__data__, index3 = assocIndexOf(data2, key2); + if (index3 < 0) { return false; } var lastIndex = data2.length - 1; - if (index2 == lastIndex) { + if (index3 == lastIndex) { data2.pop(); } else { - splice.call(data2, index2, 1); + splice.call(data2, index3, 1); } --this.size; return true; } function listCacheGet(key2) { - var data2 = this.__data__, index2 = assocIndexOf(data2, key2); - return index2 < 0 ? undefined2 : data2[index2][1]; + var data2 = this.__data__, index3 = assocIndexOf(data2, key2); + return index3 < 0 ? undefined2 : data2[index3][1]; } function listCacheHas(key2) { return assocIndexOf(this.__data__, key2) > -1; } function listCacheSet(key2, value) { - var data2 = this.__data__, index2 = assocIndexOf(data2, key2); - if (index2 < 0) { + var data2 = this.__data__, index3 = assocIndexOf(data2, key2); + if (index3 < 0) { ++this.size; data2.push([key2, value]); } else { - data2[index2][1] = value; + data2[index3][1] = value; } return this; } @@ -5182,10 +5182,10 @@ var require_lodash = __commonJS({ ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; function MapCache(entries) { - var index2 = -1, length = entries == null ? 0 : entries.length; + var index3 = -1, length = entries == null ? 0 : entries.length; this.clear(); - while (++index2 < length) { - var entry = entries[index2]; + while (++index3 < length) { + var entry = entries[index3]; this.set(entry[0], entry[1]); } } @@ -5220,10 +5220,10 @@ var require_lodash = __commonJS({ MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; function SetCache(values3) { - var index2 = -1, length = values3 == null ? 0 : values3.length; + var index3 = -1, length = values3 == null ? 0 : values3.length; this.__data__ = new MapCache(); - while (++index2 < length) { - this.add(values3[index2]); + while (++index3 < length) { + this.add(values3[index3]); } } function setCacheAdd(value) { @@ -5338,9 +5338,9 @@ var require_lodash = __commonJS({ } } function baseAt(object, paths) { - var index2 = -1, length = paths.length, result2 = Array2(length), skip = object == null; - while (++index2 < length) { - result2[index2] = skip ? undefined2 : get2(object, paths[index2]); + var index3 = -1, length = paths.length, result2 = Array2(length), skip = object == null; + while (++index3 < length) { + result2[index3] = skip ? undefined2 : get2(object, paths[index3]); } return result2; } @@ -5444,7 +5444,7 @@ var require_lodash = __commonJS({ }, wait); } function baseDifference(array, values3, iteratee2, comparator) { - var index2 = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values3.length; + var index3 = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values3.length; if (!length) { return result2; } @@ -5460,8 +5460,8 @@ var require_lodash = __commonJS({ values3 = new SetCache(values3); } outer: - while (++index2 < length) { - var value = array[index2], computed = iteratee2 == null ? value : iteratee2(value); + while (++index3 < length) { + var value = array[index3], computed = iteratee2 == null ? value : iteratee2(value); value = comparator || value !== 0 ? value : 0; if (isCommon && computed === computed) { var valuesIndex = valuesLength; @@ -5481,16 +5481,16 @@ var require_lodash = __commonJS({ var baseEachRight = createBaseEach(baseForOwnRight, true); function baseEvery(collection, predicate) { var result2 = true; - baseEach(collection, function(value, index2, collection2) { - result2 = !!predicate(value, index2, collection2); + baseEach(collection, function(value, index3, collection2) { + result2 = !!predicate(value, index3, collection2); return result2; }); return result2; } function baseExtremum(array, iteratee2, comparator) { - var index2 = -1, length = array.length; - while (++index2 < length) { - var value = array[index2], current3 = iteratee2(value); + var index3 = -1, length = array.length; + while (++index3 < length) { + var value = array[index3], current3 = iteratee2(value); if (current3 != null && (computed === undefined2 ? current3 === current3 && !isSymbol(current3) : comparator(current3, computed))) { var computed = current3, result2 = value; } @@ -5515,19 +5515,19 @@ var require_lodash = __commonJS({ } function baseFilter(collection, predicate) { var result2 = []; - baseEach(collection, function(value, index2, collection2) { - if (predicate(value, index2, collection2)) { + baseEach(collection, function(value, index3, collection2) { + if (predicate(value, index3, collection2)) { result2.push(value); } }); return result2; } function baseFlatten(array, depth, predicate, isStrict, result2) { - var index2 = -1, length = array.length; + var index3 = -1, length = array.length; predicate || (predicate = isFlattenable); result2 || (result2 = []); - while (++index2 < length) { - var value = array[index2]; + while (++index3 < length) { + var value = array[index3]; if (depth > 0 && predicate(value)) { if (depth > 1) { baseFlatten(value, depth - 1, predicate, isStrict, result2); @@ -5555,11 +5555,11 @@ var require_lodash = __commonJS({ } function baseGet(object, path2) { path2 = castPath(path2, object); - var index2 = 0, length = path2.length; - while (object != null && index2 < length) { - object = object[toKey(path2[index2++])]; + var index3 = 0, length = path2.length; + while (object != null && index3 < length) { + object = object[toKey(path2[index3++])]; } - return index2 && index2 == length ? object : undefined2; + return index3 && index3 == length ? object : undefined2; } function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result2 = keysFunc(object); @@ -5594,10 +5594,10 @@ var require_lodash = __commonJS({ caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2; } array = arrays[0]; - var index2 = -1, seen = caches[0]; + var index3 = -1, seen = caches[0]; outer: - while (++index2 < length && result2.length < maxLength) { - var value = array[index2], computed = iteratee2 ? iteratee2(value) : value; + while (++index3 < length && result2.length < maxLength) { + var value = array[index3], computed = iteratee2 ? iteratee2(value) : value; value = comparator || value !== 0 ? value : 0; if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) { othIndex = othLength; @@ -5679,19 +5679,19 @@ var require_lodash = __commonJS({ return isObjectLike2(value) && getTag2(value) == mapTag; } function baseIsMatch(object, source, matchData, customizer) { - var index2 = matchData.length, length = index2, noCustomizer = !customizer; + var index3 = matchData.length, length = index3, noCustomizer = !customizer; if (object == null) { return !length; } object = Object2(object); - while (index2--) { - var data2 = matchData[index2]; + while (index3--) { + var data2 = matchData[index3]; if (noCustomizer && data2[2] ? data2[1] !== object[data2[0]] : !(data2[0] in object)) { return false; } } - while (++index2 < length) { - data2 = matchData[index2]; + while (++index3 < length) { + data2 = matchData[index3]; var key2 = data2[0], objValue = object[key2], srcValue = data2[1]; if (noCustomizer && data2[2]) { if (objValue === undefined2 && !(key2 in object)) { @@ -5765,9 +5765,9 @@ var require_lodash = __commonJS({ return value < other; } function baseMap(collection, iteratee2) { - var index2 = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; + var index3 = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; baseEach(collection, function(value, key2, collection2) { - result2[++index2] = iteratee2(value, key2, collection2); + result2[++index3] = iteratee2(value, key2, collection2); }); return result2; } @@ -5870,13 +5870,13 @@ var require_lodash = __commonJS({ } else { iteratees = [identity2]; } - var index2 = -1; + var index3 = -1; iteratees = arrayMap(iteratees, baseUnary(getIteratee())); var result2 = baseMap(collection, function(value, key2, collection2) { var criteria = arrayMap(iteratees, function(iteratee2) { return iteratee2(value); }); - return { "criteria": criteria, "index": ++index2, "value": value }; + return { "criteria": criteria, "index": ++index3, "value": value }; }); return baseSortBy(result2, function(object, other) { return compareMultiple(object, other, orders); @@ -5888,9 +5888,9 @@ var require_lodash = __commonJS({ }); } function basePickBy(object, paths, predicate) { - var index2 = -1, length = paths.length, result2 = {}; - while (++index2 < length) { - var path2 = paths[index2], value = baseGet(object, path2); + var index3 = -1, length = paths.length, result2 = {}; + while (++index3 < length) { + var path2 = paths[index3], value = baseGet(object, path2); if (predicate(value, path2)) { baseSet(result2, castPath(path2, object), value); } @@ -5903,15 +5903,15 @@ var require_lodash = __commonJS({ }; } function basePullAll(array, values3, iteratee2, comparator) { - var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index2 = -1, length = values3.length, seen = array; + var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index3 = -1, length = values3.length, seen = array; if (array === values3) { values3 = copyArray(values3); } if (iteratee2) { seen = arrayMap(array, baseUnary(iteratee2)); } - while (++index2 < length) { - var fromIndex = 0, value = values3[index2], computed = iteratee2 ? iteratee2(value) : value; + while (++index3 < length) { + var fromIndex = 0, value = values3[index3], computed = iteratee2 ? iteratee2(value) : value; while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); @@ -5924,13 +5924,13 @@ var require_lodash = __commonJS({ function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { - var index2 = indexes[length]; - if (length == lastIndex || index2 !== previous) { - var previous = index2; - if (isIndex2(index2)) { - splice.call(array, index2, 1); + var index3 = indexes[length]; + if (length == lastIndex || index3 !== previous) { + var previous = index3; + if (isIndex2(index3)) { + splice.call(array, index3, 1); } else { - baseUnset(array, index2); + baseUnset(array, index3); } } } @@ -5940,9 +5940,9 @@ var require_lodash = __commonJS({ return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } function baseRange(start, end, step, fromRight) { - var index2 = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); + var index3 = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); while (length--) { - result2[fromRight ? length : ++index2] = start; + result2[fromRight ? length : ++index3] = start; start += step; } return result2; @@ -5978,17 +5978,17 @@ var require_lodash = __commonJS({ return object; } path2 = castPath(path2, object); - var index2 = -1, length = path2.length, lastIndex = length - 1, nested = object; - while (nested != null && ++index2 < length) { - var key2 = toKey(path2[index2]), newValue = value; + var index3 = -1, length = path2.length, lastIndex = length - 1, nested = object; + while (nested != null && ++index3 < length) { + var key2 = toKey(path2[index3]), newValue = value; if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") { return object; } - if (index2 != lastIndex) { + if (index3 != lastIndex) { var objValue = nested[key2]; newValue = customizer ? customizer(objValue, key2, nested) : undefined2; if (newValue === undefined2) { - newValue = isObject4(objValue) ? objValue : isIndex2(path2[index2 + 1]) ? [] : {}; + newValue = isObject4(objValue) ? objValue : isIndex2(path2[index3 + 1]) ? [] : {}; } } assignValue(nested, key2, newValue); @@ -6012,7 +6012,7 @@ var require_lodash = __commonJS({ return shuffleSelf(values2(collection)); } function baseSlice(array, start, end) { - var index2 = -1, length = array.length; + var index3 = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : length + start; } @@ -6023,15 +6023,15 @@ var require_lodash = __commonJS({ length = start > end ? 0 : end - start >>> 0; start >>>= 0; var result2 = Array2(length); - while (++index2 < length) { - result2[index2] = array[index2 + start]; + while (++index3 < length) { + result2[index3] = array[index3 + start]; } return result2; } function baseSome(collection, predicate) { var result2; - baseEach(collection, function(value, index2, collection2) { - result2 = predicate(value, index2, collection2); + baseEach(collection, function(value, index3, collection2) { + result2 = predicate(value, index3, collection2); return !result2; }); return !!result2; @@ -6082,10 +6082,10 @@ var require_lodash = __commonJS({ return nativeMin(high, MAX_ARRAY_INDEX); } function baseSortedUniq(array, iteratee2) { - var index2 = -1, length = array.length, resIndex = 0, result2 = []; - while (++index2 < length) { - var value = array[index2], computed = iteratee2 ? iteratee2(value) : value; - if (!index2 || !eq(computed, seen)) { + var index3 = -1, length = array.length, resIndex = 0, result2 = []; + while (++index3 < length) { + var value = array[index3], computed = iteratee2 ? iteratee2(value) : value; + if (!index3 || !eq(computed, seen)) { var seen = computed; result2[resIndex++] = value === 0 ? 0 : value; } @@ -6115,7 +6115,7 @@ var require_lodash = __commonJS({ return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2; } function baseUniq(array, iteratee2, comparator) { - var index2 = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; + var index3 = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; if (comparator) { isCommon = false; includes2 = arrayIncludesWith; @@ -6131,8 +6131,8 @@ var require_lodash = __commonJS({ seen = iteratee2 ? [] : result2; } outer: - while (++index2 < length) { - var value = array[index2], computed = iteratee2 ? iteratee2(value) : value; + while (++index3 < length) { + var value = array[index3], computed = iteratee2 ? iteratee2(value) : value; value = comparator || value !== 0 ? value : 0; if (isCommon && computed === computed) { var seenIndex = seen.length; @@ -6163,10 +6163,10 @@ var require_lodash = __commonJS({ return baseSet(object, path2, updater(baseGet(object, path2)), customizer); } function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, index2 = fromRight ? length : -1; - while ((fromRight ? index2-- : ++index2 < length) && predicate(array[index2], index2, array)) { + var length = array.length, index3 = fromRight ? length : -1; + while ((fromRight ? index3-- : ++index3 < length) && predicate(array[index3], index3, array)) { } - return isDrop ? baseSlice(array, fromRight ? 0 : index2, fromRight ? index2 + 1 : length) : baseSlice(array, fromRight ? index2 + 1 : 0, fromRight ? length : index2); + return isDrop ? baseSlice(array, fromRight ? 0 : index3, fromRight ? index3 + 1 : length) : baseSlice(array, fromRight ? index3 + 1 : 0, fromRight ? length : index3); } function baseWrapperValue(value, actions) { var result2 = value; @@ -6182,22 +6182,22 @@ var require_lodash = __commonJS({ if (length < 2) { return length ? baseUniq(arrays[0]) : []; } - var index2 = -1, result2 = Array2(length); - while (++index2 < length) { - var array = arrays[index2], othIndex = -1; + var index3 = -1, result2 = Array2(length); + while (++index3 < length) { + var array = arrays[index3], othIndex = -1; while (++othIndex < length) { - if (othIndex != index2) { - result2[index2] = baseDifference(result2[index2] || array, arrays[othIndex], iteratee2, comparator); + if (othIndex != index3) { + result2[index3] = baseDifference(result2[index3] || array, arrays[othIndex], iteratee2, comparator); } } } return baseUniq(baseFlatten(result2, 1), iteratee2, comparator); } function baseZipObject(props, values3, assignFunc) { - var index2 = -1, length = props.length, valsLength = values3.length, result2 = {}; - while (++index2 < length) { - var value = index2 < valsLength ? values3[index2] : undefined2; - assignFunc(result2, props[index2], value); + var index3 = -1, length = props.length, valsLength = values3.length, result2 = {}; + while (++index3 < length) { + var value = index3 < valsLength ? values3[index3] : undefined2; + assignFunc(result2, props[index3], value); } return result2; } @@ -6265,14 +6265,14 @@ var require_lodash = __commonJS({ return 0; } function compareMultiple(object, other, orders) { - var index2 = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; - while (++index2 < length) { - var result2 = compareAscending(objCriteria[index2], othCriteria[index2]); + var index3 = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; + while (++index3 < length) { + var result2 = compareAscending(objCriteria[index3], othCriteria[index3]); if (result2) { - if (index2 >= ordersLength) { + if (index3 >= ordersLength) { return result2; } - var order = orders[index2]; + var order = orders[index3]; return result2 * (order == "desc" ? -1 : 1); } } @@ -6310,19 +6310,19 @@ var require_lodash = __commonJS({ return result2; } function copyArray(source, array) { - var index2 = -1, length = source.length; + var index3 = -1, length = source.length; array || (array = Array2(length)); - while (++index2 < length) { - array[index2] = source[index2]; + while (++index3 < length) { + array[index3] = source[index3]; } return array; } function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); - var index2 = -1, length = props.length; - while (++index2 < length) { - var key2 = props[index2]; + var index3 = -1, length = props.length; + while (++index3 < length) { + var key2 = props[index3]; var newValue = customizer ? customizer(object[key2], source[key2], key2, object, source) : undefined2; if (newValue === undefined2) { newValue = source[key2]; @@ -6349,17 +6349,17 @@ var require_lodash = __commonJS({ } function createAssigner(assigner) { return baseRest(function(object, sources) { - var index2 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; + var index3 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined2 : customizer; length = 1; } object = Object2(object); - while (++index2 < length) { - var source = sources[index2]; + while (++index3 < length) { + var source = sources[index3]; if (source) { - assigner(object, source, index2, customizer); + assigner(object, source, index3, customizer); } } return object; @@ -6373,9 +6373,9 @@ var require_lodash = __commonJS({ if (!isArrayLike(collection)) { return eachFunc(collection, iteratee2); } - var length = collection.length, index2 = fromRight ? length : -1, iterable = Object2(collection); - while (fromRight ? index2-- : ++index2 < length) { - if (iteratee2(iterable[index2], index2, iterable) === false) { + var length = collection.length, index3 = fromRight ? length : -1, iterable = Object2(collection); + while (fromRight ? index3-- : ++index3 < length) { + if (iteratee2(iterable[index3], index3, iterable) === false) { break; } } @@ -6384,9 +6384,9 @@ var require_lodash = __commonJS({ } function createBaseFor(fromRight) { return function(object, iteratee2, keysFunc) { - var index2 = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; + var index3 = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; while (length--) { - var key2 = props[fromRight ? length : ++index2]; + var key2 = props[fromRight ? length : ++index3]; if (iteratee2(iterable[key2], key2, iterable) === false) { break; } @@ -6444,9 +6444,9 @@ var require_lodash = __commonJS({ function createCurry(func, bitmask, arity) { var Ctor = createCtor(func); function wrapper() { - var length = arguments.length, args = Array2(length), index2 = length, placeholder2 = getHolder(wrapper); - while (index2--) { - args[index2] = arguments[index2]; + var length = arguments.length, args = Array2(length), index3 = length, placeholder2 = getHolder(wrapper); + while (index3--) { + args[index3] = arguments[index3]; } var holders = length < 3 && args[0] !== placeholder2 && args[length - 1] !== placeholder2 ? [] : replaceHolders(args, placeholder2); length -= holders.length; @@ -6479,18 +6479,18 @@ var require_lodash = __commonJS({ return iteratee2(iterable[key2], key2, iterable); }; } - var index2 = findIndexFunc(collection, predicate, fromIndex); - return index2 > -1 ? iterable[iteratee2 ? collection[index2] : index2] : undefined2; + var index3 = findIndexFunc(collection, predicate, fromIndex); + return index3 > -1 ? iterable[iteratee2 ? collection[index3] : index3] : undefined2; }; } function createFlow(fromRight) { return flatRest(function(funcs) { - var length = funcs.length, index2 = length, prereq = LodashWrapper.prototype.thru; + var length = funcs.length, index3 = length, prereq = LodashWrapper.prototype.thru; if (fromRight) { funcs.reverse(); } - while (index2--) { - var func = funcs[index2]; + while (index3--) { + var func = funcs[index3]; if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } @@ -6498,9 +6498,9 @@ var require_lodash = __commonJS({ var wrapper = new LodashWrapper([], true); } } - index2 = wrapper ? index2 : length; - while (++index2 < length) { - func = funcs[index2]; + index3 = wrapper ? index3 : length; + while (++index3 < length) { + func = funcs[index3]; var funcName = getFuncName(func), data2 = funcName == "wrapper" ? getData(func) : undefined2; if (data2 && isLaziable(data2[0]) && data2[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data2[4].length && data2[9] == 1) { wrapper = wrapper[getFuncName(data2[0])].apply(wrapper, data2[3]); @@ -6513,9 +6513,9 @@ var require_lodash = __commonJS({ if (wrapper && args.length == 1 && isArray5(value)) { return wrapper.plant(value).value(); } - var index3 = 0, result2 = length ? funcs[index3].apply(this, args) : value; - while (++index3 < length) { - result2 = funcs[index3].call(this, result2); + var index4 = 0, result2 = length ? funcs[index4].apply(this, args) : value; + while (++index4 < length) { + result2 = funcs[index4].call(this, result2); } return result2; }; @@ -6524,9 +6524,9 @@ var require_lodash = __commonJS({ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) { var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func); function wrapper() { - var length = arguments.length, args = Array2(length), index2 = length; - while (index2--) { - args[index2] = arguments[index2]; + var length = arguments.length, args = Array2(length), index3 = length; + while (index3--) { + args[index3] = arguments[index3]; } if (isCurried) { var placeholder2 = getHolder(wrapper), holdersCount = countHolders(args, placeholder2); @@ -6794,13 +6794,13 @@ var require_lodash = __commonJS({ if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } - var index2 = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; + var index3 = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; stack.set(array, other); stack.set(other, array); - while (++index2 < arrLength) { - var arrValue = array[index2], othValue = other[index2]; + while (++index3 < arrLength) { + var arrValue = array[index3], othValue = other[index3]; if (customizer) { - var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack); + var compared = isPartial ? customizer(othValue, arrValue, index3, other, array, stack) : customizer(arrValue, othValue, index3, array, other, stack); } if (compared !== undefined2) { if (compared) { @@ -6878,9 +6878,9 @@ var require_lodash = __commonJS({ if (objLength != othLength && !isPartial) { return false; } - var index2 = objLength; - while (index2--) { - var key2 = objProps[index2]; + var index3 = objLength; + while (index3--) { + var key2 = objProps[index3]; if (!(isPartial ? key2 in other : hasOwnProperty3.call(other, key2))) { return false; } @@ -6894,8 +6894,8 @@ var require_lodash = __commonJS({ stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; - while (++index2 < objLength) { - key2 = objProps[index2]; + while (++index3 < objLength) { + key2 = objProps[index3]; var objValue = object[key2], othValue = other[key2]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key2, other, object, stack) : customizer(objValue, othValue, key2, object, other, stack); @@ -7019,9 +7019,9 @@ var require_lodash = __commonJS({ }; } function getView(start, end, transforms) { - var index2 = -1, length = transforms.length; - while (++index2 < length) { - var data2 = transforms[index2], size3 = data2.size; + var index3 = -1, length = transforms.length; + while (++index3 < length) { + var data2 = transforms[index3], size3 = data2.size; switch (data2.type) { case "drop": start += size3; @@ -7045,15 +7045,15 @@ var require_lodash = __commonJS({ } function hasPath(object, path2, hasFunc) { path2 = castPath(path2, object); - var index2 = -1, length = path2.length, result2 = false; - while (++index2 < length) { - var key2 = toKey(path2[index2]); + var index3 = -1, length = path2.length, result2 = false; + while (++index3 < length) { + var key2 = toKey(path2[index3]); if (!(result2 = object != null && hasFunc(object, key2))) { break; } object = object[key2]; } - if (result2 || ++index2 != length) { + if (result2 || ++index3 != length) { return result2; } length = object == null ? 0 : object.length; @@ -7121,13 +7121,13 @@ var require_lodash = __commonJS({ length = length == null ? MAX_SAFE_INTEGER2 : length; return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } - function isIterateeCall(value, index2, object) { + function isIterateeCall(value, index3, object) { if (!isObject4(object)) { return false; } - var type = typeof index2; - if (type == "number" ? isArrayLike(object) && isIndex2(index2, object.length) : type == "string" && index2 in object) { - return eq(object[index2], value); + var type = typeof index3; + if (type == "number" ? isArrayLike(object) && isIndex2(index3, object.length) : type == "string" && index3 in object) { + return eq(object[index3], value); } return false; } @@ -7236,14 +7236,14 @@ var require_lodash = __commonJS({ function overRest(func, start, transform2) { start = nativeMax(start === undefined2 ? func.length - 1 : start, 0); return function() { - var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array2(length); - while (++index2 < length) { - array[index2] = args[start + index2]; + var args = arguments, index3 = -1, length = nativeMax(args.length - start, 0), array = Array2(length); + while (++index3 < length) { + array[index3] = args[start + index3]; } - index2 = -1; + index3 = -1; var otherArgs = Array2(start + 1); - while (++index2 < start) { - otherArgs[index2] = args[index2]; + while (++index3 < start) { + otherArgs[index3] = args[index3]; } otherArgs[start] = transform2(array); return apply2(func, this, otherArgs); @@ -7255,8 +7255,8 @@ var require_lodash = __commonJS({ function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { - var index2 = indexes[length]; - array[length] = isIndex2(index2, arrLength) ? oldArray[index2] : undefined2; + var index3 = indexes[length]; + array[length] = isIndex2(index3, arrLength) ? oldArray[index3] : undefined2; } return array; } @@ -7294,12 +7294,12 @@ var require_lodash = __commonJS({ }; } function shuffleSelf(array, size3) { - var index2 = -1, length = array.length, lastIndex = length - 1; + var index3 = -1, length = array.length, lastIndex = length - 1; size3 = size3 === undefined2 ? length : size3; - while (++index2 < size3) { - var rand = baseRandom(index2, lastIndex), value = array[rand]; - array[rand] = array[index2]; - array[index2] = value; + while (++index3 < size3) { + var rand = baseRandom(index3, lastIndex), value = array[rand]; + array[rand] = array[index3]; + array[index3] = value; } array.length = size3; return array; @@ -7363,16 +7363,16 @@ var require_lodash = __commonJS({ if (!length || size3 < 1) { return []; } - var index2 = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size3)); - while (index2 < length) { - result2[resIndex++] = baseSlice(array, index2, index2 += size3); + var index3 = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size3)); + while (index3 < length) { + result2[resIndex++] = baseSlice(array, index3, index3 += size3); } return result2; } function compact(array) { - var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; - while (++index2 < length) { - var value = array[index2]; + var index3 = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; + while (++index3 < length) { + var value = array[index3]; if (value) { result2[resIndex++] = value; } @@ -7384,9 +7384,9 @@ var require_lodash = __commonJS({ if (!length) { return []; } - var args = Array2(length - 1), array = arguments[0], index2 = length; - while (index2--) { - args[index2 - 1] = arguments[index2]; + var args = Array2(length - 1), array = arguments[0], index3 = length; + while (index3--) { + args[index3 - 1] = arguments[index3]; } return arrayPush(isArray5(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } @@ -7446,23 +7446,23 @@ var require_lodash = __commonJS({ if (!length) { return -1; } - var index2 = fromIndex == null ? 0 : toInteger2(fromIndex); - if (index2 < 0) { - index2 = nativeMax(length + index2, 0); + var index3 = fromIndex == null ? 0 : toInteger2(fromIndex); + if (index3 < 0) { + index3 = nativeMax(length + index3, 0); } - return baseFindIndex(array, getIteratee(predicate, 3), index2); + return baseFindIndex(array, getIteratee(predicate, 3), index3); } function findLastIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } - var index2 = length - 1; + var index3 = length - 1; if (fromIndex !== undefined2) { - index2 = toInteger2(fromIndex); - index2 = fromIndex < 0 ? nativeMax(length + index2, 0) : nativeMin(index2, length - 1); + index3 = toInteger2(fromIndex); + index3 = fromIndex < 0 ? nativeMax(length + index3, 0) : nativeMin(index3, length - 1); } - return baseFindIndex(array, getIteratee(predicate, 3), index2, true); + return baseFindIndex(array, getIteratee(predicate, 3), index3, true); } function flatten4(array) { var length = array == null ? 0 : array.length; @@ -7481,9 +7481,9 @@ var require_lodash = __commonJS({ return baseFlatten(array, depth); } function fromPairs(pairs) { - var index2 = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; - while (++index2 < length) { - var pair2 = pairs[index2]; + var index3 = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; + while (++index3 < length) { + var pair2 = pairs[index3]; result2[pair2[0]] = pair2[1]; } return result2; @@ -7496,11 +7496,11 @@ var require_lodash = __commonJS({ if (!length) { return -1; } - var index2 = fromIndex == null ? 0 : toInteger2(fromIndex); - if (index2 < 0) { - index2 = nativeMax(length + index2, 0); + var index3 = fromIndex == null ? 0 : toInteger2(fromIndex); + if (index3 < 0) { + index3 = nativeMax(length + index3, 0); } - return baseIndexOf(array, value, index2); + return baseIndexOf(array, value, index3); } function initial(array) { var length = array == null ? 0 : array.length; @@ -7539,12 +7539,12 @@ var require_lodash = __commonJS({ if (!length) { return -1; } - var index2 = length; + var index3 = length; if (fromIndex !== undefined2) { - index2 = toInteger2(fromIndex); - index2 = index2 < 0 ? nativeMax(length + index2, 0) : nativeMin(index2, length - 1); + index3 = toInteger2(fromIndex); + index3 = index3 < 0 ? nativeMax(length + index3, 0) : nativeMin(index3, length - 1); } - return value === value ? strictLastIndexOf(array, value, index2) : baseFindIndex(array, baseIsNaN, index2, true); + return value === value ? strictLastIndexOf(array, value, index3) : baseFindIndex(array, baseIsNaN, index3, true); } function nth(array, n3) { return array && array.length ? baseNth(array, toInteger2(n3)) : undefined2; @@ -7561,8 +7561,8 @@ var require_lodash = __commonJS({ } var pullAt = flatRest(function(array, indexes) { var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); - basePullAt(array, arrayMap(indexes, function(index2) { - return isIndex2(index2, length) ? +index2 : index2; + basePullAt(array, arrayMap(indexes, function(index3) { + return isIndex2(index3, length) ? +index3 : index3; }).sort(compareAscending)); return result2; }); @@ -7571,13 +7571,13 @@ var require_lodash = __commonJS({ if (!(array && array.length)) { return result2; } - var index2 = -1, indexes = [], length = array.length; + var index3 = -1, indexes = [], length = array.length; predicate = getIteratee(predicate, 3); - while (++index2 < length) { - var value = array[index2]; - if (predicate(value, index2, array)) { + while (++index3 < length) { + var value = array[index3]; + if (predicate(value, index3, array)) { result2.push(value); - indexes.push(index2); + indexes.push(index3); } } basePullAt(array, indexes); @@ -7609,9 +7609,9 @@ var require_lodash = __commonJS({ function sortedIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { - var index2 = baseSortedIndex(array, value); - if (index2 < length && eq(array[index2], value)) { - return index2; + var index3 = baseSortedIndex(array, value); + if (index3 < length && eq(array[index3], value)) { + return index3; } } return -1; @@ -7625,9 +7625,9 @@ var require_lodash = __commonJS({ function sortedLastIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { - var index2 = baseSortedIndex(array, value, true) - 1; - if (eq(array[index2], value)) { - return index2; + var index3 = baseSortedIndex(array, value, true) - 1; + if (eq(array[index3], value)) { + return index3; } } return -1; @@ -7700,8 +7700,8 @@ var require_lodash = __commonJS({ return true; } }); - return baseTimes(length, function(index2) { - return arrayMap(array, baseProperty(index2)); + return baseTimes(length, function(index3) { + return arrayMap(array, baseProperty(index3)); }); } function unzipWith(array, iteratee2) { @@ -7886,9 +7886,9 @@ var require_lodash = __commonJS({ return isString5(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; } var invokeMap = baseRest(function(collection, path2, args) { - var index2 = -1, isFunc = typeof path2 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; + var index3 = -1, isFunc = typeof path2 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; baseEach(collection, function(value) { - result2[++index2] = isFunc ? apply2(path2, value, args) : baseInvoke(value, path2, args); + result2[++index3] = isFunc ? apply2(path2, value, args) : baseInvoke(value, path2, args); }); return result2; }); @@ -8174,9 +8174,9 @@ var require_lodash = __commonJS({ transforms = transforms.length == 1 && isArray5(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); var funcsLength = transforms.length; return baseRest(function(args) { - var index2 = -1, length = nativeMin(args.length, funcsLength); - while (++index2 < length) { - args[index2] = transforms[index2].call(this, args[index2]); + var index3 = -1, length = nativeMin(args.length, funcsLength); + while (++index3 < length) { + args[index3] = transforms[index3].call(this, args[index3]); } return apply2(func, this, args); }); @@ -8491,14 +8491,14 @@ var require_lodash = __commonJS({ } var defaults2 = baseRest(function(object, sources) { object = Object2(object); - var index2 = -1; + var index3 = -1; var length = sources.length; var guard = length > 2 ? sources[2] : undefined2; if (guard && isIterateeCall(sources[0], sources[1], guard)) { length = 1; } - while (++index2 < length) { - var source = sources[index2]; + while (++index3 < length) { + var source = sources[index3]; var props = keysIn(source); var propsIndex = -1; var propsLength = props.length; @@ -8636,15 +8636,15 @@ var require_lodash = __commonJS({ } function result(object, path2, defaultValue2) { path2 = castPath(path2, object); - var index2 = -1, length = path2.length; + var index3 = -1, length = path2.length; if (!length) { length = 1; object = undefined2; } - while (++index2 < length) { - var value = object == null ? undefined2 : object[toKey(path2[index2])]; + while (++index3 < length) { + var value = object == null ? undefined2 : object[toKey(path2[index3])]; if (value === undefined2) { - index2 = length; + index3 = length; value = defaultValue2; } object = isFunction3(value) ? value.call(object) : value; @@ -8673,8 +8673,8 @@ var require_lodash = __commonJS({ accumulator = {}; } } - (isArrLike ? arrayEach : baseForOwn)(object, function(value, index2, object2) { - return iteratee2(accumulator, value, index2, object2); + (isArrLike ? arrayEach : baseForOwn)(object, function(value, index3, object2) { + return iteratee2(accumulator, value, index3, object2); }); return accumulator; } @@ -8756,9 +8756,9 @@ var require_lodash = __commonJS({ } return baseRandom(lower, upper); } - var camelCase = createCompounder(function(result2, word, index2) { + var camelCase = createCompounder(function(result2, word, index3) { word = word.toLowerCase(); - return result2 + (index2 ? capitalize(word) : word); + return result2 + (index3 ? capitalize(word) : word); }); function capitalize(string6) { return upperFirst(toString4(string6).toLowerCase()); @@ -8784,11 +8784,11 @@ var require_lodash = __commonJS({ string6 = toString4(string6); return string6 && reHasRegExpChar.test(string6) ? string6.replace(reRegExpChar, "\\$&") : string6; } - var kebabCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? "-" : "") + word.toLowerCase(); + var kebabCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? "-" : "") + word.toLowerCase(); }); - var lowerCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? " " : "") + word.toLowerCase(); + var lowerCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? " " : "") + word.toLowerCase(); }); var lowerFirst = createCaseFirst("toLowerCase"); function pad(string6, length, chars) { @@ -8833,8 +8833,8 @@ var require_lodash = __commonJS({ var args = arguments, string6 = toString4(args[0]); return args.length < 3 ? string6 : string6.replace(args[1], args[2]); } - var snakeCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? "_" : "") + word.toLowerCase(); + var snakeCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? "_" : "") + word.toLowerCase(); }); function split(string6, separator, limit) { if (limit && typeof limit != "number" && isIterateeCall(string6, separator, limit)) { @@ -8853,8 +8853,8 @@ var require_lodash = __commonJS({ } return string6.split(separator, limit); } - var startCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? " " : "") + upperFirst(word); + var startCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? " " : "") + upperFirst(word); }); function startsWith(string6, target, position) { string6 = toString4(string6); @@ -8870,7 +8870,7 @@ var require_lodash = __commonJS({ string6 = toString4(string6); options = assignInWith({}, options, settings, customDefaultsAssignIn); var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); - var isEscaping, isEvaluating, index2 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; + var isEscaping, isEvaluating, index3 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; var reDelimiters = RegExp2( (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g" @@ -8878,7 +8878,7 @@ var require_lodash = __commonJS({ var sourceURL = "//# sourceURL=" + (hasOwnProperty3.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; string6.replace(reDelimiters, function(match2, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) { interpolateValue || (interpolateValue = esTemplateValue); - source += string6.slice(index2, offset2).replace(reUnescapedString, escapeStringChar); + source += string6.slice(index3, offset2).replace(reUnescapedString, escapeStringChar); if (escapeValue) { isEscaping = true; source += "' +\n__e(" + escapeValue + ") +\n'"; @@ -8890,7 +8890,7 @@ var require_lodash = __commonJS({ if (interpolateValue) { source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } - index2 = offset2 + match2.length; + index3 = offset2 + match2.length; return match2; }); source += "';\n"; @@ -8990,9 +8990,9 @@ var require_lodash = __commonJS({ result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd); } } else if (string6.indexOf(baseToString2(separator), end) != end) { - var index2 = result2.lastIndexOf(separator); - if (index2 > -1) { - result2 = result2.slice(0, index2); + var index3 = result2.lastIndexOf(separator); + if (index3 > -1) { + result2 = result2.slice(0, index3); } } return result2 + omission; @@ -9001,8 +9001,8 @@ var require_lodash = __commonJS({ string6 = toString4(string6); return string6 && reHasEscapedHtml.test(string6) ? string6.replace(reEscapedHtml, unescapeHtmlChar) : string6; } - var upperCase = createCompounder(function(result2, word, index2) { - return result2 + (index2 ? " " : "") + word.toUpperCase(); + var upperCase = createCompounder(function(result2, word, index3) { + return result2 + (index3 ? " " : "") + word.toUpperCase(); }); var upperFirst = createCaseFirst("toUpperCase"); function words2(string6, pattern, guard) { @@ -9036,9 +9036,9 @@ var require_lodash = __commonJS({ return [toIteratee(pair2[0]), pair2[1]]; }); return baseRest(function(args) { - var index2 = -1; - while (++index2 < length) { - var pair2 = pairs[index2]; + var index3 = -1; + while (++index3 < length) { + var pair2 = pairs[index3]; if (apply2(pair2[0], this, args)) { return apply2(pair2[1], this, args); } @@ -9154,12 +9154,12 @@ var require_lodash = __commonJS({ if (n3 < 1 || n3 > MAX_SAFE_INTEGER2) { return []; } - var index2 = MAX_ARRAY_LENGTH, length = nativeMin(n3, MAX_ARRAY_LENGTH); + var index3 = MAX_ARRAY_LENGTH, length = nativeMin(n3, MAX_ARRAY_LENGTH); iteratee2 = getIteratee(iteratee2); n3 -= MAX_ARRAY_LENGTH; var result2 = baseTimes(length, iteratee2); - while (++index2 < n3) { - iteratee2(index2); + while (++index3 < n3) { + iteratee2(index3); } return result2; } @@ -9531,10 +9531,10 @@ var require_lodash = __commonJS({ arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { lodash[methodName].placeholder = lodash; }); - arrayEach(["drop", "take"], function(methodName, index2) { + arrayEach(["drop", "take"], function(methodName, index3) { LazyWrapper.prototype[methodName] = function(n3) { n3 = n3 === undefined2 ? 1 : nativeMax(toInteger2(n3), 0); - var result2 = this.__filtered__ && !index2 ? new LazyWrapper(this) : this.clone(); + var result2 = this.__filtered__ && !index3 ? new LazyWrapper(this) : this.clone(); if (result2.__filtered__) { result2.__takeCount__ = nativeMin(n3, result2.__takeCount__); } else { @@ -9549,8 +9549,8 @@ var require_lodash = __commonJS({ return this.reverse()[methodName](n3).reverse(); }; }); - arrayEach(["filter", "map", "takeWhile"], function(methodName, index2) { - var type = index2 + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; + arrayEach(["filter", "map", "takeWhile"], function(methodName, index3) { + var type = index3 + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee2) { var result2 = this.clone(); result2.__iteratees__.push({ @@ -9561,14 +9561,14 @@ var require_lodash = __commonJS({ return result2; }; }); - arrayEach(["head", "last"], function(methodName, index2) { - var takeName = "take" + (index2 ? "Right" : ""); + arrayEach(["head", "last"], function(methodName, index3) { + var takeName = "take" + (index3 ? "Right" : ""); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); - arrayEach(["initial", "tail"], function(methodName, index2) { - var dropName = "drop" + (index2 ? "" : "Right"); + arrayEach(["initial", "tail"], function(methodName, index3) { + var dropName = "drop" + (index3 ? "" : "Right"); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; @@ -9687,17 +9687,17 @@ var require_lodash = __commonJS({ } return lodash; }; - var _15 = runInContext(); + var _16 = runInContext(); if (typeof define == "function" && typeof define.amd == "object" && define.amd) { - root._ = _15; + root._ = _16; define(function() { - return _15; + return _16; }); } else if (freeModule) { - (freeModule.exports = _15)._ = _15; - freeExports._ = _15; + (freeModule.exports = _16)._ = _16; + freeExports._ = _16; } else { - root._ = _15; + root._ = _16; } }).call(exports); } @@ -17543,11 +17543,11 @@ var require_typed_function = __commonJS({ } } } - function getParamAtIndex(params, index2) { - return index2 < params.length ? params[index2] : hasRestParam(params) ? last(params) : null; + function getParamAtIndex(params, index3) { + return index3 < params.length ? params[index3] : hasRestParam(params) ? last(params) : null; } - function getTypeSetAtIndex(params, index2) { - const param = getParamAtIndex(params, index2); + function getTypeSetAtIndex(params, index3) { + const param = getParamAtIndex(params, index3); if (!param) { return /* @__PURE__ */ new Set(); } @@ -17556,10 +17556,10 @@ var require_typed_function = __commonJS({ function isExactType(type) { return type.conversion === null || type.conversion === void 0; } - function mergeExpectedParams(signatures, index2) { + function mergeExpectedParams(signatures, index3) { const typeSet = /* @__PURE__ */ new Set(); signatures.forEach((signature) => { - const paramSet = getTypeSetAtIndex(signature.params, index2); + const paramSet = getTypeSetAtIndex(signature.params, index3); let name319; for (name319 of paramSet) { typeSet.add(name319); @@ -17571,25 +17571,25 @@ var require_typed_function = __commonJS({ let err, expected; const _name = name319 || "unnamed"; let matchingSignatures = signatures; - let index2; - for (index2 = 0; index2 < args.length; index2++) { + let index3; + for (index3 = 0; index3 < args.length; index3++) { const nextMatchingDefs = []; matchingSignatures.forEach((signature) => { - const param = getParamAtIndex(signature.params, index2); + const param = getParamAtIndex(signature.params, index3); const test = compileTest(param); - if ((index2 < signature.params.length || hasRestParam(signature.params)) && test(args[index2])) { + if ((index3 < signature.params.length || hasRestParam(signature.params)) && test(args[index3])) { nextMatchingDefs.push(signature); } }); if (nextMatchingDefs.length === 0) { - expected = mergeExpectedParams(matchingSignatures, index2); + expected = mergeExpectedParams(matchingSignatures, index3); if (expected.length > 0) { - const actualTypes = findTypeNames(args[index2]); - err = new TypeError("Unexpected type of argument in function " + _name + " (expected: " + expected.join(" or ") + ", actual: " + actualTypes.join(" | ") + ", index: " + index2 + ")"); + const actualTypes = findTypeNames(args[index3]); + err = new TypeError("Unexpected type of argument in function " + _name + " (expected: " + expected.join(" or ") + ", actual: " + actualTypes.join(" | ") + ", index: " + index3 + ")"); err.data = { category: "wrongType", fn: _name, - index: index2, + index: index3, actual: actualTypes, expected }; @@ -17603,7 +17603,7 @@ var require_typed_function = __commonJS({ return hasRestParam(signature.params) ? Infinity : signature.params.length; }); if (args.length < Math.min.apply(null, lengths)) { - expected = mergeExpectedParams(matchingSignatures, index2); + expected = mergeExpectedParams(matchingSignatures, index3); err = new TypeError("Too few arguments in function " + _name + " (expected: " + expected.join(" or ") + ", index: " + args.length + ")"); err.data = { category: "tooFewArgs", @@ -17865,9 +17865,9 @@ var require_typed_function = __commonJS({ } } function splitParams(params) { - function _splitParams(params2, index2, paramsSoFar) { - if (index2 < params2.length) { - const param = params2[index2]; + function _splitParams(params2, index3, paramsSoFar) { + if (index3 < params2.length) { + const param = params2[index3]; let resultingParams = []; if (param.restParam) { const exactTypes = param.types.filter(isExactType); @@ -17893,7 +17893,7 @@ var require_typed_function = __commonJS({ }); } return flatMap(resultingParams, function(nextParam) { - return _splitParams(params2, index2 + 1, paramsSoFar.concat([nextParam])); + return _splitParams(params2, index3 + 1, paramsSoFar.concat([nextParam])); }); } else { return [paramsSoFar]; @@ -18330,8 +18330,8 @@ var require_typed_function = __commonJS({ if (existingConversion.convert !== conversion.convert) { throw new Error("Conversion to remove does not match existing conversion"); } - const index2 = to2.conversionsTo.indexOf(existingConversion); - to2.conversionsTo.splice(index2, 1); + const index3 = to2.conversionsTo.indexOf(existingConversion); + to2.conversionsTo.splice(index3, 1); }; typed3.resolve = function(tf, argList) { if (!isTypedFunction(tf)) { @@ -19708,12 +19708,12 @@ var require_dist = __commonJS({ var escapeKeys = Object.keys(escapes); var _loop = function _loop2() { var specialCharFound = false; - escapeKeys.forEach(function(key2, index2) { + escapeKeys.forEach(function(key2, index3) { if (specialCharFound) { return; } if (runningStr.length >= key2.length && runningStr.slice(0, key2.length) === key2) { - result += escapes[escapeKeys[index2]]; + result += escapes[escapeKeys[index3]]; runningStr = runningStr.slice(key2.length, runningStr.length); specialCharFound = true; } @@ -20519,7 +20519,7 @@ var require_classnames = __commonJS({ (function() { "use strict"; var hasOwn3 = {}.hasOwnProperty; - function classNames16() { + function classNames17() { var classes2 = ""; for (var i4 = 0; i4 < arguments.length; i4++) { var arg2 = arguments[i4]; @@ -20537,7 +20537,7 @@ var require_classnames = __commonJS({ return ""; } if (Array.isArray(arg2)) { - return classNames16.apply(null, arg2); + return classNames17.apply(null, arg2); } if (arg2.toString !== Object.prototype.toString && !arg2.toString.toString().includes("[native code]")) { return arg2.toString(); @@ -20560,14 +20560,14 @@ var require_classnames = __commonJS({ return value + newClass; } if (typeof module2 !== "undefined" && module2.exports) { - classNames16.default = classNames16; - module2.exports = classNames16; + classNames17.default = classNames17; + module2.exports = classNames17; } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) { define("classnames", [], function() { - return classNames16; + return classNames17; }); } else { - window.classNames = classNames16; + window.classNames = classNames17; } })(); } @@ -20779,7 +20779,7 @@ var require_react_error_boundary_cjs = __commonJS({ function hasArrayChanged() { let a4 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; let b2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; - return a4.length !== b2.length || a4.some((item, index2) => !Object.is(item, b2[index2])); + return a4.length !== b2.length || a4.some((item, index3) => !Object.is(item, b2[index3])); } function assertErrorBoundaryContext(value) { if (value == null || typeof value.didCatch !== "boolean" || typeof value.resetErrorBoundary !== "function") { @@ -21112,17 +21112,17 @@ var require_jszip_min = __commonJS({ return n4; } function n3(e6, t8, r3, n4, i5, s5) { - var a4, o2, h3 = e6.file, u3 = e6.compression, l2 = s5 !== O2.utf8encode, f2 = I2.transformTo("string", s5(h3.name)), c3 = I2.transformTo("string", O2.utf8encode(h3.name)), d4 = h3.comment, p = I2.transformTo("string", s5(d4)), m4 = I2.transformTo("string", O2.utf8encode(d4)), _15 = c3.length !== h3.name.length, g = m4.length !== d4.length, b2 = "", v2 = "", y3 = "", w2 = h3.dir, k2 = h3.date, x2 = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; + var a4, o2, h3 = e6.file, u3 = e6.compression, l2 = s5 !== O2.utf8encode, f2 = I2.transformTo("string", s5(h3.name)), c3 = I2.transformTo("string", O2.utf8encode(h3.name)), d4 = h3.comment, p = I2.transformTo("string", s5(d4)), m4 = I2.transformTo("string", O2.utf8encode(d4)), _16 = c3.length !== h3.name.length, g = m4.length !== d4.length, b2 = "", v2 = "", y3 = "", w2 = h3.dir, k2 = h3.date, x2 = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; t8 && !r3 || (x2.crc32 = e6.crc32, x2.compressedSize = e6.compressedSize, x2.uncompressedSize = e6.uncompressedSize); var S3 = 0; - t8 && (S3 |= 8), l2 || !_15 && !g || (S3 |= 2048); + t8 && (S3 |= 8), l2 || !_16 && !g || (S3 |= 2048); var z2 = 0, C2 = 0; w2 && (z2 |= 16), "UNIX" === i5 ? (C2 = 798, z2 |= function(e7, t9) { var r4 = e7; return e7 || (r4 = t9 ? 16893 : 33204), (65535 & r4) << 16; }(h3.unixPermissions, w2)) : (C2 = 20, z2 |= function(e7) { return 63 & (e7 || 0); - }(h3.dosPermissions)), a4 = k2.getUTCHours(), a4 <<= 6, a4 |= k2.getUTCMinutes(), a4 <<= 5, a4 |= k2.getUTCSeconds() / 2, o2 = k2.getUTCFullYear() - 1980, o2 <<= 4, o2 |= k2.getUTCMonth() + 1, o2 <<= 5, o2 |= k2.getUTCDate(), _15 && (v2 = A(1, 1) + A(B2(f2), 4) + c3, b2 += "up" + A(v2.length, 2) + v2), g && (y3 = A(1, 1) + A(B2(p), 4) + m4, b2 += "uc" + A(y3.length, 2) + y3); + }(h3.dosPermissions)), a4 = k2.getUTCHours(), a4 <<= 6, a4 |= k2.getUTCMinutes(), a4 <<= 5, a4 |= k2.getUTCSeconds() / 2, o2 = k2.getUTCFullYear() - 1980, o2 <<= 4, o2 |= k2.getUTCMonth() + 1, o2 <<= 5, o2 |= k2.getUTCDate(), _16 && (v2 = A(1, 1) + A(B2(f2), 4) + c3, b2 += "up" + A(v2.length, 2) + v2), g && (y3 = A(1, 1) + A(B2(p), 4) + m4, b2 += "uc" + A(y3.length, 2) + y3); var E2 = ""; return E2 += "\n\0", E2 += A(S3, 2), E2 += u3.magic, E2 += A(a4, 2), E2 += A(o2, 2), E2 += A(x2.crc32, 4), E2 += A(x2.compressedSize, 4), E2 += A(x2.uncompressedSize, 4), E2 += A(f2.length, 2), E2 += A(b2.length, 2), { fileRecord: R2.LOCAL_FILE_HEADER + E2 + f2 + b2, dirRecord: R2.CENTRAL_FILE_HEADER + A(C2, 2) + E2 + A(p.length, 2) + "\0\0\0\0" + A(z2, 4) + A(n4, 4) + f2 + b2 + p }; } @@ -21318,7 +21318,7 @@ var require_jszip_min = __commonJS({ "use strict"; function s4(e6, t8, r3) { var n4, i5 = u3.getTypeOf(t8), s5 = u3.extend(r3 || {}, f2); - s5.date = s5.date || new Date(), null !== s5.compression && (s5.compression = s5.compression.toUpperCase()), "string" == typeof s5.unixPermissions && (s5.unixPermissions = parseInt(s5.unixPermissions, 8)), s5.unixPermissions && 16384 & s5.unixPermissions && (s5.dir = true), s5.dosPermissions && 16 & s5.dosPermissions && (s5.dir = true), s5.dir && (e6 = g(e6)), s5.createFolders && (n4 = _15(e6)) && b2.call(this, n4, true); + s5.date = s5.date || new Date(), null !== s5.compression && (s5.compression = s5.compression.toUpperCase()), "string" == typeof s5.unixPermissions && (s5.unixPermissions = parseInt(s5.unixPermissions, 8)), s5.unixPermissions && 16384 & s5.unixPermissions && (s5.dir = true), s5.dosPermissions && 16 & s5.dosPermissions && (s5.dir = true), s5.dir && (e6 = g(e6)), s5.createFolders && (n4 = _16(e6)) && b2.call(this, n4, true); var a5 = "string" === i5 && false === s5.binary && false === s5.base64; r3 && void 0 !== r3.binary || (s5.binary = !a5), (t8 instanceof c3 && 0 === t8.uncompressedSize || s5.dir || !t8 || 0 === t8.length) && (s5.base64 = false, s5.binary = true, t8 = "", s5.compression = "STORE", i5 = "string"); var o3 = null; @@ -21326,7 +21326,7 @@ var require_jszip_min = __commonJS({ var h4 = new d4(e6, o3, s5); this.files[e6] = h4; } - var i4 = e5("./utf8"), u3 = e5("./utils"), l2 = e5("./stream/GenericWorker"), a4 = e5("./stream/StreamHelper"), f2 = e5("./defaults"), c3 = e5("./compressedObject"), d4 = e5("./zipObject"), o2 = e5("./generate"), p = e5("./nodejsUtils"), m4 = e5("./nodejs/NodejsStreamInputAdapter"), _15 = function(e6) { + var i4 = e5("./utf8"), u3 = e5("./utils"), l2 = e5("./stream/GenericWorker"), a4 = e5("./stream/StreamHelper"), f2 = e5("./defaults"), c3 = e5("./compressedObject"), d4 = e5("./zipObject"), o2 = e5("./generate"), p = e5("./nodejsUtils"), m4 = e5("./nodejs/NodejsStreamInputAdapter"), _16 = function(e6) { "/" === e6.slice(-1) && (e6 = e6.substring(0, e6.length - 1)); var t8 = e6.lastIndexOf("/"); return 0 < t8 ? e6.substring(0, t8) : ""; @@ -22367,7 +22367,7 @@ var require_jszip_min = __commonJS({ }; }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e5, t7, r2) { "use strict"; - var c3 = e5("./zlib/inflate"), d4 = e5("./utils/common"), p = e5("./utils/strings"), m4 = e5("./zlib/constants"), n3 = e5("./zlib/messages"), i4 = e5("./zlib/zstream"), s4 = e5("./zlib/gzheader"), _15 = Object.prototype.toString; + var c3 = e5("./zlib/inflate"), d4 = e5("./utils/common"), p = e5("./utils/strings"), m4 = e5("./zlib/constants"), n3 = e5("./zlib/messages"), i4 = e5("./zlib/zstream"), s4 = e5("./zlib/gzheader"), _16 = Object.prototype.toString; function a4(e6) { if (!(this instanceof a4)) return new a4(e6); @@ -22389,9 +22389,9 @@ var require_jszip_min = __commonJS({ var r3, n4, i5, s5, a5, o3, h3 = this.strm, u3 = this.options.chunkSize, l2 = this.options.dictionary, f2 = false; if (this.ended) return false; - n4 = t8 === ~~t8 ? t8 : true === t8 ? m4.Z_FINISH : m4.Z_NO_FLUSH, "string" == typeof e6 ? h3.input = p.binstring2buf(e6) : "[object ArrayBuffer]" === _15.call(e6) ? h3.input = new Uint8Array(e6) : h3.input = e6, h3.next_in = 0, h3.avail_in = h3.input.length; + n4 = t8 === ~~t8 ? t8 : true === t8 ? m4.Z_FINISH : m4.Z_NO_FLUSH, "string" == typeof e6 ? h3.input = p.binstring2buf(e6) : "[object ArrayBuffer]" === _16.call(e6) ? h3.input = new Uint8Array(e6) : h3.input = e6, h3.next_in = 0, h3.avail_in = h3.input.length; do { - if (0 === h3.avail_out && (h3.output = new d4.Buf8(u3), h3.next_out = 0, h3.avail_out = u3), (r3 = c3.inflate(h3, m4.Z_NO_FLUSH)) === m4.Z_NEED_DICT && l2 && (o3 = "string" == typeof l2 ? p.string2buf(l2) : "[object ArrayBuffer]" === _15.call(l2) ? new Uint8Array(l2) : l2, r3 = c3.inflateSetDictionary(this.strm, o3)), r3 === m4.Z_BUF_ERROR && true === f2 && (r3 = m4.Z_OK, f2 = false), r3 !== m4.Z_STREAM_END && r3 !== m4.Z_OK) + if (0 === h3.avail_out && (h3.output = new d4.Buf8(u3), h3.next_out = 0, h3.avail_out = u3), (r3 = c3.inflate(h3, m4.Z_NO_FLUSH)) === m4.Z_NEED_DICT && l2 && (o3 = "string" == typeof l2 ? p.string2buf(l2) : "[object ArrayBuffer]" === _16.call(l2) ? new Uint8Array(l2) : l2, r3 = c3.inflateSetDictionary(this.strm, o3)), r3 === m4.Z_BUF_ERROR && true === f2 && (r3 = m4.Z_OK, f2 = false), r3 !== m4.Z_STREAM_END && r3 !== m4.Z_OK) return this.onEnd(r3), !(this.ended = true); h3.next_out && (0 !== h3.avail_out && r3 !== m4.Z_STREAM_END && (0 !== h3.avail_in || n4 !== m4.Z_FINISH && n4 !== m4.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i5 = p.utf8border(h3.output, h3.next_out), s5 = h3.next_out - i5, a5 = p.buf2string(h3.output, i5), h3.next_out = s5, h3.avail_out = u3 - s5, s5 && d4.arraySet(h3.output, h3.output, i5, s5, 0), this.onData(a5)) : this.onData(d4.shrinkBuf(h3.output, h3.next_out)))), 0 === h3.avail_in && 0 === h3.avail_out && (f2 = true); } while ((0 < h3.avail_in || 0 === h3.avail_out) && r3 !== m4.Z_STREAM_END); @@ -22529,7 +22529,7 @@ var require_jszip_min = __commonJS({ }; }, {}], 46: [function(e5, t7, r2) { "use strict"; - var h3, c3 = e5("../utils/common"), u3 = e5("./trees"), d4 = e5("./adler32"), p = e5("./crc32"), n3 = e5("./messages"), l2 = 0, f2 = 4, m4 = 0, _15 = -2, g = -1, b2 = 4, i4 = 2, v2 = 8, y3 = 9, s4 = 286, a4 = 30, o2 = 19, w2 = 2 * s4 + 1, k2 = 15, x2 = 3, S3 = 258, z2 = S3 + x2 + 1, C2 = 42, E2 = 113, A = 1, I2 = 2, O2 = 3, B2 = 4; + var h3, c3 = e5("../utils/common"), u3 = e5("./trees"), d4 = e5("./adler32"), p = e5("./crc32"), n3 = e5("./messages"), l2 = 0, f2 = 4, m4 = 0, _16 = -2, g = -1, b2 = 4, i4 = 2, v2 = 8, y3 = 9, s4 = 286, a4 = 30, o2 = 19, w2 = 2 * s4 + 1, k2 = 15, x2 = 3, S3 = 258, z2 = S3 + x2 + 1, C2 = 42, E2 = 113, A = 1, I2 = 2, O2 = 3, B2 = 4; function R2(e6, t8) { return e6.msg = n3[t8], t8; } @@ -22638,7 +22638,7 @@ var require_jszip_min = __commonJS({ } function G2(e6) { var t8; - return e6 && e6.state ? (e6.total_in = e6.total_out = 0, e6.data_type = i4, (t8 = e6.state).pending = 0, t8.pending_out = 0, t8.wrap < 0 && (t8.wrap = -t8.wrap), t8.status = t8.wrap ? C2 : E2, e6.adler = 2 === t8.wrap ? 0 : 1, t8.last_flush = l2, u3._tr_init(t8), m4) : R2(e6, _15); + return e6 && e6.state ? (e6.total_in = e6.total_out = 0, e6.data_type = i4, (t8 = e6.state).pending = 0, t8.pending_out = 0, t8.wrap < 0 && (t8.wrap = -t8.wrap), t8.status = t8.wrap ? C2 : E2, e6.adler = 2 === t8.wrap ? 0 : 1, t8.last_flush = l2, u3._tr_init(t8), m4) : R2(e6, _16); } function K2(e6) { var t8 = G2(e6); @@ -22648,10 +22648,10 @@ var require_jszip_min = __commonJS({ } function Y2(e6, t8, r3, n4, i5, s5) { if (!e6) - return _15; + return _16; var a5 = 1; if (t8 === g && (t8 = 6), n4 < 0 ? (a5 = 0, n4 = -n4) : 15 < n4 && (a5 = 2, n4 -= 16), i5 < 1 || y3 < i5 || r3 !== v2 || n4 < 8 || 15 < n4 || t8 < 0 || 9 < t8 || s5 < 0 || b2 < s5) - return R2(e6, _15); + return R2(e6, _16); 8 === n4 && (n4 = 9); var o3 = new H3(); return (e6.state = o3).strm = e6, o3.wrap = a5, o3.gzhead = null, o3.w_bits = n4, o3.w_size = 1 << o3.w_bits, o3.w_mask = o3.w_size - 1, o3.hash_bits = i5 + 7, o3.hash_size = 1 << o3.hash_bits, o3.hash_mask = o3.hash_size - 1, o3.hash_shift = ~~((o3.hash_bits + x2 - 1) / x2), o3.window = new c3.Buf8(2 * o3.w_size), o3.head = new c3.Buf16(o3.hash_size), o3.prev = new c3.Buf16(o3.w_size), o3.lit_bufsize = 1 << i5 + 6, o3.pending_buf_size = 4 * o3.lit_bufsize, o3.pending_buf = new c3.Buf8(o3.pending_buf_size), o3.d_buf = 1 * o3.lit_bufsize, o3.l_buf = 3 * o3.lit_bufsize, o3.level = t8, o3.strategy = s5, o3.method = r3, K2(e6); @@ -22676,13 +22676,13 @@ var require_jszip_min = __commonJS({ }), new M3(4, 4, 8, 4, Z), new M3(4, 5, 16, 8, Z), new M3(4, 6, 32, 32, Z), new M3(4, 4, 16, 16, W), new M3(8, 16, 32, 32, W), new M3(8, 16, 128, 128, W), new M3(8, 32, 128, 256, W), new M3(32, 128, 258, 1024, W), new M3(32, 258, 258, 4096, W)], r2.deflateInit = function(e6, t8) { return Y2(e6, t8, v2, 15, 8, 0); }, r2.deflateInit2 = Y2, r2.deflateReset = K2, r2.deflateResetKeep = G2, r2.deflateSetHeader = function(e6, t8) { - return e6 && e6.state ? 2 !== e6.state.wrap ? _15 : (e6.state.gzhead = t8, m4) : _15; + return e6 && e6.state ? 2 !== e6.state.wrap ? _16 : (e6.state.gzhead = t8, m4) : _16; }, r2.deflate = function(e6, t8) { var r3, n4, i5, s5; if (!e6 || !e6.state || 5 < t8 || t8 < 0) - return e6 ? R2(e6, _15) : _15; + return e6 ? R2(e6, _16) : _16; if (n4 = e6.state, !e6.output || !e6.input && 0 !== e6.avail_in || 666 === n4.status && t8 !== f2) - return R2(e6, 0 === e6.avail_out ? -5 : _15); + return R2(e6, 0 === e6.avail_out ? -5 : _16); if (n4.strm = e6, r3 = n4.last_flush, n4.last_flush = t8, n4.status === C2) if (2 === n4.wrap) e6.adler = 0, U(n4, 31), U(n4, 139), U(n4, 8), n4.gzhead ? (U(n4, (n4.gzhead.text ? 1 : 0) + (n4.gzhead.hcrc ? 2 : 0) + (n4.gzhead.extra ? 4 : 0) + (n4.gzhead.name ? 8 : 0) + (n4.gzhead.comment ? 16 : 0)), U(n4, 255 & n4.gzhead.time), U(n4, n4.gzhead.time >> 8 & 255), U(n4, n4.gzhead.time >> 16 & 255), U(n4, n4.gzhead.time >> 24 & 255), U(n4, 9 === n4.level ? 2 : 2 <= n4.strategy || n4.level < 2 ? 4 : 0), U(n4, 255 & n4.gzhead.os), n4.gzhead.extra && n4.gzhead.extra.length && (U(n4, 255 & n4.gzhead.extra.length), U(n4, n4.gzhead.extra.length >> 8 & 255)), n4.gzhead.hcrc && (e6.adler = p(e6.adler, n4.pending_buf, n4.pending, 0)), n4.gzindex = 0, n4.status = 69) : (U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 0), U(n4, 9 === n4.level ? 2 : 2 <= n4.strategy || n4.level < 2 ? 4 : 0), U(n4, 3), n4.status = E2); @@ -22769,13 +22769,13 @@ var require_jszip_min = __commonJS({ return t8 !== f2 ? m4 : n4.wrap <= 0 ? 1 : (2 === n4.wrap ? (U(n4, 255 & e6.adler), U(n4, e6.adler >> 8 & 255), U(n4, e6.adler >> 16 & 255), U(n4, e6.adler >> 24 & 255), U(n4, 255 & e6.total_in), U(n4, e6.total_in >> 8 & 255), U(n4, e6.total_in >> 16 & 255), U(n4, e6.total_in >> 24 & 255)) : (P3(n4, e6.adler >>> 16), P3(n4, 65535 & e6.adler)), F(e6), 0 < n4.wrap && (n4.wrap = -n4.wrap), 0 !== n4.pending ? m4 : 1); }, r2.deflateEnd = function(e6) { var t8; - return e6 && e6.state ? (t8 = e6.state.status) !== C2 && 69 !== t8 && 73 !== t8 && 91 !== t8 && 103 !== t8 && t8 !== E2 && 666 !== t8 ? R2(e6, _15) : (e6.state = null, t8 === E2 ? R2(e6, -3) : m4) : _15; + return e6 && e6.state ? (t8 = e6.state.status) !== C2 && 69 !== t8 && 73 !== t8 && 91 !== t8 && 103 !== t8 && t8 !== E2 && 666 !== t8 ? R2(e6, _16) : (e6.state = null, t8 === E2 ? R2(e6, -3) : m4) : _16; }, r2.deflateSetDictionary = function(e6, t8) { var r3, n4, i5, s5, a5, o3, h4, u4, l3 = t8.length; if (!e6 || !e6.state) - return _15; + return _16; if (2 === (s5 = (r3 = e6.state).wrap) || 1 === s5 && r3.status !== C2 || r3.lookahead) - return _15; + return _16; for (1 === s5 && (e6.adler = d4(e6.adler, t8, l3, 0)), r3.wrap = 0, l3 >= r3.w_size && (0 === s5 && (D2(r3.head), r3.strstart = 0, r3.block_start = 0, r3.insert = 0), u4 = new c3.Buf8(r3.w_size), c3.arraySet(u4, t8, l3 - r3.w_size, r3.w_size, 0), t8 = u4, l3 = r3.w_size), a5 = e6.avail_in, o3 = e6.next_in, h4 = e6.input, e6.avail_in = l3, e6.next_in = 0, e6.input = t8, j(r3); r3.lookahead >= x2; ) { for (n4 = r3.strstart, i5 = r3.lookahead - (x2 - 1); r3.ins_h = (r3.ins_h << r3.hash_shift ^ r3.window[n4 + x2 - 1]) & r3.hash_mask, r3.prev[n4 & r3.w_mask] = r3.head[r3.ins_h], r3.head[r3.ins_h] = n4, n4++, --i5; ) ; @@ -22791,8 +22791,8 @@ var require_jszip_min = __commonJS({ }, {}], 48: [function(e5, t7, r2) { "use strict"; t7.exports = function(e6, t8) { - var r3, n3, i4, s4, a4, o2, h3, u3, l2, f2, c3, d4, p, m4, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C2; - r3 = e6.state, n3 = e6.next_in, z2 = e6.input, i4 = n3 + (e6.avail_in - 5), s4 = e6.next_out, C2 = e6.output, a4 = s4 - (t8 - e6.avail_out), o2 = s4 + (e6.avail_out - 257), h3 = r3.dmax, u3 = r3.wsize, l2 = r3.whave, f2 = r3.wnext, c3 = r3.window, d4 = r3.hold, p = r3.bits, m4 = r3.lencode, _15 = r3.distcode, g = (1 << r3.lenbits) - 1, b2 = (1 << r3.distbits) - 1; + var r3, n3, i4, s4, a4, o2, h3, u3, l2, f2, c3, d4, p, m4, _16, g, b2, v2, y3, w2, k2, x2, S3, z2, C2; + r3 = e6.state, n3 = e6.next_in, z2 = e6.input, i4 = n3 + (e6.avail_in - 5), s4 = e6.next_out, C2 = e6.output, a4 = s4 - (t8 - e6.avail_out), o2 = s4 + (e6.avail_out - 257), h3 = r3.dmax, u3 = r3.wsize, l2 = r3.whave, f2 = r3.wnext, c3 = r3.window, d4 = r3.hold, p = r3.bits, m4 = r3.lencode, _16 = r3.distcode, g = (1 << r3.lenbits) - 1, b2 = (1 << r3.distbits) - 1; e: do { p < 15 && (d4 += z2[n3++] << p, p += 8, d4 += z2[n3++] << p, p += 8), v2 = m4[d4 & g]; @@ -22813,12 +22813,12 @@ var require_jszip_min = __commonJS({ e6.msg = "invalid literal/length code", r3.mode = 30; break e; } - w2 = 65535 & v2, (y3 &= 15) && (p < y3 && (d4 += z2[n3++] << p, p += 8), w2 += d4 & (1 << y3) - 1, d4 >>>= y3, p -= y3), p < 15 && (d4 += z2[n3++] << p, p += 8, d4 += z2[n3++] << p, p += 8), v2 = _15[d4 & b2]; + w2 = 65535 & v2, (y3 &= 15) && (p < y3 && (d4 += z2[n3++] << p, p += 8), w2 += d4 & (1 << y3) - 1, d4 >>>= y3, p -= y3), p < 15 && (d4 += z2[n3++] << p, p += 8, d4 += z2[n3++] << p, p += 8), v2 = _16[d4 & b2]; r: for (; ; ) { if (d4 >>>= y3 = v2 >>> 24, p -= y3, !(16 & (y3 = v2 >>> 16 & 255))) { if (0 == (64 & y3)) { - v2 = _15[(65535 & v2) + (d4 & (1 << y3) - 1)]; + v2 = _16[(65535 & v2) + (d4 & (1 << y3) - 1)]; continue r; } e6.msg = "invalid distance code", r3.mode = 30; @@ -22920,7 +22920,7 @@ var require_jszip_min = __commonJS({ r2.inflateReset = o2, r2.inflateReset2 = h3, r2.inflateResetKeep = a4, r2.inflateInit = function(e6) { return u3(e6, 15); }, r2.inflateInit2 = u3, r2.inflate = function(e6, t8) { - var r3, n4, i5, s5, a5, o3, h4, u4, l3, f3, c4, d4, p, m4, _15, g, b2, v2, y3, w2, k2, x2, S3, z2, C2 = 0, E2 = new I2.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; + var r3, n4, i5, s5, a5, o3, h4, u4, l3, f3, c4, d4, p, m4, _16, g, b2, v2, y3, w2, k2, x2, S3, z2, C2 = 0, E2 = new I2.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; if (!e6 || !e6.state || !e6.output || !e6.input && 0 !== e6.avail_in) return U; 12 === (r3 = e6.state).mode && (r3.mode = 13), a5 = e6.next_out, i5 = e6.output, h4 = e6.avail_out, s5 = e6.next_in, n4 = e6.input, o3 = e6.avail_in, u4 = r3.hold, l3 = r3.bits, f3 = o3, c4 = h4, x2 = N; @@ -23131,39 +23131,39 @@ var require_jszip_min = __commonJS({ r3.have = 0, r3.mode = 19; case 19: for (; r3.have < r3.nlen + r3.ndist; ) { - for (; g = (C2 = r3.lencode[u4 & (1 << r3.lenbits) - 1]) >>> 16 & 255, b2 = 65535 & C2, !((_15 = C2 >>> 24) <= l3); ) { + for (; g = (C2 = r3.lencode[u4 & (1 << r3.lenbits) - 1]) >>> 16 & 255, b2 = 65535 & C2, !((_16 = C2 >>> 24) <= l3); ) { if (0 === o3) break e; o3--, u4 += n4[s5++] << l3, l3 += 8; } if (b2 < 16) - u4 >>>= _15, l3 -= _15, r3.lens[r3.have++] = b2; + u4 >>>= _16, l3 -= _16, r3.lens[r3.have++] = b2; else { if (16 === b2) { - for (z2 = _15 + 2; l3 < z2; ) { + for (z2 = _16 + 2; l3 < z2; ) { if (0 === o3) break e; o3--, u4 += n4[s5++] << l3, l3 += 8; } - if (u4 >>>= _15, l3 -= _15, 0 === r3.have) { + if (u4 >>>= _16, l3 -= _16, 0 === r3.have) { e6.msg = "invalid bit length repeat", r3.mode = 30; break; } k2 = r3.lens[r3.have - 1], d4 = 3 + (3 & u4), u4 >>>= 2, l3 -= 2; } else if (17 === b2) { - for (z2 = _15 + 3; l3 < z2; ) { + for (z2 = _16 + 3; l3 < z2; ) { if (0 === o3) break e; o3--, u4 += n4[s5++] << l3, l3 += 8; } - l3 -= _15, k2 = 0, d4 = 3 + (7 & (u4 >>>= _15)), u4 >>>= 3, l3 -= 3; + l3 -= _16, k2 = 0, d4 = 3 + (7 & (u4 >>>= _16)), u4 >>>= 3, l3 -= 3; } else { - for (z2 = _15 + 7; l3 < z2; ) { + for (z2 = _16 + 7; l3 < z2; ) { if (0 === o3) break e; o3--, u4 += n4[s5++] << l3, l3 += 8; } - l3 -= _15, k2 = 0, d4 = 11 + (127 & (u4 >>>= _15)), u4 >>>= 7, l3 -= 7; + l3 -= _16, k2 = 0, d4 = 11 + (127 & (u4 >>>= _16)), u4 >>>= 7, l3 -= 7; } if (r3.have + d4 > r3.nlen + r3.ndist) { e6.msg = "invalid bit length repeat", r3.mode = 30; @@ -23196,20 +23196,20 @@ var require_jszip_min = __commonJS({ e6.next_out = a5, e6.avail_out = h4, e6.next_in = s5, e6.avail_in = o3, r3.hold = u4, r3.bits = l3, R2(e6, c4), a5 = e6.next_out, i5 = e6.output, h4 = e6.avail_out, s5 = e6.next_in, n4 = e6.input, o3 = e6.avail_in, u4 = r3.hold, l3 = r3.bits, 12 === r3.mode && (r3.back = -1); break; } - for (r3.back = 0; g = (C2 = r3.lencode[u4 & (1 << r3.lenbits) - 1]) >>> 16 & 255, b2 = 65535 & C2, !((_15 = C2 >>> 24) <= l3); ) { + for (r3.back = 0; g = (C2 = r3.lencode[u4 & (1 << r3.lenbits) - 1]) >>> 16 & 255, b2 = 65535 & C2, !((_16 = C2 >>> 24) <= l3); ) { if (0 === o3) break e; o3--, u4 += n4[s5++] << l3, l3 += 8; } if (g && 0 == (240 & g)) { - for (v2 = _15, y3 = g, w2 = b2; g = (C2 = r3.lencode[w2 + ((u4 & (1 << v2 + y3) - 1) >> v2)]) >>> 16 & 255, b2 = 65535 & C2, !(v2 + (_15 = C2 >>> 24) <= l3); ) { + for (v2 = _16, y3 = g, w2 = b2; g = (C2 = r3.lencode[w2 + ((u4 & (1 << v2 + y3) - 1) >> v2)]) >>> 16 & 255, b2 = 65535 & C2, !(v2 + (_16 = C2 >>> 24) <= l3); ) { if (0 === o3) break e; o3--, u4 += n4[s5++] << l3, l3 += 8; } u4 >>>= v2, l3 -= v2, r3.back += v2; } - if (u4 >>>= _15, l3 -= _15, r3.back += _15, r3.length = b2, 0 === g) { + if (u4 >>>= _16, l3 -= _16, r3.back += _16, r3.length = b2, 0 === g) { r3.mode = 26; break; } @@ -23233,20 +23233,20 @@ var require_jszip_min = __commonJS({ } r3.was = r3.length, r3.mode = 23; case 23: - for (; g = (C2 = r3.distcode[u4 & (1 << r3.distbits) - 1]) >>> 16 & 255, b2 = 65535 & C2, !((_15 = C2 >>> 24) <= l3); ) { + for (; g = (C2 = r3.distcode[u4 & (1 << r3.distbits) - 1]) >>> 16 & 255, b2 = 65535 & C2, !((_16 = C2 >>> 24) <= l3); ) { if (0 === o3) break e; o3--, u4 += n4[s5++] << l3, l3 += 8; } if (0 == (240 & g)) { - for (v2 = _15, y3 = g, w2 = b2; g = (C2 = r3.distcode[w2 + ((u4 & (1 << v2 + y3) - 1) >> v2)]) >>> 16 & 255, b2 = 65535 & C2, !(v2 + (_15 = C2 >>> 24) <= l3); ) { + for (v2 = _16, y3 = g, w2 = b2; g = (C2 = r3.distcode[w2 + ((u4 & (1 << v2 + y3) - 1) >> v2)]) >>> 16 & 255, b2 = 65535 & C2, !(v2 + (_16 = C2 >>> 24) <= l3); ) { if (0 === o3) break e; o3--, u4 += n4[s5++] << l3, l3 += 8; } u4 >>>= v2, l3 -= v2, r3.back += v2; } - if (u4 >>>= _15, l3 -= _15, r3.back += _15, 64 & g) { + if (u4 >>>= _16, l3 -= _16, r3.back += _16, 64 & g) { e6.msg = "invalid distance code", r3.mode = 30; break; } @@ -23342,7 +23342,7 @@ var require_jszip_min = __commonJS({ "use strict"; var D2 = e5("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P3 = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; t7.exports = function(e6, t8, r3, n3, i4, s4, a4, o2) { - var h3, u3, l2, f2, c3, d4, p, m4, _15, g = o2.bits, b2 = 0, v2 = 0, y3 = 0, w2 = 0, k2 = 0, x2 = 0, S3 = 0, z2 = 0, C2 = 0, E2 = 0, A = null, I2 = 0, O2 = new D2.Buf16(16), B2 = new D2.Buf16(16), R2 = null, T3 = 0; + var h3, u3, l2, f2, c3, d4, p, m4, _16, g = o2.bits, b2 = 0, v2 = 0, y3 = 0, w2 = 0, k2 = 0, x2 = 0, S3 = 0, z2 = 0, C2 = 0, E2 = 0, A = null, I2 = 0, O2 = new D2.Buf16(16), B2 = new D2.Buf16(16), R2 = null, T3 = 0; for (b2 = 0; b2 <= 15; b2++) O2[b2] = 0; for (v2 = 0; v2 < n3; v2++) @@ -23365,7 +23365,7 @@ var require_jszip_min = __commonJS({ if (d4 = 0 === e6 ? (A = R2 = a4, 19) : 1 === e6 ? (A = F, I2 -= 257, R2 = N, T3 -= 257, 256) : (A = U, R2 = P3, -1), b2 = y3, c3 = s4, S3 = v2 = E2 = 0, l2 = -1, f2 = (C2 = 1 << (x2 = k2)) - 1, 1 === e6 && 852 < C2 || 2 === e6 && 592 < C2) return 1; for (; ; ) { - for (p = b2 - S3, _15 = a4[v2] < d4 ? (m4 = 0, a4[v2]) : a4[v2] > d4 ? (m4 = R2[T3 + a4[v2]], A[I2 + a4[v2]]) : (m4 = 96, 0), h3 = 1 << b2 - S3, y3 = u3 = 1 << x2; i4[c3 + (E2 >> S3) + (u3 -= h3)] = p << 24 | m4 << 16 | _15 | 0, 0 !== u3; ) + for (p = b2 - S3, _16 = a4[v2] < d4 ? (m4 = 0, a4[v2]) : a4[v2] > d4 ? (m4 = R2[T3 + a4[v2]], A[I2 + a4[v2]]) : (m4 = 96, 0), h3 = 1 << b2 - S3, y3 = u3 = 1 << x2; i4[c3 + (E2 >> S3) + (u3 -= h3)] = p << 24 | m4 << 16 | _16 | 0, 0 !== u3; ) ; for (h3 = 1 << b2 - 1; E2 & h3; ) h3 >>= 1; @@ -23394,7 +23394,7 @@ var require_jszip_min = __commonJS({ for (var t8 = e6.length; 0 <= --t8; ) e6[t8] = 0; } - var s4 = 0, a4 = 29, u3 = 256, l2 = u3 + 1 + a4, f2 = 30, c3 = 19, _15 = 2 * l2 + 1, g = 15, d4 = 16, p = 7, m4 = 256, b2 = 16, v2 = 17, y3 = 18, w2 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k2 = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S3 = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z2 = new Array(2 * (l2 + 2)); + var s4 = 0, a4 = 29, u3 = 256, l2 = u3 + 1 + a4, f2 = 30, c3 = 19, _16 = 2 * l2 + 1, g = 15, d4 = 16, p = 7, m4 = 256, b2 = 16, v2 = 17, y3 = 18, w2 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k2 = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S3 = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z2 = new Array(2 * (l2 + 2)); n3(z2); var C2 = new Array(2 * f2); n3(C2); @@ -23468,7 +23468,7 @@ var require_jszip_min = __commonJS({ } function Y2(e6, t8) { var r3, n4, i5, s5 = t8.dyn_tree, a5 = t8.stat_desc.static_tree, o3 = t8.stat_desc.has_stree, h4 = t8.stat_desc.elems, u4 = -1; - for (e6.heap_len = 0, e6.heap_max = _15, r3 = 0; r3 < h4; r3++) + for (e6.heap_len = 0, e6.heap_max = _16, r3 = 0; r3 < h4; r3++) 0 !== s5[2 * r3] ? (e6.heap[++e6.heap_len] = u4 = r3, e6.depth[r3] = 0) : s5[2 * r3 + 1] = 0; for (; e6.heap_len < 2; ) s5[2 * (i5 = e6.heap[++e6.heap_len] = u4 < 2 ? ++u4 : 0)] = 1, e6.depth[i5] = 0, e6.opt_len--, o3 && (e6.static_len -= a5[2 * i5 + 1]); @@ -23480,7 +23480,7 @@ var require_jszip_min = __commonJS({ var r4, n5, i6, s6, a6, o4, h5 = t9.dyn_tree, u5 = t9.max_code, l3 = t9.stat_desc.static_tree, f3 = t9.stat_desc.has_stree, c4 = t9.stat_desc.extra_bits, d5 = t9.stat_desc.extra_base, p2 = t9.stat_desc.max_length, m5 = 0; for (s6 = 0; s6 <= g; s6++) e7.bl_count[s6] = 0; - for (h5[2 * e7.heap[e7.heap_max] + 1] = 0, r4 = e7.heap_max + 1; r4 < _15; r4++) + for (h5[2 * e7.heap[e7.heap_max] + 1] = 0, r4 = e7.heap_max + 1; r4 < _16; r4++) p2 < (s6 = h5[2 * h5[2 * (n5 = e7.heap[r4]) + 1] + 1] + 1) && (s6 = p2, m5++), h5[2 * n5 + 1] = s6, u5 < n5 || (e7.bl_count[s6]++, a6 = 0, d5 <= n5 && (a6 = c4[n5 - d5]), o4 = h5[2 * n5], e7.opt_len += o4 * (s6 + a6), f3 && (e7.static_len += o4 * (l3[2 * n5 + 1] + a6))); if (0 !== m5) { do { @@ -28784,9 +28784,9 @@ var Tree = class { }; Tree.empty = new Tree(NodeType.none, [], [], 0); var FlatBufferCursor = class { - constructor(buffer, index2) { + constructor(buffer, index3) { this.buffer = buffer; - this.index = index2; + this.index = index3; } get id() { return this.buffer[this.index - 4]; @@ -28821,24 +28821,24 @@ var TreeBuffer = class { } toString() { let result = []; - for (let index2 = 0; index2 < this.buffer.length; ) { - result.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + for (let index3 = 0; index3 < this.buffer.length; ) { + result.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result.join(","); } - childString(index2) { - let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3]; + childString(index3) { + let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3]; let type = this.set.types[id3], result = type.name; if (/\W/.test(result) && !type.isError) result = JSON.stringify(result); - index2 += 4; - if (endIndex == index2) + index3 += 4; + if (endIndex == index3) return result; let children = []; - while (index2 < endIndex) { - children.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + while (index3 < endIndex) { + children.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result + "(" + children.join(",") + ")"; } @@ -28946,11 +28946,11 @@ var BaseNode = class { } }; var TreeNode = class extends BaseNode { - constructor(_tree, from, index2, _parent) { + constructor(_tree, from, index3, _parent) { super(); this._tree = _tree; this.from = from; - this.index = index2; + this.index = index3; this._parent = _parent; } get type() { @@ -28971,9 +28971,9 @@ var TreeNode = class extends BaseNode { if (next instanceof TreeBuffer) { if (mode2 & IterMode.ExcludeBuffers) continue; - let index2 = next.findChild(0, next.buffer.length, dir, pos - start, side); - if (index2 > -1) - return new BufferNode(new BufferContext(parent, next, i4, start), null, index2); + let index3 = next.findChild(0, next.buffer.length, dir, pos - start, side); + if (index3 > -1) + return new BufferNode(new BufferContext(parent, next, i4, start), null, index3); } else if (mode2 & IterMode.IncludeAnonymous || (!next.type.isAnonymous || hasChild(next))) { let mounted; if (!(mode2 & IterMode.IgnoreMounts) && (mounted = MountedTree.get(next)) && !mounted.overlay) @@ -29073,10 +29073,10 @@ function matchNodeContext(node, context, i4 = context.length - 1) { return true; } var BufferContext = class { - constructor(parent, buffer, index2, start) { + constructor(parent, buffer, index3, start) { this.parent = parent; this.buffer = buffer; - this.index = index2; + this.index = index3; this.start = start; } }; @@ -29090,17 +29090,17 @@ var BufferNode = class extends BaseNode { get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; } - constructor(context, _parent, index2) { + constructor(context, _parent, index3) { super(); this.context = context; this._parent = _parent; - this.index = index2; - this.type = context.buffer.set.types[context.buffer.buffer[index2]]; + this.index = index3; + this.type = context.buffer.set.types[context.buffer.buffer[index3]]; } child(dir, pos, side) { let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode(this.context, this, index2); + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode(this.context, this, index3); } get firstChild() { return this.child(1, 0, 4); @@ -29118,8 +29118,8 @@ var BufferNode = class extends BaseNode { if (mode2 & IterMode.ExcludeBuffers) return null; let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode(this.context, this, index2); + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode(this.context, this, index3); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); @@ -29234,12 +29234,12 @@ var TreeCursor = class { this.to = node.to; return true; } - yieldBuf(index2, type) { - this.index = index2; + yieldBuf(index3, type) { + this.index = index3; let { start, buffer } = this.buffer; - this.type = type || buffer.set.types[buffer.buffer[index2]]; - this.from = start + buffer.buffer[index2 + 1]; - this.to = start + buffer.buffer[index2 + 2]; + this.type = type || buffer.set.types[buffer.buffer[index3]]; + this.from = start + buffer.buffer[index3 + 1]; + this.to = start + buffer.buffer[index3 + 2]; return true; } yield(node) { @@ -29259,11 +29259,11 @@ var TreeCursor = class { if (!this.buffer) return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); let { buffer } = this.buffer; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); - if (index2 < 0) + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); + if (index3 < 0) return false; this.stack.push(this.index); - return this.yieldBuf(index2); + return this.yieldBuf(index3); } firstChild() { return this.enterChild(1, 0, 4); @@ -29313,7 +29313,7 @@ var TreeCursor = class { return this.sibling(-1); } atLastNode(dir) { - let index2, parent, { buffer } = this; + let index3, parent, { buffer } = this; if (buffer) { if (dir > 0) { if (this.index < buffer.buffer.buffer.length) @@ -29323,13 +29323,13 @@ var TreeCursor = class { if (buffer.buffer.buffer[i4 + 3] < this.index) return false; } - ({ index: index2, parent } = buffer); + ({ index: index3, parent } = buffer); } else { - ({ index: index2, _parent: parent } = this._tree); + ({ index: index3, _parent: parent } = this._tree); } - for (; parent; { index: index2, _parent: parent } = parent) { - if (index2 > -1) - for (let i4 = index2 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { + for (; parent; { index: index3, _parent: parent } = parent) { + if (index3 > -1) + for (let i4 = index3 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { let child = parent._tree.children[i4]; if (this.mode & IterMode.IncludeAnonymous || child instanceof TreeBuffer || !child.type.isAnonymous || hasChild(child)) return false; @@ -29367,16 +29367,16 @@ var TreeCursor = class { let cache2 = this.bufferNode, result = null, depth = 0; if (cache2 && cache2.context == this.buffer) { scan: - for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) { + for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) { for (let c3 = cache2; c3; c3 = c3._parent) - if (c3.index == index2) { - if (index2 == this.index) + if (c3.index == index3) { + if (index3 == this.index) return c3; result = c3; depth = d4 + 1; break scan; } - index2 = this.stack[--d4]; + index3 = this.stack[--d4]; } } for (let i4 = depth; i4 < this.stack.length; i4++) @@ -29461,9 +29461,9 @@ function buildTree(data2) { let startPos = start - parentStart; if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor2.pos - minPos, inRepeat))) { let data3 = new Uint16Array(buffer2.size - buffer2.skip); - let endPos = cursor2.pos - buffer2.size, index2 = data3.length; + let endPos = cursor2.pos - buffer2.size, index3 = data3.length; while (cursor2.pos > endPos) - index2 = copyToBuffer(buffer2.start, data3, index2); + index3 = copyToBuffer(buffer2.start, data3, index3); node = new TreeBuffer(data3, end - buffer2.start, nodeSet2); startPos = buffer2.start - parentStart; } else { @@ -29606,26 +29606,26 @@ function buildTree(data2) { } return result.size > 4 ? result : void 0; } - function copyToBuffer(bufferStart, buffer2, index2) { + function copyToBuffer(bufferStart, buffer2, index3) { let { id: id3, start, end, size: size2 } = cursor2; cursor2.next(); if (size2 >= 0 && id3 < minRepeatType) { - let startIndex = index2; + let startIndex = index3; if (size2 > 4) { let endPos = cursor2.pos - (size2 - 4); while (cursor2.pos > endPos) - index2 = copyToBuffer(bufferStart, buffer2, index2); + index3 = copyToBuffer(bufferStart, buffer2, index3); } - buffer2[--index2] = startIndex; - buffer2[--index2] = end - bufferStart; - buffer2[--index2] = start - bufferStart; - buffer2[--index2] = id3; + buffer2[--index3] = startIndex; + buffer2[--index3] = end - bufferStart; + buffer2[--index3] = start - bufferStart; + buffer2[--index3] = id3; } else if (size2 == -3) { contextHash = id3; } else if (size2 == -4) { lookAhead = id3; } - return index2; + return index3; } let children = [], positions = []; while (cursor2.pos > 0) @@ -30241,19 +30241,19 @@ var StyleSet = class { let sheet = this.sheet; let pos = 0, j = 0; for (let i4 = 0; i4 < modules.length; i4++) { - let mod3 = modules[i4], index2 = this.modules.indexOf(mod3); - if (index2 < j && index2 > -1) { - this.modules.splice(index2, 1); + let mod3 = modules[i4], index3 = this.modules.indexOf(mod3); + if (index3 < j && index3 > -1) { + this.modules.splice(index3, 1); j--; - index2 = -1; + index3 = -1; } - if (index2 == -1) { + if (index3 == -1) { this.modules.splice(j++, 0, mod3); if (sheet) for (let k2 = 0; k2 < mod3.rules.length; k2++) sheet.insertRule(mod3.rules[k2], pos++); } else { - while (j < index2) + while (j < index3) pos += this.modules[j++].rules.length; pos += mod3.rules.length; j++; @@ -31476,9 +31476,9 @@ function matchingNodes(node, dir, brackets) { if (byProp) return byProp; if (node.name.length == 1) { - let index2 = brackets.indexOf(node.name); - if (index2 > -1 && index2 % 2 == (dir < 0 ? 1 : 0)) - return [brackets[index2 + dir]]; + let index3 = brackets.indexOf(node.name); + if (index3 > -1 && index3 % 2 == (dir < 0 ? 1 : 0)) + return [brackets[index3 + dir]]; } return null; } @@ -31851,15 +31851,15 @@ var Parse = class { } nextLine() { let from = this.parsedPos, line = this.lineAfter(from), end = from + line.length; - for (let index2 = this.rangeIndex; ; ) { - let rangeEnd = this.ranges[index2].to; + for (let index3 = this.rangeIndex; ; ) { + let rangeEnd = this.ranges[index3].to; if (rangeEnd >= end) break; line = line.slice(0, rangeEnd - (end - line.length)); - index2++; - if (index2 == this.ranges.length) + index3++; + if (index3 == this.ranges.length) break; - let rangeStart = this.ranges[index2].from; + let rangeStart = this.ranges[index3].from; let after = this.lineAfter(rangeStart); line += after; end = rangeStart + after.length; @@ -32061,7 +32061,7 @@ function iterateTreeInSelection(selection2, state, iterateFns) { } // src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx -var import_react175 = __toESM(require_react()); +var import_react159 = __toESM(require_react()); // src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowStateFields.ts var import_state3 = require("@codemirror/state"); @@ -32229,8 +32229,11 @@ var T = class { }, menu: { layout: "Layout", + enterFlowState: "Enter Flow State", + exitFlowState: "Exit Flow State", newView: "New View", calendarView: "Calendar View", + dayView: "Day View", closeSpace: "Close Space", customView: "Custom View", detailsView: "Details View", @@ -32382,7 +32385,9 @@ var T = class { }, buttons: { add: "Add", + alias: "Alias", addFilter: "Add Filter", + loadMore: "Load More", addCondition: "Add Condition", customize: "Customize", moreOptions: "More Options", @@ -32588,6 +32593,8 @@ var T = class { }, labels: { duplicateTable: "Duplicate Table", + pinned: "Pinned", + live: "Pinned by Live Search", moveTable: "Move Table", editFormula: "Edit Formula", editObject: "Edit Object", @@ -32855,6 +32862,10 @@ var T = class { name: "Enable Folder Note", desc: "Access the folder note in the folder page and hide the folder note from spaces" }, + folderNoteName: { + name: "Folder Note Name", + desc: "Name of the folder note, keep blank to use the same name as the folder" + }, expandFolder: { name: "Auto Expand Folder", desc: "Auto expand folders on click" @@ -32896,6 +32907,10 @@ var T = class { trash: "Move to Obsidian Trash", "system-trash": "Move to System Trash" }, + flowState: { + name: "Flow State", + desc: "Toggle the flow state" + }, hideRibbon: { name: "App Ribbon", desc: `Show/hide the left menu aka. ribbon` @@ -32942,7 +32957,11 @@ var T = class { }, spaceRowHeight: { name: "Row Height", - desc: "The height for each row in spaces (in pixels), default is 28" + desc: "The height for each row in spaces (in pixels), default is 29" + }, + contextPagination: { + name: "Table View Pagination", + desc: "Number of items per page in table view" }, coverHeight: { name: "Cover Height", @@ -34438,8 +34457,8 @@ function buildLocalizeFn(args) { var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; valuesArray = args.values[_width] || args.values[_defaultWidth]; } - var index2 = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; - return valuesArray[index2]; + var index3 = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; + return valuesArray[index3]; }; } @@ -34712,8 +34731,8 @@ var match = { defaultMatchWidth: "wide", parsePatterns: parseQuarterPatterns, defaultParseWidth: "any", - valueCallback: function valueCallback2(index2) { - return index2 + 1; + valueCallback: function valueCallback2(index3) { + return index3 + 1; } }), month: buildMatchFn({ @@ -35221,21 +35240,21 @@ function setYear(dirtyDate, dirtyYear) { } // src/utils/array.ts -var insert = (arr, index2, newItem) => !index2 || index2 <= 0 ? [ +var insert = (arr, index3, newItem) => !index3 || index3 <= 0 ? [ newItem, ...arr ] : [ - ...arr.slice(0, index2), + ...arr.slice(0, index3), newItem, - ...arr.slice(index2) + ...arr.slice(index3) ]; -var insertMulti = (arr, index2, newItem) => !index2 || index2 <= 0 ? [ +var insertMulti = (arr, index3, newItem) => !index3 || index3 <= 0 ? [ ...newItem, ...arr ] : [ - ...arr.slice(0, index2), + ...arr.slice(0, index3), ...newItem, - ...arr.slice(index2) + ...arr.slice(index3) ]; var uniq = (a4) => [...new Set(a4)]; var uniqCaseInsensitive = (a4) => [ @@ -35252,8 +35271,8 @@ var uniqueNameFromString = (name319, cols) => { } return newName; }; -var onlyUniqueProp = (prop2) => (value, index2, self2) => { - return self2.findIndex((v2) => value[prop2] == v2[prop2]) === index2; +var onlyUniqueProp = (prop2) => (value, index3, self2) => { + return self2.findIndex((v2) => value[prop2] == v2[prop2]) === index3; }; var orderArrayByArrayWithKey = (array, order, key2) => { return array.sort(function(a4, b2) { @@ -36214,11 +36233,11 @@ var defaultTableDataForContext = (superstate, space2) => { rows: paths.map((f2) => ({ [PathPropertyName]: f2.path })) }; }; -var createNewRow = (mdb, row2, index2) => { - if (index2) { +var createNewRow = (mdb, row2, index3) => { + if (index3) { return { ...mdb, - rows: insert(mdb.rows, index2, row2) + rows: insert(mdb.rows, index3, row2) }; } return { @@ -36358,6 +36377,7 @@ var fileSystemSpaceInfoFromFolder = (manager, folder, readOnly) => { }; } const folderName = folderPathToString(folder); + const folderNoteName = manager.superstate.settings.folderNoteName; return { name: folderName, path: folder, @@ -36365,7 +36385,7 @@ var fileSystemSpaceInfoFromFolder = (manager, folder, readOnly) => { readOnly, folderPath: folder, defPath: folder + "/.space/def.json", - notePath: folder + "/" + folderName + ".md", + notePath: folder + "/" + (folderNoteName.length > 0 ? folderNoteName : folderName) + ".md", dbPath: spaceFolderPathFromSpace(folder + "/", manager) + manager.superstate.settings.folderContextFile + ".mdb", framePath: spaceFolderPathFromSpace(folder + "/", manager) + "views.mdb", commandsPath: spaceFolderPathFromSpace(folder + "/", manager) + "commands.mdb" @@ -36373,7 +36393,7 @@ var fileSystemSpaceInfoFromFolder = (manager, folder, readOnly) => { }; // src/core/types/space.ts -var FMMetadataKeys = (settings) => [settings.fmKeyBanner, settings.fmKeySticker, settings.fmKeyColor, settings.fmKeyBanner, settings.fmKeyBannerOffset]; +var FMMetadataKeys = (settings) => [settings.fmKeyAlias, settings.fmKeyBanner, settings.fmKeySticker, settings.fmKeyColor, settings.fmKeyBanner, settings.fmKeyBannerOffset]; var tagsSpacePath = "spaces://$tags"; var waypointsPath = { name: i18n_default.menu.waypoints, @@ -36810,7 +36830,7 @@ var removeRowForPath = (spaceTable, paths) => { ) }; }; -var reorderRowsForPath = (spaceTable, paths, index2) => { +var reorderRowsForPath = (spaceTable, paths, index3) => { const rows = spaceTable.rows.filter( (f2) => paths.includes(f2[PathPropertyName]) ); @@ -36818,7 +36838,7 @@ var reorderRowsForPath = (spaceTable, paths, index2) => { ...spaceTable, rows: insertMulti(spaceTable.rows.filter( (f2) => !paths.includes(f2[PathPropertyName]) - ), index2, rows) + ), index3, rows) }; }; @@ -37461,8 +37481,8 @@ var closestCorners = (_ref) => { const rect = droppableRects.get(id3); if (rect) { const rectCorners = cornersOfRectangle(rect); - const distances = corners.reduce((accumulator, corner, index2) => { - return accumulator + distanceBetween(rectCorners[index2], corner); + const distances = corners.reduce((accumulator, corner, index3) => { + return accumulator + distanceBetween(rectCorners[index3], corner); }, 0); const effectiveDistance = Number((distances / 4).toFixed(4)); collisions.push({ @@ -38597,8 +38617,8 @@ function useAutoScroller(_ref) { if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) { continue; } - const index2 = scrollableAncestors.indexOf(scrollContainer); - const scrollContainerRect = scrollableAncestorRects[index2]; + const index3 = scrollableAncestors.indexOf(scrollContainer); + const scrollContainerRect = scrollableAncestorRects[index3]; if (!scrollContainerRect) { continue; } @@ -40495,16 +40515,16 @@ function arrayMove(array, from, to2) { return newArray; } function getSortedRects(items, rects) { - return items.reduce((accumulator, id3, index2) => { + return items.reduce((accumulator, id3, index3) => { const rect = rects.get(id3); if (rect) { - accumulator[index2] = rect; + accumulator[index3] = rect; } return accumulator; }, Array(items.length)); } -function isValidIndex(index2) { - return index2 !== null && index2 >= 0; +function isValidIndex(index3) { + return index3 !== null && index3 >= 0; } function itemsEqual(a4, b2) { if (a4 === b2) { @@ -40534,11 +40554,11 @@ var rectSortingStrategy = (_ref) => { rects, activeIndex, overIndex, - index: index2 + index: index3 } = _ref; const newRects = arrayMove(rects, overIndex, activeIndex); - const oldRect = rects[index2]; - const newRect = newRects[index2]; + const oldRect = rects[index3]; + const newRect = newRects[index3]; if (!newRect || !oldRect) { return null; } @@ -40629,7 +40649,7 @@ var defaultAnimateLayoutChanges = (_ref2) => { containerId, isSorting, wasDragging, - index: index2, + index: index3, items, newIndex, previousItems, @@ -40639,13 +40659,13 @@ var defaultAnimateLayoutChanges = (_ref2) => { if (!transition || !wasDragging) { return false; } - if (previousItems !== items && index2 === newIndex) { + if (previousItems !== items && index3 === newIndex) { return false; } if (isSorting) { return true; } - return newIndex !== index2 && containerId === previousContainerId; + return newIndex !== index3 && containerId === previousContainerId; }; var defaultTransition2 = { duration: 200, @@ -40663,14 +40683,14 @@ var defaultAttributes = { function useDerivedTransform(_ref) { let { disabled, - index: index2, + index: index3, node, rect } = _ref; const [derivedTransform, setDerivedtransform] = (0, import_react4.useState)(null); - const previousIndex = (0, import_react4.useRef)(index2); + const previousIndex = (0, import_react4.useRef)(index3); useIsomorphicLayoutEffect(() => { - if (!disabled && index2 !== previousIndex.current && node.current) { + if (!disabled && index3 !== previousIndex.current && node.current) { const initial = rect.current; if (initial) { const current3 = getClientRect(node.current, { @@ -40687,10 +40707,10 @@ function useDerivedTransform(_ref) { } } } - if (index2 !== previousIndex.current) { - previousIndex.current = index2; + if (index3 !== previousIndex.current) { + previousIndex.current = index3; } - }, [disabled, index2, node, rect]); + }, [disabled, index3, node, rect]); (0, import_react4.useEffect)(() => { if (derivedTransform) { setDerivedtransform(null); @@ -40722,15 +40742,15 @@ function useSortable(_ref) { strategy: globalStrategy } = (0, import_react4.useContext)(Context); const disabled = normalizeLocalDisabled(localDisabled, globalDisabled); - const index2 = items.indexOf(id3); + const index3 = items.indexOf(id3); const data2 = (0, import_react4.useMemo)(() => ({ sortable: { containerId, - index: index2, + index: index3, items }, ...customData - }), [containerId, customData, index2, items]); + }), [containerId, customData, index3, items]); const itemsAfterCurrentSortable = (0, import_react4.useMemo)(() => items.slice(items.indexOf(id3)), [items, id3]); const { rect, @@ -40777,14 +40797,14 @@ function useSortable(_ref) { activeNodeRect, activeIndex, overIndex, - index: index2 + index: index3 }) : null; const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({ id: id3, items, activeIndex, overIndex - }) : index2; + }) : index3; const activeId = active == null ? void 0 : active.id; const previous = (0, import_react4.useRef)({ activeId, @@ -40799,7 +40819,7 @@ function useSortable(_ref) { isDragging, isSorting, id: id3, - index: index2, + index: index3, items, newIndex: previous.current.newIndex, previousItems: previous.current.items, @@ -40809,7 +40829,7 @@ function useSortable(_ref) { }); const derivedTransform = useDerivedTransform({ disabled: !shouldAnimateLayoutChanges, - index: index2, + index: index3, node, rect }); @@ -40843,7 +40863,7 @@ function useSortable(_ref) { attributes, data: data2, rect, - index: index2, + index: index3, newIndex, items, isOver, @@ -40861,7 +40881,7 @@ function useSortable(_ref) { transition: getTransition() }; function getTransition() { - if (derivedTransform || itemsHaveChanged && previous.current.newIndex === index2) { + if (derivedTransform || itemsHaveChanged && previous.current.newIndex === index3) { return disabledTransition; } if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) { @@ -40966,7 +40986,7 @@ var sortableKeyboardCoordinates = (event, _ref) => { const newNode2 = newDroppable == null ? void 0 : newDroppable.node.current; if (newNode2 && newRect && activeDroppable && newDroppable) { const newScrollAncestors = getScrollableAncestors(newNode2); - const hasDifferentScrollAncestors = newScrollAncestors.some((element, index2) => scrollableAncestors[index2] !== element); + const hasDifferentScrollAncestors = newScrollAncestors.some((element, index3) => scrollableAncestors[index3] !== element); const hasSameContainer = isSameContainer(activeDroppable, newDroppable); const isAfterActive = isAfter2(activeDroppable, newDroppable); const offset2 = hasDifferentScrollAncestors || !hasSameContainer ? { @@ -43384,11 +43404,11 @@ types$1.backQuote.updateContext = function() { }; types$1.star.updateContext = function(prevType) { if (prevType === types$1._function) { - var index2 = this.context.length - 1; - if (this.context[index2] === types.f_expr) { - this.context[index2] = types.f_expr_gen; + var index3 = this.context.length - 1; + if (this.context[index3] === types.f_expr) { + this.context[index3] = types.f_expr_gen; } else { - this.context[index2] = types.f_gen; + this.context[index3] = types.f_gen; } } this.exprAllowed = true; @@ -46590,7 +46610,7 @@ var generateCodeForProp = (value, isClosure, type) => { var buildExecutable = (root) => { const treeNode = { ...root, execActions: {}, execProps: {}, execStyles: {}, execPropsOptions: {} }; const { sortedKeys, dependencies: dependencies314 } = sortKeysByDependencies(treeNode.node.props, `${treeNode.id}.props`); - const { sortedKeys: _15, dependencies: styleDependencies } = sortKeysByDependencies(treeNode.node.styles, `${treeNode.id}.styles`); + const { sortedKeys: _16, dependencies: styleDependencies } = sortKeysByDependencies(treeNode.node.styles, `${treeNode.id}.styles`); treeNode.execPropsOptions.props = sortedKeys.map((f2) => { return { name: f2, @@ -50406,11 +50426,11 @@ DimensionError.prototype.name = "DimensionError"; DimensionError.prototype.isDimensionError = true; // node_modules/mathjs/lib/esm/error/IndexError.js -function IndexError(index2, min5, max5) { +function IndexError(index3, min5, max5) { if (!(this instanceof IndexError)) { throw new SyntaxError("Constructor must be called with the new operator"); } - this.index = index2; + this.index = index3; if (arguments.length < 3) { this.min = 0; this.max = min5; @@ -50474,28 +50494,28 @@ function validate(array, size2) { _validate(array, size2, 0); } } -function validateIndexSourceSize(value, index2) { +function validateIndexSourceSize(value, index3) { var valueSize = value.isMatrix ? value._size : arraySize(value); - var sourceSize = index2._sourceSize; + var sourceSize = index3._sourceSize; sourceSize.forEach((sourceDim, i4) => { if (sourceDim !== null && sourceDim !== valueSize[i4]) { throw new DimensionError(sourceDim, valueSize[i4]); } }); } -function validateIndex(index2, length) { - if (index2 !== void 0) { - if (!isNumber(index2) || !isInteger(index2)) { - throw new TypeError("Index must be an integer (value: " + index2 + ")"); +function validateIndex(index3, length) { + if (index3 !== void 0) { + if (!isNumber(index3) || !isInteger(index3)) { + throw new TypeError("Index must be an integer (value: " + index3 + ")"); } - if (index2 < 0 || typeof length === "number" && index2 >= length) { - throw new IndexError(index2, length); + if (index3 < 0 || typeof length === "number" && index3 >= length) { + throw new IndexError(index3, length); } } } -function isEmptyIndex(index2) { - for (var i4 = 0; i4 < index2._dimensions.length; ++i4) { - var dimension = index2._dimensions[i4]; +function isEmptyIndex(index3) { + for (var i4 = 0; i4 < index3._dimensions.length; ++i4) { + var dimension = index3._dimensions[i4]; if (dimension._data && isArray2(dimension._data)) { if (dimension._size[0] === 0) { return true; @@ -54103,15 +54123,15 @@ var createRangeClass = /* @__PURE__ */ factory(name7, dependencies6, () => { }; Range6.prototype.map = function(callback) { var array = []; - this.forEach(function(value, index2, obj) { - array[index2[0]] = callback(value, index2, obj); + this.forEach(function(value, index3, obj) { + array[index3[0]] = callback(value, index3, obj); }); return array; }; Range6.prototype.toArray = function() { var array = []; - this.forEach(function(value, index2) { - array[index2[0]] = value; + this.forEach(function(value, index3) { + array[index3[0]] = value; }); return array; }; @@ -54165,13 +54185,13 @@ var createMatrixClass = /* @__PURE__ */ factory(name8, dependencies7, () => { Matrix2.prototype.create = function(data2, datatype) { throw new Error("Cannot invoke create on a Matrix interface"); }; - Matrix2.prototype.subset = function(index2, replacement, defaultValue2) { + Matrix2.prototype.subset = function(index3, replacement, defaultValue2) { throw new Error("Cannot invoke subset on a Matrix interface"); }; - Matrix2.prototype.get = function(index2) { + Matrix2.prototype.get = function(index3) { throw new Error("Cannot invoke get on a Matrix interface"); }; - Matrix2.prototype.set = function(index2, value, defaultValue2) { + Matrix2.prototype.set = function(index3, value, defaultValue2) { throw new Error("Cannot invoke set on a Matrix interface"); }; Matrix2.prototype.resize = function(size2, defaultValue2) { @@ -54218,7 +54238,7 @@ function lruQueue(limit) { var base2 = 1; var queue = /* @__PURE__ */ Object.create(null); var map4 = /* @__PURE__ */ Object.create(null); - var index2 = 0; + var index3 = 0; var del = function del2(id3) { var oldIndex = map4[id3]; if (!oldIndex) @@ -54229,7 +54249,7 @@ function lruQueue(limit) { if (base2 !== oldIndex) return; if (!size2) { - index2 = 0; + index3 = 0; base2 = 1; return; } @@ -54240,7 +54260,7 @@ function lruQueue(limit) { return { hit: function hit(id3) { var oldIndex = map4[id3]; - var nuIndex = ++index2; + var nuIndex = ++index3; queue[nuIndex] = id3; map4[id3] = nuIndex; if (!oldIndex) { @@ -54260,7 +54280,7 @@ function lruQueue(limit) { }, delete: del, clear: function clear() { - size2 = index2 = 0; + size2 = index3 = 0; base2 = 1; queue = /* @__PURE__ */ Object.create(null); map4 = /* @__PURE__ */ Object.create(null); @@ -54369,82 +54389,82 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name9, dependencies8, (_ref DenseMatrix2.prototype.create = function(data2, datatype) { return new DenseMatrix2(data2, datatype); }; - DenseMatrix2.prototype.subset = function(index2, replacement, defaultValue2) { + DenseMatrix2.prototype.subset = function(index3, replacement, defaultValue2) { switch (arguments.length) { case 1: - return _get(this, index2); + return _get(this, index3); case 2: case 3: - return _set(this, index2, replacement, defaultValue2); + return _set(this, index3, replacement, defaultValue2); default: throw new SyntaxError("Wrong number of arguments"); } }; - DenseMatrix2.prototype.get = function(index2) { - if (!isArray2(index2)) { + DenseMatrix2.prototype.get = function(index3) { + if (!isArray2(index3)) { throw new TypeError("Array expected"); } - if (index2.length !== this._size.length) { - throw new DimensionError(index2.length, this._size.length); + if (index3.length !== this._size.length) { + throw new DimensionError(index3.length, this._size.length); } - for (var x2 = 0; x2 < index2.length; x2++) { - validateIndex(index2[x2], this._size[x2]); + for (var x2 = 0; x2 < index3.length; x2++) { + validateIndex(index3[x2], this._size[x2]); } var data2 = this._data; - for (var i4 = 0, ii = index2.length; i4 < ii; i4++) { - var indexI = index2[i4]; + for (var i4 = 0, ii = index3.length; i4 < ii; i4++) { + var indexI = index3[i4]; validateIndex(indexI, data2.length); data2 = data2[indexI]; } return data2; }; - DenseMatrix2.prototype.set = function(index2, value, defaultValue2) { - if (!isArray2(index2)) { + DenseMatrix2.prototype.set = function(index3, value, defaultValue2) { + if (!isArray2(index3)) { throw new TypeError("Array expected"); } - if (index2.length < this._size.length) { - throw new DimensionError(index2.length, this._size.length, "<"); + if (index3.length < this._size.length) { + throw new DimensionError(index3.length, this._size.length, "<"); } var i4, ii, indexI; - var size2 = index2.map(function(i5) { + var size2 = index3.map(function(i5) { return i5 + 1; }); _fit(this, size2, defaultValue2); var data2 = this._data; - for (i4 = 0, ii = index2.length - 1; i4 < ii; i4++) { - indexI = index2[i4]; + for (i4 = 0, ii = index3.length - 1; i4 < ii; i4++) { + indexI = index3[i4]; validateIndex(indexI, data2.length); data2 = data2[indexI]; } - indexI = index2[index2.length - 1]; + indexI = index3[index3.length - 1]; validateIndex(indexI, data2.length); data2[indexI] = value; return this; }; - function _get(matrix2, index2) { - if (!isIndex(index2)) { + function _get(matrix2, index3) { + if (!isIndex(index3)) { throw new TypeError("Invalid index"); } - var isScalar = index2.isScalar(); + var isScalar = index3.isScalar(); if (isScalar) { - return matrix2.get(index2.min()); + return matrix2.get(index3.min()); } else { - var size2 = index2.size(); + var size2 = index3.size(); if (size2.length !== matrix2._size.length) { throw new DimensionError(size2.length, matrix2._size.length); } - var min5 = index2.min(); - var max5 = index2.max(); + var min5 = index3.min(); + var max5 = index3.max(); for (var i4 = 0, ii = matrix2._size.length; i4 < ii; i4++) { validateIndex(min5[i4], matrix2._size[i4]); validateIndex(max5[i4], matrix2._size[i4]); } - return new DenseMatrix2(_getSubmatrix(matrix2._data, index2, size2.length, 0), matrix2._datatype); + return new DenseMatrix2(_getSubmatrix(matrix2._data, index3, size2.length, 0), matrix2._datatype); } } - function _getSubmatrix(data2, index2, dims, dim) { + function _getSubmatrix(data2, index3, dims, dim) { var last = dim === dims - 1; - var range2 = index2.dimension(dim); + var range2 = index3.dimension(dim); if (last) { return range2.map(function(i4) { validateIndex(i4, data2.length); @@ -54454,16 +54474,16 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name9, dependencies8, (_ref return range2.map(function(i4) { validateIndex(i4, data2.length); var child = data2[i4]; - return _getSubmatrix(child, index2, dims, dim + 1); + return _getSubmatrix(child, index3, dims, dim + 1); }).valueOf(); } } - function _set(matrix2, index2, submatrix, defaultValue2) { - if (!index2 || index2.isIndex !== true) { + function _set(matrix2, index3, submatrix, defaultValue2) { + if (!index3 || index3.isIndex !== true) { throw new TypeError("Invalid index"); } - var iSize = index2.size(); - var isScalar = index2.isScalar(); + var iSize = index3.size(); + var isScalar = index3.isScalar(); var sSize; if (isMatrix(submatrix)) { sSize = submatrix.size(); @@ -54475,7 +54495,7 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name9, dependencies8, (_ref if (sSize.length !== 0) { throw new TypeError("Scalar expected"); } - matrix2.set(index2.min(), submatrix, defaultValue2); + matrix2.set(index3.min(), submatrix, defaultValue2); } else { if (!deepStrictEqual(sSize, iSize)) { try { @@ -54506,19 +54526,19 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name9, dependencies8, (_ref if (!deepStrictEqual(iSize, sSize)) { throw new DimensionError(iSize, sSize, ">"); } - var size2 = index2.max().map(function(i5) { + var size2 = index3.max().map(function(i5) { return i5 + 1; }); _fit(matrix2, size2, defaultValue2); var dims = iSize.length; var dim = 0; - _setSubmatrix(matrix2._data, index2, submatrix, dims, dim); + _setSubmatrix(matrix2._data, index3, submatrix, dims, dim); } return matrix2; } - function _setSubmatrix(data2, index2, submatrix, dims, dim) { + function _setSubmatrix(data2, index3, submatrix, dims, dim) { var last = dim === dims - 1; - var range2 = index2.dimension(dim); + var range2 = index3.dimension(dim); if (last) { range2.forEach(function(dataIndex, subIndex) { validateIndex(dataIndex); @@ -54527,7 +54547,7 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name9, dependencies8, (_ref } else { range2.forEach(function(dataIndex, subIndex) { validateIndex(dataIndex); - _setSubmatrix(data2[dataIndex], index2, submatrix[subIndex[0]], dims, dim + 1); + _setSubmatrix(data2[dataIndex], index3, submatrix[subIndex[0]], dims, dim + 1); }); } } @@ -54591,18 +54611,18 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name9, dependencies8, (_ref DenseMatrix2.prototype.map = function(callback) { var me = this; var args = maxArgumentCount(callback); - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (isArray2(value)) { return value.map(function(child, i4) { - return recurse2(child, index2.concat(i4)); + return recurse2(child, index3.concat(i4)); }); } else { if (args === 1) { return callback(value); } else if (args === 2) { - return callback(value, index2); + return callback(value, index3); } else { - return callback(value, index2, me); + return callback(value, index3, me); } } }; @@ -54612,27 +54632,27 @@ var createDenseMatrixClass = /* @__PURE__ */ factory(name9, dependencies8, (_ref }; DenseMatrix2.prototype.forEach = function(callback) { var me = this; - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (isArray2(value)) { value.forEach(function(child, i4) { - recurse2(child, index2.concat(i4)); + recurse2(child, index3.concat(i4)); }); } else { - callback(value, index2, me); + callback(value, index3, me); } }; recurse(this._data, []); }; DenseMatrix2.prototype[Symbol.iterator] = function* () { - var recurse = function* recurse2(value, index2) { + var recurse = function* recurse2(value, index3) { if (isArray2(value)) { for (var i4 = 0; i4 < value.length; i4++) { - yield* recurse2(value[i4], index2.concat(i4)); + yield* recurse2(value[i4], index3.concat(i4)); } } else { yield { value, - index: index2 + index: index3 }; } }; @@ -55802,16 +55822,16 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ var columns = this._size[1]; return rows !== 0 && columns !== 0 ? this._index.length / (rows * columns) : 0; }; - SparseMatrix2.prototype.subset = function(index2, replacement, defaultValue2) { + SparseMatrix2.prototype.subset = function(index3, replacement, defaultValue2) { if (!this._values) { throw new Error("Cannot invoke subset on a Pattern only matrix"); } switch (arguments.length) { case 1: - return _getsubset(this, index2); + return _getsubset(this, index3); case 2: case 3: - return _setsubset(this, index2, replacement, defaultValue2); + return _setsubset(this, index3, replacement, defaultValue2); default: throw new SyntaxError("Wrong number of arguments"); } @@ -55847,35 +55867,35 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ w2[i5] = true; }); var values2 = mvalues ? [] : void 0; - var index2 = []; + var index3 = []; var ptr = []; columns.forEach(function(j) { - ptr.push(index2.length); + ptr.push(index3.length); for (k2 = mptr[j], kk = mptr[j + 1]; k2 < kk; k2++) { i4 = mindex[k2]; if (w2[i4] === true) { - index2.push(pv[i4]); + index3.push(pv[i4]); if (values2) { values2.push(mvalues[k2]); } } } }); - ptr.push(index2.length); + ptr.push(index3.length); return new SparseMatrix2({ values: values2, - index: index2, + index: index3, ptr, size: size2, datatype: matrix2._datatype }); } - function _setsubset(matrix2, index2, submatrix, defaultValue2) { - if (!index2 || index2.isIndex !== true) { + function _setsubset(matrix2, index3, submatrix, defaultValue2) { + if (!index3 || index3.isIndex !== true) { throw new TypeError("Invalid index"); } - var iSize = index2.size(); - var isScalar = index2.isScalar(); + var iSize = index3.size(); + var isScalar = index3.isScalar(); var sSize; if (isMatrix(submatrix)) { sSize = submatrix.size(); @@ -55887,7 +55907,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ if (sSize.length !== 0) { throw new TypeError("Scalar expected"); } - matrix2.set(index2.min(), submatrix, defaultValue2); + matrix2.set(index3.min(), submatrix, defaultValue2); } else { if (iSize.length !== 1 && iSize.length !== 2) { throw new DimensionError(iSize.length, matrix2._size.length, "<"); @@ -55908,14 +55928,14 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ throw new DimensionError(iSize, sSize, ">"); } if (iSize.length === 1) { - var range2 = index2.dimension(0); + var range2 = index3.dimension(0); range2.forEach(function(dataIndex, subIndex) { validateIndex(dataIndex); matrix2.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue2); }); } else { - var firstDimensionRange = index2.dimension(0); - var secondDimensionRange = index2.dimension(1); + var firstDimensionRange = index3.dimension(0); + var secondDimensionRange = index3.dimension(1); firstDimensionRange.forEach(function(firstDataIndex, firstSubIndex) { validateIndex(firstDataIndex); secondDimensionRange.forEach(function(secondDataIndex, secondSubIndex) { @@ -55927,18 +55947,18 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ } return matrix2; } - SparseMatrix2.prototype.get = function(index2) { - if (!isArray2(index2)) { + SparseMatrix2.prototype.get = function(index3) { + if (!isArray2(index3)) { throw new TypeError("Array expected"); } - if (index2.length !== this._size.length) { - throw new DimensionError(index2.length, this._size.length); + if (index3.length !== this._size.length) { + throw new DimensionError(index3.length, this._size.length); } if (!this._values) { throw new Error("Cannot invoke get on a Pattern only matrix"); } - var i4 = index2[0]; - var j = index2[1]; + var i4 = index3[0]; + var j = index3[1]; validateIndex(i4, this._size[0]); validateIndex(j, this._size[1]); var k2 = _getValueIndex(i4, this._ptr[j], this._ptr[j + 1], this._index); @@ -55947,18 +55967,18 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ } return 0; }; - SparseMatrix2.prototype.set = function(index2, v2, defaultValue2) { - if (!isArray2(index2)) { + SparseMatrix2.prototype.set = function(index3, v2, defaultValue2) { + if (!isArray2(index3)) { throw new TypeError("Array expected"); } - if (index2.length !== this._size.length) { - throw new DimensionError(index2.length, this._size.length); + if (index3.length !== this._size.length) { + throw new DimensionError(index3.length, this._size.length); } if (!this._values) { throw new Error("Cannot invoke set on a Pattern only matrix"); } - var i4 = index2[0]; - var j = index2[1]; + var i4 = index3[0]; + var j = index3[1]; var rows = this._size[0]; var columns = this._size[1]; var eq = equalScalar2; @@ -55988,27 +56008,27 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ } return this; }; - function _getValueIndex(i4, top2, bottom, index2) { + function _getValueIndex(i4, top2, bottom, index3) { if (bottom - top2 === 0) { return bottom; } for (var r2 = top2; r2 < bottom; r2++) { - if (index2[r2] === i4) { + if (index3[r2] === i4) { return r2; } } return top2; } - function _remove(k2, j, values2, index2, ptr) { + function _remove(k2, j, values2, index3, ptr) { values2.splice(k2, 1); - index2.splice(k2, 1); + index3.splice(k2, 1); for (var x2 = j + 1; x2 < ptr.length; x2++) { ptr[x2]--; } } - function _insert(k2, i4, j, v2, values2, index2, ptr) { + function _insert(k2, i4, j, v2, values2, index3, ptr) { values2.splice(k2, 0, v2); - index2.splice(k2, 0, i4); + index3.splice(k2, 0, i4); for (var x2 = j + 1; x2 < ptr.length; x2++) { ptr[x2]++; } @@ -56182,7 +56202,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ }; function _map3(matrix2, minRow, maxRow, minColumn, maxColumn, callback, skipZeros) { var values2 = []; - var index2 = []; + var index3 = []; var ptr = []; var eq = equalScalar2; var zero = 0; @@ -56194,7 +56214,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ v2 = callback(v2, x2, y3); if (!eq(v2, zero)) { values2.push(v2); - index2.push(x2); + index3.push(x2); } }; for (var j = minColumn; j <= maxColumn; j++) { @@ -56223,7 +56243,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ ptr.push(values2.length); return new SparseMatrix2({ values: values2, - index: index2, + index: index3, ptr, size: [maxRow - minRow + 1, maxColumn - minColumn + 1] }); @@ -56279,7 +56299,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ SparseMatrix2.prototype.valueOf = function() { return _toArray(this._values, this._index, this._ptr, this._size, false); }; - function _toArray(values2, index2, ptr, size2, copy) { + function _toArray(values2, index3, ptr, size2, copy) { var rows = size2[0]; var columns = size2[1]; var a4 = []; @@ -56294,7 +56314,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ var k0 = ptr[j]; var k1 = ptr[j + 1]; for (var k2 = k0; k2 < k1; k2++) { - i4 = index2[k2]; + i4 = index3[k2]; a4[i4][j] = values2 ? copy ? clone(values2[k2]) : values2[k2] : 1; } } @@ -56345,7 +56365,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ var columns = this._size[1]; var n3 = Math.min(rows - kSub, columns - kSuper); var values2 = []; - var index2 = []; + var index3 = []; var ptr = []; ptr[0] = 0; for (var j = kSuper; j < columns && values2.length < n3; j++) { @@ -56355,7 +56375,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ var i4 = this._index[x2]; if (i4 === j - kSuper + kSub) { values2.push(this._values[x2]); - index2[values2.length - 1] = i4 - kSub; + index3[values2.length - 1] = i4 - kSub; break; } } @@ -56363,7 +56383,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ ptr.push(values2.length); return new SparseMatrix2({ values: values2, - index: index2, + index: index3, ptr, size: [n3, 1] }); @@ -56430,7 +56450,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ }; } var values2 = []; - var index2 = []; + var index3 = []; var ptr = []; for (var j = 0; j < columns; j++) { ptr.push(values2.length); @@ -56438,7 +56458,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ if (i4 >= 0 && i4 < n3) { var v2 = _value(i4); if (!eq(v2, zero)) { - index2.push(i4 + kSub); + index3.push(i4 + kSub); values2.push(v2); } } @@ -56446,7 +56466,7 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ ptr.push(values2.length); return new SparseMatrix2({ values: values2, - index: index2, + index: index3, ptr, size: [rows, columns] }); @@ -56463,20 +56483,20 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ SparseMatrix2._swapRows(i4, j, this._size[1], this._values, this._index, this._ptr); return this; }; - SparseMatrix2._forEachRow = function(j, values2, index2, ptr, callback) { + SparseMatrix2._forEachRow = function(j, values2, index3, ptr, callback) { var k0 = ptr[j]; var k1 = ptr[j + 1]; for (var k2 = k0; k2 < k1; k2++) { - callback(index2[k2], values2[k2]); + callback(index3[k2], values2[k2]); } }; - SparseMatrix2._swapRows = function(x2, y3, columns, values2, index2, ptr) { + SparseMatrix2._swapRows = function(x2, y3, columns, values2, index3, ptr) { for (var j = 0; j < columns; j++) { var k0 = ptr[j]; var k1 = ptr[j + 1]; - var kx = _getValueIndex(x2, k0, k1, index2); - var ky = _getValueIndex(y3, k0, k1, index2); - if (kx < k1 && ky < k1 && index2[kx] === x2 && index2[ky] === y3) { + var kx = _getValueIndex(x2, k0, k1, index3); + var ky = _getValueIndex(y3, k0, k1, index3); + if (kx < k1 && ky < k1 && index3[kx] === x2 && index3[ky] === y3) { if (values2) { var v2 = values2[kx]; values2[kx] = values2[ky]; @@ -56484,25 +56504,25 @@ var createSparseMatrixClass = /* @__PURE__ */ factory(name20, dependencies19, (_ } continue; } - if (kx < k1 && index2[kx] === x2 && (ky >= k1 || index2[ky] !== y3)) { + if (kx < k1 && index3[kx] === x2 && (ky >= k1 || index3[ky] !== y3)) { var vx = values2 ? values2[kx] : void 0; - index2.splice(ky, 0, y3); + index3.splice(ky, 0, y3); if (values2) { values2.splice(ky, 0, vx); } - index2.splice(ky <= kx ? kx + 1 : kx, 1); + index3.splice(ky <= kx ? kx + 1 : kx, 1); if (values2) { values2.splice(ky <= kx ? kx + 1 : kx, 1); } continue; } - if (ky < k1 && index2[ky] === y3 && (kx >= k1 || index2[kx] !== x2)) { + if (ky < k1 && index3[ky] === y3 && (kx >= k1 || index3[kx] !== x2)) { var vy = values2 ? values2[ky] : void 0; - index2.splice(kx, 0, x2); + index3.splice(kx, 0, x2); if (values2) { values2.splice(kx, 0, vy); } - index2.splice(kx <= ky ? ky + 1 : ky, 1); + index3.splice(kx <= ky ? ky + 1 : ky, 1); if (values2) { values2.splice(kx <= ky ? ky + 1 : ky, 1); } @@ -56555,7 +56575,7 @@ var createNumber = /* @__PURE__ */ factory(name21, dependencies20, (_ref) => { typed: typed3 } = _ref; var number6 = typed3("number", { - "": function _15() { + "": function _16() { return 0; }, number: function number7(x2) { @@ -56621,7 +56641,7 @@ var createString = /* @__PURE__ */ factory(name22, dependencies21, (_ref) => { typed: typed3 } = _ref; return typed3(name22, { - "": function _15() { + "": function _16() { return ""; }, number: format2, @@ -56649,7 +56669,7 @@ var createBoolean = /* @__PURE__ */ factory(name23, dependencies22, (_ref) => { typed: typed3 } = _ref; return typed3(name23, { - "": function _15() { + "": function _16() { return false; }, boolean: function boolean2(x2) { @@ -56690,7 +56710,7 @@ var createBignumber = /* @__PURE__ */ factory(name24, dependencies23, (_ref) => BigNumber: BigNumber2 } = _ref; return typed3("bignumber", { - "": function _15() { + "": function _16() { return new BigNumber2(0); }, number: function number6(x2) { @@ -56741,7 +56761,7 @@ var createComplex = /* @__PURE__ */ factory(name25, dependencies24, (_ref) => { Complex: Complex3 } = _ref; return typed3("complex", { - "": function _15() { + "": function _16() { return Complex3.ZERO; }, number: function number6(x2) { @@ -56831,7 +56851,7 @@ var createMatrix = /* @__PURE__ */ factory(name27, dependencies26, (_ref) => { SparseMatrix: SparseMatrix2 } = _ref; return typed3(name27, { - "": function _15() { + "": function _16() { return _create([]); }, string: function string6(format8) { @@ -56897,11 +56917,11 @@ var createMatrixFromFunction = /* @__PURE__ */ factory(name28, dependencies27, ( m4 = matrix2(format8); } m4.resize(size2); - m4.forEach(function(_15, index2) { - var val = fn(index2); + m4.forEach(function(_16, index3) { + var val = fn(index3); if (isZero2(val)) return; - m4.set(index2, val); + m4.set(index3, val); }); return m4; } @@ -60247,10 +60267,10 @@ var createMatAlgo07xSSf = /* @__PURE__ */ factory(name77, dependencies75, (_ref) }; function _scatter(m4, j, w2, x2, mark) { var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; for (var k2 = ptr[j], k1 = ptr[j + 1]; k2 < k1; k2++) { - var i4 = index2[k2]; + var i4 = index3[k2]; w2[i4] = mark; x2[i4] = values2[k2]; } @@ -60545,8 +60565,8 @@ var createColumn = /* @__PURE__ */ factory(name87, dependencies85, (_ref) => { } validateIndex(column2, value.size()[1]); var rowRange = range2(0, value.size()[0]); - var index2 = new Index2(rowRange, column2); - var result = value.subset(index2); + var index3 = new Index2(rowRange, column2); + var result = value.subset(index3); return isMatrix(result) ? result : matrix2([[result]]); } }); @@ -60702,14 +60722,14 @@ var createDiag = /* @__PURE__ */ factory(name90, dependencies88, (_ref) => { // node_modules/mathjs/lib/esm/utils/applyCallback.js var import_typed_function2 = __toESM(require_typed_function(), 1); -function applyCallback(callback, value, index2, array, mappingFnName) { +function applyCallback(callback, value, index3, array, mappingFnName) { if (import_typed_function2.default.isTypedFunction(callback)) { - var args3 = [value, index2, array]; + var args3 = [value, index3, array]; var signature3 = import_typed_function2.default.resolve(callback, args3); if (signature3) { return tryWithArgs(signature3.implementation, args3); } - var args2 = [value, index2]; + var args2 = [value, index3]; var signature2 = import_typed_function2.default.resolve(callback, args2); if (signature2) { return tryWithArgs(signature2.implementation, args2); @@ -60721,7 +60741,7 @@ function applyCallback(callback, value, index2, array, mappingFnName) { } return tryWithArgs(callback, args3); } else { - return callback(value, index2, array); + return callback(value, index3, array); } function tryWithArgs(signature, args) { try { @@ -60732,12 +60752,12 @@ function applyCallback(callback, value, index2, array, mappingFnName) { var argsDesc = []; argsDesc.push("value: ".concat(typeOf(value))); if (args.length >= 2) { - argsDesc.push("index: ".concat(typeOf(index2))); + argsDesc.push("index: ".concat(typeOf(index3))); } if (args.length >= 3) { argsDesc.push("array: ".concat(typeOf(array))); } - throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "".concat(callback.name, "(").concat(argsDesc.join(", "), ") at index ").concat(JSON.stringify(index2))); + throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "".concat(callback.name, "(").concat(argsDesc.join(", "), ") at index ").concat(JSON.stringify(index3))); } else { throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "to function ".concat(callback.name, ": ").concat(err.message)); } @@ -60764,8 +60784,8 @@ var createFilter = /* @__PURE__ */ factory(name91, dependencies89, (_ref) => { }); }); function _filterCallback(x2, callback) { - return filter(x2, function(value, index2, array) { - return applyCallback(callback, value, [index2], array, "filter"); + return filter(x2, function(value, index3, array) { + return applyCallback(callback, value, [index3], array, "filter"); }); } @@ -60803,13 +60823,13 @@ var createForEach = /* @__PURE__ */ factory(name93, dependencies91, (_ref) => { }); }); function _forEach(array, callback) { - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (Array.isArray(value)) { forEach(value, function(child, i4) { - recurse2(child, index2.concat(i4)); + recurse2(child, index3.concat(i4)); }); } else { - return applyCallback(callback, value, index2, array, "forEach"); + return applyCallback(callback, value, index3, array, "forEach"); } }; recurse(array, []); @@ -60845,7 +60865,7 @@ var createIdentity = /* @__PURE__ */ factory(name95, dependencies93, (_ref) => { SparseMatrix: SparseMatrix2 } = _ref; return typed3(name95, { - "": function _15() { + "": function _16() { return config5.matrix === "Matrix" ? matrix2([]) : []; }, string: function string6(format8) { @@ -60983,13 +61003,13 @@ var createMap2 = /* @__PURE__ */ factory(name97, dependencies95, (_ref) => { }); }); function _map(array, callback) { - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (Array.isArray(value)) { return value.map(function(child, i4) { - return recurse2(child, index2.concat(i4)); + return recurse2(child, index3.concat(i4)); }); } else { - return applyCallback(callback, value, index2, array, "map"); + return applyCallback(callback, value, index3, array, "map"); } }; return recurse(array, []); @@ -61091,7 +61111,7 @@ var createOnes = /* @__PURE__ */ factory(name99, dependencies97, (_ref) => { BigNumber: BigNumber2 } = _ref; return typed3("ones", { - "": function _15() { + "": function _16() { return config5.matrix === "Array" ? _ones([]) : _ones([], "default"); }, "...number | BigNumber | string": function numberBigNumberString(size2) { @@ -61134,10 +61154,10 @@ var createOnes = /* @__PURE__ */ factory(name99, dependencies97, (_ref) => { } function _normalize(size2) { var hasBigNumbers = false; - size2.forEach(function(value, index2, arr) { + size2.forEach(function(value, index3, arr) { if (isBigNumber(value)) { hasBigNumbers = true; - arr[index2] = value.toNumber(); + arr[index3] = value.toNumber(); } }); return hasBigNumbers; @@ -61429,7 +61449,7 @@ var createRotationMatrix = /* @__PURE__ */ factory(name104, dependencies102, (_r sin: sin3 } = _ref; return typed3(name104, { - "": function _15() { + "": function _16() { return config5.matrix === "Matrix" ? matrix2([]) : []; }, string: function string6(format8) { @@ -61540,8 +61560,8 @@ var createRow = /* @__PURE__ */ factory(name105, dependencies103, (_ref) => { } validateIndex(row2, value.size()[0]); var columnRange = range2(0, value.size()[1]); - var index2 = new Index2(row2, columnRange); - var result = value.subset(index2); + var index3 = new Index2(row2, columnRange); + var result = value.subset(index3); return isMatrix(result) ? result : matrix2([[result]]); } }); @@ -61602,56 +61622,56 @@ var createSubset = /* @__PURE__ */ factory(name108, dependencies106, (_ref) => { add: add4 } = _ref; return typed3(name108, { - "Matrix, Index": function MatrixIndex(value, index2) { - if (isEmptyIndex(index2)) { + "Matrix, Index": function MatrixIndex(value, index3) { + if (isEmptyIndex(index3)) { return matrix2(); } - validateIndexSourceSize(value, index2); - return value.subset(index2); + validateIndexSourceSize(value, index3); + return value.subset(index3); }, "Array, Index": typed3.referTo("Matrix, Index", function(subsetRef) { - return function(value, index2) { - var subsetResult = subsetRef(matrix2(value), index2); - return index2.isScalar() ? subsetResult : subsetResult.valueOf(); + return function(value, index3) { + var subsetResult = subsetRef(matrix2(value), index3); + return index3.isScalar() ? subsetResult : subsetResult.valueOf(); }; }), "Object, Index": _getObjectProperty, "string, Index": _getSubstring, - "Matrix, Index, any, any": function MatrixIndexAnyAny(value, index2, replacement, defaultValue2) { - if (isEmptyIndex(index2)) { + "Matrix, Index, any, any": function MatrixIndexAnyAny(value, index3, replacement, defaultValue2) { + if (isEmptyIndex(index3)) { return value; } - validateIndexSourceSize(value, index2); - return value.clone().subset(index2, _broadcastReplacement(replacement, index2), defaultValue2); + validateIndexSourceSize(value, index3); + return value.clone().subset(index3, _broadcastReplacement(replacement, index3), defaultValue2); }, "Array, Index, any, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) { - return function(value, index2, replacement, defaultValue2) { - var subsetResult = subsetRef(matrix2(value), index2, replacement, defaultValue2); + return function(value, index3, replacement, defaultValue2) { + var subsetResult = subsetRef(matrix2(value), index3, replacement, defaultValue2); return subsetResult.isMatrix ? subsetResult.valueOf() : subsetResult; }; }), "Array, Index, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) { - return function(value, index2, replacement) { - return subsetRef(matrix2(value), index2, replacement, void 0).valueOf(); + return function(value, index3, replacement) { + return subsetRef(matrix2(value), index3, replacement, void 0).valueOf(); }; }), "Matrix, Index, any": typed3.referTo("Matrix, Index, any, any", function(subsetRef) { - return function(value, index2, replacement) { - return subsetRef(value, index2, replacement, void 0); + return function(value, index3, replacement) { + return subsetRef(value, index3, replacement, void 0); }; }), "string, Index, string": _setSubstring, "string, Index, string, string": _setSubstring, "Object, Index, any": _setObjectProperty }); - function _broadcastReplacement(replacement, index2) { + function _broadcastReplacement(replacement, index3) { if (typeof replacement === "string") { throw new Error("can't boradcast a string"); } - if (index2._isScalar) { + if (index3._isScalar) { return replacement; } - var indexSize = index2.size(); + var indexSize = index3.size(); if (indexSize.every((d4) => d4 > 0)) { try { return add4(replacement, zeros3(indexSize)); @@ -61663,37 +61683,37 @@ var createSubset = /* @__PURE__ */ factory(name108, dependencies106, (_ref) => { } } }); -function _getSubstring(str, index2) { - if (!isIndex(index2)) { +function _getSubstring(str, index3) { + if (!isIndex(index3)) { throw new TypeError("Index expected"); } - if (isEmptyIndex(index2)) { + if (isEmptyIndex(index3)) { return ""; } - validateIndexSourceSize(Array.from(str), index2); - if (index2.size().length !== 1) { - throw new DimensionError(index2.size().length, 1); + validateIndexSourceSize(Array.from(str), index3); + if (index3.size().length !== 1) { + throw new DimensionError(index3.size().length, 1); } var strLen = str.length; - validateIndex(index2.min()[0], strLen); - validateIndex(index2.max()[0], strLen); - var range2 = index2.dimension(0); + validateIndex(index3.min()[0], strLen); + validateIndex(index3.max()[0], strLen); + var range2 = index3.dimension(0); var substr = ""; range2.forEach(function(v2) { substr += str.charAt(v2); }); return substr; } -function _setSubstring(str, index2, replacement, defaultValue2) { - if (!index2 || index2.isIndex !== true) { +function _setSubstring(str, index3, replacement, defaultValue2) { + if (!index3 || index3.isIndex !== true) { throw new TypeError("Index expected"); } - if (isEmptyIndex(index2)) { + if (isEmptyIndex(index3)) { return str; } - validateIndexSourceSize(Array.from(str), index2); - if (index2.size().length !== 1) { - throw new DimensionError(index2.size().length, 1); + validateIndexSourceSize(Array.from(str), index3); + if (index3.size().length !== 1) { + throw new DimensionError(index3.size().length, 1); } if (defaultValue2 !== void 0) { if (typeof defaultValue2 !== "string" || defaultValue2.length !== 1) { @@ -61702,14 +61722,14 @@ function _setSubstring(str, index2, replacement, defaultValue2) { } else { defaultValue2 = " "; } - var range2 = index2.dimension(0); + var range2 = index3.dimension(0); var len = range2.size()[0]; if (len !== replacement.length) { throw new DimensionError(range2.size()[0], replacement.length); } var strLen = str.length; - validateIndex(index2.min()[0]); - validateIndex(index2.max()[0]); + validateIndex(index3.min()[0]); + validateIndex(index3.max()[0]); var chars = []; for (var i4 = 0; i4 < strLen; i4++) { chars[i4] = str.charAt(i4); @@ -61726,27 +61746,27 @@ function _setSubstring(str, index2, replacement, defaultValue2) { } return chars.join(""); } -function _getObjectProperty(object, index2) { - if (isEmptyIndex(index2)) { +function _getObjectProperty(object, index3) { + if (isEmptyIndex(index3)) { return void 0; } - if (index2.size().length !== 1) { - throw new DimensionError(index2.size(), 1); + if (index3.size().length !== 1) { + throw new DimensionError(index3.size(), 1); } - var key2 = index2.dimension(0); + var key2 = index3.dimension(0); if (typeof key2 !== "string") { throw new TypeError("String expected as index to retrieve an object property"); } return getSafeProperty(object, key2); } -function _setObjectProperty(object, index2, replacement) { - if (isEmptyIndex(index2)) { +function _setObjectProperty(object, index3, replacement) { + if (isEmptyIndex(index3)) { return object; } - if (index2.size().length !== 1) { - throw new DimensionError(index2.size(), 1); + if (index3.size().length !== 1) { + throw new DimensionError(index3.size(), 1); } - var key2 = index2.dimension(0); + var key2 = index3.dimension(0); if (typeof key2 !== "string") { throw new TypeError("String expected as index to retrieve an object property"); } @@ -61815,7 +61835,7 @@ var createTranspose = /* @__PURE__ */ factory(name109, dependencies107, (_ref) = } function _sparseTranspose(m4, rows, columns) { var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var cvalues = values2 ? [] : void 0; var cindex = []; @@ -61825,8 +61845,8 @@ var createTranspose = /* @__PURE__ */ factory(name109, dependencies107, (_ref) = w2[x2] = 0; } var p, l2, j; - for (p = 0, l2 = index2.length; p < l2; p++) { - w2[index2[p]]++; + for (p = 0, l2 = index3.length; p < l2; p++) { + w2[index3[p]]++; } var sum4 = 0; for (var i4 = 0; i4 < rows; i4++) { @@ -61837,7 +61857,7 @@ var createTranspose = /* @__PURE__ */ factory(name109, dependencies107, (_ref) = cptr.push(sum4); for (j = 0; j < columns; j++) { for (var k0 = ptr[j], k1 = ptr[j + 1], k2 = k0; k2 < k1; k2++) { - var q2 = w2[index2[k2]]++; + var q2 = w2[index3[k2]]++; cindex[q2] = j; if (values2) { cvalues[q2] = clone(values2[k2]); @@ -61881,7 +61901,7 @@ var createZeros = /* @__PURE__ */ factory(name111, dependencies109, (_ref) => { BigNumber: BigNumber2 } = _ref; return typed3(name111, { - "": function _15() { + "": function _16() { return config5.matrix === "Array" ? _zeros([]) : _zeros([], "default"); }, "...number | BigNumber | string": function numberBigNumberString(size2) { @@ -61924,10 +61944,10 @@ var createZeros = /* @__PURE__ */ factory(name111, dependencies109, (_ref) => { } function _normalize(size2) { var hasBigNumbers = false; - size2.forEach(function(value, index2, arr) { + size2.forEach(function(value, index3, arr) { if (isBigNumber(value)) { hasBigNumbers = true; - arr[index2] = value.toNumber(); + arr[index3] = value.toNumber(); } }); return hasBigNumbers; @@ -61975,12 +61995,12 @@ var createFft = /* @__PURE__ */ factory(name112, dependencies110, (_ref) => { function _1dFft(arr, dim) { var size2 = arraySize(arr); if (dim !== 0) - return new Array(size2[0]).fill(0).map((_15, i4) => _1dFft(arr[i4], dim - 1)); + return new Array(size2[0]).fill(0).map((_16, i4) => _1dFft(arr[i4], dim - 1)); if (size2.length === 1) return _fft(arr); function _transpose(arr2) { var size3 = arraySize(arr2); - return new Array(size3[1]).fill(0).map((_15, j) => new Array(size3[0]).fill(0).map((_16, i4) => arr2[i4][j])); + return new Array(size3[1]).fill(0).map((_16, j) => new Array(size3[0]).fill(0).map((_17, i4) => arr2[i4][j])); } return _transpose(_1dFft(_transpose(arr), 1)); } @@ -61992,11 +62012,11 @@ var createFft = /* @__PURE__ */ factory(name112, dependencies110, (_ref) => { chirp.push(pow3(w2, divideScalar2(pow3(i4, 2), 2))); } var N2 = pow3(2, ceil3(log25(n3 + n3 - 1))); - var xp = [...new Array(n3).fill(0).map((_15, i5) => multiplyScalar2(arr[i5], chirp[n3 - 1 + i5])), ...new Array(N2 - n3).fill(0)]; - var ichirp = [...new Array(n3 + n3 - 1).fill(0).map((_15, i5) => divideScalar2(1, chirp[i5])), ...new Array(N2 - (n3 + n3 - 1)).fill(0)]; + var xp = [...new Array(n3).fill(0).map((_16, i5) => multiplyScalar2(arr[i5], chirp[n3 - 1 + i5])), ...new Array(N2 - n3).fill(0)]; + var ichirp = [...new Array(n3 + n3 - 1).fill(0).map((_16, i5) => divideScalar2(1, chirp[i5])), ...new Array(N2 - (n3 + n3 - 1)).fill(0)]; var fftXp = _fft(xp); var fftIchirp = _fft(ichirp); - var fftProduct = new Array(N2).fill(0).map((_15, i5) => multiplyScalar2(fftXp[i5], fftIchirp[i5])); + var fftProduct = new Array(N2).fill(0).map((_16, i5) => multiplyScalar2(fftXp[i5], fftIchirp[i5])); var ifftProduct = dotDivide2(conj2(_ndFft(conj2(fftProduct))), N2); var ret = []; for (var _i = n3 - 1; _i < n3 + n3 - 1; _i++) { @@ -62009,7 +62029,7 @@ var createFft = /* @__PURE__ */ factory(name112, dependencies110, (_ref) => { if (len === 1) return [arr[0]]; if (len % 2 === 0) { - var ret = [..._fft(arr.filter((_15, i4) => i4 % 2 === 0), len / 2), ..._fft(arr.filter((_15, i4) => i4 % 2 === 1), len / 2)]; + var ret = [..._fft(arr.filter((_16, i4) => i4 % 2 === 0), len / 2), ..._fft(arr.filter((_16, i4) => i4 % 2 === 1), len / 2)]; for (var k2 = 0; k2 < len / 2; k2++) { var p = ret[k2]; var q2 = multiplyScalar2(ret[k2 + len / 2], exp3(multiplyScalar2(multiplyScalar2(tau3, I2), divideScalar2(-k2, len)))); @@ -62423,7 +62443,7 @@ var createMode = /* @__PURE__ */ factory(name117, dependencies115, (_ref) => { } = _ref; return typed3(name117, { "Array | Matrix": _mode, - "...": function _15(args) { + "...": function _16(args) { return _mode(args); } }); @@ -62485,7 +62505,7 @@ var createProd = /* @__PURE__ */ factory(name118, dependencies116, (_ref) => { "Array | Matrix, number | BigNumber": function ArrayMatrixNumberBigNumber(array, dim) { throw new Error("prod(A, dim) is not yet supported"); }, - "...": function _15(args) { + "...": function _16(args) { return _prod(args); } }); @@ -63345,10 +63365,10 @@ function createSolveValidation(_ref) { data2[_i2] = [0]; } var values2 = b2._values; - var index2 = b2._index; + var index3 = b2._index; var ptr = b2._ptr; for (var k1 = ptr[1], k2 = ptr[0]; k2 < k1; k2++) { - var _i3 = index2[k2]; + var _i3 = index3[k2]; data2[_i3][0] = values2[k2]; } return new DenseMatrix2({ @@ -63455,7 +63475,7 @@ var createLsolve = /* @__PURE__ */ factory(name135, dependencies133, (_ref) => { var rows = m4._size[0]; var columns = m4._size[1]; var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var x2 = []; for (var j = 0; j < columns; j++) { @@ -63467,7 +63487,7 @@ var createLsolve = /* @__PURE__ */ factory(name135, dependencies133, (_ref) => { var firstIndex = ptr[j]; var lastIndex = ptr[j + 1]; for (var k2 = firstIndex; k2 < lastIndex; k2++) { - var i4 = index2[k2]; + var i4 = index3[k2]; if (i4 === j) { vjj = values2[k2]; } else if (i4 > j) { @@ -63559,7 +63579,7 @@ var createUsolve = /* @__PURE__ */ factory(name136, dependencies134, (_ref) => { var rows = m4._size[0]; var columns = m4._size[1]; var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var x2 = []; for (var j = columns - 1; j >= 0; j--) { @@ -63571,7 +63591,7 @@ var createUsolve = /* @__PURE__ */ factory(name136, dependencies134, (_ref) => { var firstIndex = ptr[j]; var lastIndex = ptr[j + 1]; for (var k2 = lastIndex - 1; k2 >= firstIndex; k2--) { - var i4 = index2[k2]; + var i4 = index3[k2]; if (i4 === j) { vjj = values2[k2]; } else if (i4 < j) { @@ -63670,7 +63690,7 @@ var createLsolveAll = /* @__PURE__ */ factory(name137, dependencies135, (_ref) = var rows = m4._size[0]; var columns = m4._size[1]; var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; for (var i4 = 0; i4 < columns; i4++) { var L2 = B2.length; @@ -63682,7 +63702,7 @@ var createLsolveAll = /* @__PURE__ */ factory(name137, dependencies135, (_ref) = var lastIndex = ptr[i4 + 1]; var Mii = 0; for (var j = firstIndex; j < lastIndex; j++) { - var J = index2[j]; + var J = index3[j]; if (J === i4) { Mii = values2[j]; } else if (J > i4) { @@ -63793,7 +63813,7 @@ var createUsolveAll = /* @__PURE__ */ factory(name138, dependencies136, (_ref) = var rows = m4._size[0]; var columns = m4._size[1]; var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; for (var i4 = columns - 1; i4 >= 0; i4--) { var L2 = B2.length; @@ -63805,7 +63825,7 @@ var createUsolveAll = /* @__PURE__ */ factory(name138, dependencies136, (_ref) = var lastIndex = ptr[i4 + 1]; var Mii = 0; for (var j = lastIndex - 1; j >= firstIndex; j--) { - var J = index2[j]; + var J = index3[j]; if (J === i4) { Mii = values2[j]; } else if (J < i4) { @@ -65051,7 +65071,7 @@ var createMax = /* @__PURE__ */ factory(name157, dependencies155, (_ref) => { "Array | Matrix, number | BigNumber": function ArrayMatrixNumberBigNumber(array, dim) { return reduce(array, dim.valueOf(), _largest); }, - "...": function _15(args) { + "...": function _16(args) { if (containsCollections(args)) { throw new TypeError("Scalar values expected in function max"); } @@ -65103,7 +65123,7 @@ var createMin = /* @__PURE__ */ factory(name158, dependencies156, (_ref) => { "Array | Matrix, number | BigNumber": function ArrayMatrixNumberBigNumber(array, dim) { return reduce(array, dim.valueOf(), _smallest); }, - "...": function _15(args) { + "...": function _16(args) { if (containsCollections(args)) { throw new TypeError("Scalar values expected in function min"); } @@ -65181,10 +65201,10 @@ var createImmutableDenseMatrixClass = /* @__PURE__ */ factory(name159, dependenc ImmutableDenseMatrix2.prototype = new DenseMatrix2(); ImmutableDenseMatrix2.prototype.type = "ImmutableDenseMatrix"; ImmutableDenseMatrix2.prototype.isImmutableDenseMatrix = true; - ImmutableDenseMatrix2.prototype.subset = function(index2) { + ImmutableDenseMatrix2.prototype.subset = function(index3) { switch (arguments.length) { case 1: { - var m4 = DenseMatrix2.prototype.subset.call(this, index2); + var m4 = DenseMatrix2.prototype.subset.call(this, index3); if (isMatrix(m4)) { return new ImmutableDenseMatrix2({ data: m4._data, @@ -65320,16 +65340,16 @@ var createIndexClass = /* @__PURE__ */ factory(name160, dependencies158, (_ref) return new ImmutableDenseMatrix2(arg2); } Index2.prototype.clone = function() { - var index2 = new Index2(); - index2._dimensions = clone(this._dimensions); - index2._isScalar = this._isScalar; - index2._sourceSize = this._sourceSize; - return index2; + var index3 = new Index2(); + index3._dimensions = clone(this._dimensions); + index3._isScalar = this._isScalar; + index3._sourceSize = this._sourceSize; + return index3; }; Index2.create = function(ranges) { - var index2 = new Index2(); - Index2.apply(index2, ranges); - return index2; + var index3 = new Index2(); + Index2.apply(index3, ranges); + return index3; }; Index2.prototype.size = function() { var size2 = []; @@ -65816,7 +65836,7 @@ var createUnitClass = /* @__PURE__ */ factory(name163, dependencies161, (_ref) = Unit2.prototype.constructor = Unit2; Unit2.prototype.type = "Unit"; Unit2.prototype.isUnit = true; - var text2, index2, c3; + var text2, index3, c3; function skipWhitespace() { while (c3 === " " || c3 === " ") { next(); @@ -65829,16 +65849,16 @@ var createUnitClass = /* @__PURE__ */ factory(name163, dependencies161, (_ref) = return c4 >= "0" && c4 <= "9"; } function next() { - index2++; - c3 = text2.charAt(index2); + index3++; + c3 = text2.charAt(index3); } function revert(oldIndex) { - index2 = oldIndex; - c3 = text2.charAt(index2); + index3 = oldIndex; + c3 = text2.charAt(index3); } function parseNumber() { var number6 = ""; - var oldIndex = index2; + var oldIndex = index3; if (c3 === "+") { next(); } else if (c3 === "-") { @@ -65872,7 +65892,7 @@ var createUnitClass = /* @__PURE__ */ factory(name163, dependencies161, (_ref) = } if (c3 === "E" || c3 === "e") { var tentativeNumber = ""; - var tentativeIndex = index2; + var tentativeIndex = index3; tentativeNumber += c3; next(); if (c3 === "+" || c3 === "-") { @@ -65915,7 +65935,7 @@ var createUnitClass = /* @__PURE__ */ factory(name163, dependencies161, (_ref) = Unit2.parse = function(str, options) { options = options || {}; text2 = str; - index2 = -1; + index3 = -1; c3 = ""; if (typeof text2 !== "string") { throw new TypeError("Invalid argument in Unit.parse, string expected"); @@ -65965,7 +65985,7 @@ var createUnitClass = /* @__PURE__ */ factory(name163, dependencies161, (_ref) = var oldC = c3; uStr = parseUnit(); if (uStr === null) { - throw new SyntaxError('Unexpected "' + oldC + '" in "' + text2 + '" at index ' + index2.toString()); + throw new SyntaxError('Unexpected "' + oldC + '" in "' + text2 + '" at index ' + index3.toString()); } } else { break; @@ -65995,7 +66015,7 @@ var createUnitClass = /* @__PURE__ */ factory(name163, dependencies161, (_ref) = skipWhitespace(); while (c3 === ")") { if (powerMultiplierStack.length === 0) { - throw new SyntaxError('Unmatched ")" in "' + text2 + '" at index ' + index2.toString()); + throw new SyntaxError('Unmatched ")" in "' + text2 + '" at index ' + index3.toString()); } powerMultiplierStackProduct /= powerMultiplierStack.pop(); next(); @@ -69046,7 +69066,7 @@ var createSparse = /* @__PURE__ */ factory(name165, dependencies163, (_ref) => { SparseMatrix: SparseMatrix2 } = _ref; return typed3(name165, { - "": function _15() { + "": function _16() { return new SparseMatrix2([]); }, string: function string6(datatype) { @@ -70155,7 +70175,7 @@ var createNorm = /* @__PURE__ */ factory(name204, dependencies202, (_ref) => { } function _matrixNormFrobenius(x2) { var fro = 0; - x2.forEach(function(value, index2) { + x2.forEach(function(value, index3) { fro = add4(fro, multiply2(value, conj2(value))); }); return abs3(sqrt3(fro)); @@ -70163,8 +70183,8 @@ var createNorm = /* @__PURE__ */ factory(name204, dependencies202, (_ref) => { function _matrixNormOne(x2) { var c3 = []; var maxc = 0; - x2.forEach(function(value, index2) { - var j = index2[1]; + x2.forEach(function(value, index3) { + var j = index3[1]; var cj = add4(c3[j] || 0, abs3(value)); if (larger2(cj, maxc)) { maxc = cj; @@ -70187,8 +70207,8 @@ var createNorm = /* @__PURE__ */ factory(name204, dependencies202, (_ref) => { function _matrixNormInfinity(x2) { var r2 = []; var maxr = 0; - x2.forEach(function(value, index2) { - var i4 = index2[0]; + x2.forEach(function(value, index3) { + var i4 = index3[0]; var ri = add4(r2[i4] || 0, abs3(value)); if (larger2(ri, maxr)) { maxr = ri; @@ -70390,7 +70410,7 @@ var createTrace = /* @__PURE__ */ factory(name206, dependencies204, (_ref) => { } function _sparseTrace(m4) { var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var size2 = m4._size; var rows = size2[0]; @@ -70402,7 +70422,7 @@ var createTrace = /* @__PURE__ */ factory(name206, dependencies204, (_ref) => { var k0 = ptr[j]; var k1 = ptr[j + 1]; for (var k2 = k0; k2 < k1; k2++) { - var i4 = index2[k2]; + var i4 = index3[k2]; if (i4 === j) { sum4 = add4(sum4, values2[k2]); break; @@ -70614,19 +70634,19 @@ function accessFactory(_ref) { var { subset: subset2 } = _ref; - return function access(object, index2) { + return function access(object, index3) { try { if (Array.isArray(object)) { - return subset2(object, index2); + return subset2(object, index3); } else if (object && typeof object.subset === "function") { - return object.subset(index2); + return object.subset(index3); } else if (typeof object === "string") { - return subset2(object, index2); + return subset2(object, index3); } else if (typeof object === "object") { - if (!index2.isObjectProperty()) { + if (!index3.isObjectProperty()) { throw new TypeError("Cannot apply a numeric index as object property"); } - return getSafeProperty(object, index2.getObjectProperty()); + return getSafeProperty(object, index3.getObjectProperty()); } else { throw new TypeError("Cannot apply index: unsupported type of object"); } @@ -70651,16 +70671,16 @@ var createAccessorNode = /* @__PURE__ */ factory(name209, dependencies207, (_ref return !(isAccessorNode(node) || isArrayNode(node) || isConstantNode(node) || isFunctionNode(node) || isObjectNode(node) || isParenthesisNode(node) || isSymbolNode(node)); } class AccessorNode2 extends Node4 { - constructor(object, index2) { + constructor(object, index3) { super(); if (!isNode2(object)) { throw new TypeError('Node expected for parameter "object"'); } - if (!isIndexNode(index2)) { + if (!isIndexNode(index3)) { throw new TypeError('IndexNode expected for parameter "index"'); } this.object = object; - this.index = index2; + this.index = index3; } get name() { if (this.index) { @@ -70686,8 +70706,8 @@ var createAccessorNode = /* @__PURE__ */ factory(name209, dependencies207, (_ref } else { return function evalAccessorNode(scope, args, context) { var object = evalObject(scope, args, context); - var index2 = evalIndex(scope, args, object); - return access(object, index2); + var index3 = evalIndex(scope, args, object); + return access(object, index3); }; } } @@ -70848,23 +70868,23 @@ function assignFactory(_ref) { subset: subset2, matrix: matrix2 } = _ref; - return function assign(object, index2, value) { + return function assign(object, index3, value) { try { if (Array.isArray(object)) { - var result = matrix2(object).subset(index2, value).valueOf(); - result.forEach((item, index3) => { - object[index3] = item; + var result = matrix2(object).subset(index3, value).valueOf(); + result.forEach((item, index4) => { + object[index4] = item; }); return object; } else if (object && typeof object.subset === "function") { - return object.subset(index2, value); + return object.subset(index3, value); } else if (typeof object === "string") { - return subset2(object, index2, value); + return subset2(object, index3, value); } else if (typeof object === "object") { - if (!index2.isObjectProperty()) { + if (!index3.isObjectProperty()) { throw TypeError("Cannot apply a numeric index as object property"); } - setSafeProperty(object, index2.getObjectProperty(), value); + setSafeProperty(object, index3.getObjectProperty(), value); return object; } else { throw new TypeError("Cannot apply index: unsupported type of object"); @@ -71100,11 +71120,11 @@ function getAssociativity(_node, parenthesis) { node = _node.getContent(); } var identifier = node.getIdentifier(); - var index2 = getPrecedence(node, parenthesis); - if (index2 === null) { + var index3 = getPrecedence(node, parenthesis); + if (index3 === null) { return null; } - var property = properties2[index2][identifier]; + var property = properties2[index3][identifier]; if (hasOwnProperty2(property, "associativity")) { if (property.associativity === "left") { return "left"; @@ -71121,11 +71141,11 @@ function isAssociativeWith(nodeA, nodeB, parenthesis) { var b2 = parenthesis !== "keep" ? nodeA.getContent() : nodeB; var identifierA = a4.getIdentifier(); var identifierB = b2.getIdentifier(); - var index2 = getPrecedence(a4, parenthesis); - if (index2 === null) { + var index3 = getPrecedence(a4, parenthesis); + if (index3 === null) { return null; } - var property = properties2[index2][identifierA]; + var property = properties2[index3][identifierA]; if (hasOwnProperty2(property, "associativeWith") && property.associativeWith instanceof Array) { for (var i4 = 0; i4 < property.associativeWith.length; i4++) { if (property.associativeWith[i4] === identifierB) { @@ -71175,11 +71195,11 @@ var createAssignmentNode = /* @__PURE__ */ factory(name211, dependencies209, (_r return parenthesis === "all" || exprPrecedence !== null && exprPrecedence <= precedence; } class AssignmentNode2 extends Node4 { - constructor(object, index2, value) { + constructor(object, index3, value) { super(); this.object = object; - this.index = value ? index2 : null; - this.value = value || index2; + this.index = value ? index3 : null; + this.value = value || index3; if (!isSymbolNode(object) && !isAccessorNode(object)) { throw new TypeError('SymbolNode or AccessorNode expected as "object"'); } @@ -71232,8 +71252,8 @@ var createAssignmentNode = /* @__PURE__ */ factory(name211, dependencies209, (_r return function evalAssignmentNode(scope, args, context) { var childObject = evalObject(scope, args, context); var value = evalValue(scope, args, context); - var index2 = evalIndex(scope, args, childObject); - scope.set(name319, assign(childObject, index2, value)); + var index3 = evalIndex(scope, args, childObject); + scope.set(name319, assign(childObject, index3, value)); return value; }; } else { @@ -71243,9 +71263,9 @@ var createAssignmentNode = /* @__PURE__ */ factory(name211, dependencies209, (_r return function evalAssignmentNode(scope, args, context) { var parent = evalParentObject(scope, args, context); var childObject = getSafeProperty(parent, parentProp); - var index2 = evalIndex(scope, args, childObject); + var index3 = evalIndex(scope, args, childObject); var value = evalValue(scope, args, context); - setSafeProperty(parent, parentProp, assign(childObject, index2, value)); + setSafeProperty(parent, parentProp, assign(childObject, index3, value)); return value; }; } else { @@ -71254,9 +71274,9 @@ var createAssignmentNode = /* @__PURE__ */ factory(name211, dependencies209, (_r var parent = evalParentObject(scope, args, context); var parentIndex = evalParentIndex(scope, args, parent); var childObject = access(parent, parentIndex); - var index2 = evalIndex(scope, args, childObject); + var index3 = evalIndex(scope, args, childObject); var value = evalValue(scope, args, context); - assign(parent, parentIndex, assign(childObject, index2, value)); + assign(parent, parentIndex, assign(childObject, index3, value)); return value; }; } @@ -71271,21 +71291,21 @@ var createAssignmentNode = /* @__PURE__ */ factory(name211, dependencies209, (_r } map(callback) { var object = this._ifNode(callback(this.object, "object", this)); - var index2 = this.index ? this._ifNode(callback(this.index, "index", this)) : null; + var index3 = this.index ? this._ifNode(callback(this.index, "index", this)) : null; var value = this._ifNode(callback(this.value, "value", this)); - return new AssignmentNode2(object, index2, value); + return new AssignmentNode2(object, index3, value); } clone() { return new AssignmentNode2(this.object, this.index, this.value); } _toString(options) { var object = this.object.toString(options); - var index2 = this.index ? this.index.toString(options) : ""; + var index3 = this.index ? this.index.toString(options) : ""; var value = this.value.toString(options); if (needParenthesis(this, options && options.parenthesis, options && options.implicit)) { value = "(" + value + ")"; } - return object + index2 + " = " + value; + return object + index3 + " = " + value; } toJSON() { return { @@ -71300,21 +71320,21 @@ var createAssignmentNode = /* @__PURE__ */ factory(name211, dependencies209, (_r } _toHTML(options) { var object = this.object.toHTML(options); - var index2 = this.index ? this.index.toHTML(options) : ""; + var index3 = this.index ? this.index.toHTML(options) : ""; var value = this.value.toHTML(options); if (needParenthesis(this, options && options.parenthesis, options && options.implicit)) { value = '(' + value + ')'; } - return object + index2 + '=' + value; + return object + index3 + '=' + value; } _toTex(options) { var object = this.object.toTex(options); - var index2 = this.index ? this.index.toTex(options) : ""; + var index3 = this.index ? this.index.toTex(options) : ""; var value = this.value.toTex(options); if (needParenthesis(this, options && options.parenthesis, options && options.implicit)) { value = "\\left(".concat(value, "\\right)"); } - return object + index2 + "=" + value; + return object + index3 + "=" + value; } } _defineProperty(AssignmentNode2, "name", name211); @@ -72093,9 +72113,9 @@ var createConstantNode = /* @__PURE__ */ factory(name214, dependencies212, (_ref if (!finite) { return this.value.valueOf() < 0 ? "-\\infty" : "\\infty"; } - var index2 = value.toLowerCase().indexOf("e"); - if (index2 !== -1) { - return value.substring(0, index2) + "\\cdot10^{" + value.substring(index2 + 1) + "}"; + var index3 = value.toLowerCase().indexOf("e"); + if (index3 !== -1) { + return value.substring(0, index3) + "\\cdot10^{" + value.substring(index3 + 1) + "}"; } return value; } @@ -72213,10 +72233,10 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(name215, dependencies return { mathjs: name215, name: this.name, - params: this.params.map(function(param, index2) { + params: this.params.map(function(param, index3) { return { name: param, - type: types2[index2] + type: types2[index3] }; }), expr: this.expr @@ -72299,12 +72319,12 @@ var createIndexNode = /* @__PURE__ */ factory(name216, dependencies214, (_ref) = return dimension._compile(math2, argNames); } }); - var index2 = getSafeProperty(math2, "index"); + var index3 = getSafeProperty(math2, "index"); return function evalIndexNode(scope, args, context) { var dimensions = map(evalDimensions, function(evalDimension) { return evalDimension(scope, args, context); }); - return index2(...dimensions); + return index3(...dimensions); }; } forEach(callback) { @@ -72759,9 +72779,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name218, dependencies216, (_ref } return lhs + " " + this.op + " " + rhs; } else if (args.length > 2 && (this.getIdentifier() === "OperatorNode:add" || this.getIdentifier() === "OperatorNode:multiply")) { - var stringifiedArgs = args.map(function(arg2, index2) { + var stringifiedArgs = args.map(function(arg2, index3) { arg2 = arg2.toString(options); - if (parens[index2]) { + if (parens[index3]) { arg2 = "(" + arg2 + ")"; } return arg2; @@ -72817,9 +72837,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name218, dependencies216, (_ref } return lhs + '' + escape(this.op) + "" + rhs; } else { - var stringifiedArgs = args.map(function(arg2, index2) { + var stringifiedArgs = args.map(function(arg2, index3) { arg2 = arg2.toHTML(options); - if (parens[index2]) { + if (parens[index3]) { arg2 = '(' + arg2 + ')'; } return arg2; @@ -72889,9 +72909,9 @@ var createOperatorNode = /* @__PURE__ */ factory(name218, dependencies216, (_ref } return lhsTex + op + rhsTex; } else if (args.length > 2 && (this.getIdentifier() === "OperatorNode:add" || this.getIdentifier() === "OperatorNode:multiply")) { - var texifiedArgs = args.map(function(arg2, index2) { + var texifiedArgs = args.map(function(arg2, index3) { arg2 = arg2.toTex(options); - if (parens[index2]) { + if (parens[index3]) { arg2 = "\\left(".concat(arg2, "\\right)"); } return arg2; @@ -73215,7 +73235,7 @@ var createRelationalNode = /* @__PURE__ */ factory(name221, dependencies219, (_r _toString(options) { var parenthesis = options && options.parenthesis ? options.parenthesis : "keep"; var precedence = getPrecedence(this, parenthesis, options && options.implicit); - var paramStrings = this.params.map(function(p, index2) { + var paramStrings = this.params.map(function(p, index3) { var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit); return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "(" + p.toString(options) + ")" : p.toString(options); }); @@ -73239,7 +73259,7 @@ var createRelationalNode = /* @__PURE__ */ factory(name221, dependencies219, (_r _toHTML(options) { var parenthesis = options && options.parenthesis ? options.parenthesis : "keep"; var precedence = getPrecedence(this, parenthesis, options && options.implicit); - var paramStrings = this.params.map(function(p, index2) { + var paramStrings = this.params.map(function(p, index3) { var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit); return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? '(' + p.toHTML(options) + ')' : p.toHTML(options); }); @@ -73252,7 +73272,7 @@ var createRelationalNode = /* @__PURE__ */ factory(name221, dependencies219, (_r _toTex(options) { var parenthesis = options && options.parenthesis ? options.parenthesis : "keep"; var precedence = getPrecedence(this, parenthesis, options && options.implicit); - var paramStrings = this.params.map(function(p, index2) { + var paramStrings = this.params.map(function(p, index3) { var paramPrecedence = getPrecedence(p, parenthesis, options && options.implicit); return parenthesis === "all" || paramPrecedence !== null && paramPrecedence <= precedence ? "\\left(" + p.toTex(options) + "\right)" : p.toTex(options); }); @@ -73410,11 +73430,11 @@ var createFunctionNode = /* @__PURE__ */ factory(name223, dependencies221, (_ref if (isNode2(property)) { latex += property.toTex(options); } else if (Array.isArray(property)) { - latex += property.map(function(arg2, index2) { + latex += property.map(function(arg2, index3) { if (isNode2(arg2)) { return arg2.toTex(options); } - throw new TypeError("Template: " + match2[1] + "[" + index2 + "] is not a Node."); + throw new TypeError("Template: " + match2[1] + "[" + index3 + "] is not a Node."); }).join(","); } else { throw new TypeError("Template: " + match2[1] + " has to be a Node, String or array of Nodes"); @@ -74072,9 +74092,9 @@ var createParse = /* @__PURE__ */ factory(name224, dependencies222, (_ref) => { valid = true; args = []; name319 = node.name; - node.args.forEach(function(arg2, index2) { + node.args.forEach(function(arg2, index3) { if (isSymbolNode(arg2)) { - args[index2] = arg2.name; + args[index3] = arg2.name; } else { valid = false; } @@ -74795,7 +74815,7 @@ var createParser = /* @__PURE__ */ factory(name228, dependencies226, (_ref) => { Parser: Parser8 } = _ref; return typed3(name228, { - "": function _15() { + "": function _16() { return new Parser8(); } }); @@ -74947,7 +74967,7 @@ var createLup = /* @__PURE__ */ factory(name229, dependencies227, (_ref) => { var columns = m4._size[1]; var n3 = Math.min(rows, columns); var values2 = m4._values; - var index2 = m4._index; + var index3 = m4._index; var ptr = m4._ptr; var lvalues = []; var lindex = []; @@ -74983,7 +75003,7 @@ var createLup = /* @__PURE__ */ factory(name229, dependencies227, (_ref) => { var k0 = ptr[j]; var k1 = ptr[j + 1]; for (k2 = k0; k2 < k1; k2++) { - i4 = index2[k2]; + i4 = index3[k2]; spa.set(pvCo[i4], values2[k2]); } if (j > 0) { @@ -75915,7 +75935,7 @@ function csUnflip(i4) { // node_modules/mathjs/lib/esm/function/algebra/sparse/csDfs.js function csDfs(j, g, top2, xi, pinv2) { - var index2 = g._index; + var index3 = g._index; var ptr = g._ptr; var size2 = g._size; var n3 = size2[1]; @@ -75931,7 +75951,7 @@ function csDfs(j, g, top2, xi, pinv2) { } var done = 1; for (p = xi[n3 + head], p2 = jnew < 0 ? 0 : csUnflip(ptr[jnew + 1]); p < p2; p++) { - i4 = index2[p]; + i4 = index3[p]; if (csMarked(ptr, i4)) { continue; } @@ -79470,7 +79490,7 @@ var createChain = /* @__PURE__ */ factory(name242, dependencies240, (_ref) => { Chain: Chain2 } = _ref; return typed3(name242, { - "": function _15() { + "": function _16() { return new Chain2(); }, any: function any(value) { @@ -79542,7 +79562,7 @@ var createDet = /* @__PURE__ */ factory(name243, dependencies241, (_ref) => { return subtractScalar2(multiply2(matrix3[0][0], matrix3[1][1]), multiply2(matrix3[1][0], matrix3[0][1])); } else { var negated = false; - var rowIndices = new Array(rows).fill(0).map((_15, i5) => i5); + var rowIndices = new Array(rows).fill(0).map((_16, i5) => i5); for (var k2 = 0; k2 < rows; k2++) { var k_ = rowIndices[k2]; if (isZero2(matrix3[k_][k2])) { @@ -79805,8 +79825,8 @@ var createPinv = /* @__PURE__ */ factory(name245, dependencies243, (_ref) => { } function _rankFact(mat, rows, cols) { var rref = _rref(mat, rows, cols); - var C2 = mat.map((_15, i4) => _15.filter((_16, j) => j < rows && !_isZero(dot2(rref[j], rref[j])))); - var F = rref.filter((_15, i4) => !_isZero(dot2(rref[i4], rref[i4]))); + var C2 = mat.map((_16, i4) => _16.filter((_17, j) => j < rows && !_isZero(dot2(rref[j], rref[j])))); + var F = rref.filter((_16, i4) => !_isZero(dot2(rref[i4], rref[i4]))); return { C: C2, F @@ -80202,7 +80222,7 @@ function createComplexEigs(_ref) { function randomOrthogonalVector(N, orthog, type) { var big = type === "BigNumber"; var cplx = type === "Complex"; - var v2 = Array(N).fill(0).map((_15) => 2 * Math.random() - 1); + var v2 = Array(N).fill(0).map((_16) => 2 * Math.random() - 1); if (big) { v2 = v2.map((n3) => bignumber2(n3)); } @@ -80895,7 +80915,7 @@ var createSylvester = /* @__PURE__ */ factory(name249, dependencies247, (_ref) = range: range2, concat: concat3, transpose: transpose2, - index: index2, + index: index3, subset: subset2, add: add4, subtract: subtract3, @@ -80942,26 +80962,26 @@ var createSylvester = /* @__PURE__ */ factory(name249, dependencies247, (_ref) = var hc = (a4, b2) => concat3(a4, b2, 1); var vc = (a4, b2) => concat3(a4, b2, 0); for (var k2 = 0; k2 < n3; k2++) { - if (k2 < n3 - 1 && abs3(subset2(G2, index2(k2 + 1, k2))) > 1e-5) { - var RHS = vc(subset2(D2, index2(all2, k2)), subset2(D2, index2(all2, k2 + 1))); + if (k2 < n3 - 1 && abs3(subset2(G2, index3(k2 + 1, k2))) > 1e-5) { + var RHS = vc(subset2(D2, index3(all2, k2)), subset2(D2, index3(all2, k2 + 1))); for (var j = 0; j < k2; j++) { - RHS = add4(RHS, vc(multiply2(y3[j], subset2(G2, index2(j, k2))), multiply2(y3[j], subset2(G2, index2(j, k2 + 1))))); + RHS = add4(RHS, vc(multiply2(y3[j], subset2(G2, index3(j, k2))), multiply2(y3[j], subset2(G2, index3(j, k2 + 1))))); } - var gkk = multiply2(identity2(m4), multiply2(-1, subset2(G2, index2(k2, k2)))); - var gmk = multiply2(identity2(m4), multiply2(-1, subset2(G2, index2(k2 + 1, k2)))); - var gkm = multiply2(identity2(m4), multiply2(-1, subset2(G2, index2(k2, k2 + 1)))); - var gmm = multiply2(identity2(m4), multiply2(-1, subset2(G2, index2(k2 + 1, k2 + 1)))); + var gkk = multiply2(identity2(m4), multiply2(-1, subset2(G2, index3(k2, k2)))); + var gmk = multiply2(identity2(m4), multiply2(-1, subset2(G2, index3(k2 + 1, k2)))); + var gkm = multiply2(identity2(m4), multiply2(-1, subset2(G2, index3(k2, k2 + 1)))); + var gmm = multiply2(identity2(m4), multiply2(-1, subset2(G2, index3(k2 + 1, k2 + 1)))); var LHS = vc(hc(add4(F, gkk), gmk), hc(gkm, add4(F, gmm))); var yAux = lusolve2(LHS, RHS); - y3[k2] = yAux.subset(index2(range2(0, m4), 0)); - y3[k2 + 1] = yAux.subset(index2(range2(m4, 2 * m4), 0)); + y3[k2] = yAux.subset(index3(range2(0, m4), 0)); + y3[k2 + 1] = yAux.subset(index3(range2(m4, 2 * m4), 0)); k2++; } else { - var _RHS = subset2(D2, index2(all2, k2)); + var _RHS = subset2(D2, index3(all2, k2)); for (var _j = 0; _j < k2; _j++) { - _RHS = add4(_RHS, multiply2(y3[_j], subset2(G2, index2(_j, k2)))); + _RHS = add4(_RHS, multiply2(y3[_j], subset2(G2, index3(_j, k2)))); } - var _gkk = subset2(G2, index2(k2, k2)); + var _gkk = subset2(G2, index3(k2, k2)); var _LHS = subtract3(F, multiply2(_gkk, identity2(m4))); y3[k2] = lusolve2(_LHS, _RHS); } @@ -81509,7 +81529,7 @@ var createSum = /* @__PURE__ */ factory(name255, dependencies253, (_ref) => { return typed3(name255, { "Array | Matrix": _sum, "Array | Matrix, number | BigNumber": _nsumDim, - "...": function _15(args) { + "...": function _16(args) { if (containsCollections(args)) { throw new TypeError("Scalar values expected in function sum"); } @@ -81561,7 +81581,7 @@ var createCumSum = /* @__PURE__ */ factory(name256, dependencies254, (_ref) => { "Matrix, number | BigNumber": function MatrixNumberBigNumber(matrix2, dim) { return matrix2.create(_ncumSumDim(matrix2.valueOf(), dim)); }, - "...": function _15(args) { + "...": function _16(args) { if (containsCollections(args)) { throw new TypeError("All values expected to be scalar in function cumsum"); } @@ -81632,7 +81652,7 @@ var createMean = /* @__PURE__ */ factory(name257, dependencies255, (_ref) => { return typed3(name257, { "Array | Matrix": _mean, "Array | Matrix, number | BigNumber": _nmeanDim, - "...": function _15(args) { + "...": function _16(args) { if (containsCollections(args)) { throw new TypeError("Scalar values expected in function mean"); } @@ -81717,7 +81737,7 @@ var createMedian = /* @__PURE__ */ factory(name258, dependencies256, (_ref) => { "Array | Matrix, number | BigNumber": function ArrayMatrixNumberBigNumber(array, dim) { throw new Error("median(A, dim) is not yet supported"); }, - "...": function _15(args) { + "...": function _16(args) { if (containsCollections(args)) { throw new TypeError("Scalar values expected in function median"); } @@ -81739,7 +81759,7 @@ var createMad = /* @__PURE__ */ factory(name259, dependencies257, (_ref) => { } = _ref; return typed3(name259, { "Array | Matrix": _mad, - "...": function _15(args) { + "...": function _16(args) { return _mad(args); } }); @@ -81786,7 +81806,7 @@ var createVariance = /* @__PURE__ */ factory(name260, dependencies258, (_ref) => return _varDim(array, dim, DEFAULT_NORMALIZATION); }, "Array | Matrix, number | BigNumber, string": _varDim, - "...": function _15(args) { + "...": function _16(args) { return _var(args, DEFAULT_NORMALIZATION); } }); @@ -81915,11 +81935,11 @@ var createQuantileSeq = /* @__PURE__ */ factory(name261, dependencies259, (_ref) if (len === 0) { throw new Error("Cannot calculate quantile of an empty sequence"); } - var index2 = isNumber(prob) ? prob * (len - 1) : prob.times(len - 1); - var integerPart = isNumber(prob) ? Math.floor(index2) : index2.floor().toNumber(); - var fracPart = isNumber(prob) ? index2 % 1 : index2.minus(integerPart); - if (isInteger3(index2)) { - return sorted ? flat2[index2] : partitionSelect2(flat2, isNumber(prob) ? index2 : index2.valueOf()); + var index3 = isNumber(prob) ? prob * (len - 1) : prob.times(len - 1); + var integerPart = isNumber(prob) ? Math.floor(index3) : index3.floor().toNumber(); + var fracPart = isNumber(prob) ? index3 % 1 : index3.minus(integerPart); + if (isInteger3(index3)) { + return sorted ? flat2[index3] : partitionSelect2(flat2, isNumber(prob) ? index3 : index3.valueOf()); } var left; var right; @@ -81954,7 +81974,7 @@ var createStd = /* @__PURE__ */ factory(name262, dependencies260, (_ref) => { "Array | Matrix, string": _std, "Array | Matrix, number | BigNumber": _std, "Array | Matrix, number | BigNumber, string": _std, - "...": function _15(args) { + "...": function _16(args) { return _std(args); } }); @@ -82027,7 +82047,7 @@ var createCorr = /* @__PURE__ */ factory(name263, dependencies261, (_ref) => { var n3 = A.length; var sumX = sum4(A); var sumY = sum4(B2); - var sumXY = A.reduce((acc, x2, index2) => add4(acc, multiply2(x2, B2[index2])), 0); + var sumXY = A.reduce((acc, x2, index3) => add4(acc, multiply2(x2, B2[index3])), 0); var sumXSquare = sum4(A.map((x2) => pow3(x2, 2))); var sumYSquare = sum4(B2.map((y3) => pow3(y3, 2))); var numerator = subtract3(multiply2(n3, sumXY), multiply2(sumX, sumY)); @@ -84134,12 +84154,12 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name282, dependencies280, ( } return new OperatorNode2("/", "divide", [n3, new ConstantNode3(f2.d)]); } - function _foldAccessor(obj, index2, options) { - if (!isIndexNode(index2)) { - return new AccessorNode2(_ensureNode(obj), _ensureNode(index2)); + function _foldAccessor(obj, index3, options) { + if (!isIndexNode(index3)) { + return new AccessorNode2(_ensureNode(obj), _ensureNode(index3)); } if (isArrayNode(obj) || isMatrix(obj)) { - var remainingDims = Array.from(index2.dimensions); + var remainingDims = Array.from(index3.dimensions); while (remainingDims.length > 0) { if (isConstantNode(remainingDims[0]) && typeof remainingDims[0].value !== "string") { var first = _toNumber(remainingDims.shift().value, options); @@ -84178,23 +84198,23 @@ var createSimplifyConstant = /* @__PURE__ */ factory(name282, dependencies280, ( break; } } - if (remainingDims.length === index2.dimensions.length) { - return new AccessorNode2(_ensureNode(obj), index2); + if (remainingDims.length === index3.dimensions.length) { + return new AccessorNode2(_ensureNode(obj), index3); } if (remainingDims.length > 0) { - index2 = new IndexNode2(remainingDims); - return new AccessorNode2(_ensureNode(obj), index2); + index3 = new IndexNode2(remainingDims); + return new AccessorNode2(_ensureNode(obj), index3); } return obj; } - if (isObjectNode(obj) && index2.dimensions.length === 1 && isConstantNode(index2.dimensions[0])) { - var key2 = index2.dimensions[0].value; + if (isObjectNode(obj) && index3.dimensions.length === 1 && isConstantNode(index3.dimensions[0])) { + var key2 = index3.dimensions[0].value; if (key2 in obj.properties) { return obj.properties[key2]; } return new ConstantNode3(); } - return new AccessorNode2(_ensureNode(obj), index2); + return new AccessorNode2(_ensureNode(obj), index3); } function foldOp(fn, args, makeNode, options) { var first = args.shift(); @@ -86086,8 +86106,8 @@ var createFilterTransform = /* @__PURE__ */ factory(name294, dependencies292, (_ isTransformFunction: true }); function _filter(x2, callback) { - return filter(x2, function(value, index2, array) { - return applyCallback(callback, value, [index2 + 1], array, "filter"); + return filter(x2, function(value, index3, array) { + return applyCallback(callback, value, [index3 + 1], array, "filter"); }); } @@ -86115,13 +86135,13 @@ var createForEachTransform = /* @__PURE__ */ factory(name295, dependencies293, ( forEachTransform.rawArgs = true; var _forEach2 = typed3("forEach", { "Array | Matrix, function": function ArrayMatrixFunction(array, callback) { - var recurse = function recurse2(value, index2) { + var recurse = function recurse2(value, index3) { if (Array.isArray(value)) { forEach(value, function(child, i4) { - recurse2(child, index2.concat(i4 + 1)); + recurse2(child, index3.concat(i4 + 1)); }); } else { - return applyCallback(callback, value, index2, array, "forEach"); + return applyCallback(callback, value, index3, array, "forEach"); } }; recurse(array.valueOf(), []); @@ -86210,13 +86230,13 @@ var createMapTransform = /* @__PURE__ */ factory(name297, dependencies295, (_ref isTransformFunction: true }); function _map2(array, callback, orig) { - function recurse(value, index2) { + function recurse(value, index3) { if (Array.isArray(value)) { return map(value, function(child, i4) { - return recurse(child, index2.concat(i4 + 1)); + return recurse(child, index3.concat(i4 + 1)); }); } else { - return applyCallback(callback, value, index2, orig, "map"); + return applyCallback(callback, value, index3, orig, "map"); } } return recurse(array, []); @@ -89676,9 +89696,9 @@ function create(factories, config5) { console.warn("Factory object with properties `type`, `name`, and `factory` expected", factory2); throw new Error("Factory object with properties `type`, `name`, and `factory` expected"); } - var index2 = legacyFactories.indexOf(factory2); + var index3 = legacyFactories.indexOf(factory2); var instance; - if (index2 === -1) { + if (index3 === -1) { if (factory2.math === true) { instance = factory2.factory(math2.type, configInternal, load, math2.typed, math2); } else { @@ -89687,7 +89707,7 @@ function create(factories, config5) { legacyFactories.push(factory2); legacyInstances.push(instance); } else { - instance = legacyInstances[index2]; + instance = legacyInstances[index3]; } return instance; } @@ -90319,15 +90339,20 @@ var current2 = (args, math2, scope) => { return scope?.get("$current"); }; current2.rawArgs = true; +var index2 = (args, math2, scope) => { + return scope?.get("$index"); +}; +index2.rawArgs = true; var find = (args, math2, scope) => { if (args.length !== 2) { return ""; } const arr = args[0].compile().evaluate ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.find((f2) => { + return arr.find((f2, i4) => { scope.set("$current", f2); - math2.evaluate("current = _current()", scope); + scope.set("$index", i4); + math2.evaluate("current = _current(); index = _index()", scope); const value = args[1].compile().evaluate ? args[1].compile().evaluate(scope) : args[1]; return f2 === value; }) ?? ""; @@ -90341,9 +90366,10 @@ var findIndex2 = (args, math2, scope) => { } const arr = args[0].compile().evaluate ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.findIndex((f2) => { + return arr.findIndex((f2, i4) => { scope.set("$current", f2); - math2.evaluate("current = _current()", scope); + scope.set("$index", i4); + math2.evaluate("current = _current(); index = _index()", scope); const value = args[1].compile().evaluate ? args[1].compile().evaluate(scope) : args[1]; return f2 === value; }); @@ -90357,9 +90383,10 @@ var filter3 = (args, math2, scope) => { } const arr = args[0].compile().evaluate ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.filter((f2) => { + return arr.filter((f2, i4) => { scope.set("$current", f2); - math2.evaluate("current = _current()", scope); + scope.set("$index", i4); + math2.evaluate("current = _current(); index = _index()", scope); return args[1].compile().evaluate(scope); }); } @@ -90372,9 +90399,10 @@ var map3 = (args, math2, scope) => { } const arr = args[0].compile().evaluate ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.map((f2) => { + return arr.map((f2, i4) => { scope.set("$current", f2); - math2.evaluate("current = _current()", scope); + scope.set("$index", i4); + math2.evaluate("current = _current(); index = _index()", scope); const result = args[1].compile().evaluate(scope); return result; }); @@ -90388,9 +90416,10 @@ var some = (args, math2, scope) => { } const arr = args[0].compile().evaluate ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.some((f2) => { + return arr.some((f2, i4) => { scope.set("$current", f2); - math2.evaluate("current = _current()", scope); + scope.set("$index", i4); + math2.evaluate("current = _current(); index = _index()", scope); return args[1].compile().evaluate(scope); }); } @@ -90403,9 +90432,10 @@ var every = (args, math2, scope) => { } const arr = args[0].compile().evaluate ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.every((f2) => { + return arr.every((f2, i4) => { scope.set("$current", f2); - math2.evaluate("current = _current()", scope); + scope.set("$index", i4); + math2.evaluate("current = _current(); index = _index()", scope); return args[1].compile().evaluate(scope); }); } @@ -90490,6 +90520,7 @@ var format6 = (arg2) => { var formulas = { "prop": prop, "_current": current2, + "_index": index2, "slice": (str, start, end) => { str = format6(str); return str.slice(start, end); @@ -90603,59 +90634,59 @@ var formulas = { }, "dateRange": (arr, type) => { const diff2 = Math.abs(Math.max(...arr.map((f2) => f2.getTime())) - Math.min(...arr.map((f2) => f2.getTime()))); - if (type === "days") + if (type.startsWith("day")) return diff2 / (1e3 * 60 * 60 * 24); - if (type === "months") + if (type.startsWith("month")) return diff2 / (1e3 * 60 * 60 * 24 * 30); - if (type === "years") + if (type.startsWith("year")) return diff2 / (1e3 * 60 * 60 * 24 * 365); - if (type === "hours") + if (type.startsWith("hour")) return diff2 / (1e3 * 60 * 60); - if (type === "minutes") + if (type.startsWith("minute")) return diff2 / (1e3 * 60); - if (type === "seconds") + if (type.startsWith("second")) return diff2 / 1e3; - if (type === "weeks") + if (type.startsWith("week")) return diff2 / (1e3 * 60 * 60 * 24 * 7); - if (type === "quarters") + if (type.startsWith("quarter")) return diff2 / (1e3 * 60 * 60 * 24 * 30 * 3); return diff2 / (1e3 * 60 * 60 * 24); }, "dateAdd": (newDate, amount, type) => { - if (type === "days") + if (type.startsWith("day")) newDate.setDate(newDate.getDate() + amount); - if (type === "months") + if (type.startsWith("month")) newDate.setMonth(newDate.getMonth() + amount); - if (type === "years") + if (type.startsWith("year")) newDate.setFullYear(newDate.getFullYear() + amount); - if (type === "quarters") + if (type.startsWith("quarter")) newDate.setMonth(newDate.getMonth() + amount * 3); - if (type === "weeks") + if (type.startsWith("week")) newDate.setDate(newDate.getDate() + amount * 7); - if (type === "hours") + if (type.startsWith("hour")) newDate.setHours(newDate.getHours() + amount); - if (type === "minutes") + if (type.startsWith("minute")) newDate.setMinutes(newDate.getMinutes() + amount); - if (type === "seconds") + if (type.startsWith("second")) newDate.setSeconds(newDate.getSeconds() + amount); return newDate; }, "dateSubtract": (newDate, amount, type) => { - if (type === "days") + if (type.startsWith("day")) newDate.setDate(newDate.getDate() - amount); - if (type === "months") + if (type.startsWith("month")) newDate.setMonth(newDate.getMonth() - amount); - if (type === "years") + if (type.startsWith("year")) newDate.setFullYear(newDate.getFullYear() - amount); - if (type === "quarters") + if (type.startsWith("quarter")) newDate.setMonth(newDate.getMonth() - amount * 3); - if (type === "weeks") + if (type.startsWith("week")) newDate.setDate(newDate.getDate() - amount * 7); - if (type === "hours") + if (type.startsWith("hour")) newDate.setHours(newDate.getHours() - amount); - if (type === "minutes") + if (type.startsWith("minute")) newDate.setMinutes(newDate.getMinutes() - amount); - if (type === "seconds") + if (type.startsWith("second")) newDate.setSeconds(newDate.getSeconds() - amount); return newDate; }, @@ -90691,8 +90722,8 @@ var formulas = { "timeStamp": (date) => { return date.getTime(); }, - "at": (arr, index2) => { - return arr[index2]; + "at": (arr, index3) => { + return arr[index3]; }, "first": (arr) => { return arr[0]; @@ -90964,8 +90995,9 @@ var pathStateToTreeNode = (superstate, item, space2, path2, depth, i4, collapsed rank: item.rank, type: "file" }); -var spaceRowHeight = (superstate, section) => { - return isTouchScreen(superstate.ui) ? 40 : section ? superstate.settings.spaceRowHeight + 10 : superstate.settings.spaceRowHeight; +var spaceRowHeight = (superstate, preset, section) => { + const spaceHeight = preset ?? 29; + return isTouchScreen(superstate.ui) ? 40 : section ? spaceHeight + 10 : spaceHeight; }; var spaceSortFn = (sortStrategy) => (a4, b2) => { if (sortStrategy.field == "rank") { @@ -91001,7 +91033,7 @@ var updatePathRankInSpace = async (superstate, path2, rank, space2) => { return Promise.all(promises); }).then((f2) => superstate.dispatchEvent("spaceStateUpdated", { path: spaceState.path }))); }; -var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index2, copy) => { +var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index3, copy) => { if (!item) return; const currentPathState = superstate.pathsIndex.get(item.path); @@ -91017,7 +91049,7 @@ var movePathToNewSpaceAtIndex = async (superstate, item, newParent, index2, copy } else { await superstate.spaceManager.renamePath(item.path, movePath(item.path, newParent)); } - updatePathRankInSpace(superstate, newPath, index2, newParent); + updatePathRankInSpace(superstate, newPath, index3, newParent); }; var setTemplateInSpace = (superstate, path2, template2) => { saveSpaceMetadataValue(superstate, path2, "template", template2); @@ -91335,13 +91367,13 @@ var updateValue = (folder, lookupField, lookupValue, field, value) => { ) }; }; -var insertRows = (folder, rows, index2) => { - return { ...folder, rows: index2 ? insertMulti(folder.rows, index2, rows) : [...folder.rows, ...rows] }; +var insertRows = (folder, rows, index3) => { + return { ...folder, rows: index3 ? insertMulti(folder.rows, index3, rows) : [...folder.rows, ...rows] }; }; -var updateRowAtIndex = (folder, row2, index2) => { - return { ...folder, rows: folder.rows.map((f2, i4) => i4 == index2 ? row2 : f2) }; +var updateRowAtIndex = (folder, row2, index3) => { + return { ...folder, rows: folder.rows.map((f2, i4) => i4 == index3 ? row2 : f2) }; }; -var updateTableValue = async (manager, space2, schema, index2, field, value, rank) => { +var updateTableValue = async (manager, space2, schema, index3, field, value, rank) => { processTable( manager, space2, @@ -91350,7 +91382,7 @@ var updateTableValue = async (manager, space2, schema, index2, field, value, ran let newMDB = { ...f2, rows: f2.rows.map( - (f3, i4) => i4 == index2 ? { + (f3, i4) => i4 == index3 ? { ...f3, [field]: value } : f3 @@ -91359,7 +91391,7 @@ var updateTableValue = async (manager, space2, schema, index2, field, value, ran if (rank) newMDB = { ...newMDB, - rows: arrayMove(newMDB.rows, index2, rank) + rows: arrayMove(newMDB.rows, index3, rank) }; if (!import_lodash6.default.isEqual(f2, newMDB)) { await saveContext(manager, space2, newMDB); @@ -91444,9 +91476,9 @@ var updateContextWithProperties = async (superstate, path2, spaces2) => { await Promise.all(promises); return; }; -var updateTableRow = async (manager, space2, table, index2, row2) => { +var updateTableRow = async (manager, space2, table, index3, row2) => { return processTable(manager, space2, table, async (mdb, space3) => { - const newDB = updateRowAtIndex(mdb, row2, index2); + const newDB = updateRowAtIndex(mdb, row2, index3); if (!import_lodash6.default.isEqual(mdb, newDB)) { await saveContext(manager, space3, newDB); } @@ -91497,18 +91529,18 @@ var removeTagInContexts = async (manager, tag2, spaces2) => { }); return Promise.all(promises); }; -var addRowInTable = async (manager, row2, context, table, index2) => { +var addRowInTable = async (manager, row2, context, table, index3) => { return processTable(manager, context, table, async (mdb, space2) => { - const newDB = insertRows(mdb, [row2], index2); + const newDB = insertRows(mdb, [row2], index3); if (!import_lodash6.default.isEqual(mdb, newDB)) { await saveContext(manager, space2, newDB); } return newDB; }); }; -var deleteRowInTable = async (manager, context, table, index2) => { +var deleteRowInTable = async (manager, context, table, index3) => { return processTable(manager, context, table, async (mdb, space2) => { - const newDB = { ...mdb, rows: mdb.rows.filter((f2, i4) => i4 != index2) }; + const newDB = { ...mdb, rows: mdb.rows.filter((f2, i4) => i4 != index3) }; if (!import_lodash6.default.isEqual(mdb, newDB)) { await saveContext(manager, space2, newDB); } @@ -91571,9 +91603,9 @@ var removePathInContexts = async (manager, path2, spaces2) => { }); return Promise.all(promises); }; -var reorderPathsInContext = async (manager, paths, index2, space2) => { +var reorderPathsInContext = async (manager, paths, index3, space2) => { return processContext(manager, space2, async (mdb, context) => { - const newDB = reorderRowsForPath(mdb, paths, index2); + const newDB = reorderRowsForPath(mdb, paths, index3); if (!import_lodash6.default.isEqual(mdb, newDB)) { await saveContext(manager, context, newDB, true); } @@ -91862,10 +91894,10 @@ var dropPathInTree = async (superstate, path2, active, over, projected, flattene dropPathInSpaceAtIndex(superstate, activeItem.item.path, oldSpace, newSpace, projected.sortable && newRank, modifier); } }; -var reorderOpenSpace = (superstate, path2, index2) => { +var reorderOpenSpace = (superstate, path2, index3) => { const newWaypoint = superstate.waypoints[superstate.settings.currentWaypoint] ?? { sticker: "", name: "Waypoint", paths: [] }; const currentIndex = newWaypoint.paths.findIndex((f2) => f2 == path2); - const newIndex = currentIndex > index2 ? Math.max(0, index2 - 1) : index2; + const newIndex = currentIndex > index3 ? Math.max(0, index3 - 1) : index3; newWaypoint.paths = arrayMove(newWaypoint.paths, newWaypoint.paths.findIndex((f2) => f2 == path2), newIndex); if (superstate.settings.currentWaypoint > superstate.waypoints.length) { superstate.spaceManager.saveWaypoints([ @@ -91878,24 +91910,24 @@ var reorderOpenSpace = (superstate, path2, index2) => { ); superstate.spaceManager.saveWaypoints(newWaypoints); }; -var dropPathInSpaceAtIndex = async (superstate, path2, oldSpacePath, newSpacePath, index2, modifier) => { +var dropPathInSpaceAtIndex = async (superstate, path2, oldSpacePath, newSpacePath, index3, modifier) => { const cache2 = superstate.pathsIndex.get(path2); if (!cache2) return false; if (!newSpacePath) { - reorderOpenSpace(superstate, path2, index2); + reorderOpenSpace(superstate, path2, index3); return; } const newSpaceCache = superstate.spacesIndex.get(newSpacePath); if (oldSpacePath == newSpacePath) { - updatePathRankInSpace(superstate, path2, index2, newSpacePath); + updatePathRankInSpace(superstate, path2, index3, newSpacePath); return; } if (newSpaceCache.type == "folder" || newSpaceCache.type == "vault") { if (modifier == "link" || nodeIsAncestorOfTarget(path2, newSpaceCache.path)) { - pinPathToSpaceAtIndex(superstate, newSpaceCache, path2, index2); + pinPathToSpaceAtIndex(superstate, newSpaceCache, path2, index3); } else { - movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path2), newSpaceCache.path, index2, modifier == "copy"); + movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path2), newSpaceCache.path, index3, modifier == "copy"); } } if (newSpaceCache.type == "tag") { @@ -91905,16 +91937,16 @@ var dropPathInSpaceAtIndex = async (superstate, path2, oldSpacePath, newSpacePat removePathsFromSpace(superstate, oldSpacePath, [path2]); } }; -var dropPathsInSpaceAtIndex = async (superstate, paths, newSpacePath, index2, modifier) => { +var dropPathsInSpaceAtIndex = async (superstate, paths, newSpacePath, index3, modifier) => { const newSpaceCache = superstate.spacesIndex.get(newSpacePath); if (!newSpaceCache) return; if (newSpaceCache.type == "folder" || newSpaceCache.type == "vault") { paths.forEach((path2) => { if (modifier == "link" || nodeIsAncestorOfTarget(path2, newSpaceCache.path)) { - pinPathToSpaceAtIndex(superstate, newSpaceCache, path2, index2); + pinPathToSpaceAtIndex(superstate, newSpaceCache, path2, index3); } else { - movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path2), newSpaceCache.path, index2, modifier == "copy"); + movePathToNewSpaceAtIndex(superstate, superstate.pathsIndex.get(path2), newSpaceCache.path, index3, modifier == "copy"); } }); } @@ -92244,7 +92276,7 @@ var showSpacesMenu = (offset2, win, superstate, saveLink, includeDefaults, canAd { name: i18n_default.buttons.tag, value: "tag" }, { name: i18n_default.menu.folder, value: "folder" } ], - saveOptions: (_15, value) => { + saveOptions: (_16, value) => { saveLink(value[0], !options.some((f2) => f2.value == value[0])); }, placeholder: i18n_default.labels.spaceSelectPlaceholder, @@ -92414,6 +92446,8 @@ var showPathContextMenu = (superstate, path2, space2, rect, win, anchor, onClose icon: "ui//pin", onClick: (e5) => { const offset2 = e5.target.getBoundingClientRect(); + const menuOptions2 = []; + const paths = [...superstate.spacesMap.get(path2)]; showSpacesMenu( offset2, windowFromDocument(e5.view.document), @@ -92513,7 +92547,8 @@ var showPathContextMenu = (superstate, path2, space2, rect, win, anchor, onClose onClick: (e5) => { superstate.spaceManager.copyPath( path2, - `${cache2.parent}/${cache2.name} 1.${cache2.type}` + `${cache2.parent}`, + `${cache2.name}` ); } }); @@ -92595,7 +92630,7 @@ var showLinkMenu = (offset2, win, superstate, saveLink, options) => { editable: true, value: [], options: suggestions, - saveOptions: (_15, value) => { + saveOptions: (_16, value) => { saveLink(value[0]); }, placeholder: i18n_default.labels.linkItemSelectPlaceholder, @@ -96763,7 +96798,7 @@ var selectPropertyTypeMenu = (e5, ui, selectedType) => { }; var PropertyMenuComponent = (props) => { const [field, setField] = (0, import_react18.useState)(props.field); - const selectedType = (_15, value) => { + const selectedType = (_16, value) => { const newField = { ...field, type: value[0], @@ -96835,15 +96870,26 @@ var showPropertyMenu = (props, onHide) => { editCode, hidden } = props; + const saveName = (value) => { + if (!editable) { + const fieldValue = safelyParseJSON(field.value); + saveField({ ...field, value: JSON.stringify({ + ...fieldValue, + alias: value + }) }); + return; + } + saveField({ ...field, name: value }); + }; const menuOptions = []; + menuOptions.push( + menuInput( + nameForField(field, props.superstate) ?? "", + (value) => saveName(value) + ) + ); + menuOptions.push(menuSeparator); if (editable) { - menuOptions.push( - menuInput( - field?.name ?? "", - (value) => saveField({ ...field, name: value }) - ) - ); - menuOptions.push(menuSeparator); menuOptions.push({ name: "", type: 5 /* Custom */, @@ -96856,23 +96902,23 @@ var showPropertyMenu = (props, onHide) => { saveField }) }); - menuOptions.push(menuSeparator); - menuOptions.push({ - name: i18n_default.menu.setIcon, - icon: "ui//gem", - onClick: (e5) => { - superstate.ui.openPalette( - (_props) => /* @__PURE__ */ import_react18.default.createElement(StickerModal_default, { - ui: superstate.ui, - hide: _props.hide, - selectedSticker: (emoji) => saveField({ ...field, attrs: JSON.stringify({ icon: emoji }) }) - }), - windowFromDocument(e5.view.document) - ); - } - }); - menuOptions.push(menuSeparator); } + menuOptions.push(menuSeparator); + menuOptions.push({ + name: i18n_default.menu.setIcon, + icon: "ui//gem", + onClick: (e5) => { + superstate.ui.openPalette( + (_props) => /* @__PURE__ */ import_react18.default.createElement(StickerModal_default, { + ui: superstate.ui, + hide: _props.hide, + selectedSticker: (emoji) => saveField({ ...field, attrs: JSON.stringify({ icon: emoji }) }) + }), + windowFromDocument(e5.view.document) + ); + } + }); + menuOptions.push(menuSeparator); const sortableString = normalizedSortForType(field.type, false); if (sortableString && sortColumn) { menuOptions.push({ @@ -96896,27 +96942,27 @@ var showPropertyMenu = (props, onHide) => { } }); } - if (editable) { - menuOptions.push(menuSeparator); - if (hide) { - if (!hidden) { - menuOptions.push({ - name: i18n_default.menu.hideProperty, - icon: "ui//eye-off", - onClick: () => { - hide(field, true); - } - }); - } else { - menuOptions.push({ - name: i18n_default.menu.unhideProperty, - icon: "ui//eye", - onClick: () => { - hide(field, false); - } - }); - } + menuOptions.push(menuSeparator); + if (hide) { + if (!hidden) { + menuOptions.push({ + name: i18n_default.menu.hideProperty, + icon: "ui//eye-off", + onClick: () => { + hide(field, true); + } + }); + } else { + menuOptions.push({ + name: i18n_default.menu.unhideProperty, + icon: "ui//eye", + onClick: () => { + hide(field, false); + } + }); } + } + if (editable) { if (editCode) { menuOptions.push({ name: i18n_default.menu.editCode, @@ -97598,8 +97644,8 @@ var ContextEditorProvider = (props) => { [tableData, contextTable, contexts, dbSchema] ); const data2 = (0, import_react22.useMemo)( - () => tableData?.rows.map((r2, index2) => ({ - _index: index2.toString(), + () => tableData?.rows.map((r2, index3) => ({ + _index: index3.toString(), ...r2, ...r2[PathPropertyName] ? { [PathPropertyName]: props.superstate.spaceManager.resolvePath( @@ -97667,14 +97713,14 @@ var ContextEditorProvider = (props) => { }), [predicate, data2, cols, searchString] ); - const updateValue2 = (column2, value, table, index2, path2) => { + const updateValue2 = (column2, value, table, index3, path2) => { const col = (table == "" ? tableData : contextTable[table])?.cols.find( (f2) => f2.name == column2 ); if (col) { saveProperties( props.superstate, - path2 ?? tableData.rows[index2]?.[PathPropertyName], + path2 ?? tableData.rows[index3]?.[PathPropertyName], { [column2]: parseMDBStringValue(col.type, value, true) } ); } @@ -97682,14 +97728,14 @@ var ContextEditorProvider = (props) => { saveDB({ ...tableData, rows: tableData.rows.map( - (r2, i4) => i4 == index2 ? { + (r2, i4) => i4 == index3 ? { ...r2, [column2]: value } : r2 ) }); } else if (contextTable[table]) { - const path3 = tableData.rows[index2][PathPropertyName]; + const path3 = tableData.rows[index3][PathPropertyName]; saveContextDB( { ...contextTable[table], @@ -97717,11 +97763,11 @@ var ContextEditorProvider = (props) => { ] : predicate.colsHidden.filter((s4) => s4 != col.name + col.table) }); }; - const updateFieldValue = (column2, fieldValue, value, table, index2, path2) => { + const updateFieldValue = (column2, fieldValue, value, table, index3, path2) => { const col = tableData.cols.find((f2) => f2.name == column2); saveProperties( props.superstate, - path2 ?? tableData.rows[index2]?.[PathPropertyName], + path2 ?? tableData.rows[index3]?.[PathPropertyName], { [column2]: parseMDBStringValue(col.type, value, true) } ); if (table == "") { @@ -97734,7 +97780,7 @@ var ContextEditorProvider = (props) => { } : m4 ), rows: tableData.rows.map( - (r2, i4) => i4 == index2 ? { + (r2, i4) => i4 == index3 ? { ...r2, [column2]: value } : r2 @@ -97742,7 +97788,7 @@ var ContextEditorProvider = (props) => { }; saveDB(newTable); } else if (contextTable[table]) { - const path3 = tableData.rows[index2][PathPropertyName]; + const path3 = tableData.rows[index3][PathPropertyName]; saveContextDB( { ...contextTable[table], @@ -98122,7 +98168,9 @@ var ColumnHeader = (props) => { { spaces: spaceCache?.contexts ?? [], fields: cols, - saveField: (source, field2) => newColumn({ ...field2, table: source }), + saveField: (source, field2) => { + return newColumn({ ...field2, table: source }); + }, schemaId: tableData.schema.id, contextPath: spaceInfo.path } @@ -98141,7 +98189,7 @@ var ColumnHeader = (props) => { superstate: props.superstate, rect: offset2, win: windowFromDocument(e5.view.document), - editable: props.editable, + editable: field.name != PathPropertyName, options, field, fields: cols, @@ -98175,7 +98223,7 @@ var ColumnHeader = (props) => { } }), /* @__PURE__ */ import_react24.default.createElement("div", { className: "mk-path-context-field-key" - }, field.name)) : "+", /* @__PURE__ */ import_react24.default.createElement("span", { + }, nameForField(field, props.superstate))) : "+", /* @__PURE__ */ import_react24.default.createElement("span", { className: "mk-col-header-context", "aria-label": props.column.table.length > 0 ? props.column.table : "" }, props.column.table.length > 0 ? "#" : ""))); @@ -98213,7 +98261,7 @@ var PropertyValueComponent = (props) => { multi: false, editable: true, searchable: true, - saveOptions: (_15, v2) => { + saveOptions: (_16, v2) => { if (saveProperty) { saveProperty(v2[0]); } else { @@ -98235,7 +98283,7 @@ var PropertyValueComponent = (props) => { multi: false, editable: false, searchable: false, - saveOptions: (_15, v2) => saveParsedValue("type", v2[0]), + saveOptions: (_16, v2) => saveParsedValue("type", v2[0]), value: [], showAll: true, options: fieldTypes.filter((f2) => f2.primative).map((f2, i4) => ({ @@ -98411,7 +98459,7 @@ var NewPropertyMenuComponent = (props) => { value: "$fm" }); } - if (props.contextPath) { + if (props.contextPath && (!props.fileMetadata || props.contextPath != "$fm")) { options2.push({ name: folderPathToString(props.contextPath), value: "" @@ -98425,13 +98473,13 @@ var NewPropertyMenuComponent = (props) => { ); return options2; }, [spaceCaches]); - const selectedType = (_15, value) => { + const selectedType = (_16, value) => { setFieldType(value[0]); }; const selectedValue = (value) => { setFieldValue(value); }; - const selectedSource = (_15, value) => { + const selectedSource = (_16, value) => { setFieldSource(value[0]); }; const toggleMulti = () => { @@ -98493,13 +98541,14 @@ var NewPropertyMenuComponent = (props) => { props.superstate.ui.notify(i18n_default.notice.noPropertyName); return; } - props.saveField(fieldSource, { + const result = props.saveField(fieldSource, { name: fieldName, type: fieldType, value: fieldValue, schemaId: props.schemaId }); - props.hide(); + if (result) + props.hide(); }; const onKeyDown = (e5) => { if (e5.key == "Enter") { @@ -98697,7 +98746,7 @@ var ContextListEditSelector = (props) => { value: `spaces://$kit/#*${mdbSchemaToFrameSchema(f2.schema).def.id}` })) ], - saveOptions: (_15, value, isNew) => { + saveOptions: (_16, value, isNew) => { selectFrame(value[0], frame); }, placeholder: i18n_default.hintText.createListItem, @@ -98994,7 +99043,7 @@ function memo2(getDeps, fn, opts) { if (opts.key && opts.debug) depTime = Date.now(); const newDeps = getDeps(depArgs); - const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index3) => deps[index3] !== dep); if (!depsChanged) { return result; } @@ -99295,9 +99344,9 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { createHeaderGroup(pendingParentHeaders, depth - 1); } }; - const bottomHeaders = columnsToGroup.map((column2, index2) => createHeader(table, column2, { + const bottomHeaders = columnsToGroup.map((column2, index3) => createHeader(table, column2, { depth: maxDepth, - index: index2 + index: index3 })); createHeaderGroup(bottomHeaders, maxDepth - 1); headerGroups.reverse(); @@ -100052,7 +100101,7 @@ var ColumnSizing = { column2.resetSize = () => { table.setColumnSizing((_ref2) => { let { - [column2.id]: _15, + [column2.id]: _16, ...rest } = _ref2; return rest; @@ -100513,7 +100562,7 @@ var RowExpanding = { } if (exists && !expanded) { const { - [row2.id]: _15, + [row2.id]: _16, ...rest } = oldExpanded; return rest; @@ -100647,7 +100696,7 @@ var RowPagination = { table.getPageOptions = memo2(() => [table.getPageCount()], (pageCount) => { let pageOptions = []; if (pageCount && pageCount > 0) { - pageOptions = [...new Array(pageCount)].fill(null).map((_15, i4) => i4); + pageOptions = [...new Array(pageCount)].fill(null).map((_16, i4) => i4); } return pageOptions; }, getMemoOptions(table.options, "debugTable", "getPageOptions")); @@ -101433,9 +101482,9 @@ function createTable(options) { setState: (updater) => { table.options.onStateChange == null || table.options.onStateChange(updater); }, - _getRowId: (row2, index2, parent) => { + _getRowId: (row2, index3, parent) => { var _table$options$getRow; - return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row2, index2, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index2].join(".") : index2}`; + return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row2, index3, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index3].join(".") : index3}`; }, getCoreRowModel: () => { if (!table._getCoreRowModel) { @@ -101522,8 +101571,8 @@ function createTable(options) { } }; Object.assign(table, coreInstance); - for (let index2 = 0; index2 < table._features.length; index2++) { - const feature = table._features[index2]; + for (let index3 = 0; index3 < table._features.length; index3++) { + const feature = table._features[index3]; feature == null || feature.createTable == null || feature.createTable(table); } return table; @@ -101611,13 +101660,13 @@ function getGroupedRowModel() { } const columnId = existingGrouping[depth]; const rowGroupsMap = groupBy(rows, columnId); - const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index2) => { + const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index3) => { let [groupingValue, groupedRows2] = _ref; let id3 = `${columnId}:${groupingValue}`; id3 = parentId ? `${parentId}>${id3}` : id3; const subRows = groupUpRecursively(groupedRows2, depth + 1, id3); const leafRows = depth ? flattenBy(groupedRows2, (row3) => row3.subRows) : groupedRows2; - const row2 = createRow2(table, id3, leafRows[0].original, index2, depth, void 0, parentId); + const row2 = createRow2(table, id3, leafRows[0].original, index3, depth, void 0, parentId); Object.assign(row2, { groupingColumnId: columnId, groupingValue, @@ -102773,7 +102822,7 @@ var labels = /* @__PURE__ */ Object.freeze({ }); function getDefaultContextValues() { var captionLayout = "buttons"; - var classNames16 = defaultClassNames; + var classNames17 = defaultClassNames; var locale2 = en_US_default; var modifiersClassNames = {}; var modifiers = {}; @@ -102782,7 +102831,7 @@ function getDefaultContextValues() { var today = new Date(); return { captionLayout, - classNames: classNames16, + classNames: classNames17, formatters: formatters3, labels, locale: locale2, @@ -102837,8 +102886,8 @@ function useDayPicker() { return context; } function CaptionLabel(props) { - var _a4 = useDayPicker(), locale2 = _a4.locale, classNames16 = _a4.classNames, styles2 = _a4.styles, formatCaption2 = _a4.formatters.formatCaption; - return jsxRuntimeExports.jsx("div", { className: classNames16.caption_label, style: styles2.caption_label, "aria-live": "polite", role: "presentation", id: props.id, children: formatCaption2(props.displayMonth, { locale: locale2 }) }); + var _a4 = useDayPicker(), locale2 = _a4.locale, classNames17 = _a4.classNames, styles2 = _a4.styles, formatCaption2 = _a4.formatters.formatCaption; + return jsxRuntimeExports.jsx("div", { className: classNames17.caption_label, style: styles2.caption_label, "aria-live": "polite", role: "presentation", id: props.id, children: formatCaption2(props.displayMonth, { locale: locale2 }) }); } function IconDropdown(props) { return jsxRuntimeExports.jsx("svg", __assign({ width: "8px", height: "8px", viewBox: "0 0 120 120", "data-testid": "iconDropdown" }, props, { children: jsxRuntimeExports.jsx("path", { d: "M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z", fill: "currentColor", fillRule: "nonzero" }) })); @@ -102852,7 +102901,7 @@ function Dropdown(props) { } function MonthsDropdown(props) { var _a4; - var _b = useDayPicker(), fromDate = _b.fromDate, toDate2 = _b.toDate, styles2 = _b.styles, locale2 = _b.locale, formatMonthCaption2 = _b.formatters.formatMonthCaption, classNames16 = _b.classNames, components = _b.components, labelMonthDropdown2 = _b.labels.labelMonthDropdown; + var _b = useDayPicker(), fromDate = _b.fromDate, toDate2 = _b.toDate, styles2 = _b.styles, locale2 = _b.locale, formatMonthCaption2 = _b.formatters.formatMonthCaption, classNames17 = _b.classNames, components = _b.components, labelMonthDropdown2 = _b.labels.labelMonthDropdown; if (!fromDate) return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}); if (!toDate2) @@ -102875,14 +102924,14 @@ function MonthsDropdown(props) { props.onChange(newMonth); }; var DropdownComponent2 = (_a4 = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a4 !== void 0 ? _a4 : Dropdown; - return jsxRuntimeExports.jsx(DropdownComponent2, { name: "months", "aria-label": labelMonthDropdown2(), className: classNames16.dropdown_month, style: styles2.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption2(props.displayMonth, { locale: locale2 }), children: dropdownMonths.map(function(m4) { + return jsxRuntimeExports.jsx(DropdownComponent2, { name: "months", "aria-label": labelMonthDropdown2(), className: classNames17.dropdown_month, style: styles2.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption2(props.displayMonth, { locale: locale2 }), children: dropdownMonths.map(function(m4) { return jsxRuntimeExports.jsx("option", { value: m4.getMonth(), children: formatMonthCaption2(m4, { locale: locale2 }) }, m4.getMonth()); }) }); } function YearsDropdown(props) { var _a4; var displayMonth = props.displayMonth; - var _b = useDayPicker(), fromDate = _b.fromDate, toDate2 = _b.toDate, locale2 = _b.locale, styles2 = _b.styles, classNames16 = _b.classNames, components = _b.components, formatYearCaption2 = _b.formatters.formatYearCaption, labelYearDropdown2 = _b.labels.labelYearDropdown; + var _b = useDayPicker(), fromDate = _b.fromDate, toDate2 = _b.toDate, locale2 = _b.locale, styles2 = _b.styles, classNames17 = _b.classNames, components = _b.components, formatYearCaption2 = _b.formatters.formatYearCaption, labelYearDropdown2 = _b.labels.labelYearDropdown; var years = []; if (!fromDate) return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}); @@ -102898,7 +102947,7 @@ function YearsDropdown(props) { props.onChange(newMonth); }; var DropdownComponent2 = (_a4 = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a4 !== void 0 ? _a4 : Dropdown; - return jsxRuntimeExports.jsx(DropdownComponent2, { name: "years", "aria-label": labelYearDropdown2(), className: classNames16.dropdown_year, style: styles2.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption2(displayMonth, { locale: locale2 }), children: years.map(function(year2) { + return jsxRuntimeExports.jsx(DropdownComponent2, { name: "years", "aria-label": labelYearDropdown2(), className: classNames17.dropdown_year, style: styles2.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption2(displayMonth, { locale: locale2 }), children: years.map(function(year2) { return jsxRuntimeExports.jsx("option", { value: year2.getFullYear(), children: formatYearCaption2(year2, { locale: locale2 }) }, year2.getFullYear()); }) }); } @@ -103022,14 +103071,14 @@ function useNavigation() { } function CaptionDropdowns(props) { var _a4; - var _b = useDayPicker(), classNames16 = _b.classNames, styles2 = _b.styles, components = _b.components; + var _b = useDayPicker(), classNames17 = _b.classNames, styles2 = _b.styles, components = _b.components; var goToMonth = useNavigation().goToMonth; var handleMonthChange = function(newMonth) { goToMonth(addMonths(newMonth, props.displayIndex ? -props.displayIndex : 0)); }; var CaptionLabelComponent = (_a4 = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a4 !== void 0 ? _a4 : CaptionLabel; var captionLabel = jsxRuntimeExports.jsx(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth }); - return jsxRuntimeExports.jsxs("div", { className: classNames16.caption_dropdowns, style: styles2.caption_dropdowns, children: [jsxRuntimeExports.jsx("div", { className: classNames16.vhidden, children: captionLabel }), jsxRuntimeExports.jsx(MonthsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth }), jsxRuntimeExports.jsx(YearsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth })] }); + return jsxRuntimeExports.jsxs("div", { className: classNames17.caption_dropdowns, style: styles2.caption_dropdowns, children: [jsxRuntimeExports.jsx("div", { className: classNames17.vhidden, children: captionLabel }), jsxRuntimeExports.jsx(MonthsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth }), jsxRuntimeExports.jsx(YearsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth })] }); } function IconLeft(props) { return jsxRuntimeExports.jsx("svg", __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props, { children: jsxRuntimeExports.jsx("path", { d: "M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z", fill: "currentColor", fillRule: "nonzero" }) })); @@ -103038,8 +103087,8 @@ function IconRight(props) { return jsxRuntimeExports.jsx("svg", __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props, { children: jsxRuntimeExports.jsx("path", { d: "M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z", fill: "currentColor" }) })); } var Button = (0, import_react37.forwardRef)(function(props, ref2) { - var _a4 = useDayPicker(), classNames16 = _a4.classNames, styles2 = _a4.styles; - var classNamesArr = [classNames16.button_reset, classNames16.button]; + var _a4 = useDayPicker(), classNames17 = _a4.classNames, styles2 = _a4.styles; + var classNamesArr = [classNames17.button_reset, classNames17.button]; if (props.className) { classNamesArr.push(props.className); } @@ -103052,23 +103101,23 @@ var Button = (0, import_react37.forwardRef)(function(props, ref2) { }); function Navigation(props) { var _a4, _b; - var _c = useDayPicker(), dir = _c.dir, locale2 = _c.locale, classNames16 = _c.classNames, styles2 = _c.styles, _d = _c.labels, labelPrevious2 = _d.labelPrevious, labelNext2 = _d.labelNext, components = _c.components; + var _c = useDayPicker(), dir = _c.dir, locale2 = _c.locale, classNames17 = _c.classNames, styles2 = _c.styles, _d = _c.labels, labelPrevious2 = _d.labelPrevious, labelNext2 = _d.labelNext, components = _c.components; if (!props.nextMonth && !props.previousMonth) { return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}); } var previousLabel = labelPrevious2(props.previousMonth, { locale: locale2 }); var previousClassName = [ - classNames16.nav_button, - classNames16.nav_button_previous + classNames17.nav_button, + classNames17.nav_button_previous ].join(" "); var nextLabel = labelNext2(props.nextMonth, { locale: locale2 }); var nextClassName = [ - classNames16.nav_button, - classNames16.nav_button_next + classNames17.nav_button, + classNames17.nav_button_next ].join(" "); var IconRightComponent = (_a4 = components === null || components === void 0 ? void 0 : components.IconRight) !== null && _a4 !== void 0 ? _a4 : IconRight; var IconLeftComponent = (_b = components === null || components === void 0 ? void 0 : components.IconLeft) !== null && _b !== void 0 ? _b : IconLeft; - return jsxRuntimeExports.jsxs("div", { className: classNames16.nav, style: styles2.nav, children: [!props.hidePrevious && jsxRuntimeExports.jsx(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles2.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick, children: dir === "rtl" ? jsxRuntimeExports.jsx(IconRightComponent, { className: classNames16.nav_icon, style: styles2.nav_icon }) : jsxRuntimeExports.jsx(IconLeftComponent, { className: classNames16.nav_icon, style: styles2.nav_icon }) }), !props.hideNext && jsxRuntimeExports.jsx(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles2.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick, children: dir === "rtl" ? jsxRuntimeExports.jsx(IconLeftComponent, { className: classNames16.nav_icon, style: styles2.nav_icon }) : jsxRuntimeExports.jsx(IconRightComponent, { className: classNames16.nav_icon, style: styles2.nav_icon }) })] }); + return jsxRuntimeExports.jsxs("div", { className: classNames17.nav, style: styles2.nav, children: [!props.hidePrevious && jsxRuntimeExports.jsx(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles2.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick, children: dir === "rtl" ? jsxRuntimeExports.jsx(IconRightComponent, { className: classNames17.nav_icon, style: styles2.nav_icon }) : jsxRuntimeExports.jsx(IconLeftComponent, { className: classNames17.nav_icon, style: styles2.nav_icon }) }), !props.hideNext && jsxRuntimeExports.jsx(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles2.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick, children: dir === "rtl" ? jsxRuntimeExports.jsx(IconLeftComponent, { className: classNames17.nav_icon, style: styles2.nav_icon }) : jsxRuntimeExports.jsx(IconRightComponent, { className: classNames17.nav_icon, style: styles2.nav_icon }) })] }); } function CaptionNavigation(props) { var numberOfMonths = useDayPicker().numberOfMonths; @@ -103094,7 +103143,7 @@ function CaptionNavigation(props) { } function Caption(props) { var _a4; - var _b = useDayPicker(), classNames16 = _b.classNames, disableNavigation = _b.disableNavigation, styles2 = _b.styles, captionLayout = _b.captionLayout, components = _b.components; + var _b = useDayPicker(), classNames17 = _b.classNames, disableNavigation = _b.disableNavigation, styles2 = _b.styles, captionLayout = _b.captionLayout, components = _b.components; var CaptionLabelComponent = (_a4 = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a4 !== void 0 ? _a4 : CaptionLabel; var caption; if (disableNavigation) { @@ -103106,7 +103155,7 @@ function Caption(props) { } else { caption = jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth, displayIndex: props.displayIndex }), jsxRuntimeExports.jsx(CaptionNavigation, { displayMonth: props.displayMonth, id: props.id })] }); } - return jsxRuntimeExports.jsx("div", { className: classNames16.caption, style: styles2.caption, children: caption }); + return jsxRuntimeExports.jsx("div", { className: classNames17.caption, style: styles2.caption, children: caption }); } function Footer(props) { var _a4 = useDayPicker(), footer = _a4.footer, styles2 = _a4.styles, tfoot = _a4.classNames.tfoot; @@ -103124,17 +103173,17 @@ function getWeekdays(locale2, weekStartsOn, ISOWeek) { return days; } function HeadRow() { - var _a4 = useDayPicker(), classNames16 = _a4.classNames, styles2 = _a4.styles, showWeekNumber = _a4.showWeekNumber, locale2 = _a4.locale, weekStartsOn = _a4.weekStartsOn, ISOWeek = _a4.ISOWeek, formatWeekdayName2 = _a4.formatters.formatWeekdayName, labelWeekday2 = _a4.labels.labelWeekday; + var _a4 = useDayPicker(), classNames17 = _a4.classNames, styles2 = _a4.styles, showWeekNumber = _a4.showWeekNumber, locale2 = _a4.locale, weekStartsOn = _a4.weekStartsOn, ISOWeek = _a4.ISOWeek, formatWeekdayName2 = _a4.formatters.formatWeekdayName, labelWeekday2 = _a4.labels.labelWeekday; var weekdays = getWeekdays(locale2, weekStartsOn, ISOWeek); - return jsxRuntimeExports.jsxs("tr", { style: styles2.head_row, className: classNames16.head_row, children: [showWeekNumber && jsxRuntimeExports.jsx("td", { style: styles2.head_cell, className: classNames16.head_cell }), weekdays.map(function(weekday, i4) { - return jsxRuntimeExports.jsx("th", { scope: "col", className: classNames16.head_cell, style: styles2.head_cell, "aria-label": labelWeekday2(weekday, { locale: locale2 }), children: formatWeekdayName2(weekday, { locale: locale2 }) }, i4); + return jsxRuntimeExports.jsxs("tr", { style: styles2.head_row, className: classNames17.head_row, children: [showWeekNumber && jsxRuntimeExports.jsx("td", { style: styles2.head_cell, className: classNames17.head_cell }), weekdays.map(function(weekday, i4) { + return jsxRuntimeExports.jsx("th", { scope: "col", className: classNames17.head_cell, style: styles2.head_cell, "aria-label": labelWeekday2(weekday, { locale: locale2 }), children: formatWeekdayName2(weekday, { locale: locale2 }) }, i4); })] }); } function Head() { var _a4; - var _b = useDayPicker(), classNames16 = _b.classNames, styles2 = _b.styles, components = _b.components; + var _b = useDayPicker(), classNames17 = _b.classNames, styles2 = _b.styles, components = _b.components; var HeadRowComponent = (_a4 = components === null || components === void 0 ? void 0 : components.HeadRow) !== null && _a4 !== void 0 ? _a4 : HeadRow; - return jsxRuntimeExports.jsx("thead", { style: styles2.head, className: classNames16.head, children: jsxRuntimeExports.jsx(HeadRowComponent, {}) }); + return jsxRuntimeExports.jsx("thead", { style: styles2.head, className: classNames17.head, children: jsxRuntimeExports.jsx(HeadRowComponent, {}) }); } function DayContent(props) { var _a4 = useDayPicker(), locale2 = _a4.locale, formatDay2 = _a4.formatters.formatDay; @@ -103169,10 +103218,10 @@ function SelectMultipleProviderInternal(_a4) { } var selectedDays = selected ? __spreadArray([], selected, true) : []; if (activeModifiers.selected) { - var index2 = selectedDays.findIndex(function(selectedDay) { + var index3 = selectedDays.findIndex(function(selectedDay) { return isSameDay(day, selectedDay); }); - selectedDays.splice(index2, 1); + selectedDays.splice(index3, 1); } else { selectedDays.push(day); } @@ -103840,19 +103889,19 @@ function isInternalModifier(modifier) { return Object.values(InternalModifier).includes(modifier); } function getDayClassNames(dayPicker, activeModifiers) { - var classNames16 = [dayPicker.classNames.day]; + var classNames17 = [dayPicker.classNames.day]; Object.keys(activeModifiers).forEach(function(modifier) { var customClassName = dayPicker.modifiersClassNames[modifier]; if (customClassName) { - classNames16.push(customClassName); + classNames17.push(customClassName); } else if (isInternalModifier(modifier)) { var internalClassName = dayPicker.classNames["day_".concat(modifier)]; if (internalClassName) { - classNames16.push(internalClassName); + classNames17.push(internalClassName); } } }); - return classNames16; + return classNames17; } function getDayStyle(dayPicker, activeModifiers) { var style = __assign({}, dayPicker.styles.day); @@ -103926,28 +103975,28 @@ function Day(props) { } function WeekNumber(props) { var weekNumber = props.number, dates = props.dates; - var _a4 = useDayPicker(), onWeekNumberClick = _a4.onWeekNumberClick, styles2 = _a4.styles, classNames16 = _a4.classNames, locale2 = _a4.locale, labelWeekNumber2 = _a4.labels.labelWeekNumber, formatWeekNumber2 = _a4.formatters.formatWeekNumber; + var _a4 = useDayPicker(), onWeekNumberClick = _a4.onWeekNumberClick, styles2 = _a4.styles, classNames17 = _a4.classNames, locale2 = _a4.locale, labelWeekNumber2 = _a4.labels.labelWeekNumber, formatWeekNumber2 = _a4.formatters.formatWeekNumber; var content5 = formatWeekNumber2(Number(weekNumber), { locale: locale2 }); if (!onWeekNumberClick) { - return jsxRuntimeExports.jsx("span", { className: classNames16.weeknumber, style: styles2.weeknumber, children: content5 }); + return jsxRuntimeExports.jsx("span", { className: classNames17.weeknumber, style: styles2.weeknumber, children: content5 }); } var label = labelWeekNumber2(Number(weekNumber), { locale: locale2 }); var handleClick = function(e5) { onWeekNumberClick(weekNumber, dates, e5); }; - return jsxRuntimeExports.jsx(Button, { name: "week-number", "aria-label": label, className: classNames16.weeknumber, style: styles2.weeknumber, onClick: handleClick, children: content5 }); + return jsxRuntimeExports.jsx(Button, { name: "week-number", "aria-label": label, className: classNames17.weeknumber, style: styles2.weeknumber, onClick: handleClick, children: content5 }); } function Row(props) { var _a4, _b; - var _c = useDayPicker(), styles2 = _c.styles, classNames16 = _c.classNames, showWeekNumber = _c.showWeekNumber, components = _c.components; + var _c = useDayPicker(), styles2 = _c.styles, classNames17 = _c.classNames, showWeekNumber = _c.showWeekNumber, components = _c.components; var DayComponent = (_a4 = components === null || components === void 0 ? void 0 : components.Day) !== null && _a4 !== void 0 ? _a4 : Day; var WeeknumberComponent = (_b = components === null || components === void 0 ? void 0 : components.WeekNumber) !== null && _b !== void 0 ? _b : WeekNumber; var weekNumberCell; if (showWeekNumber) { - weekNumberCell = jsxRuntimeExports.jsx("td", { className: classNames16.cell, style: styles2.cell, children: jsxRuntimeExports.jsx(WeeknumberComponent, { number: props.weekNumber, dates: props.dates }) }); + weekNumberCell = jsxRuntimeExports.jsx("td", { className: classNames17.cell, style: styles2.cell, children: jsxRuntimeExports.jsx(WeeknumberComponent, { number: props.weekNumber, dates: props.dates }) }); } - return jsxRuntimeExports.jsxs("tr", { className: classNames16.row, style: styles2.row, children: [weekNumberCell, props.dates.map(function(date) { - return jsxRuntimeExports.jsx("td", { className: classNames16.cell, style: styles2.cell, role: "presentation", children: jsxRuntimeExports.jsx(DayComponent, { displayMonth: props.displayMonth, date }) }, getUnixTime(date)); + return jsxRuntimeExports.jsxs("tr", { className: classNames17.row, style: styles2.row, children: [weekNumberCell, props.dates.map(function(date) { + return jsxRuntimeExports.jsx("td", { className: classNames17.cell, style: styles2.cell, role: "presentation", children: jsxRuntimeExports.jsx(DayComponent, { displayMonth: props.displayMonth, date }) }, getUnixTime(date)); })] }); } function daysToMonthWeeks(fromDate, toDate2, options) { @@ -103991,7 +104040,7 @@ function getMonthWeeks(month, options) { } function Table(props) { var _a4, _b, _c; - var _d = useDayPicker(), locale2 = _d.locale, classNames16 = _d.classNames, styles2 = _d.styles, hideHead = _d.hideHead, fixedWeeks = _d.fixedWeeks, components = _d.components, weekStartsOn = _d.weekStartsOn, firstWeekContainsDate = _d.firstWeekContainsDate, ISOWeek = _d.ISOWeek; + var _d = useDayPicker(), locale2 = _d.locale, classNames17 = _d.classNames, styles2 = _d.styles, hideHead = _d.hideHead, fixedWeeks = _d.fixedWeeks, components = _d.components, weekStartsOn = _d.weekStartsOn, firstWeekContainsDate = _d.firstWeekContainsDate, ISOWeek = _d.ISOWeek; var weeks = getMonthWeeks(props.displayMonth, { useFixedWeeks: Boolean(fixedWeeks), ISOWeek, @@ -104002,7 +104051,7 @@ function Table(props) { var HeadComponent = (_a4 = components === null || components === void 0 ? void 0 : components.Head) !== null && _a4 !== void 0 ? _a4 : Head; var RowComponent = (_b = components === null || components === void 0 ? void 0 : components.Row) !== null && _b !== void 0 ? _b : Row; var FooterComponent = (_c = components === null || components === void 0 ? void 0 : components.Footer) !== null && _c !== void 0 ? _c : Footer; - return jsxRuntimeExports.jsxs("table", { id: props.id, className: classNames16.table, style: styles2.table, role: "grid", "aria-labelledby": props["aria-labelledby"], children: [!hideHead && jsxRuntimeExports.jsx(HeadComponent, {}), jsxRuntimeExports.jsx("tbody", { className: classNames16.tbody, style: styles2.tbody, children: weeks.map(function(week) { + return jsxRuntimeExports.jsxs("table", { id: props.id, className: classNames17.table, style: styles2.table, role: "grid", "aria-labelledby": props["aria-labelledby"], children: [!hideHead && jsxRuntimeExports.jsx(HeadComponent, {}), jsxRuntimeExports.jsx("tbody", { className: classNames17.tbody, style: styles2.tbody, children: weeks.map(function(week) { return jsxRuntimeExports.jsx(RowComponent, { displayMonth: props.displayMonth, dates: week.dates, weekNumber: week.weekNumber }, week.weekNumber); }) }), jsxRuntimeExports.jsx(FooterComponent, { displayMonth: props.displayMonth })] }); } @@ -104035,11 +104084,11 @@ function Month(props) { var _a4; var _b; var dayPicker = useDayPicker(); - var dir = dayPicker.dir, classNames16 = dayPicker.classNames, styles2 = dayPicker.styles, components = dayPicker.components; + var dir = dayPicker.dir, classNames17 = dayPicker.classNames, styles2 = dayPicker.styles, components = dayPicker.components; var displayMonths = useNavigation().displayMonths; var captionId = useId(dayPicker.id ? "".concat(dayPicker.id, "-").concat(props.displayIndex) : void 0); var tableId = dayPicker.id ? "".concat(dayPicker.id, "-grid-").concat(props.displayIndex) : void 0; - var className = [classNames16.month]; + var className = [classNames17.month]; var style = styles2.month; var isStart = props.displayIndex === 0; var isEnd = props.displayIndex === displayMonths.length - 1; @@ -104048,23 +104097,23 @@ function Month(props) { _a4 = [isStart, isEnd], isEnd = _a4[0], isStart = _a4[1]; } if (isStart) { - className.push(classNames16.caption_start); + className.push(classNames17.caption_start); style = __assign(__assign({}, style), styles2.caption_start); } if (isEnd) { - className.push(classNames16.caption_end); + className.push(classNames17.caption_end); style = __assign(__assign({}, style), styles2.caption_end); } if (isCenter) { - className.push(classNames16.caption_between); + className.push(classNames17.caption_between); style = __assign(__assign({}, style), styles2.caption_between); } var CaptionComponent = (_b = components === null || components === void 0 ? void 0 : components.Caption) !== null && _b !== void 0 ? _b : Caption; return jsxRuntimeExports.jsxs("div", { className: className.join(" "), style, children: [jsxRuntimeExports.jsx(CaptionComponent, { id: captionId, displayMonth: props.displayMonth, displayIndex: props.displayIndex }), jsxRuntimeExports.jsx(Table, { id: tableId, "aria-labelledby": captionId, displayMonth: props.displayMonth })] }, props.displayIndex); } function Months(props) { - var _a4 = useDayPicker(), classNames16 = _a4.classNames, styles2 = _a4.styles; - return jsxRuntimeExports.jsx("div", { className: classNames16.months, style: styles2.months, children: props.children }); + var _a4 = useDayPicker(), classNames17 = _a4.classNames, styles2 = _a4.styles; + return jsxRuntimeExports.jsx("div", { className: classNames17.months, style: styles2.months, children: props.children }); } function Root(_a4) { var _b, _c; @@ -104089,12 +104138,12 @@ function Root(_a4) { focusContext.focusTarget, focusContext ]); - var classNames16 = [dayPicker.classNames.root, dayPicker.className]; + var classNames17 = [dayPicker.classNames.root, dayPicker.className]; if (dayPicker.numberOfMonths > 1) { - classNames16.push(dayPicker.classNames.multiple_months); + classNames17.push(dayPicker.classNames.multiple_months); } if (dayPicker.showWeekNumber) { - classNames16.push(dayPicker.classNames.with_weeknumber); + classNames17.push(dayPicker.classNames.with_weeknumber); } var style = __assign(__assign({}, dayPicker.styles.root), dayPicker.style); var dataAttributes = Object.keys(initialProps).filter(function(key2) { @@ -104104,7 +104153,7 @@ function Root(_a4) { return __assign(__assign({}, attrs), (_a5 = {}, _a5[key2] = initialProps[key2], _a5)); }, {}); var MonthsComponent = (_c = (_b = initialProps.components) === null || _b === void 0 ? void 0 : _b.Months) !== null && _c !== void 0 ? _c : Months; - return jsxRuntimeExports.jsx("div", __assign({ className: classNames16.join(" "), style, dir: dayPicker.dir, id: dayPicker.id, nonce: initialProps.nonce, title: initialProps.title, lang: initialProps.lang }, dataAttributes, { children: jsxRuntimeExports.jsx(MonthsComponent, { children: navigation.displayMonths.map(function(month, i4) { + return jsxRuntimeExports.jsx("div", __assign({ className: classNames17.join(" "), style, dir: dayPicker.dir, id: dayPicker.id, nonce: initialProps.nonce, title: initialProps.title, lang: initialProps.lang }, dataAttributes, { children: jsxRuntimeExports.jsx(MonthsComponent, { children: navigation.displayMonths.map(function(month, i4) { return jsxRuntimeExports.jsx(Month, { displayIndex: i4, displayMonth: month }, i4); }) }) })); } @@ -104474,35 +104523,35 @@ var ImageCell = (props) => { import_react42.default.useEffect(() => { setValue(parseMultiString(initialValue)); }, [initialValue]); - const deleteValue = (index2) => { + const deleteValue = (index3) => { if (multi) { const newValue = [...value]; - newValue.splice(index2, 1); + newValue.splice(index3, 1); setValue(newValue); props.saveValue(serializeMultiString(newValue)); } else { props.saveValue(""); } }; - const saveValue = (index2, image) => { + const saveValue = (index3, image) => { if (props.multi) { - if (index2 == -1) { + if (index3 == -1) { props.saveValue(serializeMultiString([...value, image])); } else { props.saveValue( - serializeMultiString(value.map((f2, i4) => i4 == index2 ? image : f2)) + serializeMultiString(value.map((f2, i4) => i4 == index3 ? image : f2)) ); } } else { props.saveValue(image); } }; - const showModal2 = (index2, e5) => { + const showModal2 = (index3, e5) => { props.superstate.ui.openPalette( (_props) => /* @__PURE__ */ import_react42.default.createElement(ImageModal_default, { superstate: props.superstate, hide: _props.hide, - selectedPath: (image) => saveValue(index2, image) + selectedPath: (image) => saveValue(index3, image) }), windowFromDocument(e5.view.document) ); @@ -104565,7 +104614,7 @@ var LinkCell = (props) => { props.saveValue(serializeMultiDisplayString(_values)); } }; - const saveOptions = (_15, _value) => { + const saveOptions = (_16, _value) => { if (!props.multi) { setValue(_value); saveValue(_value); @@ -104874,29 +104923,29 @@ var ObjectCell = (props) => { const saveValue = (newValue) => { props.saveValue(JSON.stringify(newValue)); }; - const insertMultiValue = (index2) => { + const insertMultiValue = (index3) => { const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {}); props.saveValue( - JSON.stringify([...value.slice(0, index2), item, ...value.slice(index2)]) + JSON.stringify([...value.slice(0, index3), item, ...value.slice(index3)]) ); }; - const saveMultiValue = (newValue, index2) => { - if (index2 >= value.length) { + const saveMultiValue = (newValue, index3) => { + if (index3 >= value.length) { props.saveValue(JSON.stringify([...value, newValue])); return; } props.saveValue( JSON.stringify( value.map( - (f2, i4) => i4 == index2 ? newValue : f2 + (f2, i4) => i4 == index3 ? newValue : f2 ) ) ); }; - const deleteMultiValue = (index2) => { + const deleteMultiValue = (index3) => { props.saveValue( JSON.stringify( - value.filter((f2, i4) => i4 != index2) + value.filter((f2, i4) => i4 != index3) ) ); }; @@ -104907,40 +104956,40 @@ var ObjectCell = (props) => { [key2]: "" }); }; - const showPropertyMultiMenu = (e5, index2) => { + const showPropertyMultiMenu = (e5, index3) => { const offset2 = e5.target.getBoundingClientRect(); const menuOptions = []; menuOptions.push({ name: i18n_default.menu.insertAbove, onClick: (e6) => { - insertMultiValue(index2); + insertMultiValue(index3); } }); menuOptions.push({ name: i18n_default.menu.insertBelow, onClick: (e6) => { - insertMultiValue(index2 + 1); + insertMultiValue(index3 + 1); } }); menuOptions.push(menuSeparator); - if (index2 > 0) + if (index3 > 0) menuOptions.push({ name: i18n_default.menu.moveUp, onClick: (e6) => { props.saveValue( JSON.stringify( - arrayMove(value, index2, index2 - 1) + arrayMove(value, index3, index3 - 1) ) ); } }); - if (index2 < value.length - 1) + if (index3 < value.length - 1) menuOptions.push({ name: i18n_default.menu.moveDown, onClick: (e6) => { props.saveValue( JSON.stringify( - arrayMove(value, index2, index2 + 1) + arrayMove(value, index3, index3 + 1) ) ); } @@ -104950,7 +104999,7 @@ var ObjectCell = (props) => { name: i18n_default.buttons.delete, icon: "ui//trash", onClick: (e6) => { - deleteMultiValue(index2); + deleteMultiValue(index3); } }); props.superstate.ui.openMenu( @@ -105116,17 +105165,18 @@ var ObjectEditorModal = (props) => { [field.name]: "" } ); + return true; }, fileMetadata: true } ); }; - const insertMultiValue = (index2) => { + const insertMultiValue = (index3) => { const val = parseObject(value, props.property.type == "object-multi"); const type = parseFieldValue(fieldValue, props.property.type)?.type; const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {}); saveValue( - JSON.stringify([...val.slice(0, index2), item, ...val.slice(index2)]) + JSON.stringify([...val.slice(0, index3), item, ...val.slice(index3)]) ); }; return /* @__PURE__ */ import_react46.default.createElement("div", { @@ -105187,7 +105237,7 @@ var PropertySelectCell = (props) => { const [value, setValue] = (0, import_react47.useState)( parseLinkedPropertyToValue(props.initialValue) ); - const saveOptions = (_15, _value) => { + const saveOptions = (_16, _value) => { setValue(parseLinkedPropertyToValue(_value[0])); props.saveValue(_value[0]); }; @@ -105246,7 +105296,7 @@ var SpaceCell = (props) => { value: f2.path, description: f2.name })), - saveOptions: (_15, value) => props.saveValue(value[0]), + saveOptions: (_16, value) => props.saveValue(value[0]), removeOption: () => null, placeholder: i18n_default.labels.optionItemSelectPlaceholder, searchable: true, @@ -105263,7 +105313,7 @@ var SpaceCell = (props) => { value: f2.id, description: f2.name })), - saveOptions: (_15, value) => props.saveValue(`${spaceObject?.space}/#^${value[0]}`), + saveOptions: (_16, value) => props.saveValue(`${spaceObject?.space}/#^${value[0]}`), removeOption: () => null, placeholder: i18n_default.labels.optionItemSelectPlaceholder, searchable: true, @@ -105693,9 +105743,10 @@ var TableView = (props) => { updateFieldValue, updateValue: updateValue2 } = (0, import_react54.useContext)(ContextEditorContext); + const pageSize = props.superstate.settings.contextPagination ?? 25; const [pagination, setPagination] = import_react54.default.useState({ pageIndex: 0, - pageSize: 10 + pageSize }); const [activeId, setActiveId] = (0, import_react54.useState)(null); const [lastSelectedIndex, setLastSelectedIndex] = (0, import_react54.useState)(null); @@ -105726,7 +105777,7 @@ var TableView = (props) => { ), [predicate] ); - const newRow = (name319, index2, data3) => { + const newRow = (name319, index3, data3) => { if (dbSchema?.id == defaultContextSchemaID) { newPathInSpace(props.superstate, spaceCache, "md", name319, true); } else { @@ -105734,7 +105785,7 @@ var TableView = (props) => { createNewRow( tableData, primaryCol ? { [primaryCol.name]: name319 ?? "", ...data3 ?? {} } : data3 ?? {}, - index2 + index3 ) ); } @@ -105744,35 +105795,35 @@ var TableView = (props) => { (f2) => f2.find((p) => p == path2) ? f2.filter((p) => p != path2) : uniq([...f2, path2]) ); }; - const selectItem = (modifier, index2) => { + const selectItem = (modifier, index3) => { if (modifier.metaKey) { props.superstate.ui.openPath( - tableData.rows[parseInt(index2)][PathPropertyName], + tableData.rows[parseInt(index3)][PathPropertyName], false ); return; } if (modifier.ctrlKey) { - selectedRows.some((f2) => f2 == index2) ? selectRows( + selectedRows.some((f2) => f2 == index3) ? selectRows( null, - selectedRows.filter((f2) => f2 != index2) - ) : selectRows(index2, uniq([...selectedRows, index2])); + selectedRows.filter((f2) => f2 != index3) + ) : selectRows(index3, uniq([...selectedRows, index3])); } else if (modifier.shiftKey) { selectRows( - index2, + index3, uniq([ ...selectedRows, ...selectRange( lastSelectedIndex, - index2, + index3, data2.map((f2) => f2._index) ) ]) ); } else { - selectRows(index2, [index2]); + selectRows(index3, [index3]); } - setLastSelectedIndex(index2); + setLastSelectedIndex(index3); }; const onKeyDown = (e5) => { const setCellValue = (value) => { @@ -105879,14 +105930,14 @@ var TableView = (props) => { }, cell: ({ getValue, - row: { index: index2 }, + row: { index: index3 }, column: { colId }, cell, table: table2 }) => { const initialValue = getValue(); - const rowIndex = parseInt(data2[index2]["_index"]); - const tableIndex = parseInt(data2[index2]["_index"]); + const rowIndex = parseInt(data2[index3]["_index"]); + const tableIndex = parseInt(data2[index3]["_index"]); const saveValue = (value) => { setCurrentEdit(null); setSelectedColumn(null); @@ -105917,9 +105968,9 @@ var TableView = (props) => { setEditMode: setCurrentEdit, column: f2, editMode, - row: data2[index2], + row: data2[index3], contextTable, - source: data2[index2][PathPropertyName] + source: data2[index3][PathPropertyName] }; const fieldType = fieldTypeForType(f2.type, f2.name); if (!fieldType) { @@ -106036,7 +106087,7 @@ var TableView = (props) => { }); return result; }, [cols, tableData, predicate.colsCalc]); - const selectCell = (e5, index2, column2) => { + const selectCell = (e5, index3, column2) => { if (isTouchScreen(props.superstate.ui) || column2 == "+") return; selectItem( @@ -106046,12 +106097,12 @@ var TableView = (props) => { altKey: e5.altKey, shiftKey: e5.shiftKey }, - data2[index2]["_index"] + data2[index3]["_index"] ); setSelectedColumn(column2); if (e5.detail === 1) { } else if (e5.detail === 2) { - setCurrentEdit([column2, data2[index2]["_index"]]); + setCurrentEdit([column2, data2[index3]["_index"]]); } }; function handleDragEnd({ active, over }) { @@ -106178,8 +106229,8 @@ var TableView = (props) => { )))), /* @__PURE__ */ import_react54.default.createElement("tfoot", null, table.getCanNextPage() && /* @__PURE__ */ import_react54.default.createElement("tr", null, /* @__PURE__ */ import_react54.default.createElement("th", { className: "mk-row-new", colSpan: cols.length + (readMode ? 1 : 2), - onClick: () => table.setPageSize(pagination.pageSize + 25) - }, "Load More")), !readMode ? /* @__PURE__ */ import_react54.default.createElement("tr", null, /* @__PURE__ */ import_react54.default.createElement("th", { + onClick: () => table.setPageSize(pagination.pageSize + pageSize) + }, i18n_default.buttons.loadMore)), !readMode ? /* @__PURE__ */ import_react54.default.createElement("tr", null, /* @__PURE__ */ import_react54.default.createElement("th", { className: "mk-row-new", colSpan: cols.length + (readMode ? 1 : 2), "data-placeholder": i18n_default.hintText.newItem, @@ -106302,12 +106353,13 @@ var DataPropertyView = (props) => { [field.name]: "" } ); + return true; }, fileMetadata: true } ); }; - const insertMultiValue = (index2) => { + const insertMultiValue = (index3) => { const type = parseFieldValue(props.column.value, props.column.type)?.type; const value = parseObject( props.initialValue ?? "", @@ -106315,7 +106367,7 @@ var DataPropertyView = (props) => { ); const item = Object.keys(type).reduce((p, c3) => ({ ...p, [c3]: "" }), {}); props.updateValue( - JSON.stringify([...value.slice(0, index2), item, ...value.slice(index2)]) + JSON.stringify([...value.slice(0, index3), item, ...value.slice(index3)]) ); }; return !props.compactMode ? /* @__PURE__ */ import_react55.default.createElement(import_react55.default.Fragment, null, /* @__PURE__ */ import_react55.default.createElement("div", { @@ -106442,7 +106494,7 @@ var EditPropertiesSubmenu = (props) => { }; // src/core/react/components/UI/Menus/contexts/rowContextMenu.tsx -var showRowContextMenu = async (e5, superstate, contextPath, schema, index2) => { +var showRowContextMenu = async (e5, superstate, contextPath, schema, index3) => { e5.preventDefault(); const context = await superstate.spaceManager.readTable(contextPath, schema); const dbSchema = context?.schema; @@ -106450,7 +106502,7 @@ var showRowContextMenu = async (e5, superstate, contextPath, schema, index2) => if (!context) return; if (dbSchema.primary == "true") { - const row2 = rows.find((f2, i4) => i4 == index2); + const row2 = rows.find((f2, i4) => i4 == index3); if (row2) { if (superstate.spacesIndex.has(row2[PathPropertyName])) { const pathState = superstate.pathsIndex.get(row2[PathPropertyName]); @@ -106474,7 +106526,7 @@ var showRowContextMenu = async (e5, superstate, contextPath, schema, index2) => pathState: superstate.pathsIndex.get(contextPath), path: contextPath, schema, - index: index2 + index: index3 }; menuOptions.push({ name: i18n_default.menu.editProperties, @@ -106498,7 +106550,7 @@ var showRowContextMenu = async (e5, superstate, contextPath, schema, index2) => superstate.spaceManager, superstate.spacesIndex.get(contextPath)?.space, schema, - index2 + index3 ); } }); @@ -106596,10 +106648,10 @@ var API = class { select: (path2, table) => { return this.superstate.spaceManager.readTable(path2, table)?.then((f2) => f2?.rows); }, - update: (path2, table, index2, row2) => { + update: (path2, table, index3, row2) => { const space2 = this.superstate.spacesIndex.get(path2); if (space2) - return updateTableRow(this.superstate.spaceManager, space2.space, table, index2, row2); + return updateTableRow(this.superstate.spaceManager, space2.space, table, index3, row2); }, insert: (path2, schema, row2) => { if (schema == defaultContextSchemaID) { @@ -106622,21 +106674,21 @@ var API = class { newSchema ); }, - open: async (space2, table, index2, target) => { + open: async (space2, table, index3, target) => { const context = await this.superstate.spaceManager.readTable(space2, table); if (table == defaultContextSchemaID) { - const path2 = this.superstate.spaceManager.resolvePath(context?.rows[index2]?.[PathPropertyName], space2); + const path2 = this.superstate.spaceManager.resolvePath(context?.rows[index3]?.[PathPropertyName], space2); this.superstate.ui.openPath(path2, target); } else { } }, - contextMenu: async (e5, space2, table, index2) => { + contextMenu: async (e5, space2, table, index3) => { const context = await this.superstate.spaceManager.readTable(space2, table); if (table == defaultContextSchemaID) { - const path2 = context?.rows[index2]?.[PathPropertyName]; + const path2 = context?.rows[index3]?.[PathPropertyName]; showPathContextMenu(this.superstate, path2, space2, { x: e5.clientX, y: e5.clientY, width: 0, height: 0 }, windowFromDocument(e5.view.document)); } else { - showRowContextMenu(e5, this.superstate, space2, table, index2); + showRowContextMenu(e5, this.superstate, space2, table, index3); } } }; @@ -106654,7 +106706,8 @@ var API = class { newPathInSpace(this.superstate, this.superstate.spacesIndex.get(path2), "md", name319, true).then((f2) => { if (row2) saveProperties(this.superstate, f2, { - ...row2 + ...row2, + [PathPropertyName]: f2 }); }); } else { @@ -106890,7 +106943,7 @@ var filterPathCache = (paths, def, props) => { if (def.field == "outlinks") { value = serializeMultiString(f2.outlinks ?? []); } else if (def.field == "inlinks") { - value = serializeMultiString(f2.inlinks ?? []); + value = serializeMultiString(f2.metadata?.inlinks ?? []); } else if (def.field == "tags") { value = serializeMultiString(f2.tags ?? []); } @@ -109602,10 +109655,10 @@ function inlineWorker(scriptText, name319) { // src/core/superstate/workers/indexer/indexer.worker.ts function Worker2() { - return inlineWorker(`"use strict";var Sq=Object.create;var xb=Object.defineProperty;var Nq=Object.getOwnPropertyDescriptor;var Aq=Object.getOwnPropertyNames;var Mq=Object.getPrototypeOf,Cq=Object.prototype.hasOwnProperty;var vn=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Eq=(e,r)=>{for(var t in r)xb(e,t,{get:r[t],enumerable:!0})},Tq=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Aq(r))!Cq.call(e,a)&&a!==t&&xb(e,a,{get:()=>r[a],enumerable:!(n=Nq(r,a))||n.enumerable});return e};var ma=(e,r,t)=>(t=e!=null?Sq(Mq(e)):{},Tq(r||!e||!e.__esModule?xb(t,"default",{value:e,enumerable:!0}):t,e));var fm=vn((gu,Dc)=>{(function(){var e,r="4.17.21",t=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",i="Invalid \`variable\` option passed into \`_.template\`",u="__lodash_hash_undefined__",l=500,c="__lodash_placeholder__",o=1,s=2,m=4,d=1,h=2,y=1,v=2,x=4,w=8,C=16,b=32,N=64,M=128,S=256,O=512,_=30,E="...",T=800,R=16,k=1,W=2,G=3,H=1/0,L=9007199254740991,q=17976931348623157e292,K=0/0,z=4294967295,oe=z-1,pe=z>>>1,ae=[["ary",M],["bind",y],["bindKey",v],["curry",w],["curryRight",C],["flip",O],["partial",b],["partialRight",N],["rearg",S]],$="[object Arguments]",le="[object Array]",Ee="[object AsyncFunction]",me="[object Boolean]",ge="[object Date]",Se="[object DOMException]",ye="[object Error]",be="[object Function]",De="[object GeneratorFunction]",Ae="[object Map]",We="[object Number]",Je="[object Null]",J="[object Object]",re="[object Promise]",xe="[object Proxy]",j="[object RegExp]",ne="[object Set]",ue="[object String]",Me="[object Symbol]",Ce="[object Undefined]",Le="[object WeakMap]",Ie="[object WeakSet]",fr="[object ArrayBuffer]",or="[object DataView]",Ke="[object Float32Array]",Pr="[object Float64Array]",ee="[object Int8Array]",ce="[object Int16Array]",we="[object Int32Array]",Be="[object Uint8Array]",qe="[object Uint8ClampedArray]",Te="[object Uint16Array]",Re="[object Uint32Array]",Ye=/\\b__p \\+= '';/g,B=/\\b(__p \\+=) '' \\+/g,Q=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g,ve=/&(?:amp|lt|gt|quot|#39);/g,Pe=/[&<>"']/g,tr=RegExp(ve.source),cr=RegExp(Pe.source),Xr=/<%-([\\s\\S]+?)%>/g,Pt=/<%([\\s\\S]+?)%>/g,Xt=/<%=([\\s\\S]+?)%>/g,mi=/\\.|\\[(?:[^[\\]]*|(["'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,Ya=/^\\w*$/,Ef=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,Ha=/[\\\\^$.*+?()[\\]{}|]/g,so=RegExp(Ha.source),nr=/^\\s+/,Tf=/\\s/,Ff=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,mn=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,Ko=/,? & /,ot=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,Ii=/[()=,{}\\[\\]\\/\\s]/,_f=/\\\\(\\\\)?/g,Gt=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,Un=/\\w*$/,Wn=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,On=/^\\[object .+?Constructor\\]$/,aa=/^0o[0-7]+$/i,$a=/^(?:0|[1-9]\\d*)$/,Of=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,uo=/($^)/,Bf=/['\\n\\r\\u2028\\u2029\\\\]/g,vt="\\\\ud800-\\\\udfff",fo="\\\\u0300-\\\\u036f",Pf="\\\\ufe20-\\\\ufe2f",Ls="\\\\u20d0-\\\\u20ff",jo=fo+Pf+Ls,zs="\\\\u2700-\\\\u27bf",Us="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",Ri="\\\\xac\\\\xb1\\\\xd7\\\\xf7",et="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",on="\\\\u2000-\\\\u206f",If=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",pi="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",Ga="\\\\ufe0e\\\\ufe0f",Ws=Ri+et+on+If,Rf="['\\u2019]",vx="["+vt+"]",qf="["+Ws+"]",di="["+jo+"]",kf="\\\\d+",gx="["+zs+"]",Gc="["+Us+"]",co="[^"+vt+Ws+kf+zs+Us+pi+"]",lo="\\\\ud83c[\\\\udffb-\\\\udfff]",Vc="(?:"+di+"|"+lo+")",mo="[^"+vt+"]",ia="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Lf="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",po="["+pi+"]",Zc="\\\\u200d",Qc="(?:"+Gc+"|"+co+")",yx="(?:"+po+"|"+co+")",Xc="(?:"+Rf+"(?:d|ll|m|re|s|t|ve))?",Jc="(?:"+Rf+"(?:D|LL|M|RE|S|T|VE))?",Kc=Vc+"?",Ys="["+Ga+"]?",xx="(?:"+Zc+"(?:"+[mo,ia,Lf].join("|")+")"+Ys+Kc+")*",jc="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",bx="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",el=Ys+Kc+xx,wx="(?:"+[gx,ia,Lf].join("|")+")"+el,Dx="(?:"+[mo+di+"?",di,ia,Lf,vx].join("|")+")",Sx=RegExp(Rf,"g"),Nx=RegExp(di,"g"),zf=RegExp(lo+"(?="+lo+")|"+Dx+el,"g"),Ax=RegExp([po+"?"+Gc+"+"+Xc+"(?="+[qf,po,"$"].join("|")+")",yx+"+"+Jc+"(?="+[qf,po+Qc,"$"].join("|")+")",po+"?"+Qc+"+"+Xc,po+"+"+Jc,bx,jc,kf,wx].join("|"),"g"),Mx=RegExp("["+Zc+vt+jo+Ga+"]"),Cx=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ex=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Tx=-1,xt={};xt[Ke]=xt[Pr]=xt[ee]=xt[ce]=xt[we]=xt[Be]=xt[qe]=xt[Te]=xt[Re]=!0,xt[$]=xt[le]=xt[fr]=xt[me]=xt[or]=xt[ge]=xt[ye]=xt[be]=xt[Ae]=xt[We]=xt[J]=xt[j]=xt[ne]=xt[ue]=xt[Le]=!1;var gt={};gt[$]=gt[le]=gt[fr]=gt[or]=gt[me]=gt[ge]=gt[Ke]=gt[Pr]=gt[ee]=gt[ce]=gt[we]=gt[Ae]=gt[We]=gt[J]=gt[j]=gt[ne]=gt[ue]=gt[Me]=gt[Be]=gt[qe]=gt[Te]=gt[Re]=!0,gt[ye]=gt[be]=gt[Le]=!1;var Fx={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"'n",\\u017F:"s"},Uf={"&":"&","<":"<",">":">",'"':""","'":"'"},Wf={"&":"&","<":"<",">":">",""":'"',"'":"'"},_x={"\\\\":"\\\\","'":"'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},rl=parseFloat,tl=parseInt,nl=typeof global=="object"&&global&&global.Object===Object&&global,Ox=typeof self=="object"&&self&&self.Object===Object&&self,Vt=nl||Ox||Function("return this")(),Yf=typeof gu=="object"&&gu&&!gu.nodeType&&gu,hi=Yf&&typeof Dc=="object"&&Dc&&!Dc.nodeType&&Dc,bt=hi&&hi.exports===Yf,qi=bt&&nl.process,sn=function(){try{var de=hi&&hi.require&&hi.require("util").types;return de||qi&&qi.binding&&qi.binding("util")}catch{}}(),al=sn&&sn.isArrayBuffer,Hf=sn&&sn.isDate,il=sn&&sn.isMap,ol=sn&&sn.isRegExp,es=sn&&sn.isSet,Va=sn&&sn.isTypedArray;function pn(de,_e,Ne){switch(Ne.length){case 0:return de.call(_e);case 1:return de.call(_e,Ne[0]);case 2:return de.call(_e,Ne[0],Ne[1]);case 3:return de.call(_e,Ne[0],Ne[1],Ne[2])}return de.apply(_e,Ne)}function Bx(de,_e,Ne,ir){for(var Ar=-1,rt=de==null?0:de.length;++Ar-1}function $f(de,_e,Ne){for(var ir=-1,Ar=de==null?0:de.length;++ir-1;);return Ne}function pl(de,_e){for(var Ne=de.length;Ne--&&ho(_e,de[Ne],0)>-1;);return Ne}function Lx(de,_e){for(var Ne=de.length,ir=0;Ne--;)de[Ne]===_e&&++ir;return ir}var dl=rs(Fx),zx=rs(Uf);function Ux(de){return"\\\\"+_x[de]}function Wx(de,_e){return de==null?e:de[_e]}function Sa(de){return Mx.test(de)}function Yx(de){return Cx.test(de)}function Hx(de){for(var _e,Ne=[];!(_e=de.next()).done;)Ne.push(_e.value);return Ne}function jf(de){var _e=-1,Ne=Array(de.size);return de.forEach(function(ir,Ar){Ne[++_e]=[Ar,ir]}),Ne}function ts(de,_e){return function(Ne){return de(_e(Ne))}}function oa(de,_e){for(var Ne=-1,ir=de.length,Ar=0,rt=[];++Ne-1}function Tl(f,p){var D=this.__data__,P=$n(D,f);return P<0?(++this.size,D.push([f,p])):D[P][1]=p,this}Xa.prototype.clear=y1,Xa.prototype.delete=El,Xa.prototype.get=x1,Xa.prototype.has=b1,Xa.prototype.set=Tl;function Ja(f){var p=-1,D=f==null?0:f.length;for(this.clear();++p=p?f:p)),f}function Pn(f,p,D,P,Y,X){var ie,fe=p&o,he=p&s,ke=p&m;if(D&&(ie=Y?D(f,P,Y,X):D(f)),ie!==e)return ie;if(!_t(f))return f;var ze=Or(f);if(ze){if(ie=K5(f),!fe)return Gn(f,ie)}else{var He=Dn(f),er=He==be||He==De;if(Mo(f))return KS(f,fe);if(He==J||He==$||er&&!Y){if(ie=he||er?{}:gN(f),!fe)return he?U5(f,T1(ie,f)):z5(f,nc(ie,f))}else{if(!gt[He])return Y?f:{};ie=j5(f,He,fe)}}X||(X=new sa);var mr=X.get(f);if(mr)return mr;X.set(f,ie),GN(f)?f.forEach(function(Sr){ie.add(Pn(Sr,p,D,Sr,f,X))}):HN(f)&&f.forEach(function(Sr,Yr){ie.set(Yr,Pn(Sr,p,D,Yr,f,X))});var Dr=ke?he?X1:Q1:he?Zn:un,kr=ze?e:Dr(f);return It(kr||f,function(Sr,Yr){kr&&(Yr=Sr,Sr=f[Yr]),ms(ie,Yr,Pn(Sr,p,D,Yr,f,X))}),ie}function ac(f){var p=un(f);return function(D){return Pl(D,f,p)}}function Pl(f,p,D){var P=D.length;if(f==null)return!P;for(f=zr(f);P--;){var Y=D[P],X=p[Y],ie=f[Y];if(ie===e&&!(Y in f)||!X(ie))return!1}return!0}function Il(f,p,D){if(typeof f!="function")throw new Yn(a);return pc(function(){f.apply(e,D)},p)}function In(f,p,D,P){var Y=-1,X=$s,ie=!0,fe=f.length,he=[],ke=p.length;if(!fe)return he;D&&(p=dt(p,wn(D))),P?(X=$f,ie=!1):p.length>=t&&(X=vo,ie=!1,p=new Ui(p));e:for(;++YY?0:Y+D),P=P===e||P>Y?Y:Rr(P),P<0&&(P+=Y),P=D>P?0:ZN(P);D0&&D(fe)?p>1?Jt(fe,p-1,D,P,Y):Da(Y,fe):P||(Y[Y.length]=fe)}return Y}var ic=aN(),kl=aN(!0);function Na(f,p){return f&&ic(f,p,un)}function oc(f,p){return f&&kl(f,p,un)}function Aa(f,p){return vi(p,function(D){return Vi(f[D])})}function Yi(f,p){p=No(p,f);for(var D=0,P=p.length;f!=null&&Dp}function O1(f,p){return f!=null&&ut.call(f,p)}function B1(f,p){return f!=null&&p in zr(f)}function P1(f,p,D){return f>=Ft(p,D)&&f=120&&ze.length>=120)?new Ui(ie&&ze):e}ze=f[0];var He=-1,er=fe[0];e:for(;++He-1;)fe!==f&&Li.call(fe,he,1),Li.call(f,he,1);return f}function HS(f,p){for(var D=f?p.length:0,P=D-1;D--;){var Y=p[D];if(D==P||Y!==X){var X=Y;Gi(Y)?Li.call(f,Y,1):W1(f,Y)}}return f}function L1(f,p){return f+os(Ml()*(p-f+1))}function T5(f,p,D,P){for(var Y=-1,X=Rt(eu((p-f)/(D||1)),0),ie=Ne(X);X--;)ie[P?X:++Y]=f,f+=D;return ie}function z1(f,p){var D="";if(!f||p<1||p>L)return D;do p%2&&(D+=f),p=os(p/2),p&&(f+=f);while(p);return D}function Ur(f,p){return nb(bN(f,p,Qn),f+"")}function F5(f){return Bl(hu(f))}function _5(f,p){var D=hu(f);return Xl(D,Wi(p,0,D.length))}function cc(f,p,D,P){if(!_t(f))return f;p=No(p,f);for(var Y=-1,X=p.length,ie=X-1,fe=f;fe!=null&&++YY?0:Y+p),D=D>Y?Y:D,D<0&&(D+=Y),Y=p>D?0:D-p>>>0,p>>>=0;for(var X=Ne(Y);++P>>1,ie=f[X];ie!==null&&!fa(ie)&&(D?ie<=p:ie=t){var ke=p?null:$5(f);if(ke)return go(ke);ie=!1,Y=vo,he=new Ui}else he=p?[]:fe;e:for(;++P=P?f:Ea(f,p,D)}var JS=t1||function(f){return Vt.clearTimeout(f)};function KS(f,p){if(p)return f.slice();var D=f.length,P=xl?xl(D):new f.constructor(D);return f.copy(P),P}function G1(f){var p=new f.constructor(f.byteLength);return new Js(p).set(new Js(f)),p}function R5(f,p){var D=p?G1(f.buffer):f.buffer;return new f.constructor(D,f.byteOffset,f.byteLength)}function q5(f){var p=new f.constructor(f.source,Un.exec(f));return p.lastIndex=f.lastIndex,p}function k5(f){return ls?zr(ls.call(f)):{}}function jS(f,p){var D=p?G1(f.buffer):f.buffer;return new f.constructor(D,f.byteOffset,f.length)}function eN(f,p){if(f!==p){var D=f!==e,P=f===null,Y=f===f,X=fa(f),ie=p!==e,fe=p===null,he=p===p,ke=fa(p);if(!fe&&!ke&&!X&&f>p||X&&ie&&he&&!fe&&!ke||P&&ie&&he||!D&&he||!Y)return 1;if(!P&&!X&&!ke&&f=fe)return he;var ke=D[P];return he*(ke=="desc"?-1:1)}}return f.index-p.index}function rN(f,p,D,P){for(var Y=-1,X=f.length,ie=D.length,fe=-1,he=p.length,ke=Rt(X-ie,0),ze=Ne(he+ke),He=!P;++fe1?D[Y-1]:e,ie=Y>2?D[2]:e;for(X=f.length>3&&typeof X=="function"?(Y--,X):e,ie&&Rn(D[0],D[1],ie)&&(X=Y<3?e:X,Y=1),p=zr(p);++P-1?Y[X?p[ie]:ie]:e}}function sN(f){return $i(function(p){var D=p.length,P=D,Y=Hn.prototype.thru;for(f&&p.reverse();P--;){var X=p[P];if(typeof X!="function")throw new Yn(a);if(Y&&!ie&&Zl(X)=="wrapper")var ie=new Hn([],!0)}for(P=ie?P:D;++P1&&Zr.reverse(),ze&&hefe))return!1;var ke=X.get(f),ze=X.get(p);if(ke&&ze)return ke==p&&ze==f;var He=-1,er=!0,mr=D&h?new Ui:e;for(X.set(f,p),X.set(p,f);++He1?"& ":"")+p[P],p=p.join(D>2?", ":" "),f.replace(Ff,\`{ + return inlineWorker(`"use strict";var Nq=Object.create;var yb=Object.defineProperty;var Aq=Object.getOwnPropertyDescriptor;var Mq=Object.getOwnPropertyNames;var Cq=Object.getPrototypeOf,Eq=Object.prototype.hasOwnProperty;var vn=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Tq=(e,r)=>{for(var t in r)yb(e,t,{get:r[t],enumerable:!0})},Fq=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Mq(r))!Eq.call(e,a)&&a!==t&&yb(e,a,{get:()=>r[a],enumerable:!(n=Aq(r,a))||n.enumerable});return e};var ma=(e,r,t)=>(t=e!=null?Nq(Cq(e)):{},Fq(r||!e||!e.__esModule?yb(t,"default",{value:e,enumerable:!0}):t,e));var um=vn((gu,Dc)=>{(function(){var e,r="4.17.21",t=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",i="Invalid \`variable\` option passed into \`_.template\`",s="__lodash_hash_undefined__",l=500,c="__lodash_placeholder__",o=1,u=2,m=4,d=1,h=2,y=1,v=2,x=4,w=8,C=16,b=32,N=64,M=128,S=256,O=512,_=30,E="...",T=800,R=16,L=1,H=2,V=3,W=1/0,k=9007199254740991,q=17976931348623157e292,K=0/0,z=4294967295,oe=z-1,le=z>>>1,ae=[["ary",M],["bind",y],["bindKey",v],["curry",w],["curryRight",C],["flip",O],["partial",b],["partialRight",N],["rearg",S]],$="[object Arguments]",me="[object Array]",Ee="[object AsyncFunction]",pe="[object Boolean]",ge="[object Date]",Se="[object DOMException]",ye="[object Error]",be="[object Function]",De="[object GeneratorFunction]",Ae="[object Map]",We="[object Number]",Je="[object Null]",J="[object Object]",re="[object Promise]",xe="[object Proxy]",j="[object RegExp]",ne="[object Set]",ue="[object String]",Me="[object Symbol]",Ce="[object Undefined]",Le="[object WeakMap]",Ie="[object WeakSet]",fr="[object ArrayBuffer]",or="[object DataView]",Ke="[object Float32Array]",Pr="[object Float64Array]",ee="[object Int8Array]",ce="[object Int16Array]",we="[object Int32Array]",Be="[object Uint8Array]",qe="[object Uint8ClampedArray]",Te="[object Uint16Array]",Re="[object Uint32Array]",Ye=/\\b__p \\+= '';/g,B=/\\b(__p \\+=) '' \\+/g,Q=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g,ve=/&(?:amp|lt|gt|quot|#39);/g,Pe=/[&<>"']/g,tr=RegExp(ve.source),cr=RegExp(Pe.source),Xr=/<%-([\\s\\S]+?)%>/g,Pt=/<%([\\s\\S]+?)%>/g,Xt=/<%=([\\s\\S]+?)%>/g,mi=/\\.|\\[(?:[^[\\]]*|(["'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,Ya=/^\\w*$/,Ef=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,Ha=/[\\\\^$.*+?()[\\]{}|]/g,so=RegExp(Ha.source),nr=/^\\s+/,Tf=/\\s/,Ff=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,mn=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,Ko=/,? & /,ot=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,Ii=/[()=,{}\\[\\]\\/\\s]/,_f=/\\\\(\\\\)?/g,Gt=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,Un=/\\w*$/,Wn=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,On=/^\\[object .+?Constructor\\]$/,aa=/^0o[0-7]+$/i,$a=/^(?:0|[1-9]\\d*)$/,Of=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,uo=/($^)/,Bf=/['\\n\\r\\u2028\\u2029\\\\]/g,vt="\\\\ud800-\\\\udfff",fo="\\\\u0300-\\\\u036f",Pf="\\\\ufe20-\\\\ufe2f",Ls="\\\\u20d0-\\\\u20ff",jo=fo+Pf+Ls,zs="\\\\u2700-\\\\u27bf",Us="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",Ri="\\\\xac\\\\xb1\\\\xd7\\\\xf7",et="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",on="\\\\u2000-\\\\u206f",If=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",pi="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",Ga="\\\\ufe0e\\\\ufe0f",Ws=Ri+et+on+If,Rf="['\\u2019]",hx="["+vt+"]",qf="["+Ws+"]",di="["+jo+"]",kf="\\\\d+",vx="["+zs+"]",Gc="["+Us+"]",co="[^"+vt+Ws+kf+zs+Us+pi+"]",lo="\\\\ud83c[\\\\udffb-\\\\udfff]",Vc="(?:"+di+"|"+lo+")",mo="[^"+vt+"]",ia="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Lf="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",po="["+pi+"]",Zc="\\\\u200d",Qc="(?:"+Gc+"|"+co+")",gx="(?:"+po+"|"+co+")",Xc="(?:"+Rf+"(?:d|ll|m|re|s|t|ve))?",Jc="(?:"+Rf+"(?:D|LL|M|RE|S|T|VE))?",Kc=Vc+"?",Ys="["+Ga+"]?",yx="(?:"+Zc+"(?:"+[mo,ia,Lf].join("|")+")"+Ys+Kc+")*",jc="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",xx="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",el=Ys+Kc+yx,bx="(?:"+[vx,ia,Lf].join("|")+")"+el,wx="(?:"+[mo+di+"?",di,ia,Lf,hx].join("|")+")",Dx=RegExp(Rf,"g"),Sx=RegExp(di,"g"),zf=RegExp(lo+"(?="+lo+")|"+wx+el,"g"),Nx=RegExp([po+"?"+Gc+"+"+Xc+"(?="+[qf,po,"$"].join("|")+")",gx+"+"+Jc+"(?="+[qf,po+Qc,"$"].join("|")+")",po+"?"+Qc+"+"+Xc,po+"+"+Jc,xx,jc,kf,bx].join("|"),"g"),Ax=RegExp("["+Zc+vt+jo+Ga+"]"),Mx=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Cx=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ex=-1,xt={};xt[Ke]=xt[Pr]=xt[ee]=xt[ce]=xt[we]=xt[Be]=xt[qe]=xt[Te]=xt[Re]=!0,xt[$]=xt[me]=xt[fr]=xt[pe]=xt[or]=xt[ge]=xt[ye]=xt[be]=xt[Ae]=xt[We]=xt[J]=xt[j]=xt[ne]=xt[ue]=xt[Le]=!1;var gt={};gt[$]=gt[me]=gt[fr]=gt[or]=gt[pe]=gt[ge]=gt[Ke]=gt[Pr]=gt[ee]=gt[ce]=gt[we]=gt[Ae]=gt[We]=gt[J]=gt[j]=gt[ne]=gt[ue]=gt[Me]=gt[Be]=gt[qe]=gt[Te]=gt[Re]=!0,gt[ye]=gt[be]=gt[Le]=!1;var Tx={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"'n",\\u017F:"s"},Uf={"&":"&","<":"<",">":">",'"':""","'":"'"},Wf={"&":"&","<":"<",">":">",""":'"',"'":"'"},Fx={"\\\\":"\\\\","'":"'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},rl=parseFloat,tl=parseInt,nl=typeof global=="object"&&global&&global.Object===Object&&global,_x=typeof self=="object"&&self&&self.Object===Object&&self,Vt=nl||_x||Function("return this")(),Yf=typeof gu=="object"&&gu&&!gu.nodeType&&gu,hi=Yf&&typeof Dc=="object"&&Dc&&!Dc.nodeType&&Dc,bt=hi&&hi.exports===Yf,qi=bt&&nl.process,sn=function(){try{var de=hi&&hi.require&&hi.require("util").types;return de||qi&&qi.binding&&qi.binding("util")}catch{}}(),al=sn&&sn.isArrayBuffer,Hf=sn&&sn.isDate,il=sn&&sn.isMap,ol=sn&&sn.isRegExp,es=sn&&sn.isSet,Va=sn&&sn.isTypedArray;function pn(de,_e,Ne){switch(Ne.length){case 0:return de.call(_e);case 1:return de.call(_e,Ne[0]);case 2:return de.call(_e,Ne[0],Ne[1]);case 3:return de.call(_e,Ne[0],Ne[1],Ne[2])}return de.apply(_e,Ne)}function Ox(de,_e,Ne,ir){for(var Ar=-1,rt=de==null?0:de.length;++Ar-1}function $f(de,_e,Ne){for(var ir=-1,Ar=de==null?0:de.length;++ir-1;);return Ne}function pl(de,_e){for(var Ne=de.length;Ne--&&ho(_e,de[Ne],0)>-1;);return Ne}function kx(de,_e){for(var Ne=de.length,ir=0;Ne--;)de[Ne]===_e&&++ir;return ir}var dl=rs(Tx),Lx=rs(Uf);function zx(de){return"\\\\"+Fx[de]}function Ux(de,_e){return de==null?e:de[_e]}function Sa(de){return Ax.test(de)}function Wx(de){return Mx.test(de)}function Yx(de){for(var _e,Ne=[];!(_e=de.next()).done;)Ne.push(_e.value);return Ne}function jf(de){var _e=-1,Ne=Array(de.size);return de.forEach(function(ir,Ar){Ne[++_e]=[Ar,ir]}),Ne}function ts(de,_e){return function(Ne){return de(_e(Ne))}}function oa(de,_e){for(var Ne=-1,ir=de.length,Ar=0,rt=[];++Ne-1}function Tl(f,p){var D=this.__data__,P=$n(D,f);return P<0?(++this.size,D.push([f,p])):D[P][1]=p,this}Xa.prototype.clear=g1,Xa.prototype.delete=El,Xa.prototype.get=y1,Xa.prototype.has=x1,Xa.prototype.set=Tl;function Ja(f){var p=-1,D=f==null?0:f.length;for(this.clear();++p=p?f:p)),f}function Pn(f,p,D,P,Y,X){var ie,fe=p&o,he=p&u,ke=p&m;if(D&&(ie=Y?D(f,P,Y,X):D(f)),ie!==e)return ie;if(!_t(f))return f;var ze=Or(f);if(ze){if(ie=j5(f),!fe)return Gn(f,ie)}else{var He=Dn(f),er=He==be||He==De;if(Mo(f))return KS(f,fe);if(He==J||He==$||er&&!Y){if(ie=he||er?{}:gN(f),!fe)return he?W5(f,E1(ie,f)):U5(f,nc(ie,f))}else{if(!gt[He])return Y?f:{};ie=e8(f,He,fe)}}X||(X=new sa);var mr=X.get(f);if(mr)return mr;X.set(f,ie),GN(f)?f.forEach(function(Sr){ie.add(Pn(Sr,p,D,Sr,f,X))}):HN(f)&&f.forEach(function(Sr,Yr){ie.set(Yr,Pn(Sr,p,D,Yr,f,X))});var Dr=ke?he?Q1:Z1:he?Zn:un,kr=ze?e:Dr(f);return It(kr||f,function(Sr,Yr){kr&&(Yr=Sr,Sr=f[Yr]),ms(ie,Yr,Pn(Sr,p,D,Yr,f,X))}),ie}function ac(f){var p=un(f);return function(D){return Pl(D,f,p)}}function Pl(f,p,D){var P=D.length;if(f==null)return!P;for(f=zr(f);P--;){var Y=D[P],X=p[Y],ie=f[Y];if(ie===e&&!(Y in f)||!X(ie))return!1}return!0}function Il(f,p,D){if(typeof f!="function")throw new Yn(a);return pc(function(){f.apply(e,D)},p)}function In(f,p,D,P){var Y=-1,X=$s,ie=!0,fe=f.length,he=[],ke=p.length;if(!fe)return he;D&&(p=dt(p,wn(D))),P?(X=$f,ie=!1):p.length>=t&&(X=vo,ie=!1,p=new Ui(p));e:for(;++YY?0:Y+D),P=P===e||P>Y?Y:Rr(P),P<0&&(P+=Y),P=D>P?0:ZN(P);D0&&D(fe)?p>1?Jt(fe,p-1,D,P,Y):Da(Y,fe):P||(Y[Y.length]=fe)}return Y}var ic=aN(),kl=aN(!0);function Na(f,p){return f&&ic(f,p,un)}function oc(f,p){return f&&kl(f,p,un)}function Aa(f,p){return vi(p,function(D){return Vi(f[D])})}function Yi(f,p){p=No(p,f);for(var D=0,P=p.length;f!=null&&Dp}function _1(f,p){return f!=null&&ut.call(f,p)}function O1(f,p){return f!=null&&p in zr(f)}function B1(f,p,D){return f>=Ft(p,D)&&f=120&&ze.length>=120)?new Ui(ie&&ze):e}ze=f[0];var He=-1,er=fe[0];e:for(;++He-1;)fe!==f&&Li.call(fe,he,1),Li.call(f,he,1);return f}function HS(f,p){for(var D=f?p.length:0,P=D-1;D--;){var Y=p[D];if(D==P||Y!==X){var X=Y;Gi(Y)?Li.call(f,Y,1):U1(f,Y)}}return f}function k1(f,p){return f+os(Ml()*(p-f+1))}function F5(f,p,D,P){for(var Y=-1,X=Rt(eu((p-f)/(D||1)),0),ie=Ne(X);X--;)ie[P?X:++Y]=f,f+=D;return ie}function L1(f,p){var D="";if(!f||p<1||p>k)return D;do p%2&&(D+=f),p=os(p/2),p&&(f+=f);while(p);return D}function Ur(f,p){return tb(bN(f,p,Qn),f+"")}function _5(f){return Bl(hu(f))}function O5(f,p){var D=hu(f);return Xl(D,Wi(p,0,D.length))}function cc(f,p,D,P){if(!_t(f))return f;p=No(p,f);for(var Y=-1,X=p.length,ie=X-1,fe=f;fe!=null&&++YY?0:Y+p),D=D>Y?Y:D,D<0&&(D+=Y),Y=p>D?0:D-p>>>0,p>>>=0;for(var X=Ne(Y);++P>>1,ie=f[X];ie!==null&&!fa(ie)&&(D?ie<=p:ie=t){var ke=p?null:G5(f);if(ke)return go(ke);ie=!1,Y=vo,he=new Ui}else he=p?[]:fe;e:for(;++P=P?f:Ea(f,p,D)}var JS=r1||function(f){return Vt.clearTimeout(f)};function KS(f,p){if(p)return f.slice();var D=f.length,P=xl?xl(D):new f.constructor(D);return f.copy(P),P}function $1(f){var p=new f.constructor(f.byteLength);return new Js(p).set(new Js(f)),p}function q5(f,p){var D=p?$1(f.buffer):f.buffer;return new f.constructor(D,f.byteOffset,f.byteLength)}function k5(f){var p=new f.constructor(f.source,Un.exec(f));return p.lastIndex=f.lastIndex,p}function L5(f){return ls?zr(ls.call(f)):{}}function jS(f,p){var D=p?$1(f.buffer):f.buffer;return new f.constructor(D,f.byteOffset,f.length)}function eN(f,p){if(f!==p){var D=f!==e,P=f===null,Y=f===f,X=fa(f),ie=p!==e,fe=p===null,he=p===p,ke=fa(p);if(!fe&&!ke&&!X&&f>p||X&&ie&&he&&!fe&&!ke||P&&ie&&he||!D&&he||!Y)return 1;if(!P&&!X&&!ke&&f=fe)return he;var ke=D[P];return he*(ke=="desc"?-1:1)}}return f.index-p.index}function rN(f,p,D,P){for(var Y=-1,X=f.length,ie=D.length,fe=-1,he=p.length,ke=Rt(X-ie,0),ze=Ne(he+ke),He=!P;++fe1?D[Y-1]:e,ie=Y>2?D[2]:e;for(X=f.length>3&&typeof X=="function"?(Y--,X):e,ie&&Rn(D[0],D[1],ie)&&(X=Y<3?e:X,Y=1),p=zr(p);++P-1?Y[X?p[ie]:ie]:e}}function sN(f){return $i(function(p){var D=p.length,P=D,Y=Hn.prototype.thru;for(f&&p.reverse();P--;){var X=p[P];if(typeof X!="function")throw new Yn(a);if(Y&&!ie&&Zl(X)=="wrapper")var ie=new Hn([],!0)}for(P=ie?P:D;++P1&&Zr.reverse(),ze&&hefe))return!1;var ke=X.get(f),ze=X.get(p);if(ke&&ze)return ke==p&&ze==f;var He=-1,er=!0,mr=D&h?new Ui:e;for(X.set(f,p),X.set(p,f);++He1?"& ":"")+p[P],p=p.join(D>2?", ":" "),f.replace(Ff,\`{ /* [wrapped with \`+p+\`] */ -\`)}function r8(f){return Or(f)||gs(f)||!!(Dl&&f&&f[Dl])}function Gi(f,p){var D=typeof f;return p=p??L,!!p&&(D=="number"||D!="symbol"&&$a.test(f))&&f>-1&&f%1==0&&f0){if(++p>=T)return arguments[0]}else p=0;return f.apply(e,arguments)}}function Xl(f,p){var D=-1,P=f.length,Y=P-1;for(p=p===e?P:p;++D1?f[p-1]:e;return D=typeof D=="function"?(f.pop(),D):e,ON(f,D)});function BN(f){var p=Z(f);return p.__chain__=!0,p}function m6(f,p){return p(f),f}function Jl(f,p){return p(f)}var p6=$i(function(f){var p=f.length,D=p?f[0]:0,P=this.__wrapped__,Y=function(X){return fu(X,f)};return p>1||this.__actions__.length||!(P instanceof qr)||!Gi(D)?this.thru(Y):(P=P.slice(D,+D+(p?1:0)),P.__actions__.push({func:Jl,args:[Y],thisArg:e}),new Hn(P,this.__chain__).thru(function(X){return p&&!X.length&&X.push(e),X}))});function d6(){return BN(this)}function h6(){return new Hn(this.value(),this.__chain__)}function v6(){this.__values__===e&&(this.__values__=VN(this.value()));var f=this.__index__>=this.__values__.length,p=f?e:this.__values__[this.__index__++];return{done:f,value:p}}function g6(){return this}function y6(f){for(var p,D=this;D instanceof iu;){var P=MN(D);P.__index__=0,P.__values__=e,p?Y.__wrapped__=P:p=P;var Y=P;D=D.__wrapped__}return Y.__wrapped__=f,p}function x6(){var f=this.__wrapped__;if(f instanceof qr){var p=f;return this.__actions__.length&&(p=new qr(this)),p=p.reverse(),p.__actions__.push({func:Jl,args:[ab],thisArg:e}),new Hn(p,this.__chain__)}return this.thru(ab)}function b6(){return QS(this.__wrapped__,this.__actions__)}var w6=Yl(function(f,p,D){ut.call(f,D)?++f[D]:Ka(f,D,1)});function D6(f,p,D){var P=Or(f)?Hs:F1;return D&&Rn(f,p,D)&&(p=e),P(f,yr(p,3))}function S6(f,p){var D=Or(f)?vi:ql;return D(f,yr(p,3))}var N6=oN(CN),A6=oN(EN);function M6(f,p){return Jt(Kl(f,p),1)}function C6(f,p){return Jt(Kl(f,p),H)}function E6(f,p,D){return D=D===e?1:Rr(D),Jt(Kl(f,p),D)}function PN(f,p){var D=Or(f)?It:wi;return D(f,yr(p,3))}function IN(f,p){var D=Or(f)?Px:Rl;return D(f,yr(p,3))}var T6=Yl(function(f,p,D){ut.call(f,D)?f[D].push(p):Ka(f,D,[p])});function F6(f,p,D,P){f=Vn(f)?f:hu(f),D=D&&!P?Rr(D):0;var Y=f.length;return D<0&&(D=Rt(Y+D,0)),nm(f)?D<=Y&&f.indexOf(p,D)>-1:!!Y&&ho(f,p,D)>-1}var _6=Ur(function(f,p,D){var P=-1,Y=typeof p=="function",X=Vn(f)?Ne(f.length):[];return wi(f,function(ie){X[++P]=Y?pn(p,ie,D):Ma(ie,p,D)}),X}),O6=Yl(function(f,p,D){Ka(f,D,p)});function Kl(f,p){var D=Or(f)?dt:Fe;return D(f,yr(p,3))}function B6(f,p,D,P){return f==null?[]:(Or(p)||(p=p==null?[]:[p]),D=P?e:D,Or(D)||(D=D==null?[]:[D]),ei(f,p,D))}var P6=Yl(function(f,p,D){f[D?0:1].push(p)},function(){return[[],[]]});function I6(f,p,D){var P=Or(f)?Gf:ll,Y=arguments.length<3;return P(f,yr(p,4),D,Y,wi)}function R6(f,p,D){var P=Or(f)?Ix:ll,Y=arguments.length<3;return P(f,yr(p,4),D,Y,Rl)}function q6(f,p){var D=Or(f)?vi:ql;return D(f,rm(yr(p,3)))}function k6(f){var p=Or(f)?Bl:F5;return p(f)}function L6(f,p,D){(D?Rn(f,p,D):p===e)?p=1:p=Rr(p);var P=Or(f)?M1:_5;return P(f,p)}function z6(f){var p=Or(f)?C1:B5;return p(f)}function U6(f){if(f==null)return 0;if(Vn(f))return nm(f)?gi(f):f.length;var p=Dn(f);return p==Ae||p==ne?f.size:U(f).length}function W6(f,p,D){var P=Or(f)?Vf:P5;return D&&Rn(f,p,D)&&(p=e),P(f,yr(p,3))}var Y6=Ur(function(f,p){if(f==null)return[];var D=p.length;return D>1&&Rn(f,p[0],p[1])?p=[]:D>2&&Rn(p[0],p[1],p[2])&&(p=[p[0]]),ei(f,Jt(p,1),[])}),jl=n1||function(){return Vt.Date.now()};function H6(f,p){if(typeof p!="function")throw new Yn(a);return f=Rr(f),function(){if(--f<1)return p.apply(this,arguments)}}function RN(f,p,D){return p=D?e:p,p=f&&p==null?f.length:p,Hi(f,M,e,e,e,e,p)}function qN(f,p){var D;if(typeof p!="function")throw new Yn(a);return f=Rr(f),function(){return--f>0&&(D=p.apply(this,arguments)),f<=1&&(p=e),D}}var ob=Ur(function(f,p,D){var P=y;if(D.length){var Y=oa(D,pu(ob));P|=b}return Hi(f,P,p,D,Y)}),kN=Ur(function(f,p,D){var P=y|v;if(D.length){var Y=oa(D,pu(kN));P|=b}return Hi(p,P,f,D,Y)});function LN(f,p,D){p=D?e:p;var P=Hi(f,w,e,e,e,e,e,p);return P.placeholder=LN.placeholder,P}function zN(f,p,D){p=D?e:p;var P=Hi(f,C,e,e,e,e,e,p);return P.placeholder=zN.placeholder,P}function UN(f,p,D){var P,Y,X,ie,fe,he,ke=0,ze=!1,He=!1,er=!0;if(typeof f!="function")throw new Yn(a);p=Fa(p)||0,_t(D)&&(ze=!!D.leading,He="maxWait"in D,X=He?Rt(Fa(D.maxWait)||0,p):X,er="trailing"in D?!!D.trailing:er);function mr(Wt){var ti=P,Qi=Y;return P=Y=e,ke=Wt,ie=f.apply(Qi,ti),ie}function Dr(Wt){return ke=Wt,fe=pc(Yr,p),ze?mr(Wt):ie}function kr(Wt){var ti=Wt-he,Qi=Wt-ke,oA=p-ti;return He?Ft(oA,X-Qi):oA}function Sr(Wt){var ti=Wt-he,Qi=Wt-ke;return he===e||ti>=p||ti<0||He&&Qi>=X}function Yr(){var Wt=jl();if(Sr(Wt))return Zr(Wt);fe=pc(Yr,kr(Wt))}function Zr(Wt){return fe=e,er&&P?mr(Wt):(P=Y=e,ie)}function ca(){fe!==e&&JS(fe),ke=0,P=he=Y=fe=e}function qn(){return fe===e?ie:Zr(jl())}function la(){var Wt=jl(),ti=Sr(Wt);if(P=arguments,Y=this,he=Wt,ti){if(fe===e)return Dr(he);if(He)return JS(fe),fe=pc(Yr,p),mr(he)}return fe===e&&(fe=pc(Yr,p)),ie}return la.cancel=ca,la.flush=qn,la}var $6=Ur(function(f,p){return Il(f,1,p)}),G6=Ur(function(f,p,D){return Il(f,Fa(p)||0,D)});function V6(f){return Hi(f,O)}function em(f,p){if(typeof f!="function"||p!=null&&typeof p!="function")throw new Yn(a);var D=function(){var P=arguments,Y=p?p.apply(this,P):P[0],X=D.cache;if(X.has(Y))return X.get(Y);var ie=f.apply(this,P);return D.cache=X.set(Y,ie)||X,ie};return D.cache=new(em.Cache||Ja),D}em.Cache=Ja;function rm(f){if(typeof f!="function")throw new Yn(a);return function(){var p=arguments;switch(p.length){case 0:return!f.call(this);case 1:return!f.call(this,p[0]);case 2:return!f.call(this,p[0],p[1]);case 3:return!f.call(this,p[0],p[1],p[2])}return!f.apply(this,p)}}function Z6(f){return qN(2,f)}var Q6=I5(function(f,p){p=p.length==1&&Or(p[0])?dt(p[0],wn(yr())):dt(Jt(p,1),wn(yr()));var D=p.length;return Ur(function(P){for(var Y=-1,X=Ft(P.length,D);++Y=p}),gs=zl(function(){return arguments}())?zl:function(f){return qt(f)&&ut.call(f,"callee")&&!wl.call(f,"callee")},Or=Ne.isArray,c7=al?wn(al):I1;function Vn(f){return f!=null&&tm(f.length)&&!Vi(f)}function Ut(f){return qt(f)&&Vn(f)}function l7(f){return f===!0||f===!1||qt(f)&&dn(f)==me}var Mo=Sl||yb,m7=Hf?wn(Hf):R1;function p7(f){return qt(f)&&f.nodeType===1&&!dc(f)}function d7(f){if(f==null)return!0;if(Vn(f)&&(Or(f)||typeof f=="string"||typeof f.splice=="function"||Mo(f)||du(f)||gs(f)))return!f.length;var p=Dn(f);if(p==Ae||p==ne)return!f.size;if(mc(f))return!U(f).length;for(var D in f)if(ut.call(f,D))return!1;return!0}function h7(f,p){return ps(f,p)}function v7(f,p,D){D=typeof D=="function"?D:e;var P=D?D(f,p):e;return P===e?ps(f,p,e,D):!!P}function ub(f){if(!qt(f))return!1;var p=dn(f);return p==ye||p==Se||typeof f.message=="string"&&typeof f.name=="string"&&!dc(f)}function g7(f){return typeof f=="number"&&ss(f)}function Vi(f){if(!_t(f))return!1;var p=dn(f);return p==be||p==De||p==Ee||p==xe}function YN(f){return typeof f=="number"&&f==Rr(f)}function tm(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=L}function _t(f){var p=typeof f;return f!=null&&(p=="object"||p=="function")}function qt(f){return f!=null&&typeof f=="object"}var HN=il?wn(il):fc;function y7(f,p){return f===p||Di(f,p,K1(p))}function x7(f,p,D){return D=typeof D=="function"?D:e,Di(f,p,K1(p),D)}function b7(f){return $N(f)&&f!=+f}function w7(f){if(a8(f))throw new Ar(n);return ds(f)}function D7(f){return f===null}function S7(f){return f==null}function $N(f){return typeof f=="number"||qt(f)&&dn(f)==We}function dc(f){if(!qt(f)||dn(f)!=J)return!1;var p=Ks(f);if(p===null)return!0;var D=ut.call(p,"constructor")&&p.constructor;return typeof D=="function"&&D instanceof D&&as.call(D)==jx}var fb=ol?wn(ol):Vr;function N7(f){return YN(f)&&f>=-L&&f<=L}var GN=es?wn(es):g;function nm(f){return typeof f=="string"||!Or(f)&&qt(f)&&dn(f)==ue}function fa(f){return typeof f=="symbol"||qt(f)&&dn(f)==Me}var du=Va?wn(Va):A;function A7(f){return f===e}function M7(f){return qt(f)&&Dn(f)==Le}function C7(f){return qt(f)&&dn(f)==Ie}var E7=Vl(se),T7=Vl(function(f,p){return f<=p});function VN(f){if(!f)return[];if(Vn(f))return nm(f)?Bn(f):Gn(f);if(is&&f[is])return Hx(f[is]());var p=Dn(f),D=p==Ae?jf:p==ne?go:hu;return D(f)}function Zi(f){if(!f)return f===0?f:0;if(f=Fa(f),f===H||f===-H){var p=f<0?-1:1;return p*q}return f===f?f:0}function Rr(f){var p=Zi(f),D=p%1;return p===p?D?p-D:p:0}function ZN(f){return f?Wi(Rr(f),0,z):0}function Fa(f){if(typeof f=="number")return f;if(fa(f))return K;if(_t(f)){var p=typeof f.valueOf=="function"?f.valueOf():f;f=_t(p)?p+"":p}if(typeof f!="string")return f===0?f:+f;f=ml(f);var D=Tt.test(f);return D||aa.test(f)?tl(f.slice(2),D?2:8):Wn.test(f)?K:+f}function QN(f){return Si(f,Zn(f))}function F7(f){return f?Wi(Rr(f),-L,L):f===0?f:0}function ft(f){return f==null?"":ua(f)}var _7=lu(function(f,p){if(mc(p)||Vn(p)){Si(p,un(p),f);return}for(var D in p)ut.call(p,D)&&ms(f,D,p[D])}),XN=lu(function(f,p){Si(p,Zn(p),f)}),am=lu(function(f,p,D,P){Si(p,Zn(p),f,P)}),O7=lu(function(f,p,D,P){Si(p,un(p),f,P)}),B7=$i(fu);function P7(f,p){var D=Do(f);return p==null?D:nc(D,p)}var I7=Ur(function(f,p){f=zr(f);var D=-1,P=p.length,Y=P>2?p[2]:e;for(Y&&Rn(p[0],p[1],Y)&&(P=1);++D1),X}),Si(f,X1(f),D),P&&(D=Pn(D,o|s|m,G5));for(var Y=p.length;Y--;)W1(D,p[Y]);return D});function j7(f,p){return KN(f,rm(yr(p)))}var e9=$i(function(f,p){return f==null?{}:C5(f,p)});function KN(f,p){if(f==null)return{};var D=dt(X1(f),function(P){return[P]});return p=yr(p),YS(f,D,function(P,Y){return p(P,Y[0])})}function r9(f,p,D){p=No(p,f);var P=-1,Y=p.length;for(Y||(Y=1,f=e);++Pp){var P=f;f=p,p=P}if(D||f%1||p%1){var Y=Ml();return Ft(f+Y*(p-f+rl("1e-"+((Y+"").length-1))),p)}return L1(f,p)}var m9=mu(function(f,p,D){return p=p.toLowerCase(),f+(D?rA(p):p)});function rA(f){return mb(ft(f).toLowerCase())}function tA(f){return f=ft(f),f&&f.replace(Of,dl).replace(Nx,"")}function p9(f,p,D){f=ft(f),p=ua(p);var P=f.length;D=D===e?P:Wi(Rr(D),0,P);var Y=D;return D-=p.length,D>=0&&f.slice(D,Y)==p}function d9(f){return f=ft(f),f&&cr.test(f)?f.replace(Pe,zx):f}function h9(f){return f=ft(f),f&&so.test(f)?f.replace(Ha,"\\\\$&"):f}var v9=mu(function(f,p,D){return f+(D?"-":"")+p.toLowerCase()}),g9=mu(function(f,p,D){return f+(D?" ":"")+p.toLowerCase()}),y9=iN("toLowerCase");function x9(f,p,D){f=ft(f),p=Rr(p);var P=p?gi(f):0;if(!p||P>=p)return f;var Y=(p-P)/2;return Gl(os(Y),D)+f+Gl(eu(Y),D)}function b9(f,p,D){f=ft(f),p=Rr(p);var P=p?gi(f):0;return p&&P>>0,D?(f=ft(f),f&&(typeof p=="string"||p!=null&&!fb(p))&&(p=ua(p),!p&&Sa(f))?Ao(Bn(f),0,D):f.split(p,D)):[]}var C9=mu(function(f,p,D){return f+(D?" ":"")+mb(p)});function E9(f,p,D){return f=ft(f),D=D==null?0:Wi(Rr(D),0,f.length),p=ua(p),f.slice(D,D+p.length)==p}function T9(f,p,D){var P=Z.templateSettings;D&&Rn(f,p,D)&&(p=e),f=ft(f),p=am({},p,P,mN);var Y=am({},p.imports,P.imports,mN),X=un(Y),ie=Kf(Y,X),fe,he,ke=0,ze=p.interpolate||uo,He="__p += '",er=Za((p.escape||uo).source+"|"+ze.source+"|"+(ze===Xt?Gt:uo).source+"|"+(p.evaluate||uo).source+"|$","g"),mr="//# sourceURL="+(ut.call(p,"sourceURL")?(p.sourceURL+"").replace(/\\s/g," "):"lodash.templateSources["+ ++Tx+"]")+\` -\`;f.replace(er,function(Sr,Yr,Zr,ca,qn,la){return Zr||(Zr=ca),He+=f.slice(ke,la).replace(Bf,Ux),Yr&&(fe=!0,He+=\`' + +\`)}function t8(f){return Or(f)||gs(f)||!!(Dl&&f&&f[Dl])}function Gi(f,p){var D=typeof f;return p=p??k,!!p&&(D=="number"||D!="symbol"&&$a.test(f))&&f>-1&&f%1==0&&f0){if(++p>=T)return arguments[0]}else p=0;return f.apply(e,arguments)}}function Xl(f,p){var D=-1,P=f.length,Y=P-1;for(p=p===e?P:p;++D1?f[p-1]:e;return D=typeof D=="function"?(f.pop(),D):e,ON(f,D)});function BN(f){var p=Z(f);return p.__chain__=!0,p}function p6(f,p){return p(f),f}function Jl(f,p){return p(f)}var d6=$i(function(f){var p=f.length,D=p?f[0]:0,P=this.__wrapped__,Y=function(X){return fu(X,f)};return p>1||this.__actions__.length||!(P instanceof qr)||!Gi(D)?this.thru(Y):(P=P.slice(D,+D+(p?1:0)),P.__actions__.push({func:Jl,args:[Y],thisArg:e}),new Hn(P,this.__chain__).thru(function(X){return p&&!X.length&&X.push(e),X}))});function h6(){return BN(this)}function v6(){return new Hn(this.value(),this.__chain__)}function g6(){this.__values__===e&&(this.__values__=VN(this.value()));var f=this.__index__>=this.__values__.length,p=f?e:this.__values__[this.__index__++];return{done:f,value:p}}function y6(){return this}function x6(f){for(var p,D=this;D instanceof iu;){var P=MN(D);P.__index__=0,P.__values__=e,p?Y.__wrapped__=P:p=P;var Y=P;D=D.__wrapped__}return Y.__wrapped__=f,p}function b6(){var f=this.__wrapped__;if(f instanceof qr){var p=f;return this.__actions__.length&&(p=new qr(this)),p=p.reverse(),p.__actions__.push({func:Jl,args:[nb],thisArg:e}),new Hn(p,this.__chain__)}return this.thru(nb)}function w6(){return QS(this.__wrapped__,this.__actions__)}var D6=Yl(function(f,p,D){ut.call(f,D)?++f[D]:Ka(f,D,1)});function S6(f,p,D){var P=Or(f)?Hs:T1;return D&&Rn(f,p,D)&&(p=e),P(f,yr(p,3))}function N6(f,p){var D=Or(f)?vi:ql;return D(f,yr(p,3))}var A6=oN(CN),M6=oN(EN);function C6(f,p){return Jt(Kl(f,p),1)}function E6(f,p){return Jt(Kl(f,p),W)}function T6(f,p,D){return D=D===e?1:Rr(D),Jt(Kl(f,p),D)}function PN(f,p){var D=Or(f)?It:wi;return D(f,yr(p,3))}function IN(f,p){var D=Or(f)?Bx:Rl;return D(f,yr(p,3))}var F6=Yl(function(f,p,D){ut.call(f,D)?f[D].push(p):Ka(f,D,[p])});function _6(f,p,D,P){f=Vn(f)?f:hu(f),D=D&&!P?Rr(D):0;var Y=f.length;return D<0&&(D=Rt(Y+D,0)),nm(f)?D<=Y&&f.indexOf(p,D)>-1:!!Y&&ho(f,p,D)>-1}var O6=Ur(function(f,p,D){var P=-1,Y=typeof p=="function",X=Vn(f)?Ne(f.length):[];return wi(f,function(ie){X[++P]=Y?pn(p,ie,D):Ma(ie,p,D)}),X}),B6=Yl(function(f,p,D){Ka(f,D,p)});function Kl(f,p){var D=Or(f)?dt:Fe;return D(f,yr(p,3))}function P6(f,p,D,P){return f==null?[]:(Or(p)||(p=p==null?[]:[p]),D=P?e:D,Or(D)||(D=D==null?[]:[D]),ei(f,p,D))}var I6=Yl(function(f,p,D){f[D?0:1].push(p)},function(){return[[],[]]});function R6(f,p,D){var P=Or(f)?Gf:ll,Y=arguments.length<3;return P(f,yr(p,4),D,Y,wi)}function q6(f,p,D){var P=Or(f)?Px:ll,Y=arguments.length<3;return P(f,yr(p,4),D,Y,Rl)}function k6(f,p){var D=Or(f)?vi:ql;return D(f,rm(yr(p,3)))}function L6(f){var p=Or(f)?Bl:_5;return p(f)}function z6(f,p,D){(D?Rn(f,p,D):p===e)?p=1:p=Rr(p);var P=Or(f)?A1:O5;return P(f,p)}function U6(f){var p=Or(f)?M1:P5;return p(f)}function W6(f){if(f==null)return 0;if(Vn(f))return nm(f)?gi(f):f.length;var p=Dn(f);return p==Ae||p==ne?f.size:U(f).length}function Y6(f,p,D){var P=Or(f)?Vf:I5;return D&&Rn(f,p,D)&&(p=e),P(f,yr(p,3))}var H6=Ur(function(f,p){if(f==null)return[];var D=p.length;return D>1&&Rn(f,p[0],p[1])?p=[]:D>2&&Rn(p[0],p[1],p[2])&&(p=[p[0]]),ei(f,Jt(p,1),[])}),jl=t1||function(){return Vt.Date.now()};function $6(f,p){if(typeof p!="function")throw new Yn(a);return f=Rr(f),function(){if(--f<1)return p.apply(this,arguments)}}function RN(f,p,D){return p=D?e:p,p=f&&p==null?f.length:p,Hi(f,M,e,e,e,e,p)}function qN(f,p){var D;if(typeof p!="function")throw new Yn(a);return f=Rr(f),function(){return--f>0&&(D=p.apply(this,arguments)),f<=1&&(p=e),D}}var ib=Ur(function(f,p,D){var P=y;if(D.length){var Y=oa(D,pu(ib));P|=b}return Hi(f,P,p,D,Y)}),kN=Ur(function(f,p,D){var P=y|v;if(D.length){var Y=oa(D,pu(kN));P|=b}return Hi(p,P,f,D,Y)});function LN(f,p,D){p=D?e:p;var P=Hi(f,w,e,e,e,e,e,p);return P.placeholder=LN.placeholder,P}function zN(f,p,D){p=D?e:p;var P=Hi(f,C,e,e,e,e,e,p);return P.placeholder=zN.placeholder,P}function UN(f,p,D){var P,Y,X,ie,fe,he,ke=0,ze=!1,He=!1,er=!0;if(typeof f!="function")throw new Yn(a);p=Fa(p)||0,_t(D)&&(ze=!!D.leading,He="maxWait"in D,X=He?Rt(Fa(D.maxWait)||0,p):X,er="trailing"in D?!!D.trailing:er);function mr(Wt){var ti=P,Qi=Y;return P=Y=e,ke=Wt,ie=f.apply(Qi,ti),ie}function Dr(Wt){return ke=Wt,fe=pc(Yr,p),ze?mr(Wt):ie}function kr(Wt){var ti=Wt-he,Qi=Wt-ke,oA=p-ti;return He?Ft(oA,X-Qi):oA}function Sr(Wt){var ti=Wt-he,Qi=Wt-ke;return he===e||ti>=p||ti<0||He&&Qi>=X}function Yr(){var Wt=jl();if(Sr(Wt))return Zr(Wt);fe=pc(Yr,kr(Wt))}function Zr(Wt){return fe=e,er&&P?mr(Wt):(P=Y=e,ie)}function ca(){fe!==e&&JS(fe),ke=0,P=he=Y=fe=e}function qn(){return fe===e?ie:Zr(jl())}function la(){var Wt=jl(),ti=Sr(Wt);if(P=arguments,Y=this,he=Wt,ti){if(fe===e)return Dr(he);if(He)return JS(fe),fe=pc(Yr,p),mr(he)}return fe===e&&(fe=pc(Yr,p)),ie}return la.cancel=ca,la.flush=qn,la}var G6=Ur(function(f,p){return Il(f,1,p)}),V6=Ur(function(f,p,D){return Il(f,Fa(p)||0,D)});function Z6(f){return Hi(f,O)}function em(f,p){if(typeof f!="function"||p!=null&&typeof p!="function")throw new Yn(a);var D=function(){var P=arguments,Y=p?p.apply(this,P):P[0],X=D.cache;if(X.has(Y))return X.get(Y);var ie=f.apply(this,P);return D.cache=X.set(Y,ie)||X,ie};return D.cache=new(em.Cache||Ja),D}em.Cache=Ja;function rm(f){if(typeof f!="function")throw new Yn(a);return function(){var p=arguments;switch(p.length){case 0:return!f.call(this);case 1:return!f.call(this,p[0]);case 2:return!f.call(this,p[0],p[1]);case 3:return!f.call(this,p[0],p[1],p[2])}return!f.apply(this,p)}}function Q6(f){return qN(2,f)}var X6=R5(function(f,p){p=p.length==1&&Or(p[0])?dt(p[0],wn(yr())):dt(Jt(p,1),wn(yr()));var D=p.length;return Ur(function(P){for(var Y=-1,X=Ft(P.length,D);++Y=p}),gs=zl(function(){return arguments}())?zl:function(f){return qt(f)&&ut.call(f,"callee")&&!wl.call(f,"callee")},Or=Ne.isArray,l7=al?wn(al):P1;function Vn(f){return f!=null&&tm(f.length)&&!Vi(f)}function Ut(f){return qt(f)&&Vn(f)}function m7(f){return f===!0||f===!1||qt(f)&&dn(f)==pe}var Mo=Sl||gb,p7=Hf?wn(Hf):I1;function d7(f){return qt(f)&&f.nodeType===1&&!dc(f)}function h7(f){if(f==null)return!0;if(Vn(f)&&(Or(f)||typeof f=="string"||typeof f.splice=="function"||Mo(f)||du(f)||gs(f)))return!f.length;var p=Dn(f);if(p==Ae||p==ne)return!f.size;if(mc(f))return!U(f).length;for(var D in f)if(ut.call(f,D))return!1;return!0}function v7(f,p){return ps(f,p)}function g7(f,p,D){D=typeof D=="function"?D:e;var P=D?D(f,p):e;return P===e?ps(f,p,e,D):!!P}function sb(f){if(!qt(f))return!1;var p=dn(f);return p==ye||p==Se||typeof f.message=="string"&&typeof f.name=="string"&&!dc(f)}function y7(f){return typeof f=="number"&&ss(f)}function Vi(f){if(!_t(f))return!1;var p=dn(f);return p==be||p==De||p==Ee||p==xe}function YN(f){return typeof f=="number"&&f==Rr(f)}function tm(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=k}function _t(f){var p=typeof f;return f!=null&&(p=="object"||p=="function")}function qt(f){return f!=null&&typeof f=="object"}var HN=il?wn(il):fc;function x7(f,p){return f===p||Di(f,p,J1(p))}function b7(f,p,D){return D=typeof D=="function"?D:e,Di(f,p,J1(p),D)}function w7(f){return $N(f)&&f!=+f}function D7(f){if(i8(f))throw new Ar(n);return ds(f)}function S7(f){return f===null}function N7(f){return f==null}function $N(f){return typeof f=="number"||qt(f)&&dn(f)==We}function dc(f){if(!qt(f)||dn(f)!=J)return!1;var p=Ks(f);if(p===null)return!0;var D=ut.call(p,"constructor")&&p.constructor;return typeof D=="function"&&D instanceof D&&as.call(D)==Kx}var ub=ol?wn(ol):Vr;function A7(f){return YN(f)&&f>=-k&&f<=k}var GN=es?wn(es):g;function nm(f){return typeof f=="string"||!Or(f)&&qt(f)&&dn(f)==ue}function fa(f){return typeof f=="symbol"||qt(f)&&dn(f)==Me}var du=Va?wn(Va):A;function M7(f){return f===e}function C7(f){return qt(f)&&Dn(f)==Le}function E7(f){return qt(f)&&dn(f)==Ie}var T7=Vl(se),F7=Vl(function(f,p){return f<=p});function VN(f){if(!f)return[];if(Vn(f))return nm(f)?Bn(f):Gn(f);if(is&&f[is])return Yx(f[is]());var p=Dn(f),D=p==Ae?jf:p==ne?go:hu;return D(f)}function Zi(f){if(!f)return f===0?f:0;if(f=Fa(f),f===W||f===-W){var p=f<0?-1:1;return p*q}return f===f?f:0}function Rr(f){var p=Zi(f),D=p%1;return p===p?D?p-D:p:0}function ZN(f){return f?Wi(Rr(f),0,z):0}function Fa(f){if(typeof f=="number")return f;if(fa(f))return K;if(_t(f)){var p=typeof f.valueOf=="function"?f.valueOf():f;f=_t(p)?p+"":p}if(typeof f!="string")return f===0?f:+f;f=ml(f);var D=Tt.test(f);return D||aa.test(f)?tl(f.slice(2),D?2:8):Wn.test(f)?K:+f}function QN(f){return Si(f,Zn(f))}function _7(f){return f?Wi(Rr(f),-k,k):f===0?f:0}function ft(f){return f==null?"":ua(f)}var O7=lu(function(f,p){if(mc(p)||Vn(p)){Si(p,un(p),f);return}for(var D in p)ut.call(p,D)&&ms(f,D,p[D])}),XN=lu(function(f,p){Si(p,Zn(p),f)}),am=lu(function(f,p,D,P){Si(p,Zn(p),f,P)}),B7=lu(function(f,p,D,P){Si(p,un(p),f,P)}),P7=$i(fu);function I7(f,p){var D=Do(f);return p==null?D:nc(D,p)}var R7=Ur(function(f,p){f=zr(f);var D=-1,P=p.length,Y=P>2?p[2]:e;for(Y&&Rn(p[0],p[1],Y)&&(P=1);++D1),X}),Si(f,Q1(f),D),P&&(D=Pn(D,o|u|m,V5));for(var Y=p.length;Y--;)U1(D,p[Y]);return D});function e9(f,p){return KN(f,rm(yr(p)))}var r9=$i(function(f,p){return f==null?{}:E5(f,p)});function KN(f,p){if(f==null)return{};var D=dt(Q1(f),function(P){return[P]});return p=yr(p),YS(f,D,function(P,Y){return p(P,Y[0])})}function t9(f,p,D){p=No(p,f);var P=-1,Y=p.length;for(Y||(Y=1,f=e);++Pp){var P=f;f=p,p=P}if(D||f%1||p%1){var Y=Ml();return Ft(f+Y*(p-f+rl("1e-"+((Y+"").length-1))),p)}return k1(f,p)}var p9=mu(function(f,p,D){return p=p.toLowerCase(),f+(D?rA(p):p)});function rA(f){return lb(ft(f).toLowerCase())}function tA(f){return f=ft(f),f&&f.replace(Of,dl).replace(Sx,"")}function d9(f,p,D){f=ft(f),p=ua(p);var P=f.length;D=D===e?P:Wi(Rr(D),0,P);var Y=D;return D-=p.length,D>=0&&f.slice(D,Y)==p}function h9(f){return f=ft(f),f&&cr.test(f)?f.replace(Pe,Lx):f}function v9(f){return f=ft(f),f&&so.test(f)?f.replace(Ha,"\\\\$&"):f}var g9=mu(function(f,p,D){return f+(D?"-":"")+p.toLowerCase()}),y9=mu(function(f,p,D){return f+(D?" ":"")+p.toLowerCase()}),x9=iN("toLowerCase");function b9(f,p,D){f=ft(f),p=Rr(p);var P=p?gi(f):0;if(!p||P>=p)return f;var Y=(p-P)/2;return Gl(os(Y),D)+f+Gl(eu(Y),D)}function w9(f,p,D){f=ft(f),p=Rr(p);var P=p?gi(f):0;return p&&P>>0,D?(f=ft(f),f&&(typeof p=="string"||p!=null&&!ub(p))&&(p=ua(p),!p&&Sa(f))?Ao(Bn(f),0,D):f.split(p,D)):[]}var E9=mu(function(f,p,D){return f+(D?" ":"")+lb(p)});function T9(f,p,D){return f=ft(f),D=D==null?0:Wi(Rr(D),0,f.length),p=ua(p),f.slice(D,D+p.length)==p}function F9(f,p,D){var P=Z.templateSettings;D&&Rn(f,p,D)&&(p=e),f=ft(f),p=am({},p,P,mN);var Y=am({},p.imports,P.imports,mN),X=un(Y),ie=Kf(Y,X),fe,he,ke=0,ze=p.interpolate||uo,He="__p += '",er=Za((p.escape||uo).source+"|"+ze.source+"|"+(ze===Xt?Gt:uo).source+"|"+(p.evaluate||uo).source+"|$","g"),mr="//# sourceURL="+(ut.call(p,"sourceURL")?(p.sourceURL+"").replace(/\\s/g," "):"lodash.templateSources["+ ++Ex+"]")+\` +\`;f.replace(er,function(Sr,Yr,Zr,ca,qn,la){return Zr||(Zr=ca),He+=f.slice(ke,la).replace(Bf,zx),Yr&&(fe=!0,He+=\`' + __e(\`+Yr+\`) + '\`),qn&&(he=!0,He+=\`'; \`+qn+\`; @@ -109621,42 +109674,42 @@ __p += '\`),Zr&&(He+=\`' + function print() { __p += __j.call(arguments, '') } \`:\`; \`)+He+\`return __p -}\`;var kr=aA(function(){return rt(X,mr+"return "+He).apply(e,ie)});if(kr.source=He,ub(kr))throw kr;return kr}function F9(f){return ft(f).toLowerCase()}function _9(f){return ft(f).toUpperCase()}function O9(f,p,D){if(f=ft(f),f&&(D||p===e))return ml(f);if(!f||!(p=ua(p)))return f;var P=Bn(f),Y=Bn(p),X=yt(P,Y),ie=pl(P,Y)+1;return Ao(P,X,ie).join("")}function B9(f,p,D){if(f=ft(f),f&&(D||p===e))return f.slice(0,Vs(f)+1);if(!f||!(p=ua(p)))return f;var P=Bn(f),Y=pl(P,Bn(p))+1;return Ao(P,0,Y).join("")}function P9(f,p,D){if(f=ft(f),f&&(D||p===e))return f.replace(nr,"");if(!f||!(p=ua(p)))return f;var P=Bn(f),Y=yt(P,Bn(p));return Ao(P,Y).join("")}function I9(f,p){var D=_,P=E;if(_t(p)){var Y="separator"in p?p.separator:Y;D="length"in p?Rr(p.length):D,P="omission"in p?ua(p.omission):P}f=ft(f);var X=f.length;if(Sa(f)){var ie=Bn(f);X=ie.length}if(D>=X)return f;var fe=D-gi(P);if(fe<1)return P;var he=ie?Ao(ie,0,fe).join(""):f.slice(0,fe);if(Y===e)return he+P;if(ie&&(fe+=he.length-fe),fb(Y)){if(f.slice(fe).search(Y)){var ke,ze=he;for(Y.global||(Y=Za(Y.source,ft(Un.exec(Y))+"g")),Y.lastIndex=0;ke=Y.exec(ze);)var He=ke.index;he=he.slice(0,He===e?fe:He)}}else if(f.indexOf(ua(Y),fe)!=fe){var er=he.lastIndexOf(Y);er>-1&&(he=he.slice(0,er))}return he+P}function R9(f){return f=ft(f),f&&tr.test(f)?f.replace(ve,Vx):f}var q9=mu(function(f,p,D){return f+(D?" ":"")+p.toUpperCase()}),mb=iN("toUpperCase");function nA(f,p,D){return f=ft(f),p=D?e:p,p===e?Yx(f)?Xx(f):qx(f):f.match(p)||[]}var aA=Ur(function(f,p){try{return pn(f,e,p)}catch(D){return ub(D)?D:new Ar(D)}}),k9=$i(function(f,p){return It(p,function(D){D=Ni(D),Ka(f,D,ob(f[D],f))}),f});function L9(f){var p=f==null?0:f.length,D=yr();return f=p?dt(f,function(P){if(typeof P[1]!="function")throw new Yn(a);return[D(P[0]),P[1]]}):[],Ur(function(P){for(var Y=-1;++YL)return[];var D=z,P=Ft(f,z);p=yr(p),f-=z;for(var Y=Jf(P,p);++D0||p<0)?new qr(D):(f<0?D=D.takeRight(-f):f&&(D=D.drop(f)),p!==e&&(p=Rr(p),D=p<0?D.dropRight(-p):D.take(p-f)),D)},qr.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},qr.prototype.toArray=function(){return this.take(z)},Na(qr.prototype,function(f,p){var D=/^(?:filter|find|map|reject)|While$/.test(p),P=/^(?:head|last)$/.test(p),Y=Z[P?"take"+(p=="last"?"Right":""):p],X=P||/^find/.test(p);!Y||(Z.prototype[p]=function(){var ie=this.__wrapped__,fe=P?[1]:arguments,he=ie instanceof qr,ke=fe[0],ze=he||Or(ie),He=function(Yr){var Zr=Y.apply(Z,Da([Yr],fe));return P&&er?Zr[0]:Zr};ze&&D&&typeof ke=="function"&&ke.length!=1&&(he=ze=!1);var er=this.__chain__,mr=!!this.__actions__.length,Dr=X&&!er,kr=he&&!mr;if(!X&&ze){ie=kr?ie:new qr(this);var Sr=f.apply(ie,fe);return Sr.__actions__.push({func:Jl,args:[He],thisArg:e}),new Hn(Sr,er)}return Dr&&kr?f.apply(this,fe):(Sr=this.thru(He),Dr?P?Sr.value()[0]:Sr.value():Sr)})}),It(["pop","push","shift","sort","splice","unshift"],function(f){var p=ns[f],D=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",P=/^(?:pop|shift)$/.test(f);Z.prototype[f]=function(){var Y=arguments;if(P&&!this.__chain__){var X=this.value();return p.apply(Or(X)?X:[],Y)}return this[D](function(ie){return p.apply(Or(ie)?ie:[],Y)})}}),Na(qr.prototype,function(f,p){var D=Z[p];if(D){var P=D.name+"";ut.call(wo,P)||(wo[P]=[]),wo[P].push({name:p,func:D})}}),wo[Hl(e,v).name]=[{name:"wrapper",func:e}],qr.prototype.clone=l1,qr.prototype.reverse=m1,qr.prototype.value=p1,Z.prototype.at=p6,Z.prototype.chain=d6,Z.prototype.commit=h6,Z.prototype.next=v6,Z.prototype.plant=y6,Z.prototype.reverse=x6,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=b6,Z.prototype.first=Z.prototype.head,is&&(Z.prototype[is]=g6),Z},yi=Jx();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Vt._=yi,define(function(){return yi})):hi?((hi.exports=yi)._=yi,Yf._=yi):Vt._=yi}).call(gu)});var Am=vn((Yb,Hb)=>{(function(e,r){typeof Yb=="object"&&typeof Hb<"u"?Hb.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis<"u"?globalThis:e||self,e["'typed'"]=r())})(Yb,function(){"use strict";function e(){return!0}function r(){return!1}function t(){}let n="Argument is not a typed-function.";function a(){function u(ee){return typeof ee=="object"&&ee!==null&&ee.constructor===Object}let l=[{name:"number",test:function(ee){return typeof ee=="number"}},{name:"string",test:function(ee){return typeof ee=="string"}},{name:"boolean",test:function(ee){return typeof ee=="boolean"}},{name:"Function",test:function(ee){return typeof ee=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(ee){return ee instanceof Date}},{name:"RegExp",test:function(ee){return ee instanceof RegExp}},{name:"Object",test:u},{name:"null",test:function(ee){return ee===null}},{name:"undefined",test:function(ee){return ee===void 0}}],c={name:"any",test:e,isAny:!0},o,s,m=0,d={createCount:0};function h(ee){let ce=o.get(ee);if(ce)return ce;let we='Unknown type "'+ee+'"',Be=ee.toLowerCase(),qe;for(qe of s)if(qe.toLowerCase()===Be){we+='. Did you mean "'+qe+'" ?';break}throw new TypeError(we)}function y(ee){let ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",we=ce?h(ce).index:s.length,Be=[];for(let Te=0;Te{let Be=o.get(we);return!Be.isAny&&Be.test(ee)});return ce.length?ce:["any"]}function C(ee){return ee&&typeof ee=="function"&&"_typedFunctionData"in ee}function b(ee,ce,we){if(!C(ee))throw new TypeError(n);let Be=we&&we.exact,qe=Array.isArray(ce)?ce.join(","):ce,Te=T(qe),Re=S(Te);if(!Be||Re in ee.signatures){let ve=ee._typedFunctionData.signatureMap.get(Re);if(ve)return ve}let Ye=Te.length,B;if(Be){B=[];let ve;for(ve in ee.signatures)B.push(ee._typedFunctionData.signatureMap.get(ve))}else B=ee._typedFunctionData.signatures;for(let ve=0;ve!Pt.has(Xt.name)))continue}tr.push(cr)}}if(B=tr,B.length===0)break}let Q;for(Q of B)if(Q.params.length<=Ye)return Q;throw new TypeError("Signature not found (signature: "+(ee.name||"unnamed")+"("+S(Te,", ")+"))")}function N(ee,ce,we){return b(ee,ce,we).implementation}function M(ee,ce){let we=h(ce);if(we.test(ee))return ee;let Be=we.conversionsTo;if(Be.length===0)throw new Error("There are no conversions to "+ce+" defined.");for(let qe=0;qe1&&arguments[1]!==void 0?arguments[1]:",";return ee.map(we=>we.name).join(ce)}function O(ee){let ce=ee.indexOf("...")===0,Be=(ce?ee.length>3?ee.slice(3):"any":ee).split("|").map(Ye=>h(Ye.trim())),qe=!1,Te=ce?"...":"";return{types:Be.map(function(Ye){return qe=Ye.isAny||qe,Te+=Ye.name+"|",{name:Ye.name,typeIndex:Ye.index,test:Ye.test,isAny:Ye.isAny,conversion:null,conversionIndex:-1}}),name:Te.slice(0,-1),hasAny:qe,hasConversion:!1,restParam:ce}}function _(ee){let ce=ee.types.map(Re=>Re.name),we=$(ce),Be=ee.hasAny,qe=ee.name,Te=we.map(function(Re){let Ye=h(Re.from);return Be=Ye.isAny||Be,qe+="|"+Re.from,{name:Re.from,typeIndex:Ye.index,test:Ye.test,isAny:Ye.isAny,conversion:Re,conversionIndex:Re.index}});return{types:ee.types.concat(Te),name:qe,hasAny:Be,hasConversion:Te.length>0,restParam:ee.restParam}}function E(ee){return ee.typeSet||(ee.typeSet=new Set,ee.types.forEach(ce=>ee.typeSet.add(ce.name))),ee.typeSet}function T(ee){let ce=[];if(typeof ee!="string")throw new TypeError("Signatures must be strings");let we=ee.trim();if(we==="")return ce;let Be=we.split(",");for(let qe=0;qe=qe+1}}else return ee.length===0?function(Te){return Te.length===0}:ee.length===1?(we=k(ee[0]),function(Te){return we(Te[0])&&Te.length===1}):ee.length===2?(we=k(ee[0]),Be=k(ee[1]),function(Te){return we(Te[0])&&Be(Te[1])&&Te.length===2}):(ce=ee.map(k),function(Te){for(let Re=0;Re{let qe=H(Be.params,ce),Te;for(Te of qe)we.add(Te)}),we.has("any")?["any"]:Array.from(we)}function K(ee,ce,we){let Be,qe,Te=ee||"unnamed",Re=we,Ye;for(Ye=0;Ye{let cr=G(tr.params,Ye),Xr=k(cr);(Ye0){let tr=w(ce[Ye]);return Be=new TypeError("Unexpected type of argument in function "+Te+" (expected: "+qe.join(" or ")+", actual: "+tr.join(" | ")+", index: "+Ye+")"),Be.data={category:"wrongType",fn:Te,index:Ye,actual:tr,expected:qe},Be}}else Re=Pe}let B=Re.map(function(Pe){return R(Pe.params)?1/0:Pe.params.length});if(ce.lengthQ)return Be=new TypeError("Too many arguments in function "+Te+" (expected: "+Q+", actual: "+ce.length+")"),Be.data={category:"tooManyArgs",fn:Te,index:ce.length,expectedLength:Q},Be;let ve=[];for(let Pe=0;Pe0)return 1;let Be=oe(ee)-oe(ce);return Be<0?-1:Be>0?1:0}function ae(ee,ce){let we=ee.params,Be=ce.params,qe=J(we),Te=J(Be),Re=R(we),Ye=R(Be);if(Re&&qe.hasAny){if(!Ye||!Te.hasAny)return 1}else if(Ye&&Te.hasAny)return-1;let B=0,Q=0,ve;for(ve of we)ve.hasAny&&++B,ve.hasConversion&&++Q;let Pe=0,tr=0;for(ve of Be)ve.hasAny&&++Pe,ve.hasConversion&&++tr;if(B!==Pe)return B-Pe;if(Re&&qe.hasConversion){if(!Ye||!Te.hasConversion)return 1}else if(Ye&&Te.hasConversion)return-1;if(Q!==tr)return Q-tr;if(Re){if(!Ye)return 1}else if(Ye)return-1;let cr=(we.length-Be.length)*(Re?-1:1);if(cr!==0)return cr;let Xr=[],Pt=0;for(let mi=0;mi1&&ce.sort((qe,Te)=>qe.index-Te.index);let we=ce[0].conversionsTo;if(ee.length===1)return we;we=we.concat([]);let Be=new Set(ee);for(let qe=1;qeqe.hasConversion)){let qe=R(ee),Te=ee.map(Ee);we=function(){let Ye=[],B=qe?arguments.length-1:arguments.length;for(let Q=0;QB.name).join("|"),hasAny:Ye.some(B=>B.isAny),hasConversion:!1,restParam:!0}),Re.push(Te)}else Re=Te.types.map(function(Ye){return{types:[Ye],name:Ye.name,hasAny:Ye.isAny,hasConversion:Ye.conversion,restParam:!1}});return j(Re,function(Ye){return ce(we,Be+1,qe.concat([Ye]))})}else return[qe]}return ce(ee,0,[])}function ge(ee,ce){let we=Math.max(ee.length,ce.length);for(let Ye=0;Ye=Be:Re?Be>=qe:Be===qe}function Se(ee){return ee.map(ce=>Le(ce)?Me(ce.referToSelf.callback):Ce(ce)?ue(ce.referTo.references,ce.referTo.callback):ce)}function ye(ee,ce,we){let Be=[],qe;for(qe of ee){let Te=we[qe];if(typeof Te!="number")throw new TypeError('No definition for referenced signature "'+qe+'"');if(Te=ce[Te],typeof Te!="function")return!1;Be.push(Te)}return Be}function be(ee,ce,we){let Be=Se(ee),qe=new Array(Be.length).fill(!1),Te=!0;for(;Te;){Te=!1;let Re=!0;for(let Ye=0;Ye{let Be=ee[we];if(ce.test(Be.toString()))throw new SyntaxError("Using \`this\` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Ae(ee,ce){if(d.createCount++,Object.keys(ce).length===0)throw new SyntaxError("No signatures provided");d.warnAgainstDeprecatedThis&&De(ce);let we=[],Be=[],qe={},Te=[],Re;for(Re in ce){if(!Object.prototype.hasOwnProperty.call(ce,Re))continue;let et=T(Re);if(!et)continue;we.forEach(function(Ga){if(ge(Ga,et))throw new TypeError('Conflicting signatures "'+S(Ga)+'" and "'+S(et)+'".')}),we.push(et);let on=Be.length;Be.push(ce[Re]);let If=et.map(_),pi;for(pi of me(If)){let Ga=S(pi);Te.push({params:pi,name:Ga,fn:on}),pi.every(Ws=>!Ws.hasConversion)&&(qe[Ga]=on)}}Te.sort(ae);let Ye=be(Be,qe,Ri),B;for(B in qe)Object.prototype.hasOwnProperty.call(qe,B)&&(qe[B]=Ye[qe[B]]);let Q=[],ve=new Map;for(B of Te)ve.has(B.name)||(B.fn=Ye[B.fn],Q.push(B),ve.set(B.name,B));let Pe=Q[0]&&Q[0].params.length<=2&&!R(Q[0].params),tr=Q[1]&&Q[1].params.length<=2&&!R(Q[1].params),cr=Q[2]&&Q[2].params.length<=2&&!R(Q[2].params),Xr=Q[3]&&Q[3].params.length<=2&&!R(Q[3].params),Pt=Q[4]&&Q[4].params.length<=2&&!R(Q[4].params),Xt=Q[5]&&Q[5].params.length<=2&&!R(Q[5].params),mi=Pe&&tr&&cr&&Xr&&Pt&&Xt;for(let et=0;etet.test),zs=Q.map(et=>et.implementation),Us=function(){for(let on=Pf;onS(T(we))),ce=J(arguments);if(typeof ce!="function")throw new TypeError("Callback function expected as last argument");return ue(ee,ce)}function ue(ee,ce){return{referTo:{references:ee,callback:ce}}}function Me(ee){if(typeof ee!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:ee}}}function Ce(ee){return ee&&typeof ee.referTo=="object"&&Array.isArray(ee.referTo.references)&&typeof ee.referTo.callback=="function"}function Le(ee){return ee&&typeof ee.referToSelf=="object"&&typeof ee.referToSelf.callback=="function"}function Ie(ee,ce){if(!ee)return ce;if(ce&&ce!==ee){let we=new Error("Function names do not match (expected: "+ee+", actual: "+ce+")");throw we.data={actual:ce,expected:ee},we}return ee}function fr(ee){let ce;for(let we in ee)Object.prototype.hasOwnProperty.call(ee,we)&&(C(ee[we])||typeof ee[we].signature=="string")&&(ce=Ie(ce,ee[we].name));return ce}function or(ee,ce){let we;for(we in ce)if(Object.prototype.hasOwnProperty.call(ce,we)){if(we in ee&&ce[we]!==ee[we]){let Be=new Error('Signature "'+we+'" is defined twice');throw Be.data={signature:we,sourceFunction:ce[we],destFunction:ee[we]},Be}ee[we]=ce[we]}}let Ke=d;d=function(ee){let ce=typeof ee=="string",we=ce?1:0,Be=ce?ee:"",qe={};for(let Te=we;Teqe.from===ee.from);if(!we)throw new Error("Attempt to remove nonexistent conversion from "+ee.from+" to "+ee.to);if(we.convert!==ee.convert)throw new Error("Conversion to remove does not match existing conversion");let Be=ce.conversionsTo.indexOf(we);ce.conversionsTo.splice(Be,1)},d.resolve=function(ee,ce){if(!C(ee))throw new TypeError(n);let we=ee._typedFunctionData.signatures;for(let Be=0;Be{(function(e){"use strict";var r=Math.cosh||function(o){return Math.abs(o)<1e-9?1-o:(Math.exp(o)+Math.exp(-o))*.5},t=Math.sinh||function(o){return Math.abs(o)<1e-9?o:(Math.exp(o)-Math.exp(-o))*.5},n=function(o){var s=Math.PI/4;if(-s>o||o>s)return Math.cos(o)-1;var m=o*o;return m*(m*(m*(m*(m*(m*(m*(m/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},a=function(o,s){var m=Math.abs(o),d=Math.abs(s);return m<3e3&&d<3e3?Math.sqrt(m*m+d*d):(m0&&i();break;case"number":m.im=0,m.re=o;break;default:i()}return isNaN(m.re)||isNaN(m.im),m};function c(o,s){if(!(this instanceof c))return new c(o,s);var m=l(o,s);this.re=m.re,this.im=m.im}c.prototype={re:0,im:0,sign:function(){var o=this.abs();return new c(this.re/o,this.im/o)},add:function(o,s){var m=new c(o,s);return this.isInfinite()&&m.isInfinite()?c.NAN:this.isInfinite()||m.isInfinite()?c.INFINITY:new c(this.re+m.re,this.im+m.im)},sub:function(o,s){var m=new c(o,s);return this.isInfinite()&&m.isInfinite()?c.NAN:this.isInfinite()||m.isInfinite()?c.INFINITY:new c(this.re-m.re,this.im-m.im)},mul:function(o,s){var m=new c(o,s);return this.isInfinite()&&m.isZero()||this.isZero()&&m.isInfinite()?c.NAN:this.isInfinite()||m.isInfinite()?c.INFINITY:m.im===0&&this.im===0?new c(this.re*m.re,0):new c(this.re*m.re-this.im*m.im,this.re*m.im+this.im*m.re)},div:function(o,s){var m=new c(o,s);if(this.isZero()&&m.isZero()||this.isInfinite()&&m.isInfinite())return c.NAN;if(this.isInfinite()||m.isZero())return c.INFINITY;if(this.isZero()||m.isInfinite())return c.ZERO;o=this.re,s=this.im;var d=m.re,h=m.im,y,v;return h===0?new c(o/d,s/d):Math.abs(d)0)return new c(Math.pow(o,m.re),0);if(o===0)switch((m.re%4+4)%4){case 0:return new c(Math.pow(s,m.re),0);case 1:return new c(0,Math.pow(s,m.re));case 2:return new c(-Math.pow(s,m.re),0);case 3:return new c(0,-Math.pow(s,m.re))}}if(o===0&&s===0&&m.re>0&&m.im>=0)return c.ZERO;var d=Math.atan2(s,o),h=u(o,s);return o=Math.exp(m.re*h-m.im*d),s=m.im*h+m.re*d,new c(o*Math.cos(s),o*Math.sin(s))},sqrt:function(){var o=this.re,s=this.im,m=this.abs(),d,h;if(o>=0){if(s===0)return new c(Math.sqrt(o),0);d=.5*Math.sqrt(2*(m+o))}else d=Math.abs(s)/Math.sqrt(2*(m-o));return o<=0?h=.5*Math.sqrt(2*(m-o)):h=Math.abs(s)/Math.sqrt(2*(m+o)),new c(d,s<0?-h:h)},exp:function(){var o=Math.exp(this.re);return this.im,new c(o*Math.cos(this.im),o*Math.sin(this.im))},expm1:function(){var o=this.re,s=this.im;return new c(Math.expm1(o)*Math.cos(s)+n(s),Math.exp(o)*Math.sin(s))},log:function(){var o=this.re,s=this.im;return s===0&&o>0,new c(u(o,s),Math.atan2(s,o))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var o=this.re,s=this.im;return new c(Math.sin(o)*r(s),Math.cos(o)*t(s))},cos:function(){var o=this.re,s=this.im;return new c(Math.cos(o)*r(s),-Math.sin(o)*t(s))},tan:function(){var o=2*this.re,s=2*this.im,m=Math.cos(o)+r(s);return new c(Math.sin(o)/m,t(s)/m)},cot:function(){var o=2*this.re,s=2*this.im,m=Math.cos(o)-r(s);return new c(-Math.sin(o)/m,t(s)/m)},sec:function(){var o=this.re,s=this.im,m=.5*r(2*s)+.5*Math.cos(2*o);return new c(Math.cos(o)*r(s)/m,Math.sin(o)*t(s)/m)},csc:function(){var o=this.re,s=this.im,m=.5*r(2*s)-.5*Math.cos(2*o);return new c(Math.sin(o)*r(s)/m,-Math.cos(o)*t(s)/m)},asin:function(){var o=this.re,s=this.im,m=new c(s*s-o*o+1,-2*o*s).sqrt(),d=new c(m.re-s,m.im+o).log();return new c(d.im,-d.re)},acos:function(){var o=this.re,s=this.im,m=new c(s*s-o*o+1,-2*o*s).sqrt(),d=new c(m.re-s,m.im+o).log();return new c(Math.PI/2-d.im,d.re)},atan:function(){var o=this.re,s=this.im;if(o===0){if(s===1)return new c(0,1/0);if(s===-1)return new c(0,-1/0)}var m=o*o+(1-s)*(1-s),d=new c((1-s*s-o*o)/m,-2*o/m).log();return new c(-.5*d.im,.5*d.re)},acot:function(){var o=this.re,s=this.im;if(s===0)return new c(Math.atan2(1,o),0);var m=o*o+s*s;return m!==0?new c(o/m,-s/m).atan():new c(o!==0?o/0:0,s!==0?-s/0:0).atan()},asec:function(){var o=this.re,s=this.im;if(o===0&&s===0)return new c(0,1/0);var m=o*o+s*s;return m!==0?new c(o/m,-s/m).acos():new c(o!==0?o/0:0,s!==0?-s/0:0).acos()},acsc:function(){var o=this.re,s=this.im;if(o===0&&s===0)return new c(Math.PI/2,1/0);var m=o*o+s*s;return m!==0?new c(o/m,-s/m).asin():new c(o!==0?o/0:0,s!==0?-s/0:0).asin()},sinh:function(){var o=this.re,s=this.im;return new c(t(o)*Math.cos(s),r(o)*Math.sin(s))},cosh:function(){var o=this.re,s=this.im;return new c(r(o)*Math.cos(s),t(o)*Math.sin(s))},tanh:function(){var o=2*this.re,s=2*this.im,m=r(o)+Math.cos(s);return new c(t(o)/m,Math.sin(s)/m)},coth:function(){var o=2*this.re,s=2*this.im,m=r(o)-Math.cos(s);return new c(t(o)/m,-Math.sin(s)/m)},csch:function(){var o=this.re,s=this.im,m=Math.cos(2*s)-r(2*o);return new c(-2*t(o)*Math.cos(s)/m,2*r(o)*Math.sin(s)/m)},sech:function(){var o=this.re,s=this.im,m=Math.cos(2*s)+r(2*o);return new c(2*r(o)*Math.cos(s)/m,-2*t(o)*Math.sin(s)/m)},asinh:function(){var o=this.im;this.im=-this.re,this.re=o;var s=this.asin();return this.re=-this.im,this.im=o,o=s.re,s.re=-s.im,s.im=o,s},acosh:function(){var o=this.acos();if(o.im<=0){var s=o.re;o.re=-o.im,o.im=s}else{var s=o.im;o.im=-o.re,o.re=s}return o},atanh:function(){var o=this.re,s=this.im,m=o>1&&s===0,d=1-o,h=1+o,y=d*d+s*s,v=y!==0?new c((h*d-s*s)/y,(s*d+h*s)/y):new c(o!==-1?o/0:0,s!==0?s/0:0),x=v.re;return v.re=u(v.re,v.im)/2,v.im=Math.atan2(v.im,x)/2,m&&(v.im=-v.im),v},acoth:function(){var o=this.re,s=this.im;if(o===0&&s===0)return new c(0,Math.PI/2);var m=o*o+s*s;return m!==0?new c(o/m,-s/m).atanh():new c(o!==0?o/0:0,s!==0?-s/0:0).atanh()},acsch:function(){var o=this.re,s=this.im;if(s===0)return new c(o!==0?Math.log(o+Math.sqrt(o*o+1)):1/0,0);var m=o*o+s*s;return m!==0?new c(o/m,-s/m).asinh():new c(o!==0?o/0:0,s!==0?-s/0:0).asinh()},asech:function(){var o=this.re,s=this.im;if(this.isZero())return c.INFINITY;var m=o*o+s*s;return m!==0?new c(o/m,-s/m).acosh():new c(o!==0?o/0:0,s!==0?-s/0:0).acosh()},inverse:function(){if(this.isZero())return c.INFINITY;if(this.isInfinite())return c.ZERO;var o=this.re,s=this.im,m=o*o+s*s;return new c(o/m,-s/m)},conjugate:function(){return new c(this.re,-this.im)},neg:function(){return new c(-this.re,-this.im)},ceil:function(o){return o=Math.pow(10,o||0),new c(Math.ceil(this.re*o)/o,Math.ceil(this.im*o)/o)},floor:function(o){return o=Math.pow(10,o||0),new c(Math.floor(this.re*o)/o,Math.floor(this.im*o)/o)},round:function(o){return o=Math.pow(10,o||0),new c(Math.round(this.re*o)/o,Math.round(this.im*o)/o)},equals:function(o,s){var m=new c(o,s);return Math.abs(m.re-this.re)<=c.EPSILON&&Math.abs(m.im-this.im)<=c.EPSILON},clone:function(){return new c(this.re,this.im)},toString:function(){var o=this.re,s=this.im,m="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(o){(function(e){"use strict";var r=2e3,t={s:1,n:0,d:1};function n(v,x){if(isNaN(v=parseInt(v,10)))throw h();return v*x}function a(v,x){if(x===0)throw d();var w=Object.create(m.prototype);w.s=v<0?-1:1,v=v<0?-v:v;var C=s(v,x);return w.n=v/C,w.d=x/C,w}function i(v){for(var x={},w=v,C=2,b=4;b<=w;){for(;w%C===0;)w/=C,x[C]=(x[C]||0)+1;b+=1+2*C++}return w!==v?w>1&&(x[w]=(x[w]||0)+1):x[v]=(x[v]||0)+1,x}var u=function(v,x){var w=0,C=1,b=1,N=0,M=0,S=0,O=1,_=1,E=0,T=1,R=1,k=1,W=1e7,G;if(v!=null)if(x!==void 0){if(w=v,C=x,b=w*C,w%1!==0||C%1!==0)throw y()}else switch(typeof v){case"object":{if("d"in v&&"n"in v)w=v.n,C=v.d,"s"in v&&(w*=v.s);else if(0 in v)w=v[0],1 in v&&(C=v[1]);else throw h();b=w*C;break}case"number":{if(v<0&&(b=v,v=-v),v%1===0)w=v;else if(v>0){for(v>=1&&(_=Math.pow(10,Math.floor(1+Math.log(v)/Math.LN10)),v/=_);T<=W&&k<=W;)if(G=(E+R)/(T+k),v===G){T+k<=W?(w=E+R,C=T+k):k>T?(w=R,C=k):(w=E,C=T);break}else v>G?(E+=R,T+=k):(R+=E,k+=T),T>W?(w=R,C=k):(w=E,C=T);w*=_}else(isNaN(v)||isNaN(x))&&(C=w=NaN);break}case"string":{if(T=v.match(/\\d+|./g),T===null)throw h();if(T[E]==="-"?(b=-1,E++):T[E]==="+"&&E++,T.length===E+1?M=n(T[E++],b):T[E+1]==="."||T[E]==="."?(T[E]!=="."&&(N=n(T[E++],b)),E++,(E+1===T.length||T[E+1]==="("&&T[E+3]===")"||T[E+1]==="'"&&T[E+3]==="'")&&(M=n(T[E],b),O=Math.pow(10,T[E].length),E++),(T[E]==="("&&T[E+2]===")"||T[E]==="'"&&T[E+2]==="'")&&(S=n(T[E+1],b),_=Math.pow(10,T[E+1].length)-1,E+=3)):T[E+1]==="/"||T[E+1]===":"?(M=n(T[E],b),O=n(T[E+2],1),E+=3):T[E+3]==="/"&&T[E+1]===" "&&(N=n(T[E],b),M=n(T[E+2],b),O=n(T[E+4],1),E+=5),T.length<=E){C=O*_,b=w=S+C*N+_*M;break}}default:throw h()}if(C===0)throw d();t.s=b<0?-1:1,t.n=Math.abs(w),t.d=Math.abs(C)};function l(v,x,w){for(var C=1;x>0;v=v*v%w,x>>=1)x&1&&(C=C*v%w);return C}function c(v,x){for(;x%2===0;x/=2);for(;x%5===0;x/=5);if(x===1)return 0;for(var w=10%x,C=1;w!==1;C++)if(w=w*10%x,C>r)return 0;return C}function o(v,x,w){for(var C=1,b=l(10,w,x),N=0;N<300;N++){if(C===b)return N;C=C*10%x,b=b*10%x}return 0}function s(v,x){if(!v)return x;if(!x)return v;for(;;){if(v%=x,!v)return x;if(x%=v,!x)return v}}function m(v,x){if(u(v,x),this instanceof m)v=s(t.d,t.n),this.s=t.s,this.n=t.n/v,this.d=t.d/v;else return a(t.s*t.n,t.d)}var d=function(){return new Error("Division by Zero")},h=function(){return new Error("Invalid argument")},y=function(){return new Error("Parameters must be integer")};m.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(v,x){return u(v,x),a(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(v,x){return u(v,x),a(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(v,x){return u(v,x),a(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(v,x){return u(v,x),a(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(v,x){if(isNaN(this.n)||isNaN(this.d))return new m(NaN);if(v===void 0)return a(this.s*this.n%this.d,1);if(u(v,x),t.n===0&&this.d===0)throw d();return a(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(v,x){return u(v,x),a(s(t.n,this.n)*s(t.d,this.d),t.d*this.d)},lcm:function(v,x){return u(v,x),t.n===0&&this.n===0?a(0,1):a(t.n*this.n,s(t.n,this.n)*s(t.d,this.d))},ceil:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.ceil(v*this.s*this.n/this.d),v)},floor:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.floor(v*this.s*this.n/this.d),v)},round:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.round(v*this.s*this.n/this.d),v)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(v,x){if(u(v,x),t.d===1)return t.s<0?a(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):a(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var w=i(this.n),C=i(this.d),b=1,N=1;for(var M in w)if(M!=="1"){if(M==="0"){b=0;break}if(w[M]*=t.n,w[M]%t.d===0)w[M]/=t.d;else return null;b*=Math.pow(M,w[M])}for(var M in C)if(M!=="1"){if(C[M]*=t.n,C[M]%t.d===0)C[M]/=t.d;else return null;N*=Math.pow(M,C[M])}return t.s<0?a(N,b):a(b,N)},equals:function(v,x){return u(v,x),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(v,x){u(v,x);var w=this.s*this.n*t.d-t.s*t.n*this.d;return(0=0;N--)b=b.inverse().add(w[N]);if(Math.abs(b.sub(x).valueOf())0&&(w+=x,w+=" ",C%=b),w+=C,w+="/",w+=b),w},toLatex:function(v){var x,w="",C=this.n,b=this.d;return this.s<0&&(w+="-"),b===1?w+=C:(v&&(x=Math.floor(C/b))>0&&(w+=x,C%=b),w+="\\\\frac{",w+=C,w+="}{",w+=b,w+="}"),w},toContinued:function(){var v,x=this.n,w=this.d,C=[];if(isNaN(x)||isNaN(w))return C;do C.push(Math.floor(x/w)),v=x%w,x=w,w=v;while(x!==1);return C},toString:function(v){var x=this.n,w=this.d;if(isNaN(x)||isNaN(w))return"NaN";v=v||15;var C=c(x,w),b=o(x,w,C),N=this.s<0?"-":"";if(N+=x/w|0,x%=w,x*=10,x&&(N+="."),C){for(var M=b;M--;)N+=x/w|0,x%=w,x*=10;N+="(";for(var M=C;M--;)N+=x/w|0,x%=w,x*=10;N+=")"}else for(var M=v;x&&M--;)N+=x/w|0,x%=w,x*=10;return N}},typeof pw=="object"?(Object.defineProperty(m,"__esModule",{value:!0}),m.default=m,m.Fraction=m,UM.exports=m):e.Fraction=m})(pw)});var nE=vn((Oce,tE)=>{tE.exports=function e(r,t){"use strict";var n=/(^([+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)?$|^0x[0-9a-f]+$|\\d+)/gi,a=/(^[ ]*|[ ]*$)/g,i=/(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[\\/\\-]\\d{1,4}[\\/\\-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/,u=/^0x[0-9a-f]+$/i,l=/^0/,c=function(b){return e.insensitive&&(""+b).toLowerCase()||""+b},o=c(r).replace(a,"")||"",s=c(t).replace(a,"")||"",m=o.replace(n,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0"),d=s.replace(n,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0"),h=parseInt(o.match(u),16)||m.length!==1&&o.match(i)&&Date.parse(o),y=parseInt(s.match(u),16)||h&&s.match(i)&&Date.parse(s)||null,v,x;if(y){if(hy)return 1}for(var w=0,C=Math.max(m.length,d.length);wx)return 1}return 0}});var oT=vn((Qhe,iT)=>{"use strict";var yD=Object.assign||function(e){for(var r=1;r1&&arguments[1]!==void 0?arguments[1]:{},t=r.preserveFormatting,n=t===void 0?!1:t,a=r.escapeMapFn,i=a===void 0?R$:a,u=String(e),l="",c=i(yD({},P$),n?yD({},I$):{}),o=Object.keys(c),s=function(){var d=!1;o.forEach(function(h,y){d||u.length>=h.length&&u.slice(0,h.length)===h&&(l+=c[o[y]],u=u.slice(h.length,u.length),d=!0)}),d||(l+=u.slice(0,1),u=u.slice(1,u.length))};u;)s();return l}});var RB=vn((IB,MD)=>{(function(e,r,t){function n(l){var c=this,o=u();c.next=function(){var s=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=s-(c.c=s|0)},c.c=1,c.s0=o(" "),c.s1=o(" "),c.s2=o(" "),c.s0-=o(l),c.s0<0&&(c.s0+=1),c.s1-=o(l),c.s1<0&&(c.s1+=1),c.s2-=o(l),c.s2<0&&(c.s2+=1),o=null}function a(l,c){return c.c=l.c,c.s0=l.s0,c.s1=l.s1,c.s2=l.s2,c}function i(l,c){var o=new n(l),s=c&&c.state,m=o.next;return m.int32=function(){return o.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,s&&(typeof s=="object"&&a(s,o),m.state=function(){return a(o,{})}),m}function u(){var l=4022871197,c=function(o){o=String(o);for(var s=0;s>>0,m-=l,m*=l,l=m>>>0,m-=l,l+=m*4294967296}return(l>>>0)*23283064365386963e-26};return c}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.alea=i})(IB,typeof MD=="object"&&MD,typeof define=="function"&&define)});var kB=vn((qB,CD)=>{(function(e,r,t){function n(u){var l=this,c="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var s=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^s^s>>>8},u===(u|0)?l.x=u:c+=u;for(var o=0;o>>0)/4294967296};return s.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},s.int32=c.next,s.quick=s,o&&(typeof o=="object"&&a(o,c),s.state=function(){return a(c,{})}),s}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xor128=i})(qB,typeof CD=="object"&&CD,typeof define=="function"&&define)});var zB=vn((LB,ED)=>{(function(e,r,t){function n(u){var l=this,c="";l.next=function(){var s=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(s^s<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,u===(u|0)?l.x=u:c+=u;for(var o=0;o>>4),l.next()}function a(u,l){return l.x=u.x,l.y=u.y,l.z=u.z,l.w=u.w,l.v=u.v,l.d=u.d,l}function i(u,l){var c=new n(u),o=l&&l.state,s=function(){return(c.next()>>>0)/4294967296};return s.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},s.int32=c.next,s.quick=s,o&&(typeof o=="object"&&a(o,c),s.state=function(){return a(c,{})}),s}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xorwow=i})(LB,typeof ED=="object"&&ED,typeof define=="function"&&define)});var WB=vn((UB,TD)=>{(function(e,r,t){function n(u){var l=this;l.next=function(){var o=l.x,s=l.i,m,d,h;return m=o[s],m^=m>>>7,d=m^m<<24,m=o[s+1&7],d^=m^m>>>10,m=o[s+3&7],d^=m^m>>>3,m=o[s+4&7],d^=m^m<<7,m=o[s+7&7],m=m^m<<13,d^=m^m<<9,o[s]=d,l.i=s+1&7,d};function c(o,s){var m,d,h=[];if(s===(s|0))d=h[0]=s;else for(s=""+s,m=0;m0;--m)o.next()}c(l,u)}function a(u,l){return l.x=u.x.slice(),l.i=u.i,l}function i(u,l){u==null&&(u=+new Date);var c=new n(u),o=l&&l.state,s=function(){return(c.next()>>>0)/4294967296};return s.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},s.int32=c.next,s.quick=s,o&&(o.x&&a(o,c),s.state=function(){return a(c,{})}),s}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xorshift7=i})(UB,typeof TD=="object"&&TD,typeof define=="function"&&define)});var HB=vn((YB,FD)=>{(function(e,r,t){function n(u){var l=this;l.next=function(){var o=l.w,s=l.X,m=l.i,d,h;return l.w=o=o+1640531527|0,h=s[m+34&127],d=s[m=m+1&127],h^=h<<13,d^=d<<17,h^=h>>>15,d^=d>>>12,h=s[m]=h^d,l.i=m,h+(o^o>>>16)|0};function c(o,s){var m,d,h,y,v,x=[],w=128;for(s===(s|0)?(d=s,s=null):(s=s+"\\0",d=0,w=Math.max(w,s.length)),h=0,y=-32;y>>15,d^=d<<4,d^=d>>>13,y>=0&&(v=v+1640531527|0,m=x[y&127]^=d+v,h=m==0?h+1:0);for(h>=128&&(x[(s&&s.length||0)&127]=-1),h=127,y=4*128;y>0;--y)d=x[h+34&127],m=x[h=h+1&127],d^=d<<13,m^=m<<17,d^=d>>>15,m^=m>>>12,x[h]=d^m;o.w=v,o.X=x,o.i=h}c(l,u)}function a(u,l){return l.i=u.i,l.w=u.w,l.X=u.X.slice(),l}function i(u,l){u==null&&(u=+new Date);var c=new n(u),o=l&&l.state,s=function(){return(c.next()>>>0)/4294967296};return s.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},s.int32=c.next,s.quick=s,o&&(o.X&&a(o,c),s.state=function(){return a(c,{})}),s}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xor4096=i})(YB,typeof FD=="object"&&FD,typeof define=="function"&&define)});var GB=vn(($B,_D)=>{(function(e,r,t){function n(u){var l=this,c="";l.next=function(){var s=l.b,m=l.c,d=l.d,h=l.a;return s=s<<25^s>>>7^m,m=m-d|0,d=d<<24^d>>>8^h,h=h-s|0,l.b=s=s<<20^s>>>12^m,l.c=m=m-d|0,l.d=d<<16^m>>>16^h,l.a=h-s|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,u===Math.floor(u)?(l.a=u/4294967296|0,l.b=u|0):c+=u;for(var o=0;o>>0)/4294967296};return s.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},s.int32=c.next,s.quick=s,o&&(typeof o=="object"&&a(o,c),s.state=function(){return a(c,{})}),s}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.tychei=i})($B,typeof _D=="object"&&_D,typeof define=="function"&&define)});var VB=vn(()=>{});var QB=vn((ZB,Ug)=>{(function(e,r,t){var n=256,a=6,i=52,u="random",l=t.pow(n,a),c=t.pow(2,i),o=c*2,s=n-1,m;function d(b,N,M){var S=[];N=N==!0?{entropy:!0}:N||{};var O=x(v(N.entropy?[b,C(r)]:b??w(),3),S),_=new h(S),E=function(){for(var T=_.g(a),R=l,k=0;T=o;)T/=2,R/=2,k>>>=1;return(T+k)/R};return E.int32=function(){return _.g(4)|0},E.quick=function(){return _.g(4)/4294967296},E.double=E,x(C(_.S),r),(N.pass||M||function(T,R,k,W){return W&&(W.S&&y(W,_),T.state=function(){return y(_,{})}),k?(t[u]=T,R):T})(E,O,"global"in N?N.global:this==t,N.state)}function h(b){var N,M=b.length,S=this,O=0,_=S.i=S.j=0,E=S.S=[];for(M||(b=[M++]);O{var jG=RB(),eV=kB(),rV=zB(),tV=WB(),nV=HB(),aV=GB(),Bs=QB();Bs.alea=jG;Bs.xor128=eV;Bs.xorwow=rV;Bs.xorshift7=tV;Bs.xor4096=nV;Bs.tychei=aV;XB.exports=Bs});var KR=vn((IIe,ES)=>{function CS(){}CS.prototype={on:function(e,r,t){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:r,ctx:t}),this},once:function(e,r,t){var n=this;function a(){n.off(e,a),r.apply(t,arguments)}return a._=r,this.on(e,a,t)},emit:function(e){var r=[].slice.call(arguments,1),t=((this.e||(this.e={}))[e]||[]).slice(),n=0,a=t.length;for(n;n{(function(e,r){typeof TS=="object"&&typeof Nf<"u"?Nf.exports=r():typeof define=="function"&&define.amd?define(r):e.moment=r()})(TS,function(){"use strict";var e;function r(){return e.apply(null,arguments)}function t(g){e=g}function n(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function a(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function i(g,A){return Object.prototype.hasOwnProperty.call(g,A)}function u(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var A;for(A in g)if(i(g,A))return!1;return!0}function l(g){return g===void 0}function c(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function o(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function s(g,A){var I=[],U,V=g.length;for(U=0;U>>0,U;for(U=0;U0)for(I=0;I=X)return f;var fe=D-gi(P);if(fe<1)return P;var he=ie?Ao(ie,0,fe).join(""):f.slice(0,fe);if(Y===e)return he+P;if(ie&&(fe+=he.length-fe),ub(Y)){if(f.slice(fe).search(Y)){var ke,ze=he;for(Y.global||(Y=Za(Y.source,ft(Un.exec(Y))+"g")),Y.lastIndex=0;ke=Y.exec(ze);)var He=ke.index;he=he.slice(0,He===e?fe:He)}}else if(f.indexOf(ua(Y),fe)!=fe){var er=he.lastIndexOf(Y);er>-1&&(he=he.slice(0,er))}return he+P}function q9(f){return f=ft(f),f&&tr.test(f)?f.replace(ve,Gx):f}var k9=mu(function(f,p,D){return f+(D?" ":"")+p.toUpperCase()}),lb=iN("toUpperCase");function nA(f,p,D){return f=ft(f),p=D?e:p,p===e?Wx(f)?Qx(f):Rx(f):f.match(p)||[]}var aA=Ur(function(f,p){try{return pn(f,e,p)}catch(D){return sb(D)?D:new Ar(D)}}),L9=$i(function(f,p){return It(p,function(D){D=Ni(D),Ka(f,D,ib(f[D],f))}),f});function z9(f){var p=f==null?0:f.length,D=yr();return f=p?dt(f,function(P){if(typeof P[1]!="function")throw new Yn(a);return[D(P[0]),P[1]]}):[],Ur(function(P){for(var Y=-1;++Yk)return[];var D=z,P=Ft(f,z);p=yr(p),f-=z;for(var Y=Jf(P,p);++D0||p<0)?new qr(D):(f<0?D=D.takeRight(-f):f&&(D=D.drop(f)),p!==e&&(p=Rr(p),D=p<0?D.dropRight(-p):D.take(p-f)),D)},qr.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},qr.prototype.toArray=function(){return this.take(z)},Na(qr.prototype,function(f,p){var D=/^(?:filter|find|map|reject)|While$/.test(p),P=/^(?:head|last)$/.test(p),Y=Z[P?"take"+(p=="last"?"Right":""):p],X=P||/^find/.test(p);!Y||(Z.prototype[p]=function(){var ie=this.__wrapped__,fe=P?[1]:arguments,he=ie instanceof qr,ke=fe[0],ze=he||Or(ie),He=function(Yr){var Zr=Y.apply(Z,Da([Yr],fe));return P&&er?Zr[0]:Zr};ze&&D&&typeof ke=="function"&&ke.length!=1&&(he=ze=!1);var er=this.__chain__,mr=!!this.__actions__.length,Dr=X&&!er,kr=he&&!mr;if(!X&&ze){ie=kr?ie:new qr(this);var Sr=f.apply(ie,fe);return Sr.__actions__.push({func:Jl,args:[He],thisArg:e}),new Hn(Sr,er)}return Dr&&kr?f.apply(this,fe):(Sr=this.thru(He),Dr?P?Sr.value()[0]:Sr.value():Sr)})}),It(["pop","push","shift","sort","splice","unshift"],function(f){var p=ns[f],D=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",P=/^(?:pop|shift)$/.test(f);Z.prototype[f]=function(){var Y=arguments;if(P&&!this.__chain__){var X=this.value();return p.apply(Or(X)?X:[],Y)}return this[D](function(ie){return p.apply(Or(ie)?ie:[],Y)})}}),Na(qr.prototype,function(f,p){var D=Z[p];if(D){var P=D.name+"";ut.call(wo,P)||(wo[P]=[]),wo[P].push({name:p,func:D})}}),wo[Hl(e,v).name]=[{name:"wrapper",func:e}],qr.prototype.clone=c1,qr.prototype.reverse=l1,qr.prototype.value=m1,Z.prototype.at=d6,Z.prototype.chain=h6,Z.prototype.commit=v6,Z.prototype.next=g6,Z.prototype.plant=x6,Z.prototype.reverse=b6,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=w6,Z.prototype.first=Z.prototype.head,is&&(Z.prototype[is]=y6),Z},yi=Xx();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Vt._=yi,define(function(){return yi})):hi?((hi.exports=yi)._=yi,Yf._=yi):Vt._=yi}).call(gu)});var Nm=vn((Wb,Yb)=>{(function(e,r){typeof Wb=="object"&&typeof Yb<"u"?Yb.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis<"u"?globalThis:e||self,e["'typed'"]=r())})(Wb,function(){"use strict";function e(){return!0}function r(){return!1}function t(){}let n="Argument is not a typed-function.";function a(){function s(ee){return typeof ee=="object"&&ee!==null&&ee.constructor===Object}let l=[{name:"number",test:function(ee){return typeof ee=="number"}},{name:"string",test:function(ee){return typeof ee=="string"}},{name:"boolean",test:function(ee){return typeof ee=="boolean"}},{name:"Function",test:function(ee){return typeof ee=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(ee){return ee instanceof Date}},{name:"RegExp",test:function(ee){return ee instanceof RegExp}},{name:"Object",test:s},{name:"null",test:function(ee){return ee===null}},{name:"undefined",test:function(ee){return ee===void 0}}],c={name:"any",test:e,isAny:!0},o,u,m=0,d={createCount:0};function h(ee){let ce=o.get(ee);if(ce)return ce;let we='Unknown type "'+ee+'"',Be=ee.toLowerCase(),qe;for(qe of u)if(qe.toLowerCase()===Be){we+='. Did you mean "'+qe+'" ?';break}throw new TypeError(we)}function y(ee){let ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",we=ce?h(ce).index:u.length,Be=[];for(let Te=0;Te{let Be=o.get(we);return!Be.isAny&&Be.test(ee)});return ce.length?ce:["any"]}function C(ee){return ee&&typeof ee=="function"&&"_typedFunctionData"in ee}function b(ee,ce,we){if(!C(ee))throw new TypeError(n);let Be=we&&we.exact,qe=Array.isArray(ce)?ce.join(","):ce,Te=T(qe),Re=S(Te);if(!Be||Re in ee.signatures){let ve=ee._typedFunctionData.signatureMap.get(Re);if(ve)return ve}let Ye=Te.length,B;if(Be){B=[];let ve;for(ve in ee.signatures)B.push(ee._typedFunctionData.signatureMap.get(ve))}else B=ee._typedFunctionData.signatures;for(let ve=0;ve!Pt.has(Xt.name)))continue}tr.push(cr)}}if(B=tr,B.length===0)break}let Q;for(Q of B)if(Q.params.length<=Ye)return Q;throw new TypeError("Signature not found (signature: "+(ee.name||"unnamed")+"("+S(Te,", ")+"))")}function N(ee,ce,we){return b(ee,ce,we).implementation}function M(ee,ce){let we=h(ce);if(we.test(ee))return ee;let Be=we.conversionsTo;if(Be.length===0)throw new Error("There are no conversions to "+ce+" defined.");for(let qe=0;qe1&&arguments[1]!==void 0?arguments[1]:",";return ee.map(we=>we.name).join(ce)}function O(ee){let ce=ee.indexOf("...")===0,Be=(ce?ee.length>3?ee.slice(3):"any":ee).split("|").map(Ye=>h(Ye.trim())),qe=!1,Te=ce?"...":"";return{types:Be.map(function(Ye){return qe=Ye.isAny||qe,Te+=Ye.name+"|",{name:Ye.name,typeIndex:Ye.index,test:Ye.test,isAny:Ye.isAny,conversion:null,conversionIndex:-1}}),name:Te.slice(0,-1),hasAny:qe,hasConversion:!1,restParam:ce}}function _(ee){let ce=ee.types.map(Re=>Re.name),we=$(ce),Be=ee.hasAny,qe=ee.name,Te=we.map(function(Re){let Ye=h(Re.from);return Be=Ye.isAny||Be,qe+="|"+Re.from,{name:Re.from,typeIndex:Ye.index,test:Ye.test,isAny:Ye.isAny,conversion:Re,conversionIndex:Re.index}});return{types:ee.types.concat(Te),name:qe,hasAny:Be,hasConversion:Te.length>0,restParam:ee.restParam}}function E(ee){return ee.typeSet||(ee.typeSet=new Set,ee.types.forEach(ce=>ee.typeSet.add(ce.name))),ee.typeSet}function T(ee){let ce=[];if(typeof ee!="string")throw new TypeError("Signatures must be strings");let we=ee.trim();if(we==="")return ce;let Be=we.split(",");for(let qe=0;qe=qe+1}}else return ee.length===0?function(Te){return Te.length===0}:ee.length===1?(we=L(ee[0]),function(Te){return we(Te[0])&&Te.length===1}):ee.length===2?(we=L(ee[0]),Be=L(ee[1]),function(Te){return we(Te[0])&&Be(Te[1])&&Te.length===2}):(ce=ee.map(L),function(Te){for(let Re=0;Re{let qe=W(Be.params,ce),Te;for(Te of qe)we.add(Te)}),we.has("any")?["any"]:Array.from(we)}function K(ee,ce,we){let Be,qe,Te=ee||"unnamed",Re=we,Ye;for(Ye=0;Ye{let cr=V(tr.params,Ye),Xr=L(cr);(Ye0){let tr=w(ce[Ye]);return Be=new TypeError("Unexpected type of argument in function "+Te+" (expected: "+qe.join(" or ")+", actual: "+tr.join(" | ")+", index: "+Ye+")"),Be.data={category:"wrongType",fn:Te,index:Ye,actual:tr,expected:qe},Be}}else Re=Pe}let B=Re.map(function(Pe){return R(Pe.params)?1/0:Pe.params.length});if(ce.lengthQ)return Be=new TypeError("Too many arguments in function "+Te+" (expected: "+Q+", actual: "+ce.length+")"),Be.data={category:"tooManyArgs",fn:Te,index:ce.length,expectedLength:Q},Be;let ve=[];for(let Pe=0;Pe0)return 1;let Be=oe(ee)-oe(ce);return Be<0?-1:Be>0?1:0}function ae(ee,ce){let we=ee.params,Be=ce.params,qe=J(we),Te=J(Be),Re=R(we),Ye=R(Be);if(Re&&qe.hasAny){if(!Ye||!Te.hasAny)return 1}else if(Ye&&Te.hasAny)return-1;let B=0,Q=0,ve;for(ve of we)ve.hasAny&&++B,ve.hasConversion&&++Q;let Pe=0,tr=0;for(ve of Be)ve.hasAny&&++Pe,ve.hasConversion&&++tr;if(B!==Pe)return B-Pe;if(Re&&qe.hasConversion){if(!Ye||!Te.hasConversion)return 1}else if(Ye&&Te.hasConversion)return-1;if(Q!==tr)return Q-tr;if(Re){if(!Ye)return 1}else if(Ye)return-1;let cr=(we.length-Be.length)*(Re?-1:1);if(cr!==0)return cr;let Xr=[],Pt=0;for(let mi=0;mi1&&ce.sort((qe,Te)=>qe.index-Te.index);let we=ce[0].conversionsTo;if(ee.length===1)return we;we=we.concat([]);let Be=new Set(ee);for(let qe=1;qeqe.hasConversion)){let qe=R(ee),Te=ee.map(Ee);we=function(){let Ye=[],B=qe?arguments.length-1:arguments.length;for(let Q=0;QB.name).join("|"),hasAny:Ye.some(B=>B.isAny),hasConversion:!1,restParam:!0}),Re.push(Te)}else Re=Te.types.map(function(Ye){return{types:[Ye],name:Ye.name,hasAny:Ye.isAny,hasConversion:Ye.conversion,restParam:!1}});return j(Re,function(Ye){return ce(we,Be+1,qe.concat([Ye]))})}else return[qe]}return ce(ee,0,[])}function ge(ee,ce){let we=Math.max(ee.length,ce.length);for(let Ye=0;Ye=Be:Re?Be>=qe:Be===qe}function Se(ee){return ee.map(ce=>Le(ce)?Me(ce.referToSelf.callback):Ce(ce)?ue(ce.referTo.references,ce.referTo.callback):ce)}function ye(ee,ce,we){let Be=[],qe;for(qe of ee){let Te=we[qe];if(typeof Te!="number")throw new TypeError('No definition for referenced signature "'+qe+'"');if(Te=ce[Te],typeof Te!="function")return!1;Be.push(Te)}return Be}function be(ee,ce,we){let Be=Se(ee),qe=new Array(Be.length).fill(!1),Te=!0;for(;Te;){Te=!1;let Re=!0;for(let Ye=0;Ye{let Be=ee[we];if(ce.test(Be.toString()))throw new SyntaxError("Using \`this\` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Ae(ee,ce){if(d.createCount++,Object.keys(ce).length===0)throw new SyntaxError("No signatures provided");d.warnAgainstDeprecatedThis&&De(ce);let we=[],Be=[],qe={},Te=[],Re;for(Re in ce){if(!Object.prototype.hasOwnProperty.call(ce,Re))continue;let et=T(Re);if(!et)continue;we.forEach(function(Ga){if(ge(Ga,et))throw new TypeError('Conflicting signatures "'+S(Ga)+'" and "'+S(et)+'".')}),we.push(et);let on=Be.length;Be.push(ce[Re]);let If=et.map(_),pi;for(pi of pe(If)){let Ga=S(pi);Te.push({params:pi,name:Ga,fn:on}),pi.every(Ws=>!Ws.hasConversion)&&(qe[Ga]=on)}}Te.sort(ae);let Ye=be(Be,qe,Ri),B;for(B in qe)Object.prototype.hasOwnProperty.call(qe,B)&&(qe[B]=Ye[qe[B]]);let Q=[],ve=new Map;for(B of Te)ve.has(B.name)||(B.fn=Ye[B.fn],Q.push(B),ve.set(B.name,B));let Pe=Q[0]&&Q[0].params.length<=2&&!R(Q[0].params),tr=Q[1]&&Q[1].params.length<=2&&!R(Q[1].params),cr=Q[2]&&Q[2].params.length<=2&&!R(Q[2].params),Xr=Q[3]&&Q[3].params.length<=2&&!R(Q[3].params),Pt=Q[4]&&Q[4].params.length<=2&&!R(Q[4].params),Xt=Q[5]&&Q[5].params.length<=2&&!R(Q[5].params),mi=Pe&&tr&&cr&&Xr&&Pt&&Xt;for(let et=0;etet.test),zs=Q.map(et=>et.implementation),Us=function(){for(let on=Pf;onS(T(we))),ce=J(arguments);if(typeof ce!="function")throw new TypeError("Callback function expected as last argument");return ue(ee,ce)}function ue(ee,ce){return{referTo:{references:ee,callback:ce}}}function Me(ee){if(typeof ee!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:ee}}}function Ce(ee){return ee&&typeof ee.referTo=="object"&&Array.isArray(ee.referTo.references)&&typeof ee.referTo.callback=="function"}function Le(ee){return ee&&typeof ee.referToSelf=="object"&&typeof ee.referToSelf.callback=="function"}function Ie(ee,ce){if(!ee)return ce;if(ce&&ce!==ee){let we=new Error("Function names do not match (expected: "+ee+", actual: "+ce+")");throw we.data={actual:ce,expected:ee},we}return ee}function fr(ee){let ce;for(let we in ee)Object.prototype.hasOwnProperty.call(ee,we)&&(C(ee[we])||typeof ee[we].signature=="string")&&(ce=Ie(ce,ee[we].name));return ce}function or(ee,ce){let we;for(we in ce)if(Object.prototype.hasOwnProperty.call(ce,we)){if(we in ee&&ce[we]!==ee[we]){let Be=new Error('Signature "'+we+'" is defined twice');throw Be.data={signature:we,sourceFunction:ce[we],destFunction:ee[we]},Be}ee[we]=ce[we]}}let Ke=d;d=function(ee){let ce=typeof ee=="string",we=ce?1:0,Be=ce?ee:"",qe={};for(let Te=we;Teqe.from===ee.from);if(!we)throw new Error("Attempt to remove nonexistent conversion from "+ee.from+" to "+ee.to);if(we.convert!==ee.convert)throw new Error("Conversion to remove does not match existing conversion");let Be=ce.conversionsTo.indexOf(we);ce.conversionsTo.splice(Be,1)},d.resolve=function(ee,ce){if(!C(ee))throw new TypeError(n);let we=ee._typedFunctionData.signatures;for(let Be=0;Be{(function(e){"use strict";var r=Math.cosh||function(o){return Math.abs(o)<1e-9?1-o:(Math.exp(o)+Math.exp(-o))*.5},t=Math.sinh||function(o){return Math.abs(o)<1e-9?o:(Math.exp(o)-Math.exp(-o))*.5},n=function(o){var u=Math.PI/4;if(-u>o||o>u)return Math.cos(o)-1;var m=o*o;return m*(m*(m*(m*(m*(m*(m*(m/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},a=function(o,u){var m=Math.abs(o),d=Math.abs(u);return m<3e3&&d<3e3?Math.sqrt(m*m+d*d):(m0&&i();break;case"number":m.im=0,m.re=o;break;default:i()}return isNaN(m.re)||isNaN(m.im),m};function c(o,u){if(!(this instanceof c))return new c(o,u);var m=l(o,u);this.re=m.re,this.im=m.im}c.prototype={re:0,im:0,sign:function(){var o=this.abs();return new c(this.re/o,this.im/o)},add:function(o,u){var m=new c(o,u);return this.isInfinite()&&m.isInfinite()?c.NAN:this.isInfinite()||m.isInfinite()?c.INFINITY:new c(this.re+m.re,this.im+m.im)},sub:function(o,u){var m=new c(o,u);return this.isInfinite()&&m.isInfinite()?c.NAN:this.isInfinite()||m.isInfinite()?c.INFINITY:new c(this.re-m.re,this.im-m.im)},mul:function(o,u){var m=new c(o,u);return this.isInfinite()&&m.isZero()||this.isZero()&&m.isInfinite()?c.NAN:this.isInfinite()||m.isInfinite()?c.INFINITY:m.im===0&&this.im===0?new c(this.re*m.re,0):new c(this.re*m.re-this.im*m.im,this.re*m.im+this.im*m.re)},div:function(o,u){var m=new c(o,u);if(this.isZero()&&m.isZero()||this.isInfinite()&&m.isInfinite())return c.NAN;if(this.isInfinite()||m.isZero())return c.INFINITY;if(this.isZero()||m.isInfinite())return c.ZERO;o=this.re,u=this.im;var d=m.re,h=m.im,y,v;return h===0?new c(o/d,u/d):Math.abs(d)0)return new c(Math.pow(o,m.re),0);if(o===0)switch((m.re%4+4)%4){case 0:return new c(Math.pow(u,m.re),0);case 1:return new c(0,Math.pow(u,m.re));case 2:return new c(-Math.pow(u,m.re),0);case 3:return new c(0,-Math.pow(u,m.re))}}if(o===0&&u===0&&m.re>0&&m.im>=0)return c.ZERO;var d=Math.atan2(u,o),h=s(o,u);return o=Math.exp(m.re*h-m.im*d),u=m.im*h+m.re*d,new c(o*Math.cos(u),o*Math.sin(u))},sqrt:function(){var o=this.re,u=this.im,m=this.abs(),d,h;if(o>=0){if(u===0)return new c(Math.sqrt(o),0);d=.5*Math.sqrt(2*(m+o))}else d=Math.abs(u)/Math.sqrt(2*(m-o));return o<=0?h=.5*Math.sqrt(2*(m-o)):h=Math.abs(u)/Math.sqrt(2*(m+o)),new c(d,u<0?-h:h)},exp:function(){var o=Math.exp(this.re);return this.im,new c(o*Math.cos(this.im),o*Math.sin(this.im))},expm1:function(){var o=this.re,u=this.im;return new c(Math.expm1(o)*Math.cos(u)+n(u),Math.exp(o)*Math.sin(u))},log:function(){var o=this.re,u=this.im;return u===0&&o>0,new c(s(o,u),Math.atan2(u,o))},abs:function(){return a(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var o=this.re,u=this.im;return new c(Math.sin(o)*r(u),Math.cos(o)*t(u))},cos:function(){var o=this.re,u=this.im;return new c(Math.cos(o)*r(u),-Math.sin(o)*t(u))},tan:function(){var o=2*this.re,u=2*this.im,m=Math.cos(o)+r(u);return new c(Math.sin(o)/m,t(u)/m)},cot:function(){var o=2*this.re,u=2*this.im,m=Math.cos(o)-r(u);return new c(-Math.sin(o)/m,t(u)/m)},sec:function(){var o=this.re,u=this.im,m=.5*r(2*u)+.5*Math.cos(2*o);return new c(Math.cos(o)*r(u)/m,Math.sin(o)*t(u)/m)},csc:function(){var o=this.re,u=this.im,m=.5*r(2*u)-.5*Math.cos(2*o);return new c(Math.sin(o)*r(u)/m,-Math.cos(o)*t(u)/m)},asin:function(){var o=this.re,u=this.im,m=new c(u*u-o*o+1,-2*o*u).sqrt(),d=new c(m.re-u,m.im+o).log();return new c(d.im,-d.re)},acos:function(){var o=this.re,u=this.im,m=new c(u*u-o*o+1,-2*o*u).sqrt(),d=new c(m.re-u,m.im+o).log();return new c(Math.PI/2-d.im,d.re)},atan:function(){var o=this.re,u=this.im;if(o===0){if(u===1)return new c(0,1/0);if(u===-1)return new c(0,-1/0)}var m=o*o+(1-u)*(1-u),d=new c((1-u*u-o*o)/m,-2*o/m).log();return new c(-.5*d.im,.5*d.re)},acot:function(){var o=this.re,u=this.im;if(u===0)return new c(Math.atan2(1,o),0);var m=o*o+u*u;return m!==0?new c(o/m,-u/m).atan():new c(o!==0?o/0:0,u!==0?-u/0:0).atan()},asec:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new c(0,1/0);var m=o*o+u*u;return m!==0?new c(o/m,-u/m).acos():new c(o!==0?o/0:0,u!==0?-u/0:0).acos()},acsc:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new c(Math.PI/2,1/0);var m=o*o+u*u;return m!==0?new c(o/m,-u/m).asin():new c(o!==0?o/0:0,u!==0?-u/0:0).asin()},sinh:function(){var o=this.re,u=this.im;return new c(t(o)*Math.cos(u),r(o)*Math.sin(u))},cosh:function(){var o=this.re,u=this.im;return new c(r(o)*Math.cos(u),t(o)*Math.sin(u))},tanh:function(){var o=2*this.re,u=2*this.im,m=r(o)+Math.cos(u);return new c(t(o)/m,Math.sin(u)/m)},coth:function(){var o=2*this.re,u=2*this.im,m=r(o)-Math.cos(u);return new c(t(o)/m,-Math.sin(u)/m)},csch:function(){var o=this.re,u=this.im,m=Math.cos(2*u)-r(2*o);return new c(-2*t(o)*Math.cos(u)/m,2*r(o)*Math.sin(u)/m)},sech:function(){var o=this.re,u=this.im,m=Math.cos(2*u)+r(2*o);return new c(2*r(o)*Math.cos(u)/m,-2*t(o)*Math.sin(u)/m)},asinh:function(){var o=this.im;this.im=-this.re,this.re=o;var u=this.asin();return this.re=-this.im,this.im=o,o=u.re,u.re=-u.im,u.im=o,u},acosh:function(){var o=this.acos();if(o.im<=0){var u=o.re;o.re=-o.im,o.im=u}else{var u=o.im;o.im=-o.re,o.re=u}return o},atanh:function(){var o=this.re,u=this.im,m=o>1&&u===0,d=1-o,h=1+o,y=d*d+u*u,v=y!==0?new c((h*d-u*u)/y,(u*d+h*u)/y):new c(o!==-1?o/0:0,u!==0?u/0:0),x=v.re;return v.re=s(v.re,v.im)/2,v.im=Math.atan2(v.im,x)/2,m&&(v.im=-v.im),v},acoth:function(){var o=this.re,u=this.im;if(o===0&&u===0)return new c(0,Math.PI/2);var m=o*o+u*u;return m!==0?new c(o/m,-u/m).atanh():new c(o!==0?o/0:0,u!==0?-u/0:0).atanh()},acsch:function(){var o=this.re,u=this.im;if(u===0)return new c(o!==0?Math.log(o+Math.sqrt(o*o+1)):1/0,0);var m=o*o+u*u;return m!==0?new c(o/m,-u/m).asinh():new c(o!==0?o/0:0,u!==0?-u/0:0).asinh()},asech:function(){var o=this.re,u=this.im;if(this.isZero())return c.INFINITY;var m=o*o+u*u;return m!==0?new c(o/m,-u/m).acosh():new c(o!==0?o/0:0,u!==0?-u/0:0).acosh()},inverse:function(){if(this.isZero())return c.INFINITY;if(this.isInfinite())return c.ZERO;var o=this.re,u=this.im,m=o*o+u*u;return new c(o/m,-u/m)},conjugate:function(){return new c(this.re,-this.im)},neg:function(){return new c(-this.re,-this.im)},ceil:function(o){return o=Math.pow(10,o||0),new c(Math.ceil(this.re*o)/o,Math.ceil(this.im*o)/o)},floor:function(o){return o=Math.pow(10,o||0),new c(Math.floor(this.re*o)/o,Math.floor(this.im*o)/o)},round:function(o){return o=Math.pow(10,o||0),new c(Math.round(this.re*o)/o,Math.round(this.im*o)/o)},equals:function(o,u){var m=new c(o,u);return Math.abs(m.re-this.re)<=c.EPSILON&&Math.abs(m.im-this.im)<=c.EPSILON},clone:function(){return new c(this.re,this.im)},toString:function(){var o=this.re,u=this.im,m="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(o){(function(e){"use strict";var r=2e3,t={s:1,n:0,d:1};function n(v,x){if(isNaN(v=parseInt(v,10)))throw h();return v*x}function a(v,x){if(x===0)throw d();var w=Object.create(m.prototype);w.s=v<0?-1:1,v=v<0?-v:v;var C=u(v,x);return w.n=v/C,w.d=x/C,w}function i(v){for(var x={},w=v,C=2,b=4;b<=w;){for(;w%C===0;)w/=C,x[C]=(x[C]||0)+1;b+=1+2*C++}return w!==v?w>1&&(x[w]=(x[w]||0)+1):x[v]=(x[v]||0)+1,x}var s=function(v,x){var w=0,C=1,b=1,N=0,M=0,S=0,O=1,_=1,E=0,T=1,R=1,L=1,H=1e7,V;if(v!=null)if(x!==void 0){if(w=v,C=x,b=w*C,w%1!==0||C%1!==0)throw y()}else switch(typeof v){case"object":{if("d"in v&&"n"in v)w=v.n,C=v.d,"s"in v&&(w*=v.s);else if(0 in v)w=v[0],1 in v&&(C=v[1]);else throw h();b=w*C;break}case"number":{if(v<0&&(b=v,v=-v),v%1===0)w=v;else if(v>0){for(v>=1&&(_=Math.pow(10,Math.floor(1+Math.log(v)/Math.LN10)),v/=_);T<=H&&L<=H;)if(V=(E+R)/(T+L),v===V){T+L<=H?(w=E+R,C=T+L):L>T?(w=R,C=L):(w=E,C=T);break}else v>V?(E+=R,T+=L):(R+=E,L+=T),T>H?(w=R,C=L):(w=E,C=T);w*=_}else(isNaN(v)||isNaN(x))&&(C=w=NaN);break}case"string":{if(T=v.match(/\\d+|./g),T===null)throw h();if(T[E]==="-"?(b=-1,E++):T[E]==="+"&&E++,T.length===E+1?M=n(T[E++],b):T[E+1]==="."||T[E]==="."?(T[E]!=="."&&(N=n(T[E++],b)),E++,(E+1===T.length||T[E+1]==="("&&T[E+3]===")"||T[E+1]==="'"&&T[E+3]==="'")&&(M=n(T[E],b),O=Math.pow(10,T[E].length),E++),(T[E]==="("&&T[E+2]===")"||T[E]==="'"&&T[E+2]==="'")&&(S=n(T[E+1],b),_=Math.pow(10,T[E+1].length)-1,E+=3)):T[E+1]==="/"||T[E+1]===":"?(M=n(T[E],b),O=n(T[E+2],1),E+=3):T[E+3]==="/"&&T[E+1]===" "&&(N=n(T[E],b),M=n(T[E+2],b),O=n(T[E+4],1),E+=5),T.length<=E){C=O*_,b=w=S+C*N+_*M;break}}default:throw h()}if(C===0)throw d();t.s=b<0?-1:1,t.n=Math.abs(w),t.d=Math.abs(C)};function l(v,x,w){for(var C=1;x>0;v=v*v%w,x>>=1)x&1&&(C=C*v%w);return C}function c(v,x){for(;x%2===0;x/=2);for(;x%5===0;x/=5);if(x===1)return 0;for(var w=10%x,C=1;w!==1;C++)if(w=w*10%x,C>r)return 0;return C}function o(v,x,w){for(var C=1,b=l(10,w,x),N=0;N<300;N++){if(C===b)return N;C=C*10%x,b=b*10%x}return 0}function u(v,x){if(!v)return x;if(!x)return v;for(;;){if(v%=x,!v)return x;if(x%=v,!x)return v}}function m(v,x){if(s(v,x),this instanceof m)v=u(t.d,t.n),this.s=t.s,this.n=t.n/v,this.d=t.d/v;else return a(t.s*t.n,t.d)}var d=function(){return new Error("Division by Zero")},h=function(){return new Error("Invalid argument")},y=function(){return new Error("Parameters must be integer")};m.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(v,x){return s(v,x),a(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(v,x){return s(v,x),a(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(v,x){return s(v,x),a(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(v,x){return s(v,x),a(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(v,x){if(isNaN(this.n)||isNaN(this.d))return new m(NaN);if(v===void 0)return a(this.s*this.n%this.d,1);if(s(v,x),t.n===0&&this.d===0)throw d();return a(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(v,x){return s(v,x),a(u(t.n,this.n)*u(t.d,this.d),t.d*this.d)},lcm:function(v,x){return s(v,x),t.n===0&&this.n===0?a(0,1):a(t.n*this.n,u(t.n,this.n)*u(t.d,this.d))},ceil:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.ceil(v*this.s*this.n/this.d),v)},floor:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.floor(v*this.s*this.n/this.d),v)},round:function(v){return v=Math.pow(10,v||0),isNaN(this.n)||isNaN(this.d)?new m(NaN):a(Math.round(v*this.s*this.n/this.d),v)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(v,x){if(s(v,x),t.d===1)return t.s<0?a(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):a(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var w=i(this.n),C=i(this.d),b=1,N=1;for(var M in w)if(M!=="1"){if(M==="0"){b=0;break}if(w[M]*=t.n,w[M]%t.d===0)w[M]/=t.d;else return null;b*=Math.pow(M,w[M])}for(var M in C)if(M!=="1"){if(C[M]*=t.n,C[M]%t.d===0)C[M]/=t.d;else return null;N*=Math.pow(M,C[M])}return t.s<0?a(N,b):a(b,N)},equals:function(v,x){return s(v,x),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(v,x){s(v,x);var w=this.s*this.n*t.d-t.s*t.n*this.d;return(0=0;N--)b=b.inverse().add(w[N]);if(Math.abs(b.sub(x).valueOf())0&&(w+=x,w+=" ",C%=b),w+=C,w+="/",w+=b),w},toLatex:function(v){var x,w="",C=this.n,b=this.d;return this.s<0&&(w+="-"),b===1?w+=C:(v&&(x=Math.floor(C/b))>0&&(w+=x,C%=b),w+="\\\\frac{",w+=C,w+="}{",w+=b,w+="}"),w},toContinued:function(){var v,x=this.n,w=this.d,C=[];if(isNaN(x)||isNaN(w))return C;do C.push(Math.floor(x/w)),v=x%w,x=w,w=v;while(x!==1);return C},toString:function(v){var x=this.n,w=this.d;if(isNaN(x)||isNaN(w))return"NaN";v=v||15;var C=c(x,w),b=o(x,w,C),N=this.s<0?"-":"";if(N+=x/w|0,x%=w,x*=10,x&&(N+="."),C){for(var M=b;M--;)N+=x/w|0,x%=w,x*=10;N+="(";for(var M=C;M--;)N+=x/w|0,x%=w,x*=10;N+=")"}else for(var M=v;x&&M--;)N+=x/w|0,x%=w,x*=10;return N}},typeof mw=="object"?(Object.defineProperty(m,"__esModule",{value:!0}),m.default=m,m.Fraction=m,WM.exports=m):e.Fraction=m})(mw)});var aE=vn((Fce,nE)=>{nE.exports=function e(r,t){"use strict";var n=/(^([+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)?$|^0x[0-9a-f]+$|\\d+)/gi,a=/(^[ ]*|[ ]*$)/g,i=/(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[\\/\\-]\\d{1,4}[\\/\\-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/,s=/^0x[0-9a-f]+$/i,l=/^0/,c=function(b){return e.insensitive&&(""+b).toLowerCase()||""+b},o=c(r).replace(a,"")||"",u=c(t).replace(a,"")||"",m=o.replace(n,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0"),d=u.replace(n,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0"),h=parseInt(o.match(s),16)||m.length!==1&&o.match(i)&&Date.parse(o),y=parseInt(u.match(s),16)||h&&u.match(i)&&Date.parse(u)||null,v,x;if(y){if(hy)return 1}for(var w=0,C=Math.max(m.length,d.length);wx)return 1}return 0}});var sT=vn((Vhe,oT)=>{"use strict";var gD=Object.assign||function(e){for(var r=1;r1&&arguments[1]!==void 0?arguments[1]:{},t=r.preserveFormatting,n=t===void 0?!1:t,a=r.escapeMapFn,i=a===void 0?q$:a,s=String(e),l="",c=i(gD({},I$),n?gD({},R$):{}),o=Object.keys(c),u=function(){var d=!1;o.forEach(function(h,y){d||s.length>=h.length&&s.slice(0,h.length)===h&&(l+=c[o[y]],s=s.slice(h.length,s.length),d=!0)}),d||(l+=s.slice(0,1),s=s.slice(1,s.length))};s;)u();return l}});var qB=vn((RB,AD)=>{(function(e,r,t){function n(l){var c=this,o=s();c.next=function(){var u=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=u-(c.c=u|0)},c.c=1,c.s0=o(" "),c.s1=o(" "),c.s2=o(" "),c.s0-=o(l),c.s0<0&&(c.s0+=1),c.s1-=o(l),c.s1<0&&(c.s1+=1),c.s2-=o(l),c.s2<0&&(c.s2+=1),o=null}function a(l,c){return c.c=l.c,c.s0=l.s0,c.s1=l.s1,c.s2=l.s2,c}function i(l,c){var o=new n(l),u=c&&c.state,m=o.next;return m.int32=function(){return o.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,u&&(typeof u=="object"&&a(u,o),m.state=function(){return a(o,{})}),m}function s(){var l=4022871197,c=function(o){o=String(o);for(var u=0;u>>0,m-=l,m*=l,l=m>>>0,m-=l,l+=m*4294967296}return(l>>>0)*23283064365386963e-26};return c}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.alea=i})(RB,typeof AD=="object"&&AD,typeof define=="function"&&define)});var LB=vn((kB,MD)=>{(function(e,r,t){function n(s){var l=this,c="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var u=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^u^u>>>8},s===(s|0)?l.x=s:c+=s;for(var o=0;o>>0)/4294967296};return u.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},u.int32=c.next,u.quick=u,o&&(typeof o=="object"&&a(o,c),u.state=function(){return a(c,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xor128=i})(kB,typeof MD=="object"&&MD,typeof define=="function"&&define)});var UB=vn((zB,CD)=>{(function(e,r,t){function n(s){var l=this,c="";l.next=function(){var u=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(u^u<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,s===(s|0)?l.x=s:c+=s;for(var o=0;o>>4),l.next()}function a(s,l){return l.x=s.x,l.y=s.y,l.z=s.z,l.w=s.w,l.v=s.v,l.d=s.d,l}function i(s,l){var c=new n(s),o=l&&l.state,u=function(){return(c.next()>>>0)/4294967296};return u.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},u.int32=c.next,u.quick=u,o&&(typeof o=="object"&&a(o,c),u.state=function(){return a(c,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xorwow=i})(zB,typeof CD=="object"&&CD,typeof define=="function"&&define)});var YB=vn((WB,ED)=>{(function(e,r,t){function n(s){var l=this;l.next=function(){var o=l.x,u=l.i,m,d,h;return m=o[u],m^=m>>>7,d=m^m<<24,m=o[u+1&7],d^=m^m>>>10,m=o[u+3&7],d^=m^m>>>3,m=o[u+4&7],d^=m^m<<7,m=o[u+7&7],m=m^m<<13,d^=m^m<<9,o[u]=d,l.i=u+1&7,d};function c(o,u){var m,d,h=[];if(u===(u|0))d=h[0]=u;else for(u=""+u,m=0;m0;--m)o.next()}c(l,s)}function a(s,l){return l.x=s.x.slice(),l.i=s.i,l}function i(s,l){s==null&&(s=+new Date);var c=new n(s),o=l&&l.state,u=function(){return(c.next()>>>0)/4294967296};return u.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},u.int32=c.next,u.quick=u,o&&(o.x&&a(o,c),u.state=function(){return a(c,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xorshift7=i})(WB,typeof ED=="object"&&ED,typeof define=="function"&&define)});var $B=vn((HB,TD)=>{(function(e,r,t){function n(s){var l=this;l.next=function(){var o=l.w,u=l.X,m=l.i,d,h;return l.w=o=o+1640531527|0,h=u[m+34&127],d=u[m=m+1&127],h^=h<<13,d^=d<<17,h^=h>>>15,d^=d>>>12,h=u[m]=h^d,l.i=m,h+(o^o>>>16)|0};function c(o,u){var m,d,h,y,v,x=[],w=128;for(u===(u|0)?(d=u,u=null):(u=u+"\\0",d=0,w=Math.max(w,u.length)),h=0,y=-32;y>>15,d^=d<<4,d^=d>>>13,y>=0&&(v=v+1640531527|0,m=x[y&127]^=d+v,h=m==0?h+1:0);for(h>=128&&(x[(u&&u.length||0)&127]=-1),h=127,y=4*128;y>0;--y)d=x[h+34&127],m=x[h=h+1&127],d^=d<<13,m^=m<<17,d^=d>>>15,m^=m>>>12,x[h]=d^m;o.w=v,o.X=x,o.i=h}c(l,s)}function a(s,l){return l.i=s.i,l.w=s.w,l.X=s.X.slice(),l}function i(s,l){s==null&&(s=+new Date);var c=new n(s),o=l&&l.state,u=function(){return(c.next()>>>0)/4294967296};return u.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},u.int32=c.next,u.quick=u,o&&(o.X&&a(o,c),u.state=function(){return a(c,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.xor4096=i})(HB,typeof TD=="object"&&TD,typeof define=="function"&&define)});var VB=vn((GB,FD)=>{(function(e,r,t){function n(s){var l=this,c="";l.next=function(){var u=l.b,m=l.c,d=l.d,h=l.a;return u=u<<25^u>>>7^m,m=m-d|0,d=d<<24^d>>>8^h,h=h-u|0,l.b=u=u<<20^u>>>12^m,l.c=m=m-d|0,l.d=d<<16^m>>>16^h,l.a=h-u|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,s===Math.floor(s)?(l.a=s/4294967296|0,l.b=s|0):c+=s;for(var o=0;o>>0)/4294967296};return u.double=function(){do var m=c.next()>>>11,d=(c.next()>>>0)/4294967296,h=(m+d)/(1<<21);while(h===0);return h},u.int32=c.next,u.quick=u,o&&(typeof o=="object"&&a(o,c),u.state=function(){return a(c,{})}),u}r&&r.exports?r.exports=i:t&&t.amd?t(function(){return i}):this.tychei=i})(GB,typeof FD=="object"&&FD,typeof define=="function"&&define)});var ZB=vn(()=>{});var XB=vn((QB,zg)=>{(function(e,r,t){var n=256,a=6,i=52,s="random",l=t.pow(n,a),c=t.pow(2,i),o=c*2,u=n-1,m;function d(b,N,M){var S=[];N=N==!0?{entropy:!0}:N||{};var O=x(v(N.entropy?[b,C(r)]:b??w(),3),S),_=new h(S),E=function(){for(var T=_.g(a),R=l,L=0;T=o;)T/=2,R/=2,L>>>=1;return(T+L)/R};return E.int32=function(){return _.g(4)|0},E.quick=function(){return _.g(4)/4294967296},E.double=E,x(C(_.S),r),(N.pass||M||function(T,R,L,H){return H&&(H.S&&y(H,_),T.state=function(){return y(_,{})}),L?(t[s]=T,R):T})(E,O,"global"in N?N.global:this==t,N.state)}function h(b){var N,M=b.length,S=this,O=0,_=S.i=S.j=0,E=S.S=[];for(M||(b=[M++]);O{var eV=qB(),rV=LB(),tV=UB(),nV=YB(),aV=$B(),iV=VB(),Bs=XB();Bs.alea=eV;Bs.xor128=rV;Bs.xorwow=tV;Bs.xorshift7=nV;Bs.xor4096=aV;Bs.tychei=iV;JB.exports=Bs});var jR=vn((BIe,CS)=>{function MS(){}MS.prototype={on:function(e,r,t){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:r,ctx:t}),this},once:function(e,r,t){var n=this;function a(){n.off(e,a),r.apply(t,arguments)}return a._=r,this.on(e,a,t)},emit:function(e){var r=[].slice.call(arguments,1),t=((this.e||(this.e={}))[e]||[]).slice(),n=0,a=t.length;for(n;n{(function(e,r){typeof ES=="object"&&typeof Nf<"u"?Nf.exports=r():typeof define=="function"&&define.amd?define(r):e.moment=r()})(ES,function(){"use strict";var e;function r(){return e.apply(null,arguments)}function t(g){e=g}function n(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function a(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function i(g,A){return Object.prototype.hasOwnProperty.call(g,A)}function s(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var A;for(A in g)if(i(g,A))return!1;return!0}function l(g){return g===void 0}function c(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function o(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function u(g,A){var I=[],U,G=g.length;for(U=0;U>>0,U;for(U=0;U0)for(I=0;I=0;return(se?I?"+":"":"-")+Math.pow(10,Math.max(0,V)).toString().substr(1)+U}var z=/(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,oe=/(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,pe={},ae={};function $(g,A,I,U){var V=U;typeof U=="string"&&(V=function(){return this[U]()}),g&&(ae[g]=V),A&&(ae[A[0]]=function(){return K(V.apply(this,arguments),A[1],A[2])}),I&&(ae[I]=function(){return this.localeData().ordinal(V.apply(this,arguments),g)})}function le(g){return g.match(/\\[[\\s\\S]/)?g.replace(/^\\[|\\]$/g,""):g.replace(/\\\\/g,"")}function Ee(g){var A=g.match(z),I,U;for(I=0,U=A.length;I=0&&oe.test(g);)g=g.replace(oe,U),oe.lastIndex=0,I-=1;return g}var Se={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function ye(g){var A=this._longDateFormat[g],I=this._longDateFormat[g.toUpperCase()];return A||!I?A:(this._longDateFormat[g]=I.match(z).map(function(U){return U==="MMMM"||U==="MM"||U==="DD"||U==="dddd"?U.slice(1):U}).join(""),this._longDateFormat[g])}var be="Invalid date";function De(){return this._invalidDate}var Ae="%d",We=/\\d{1,2}/;function Je(g){return this._ordinal.replace("%d",g)}var J={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function re(g,A,I,U){var V=this._relativeTime[I];return R(V)?V(g,A,I,U):V.replace(/%d/i,g)}function xe(g,A){var I=this._relativeTime[g>0?"future":"past"];return R(I)?I(A):I.replace(/%s/i,A)}var j={};function ne(g,A){var I=g.toLowerCase();j[I]=j[I+"s"]=j[A]=g}function ue(g){return typeof g=="string"?j[g]||j[g.toLowerCase()]:void 0}function Me(g){var A={},I,U;for(U in g)i(g,U)&&(I=ue(U),I&&(A[I]=g[U]));return A}var Ce={};function Le(g,A){Ce[g]=A}function Ie(g){var A=[],I;for(I in g)i(g,I)&&A.push({unit:I,priority:Ce[I]});return A.sort(function(U,V){return U.priority-V.priority}),A}function fr(g){return g%4===0&&g%100!==0||g%400===0}function or(g){return g<0?Math.ceil(g)||0:Math.floor(g)}function Ke(g){var A=+g,I=0;return A!==0&&isFinite(A)&&(I=or(A)),I}function Pr(g,A){return function(I){return I!=null?(ce(this,g,I),r.updateOffset(this,A),this):ee(this,g)}}function ee(g,A){return g.isValid()?g._d["get"+(g._isUTC?"UTC":"")+A]():NaN}function ce(g,A,I){g.isValid()&&!isNaN(I)&&(A==="FullYear"&&fr(g.year())&&g.month()===1&&g.date()===29?(I=Ke(I),g._d["set"+(g._isUTC?"UTC":"")+A](I,g.month(),fo(I,g.month()))):g._d["set"+(g._isUTC?"UTC":"")+A](I))}function we(g){return g=ue(g),R(this[g])?this[g]():this}function Be(g,A){if(typeof g=="object"){g=Me(g);var I=Ie(g),U,V=I.length;for(U=0;U68?1900:2e3)};var kf=Pr("FullYear",!0);function gx(){return fr(this.year())}function Gc(g,A,I,U,V,se,Fe){var dr;return g<100&&g>=0?(dr=new Date(g+400,A,I,U,V,se,Fe),isFinite(dr.getFullYear())&&dr.setFullYear(g)):dr=new Date(g,A,I,U,V,se,Fe),dr}function co(g){var A,I;return g<100&&g>=0?(I=Array.prototype.slice.call(arguments),I[0]=g+400,A=new Date(Date.UTC.apply(null,I)),isFinite(A.getUTCFullYear())&&A.setUTCFullYear(g)):A=new Date(Date.UTC.apply(null,arguments)),A}function lo(g,A,I){var U=7+A-I,V=(7+co(g,0,U).getUTCDay()-A)%7;return-V+U-1}function Vc(g,A,I,U,V){var se=(7+I-U)%7,Fe=lo(g,U,V),dr=1+7*(A-1)+se+Fe,_r,tt;return dr<=0?(_r=g-1,tt=di(_r)+dr):dr>di(g)?(_r=g+1,tt=dr-di(g)):(_r=g,tt=dr),{year:_r,dayOfYear:tt}}function mo(g,A,I){var U=lo(g.year(),A,I),V=Math.floor((g.dayOfYear()-U-1)/7)+1,se,Fe;return V<1?(Fe=g.year()-1,se=V+ia(Fe,A,I)):V>ia(g.year(),A,I)?(se=V-ia(g.year(),A,I),Fe=g.year()+1):(Fe=g.year(),se=V),{week:se,year:Fe}}function ia(g,A,I){var U=lo(g,A,I),V=lo(g+1,A,I);return(di(g)-U+V)/7}$("w",["ww",2],"wo","week"),$("W",["WW",2],"Wo","isoWeek"),ne("week","w"),ne("isoWeek","W"),Le("week",5),Le("isoWeek",5),nr("w",Q),nr("ww",Q,Te),nr("W",Q),nr("WW",Q,Te),Ii(["w","ww","W","WW"],function(g,A,I,U){A[U.substr(0,1)]=Ke(g)});function Lf(g){return mo(g,this._week.dow,this._week.doy).week}var po={dow:0,doy:6};function Zc(){return this._week.dow}function Qc(){return this._week.doy}function yx(g){var A=this.localeData().week(this);return g==null?A:this.add((g-A)*7,"d")}function Xc(g){var A=mo(this,1,4).week;return g==null?A:this.add((g-A)*7,"d")}$("d",0,"do","day"),$("dd",0,0,function(g){return this.localeData().weekdaysMin(this,g)}),$("ddd",0,0,function(g){return this.localeData().weekdaysShort(this,g)}),$("dddd",0,0,function(g){return this.localeData().weekdays(this,g)}),$("e",0,0,"weekday"),$("E",0,0,"isoWeekday"),ne("day","d"),ne("weekday","e"),ne("isoWeekday","E"),Le("day",11),Le("weekday",11),Le("isoWeekday",11),nr("d",Q),nr("e",Q),nr("E",Q),nr("dd",function(g,A){return A.weekdaysMinRegex(g)}),nr("ddd",function(g,A){return A.weekdaysShortRegex(g)}),nr("dddd",function(g,A){return A.weekdaysRegex(g)}),Ii(["dd","ddd","dddd"],function(g,A,I,U){var V=I._locale.weekdaysParse(g,U,I._strict);V!=null?A.d=V:y(I).invalidWeekday=g}),Ii(["d","e","E"],function(g,A,I,U){A[U]=Ke(g)});function Jc(g,A){return typeof g!="string"?g:isNaN(g)?(g=A.weekdaysParse(g),typeof g=="number"?g:null):parseInt(g,10)}function Kc(g,A){return typeof g=="string"?A.weekdaysParse(g)%7||7:isNaN(g)?null:g}function Ys(g,A){return g.slice(A,7).concat(g.slice(0,A))}var xx="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),jc="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),bx="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),el=Ha,wx=Ha,Dx=Ha;function Sx(g,A){var I=n(this._weekdays)?this._weekdays:this._weekdays[g&&g!==!0&&this._weekdays.isFormat.test(A)?"format":"standalone"];return g===!0?Ys(I,this._week.dow):g?I[g.day()]:I}function Nx(g){return g===!0?Ys(this._weekdaysShort,this._week.dow):g?this._weekdaysShort[g.day()]:this._weekdaysShort}function zf(g){return g===!0?Ys(this._weekdaysMin,this._week.dow):g?this._weekdaysMin[g.day()]:this._weekdaysMin}function Ax(g,A,I){var U,V,se,Fe=g.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],U=0;U<7;++U)se=d([2e3,1]).day(U),this._minWeekdaysParse[U]=this.weekdaysMin(se,"").toLocaleLowerCase(),this._shortWeekdaysParse[U]=this.weekdaysShort(se,"").toLocaleLowerCase(),this._weekdaysParse[U]=this.weekdays(se,"").toLocaleLowerCase();return I?A==="dddd"?(V=vt.call(this._weekdaysParse,Fe),V!==-1?V:null):A==="ddd"?(V=vt.call(this._shortWeekdaysParse,Fe),V!==-1?V:null):(V=vt.call(this._minWeekdaysParse,Fe),V!==-1?V:null):A==="dddd"?(V=vt.call(this._weekdaysParse,Fe),V!==-1||(V=vt.call(this._shortWeekdaysParse,Fe),V!==-1)?V:(V=vt.call(this._minWeekdaysParse,Fe),V!==-1?V:null)):A==="ddd"?(V=vt.call(this._shortWeekdaysParse,Fe),V!==-1||(V=vt.call(this._weekdaysParse,Fe),V!==-1)?V:(V=vt.call(this._minWeekdaysParse,Fe),V!==-1?V:null)):(V=vt.call(this._minWeekdaysParse,Fe),V!==-1||(V=vt.call(this._weekdaysParse,Fe),V!==-1)?V:(V=vt.call(this._shortWeekdaysParse,Fe),V!==-1?V:null))}function Mx(g,A,I){var U,V,se;if(this._weekdaysParseExact)return Ax.call(this,g,A,I);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),U=0;U<7;U++){if(V=d([2e3,1]).day(U),I&&!this._fullWeekdaysParse[U]&&(this._fullWeekdaysParse[U]=new RegExp("^"+this.weekdays(V,"").replace(".","\\\\.?")+"$","i"),this._shortWeekdaysParse[U]=new RegExp("^"+this.weekdaysShort(V,"").replace(".","\\\\.?")+"$","i"),this._minWeekdaysParse[U]=new RegExp("^"+this.weekdaysMin(V,"").replace(".","\\\\.?")+"$","i")),this._weekdaysParse[U]||(se="^"+this.weekdays(V,"")+"|^"+this.weekdaysShort(V,"")+"|^"+this.weekdaysMin(V,""),this._weekdaysParse[U]=new RegExp(se.replace(".",""),"i")),I&&A==="dddd"&&this._fullWeekdaysParse[U].test(g))return U;if(I&&A==="ddd"&&this._shortWeekdaysParse[U].test(g))return U;if(I&&A==="dd"&&this._minWeekdaysParse[U].test(g))return U;if(!I&&this._weekdaysParse[U].test(g))return U}}function Cx(g){if(!this.isValid())return g!=null?this:NaN;var A=this._isUTC?this._d.getUTCDay():this._d.getDay();return g!=null?(g=Jc(g,this.localeData()),this.add(g-A,"d")):A}function Ex(g){if(!this.isValid())return g!=null?this:NaN;var A=(this.day()+7-this.localeData()._week.dow)%7;return g==null?A:this.add(g-A,"d")}function Tx(g){if(!this.isValid())return g!=null?this:NaN;if(g!=null){var A=Kc(g,this.localeData());return this.day(this.day()%7?A:A-7)}else return this.day()||7}function xt(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Uf.call(this),g?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=el),this._weekdaysStrictRegex&&g?this._weekdaysStrictRegex:this._weekdaysRegex)}function gt(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Uf.call(this),g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=wx),this._weekdaysShortStrictRegex&&g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Fx(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Uf.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Dx),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Uf(){function g(hn,Ca){return Ca.length-hn.length}var A=[],I=[],U=[],V=[],se,Fe,dr,_r,tt;for(se=0;se<7;se++)Fe=d([2e3,1]).day(se),dr=mn(this.weekdaysMin(Fe,"")),_r=mn(this.weekdaysShort(Fe,"")),tt=mn(this.weekdays(Fe,"")),A.push(dr),I.push(_r),U.push(tt),V.push(dr),V.push(_r),V.push(tt);A.sort(g),I.sort(g),U.sort(g),V.sort(g),this._weekdaysRegex=new RegExp("^("+V.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+U.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+A.join("|")+")","i")}function Wf(){return this.hours()%12||12}function _x(){return this.hours()||24}$("H",["HH",2],0,"hour"),$("h",["hh",2],0,Wf),$("k",["kk",2],0,_x),$("hmm",0,0,function(){return""+Wf.apply(this)+K(this.minutes(),2)}),$("hmmss",0,0,function(){return""+Wf.apply(this)+K(this.minutes(),2)+K(this.seconds(),2)}),$("Hmm",0,0,function(){return""+this.hours()+K(this.minutes(),2)}),$("Hmmss",0,0,function(){return""+this.hours()+K(this.minutes(),2)+K(this.seconds(),2)});function rl(g,A){$(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),A)})}rl("a",!0),rl("A",!1),ne("hour","h"),Le("hour",13);function tl(g,A){return A._meridiemParse}nr("a",tl),nr("A",tl),nr("H",Q),nr("h",Q),nr("k",Q),nr("HH",Q,Te),nr("hh",Q,Te),nr("kk",Q,Te),nr("hmm",ve),nr("hmmss",Pe),nr("Hmm",ve),nr("Hmmss",Pe),ot(["H","HH"],Tt),ot(["k","kk"],function(g,A,I){var U=Ke(g);A[Tt]=U===24?0:U}),ot(["a","A"],function(g,A,I){I._isPm=I._locale.isPM(g),I._meridiem=g}),ot(["h","hh"],function(g,A,I){A[Tt]=Ke(g),y(I).bigHour=!0}),ot("hmm",function(g,A,I){var U=g.length-2;A[Tt]=Ke(g.substr(0,U)),A[On]=Ke(g.substr(U)),y(I).bigHour=!0}),ot("hmmss",function(g,A,I){var U=g.length-4,V=g.length-2;A[Tt]=Ke(g.substr(0,U)),A[On]=Ke(g.substr(U,2)),A[aa]=Ke(g.substr(V)),y(I).bigHour=!0}),ot("Hmm",function(g,A,I){var U=g.length-2;A[Tt]=Ke(g.substr(0,U)),A[On]=Ke(g.substr(U))}),ot("Hmmss",function(g,A,I){var U=g.length-4,V=g.length-2;A[Tt]=Ke(g.substr(0,U)),A[On]=Ke(g.substr(U,2)),A[aa]=Ke(g.substr(V))});function nl(g){return(g+"").toLowerCase().charAt(0)==="p"}var Ox=/[ap]\\.?m?\\.?/i,Vt=Pr("Hours",!0);function Yf(g,A,I){return g>11?I?"pm":"PM":I?"am":"AM"}var hi={calendar:L,longDateFormat:Se,invalidDate:be,ordinal:Ae,dayOfMonthOrdinalParse:We,relativeTime:J,months:Pf,monthsShort:Ls,week:po,weekdays:xx,weekdaysMin:bx,weekdaysShort:jc,meridiemParse:Ox},bt={},qi={},sn;function al(g,A){var I,U=Math.min(g.length,A.length);for(I=0;I0;){if(V=es(se.slice(0,I).join("-")),V)return V;if(U&&U.length>=I&&al(se,U)>=I-1)break;I--}A++}return sn}function ol(g){return g.match("^[^/\\\\\\\\]*$")!=null}function es(g){var A=null,I;if(bt[g]===void 0&&typeof Nf<"u"&&Nf&&Nf.exports&&ol(g))try{A=sn._abbr,I=require,I("./locale/"+g),Va(A)}catch{bt[g]=null}return bt[g]}function Va(g,A){var I;return g&&(l(A)?I=It(g):I=pn(g,A),I?sn=I:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),sn._abbr}function pn(g,A){if(A!==null){var I,U=hi;if(A.abbr=g,bt[g]!=null)T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),U=bt[g]._config;else if(A.parentLocale!=null)if(bt[A.parentLocale]!=null)U=bt[A.parentLocale]._config;else if(I=es(A.parentLocale),I!=null)U=I._config;else return qi[A.parentLocale]||(qi[A.parentLocale]=[]),qi[A.parentLocale].push({name:g,config:A}),null;return bt[g]=new G(W(U,A)),qi[g]&&qi[g].forEach(function(V){pn(V.name,V.config)}),Va(g),bt[g]}else return delete bt[g],null}function Bx(g,A){if(A!=null){var I,U,V=hi;bt[g]!=null&&bt[g].parentLocale!=null?bt[g].set(W(bt[g]._config,A)):(U=es(g),U!=null&&(V=U._config),A=W(V,A),U==null&&(A.abbr=g),I=new G(A),I.parentLocale=bt[g],bt[g]=I),Va(g)}else bt[g]!=null&&(bt[g].parentLocale!=null?(bt[g]=bt[g].parentLocale,g===Va()&&Va(g)):bt[g]!=null&&delete bt[g]);return bt[g]}function It(g){var A;if(g&&g._locale&&g._locale._abbr&&(g=g._locale._abbr),!g)return sn;if(!n(g)){if(A=es(g),A)return A;g=[g]}return il(g)}function Px(){return H(bt)}function Hs(g){var A,I=g._a;return I&&y(g).overflow===-2&&(A=I[Un]<0||I[Un]>11?Un:I[Wn]<1||I[Wn]>fo(I[Gt],I[Un])?Wn:I[Tt]<0||I[Tt]>24||I[Tt]===24&&(I[On]!==0||I[aa]!==0||I[$a]!==0)?Tt:I[On]<0||I[On]>59?On:I[aa]<0||I[aa]>59?aa:I[$a]<0||I[$a]>999?$a:-1,y(g)._overflowDayOfYear&&(AWn)&&(A=Wn),y(g)._overflowWeeks&&A===-1&&(A=Of),y(g)._overflowWeekday&&A===-1&&(A=uo),y(g).overflow=A),g}var vi=/^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,$s=/^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,$f=/Z|[+-]\\d\\d(?::?\\d\\d)?/,dt=[["YYYYYY-MM-DD",/[+-]\\d{6}-\\d\\d-\\d\\d/],["YYYY-MM-DD",/\\d{4}-\\d\\d-\\d\\d/],["GGGG-[W]WW-E",/\\d{4}-W\\d\\d-\\d/],["GGGG-[W]WW",/\\d{4}-W\\d\\d/,!1],["YYYY-DDD",/\\d{4}-\\d{3}/],["YYYY-MM",/\\d{4}-\\d\\d/,!1],["YYYYYYMMDD",/[+-]\\d{10}/],["YYYYMMDD",/\\d{8}/],["GGGG[W]WWE",/\\d{4}W\\d{3}/],["GGGG[W]WW",/\\d{4}W\\d{2}/,!1],["YYYYDDD",/\\d{7}/],["YYYYMM",/\\d{6}/,!1],["YYYY",/\\d{4}/,!1]],Da=[["HH:mm:ss.SSSS",/\\d\\d:\\d\\d:\\d\\d\\.\\d+/],["HH:mm:ss,SSSS",/\\d\\d:\\d\\d:\\d\\d,\\d+/],["HH:mm:ss",/\\d\\d:\\d\\d:\\d\\d/],["HH:mm",/\\d\\d:\\d\\d/],["HHmmss.SSSS",/\\d\\d\\d\\d\\d\\d\\.\\d+/],["HHmmss,SSSS",/\\d\\d\\d\\d\\d\\d,\\d+/],["HHmmss",/\\d\\d\\d\\d\\d\\d/],["HHmm",/\\d\\d\\d\\d/],["HH",/\\d\\d/]],Gf=/^\\/?Date\\((-?\\d+)/i,Ix=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,Vf={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function sl(g){var A,I,U=g._i,V=vi.exec(U)||$s.exec(U),se,Fe,dr,_r,tt=dt.length,hn=Da.length;if(V){for(y(g).iso=!0,A=0,I=tt;Adi(Fe)||g._dayOfYear===0)&&(y(g)._overflowDayOfYear=!0),I=co(Fe,0,g._dayOfYear),g._a[Un]=I.getUTCMonth(),g._a[Wn]=I.getUTCDate()),A=0;A<3&&g._a[A]==null;++A)g._a[A]=U[A]=V[A];for(;A<7;A++)g._a[A]=U[A]=g._a[A]==null?A===2?1:0:g._a[A];g._a[Tt]===24&&g._a[On]===0&&g._a[aa]===0&&g._a[$a]===0&&(g._nextDay=!0,g._a[Tt]=0),g._d=(g._useUTC?co:Gc).apply(null,U),se=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[Tt]=24),g._w&&typeof g._w.d<"u"&&g._w.d!==se&&(y(g).weekdayMismatch=!0)}}function ll(g){var A,I,U,V,se,Fe,dr,_r,tt;A=g._w,A.GG!=null||A.W!=null||A.E!=null?(se=1,Fe=4,I=ki(A.GG,g._a[Gt],mo(yt(),1,4).year),U=ki(A.W,1),V=ki(A.E,1),(V<1||V>7)&&(_r=!0)):(se=g._locale._week.dow,Fe=g._locale._week.doy,tt=mo(yt(),se,Fe),I=ki(A.gg,g._a[Gt],tt.year),U=ki(A.w,tt.week),A.d!=null?(V=A.d,(V<0||V>6)&&(_r=!0)):A.e!=null?(V=A.e+se,(A.e<0||A.e>6)&&(_r=!0)):V=se),U<1||U>ia(I,se,Fe)?y(g)._overflowWeeks=!0:_r!=null?y(g)._overflowWeekday=!0:(dr=Vc(I,U,V,se,Fe),g._a[Gt]=dr.year,g._dayOfYear=dr.dayOfYear)}r.ISO_8601=function(){},r.RFC_2822=function(){};function Qf(g){if(g._f===r.ISO_8601){sl(g);return}if(g._f===r.RFC_2822){fl(g);return}g._a=[],y(g).empty=!0;var A=""+g._i,I,U,V,se,Fe,dr=A.length,_r=0,tt,hn;for(V=ge(g._f,g._locale).match(z)||[],hn=V.length,I=0;I0&&y(g).unusedInput.push(Fe),A=A.slice(A.indexOf(U)+U.length),_r+=U.length),ae[se]?(U?y(g).empty=!1:y(g).unusedTokens.push(se),_f(se,U,g)):g._strict&&!U&&y(g).unusedTokens.push(se);y(g).charsLeftOver=dr-_r,A.length>0&&y(g).unusedInput.push(A),g._a[Tt]<=12&&y(g).bigHour===!0&&g._a[Tt]>0&&(y(g).bigHour=void 0),y(g).parsedDateParts=g._a.slice(0),y(g).meridiem=g._meridiem,g._a[Tt]=Xf(g._locale,g._a[Tt],g._meridiem),tt=y(g).era,tt!==null&&(g._a[Gt]=g._locale.erasConvertYear(tt,g._a[Gt])),rs(g),Hs(g)}function Xf(g,A,I){var U;return I==null?A:g.meridiemHour!=null?g.meridiemHour(A,I):(g.isPM!=null&&(U=g.isPM(I),U&&A<12&&(A+=12),!U&&A===12&&(A=0)),A)}function Jf(g){var A,I,U,V,se,Fe,dr=!1,_r=g._f.length;if(_r===0){y(g).invalidFormat=!0,g._d=new Date(NaN);return}for(V=0;V<_r;V++)se=0,Fe=!1,A=N({},g),g._useUTC!=null&&(A._useUTC=g._useUTC),A._f=g._f[V],Qf(A),x(A)&&(Fe=!0),se+=y(A).charsLeftOver,se+=y(A).unusedTokens.length*10,y(A).score=se,dr?sethis?this:g:w()});function dl(g,A){var I,U;if(A.length===1&&n(A[0])&&(A=A[0]),!A.length)return yt();for(I=A[0],U=1;Uthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function _e(){if(!l(this._isDSTShifted))return this._isDSTShifted;var g={},A;return N(g,this),g=wn(g),g._a?(A=g._isUTC?d(g._a):yt(g._a),this._isDSTShifted=this.isValid()&&$x(g._a,A.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Ne(){return this.isValid()?!this._isUTC:!1}function ir(){return this.isValid()?this._isUTC:!1}function Ar(){return this.isValid()?this._isUTC&&this._offset===0:!1}var rt=/^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,zt=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function zr(g,A){var I=g,U=null,V,se,Fe;return oa(g)?I={ms:g._milliseconds,d:g._days,M:g._months}:c(g)||!isNaN(+g)?(I={},A?I[A]=+g:I.milliseconds=+g):(U=rt.exec(g))?(V=U[1]==="-"?-1:1,I={y:0,d:Ke(U[Wn])*V,h:Ke(U[Tt])*V,m:Ke(U[On])*V,s:Ke(U[aa])*V,ms:Ke(go(U[$a]*1e3))*V}):(U=zt.exec(g))?(V=U[1]==="-"?-1:1,I={y:Za(U[2],V),M:Za(U[3],V),w:Za(U[4],V),d:Za(U[5],V),h:Za(U[6],V),m:Za(U[7],V),s:Za(U[8],V)}):I==null?I={}:typeof I=="object"&&("from"in I||"to"in I)&&(Fe=Yn(yt(I.from),yt(I.to)),I={},I.ms=Fe.milliseconds,I.M=Fe.months),se=new ts(I),oa(g)&&i(g,"_locale")&&(se._locale=g._locale),oa(g)&&i(g,"_isValid")&&(se._isValid=g._isValid),se}zr.fn=ts.prototype,zr.invalid=jf;function Za(g,A){var I=g&&parseFloat(g.replace(",","."));return(isNaN(I)?0:I)*A}function vl(g,A){var I={};return I.months=A.month()-g.month()+(A.year()-g.year())*12,g.clone().add(I.months,"M").isAfter(A)&&--I.months,I.milliseconds=+A-+g.clone().add(I.months,"M"),I}function Yn(g,A){var I;return g.isValid()&&A.isValid()?(A=Bn(A,g),g.isBefore(A)?I=vl(g,A):(I=vl(A,g),I.milliseconds=-I.milliseconds,I.months=-I.months),I):{milliseconds:0,months:0}}function ns(g,A){return function(I,U){var V,se;return U!==null&&!isNaN(+U)&&(T(A,"moment()."+A+"(period, number) is deprecated. Please use moment()."+A+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),se=I,I=U,U=se),V=zr(I,U),gl(this,V,g),this}}function gl(g,A,I,U){var V=A._milliseconds,se=go(A._days),Fe=go(A._months);!g.isValid()||(U=U??!0,Fe&&pi(g,ee(g,"Month")+Fe*I),se&&ce(g,"Date",ee(g,"Date")+se*I),V&&g._d.setTime(g._d.valueOf()+V*I),U&&r.updateOffset(g,se||Fe))}var yo=ns(1,"add"),Zs=ns(-1,"subtract");function as(g){return typeof g=="string"||g instanceof String}function ut(g){return S(g)||o(g)||as(g)||c(g)||yl(g)||Kx(g)||g===null||g===void 0}function Kx(g){var A=a(g)&&!u(g),I=!1,U=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],V,se,Fe=U.length;for(V=0;VI.valueOf():I.valueOf()9999?me(I,A?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):R(Date.prototype.toISOString)?A?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",me(I,"Z")):me(I,A?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function zi(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var g="moment",A="",I,U,V,se;return this.isLocal()||(g=this.utcOffset()===0?"moment.utc":"moment.parseZone",A="Z"),I="["+g+'("]',U=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",V="-MM-DD[T]HH:mm:ss.SSS",se=A+'[")]',this.format(I+U+V+se)}function js(g){g||(g=this.isUtc()?r.defaultFormatUtc:r.defaultFormat);var A=me(this,g);return this.localeData().postformat(A)}function t1(g,A){return this.isValid()&&(S(g)&&g.isValid()||yt(g).isValid())?zr({to:this,from:g}).locale(this.locale()).humanize(!A):this.localeData().invalidDate()}function n1(g){return this.from(yt(),g)}function a1(g,A){return this.isValid()&&(S(g)&&g.isValid()||yt(g).isValid())?zr({from:this,to:g}).locale(this.locale()).humanize(!A):this.localeData().invalidDate()}function eu(g){return this.to(yt(),g)}function os(g){var A;return g===void 0?this._locale._abbr:(A=It(g),A!=null&&(this._locale=A),this)}var ru=_("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(g){return g===void 0?this.localeData():this.locale(g)});function Sl(){return this._locale}var ss=1e3,xo=60*ss,tu=60*xo,Rt=(365*400+97)*24*tu;function Ft(g,A){return(g%A+A)%A}function Nl(g,A,I){return g<100&&g>=0?new Date(g+400,A,I)-Rt:new Date(g,A,I).valueOf()}function Al(g,A,I){return g<100&&g>=0?Date.UTC(g+400,A,I)-Rt:Date.UTC(g,A,I)}function Ml(g){var A,I;if(g=ue(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?Al:Nl,g){case"year":A=I(this.year(),0,1);break;case"quarter":A=I(this.year(),this.month()-this.month()%3,1);break;case"month":A=I(this.year(),this.month(),1);break;case"week":A=I(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":A=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":A=I(this.year(),this.month(),this.date());break;case"hour":A=this._d.valueOf(),A-=Ft(A+(this._isUTC?0:this.utcOffset()*xo),tu);break;case"minute":A=this._d.valueOf(),A-=Ft(A,xo);break;case"second":A=this._d.valueOf(),A-=Ft(A,ss);break}return this._d.setTime(A),r.updateOffset(this,!0),this}function i1(g){var A,I;if(g=ue(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?Al:Nl,g){case"year":A=I(this.year()+1,0,1)-1;break;case"quarter":A=I(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":A=I(this.year(),this.month()+1,1)-1;break;case"week":A=I(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":A=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":A=I(this.year(),this.month(),this.date()+1)-1;break;case"hour":A=this._d.valueOf(),A+=tu-Ft(A+(this._isUTC?0:this.utcOffset()*xo),tu)-1;break;case"minute":A=this._d.valueOf(),A+=xo-Ft(A,xo)-1;break;case"second":A=this._d.valueOf(),A+=ss-Ft(A,ss)-1;break}return this._d.setTime(A),r.updateOffset(this,!0),this}function ec(){return this._d.valueOf()-(this._offset||0)*6e4}function us(){return Math.floor(this.valueOf()/1e3)}function rc(){return new Date(this.valueOf())}function bo(){var g=this;return[g.year(),g.month(),g.date(),g.hour(),g.minute(),g.second(),g.millisecond()]}function fs(){var g=this;return{years:g.year(),months:g.month(),date:g.date(),hours:g.hours(),minutes:g.minutes(),seconds:g.seconds(),milliseconds:g.milliseconds()}}function cs(){return this.isValid()?this.toISOString():null}function nu(){return x(this)}function wo(){return m({},y(this))}function o1(){return y(this).overflow}function s1(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}$("N",0,0,"eraAbbr"),$("NN",0,0,"eraAbbr"),$("NNN",0,0,"eraAbbr"),$("NNNN",0,0,"eraName"),$("NNNNN",0,0,"eraNarrow"),$("y",["y",1],"yo","eraYear"),$("y",["yy",2],0,"eraYear"),$("y",["yyy",3],0,"eraYear"),$("y",["yyyy",4],0,"eraYear"),nr("N",qr),nr("NN",qr),nr("NNN",qr),nr("NNNN",l1),nr("NNNNN",m1),ot(["N","NN","NNN","NNNN","NNNNN"],function(g,A,I,U){var V=I._locale.erasParse(g,U,I._strict);V?y(I).era=V:y(I).invalidEra=g}),nr("y",Pt),nr("yy",Pt),nr("yyy",Pt),nr("yyyy",Pt),nr("yo",p1),ot(["y","yy","yyy","yyyy"],Gt),ot(["yo"],function(g,A,I,U){var V;I._locale._eraYearOrdinalRegex&&(V=g.match(I._locale._eraYearOrdinalRegex)),I._locale.eraYearOrdinalParse?A[Gt]=I._locale.eraYearOrdinalParse(g,V):A[Gt]=parseInt(g,10)});function u1(g,A){var I,U,V,se=this._eras||It("en")._eras;for(I=0,U=se.length;I=0)return se[U]}function c1(g,A){var I=g.since<=g.until?1:-1;return A===void 0?r(g.since).year():r(g.since).year()+(A-g.offset)*I}function au(){var g,A,I,U=this.localeData().eras();for(g=0,A=U.length;gse&&(A=se),x1.call(this,g,A,I,U,V))}function x1(g,A,I,U,V){var se=Vc(g,A,I,U,V),Fe=co(se.year,0,se.dayOfYear);return this.year(Fe.getUTCFullYear()),this.month(Fe.getUTCMonth()),this.date(Fe.getUTCDate()),this}$("Q",0,"Qo","quarter"),ne("quarter","Q"),Le("quarter",7),nr("Q",qe),ot("Q",function(g,A){A[Un]=(Ke(g)-1)*3});function b1(g){return g==null?Math.ceil((this.month()+1)/3):this.month((g-1)*3+this.month()%3)}$("D",["DD",2],"Do","date"),ne("date","D"),Le("date",9),nr("D",Q),nr("DD",Q,Te),nr("Do",function(g,A){return g?A._dayOfMonthOrdinalParse||A._ordinalParse:A._dayOfMonthOrdinalParseLenient}),ot(["D","DD"],Wn),ot("Do",function(g,A){A[Wn]=Ke(g.match(Q)[0])});var Tl=Pr("Date",!0);$("DDD",["DDDD",3],"DDDo","dayOfYear"),ne("dayOfYear","DDD"),Le("dayOfYear",4),nr("DDD",tr),nr("DDDD",Re),ot(["DDD","DDDD"],function(g,A,I){I._dayOfYear=Ke(g)});function Ja(g){var A=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return g==null?A:this.add(g-A,"d")}$("m",["mm",2],0,"minute"),ne("minute","m"),Le("minute",14),nr("m",Q),nr("mm",Q,Te),ot(["m","mm"],On);var w1=Pr("Minutes",!1);$("s",["ss",2],0,"second"),ne("second","s"),Le("second",15),nr("s",Q),nr("ss",Q,Te),ot(["s","ss"],aa);var D1=Pr("Seconds",!1);$("S",0,0,function(){return~~(this.millisecond()/100)}),$(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),$(0,["SSS",3],0,"millisecond"),$(0,["SSSS",4],0,function(){return this.millisecond()*10}),$(0,["SSSSS",5],0,function(){return this.millisecond()*100}),$(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),$(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),$(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),$(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),ne("millisecond","ms"),Le("millisecond",16),nr("S",tr,qe),nr("SS",tr,Te),nr("SSS",tr,Re);var bi,Fl;for(bi="SSSS";bi.length<=9;bi+="S")nr(bi,Pt);function S1(g,A){A[$a]=Ke(("0."+g)*1e3)}for(bi="S";bi.length<=9;bi+="S")ot(bi,S1);Fl=Pr("Milliseconds",!1),$("z",0,0,"zoneAbbr"),$("zz",0,0,"zoneName");function Ui(){return this._isUTC?"UTC":""}function N1(){return this._isUTC?"Coordinated Universal Time":""}var Ve=M.prototype;Ve.add=yo,Ve.calendar=e1,Ve.clone=r1,Ve.diff=wl,Ve.endOf=i1,Ve.format=js,Ve.from=t1,Ve.fromNow=n1,Ve.to=a1,Ve.toNow=eu,Ve.get=we,Ve.invalidAt=o1,Ve.isAfter=Xs,Ve.isBefore=xi,Ve.isBetween=Js,Ve.isSame=xl,Ve.isSameOrAfter=Ks,Ve.isSameOrBefore=bl,Ve.isValid=nu,Ve.lang=ru,Ve.locale=os,Ve.localeData=Sl,Ve.max=Lx,Ve.min=pl,Ve.parsingFlags=wo,Ve.set=Be,Ve.startOf=Ml,Ve.subtract=Zs,Ve.toArray=bo,Ve.toObject=fs,Ve.toDate=rc,Ve.toISOString=is,Ve.inspect=zi,typeof Symbol<"u"&&Symbol.for!=null&&(Ve[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ve.toJSON=cs,Ve.toString=Dl,Ve.unix=us,Ve.valueOf=ec,Ve.creationData=s1,Ve.eraName=au,Ve.eraNarrow=ls,Ve.eraAbbr=Cl,Ve.eraYear=Z,Ve.year=kf,Ve.isLeapYear=gx,Ve.weekYear=d1,Ve.isoWeekYear=h1,Ve.quarter=Ve.quarters=b1,Ve.month=Ga,Ve.daysInMonth=Ws,Ve.week=Ve.weeks=yx,Ve.isoWeek=Ve.isoWeeks=Xc,Ve.weeksInYear=Xa,Ve.weeksInWeekYear=y1,Ve.isoWeeksInYear=v1,Ve.isoWeeksInISOWeekYear=g1,Ve.date=Tl,Ve.day=Ve.days=Cx,Ve.weekday=Ex,Ve.isoWeekday=Tx,Ve.dayOfYear=Ja,Ve.hour=Ve.hours=Vt,Ve.minute=Ve.minutes=w1,Ve.second=Ve.seconds=D1,Ve.millisecond=Ve.milliseconds=Fl,Ve.utcOffset=Vx,Ve.utc=Qx,Ve.local=Xx,Ve.parseZone=Jx,Ve.hasAlignedHourOffset=yi,Ve.isDST=de,Ve.isLocal=Ne,Ve.isUtcOffset=ir,Ve.isUtc=Ar,Ve.isUTC=Ar,Ve.zoneAbbr=Ui,Ve.zoneName=N1,Ve.dates=_("dates accessor is deprecated. Use date instead.",Tl),Ve.months=_("months accessor is deprecated. Use month instead",Ga),Ve.years=_("years accessor is deprecated. Use year instead",kf),Ve.zone=_("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Zx),Ve.isDSTShifted=_("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",_e);function sa(g){return yt(g*1e3)}function A1(){return yt.apply(null,arguments).parseZone()}function _l(g){return g}var Jr=G.prototype;Jr.calendar=q,Jr.longDateFormat=ye,Jr.invalidDate=De,Jr.ordinal=Je,Jr.preparse=_l,Jr.postformat=_l,Jr.relativeTime=re,Jr.pastFuture=xe,Jr.set=k,Jr.eras=u1,Jr.erasParse=f1,Jr.erasConvertYear=c1,Jr.erasAbbrRegex=iu,Jr.erasNameRegex=Do,Jr.erasNarrowRegex=Hn,Jr.months=Ri,Jr.monthsShort=et,Jr.monthsParse=If,Jr.monthsRegex=vx,Jr.monthsShortRegex=Rf,Jr.week=Lf,Jr.firstDayOfYear=Qc,Jr.firstDayOfWeek=Zc,Jr.weekdays=Sx,Jr.weekdaysMin=zf,Jr.weekdaysShort=Nx,Jr.weekdaysParse=Mx,Jr.weekdaysRegex=xt,Jr.weekdaysShortRegex=gt,Jr.weekdaysMinRegex=Fx,Jr.isPM=nl,Jr.meridiem=Yf;function su(g,A,I,U){var V=It(),se=d().set(U,A);return V[I](se,g)}function Ol(g,A,I){if(c(g)&&(A=g,g=void 0),g=g||"",A!=null)return su(g,A,I,"month");var U,V=[];for(U=0;U<12;U++)V[U]=su(g,U,I,"month");return V}function uu(g,A,I,U){typeof g=="boolean"?(c(A)&&(I=A,A=void 0),A=A||""):(A=g,I=A,g=!1,c(A)&&(I=A,A=void 0),A=A||"");var V=It(),se=g?V._week.dow:0,Fe,dr=[];if(I!=null)return su(A,(I+se)%7,U,"day");for(Fe=0;Fe<7;Fe++)dr[Fe]=su(A,(Fe+se)%7,U,"day");return dr}function Bl(g,A){return Ol(g,A,"months")}function M1(g,A){return Ol(g,A,"monthsShort")}function C1(g,A,I){return uu(g,A,I,"weekdays")}function tc(g,A,I){return uu(g,A,I,"weekdaysShort")}function ms(g,A,I){return uu(g,A,I,"weekdaysMin")}Va("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\\d{1,2}(th|st|nd|rd)/,ordinal:function(g){var A=g%10,I=Ke(g%100/10)===1?"th":A===1?"st":A===2?"nd":A===3?"rd":"th";return g+I}}),r.lang=_("moment.lang is deprecated. Use moment.locale instead.",Va),r.langData=_("moment.langData is deprecated. Use moment.localeData instead.",It);var $n=Math.abs;function E1(){var g=this._data;return this._milliseconds=$n(this._milliseconds),this._days=$n(this._days),this._months=$n(this._months),g.milliseconds=$n(g.milliseconds),g.seconds=$n(g.seconds),g.minutes=$n(g.minutes),g.hours=$n(g.hours),g.months=$n(g.months),g.years=$n(g.years),this}function nc(g,A,I,U){var V=zr(A,I);return g._milliseconds+=U*V._milliseconds,g._days+=U*V._days,g._months+=U*V._months,g._bubble()}function T1(g,A){return nc(this,g,A,1)}function Ka(g,A){return nc(this,g,A,-1)}function fu(g){return g<0?Math.floor(g):Math.ceil(g)}function Wi(){var g=this._milliseconds,A=this._days,I=this._months,U=this._data,V,se,Fe,dr,_r;return g>=0&&A>=0&&I>=0||g<=0&&A<=0&&I<=0||(g+=fu(ac(I)+A)*864e5,A=0,I=0),U.milliseconds=g%1e3,V=or(g/1e3),U.seconds=V%60,se=or(V/60),U.minutes=se%60,Fe=or(se/60),U.hours=Fe%24,A+=or(Fe/24),_r=or(Pn(A)),I+=_r,A-=fu(ac(_r)),dr=or(I/12),I%=12,U.days=A,U.months=I,U.years=dr,this}function Pn(g){return g*4800/146097}function ac(g){return g*146097/4800}function Pl(g){if(!this.isValid())return NaN;var A,I,U=this._milliseconds;if(g=ue(g),g==="month"||g==="quarter"||g==="year")switch(A=this._days+U/864e5,I=this._months+Pn(A),g){case"month":return I;case"quarter":return I/3;case"year":return I/12}else switch(A=this._days+Math.round(ac(this._months)),g){case"week":return A/7+U/6048e5;case"day":return A+U/864e5;case"hour":return A*24+U/36e5;case"minute":return A*1440+U/6e4;case"second":return A*86400+U/1e3;case"millisecond":return Math.floor(A*864e5)+U;default:throw new Error("Unknown unit "+g)}}function Il(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Ke(this._months/12)*31536e6:NaN}function In(g){return function(){return this.as(g)}}var wi=In("ms"),Rl=In("s"),F1=In("m"),cu=In("h"),_1=In("d"),ql=In("w"),Jt=In("M"),ic=In("Q"),kl=In("y");function Na(){return zr(this)}function oc(g){return g=ue(g),this.isValid()?this[g+"s"]():NaN}function Aa(g){return function(){return this.isValid()?this._data[g]:NaN}}var Yi=Aa("milliseconds"),Ll=Aa("seconds"),dn=Aa("minutes"),sc=Aa("hours"),O1=Aa("days"),B1=Aa("months"),P1=Aa("years");function uc(){return or(this.days()/7)}var ja=Math.round,Ma={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function zl(g,A,I,U,V){return V.relativeTime(A||1,!!I,g,U)}function I1(g,A,I,U){var V=zr(g).abs(),se=ja(V.as("s")),Fe=ja(V.as("m")),dr=ja(V.as("h")),_r=ja(V.as("d")),tt=ja(V.as("M")),hn=ja(V.as("w")),Ca=ja(V.as("y")),ei=se<=I.ss&&["s",se]||se0,ei[4]=U,zl.apply(null,ei)}function R1(g){return g===void 0?ja:typeof g=="function"?(ja=g,!0):!1}function ps(g,A){return Ma[g]===void 0?!1:A===void 0?Ma[g]:(Ma[g]=A,g==="s"&&(Ma.ss=A-1),!0)}function q1(g,A){if(!this.isValid())return this.localeData().invalidDate();var I=!1,U=Ma,V,se;return typeof g=="object"&&(A=g,g=!1),typeof g=="boolean"&&(I=g),typeof A=="object"&&(U=Object.assign({},Ma,A),A.s!=null&&A.ss==null&&(U.ss=A.s-1)),V=this.localeData(),se=I1(this,!I,U,V),I&&(se=V.pastFuture(+this,se)),V.postformat(se)}var fc=Math.abs;function Di(g){return(g>0)-(g<0)||+g}function ds(){if(!this.isValid())return this.localeData().invalidDate();var g=fc(this._milliseconds)/1e3,A=fc(this._days),I=fc(this._months),U,V,se,Fe,dr=this.asSeconds(),_r,tt,hn,Ca;return dr?(U=or(g/60),V=or(U/60),g%=60,U%=60,se=or(I/12),I%=12,Fe=g?g.toFixed(3).replace(/\\.?0+$/,""):"",_r=dr<0?"-":"",tt=Di(this._months)!==Di(dr)?"-":"",hn=Di(this._days)!==Di(dr)?"-":"",Ca=Di(this._milliseconds)!==Di(dr)?"-":"",_r+"P"+(se?tt+se+"Y":"")+(I?tt+I+"M":"")+(A?hn+A+"D":"")+(V||U||g?"T":"")+(V?Ca+V+"H":"")+(U?Ca+U+"M":"")+(g?Ca+Fe+"S":"")):"P0D"}var Vr=ts.prototype;Vr.isValid=Hx,Vr.abs=E1,Vr.add=T1,Vr.subtract=Ka,Vr.as=Pl,Vr.asMilliseconds=wi,Vr.asSeconds=Rl,Vr.asMinutes=F1,Vr.asHours=cu,Vr.asDays=_1,Vr.asWeeks=ql,Vr.asMonths=Jt,Vr.asQuarters=ic,Vr.asYears=kl,Vr.valueOf=Il,Vr._bubble=Wi,Vr.clone=Na,Vr.get=oc,Vr.milliseconds=Yi,Vr.seconds=Ll,Vr.minutes=dn,Vr.hours=sc,Vr.days=O1,Vr.weeks=uc,Vr.months=B1,Vr.years=P1,Vr.humanize=q1,Vr.toISOString=ds,Vr.toString=ds,Vr.toJSON=ds,Vr.locale=os,Vr.localeData=Sl,Vr.toIsoString=_("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ds),Vr.lang=ru,$("X",0,0,"unix"),$("x",0,0,"valueOf"),nr("x",Xt),nr("X",Ef),ot("X",function(g,A,I){I._d=new Date(parseFloat(g)*1e3)}),ot("x",function(g,A,I){I._d=new Date(Ke(g))});return r.version="2.29.4",t(yt),r.fn=Ve,r.min=zx,r.max=Ux,r.now=Wx,r.utc=d,r.unix=sa,r.months=Bl,r.isDate=o,r.locale=Va,r.invalid=w,r.duration=zr,r.isMoment=S,r.weekdays=C1,r.parseZone=A1,r.localeData=It,r.isDuration=oa,r.monthsShort=M1,r.weekdaysMin=ms,r.defineLocale=pn,r.updateLocale=Bx,r.locales=Px,r.weekdaysShort=tc,r.normalizeUnits=ue,r.relativeTimeRounding=R1,r.relativeTimeThreshold=ps,r.calendarFormat=jx,r.prototype=Ve,r.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},r})});function _a(e){return _a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_a(e)}function Sn(e){if(e===null||e===!0||e===!1)return NaN;var r=Number(e);return isNaN(r)?r:r<0?Math.ceil(r):Math.floor(r)}function nt(e,r){if(r.length1?"s":"")+" required, but only "+r.length+" present")}function Yt(e){nt(1,arguments);var r=Object.prototype.toString.call(e);return e instanceof Date||_a(e)==="object"&&r==="[object Date]"?new Date(e.getTime()):typeof e=="number"||r==="[object Number]"?new Date(e):((typeof e=="string"||r==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use \`parseISO\` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function bb(e,r){nt(2,arguments);var t=Yt(e).getTime(),n=Sn(r);return new Date(t+n)}var Fq={};function Co(){return Fq}function wb(e){var r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),e.getTime()-r.getTime()}var _q=365.2425,Oq=Math.pow(10,8)*24*60*60*1e3,Db=6e4,Sb=36e5;var tQ=-Oq;var Bq=3600;var sA=Bq*24,nQ=sA*7,Pq=sA*_q,Iq=Pq/12,aQ=Iq*3;function Nb(e){return nt(1,arguments),e instanceof Date||_a(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Ab(e){if(nt(1,arguments),!Nb(e)&&typeof e!="number")return!1;var r=Yt(e);return!isNaN(Number(r))}function Mb(e,r){nt(2,arguments);var t=Sn(r);return bb(e,-t)}var Rq=864e5;function Cb(e){nt(1,arguments);var r=Yt(e),t=r.getTime();r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0);var n=r.getTime(),a=t-n;return Math.floor(a/Rq)+1}function Eo(e){nt(1,arguments);var r=1,t=Yt(e),n=t.getUTCDay(),a=(n=a.getTime()?t+1:r.getTime()>=u.getTime()?t:t-1}function Eb(e){nt(1,arguments);var r=hc(e),t=new Date(0);t.setUTCFullYear(r,0,4),t.setUTCHours(0,0,0,0);var n=Eo(t);return n}var qq=6048e5;function Tb(e){nt(1,arguments);var r=Yt(e),t=Eo(r).getTime()-Eb(r).getTime();return Math.round(t/qq)+1}function To(e,r){var t,n,a,i,u,l,c,o;nt(1,arguments);var s=Co(),m=Sn((t=(n=(a=(i=r?.weekStartsOn)!==null&&i!==void 0?i:r==null||(u=r.locale)===null||u===void 0||(l=u.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&a!==void 0?a:s.weekStartsOn)!==null&&n!==void 0?n:(c=s.locale)===null||c===void 0||(o=c.options)===null||o===void 0?void 0:o.weekStartsOn)!==null&&t!==void 0?t:0);if(!(m>=0&&m<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Yt(e),h=d.getUTCDay(),y=(h=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=new Date(0);y.setUTCFullYear(m+1,0,h),y.setUTCHours(0,0,0,0);var v=To(y,r),x=new Date(0);x.setUTCFullYear(m,0,h),x.setUTCHours(0,0,0,0);var w=To(x,r);return s.getTime()>=v.getTime()?m+1:s.getTime()>=w.getTime()?m:m-1}function Fb(e,r){var t,n,a,i,u,l,c,o;nt(1,arguments);var s=Co(),m=Sn((t=(n=(a=(i=r?.firstWeekContainsDate)!==null&&i!==void 0?i:r==null||(u=r.locale)===null||u===void 0||(l=u.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&a!==void 0?a:s.firstWeekContainsDate)!==null&&n!==void 0?n:(c=s.locale)===null||c===void 0||(o=c.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&t!==void 0?t:1),d=vc(e,r),h=new Date(0);h.setUTCFullYear(d,0,m),h.setUTCHours(0,0,0,0);var y=To(h,r);return y}var kq=6048e5;function _b(e,r){nt(1,arguments);var t=Yt(e),n=To(t,r).getTime()-Fb(t,r).getTime();return Math.round(n/kq)+1}function st(e,r){for(var t=e<0?"-":"",n=Math.abs(e).toString();n.length0?n:1-n;return st(t==="yy"?a%100:a,t.length)},M:function(r,t){var n=r.getUTCMonth();return t==="M"?String(n+1):st(n+1,2)},d:function(r,t){return st(r.getUTCDate(),t.length)},a:function(r,t){var n=r.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h:function(r,t){return st(r.getUTCHours()%12||12,t.length)},H:function(r,t){return st(r.getUTCHours(),t.length)},m:function(r,t){return st(r.getUTCMinutes(),t.length)},s:function(r,t){return st(r.getUTCSeconds(),t.length)},S:function(r,t){var n=t.length,a=r.getUTCMilliseconds(),i=Math.floor(a*Math.pow(10,n-3));return st(i,t.length)}},Xi=Lq;var vu={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},zq={G:function(r,t,n){var a=r.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(r,t,n){if(t==="yo"){var a=r.getUTCFullYear(),i=a>0?a:1-a;return n.ordinalNumber(i,{unit:"year"})}return Xi.y(r,t)},Y:function(r,t,n,a){var i=vc(r,a),u=i>0?i:1-i;if(t==="YY"){var l=u%100;return st(l,2)}return t==="Yo"?n.ordinalNumber(u,{unit:"year"}):st(u,t.length)},R:function(r,t){var n=hc(r);return st(n,t.length)},u:function(r,t){var n=r.getUTCFullYear();return st(n,t.length)},Q:function(r,t,n){var a=Math.ceil((r.getUTCMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return st(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,t,n){var a=Math.ceil((r.getUTCMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return st(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,t,n){var a=r.getUTCMonth();switch(t){case"M":case"MM":return Xi.M(r,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(r,t,n){var a=r.getUTCMonth();switch(t){case"L":return String(a+1);case"LL":return st(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(r,t,n,a){var i=_b(r,a);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):st(i,t.length)},I:function(r,t,n){var a=Tb(r);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):st(a,t.length)},d:function(r,t,n){return t==="do"?n.ordinalNumber(r.getUTCDate(),{unit:"date"}):Xi.d(r,t)},D:function(r,t,n){var a=Cb(r);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):st(a,t.length)},E:function(r,t,n){var a=r.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});case"EEEE":default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(r,t,n,a){var i=r.getUTCDay(),u=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(u);case"ee":return st(u,2);case"eo":return n.ordinalNumber(u,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(r,t,n,a){var i=r.getUTCDay(),u=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(u);case"cc":return st(u,t.length);case"co":return n.ordinalNumber(u,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(r,t,n){var a=r.getUTCDay(),i=a===0?7:a;switch(t){case"i":return String(i);case"ii":return st(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(r,t,n){var a=r.getUTCHours(),i=a/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,t,n){var a=r.getUTCHours(),i;switch(a===12?i=vu.noon:a===0?i=vu.midnight:i=a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,t,n){var a=r.getUTCHours(),i;switch(a>=17?i=vu.evening:a>=12?i=vu.afternoon:a>=4?i=vu.morning:i=vu.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,t,n){if(t==="ho"){var a=r.getUTCHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return Xi.h(r,t)},H:function(r,t,n){return t==="Ho"?n.ordinalNumber(r.getUTCHours(),{unit:"hour"}):Xi.H(r,t)},K:function(r,t,n){var a=r.getUTCHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):st(a,t.length)},k:function(r,t,n){var a=r.getUTCHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):st(a,t.length)},m:function(r,t,n){return t==="mo"?n.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):Xi.m(r,t)},s:function(r,t,n){return t==="so"?n.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):Xi.s(r,t)},S:function(r,t){return Xi.S(r,t)},X:function(r,t,n,a){var i=a._originalDate||r,u=i.getTimezoneOffset();if(u===0)return"Z";switch(t){case"X":return fA(u);case"XXXX":case"XX":return ys(u);case"XXXXX":case"XXX":default:return ys(u,":")}},x:function(r,t,n,a){var i=a._originalDate||r,u=i.getTimezoneOffset();switch(t){case"x":return fA(u);case"xxxx":case"xx":return ys(u);case"xxxxx":case"xxx":default:return ys(u,":")}},O:function(r,t,n,a){var i=a._originalDate||r,u=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+uA(u,":");case"OOOO":default:return"GMT"+ys(u,":")}},z:function(r,t,n,a){var i=a._originalDate||r,u=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+uA(u,":");case"zzzz":default:return"GMT"+ys(u,":")}},t:function(r,t,n,a){var i=a._originalDate||r,u=Math.floor(i.getTime()/1e3);return st(u,t.length)},T:function(r,t,n,a){var i=a._originalDate||r,u=i.getTime();return st(u,t.length)}};function uA(e,r){var t=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),i=n%60;if(i===0)return t+String(a);var u=r||"";return t+String(a)+u+st(i,2)}function fA(e,r){if(e%60===0){var t=e>0?"-":"+";return t+st(Math.abs(e)/60,2)}return ys(e,r)}function ys(e,r){var t=r||"",n=e>0?"-":"+",a=Math.abs(e),i=st(Math.floor(a/60),2),u=st(a%60,2);return n+i+t+u}var cA=zq;var lA=function(r,t){switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},mA=function(r,t){switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Uq=function(r,t){var n=r.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return lA(r,t);var u;switch(a){case"P":u=t.dateTime({width:"short"});break;case"PP":u=t.dateTime({width:"medium"});break;case"PPP":u=t.dateTime({width:"long"});break;case"PPPP":default:u=t.dateTime({width:"full"});break}return u.replace("{{date}}",lA(a,t)).replace("{{time}}",mA(i,t))},Wq={p:mA,P:Uq},pA=Wq;var Yq=["D","DD"],Hq=["YY","YYYY"];function dA(e){return Yq.indexOf(e)!==-1}function hA(e){return Hq.indexOf(e)!==-1}function Ob(e,r,t){if(e==="YYYY")throw new RangeError("Use \`yyyy\` instead of \`YYYY\` (in \`".concat(r,"\`) for formatting years to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use \`yy\` instead of \`YY\` (in \`".concat(r,"\`) for formatting years to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use \`d\` instead of \`D\` (in \`".concat(r,"\`) for formatting days of the month to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use \`dd\` instead of \`DD\` (in \`".concat(r,"\`) for formatting days of the month to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var $q={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Gq=function(r,t,n){var a,i=$q[r];return typeof i=="string"?a=i:t===1?a=i.one:a=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},vA=Gq;function gc(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=r.width?String(r.width):e.defaultWidth,n=e.formats[t]||e.formats[e.defaultWidth];return n}}var Vq={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Zq={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Qq={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xq={date:gc({formats:Vq,defaultWidth:"full"}),time:gc({formats:Zq,defaultWidth:"full"}),dateTime:gc({formats:Qq,defaultWidth:"full"})},gA=Xq;var Jq={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Kq=function(r,t,n,a){return Jq[r]},yA=Kq;function xs(e){return function(r,t){var n=t!=null&&t.context?String(t.context):"standalone",a;if(n==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,u=t!=null&&t.width?String(t.width):i;a=e.formattingValues[u]||e.formattingValues[i]}else{var l=e.defaultWidth,c=t!=null&&t.width?String(t.width):e.defaultWidth;a=e.values[c]||e.values[l]}var o=e.argumentCallback?e.argumentCallback(r):r;return a[o]}}var jq={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ek={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},rk={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},tk={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},nk={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},ak={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ik=function(r,t){var n=Number(r),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},ok={ordinalNumber:ik,era:xs({values:jq,defaultWidth:"wide"}),quarter:xs({values:ek,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:xs({values:rk,defaultWidth:"wide"}),day:xs({values:tk,defaultWidth:"wide"}),dayPeriod:xs({values:nk,defaultWidth:"wide",formattingValues:ak,defaultFormattingWidth:"wide"})},xA=ok;function bs(e){return function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=r.match(a);if(!i)return null;var u=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?uk(l,function(m){return m.test(u)}):sk(l,function(m){return m.test(u)}),o;o=e.valueCallback?e.valueCallback(c):c,o=t.valueCallback?t.valueCallback(o):o;var s=r.slice(u.length);return{value:o,rest:s}}}function sk(e,r){for(var t in e)if(e.hasOwnProperty(t)&&r(e[t]))return t}function uk(e,r){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},n=r.match(e.matchPattern);if(!n)return null;var a=n[0],i=r.match(e.parsePattern);if(!i)return null;var u=e.valueCallback?e.valueCallback(i[0]):i[0];u=t.valueCallback?t.valueCallback(u):u;var l=r.slice(a.length);return{value:u,rest:l}}}var fk=/^(\\d+)(th|st|nd|rd)?/i,ck=/\\d+/i,lk={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},mk={any:[/^b/i,/^(a|c)/i]},pk={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},dk={any:[/1/i,/2/i,/3/i,/4/i]},hk={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},vk={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},gk={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},yk={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},xk={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},bk={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},wk={ordinalNumber:Bb({matchPattern:fk,parsePattern:ck,valueCallback:function(r){return parseInt(r,10)}}),era:bs({matchPatterns:lk,defaultMatchWidth:"wide",parsePatterns:mk,defaultParseWidth:"any"}),quarter:bs({matchPatterns:pk,defaultMatchWidth:"wide",parsePatterns:dk,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:bs({matchPatterns:hk,defaultMatchWidth:"wide",parsePatterns:vk,defaultParseWidth:"any"}),day:bs({matchPatterns:gk,defaultMatchWidth:"wide",parsePatterns:yk,defaultParseWidth:"any"}),dayPeriod:bs({matchPatterns:xk,defaultMatchWidth:"any",parsePatterns:bk,defaultParseWidth:"any"})},bA=wk;var Dk={code:"en-US",formatDistance:vA,formatLong:gA,formatRelative:yA,localize:xA,match:bA,options:{weekStartsOn:0,firstWeekContainsDate:1}},wA=Dk;var DA=wA;var Sk=/[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g,Nk=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ak=/^'([^]*?)'?$/,Mk=/''/g,Ck=/[a-zA-Z]/;function Ai(e,r,t){var n,a,i,u,l,c,o,s,m,d,h,y,v,x,w,C,b,N;nt(2,arguments);var M=String(r),S=Co(),O=(n=(a=t?.locale)!==null&&a!==void 0?a:S.locale)!==null&&n!==void 0?n:DA,_=Sn((i=(u=(l=(c=t?.firstWeekContainsDate)!==null&&c!==void 0?c:t==null||(o=t.locale)===null||o===void 0||(s=o.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&l!==void 0?l:S.firstWeekContainsDate)!==null&&u!==void 0?u:(m=S.locale)===null||m===void 0||(d=m.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(_>=1&&_<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var E=Sn((h=(y=(v=(x=t?.weekStartsOn)!==null&&x!==void 0?x:t==null||(w=t.locale)===null||w===void 0||(C=w.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&v!==void 0?v:S.weekStartsOn)!==null&&y!==void 0?y:(b=S.locale)===null||b===void 0||(N=b.options)===null||N===void 0?void 0:N.weekStartsOn)!==null&&h!==void 0?h:0);if(!(E>=0&&E<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!O.localize)throw new RangeError("locale must contain localize property");if(!O.formatLong)throw new RangeError("locale must contain formatLong property");var T=Yt(e);if(!Ab(T))throw new RangeError("Invalid time value");var R=wb(T),k=Mb(T,R),W={firstWeekContainsDate:_,weekStartsOn:E,locale:O,_originalDate:T},G=M.match(Nk).map(function(H){var L=H[0];if(L==="p"||L==="P"){var q=pA[L];return q(H,O.formatLong)}return H}).join("").match(Sk).map(function(H){if(H==="''")return"'";var L=H[0];if(L==="'")return Ek(H);var q=cA[L];if(q)return!(t!=null&&t.useAdditionalWeekYearTokens)&&hA(H)&&Ob(H,r,String(e)),!(t!=null&&t.useAdditionalDayOfYearTokens)&&dA(H)&&Ob(H,r,String(e)),q(k,H,O.localize,W);if(L.match(Ck))throw new RangeError("Format string contains an unescaped latin alphabet character \`"+L+"\`");return H}).join("");return G}function Ek(e){var r=e.match(Ak);return r?r[1].replace(Mk,"'"):e}function Pb(e,r){if(_a(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(_a(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Ib(e){var r=Pb(e,"string");return _a(r)=="symbol"?r:r+""}function Hr(e,r,t){return r=Ib(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function om(e,r){var t;nt(1,arguments);var n=Sn((t=r?.additionalDigits)!==null&&t!==void 0?t:2);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var a=Ok(e),i;if(a.date){var u=Bk(a.date,n);i=Pk(u.restDateString,u.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var l=i.getTime(),c=0,o;if(a.time&&(c=Ik(a.time),isNaN(c)))return new Date(NaN);if(a.timezone){if(o=Rk(a.timezone),isNaN(o))return new Date(NaN)}else{var s=new Date(l+c),m=new Date(0);return m.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),m.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),m}return new Date(l+c+o)}var im={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Tk=/^-?(?:(\\d{3})|(\\d{2})(?:-?(\\d{2}))?|W(\\d{2})(?:-?(\\d{1}))?|)$/,Fk=/^(\\d{2}(?:[.,]\\d*)?)(?::?(\\d{2}(?:[.,]\\d*)?))?(?::?(\\d{2}(?:[.,]\\d*)?))?$/,_k=/^([+-])(\\d{2})(?::?(\\d{2}))?$/;function Ok(e){var r={},t=e.split(im.dateTimeDelimiter),n;if(t.length>2)return r;if(/:/.test(t[0])?n=t[0]:(r.date=t[0],n=t[1],im.timeZoneDelimiter.test(r.date)&&(r.date=e.split(im.timeZoneDelimiter)[0],n=e.substr(r.date.length,e.length))),n){var a=im.timezone.exec(n);a?(r.time=n.replace(a[1],""),r.timezone=a[1]):r.time=n}return r}function Bk(e,r){var t=new RegExp("^(?:(\\\\d{4}|[+-]\\\\d{"+(4+r)+"})|(\\\\d{2}|[+-]\\\\d{"+(2+r)+"})$)"),n=e.match(t);if(!n)return{year:NaN,restDateString:""};var a=n[1]?parseInt(n[1]):null,i=n[2]?parseInt(n[2]):null;return{year:i===null?a:i*100,restDateString:e.slice((n[1]||n[2]).length)}}function Pk(e,r){if(r===null)return new Date(NaN);var t=e.match(Tk);if(!t)return new Date(NaN);var n=!!t[4],a=yc(t[1]),i=yc(t[2])-1,u=yc(t[3]),l=yc(t[4]),c=yc(t[5])-1;if(n)return Uk(r,l,c)?qk(r,l,c):new Date(NaN);var o=new Date(0);return!Lk(r,i,u)||!zk(r,a)?new Date(NaN):(o.setUTCFullYear(r,i,Math.max(a,u)),o)}function yc(e){return e?parseInt(e):1}function Ik(e){var r=e.match(Fk);if(!r)return NaN;var t=Rb(r[1]),n=Rb(r[2]),a=Rb(r[3]);return Wk(t,n,a)?t*Sb+n*Db+a*1e3:NaN}function Rb(e){return e&&parseFloat(e.replace(",","."))||0}function Rk(e){if(e==="Z")return 0;var r=e.match(_k);if(!r)return 0;var t=r[1]==="+"?-1:1,n=parseInt(r[2]),a=r[3]&&parseInt(r[3])||0;return Yk(n,a)?t*(n*Sb+a*Db):NaN}function qk(e,r,t){var n=new Date(0);n.setUTCFullYear(e,0,4);var a=n.getUTCDay()||7,i=(r-1)*7+t+1-a;return n.setUTCDate(n.getUTCDate()+i),n}var kk=[31,null,31,30,31,30,31,31,30,31,30,31];function SA(e){return e%400===0||e%4===0&&e%100!==0}function Lk(e,r,t){return r>=0&&r<=11&&t>=1&&t<=(kk[r]||(SA(e)?29:28))}function zk(e,r){return r>=1&&r<=(SA(e)?366:365)}function Uk(e,r,t){return r>=1&&r<=53&&t>=0&&t<=6}function Wk(e,r,t){return e===24?r===0&&t===0:t>=0&&t<60&&r>=0&&r<60&&e>=0&&e<25}function Yk(e,r){return r>=0&&r<=59}var pa=e=>[...new Set(e)];var NA=(e,r)=>e.sort(function(t,n){let a=r.indexOf(t),i=r.indexOf(n);return a>i?a!=-1&&i==-1?-1:1:i!=-1&&a==-1?1:-1});var Xn="File";var sm=e=>e.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?AA(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e;function um(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}var MA=(e,r)=>r.indexOf(e)>0?r.indexOf(e):r.length;var xc=e=>"spaces://"+e;var AA=e=>e.charAt(0)=="/"?e.substring(1):e;var qb=(e,r)=>{if(e instanceof Date)return"date";if(typeof e=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(e)||e.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(e))return"date";if(r=="tag"||r=="tags")return"tags-multi";if(/\\[\\[.*?\\]\\]/.test(e))return"link"}else{if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e)if(Array.isArray(e)||typeof e=="string"&&e.indexOf(",")>-1){let t=Array.isArray(e)?e:[];if(typeof e=="string"&&e.indexOf(",")>-1&&(t=gn(e)),r=="tag"||r=="tags")return"tags-multi";if(t.length==1&&Array.isArray(t[0])&&t[0].length==1&&typeof t[0][0]=="string")return"link";let n=pa(t.map(a=>qb(a,r)));return n.length==1&&n[0]=="link"?"link-multi":n.some(a=>a=="object")?"object-multi":"option-multi"}else return e.isLuxonDateTime?"date":e.isLuxonDuration?"duration":e.type=="file"?"link":typeof e=="object"&&!Array.isArray(e)&&e!==null?"object":"unknown";else return"unknown"}return"text"};var kb=(e,r,t)=>e=="object"||e=="object-multi"?JSON.parse(r):e=="number"?parseFloat(r):e=="boolean"?r=="true":e.includes("-multi")?gn(r).map(n=>kb(e.replace("-multi",""),n,t)):(e.includes("link")||e.includes("context"))&&t?\`[[\${r}]]\`:r;var CA=e=>e.map(r=>r.replace(",","\\\\,")).join(", "),ws=e=>JSON.stringify(e);var gn=e=>e?.startsWith("[")?um(bc(e)):Hk(e),Hk=e=>(e?.replace("\\\\,",",")?.match(/(\\\\.|[^,])+/g)??[]).map(r=>r.trim()),Ds=(e,r)=>{switch(qb(r,e)){case"tags-multi":return r;case"object":case"object-multi":return JSON.stringify(r);case"number":return r.toString();case"boolean":return r?"true":"false";case"date":{if(r instanceof Date){let n=Ai(r,"yyyy-MM-dd");return typeof n=="string"?n:""}return typeof r!="string"?"":r}break;case"duration":return CA(Object.keys(r.values).reduce((n,a)=>[...n,...r.values[a]>0?[r.values[a]+" "+a]:[]],[]));case"option-multi":case"link-multi":return typeof r=="string"?wc(r):ws(r.map(n=>n?typeof n=="string"?wc(n):n.path?n.path:Array.isArray(r)&&n.length==1&&Array.isArray(n[0])&&n[0].length==1&&typeof n[0][0]=="string"?n[0][0]:JSON.stringify(n):""));case"link":return Array.isArray(r)&&r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string"?r[0][0]:typeof r=="string"?wc(r):r.path;case"text":case"tag":case"image":return r}return""};var bc=e=>{let r;try{r=JSON.parse(e)}catch{}return r};var wc=e=>{if(!e)return"";let r=/\\[\\[(.*?)\\]\\]/g.exec(e),t=r?.length>1?r[1].substring(0,MA("|",r[1])):e;return t||e};var yu=ma(fm());var Lb=e=>(0,yu.isNumber)(e)?new Date(e):(0,yu.isString)(e)?om(e):(0,yu.isDate)(e)?e:new Date;var EA=(e,r,t)=>{let n=e[0];if(!n.isSymbolNode||e.length!==3)return"";let a=n.name,i=e[1];return r.evaluate(\`\${a} = \${i.toString()}\`,t),e[2].compile().evaluate(t)};EA.rawArgs=!0;var TA=(e,r,t)=>{if(e.length%2!==1)return"";for(let a=0;a{if(e.length!==1)return"";let n=e.map(function(i){return i.compile().evaluate(t)});return t.get("$paths").get(n[0])};FA.rawArgs=!0;var _A=(e,r,t)=>t?.get("$current");_A.rawArgs=!0;var OA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.find(a=>{t.set("$current",a),r.evaluate("current = _current()",t);let i=e[1].compile().evaluate?e[1].compile().evaluate(t):e[1];return a===i})??"":""};OA.rawArgs=!0;var BA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.findIndex(a=>{t.set("$current",a),r.evaluate("current = _current()",t);let i=e[1].compile().evaluate?e[1].compile().evaluate(t):e[1];return a===i}):""};BA.rawArgs=!0;var PA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.filter(a=>(t.set("$current",a),r.evaluate("current = _current()",t),e[1].compile().evaluate(t))):""};PA.rawArgs=!0;var IA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.map(a=>(t.set("$current",a),r.evaluate("current = _current()",t),e[1].compile().evaluate(t))):""};IA.rawArgs=!0;var RA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.some(a=>(t.set("$current",a),r.evaluate("current = _current()",t),e[1].compile().evaluate(t))):""};RA.rawArgs=!0;var qA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.every(a=>(t.set("$current",a),r.evaluate("current = _current()",t),e[1].compile().evaluate(t))):""};qA.rawArgs=!0;var kA=(e,r,t)=>{if(e.length!==1)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.flat():""};kA.rawArgs=!0;var LA=(e,r,t)=>{if(e.length!==1)return"";let n=e.map(function(u){return u.compile().evaluate(t)}),a=t.get("$properties")?.[n[0]]?.type,i=kb(a,t.get(n[0]));return(a=="file"||a=="link"||a=="context")&&(a.includes("multi")?i=gn(i).map(u=>t.get("$paths").get(u)??u):i=t.get("$paths").get(i)??i),a=="date"&&(i=Lb(i)),i??""};LA.rawArgs=!0;var zA=(e,r,t)=>{if((e.length-1)%2!==0)return"";for(let n=0;n{if(e.length<1||e.length>2)return"";let n=e[0].compile().evaluate(t);n instanceof Date||(n=new Date(n));let a=e[1]?.compile().evaluate(t);return a?.length>0?Ai(n,a):Ai(n,t.get("$settings")?.dateFormat??"yyyy-MM-dd")};UA.rawArgs=!0;var kn=e=>typeof e=="string"||e instanceof String?e:e instanceof Date?Ai(e,"yyyy-MM-dd"):typeof e=="number"?e.toFixed(0):e?.path?e.path:"",zb={prop:LA,_current:_A,slice:(e,r,t)=>(e=kn(e),e.slice(r,t)),if:(e,r,t)=>e===!0?r:t,ifs:zA,empty:e=>e.length!==1?"":Array.isArray(e[0])?e[0].length===0:e[0]===""?"true":"false",length:e=>e.length,values:e=>e.flat().length,uniques:e=>pa(e.flat()).length,substring:(e,r,t)=>(e=kn(e),t?e.substring(r,t):e.substring(r)),startsWith:(e,r)=>(e=kn(e),r=kn(r),e.startsWith(r)),contains:(e,r)=>(e=kn(e),r=kn(r),e.includes(r)),test:(e,r)=>(e=kn(e),new RegExp(r).test(e)),match:(e,r)=>(e=kn(e),e.match(new RegExp(r))),replace:(e,r,t)=>(e=kn(e),e.replace(new RegExp(r),t)),replaceAll:(e,r,t)=>(e=kn(e),r=kn(r),t=kn(t),e.replace(new RegExp(r,"g"),t)),lower:e=>(e=kn(e),e.toLowerCase()),upper:e=>(e=kn(e),e.toUpperCase()),repeat:(e,r)=>e.repeat(r),format:kn,toNumber:e=>e instanceof Date?e.getTime():typeof e=="string"?parseFloat(e):e,now:()=>new Date,minute:e=>e.getMinutes(),hour:e=>e.getHours(),day:e=>e.getDay(),date:e=>e.getDate(),week:e=>Ai(e,"w"),month:e=>e.getMonth()+1,year:e=>e.getFullYear(),pad:(e,r,t)=>e.padStart(r,t),range:e=>Math.max(...e)-Math.min(...e),latest:e=>new Date(Math.max(...e.map(r=>r.getTime()))),earliest:e=>new Date(Math.min(...e.map(r=>r.getTime()))),dateRange:(e,r)=>{let t=Math.abs(Math.max(...e.map(n=>n.getTime()))-Math.min(...e.map(n=>n.getTime())));return r==="days"?t/(1e3*60*60*24):r==="months"?t/(1e3*60*60*24*30):r==="years"?t/(1e3*60*60*24*365):r==="hours"?t/(1e3*60*60):r==="minutes"?t/(1e3*60):r==="seconds"?t/1e3:r==="weeks"?t/(1e3*60*60*24*7):r==="quarters"?t/(1e3*60*60*24*30*3):t/(1e3*60*60*24)},dateAdd:(e,r,t)=>(t==="days"&&e.setDate(e.getDate()+r),t==="months"&&e.setMonth(e.getMonth()+r),t==="years"&&e.setFullYear(e.getFullYear()+r),t==="quarters"&&e.setMonth(e.getMonth()+r*3),t==="weeks"&&e.setDate(e.getDate()+r*7),t==="hours"&&e.setHours(e.getHours()+r),t==="minutes"&&e.setMinutes(e.getMinutes()+r),t==="seconds"&&e.setSeconds(e.getSeconds()+r),e),dateSubtract:(e,r,t)=>(t==="days"&&e.setDate(e.getDate()-r),t==="months"&&e.setMonth(e.getMonth()-r),t==="years"&&e.setFullYear(e.getFullYear()-r),t==="quarters"&&e.setMonth(e.getMonth()-r*3),t==="weeks"&&e.setDate(e.getDate()-r*7),t==="hours"&&e.setHours(e.getHours()-r),t==="minutes"&&e.setMinutes(e.getMinutes()-r),t==="seconds"&&e.setSeconds(e.getSeconds()-r),e),dateBetween:(e,r,t)=>{let u=Math.abs(r.getTime()-e.getTime());switch(t){case"days":return Math.round(u/864e5);case"months":return Math.round(u/2592e6);case"years":return Math.round(u/31536e6);case"hours":return Math.round(u/(60*60*1e3));case"minutes":return Math.round(u/(60*1e3));case"seconds":return Math.round(u/1e3);case"weeks":return Math.round(u/(864e5*7));case"quarters":return Math.round(u/(2592e6*3));default:return Math.round(u/864e5)}},style:(e,r)=>e,timeStamp:e=>e.getTime(),at:(e,r)=>e[r],first:e=>e[0],last:e=>e[e.length-1],concat:(e,r)=>e.concat(r),sort:e=>e.sort((r,t)=>t-r),reverse:e=>e.reverse(),join:(e,r)=>e.join(r),includes:(e,r)=>e.includes(r),split:(e,r)=>e.split(r),formatDate:UA,parseDate:e=>Lb(e),find:OA,findIndex:BA,filter:PA,map:IA,some:RA,every:qA,flat:kA,path:FA,let:EA,lets:TA};function ht(){return ht=Object.assign?Object.assign.bind():function(e){for(var r=1;re[r])}var Sm=["Matrix","Array"],Nm=["number","BigNumber","Fraction"];function VA(e,r){function t(n){if(n){var a=wu(e,ar);GA(n,"matrix",Sm),GA(n,"number",Nm),Ub(e,n);var i=wu(e,ar),u=wu(n,ar);return r("config",i,a,u),i}else return wu(e,ar)}return t.MATRIX_OPTIONS=Sm,t.NUMBER_OPTIONS=Nm,Object.keys(Ss).forEach(n=>{Object.defineProperty(t,n,{get:()=>e[n],enumerable:!0,configurable:!0})}),t}function $k(e,r){return e.indexOf(r)!==-1}function GA(e,r,t){e[r]!==void 0&&!$k(t,e[r])&&console.warn('Warning: Unknown value "'+e[r]+'" for configuration option "'+r+'". Available options: '+t.map(n=>JSON.stringify(n)).join(", ")+".")}var Oe=function(r){if(r)throw new Error(\`The global config is readonly. +\`+new Error().stack),I=!1}return A.apply(this,arguments)},A)}var E={};function T(g,A){r.deprecationHandler!=null&&r.deprecationHandler(g,A),E[g]||(O(A),E[g]=!0)}r.suppressDeprecationWarnings=!1,r.deprecationHandler=null;function R(g){return typeof Function<"u"&&g instanceof Function||Object.prototype.toString.call(g)==="[object Function]"}function L(g){var A,I;for(I in g)i(g,I)&&(A=g[I],R(A)?this[I]=A:this["_"+I]=A);this._config=g,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\\d{1,2}/.source)}function H(g,A){var I=m({},g),U;for(U in A)i(A,U)&&(a(g[U])&&a(A[U])?(I[U]={},m(I[U],g[U]),m(I[U],A[U])):A[U]!=null?I[U]=A[U]:delete I[U]);for(U in g)i(g,U)&&!i(A,U)&&a(g[U])&&(I[U]=m({},I[U]));return I}function V(g){g!=null&&this.set(g)}var W;Object.keys?W=Object.keys:W=function(g){var A,I=[];for(A in g)i(g,A)&&I.push(A);return I};var k={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function q(g,A,I){var U=this._calendar[g]||this._calendar.sameElse;return R(U)?U.call(A,I):U}function K(g,A,I){var U=""+Math.abs(g),G=A-U.length,se=g>=0;return(se?I?"+":"":"-")+Math.pow(10,Math.max(0,G)).toString().substr(1)+U}var z=/(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,oe=/(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,le={},ae={};function $(g,A,I,U){var G=U;typeof U=="string"&&(G=function(){return this[U]()}),g&&(ae[g]=G),A&&(ae[A[0]]=function(){return K(G.apply(this,arguments),A[1],A[2])}),I&&(ae[I]=function(){return this.localeData().ordinal(G.apply(this,arguments),g)})}function me(g){return g.match(/\\[[\\s\\S]/)?g.replace(/^\\[|\\]$/g,""):g.replace(/\\\\/g,"")}function Ee(g){var A=g.match(z),I,U;for(I=0,U=A.length;I=0&&oe.test(g);)g=g.replace(oe,U),oe.lastIndex=0,I-=1;return g}var Se={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function ye(g){var A=this._longDateFormat[g],I=this._longDateFormat[g.toUpperCase()];return A||!I?A:(this._longDateFormat[g]=I.match(z).map(function(U){return U==="MMMM"||U==="MM"||U==="DD"||U==="dddd"?U.slice(1):U}).join(""),this._longDateFormat[g])}var be="Invalid date";function De(){return this._invalidDate}var Ae="%d",We=/\\d{1,2}/;function Je(g){return this._ordinal.replace("%d",g)}var J={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function re(g,A,I,U){var G=this._relativeTime[I];return R(G)?G(g,A,I,U):G.replace(/%d/i,g)}function xe(g,A){var I=this._relativeTime[g>0?"future":"past"];return R(I)?I(A):I.replace(/%s/i,A)}var j={};function ne(g,A){var I=g.toLowerCase();j[I]=j[I+"s"]=j[A]=g}function ue(g){return typeof g=="string"?j[g]||j[g.toLowerCase()]:void 0}function Me(g){var A={},I,U;for(U in g)i(g,U)&&(I=ue(U),I&&(A[I]=g[U]));return A}var Ce={};function Le(g,A){Ce[g]=A}function Ie(g){var A=[],I;for(I in g)i(g,I)&&A.push({unit:I,priority:Ce[I]});return A.sort(function(U,G){return U.priority-G.priority}),A}function fr(g){return g%4===0&&g%100!==0||g%400===0}function or(g){return g<0?Math.ceil(g)||0:Math.floor(g)}function Ke(g){var A=+g,I=0;return A!==0&&isFinite(A)&&(I=or(A)),I}function Pr(g,A){return function(I){return I!=null?(ce(this,g,I),r.updateOffset(this,A),this):ee(this,g)}}function ee(g,A){return g.isValid()?g._d["get"+(g._isUTC?"UTC":"")+A]():NaN}function ce(g,A,I){g.isValid()&&!isNaN(I)&&(A==="FullYear"&&fr(g.year())&&g.month()===1&&g.date()===29?(I=Ke(I),g._d["set"+(g._isUTC?"UTC":"")+A](I,g.month(),fo(I,g.month()))):g._d["set"+(g._isUTC?"UTC":"")+A](I))}function we(g){return g=ue(g),R(this[g])?this[g]():this}function Be(g,A){if(typeof g=="object"){g=Me(g);var I=Ie(g),U,G=I.length;for(U=0;U68?1900:2e3)};var kf=Pr("FullYear",!0);function vx(){return fr(this.year())}function Gc(g,A,I,U,G,se,Fe){var dr;return g<100&&g>=0?(dr=new Date(g+400,A,I,U,G,se,Fe),isFinite(dr.getFullYear())&&dr.setFullYear(g)):dr=new Date(g,A,I,U,G,se,Fe),dr}function co(g){var A,I;return g<100&&g>=0?(I=Array.prototype.slice.call(arguments),I[0]=g+400,A=new Date(Date.UTC.apply(null,I)),isFinite(A.getUTCFullYear())&&A.setUTCFullYear(g)):A=new Date(Date.UTC.apply(null,arguments)),A}function lo(g,A,I){var U=7+A-I,G=(7+co(g,0,U).getUTCDay()-A)%7;return-G+U-1}function Vc(g,A,I,U,G){var se=(7+I-U)%7,Fe=lo(g,U,G),dr=1+7*(A-1)+se+Fe,_r,tt;return dr<=0?(_r=g-1,tt=di(_r)+dr):dr>di(g)?(_r=g+1,tt=dr-di(g)):(_r=g,tt=dr),{year:_r,dayOfYear:tt}}function mo(g,A,I){var U=lo(g.year(),A,I),G=Math.floor((g.dayOfYear()-U-1)/7)+1,se,Fe;return G<1?(Fe=g.year()-1,se=G+ia(Fe,A,I)):G>ia(g.year(),A,I)?(se=G-ia(g.year(),A,I),Fe=g.year()+1):(Fe=g.year(),se=G),{week:se,year:Fe}}function ia(g,A,I){var U=lo(g,A,I),G=lo(g+1,A,I);return(di(g)-U+G)/7}$("w",["ww",2],"wo","week"),$("W",["WW",2],"Wo","isoWeek"),ne("week","w"),ne("isoWeek","W"),Le("week",5),Le("isoWeek",5),nr("w",Q),nr("ww",Q,Te),nr("W",Q),nr("WW",Q,Te),Ii(["w","ww","W","WW"],function(g,A,I,U){A[U.substr(0,1)]=Ke(g)});function Lf(g){return mo(g,this._week.dow,this._week.doy).week}var po={dow:0,doy:6};function Zc(){return this._week.dow}function Qc(){return this._week.doy}function gx(g){var A=this.localeData().week(this);return g==null?A:this.add((g-A)*7,"d")}function Xc(g){var A=mo(this,1,4).week;return g==null?A:this.add((g-A)*7,"d")}$("d",0,"do","day"),$("dd",0,0,function(g){return this.localeData().weekdaysMin(this,g)}),$("ddd",0,0,function(g){return this.localeData().weekdaysShort(this,g)}),$("dddd",0,0,function(g){return this.localeData().weekdays(this,g)}),$("e",0,0,"weekday"),$("E",0,0,"isoWeekday"),ne("day","d"),ne("weekday","e"),ne("isoWeekday","E"),Le("day",11),Le("weekday",11),Le("isoWeekday",11),nr("d",Q),nr("e",Q),nr("E",Q),nr("dd",function(g,A){return A.weekdaysMinRegex(g)}),nr("ddd",function(g,A){return A.weekdaysShortRegex(g)}),nr("dddd",function(g,A){return A.weekdaysRegex(g)}),Ii(["dd","ddd","dddd"],function(g,A,I,U){var G=I._locale.weekdaysParse(g,U,I._strict);G!=null?A.d=G:y(I).invalidWeekday=g}),Ii(["d","e","E"],function(g,A,I,U){A[U]=Ke(g)});function Jc(g,A){return typeof g!="string"?g:isNaN(g)?(g=A.weekdaysParse(g),typeof g=="number"?g:null):parseInt(g,10)}function Kc(g,A){return typeof g=="string"?A.weekdaysParse(g)%7||7:isNaN(g)?null:g}function Ys(g,A){return g.slice(A,7).concat(g.slice(0,A))}var yx="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),jc="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),xx="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),el=Ha,bx=Ha,wx=Ha;function Dx(g,A){var I=n(this._weekdays)?this._weekdays:this._weekdays[g&&g!==!0&&this._weekdays.isFormat.test(A)?"format":"standalone"];return g===!0?Ys(I,this._week.dow):g?I[g.day()]:I}function Sx(g){return g===!0?Ys(this._weekdaysShort,this._week.dow):g?this._weekdaysShort[g.day()]:this._weekdaysShort}function zf(g){return g===!0?Ys(this._weekdaysMin,this._week.dow):g?this._weekdaysMin[g.day()]:this._weekdaysMin}function Nx(g,A,I){var U,G,se,Fe=g.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],U=0;U<7;++U)se=d([2e3,1]).day(U),this._minWeekdaysParse[U]=this.weekdaysMin(se,"").toLocaleLowerCase(),this._shortWeekdaysParse[U]=this.weekdaysShort(se,"").toLocaleLowerCase(),this._weekdaysParse[U]=this.weekdays(se,"").toLocaleLowerCase();return I?A==="dddd"?(G=vt.call(this._weekdaysParse,Fe),G!==-1?G:null):A==="ddd"?(G=vt.call(this._shortWeekdaysParse,Fe),G!==-1?G:null):(G=vt.call(this._minWeekdaysParse,Fe),G!==-1?G:null):A==="dddd"?(G=vt.call(this._weekdaysParse,Fe),G!==-1||(G=vt.call(this._shortWeekdaysParse,Fe),G!==-1)?G:(G=vt.call(this._minWeekdaysParse,Fe),G!==-1?G:null)):A==="ddd"?(G=vt.call(this._shortWeekdaysParse,Fe),G!==-1||(G=vt.call(this._weekdaysParse,Fe),G!==-1)?G:(G=vt.call(this._minWeekdaysParse,Fe),G!==-1?G:null)):(G=vt.call(this._minWeekdaysParse,Fe),G!==-1||(G=vt.call(this._weekdaysParse,Fe),G!==-1)?G:(G=vt.call(this._shortWeekdaysParse,Fe),G!==-1?G:null))}function Ax(g,A,I){var U,G,se;if(this._weekdaysParseExact)return Nx.call(this,g,A,I);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),U=0;U<7;U++){if(G=d([2e3,1]).day(U),I&&!this._fullWeekdaysParse[U]&&(this._fullWeekdaysParse[U]=new RegExp("^"+this.weekdays(G,"").replace(".","\\\\.?")+"$","i"),this._shortWeekdaysParse[U]=new RegExp("^"+this.weekdaysShort(G,"").replace(".","\\\\.?")+"$","i"),this._minWeekdaysParse[U]=new RegExp("^"+this.weekdaysMin(G,"").replace(".","\\\\.?")+"$","i")),this._weekdaysParse[U]||(se="^"+this.weekdays(G,"")+"|^"+this.weekdaysShort(G,"")+"|^"+this.weekdaysMin(G,""),this._weekdaysParse[U]=new RegExp(se.replace(".",""),"i")),I&&A==="dddd"&&this._fullWeekdaysParse[U].test(g))return U;if(I&&A==="ddd"&&this._shortWeekdaysParse[U].test(g))return U;if(I&&A==="dd"&&this._minWeekdaysParse[U].test(g))return U;if(!I&&this._weekdaysParse[U].test(g))return U}}function Mx(g){if(!this.isValid())return g!=null?this:NaN;var A=this._isUTC?this._d.getUTCDay():this._d.getDay();return g!=null?(g=Jc(g,this.localeData()),this.add(g-A,"d")):A}function Cx(g){if(!this.isValid())return g!=null?this:NaN;var A=(this.day()+7-this.localeData()._week.dow)%7;return g==null?A:this.add(g-A,"d")}function Ex(g){if(!this.isValid())return g!=null?this:NaN;if(g!=null){var A=Kc(g,this.localeData());return this.day(this.day()%7?A:A-7)}else return this.day()||7}function xt(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Uf.call(this),g?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=el),this._weekdaysStrictRegex&&g?this._weekdaysStrictRegex:this._weekdaysRegex)}function gt(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Uf.call(this),g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=bx),this._weekdaysShortStrictRegex&&g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Tx(g){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Uf.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=wx),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Uf(){function g(hn,Ca){return Ca.length-hn.length}var A=[],I=[],U=[],G=[],se,Fe,dr,_r,tt;for(se=0;se<7;se++)Fe=d([2e3,1]).day(se),dr=mn(this.weekdaysMin(Fe,"")),_r=mn(this.weekdaysShort(Fe,"")),tt=mn(this.weekdays(Fe,"")),A.push(dr),I.push(_r),U.push(tt),G.push(dr),G.push(_r),G.push(tt);A.sort(g),I.sort(g),U.sort(g),G.sort(g),this._weekdaysRegex=new RegExp("^("+G.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+U.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+A.join("|")+")","i")}function Wf(){return this.hours()%12||12}function Fx(){return this.hours()||24}$("H",["HH",2],0,"hour"),$("h",["hh",2],0,Wf),$("k",["kk",2],0,Fx),$("hmm",0,0,function(){return""+Wf.apply(this)+K(this.minutes(),2)}),$("hmmss",0,0,function(){return""+Wf.apply(this)+K(this.minutes(),2)+K(this.seconds(),2)}),$("Hmm",0,0,function(){return""+this.hours()+K(this.minutes(),2)}),$("Hmmss",0,0,function(){return""+this.hours()+K(this.minutes(),2)+K(this.seconds(),2)});function rl(g,A){$(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),A)})}rl("a",!0),rl("A",!1),ne("hour","h"),Le("hour",13);function tl(g,A){return A._meridiemParse}nr("a",tl),nr("A",tl),nr("H",Q),nr("h",Q),nr("k",Q),nr("HH",Q,Te),nr("hh",Q,Te),nr("kk",Q,Te),nr("hmm",ve),nr("hmmss",Pe),nr("Hmm",ve),nr("Hmmss",Pe),ot(["H","HH"],Tt),ot(["k","kk"],function(g,A,I){var U=Ke(g);A[Tt]=U===24?0:U}),ot(["a","A"],function(g,A,I){I._isPm=I._locale.isPM(g),I._meridiem=g}),ot(["h","hh"],function(g,A,I){A[Tt]=Ke(g),y(I).bigHour=!0}),ot("hmm",function(g,A,I){var U=g.length-2;A[Tt]=Ke(g.substr(0,U)),A[On]=Ke(g.substr(U)),y(I).bigHour=!0}),ot("hmmss",function(g,A,I){var U=g.length-4,G=g.length-2;A[Tt]=Ke(g.substr(0,U)),A[On]=Ke(g.substr(U,2)),A[aa]=Ke(g.substr(G)),y(I).bigHour=!0}),ot("Hmm",function(g,A,I){var U=g.length-2;A[Tt]=Ke(g.substr(0,U)),A[On]=Ke(g.substr(U))}),ot("Hmmss",function(g,A,I){var U=g.length-4,G=g.length-2;A[Tt]=Ke(g.substr(0,U)),A[On]=Ke(g.substr(U,2)),A[aa]=Ke(g.substr(G))});function nl(g){return(g+"").toLowerCase().charAt(0)==="p"}var _x=/[ap]\\.?m?\\.?/i,Vt=Pr("Hours",!0);function Yf(g,A,I){return g>11?I?"pm":"PM":I?"am":"AM"}var hi={calendar:k,longDateFormat:Se,invalidDate:be,ordinal:Ae,dayOfMonthOrdinalParse:We,relativeTime:J,months:Pf,monthsShort:Ls,week:po,weekdays:yx,weekdaysMin:xx,weekdaysShort:jc,meridiemParse:_x},bt={},qi={},sn;function al(g,A){var I,U=Math.min(g.length,A.length);for(I=0;I0;){if(G=es(se.slice(0,I).join("-")),G)return G;if(U&&U.length>=I&&al(se,U)>=I-1)break;I--}A++}return sn}function ol(g){return g.match("^[^/\\\\\\\\]*$")!=null}function es(g){var A=null,I;if(bt[g]===void 0&&typeof Nf<"u"&&Nf&&Nf.exports&&ol(g))try{A=sn._abbr,I=require,I("./locale/"+g),Va(A)}catch{bt[g]=null}return bt[g]}function Va(g,A){var I;return g&&(l(A)?I=It(g):I=pn(g,A),I?sn=I:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),sn._abbr}function pn(g,A){if(A!==null){var I,U=hi;if(A.abbr=g,bt[g]!=null)T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),U=bt[g]._config;else if(A.parentLocale!=null)if(bt[A.parentLocale]!=null)U=bt[A.parentLocale]._config;else if(I=es(A.parentLocale),I!=null)U=I._config;else return qi[A.parentLocale]||(qi[A.parentLocale]=[]),qi[A.parentLocale].push({name:g,config:A}),null;return bt[g]=new V(H(U,A)),qi[g]&&qi[g].forEach(function(G){pn(G.name,G.config)}),Va(g),bt[g]}else return delete bt[g],null}function Ox(g,A){if(A!=null){var I,U,G=hi;bt[g]!=null&&bt[g].parentLocale!=null?bt[g].set(H(bt[g]._config,A)):(U=es(g),U!=null&&(G=U._config),A=H(G,A),U==null&&(A.abbr=g),I=new V(A),I.parentLocale=bt[g],bt[g]=I),Va(g)}else bt[g]!=null&&(bt[g].parentLocale!=null?(bt[g]=bt[g].parentLocale,g===Va()&&Va(g)):bt[g]!=null&&delete bt[g]);return bt[g]}function It(g){var A;if(g&&g._locale&&g._locale._abbr&&(g=g._locale._abbr),!g)return sn;if(!n(g)){if(A=es(g),A)return A;g=[g]}return il(g)}function Bx(){return W(bt)}function Hs(g){var A,I=g._a;return I&&y(g).overflow===-2&&(A=I[Un]<0||I[Un]>11?Un:I[Wn]<1||I[Wn]>fo(I[Gt],I[Un])?Wn:I[Tt]<0||I[Tt]>24||I[Tt]===24&&(I[On]!==0||I[aa]!==0||I[$a]!==0)?Tt:I[On]<0||I[On]>59?On:I[aa]<0||I[aa]>59?aa:I[$a]<0||I[$a]>999?$a:-1,y(g)._overflowDayOfYear&&(AWn)&&(A=Wn),y(g)._overflowWeeks&&A===-1&&(A=Of),y(g)._overflowWeekday&&A===-1&&(A=uo),y(g).overflow=A),g}var vi=/^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,$s=/^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,$f=/Z|[+-]\\d\\d(?::?\\d\\d)?/,dt=[["YYYYYY-MM-DD",/[+-]\\d{6}-\\d\\d-\\d\\d/],["YYYY-MM-DD",/\\d{4}-\\d\\d-\\d\\d/],["GGGG-[W]WW-E",/\\d{4}-W\\d\\d-\\d/],["GGGG-[W]WW",/\\d{4}-W\\d\\d/,!1],["YYYY-DDD",/\\d{4}-\\d{3}/],["YYYY-MM",/\\d{4}-\\d\\d/,!1],["YYYYYYMMDD",/[+-]\\d{10}/],["YYYYMMDD",/\\d{8}/],["GGGG[W]WWE",/\\d{4}W\\d{3}/],["GGGG[W]WW",/\\d{4}W\\d{2}/,!1],["YYYYDDD",/\\d{7}/],["YYYYMM",/\\d{6}/,!1],["YYYY",/\\d{4}/,!1]],Da=[["HH:mm:ss.SSSS",/\\d\\d:\\d\\d:\\d\\d\\.\\d+/],["HH:mm:ss,SSSS",/\\d\\d:\\d\\d:\\d\\d,\\d+/],["HH:mm:ss",/\\d\\d:\\d\\d:\\d\\d/],["HH:mm",/\\d\\d:\\d\\d/],["HHmmss.SSSS",/\\d\\d\\d\\d\\d\\d\\.\\d+/],["HHmmss,SSSS",/\\d\\d\\d\\d\\d\\d,\\d+/],["HHmmss",/\\d\\d\\d\\d\\d\\d/],["HHmm",/\\d\\d\\d\\d/],["HH",/\\d\\d/]],Gf=/^\\/?Date\\((-?\\d+)/i,Px=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,Vf={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function sl(g){var A,I,U=g._i,G=vi.exec(U)||$s.exec(U),se,Fe,dr,_r,tt=dt.length,hn=Da.length;if(G){for(y(g).iso=!0,A=0,I=tt;Adi(Fe)||g._dayOfYear===0)&&(y(g)._overflowDayOfYear=!0),I=co(Fe,0,g._dayOfYear),g._a[Un]=I.getUTCMonth(),g._a[Wn]=I.getUTCDate()),A=0;A<3&&g._a[A]==null;++A)g._a[A]=U[A]=G[A];for(;A<7;A++)g._a[A]=U[A]=g._a[A]==null?A===2?1:0:g._a[A];g._a[Tt]===24&&g._a[On]===0&&g._a[aa]===0&&g._a[$a]===0&&(g._nextDay=!0,g._a[Tt]=0),g._d=(g._useUTC?co:Gc).apply(null,U),se=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[Tt]=24),g._w&&typeof g._w.d<"u"&&g._w.d!==se&&(y(g).weekdayMismatch=!0)}}function ll(g){var A,I,U,G,se,Fe,dr,_r,tt;A=g._w,A.GG!=null||A.W!=null||A.E!=null?(se=1,Fe=4,I=ki(A.GG,g._a[Gt],mo(yt(),1,4).year),U=ki(A.W,1),G=ki(A.E,1),(G<1||G>7)&&(_r=!0)):(se=g._locale._week.dow,Fe=g._locale._week.doy,tt=mo(yt(),se,Fe),I=ki(A.gg,g._a[Gt],tt.year),U=ki(A.w,tt.week),A.d!=null?(G=A.d,(G<0||G>6)&&(_r=!0)):A.e!=null?(G=A.e+se,(A.e<0||A.e>6)&&(_r=!0)):G=se),U<1||U>ia(I,se,Fe)?y(g)._overflowWeeks=!0:_r!=null?y(g)._overflowWeekday=!0:(dr=Vc(I,U,G,se,Fe),g._a[Gt]=dr.year,g._dayOfYear=dr.dayOfYear)}r.ISO_8601=function(){},r.RFC_2822=function(){};function Qf(g){if(g._f===r.ISO_8601){sl(g);return}if(g._f===r.RFC_2822){fl(g);return}g._a=[],y(g).empty=!0;var A=""+g._i,I,U,G,se,Fe,dr=A.length,_r=0,tt,hn;for(G=ge(g._f,g._locale).match(z)||[],hn=G.length,I=0;I0&&y(g).unusedInput.push(Fe),A=A.slice(A.indexOf(U)+U.length),_r+=U.length),ae[se]?(U?y(g).empty=!1:y(g).unusedTokens.push(se),_f(se,U,g)):g._strict&&!U&&y(g).unusedTokens.push(se);y(g).charsLeftOver=dr-_r,A.length>0&&y(g).unusedInput.push(A),g._a[Tt]<=12&&y(g).bigHour===!0&&g._a[Tt]>0&&(y(g).bigHour=void 0),y(g).parsedDateParts=g._a.slice(0),y(g).meridiem=g._meridiem,g._a[Tt]=Xf(g._locale,g._a[Tt],g._meridiem),tt=y(g).era,tt!==null&&(g._a[Gt]=g._locale.erasConvertYear(tt,g._a[Gt])),rs(g),Hs(g)}function Xf(g,A,I){var U;return I==null?A:g.meridiemHour!=null?g.meridiemHour(A,I):(g.isPM!=null&&(U=g.isPM(I),U&&A<12&&(A+=12),!U&&A===12&&(A=0)),A)}function Jf(g){var A,I,U,G,se,Fe,dr=!1,_r=g._f.length;if(_r===0){y(g).invalidFormat=!0,g._d=new Date(NaN);return}for(G=0;G<_r;G++)se=0,Fe=!1,A=N({},g),g._useUTC!=null&&(A._useUTC=g._useUTC),A._f=g._f[G],Qf(A),x(A)&&(Fe=!0),se+=y(A).charsLeftOver,se+=y(A).unusedTokens.length*10,y(A).score=se,dr?sethis?this:g:w()});function dl(g,A){var I,U;if(A.length===1&&n(A[0])&&(A=A[0]),!A.length)return yt();for(I=A[0],U=1;Uthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function _e(){if(!l(this._isDSTShifted))return this._isDSTShifted;var g={},A;return N(g,this),g=wn(g),g._a?(A=g._isUTC?d(g._a):yt(g._a),this._isDSTShifted=this.isValid()&&Hx(g._a,A.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Ne(){return this.isValid()?!this._isUTC:!1}function ir(){return this.isValid()?this._isUTC:!1}function Ar(){return this.isValid()?this._isUTC&&this._offset===0:!1}var rt=/^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,zt=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function zr(g,A){var I=g,U=null,G,se,Fe;return oa(g)?I={ms:g._milliseconds,d:g._days,M:g._months}:c(g)||!isNaN(+g)?(I={},A?I[A]=+g:I.milliseconds=+g):(U=rt.exec(g))?(G=U[1]==="-"?-1:1,I={y:0,d:Ke(U[Wn])*G,h:Ke(U[Tt])*G,m:Ke(U[On])*G,s:Ke(U[aa])*G,ms:Ke(go(U[$a]*1e3))*G}):(U=zt.exec(g))?(G=U[1]==="-"?-1:1,I={y:Za(U[2],G),M:Za(U[3],G),w:Za(U[4],G),d:Za(U[5],G),h:Za(U[6],G),m:Za(U[7],G),s:Za(U[8],G)}):I==null?I={}:typeof I=="object"&&("from"in I||"to"in I)&&(Fe=Yn(yt(I.from),yt(I.to)),I={},I.ms=Fe.milliseconds,I.M=Fe.months),se=new ts(I),oa(g)&&i(g,"_locale")&&(se._locale=g._locale),oa(g)&&i(g,"_isValid")&&(se._isValid=g._isValid),se}zr.fn=ts.prototype,zr.invalid=jf;function Za(g,A){var I=g&&parseFloat(g.replace(",","."));return(isNaN(I)?0:I)*A}function vl(g,A){var I={};return I.months=A.month()-g.month()+(A.year()-g.year())*12,g.clone().add(I.months,"M").isAfter(A)&&--I.months,I.milliseconds=+A-+g.clone().add(I.months,"M"),I}function Yn(g,A){var I;return g.isValid()&&A.isValid()?(A=Bn(A,g),g.isBefore(A)?I=vl(g,A):(I=vl(A,g),I.milliseconds=-I.milliseconds,I.months=-I.months),I):{milliseconds:0,months:0}}function ns(g,A){return function(I,U){var G,se;return U!==null&&!isNaN(+U)&&(T(A,"moment()."+A+"(period, number) is deprecated. Please use moment()."+A+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),se=I,I=U,U=se),G=zr(I,U),gl(this,G,g),this}}function gl(g,A,I,U){var G=A._milliseconds,se=go(A._days),Fe=go(A._months);!g.isValid()||(U=U??!0,Fe&&pi(g,ee(g,"Month")+Fe*I),se&&ce(g,"Date",ee(g,"Date")+se*I),G&&g._d.setTime(g._d.valueOf()+G*I),U&&r.updateOffset(g,se||Fe))}var yo=ns(1,"add"),Zs=ns(-1,"subtract");function as(g){return typeof g=="string"||g instanceof String}function ut(g){return S(g)||o(g)||as(g)||c(g)||yl(g)||Jx(g)||g===null||g===void 0}function Jx(g){var A=a(g)&&!s(g),I=!1,U=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],G,se,Fe=U.length;for(G=0;GI.valueOf():I.valueOf()9999?pe(I,A?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):R(Date.prototype.toISOString)?A?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",pe(I,"Z")):pe(I,A?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function zi(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var g="moment",A="",I,U,G,se;return this.isLocal()||(g=this.utcOffset()===0?"moment.utc":"moment.parseZone",A="Z"),I="["+g+'("]',U=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",G="-MM-DD[T]HH:mm:ss.SSS",se=A+'[")]',this.format(I+U+G+se)}function js(g){g||(g=this.isUtc()?r.defaultFormatUtc:r.defaultFormat);var A=pe(this,g);return this.localeData().postformat(A)}function r1(g,A){return this.isValid()&&(S(g)&&g.isValid()||yt(g).isValid())?zr({to:this,from:g}).locale(this.locale()).humanize(!A):this.localeData().invalidDate()}function t1(g){return this.from(yt(),g)}function n1(g,A){return this.isValid()&&(S(g)&&g.isValid()||yt(g).isValid())?zr({from:this,to:g}).locale(this.locale()).humanize(!A):this.localeData().invalidDate()}function eu(g){return this.to(yt(),g)}function os(g){var A;return g===void 0?this._locale._abbr:(A=It(g),A!=null&&(this._locale=A),this)}var ru=_("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(g){return g===void 0?this.localeData():this.locale(g)});function Sl(){return this._locale}var ss=1e3,xo=60*ss,tu=60*xo,Rt=(365*400+97)*24*tu;function Ft(g,A){return(g%A+A)%A}function Nl(g,A,I){return g<100&&g>=0?new Date(g+400,A,I)-Rt:new Date(g,A,I).valueOf()}function Al(g,A,I){return g<100&&g>=0?Date.UTC(g+400,A,I)-Rt:Date.UTC(g,A,I)}function Ml(g){var A,I;if(g=ue(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?Al:Nl,g){case"year":A=I(this.year(),0,1);break;case"quarter":A=I(this.year(),this.month()-this.month()%3,1);break;case"month":A=I(this.year(),this.month(),1);break;case"week":A=I(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":A=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":A=I(this.year(),this.month(),this.date());break;case"hour":A=this._d.valueOf(),A-=Ft(A+(this._isUTC?0:this.utcOffset()*xo),tu);break;case"minute":A=this._d.valueOf(),A-=Ft(A,xo);break;case"second":A=this._d.valueOf(),A-=Ft(A,ss);break}return this._d.setTime(A),r.updateOffset(this,!0),this}function a1(g){var A,I;if(g=ue(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?Al:Nl,g){case"year":A=I(this.year()+1,0,1)-1;break;case"quarter":A=I(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":A=I(this.year(),this.month()+1,1)-1;break;case"week":A=I(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":A=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":A=I(this.year(),this.month(),this.date()+1)-1;break;case"hour":A=this._d.valueOf(),A+=tu-Ft(A+(this._isUTC?0:this.utcOffset()*xo),tu)-1;break;case"minute":A=this._d.valueOf(),A+=xo-Ft(A,xo)-1;break;case"second":A=this._d.valueOf(),A+=ss-Ft(A,ss)-1;break}return this._d.setTime(A),r.updateOffset(this,!0),this}function ec(){return this._d.valueOf()-(this._offset||0)*6e4}function us(){return Math.floor(this.valueOf()/1e3)}function rc(){return new Date(this.valueOf())}function bo(){var g=this;return[g.year(),g.month(),g.date(),g.hour(),g.minute(),g.second(),g.millisecond()]}function fs(){var g=this;return{years:g.year(),months:g.month(),date:g.date(),hours:g.hours(),minutes:g.minutes(),seconds:g.seconds(),milliseconds:g.milliseconds()}}function cs(){return this.isValid()?this.toISOString():null}function nu(){return x(this)}function wo(){return m({},y(this))}function i1(){return y(this).overflow}function o1(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}$("N",0,0,"eraAbbr"),$("NN",0,0,"eraAbbr"),$("NNN",0,0,"eraAbbr"),$("NNNN",0,0,"eraName"),$("NNNNN",0,0,"eraNarrow"),$("y",["y",1],"yo","eraYear"),$("y",["yy",2],0,"eraYear"),$("y",["yyy",3],0,"eraYear"),$("y",["yyyy",4],0,"eraYear"),nr("N",qr),nr("NN",qr),nr("NNN",qr),nr("NNNN",c1),nr("NNNNN",l1),ot(["N","NN","NNN","NNNN","NNNNN"],function(g,A,I,U){var G=I._locale.erasParse(g,U,I._strict);G?y(I).era=G:y(I).invalidEra=g}),nr("y",Pt),nr("yy",Pt),nr("yyy",Pt),nr("yyyy",Pt),nr("yo",m1),ot(["y","yy","yyy","yyyy"],Gt),ot(["yo"],function(g,A,I,U){var G;I._locale._eraYearOrdinalRegex&&(G=g.match(I._locale._eraYearOrdinalRegex)),I._locale.eraYearOrdinalParse?A[Gt]=I._locale.eraYearOrdinalParse(g,G):A[Gt]=parseInt(g,10)});function s1(g,A){var I,U,G,se=this._eras||It("en")._eras;for(I=0,U=se.length;I=0)return se[U]}function f1(g,A){var I=g.since<=g.until?1:-1;return A===void 0?r(g.since).year():r(g.since).year()+(A-g.offset)*I}function au(){var g,A,I,U=this.localeData().eras();for(g=0,A=U.length;gse&&(A=se),y1.call(this,g,A,I,U,G))}function y1(g,A,I,U,G){var se=Vc(g,A,I,U,G),Fe=co(se.year,0,se.dayOfYear);return this.year(Fe.getUTCFullYear()),this.month(Fe.getUTCMonth()),this.date(Fe.getUTCDate()),this}$("Q",0,"Qo","quarter"),ne("quarter","Q"),Le("quarter",7),nr("Q",qe),ot("Q",function(g,A){A[Un]=(Ke(g)-1)*3});function x1(g){return g==null?Math.ceil((this.month()+1)/3):this.month((g-1)*3+this.month()%3)}$("D",["DD",2],"Do","date"),ne("date","D"),Le("date",9),nr("D",Q),nr("DD",Q,Te),nr("Do",function(g,A){return g?A._dayOfMonthOrdinalParse||A._ordinalParse:A._dayOfMonthOrdinalParseLenient}),ot(["D","DD"],Wn),ot("Do",function(g,A){A[Wn]=Ke(g.match(Q)[0])});var Tl=Pr("Date",!0);$("DDD",["DDDD",3],"DDDo","dayOfYear"),ne("dayOfYear","DDD"),Le("dayOfYear",4),nr("DDD",tr),nr("DDDD",Re),ot(["DDD","DDDD"],function(g,A,I){I._dayOfYear=Ke(g)});function Ja(g){var A=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return g==null?A:this.add(g-A,"d")}$("m",["mm",2],0,"minute"),ne("minute","m"),Le("minute",14),nr("m",Q),nr("mm",Q,Te),ot(["m","mm"],On);var b1=Pr("Minutes",!1);$("s",["ss",2],0,"second"),ne("second","s"),Le("second",15),nr("s",Q),nr("ss",Q,Te),ot(["s","ss"],aa);var w1=Pr("Seconds",!1);$("S",0,0,function(){return~~(this.millisecond()/100)}),$(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),$(0,["SSS",3],0,"millisecond"),$(0,["SSSS",4],0,function(){return this.millisecond()*10}),$(0,["SSSSS",5],0,function(){return this.millisecond()*100}),$(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),$(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),$(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),$(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),ne("millisecond","ms"),Le("millisecond",16),nr("S",tr,qe),nr("SS",tr,Te),nr("SSS",tr,Re);var bi,Fl;for(bi="SSSS";bi.length<=9;bi+="S")nr(bi,Pt);function D1(g,A){A[$a]=Ke(("0."+g)*1e3)}for(bi="S";bi.length<=9;bi+="S")ot(bi,D1);Fl=Pr("Milliseconds",!1),$("z",0,0,"zoneAbbr"),$("zz",0,0,"zoneName");function Ui(){return this._isUTC?"UTC":""}function S1(){return this._isUTC?"Coordinated Universal Time":""}var Ve=M.prototype;Ve.add=yo,Ve.calendar=jx,Ve.clone=e1,Ve.diff=wl,Ve.endOf=a1,Ve.format=js,Ve.from=r1,Ve.fromNow=t1,Ve.to=n1,Ve.toNow=eu,Ve.get=we,Ve.invalidAt=i1,Ve.isAfter=Xs,Ve.isBefore=xi,Ve.isBetween=Js,Ve.isSame=xl,Ve.isSameOrAfter=Ks,Ve.isSameOrBefore=bl,Ve.isValid=nu,Ve.lang=ru,Ve.locale=os,Ve.localeData=Sl,Ve.max=kx,Ve.min=pl,Ve.parsingFlags=wo,Ve.set=Be,Ve.startOf=Ml,Ve.subtract=Zs,Ve.toArray=bo,Ve.toObject=fs,Ve.toDate=rc,Ve.toISOString=is,Ve.inspect=zi,typeof Symbol<"u"&&Symbol.for!=null&&(Ve[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ve.toJSON=cs,Ve.toString=Dl,Ve.unix=us,Ve.valueOf=ec,Ve.creationData=o1,Ve.eraName=au,Ve.eraNarrow=ls,Ve.eraAbbr=Cl,Ve.eraYear=Z,Ve.year=kf,Ve.isLeapYear=vx,Ve.weekYear=p1,Ve.isoWeekYear=d1,Ve.quarter=Ve.quarters=x1,Ve.month=Ga,Ve.daysInMonth=Ws,Ve.week=Ve.weeks=gx,Ve.isoWeek=Ve.isoWeeks=Xc,Ve.weeksInYear=Xa,Ve.weeksInWeekYear=g1,Ve.isoWeeksInYear=h1,Ve.isoWeeksInISOWeekYear=v1,Ve.date=Tl,Ve.day=Ve.days=Mx,Ve.weekday=Cx,Ve.isoWeekday=Ex,Ve.dayOfYear=Ja,Ve.hour=Ve.hours=Vt,Ve.minute=Ve.minutes=b1,Ve.second=Ve.seconds=w1,Ve.millisecond=Ve.milliseconds=Fl,Ve.utcOffset=Gx,Ve.utc=Zx,Ve.local=Qx,Ve.parseZone=Xx,Ve.hasAlignedHourOffset=yi,Ve.isDST=de,Ve.isLocal=Ne,Ve.isUtcOffset=ir,Ve.isUtc=Ar,Ve.isUTC=Ar,Ve.zoneAbbr=Ui,Ve.zoneName=S1,Ve.dates=_("dates accessor is deprecated. Use date instead.",Tl),Ve.months=_("months accessor is deprecated. Use month instead",Ga),Ve.years=_("years accessor is deprecated. Use year instead",kf),Ve.zone=_("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Vx),Ve.isDSTShifted=_("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",_e);function sa(g){return yt(g*1e3)}function N1(){return yt.apply(null,arguments).parseZone()}function _l(g){return g}var Jr=V.prototype;Jr.calendar=q,Jr.longDateFormat=ye,Jr.invalidDate=De,Jr.ordinal=Je,Jr.preparse=_l,Jr.postformat=_l,Jr.relativeTime=re,Jr.pastFuture=xe,Jr.set=L,Jr.eras=s1,Jr.erasParse=u1,Jr.erasConvertYear=f1,Jr.erasAbbrRegex=iu,Jr.erasNameRegex=Do,Jr.erasNarrowRegex=Hn,Jr.months=Ri,Jr.monthsShort=et,Jr.monthsParse=If,Jr.monthsRegex=hx,Jr.monthsShortRegex=Rf,Jr.week=Lf,Jr.firstDayOfYear=Qc,Jr.firstDayOfWeek=Zc,Jr.weekdays=Dx,Jr.weekdaysMin=zf,Jr.weekdaysShort=Sx,Jr.weekdaysParse=Ax,Jr.weekdaysRegex=xt,Jr.weekdaysShortRegex=gt,Jr.weekdaysMinRegex=Tx,Jr.isPM=nl,Jr.meridiem=Yf;function su(g,A,I,U){var G=It(),se=d().set(U,A);return G[I](se,g)}function Ol(g,A,I){if(c(g)&&(A=g,g=void 0),g=g||"",A!=null)return su(g,A,I,"month");var U,G=[];for(U=0;U<12;U++)G[U]=su(g,U,I,"month");return G}function uu(g,A,I,U){typeof g=="boolean"?(c(A)&&(I=A,A=void 0),A=A||""):(A=g,I=A,g=!1,c(A)&&(I=A,A=void 0),A=A||"");var G=It(),se=g?G._week.dow:0,Fe,dr=[];if(I!=null)return su(A,(I+se)%7,U,"day");for(Fe=0;Fe<7;Fe++)dr[Fe]=su(A,(Fe+se)%7,U,"day");return dr}function Bl(g,A){return Ol(g,A,"months")}function A1(g,A){return Ol(g,A,"monthsShort")}function M1(g,A,I){return uu(g,A,I,"weekdays")}function tc(g,A,I){return uu(g,A,I,"weekdaysShort")}function ms(g,A,I){return uu(g,A,I,"weekdaysMin")}Va("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\\d{1,2}(th|st|nd|rd)/,ordinal:function(g){var A=g%10,I=Ke(g%100/10)===1?"th":A===1?"st":A===2?"nd":A===3?"rd":"th";return g+I}}),r.lang=_("moment.lang is deprecated. Use moment.locale instead.",Va),r.langData=_("moment.langData is deprecated. Use moment.localeData instead.",It);var $n=Math.abs;function C1(){var g=this._data;return this._milliseconds=$n(this._milliseconds),this._days=$n(this._days),this._months=$n(this._months),g.milliseconds=$n(g.milliseconds),g.seconds=$n(g.seconds),g.minutes=$n(g.minutes),g.hours=$n(g.hours),g.months=$n(g.months),g.years=$n(g.years),this}function nc(g,A,I,U){var G=zr(A,I);return g._milliseconds+=U*G._milliseconds,g._days+=U*G._days,g._months+=U*G._months,g._bubble()}function E1(g,A){return nc(this,g,A,1)}function Ka(g,A){return nc(this,g,A,-1)}function fu(g){return g<0?Math.floor(g):Math.ceil(g)}function Wi(){var g=this._milliseconds,A=this._days,I=this._months,U=this._data,G,se,Fe,dr,_r;return g>=0&&A>=0&&I>=0||g<=0&&A<=0&&I<=0||(g+=fu(ac(I)+A)*864e5,A=0,I=0),U.milliseconds=g%1e3,G=or(g/1e3),U.seconds=G%60,se=or(G/60),U.minutes=se%60,Fe=or(se/60),U.hours=Fe%24,A+=or(Fe/24),_r=or(Pn(A)),I+=_r,A-=fu(ac(_r)),dr=or(I/12),I%=12,U.days=A,U.months=I,U.years=dr,this}function Pn(g){return g*4800/146097}function ac(g){return g*146097/4800}function Pl(g){if(!this.isValid())return NaN;var A,I,U=this._milliseconds;if(g=ue(g),g==="month"||g==="quarter"||g==="year")switch(A=this._days+U/864e5,I=this._months+Pn(A),g){case"month":return I;case"quarter":return I/3;case"year":return I/12}else switch(A=this._days+Math.round(ac(this._months)),g){case"week":return A/7+U/6048e5;case"day":return A+U/864e5;case"hour":return A*24+U/36e5;case"minute":return A*1440+U/6e4;case"second":return A*86400+U/1e3;case"millisecond":return Math.floor(A*864e5)+U;default:throw new Error("Unknown unit "+g)}}function Il(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Ke(this._months/12)*31536e6:NaN}function In(g){return function(){return this.as(g)}}var wi=In("ms"),Rl=In("s"),T1=In("m"),cu=In("h"),F1=In("d"),ql=In("w"),Jt=In("M"),ic=In("Q"),kl=In("y");function Na(){return zr(this)}function oc(g){return g=ue(g),this.isValid()?this[g+"s"]():NaN}function Aa(g){return function(){return this.isValid()?this._data[g]:NaN}}var Yi=Aa("milliseconds"),Ll=Aa("seconds"),dn=Aa("minutes"),sc=Aa("hours"),_1=Aa("days"),O1=Aa("months"),B1=Aa("years");function uc(){return or(this.days()/7)}var ja=Math.round,Ma={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function zl(g,A,I,U,G){return G.relativeTime(A||1,!!I,g,U)}function P1(g,A,I,U){var G=zr(g).abs(),se=ja(G.as("s")),Fe=ja(G.as("m")),dr=ja(G.as("h")),_r=ja(G.as("d")),tt=ja(G.as("M")),hn=ja(G.as("w")),Ca=ja(G.as("y")),ei=se<=I.ss&&["s",se]||se0,ei[4]=U,zl.apply(null,ei)}function I1(g){return g===void 0?ja:typeof g=="function"?(ja=g,!0):!1}function ps(g,A){return Ma[g]===void 0?!1:A===void 0?Ma[g]:(Ma[g]=A,g==="s"&&(Ma.ss=A-1),!0)}function R1(g,A){if(!this.isValid())return this.localeData().invalidDate();var I=!1,U=Ma,G,se;return typeof g=="object"&&(A=g,g=!1),typeof g=="boolean"&&(I=g),typeof A=="object"&&(U=Object.assign({},Ma,A),A.s!=null&&A.ss==null&&(U.ss=A.s-1)),G=this.localeData(),se=P1(this,!I,U,G),I&&(se=G.pastFuture(+this,se)),G.postformat(se)}var fc=Math.abs;function Di(g){return(g>0)-(g<0)||+g}function ds(){if(!this.isValid())return this.localeData().invalidDate();var g=fc(this._milliseconds)/1e3,A=fc(this._days),I=fc(this._months),U,G,se,Fe,dr=this.asSeconds(),_r,tt,hn,Ca;return dr?(U=or(g/60),G=or(U/60),g%=60,U%=60,se=or(I/12),I%=12,Fe=g?g.toFixed(3).replace(/\\.?0+$/,""):"",_r=dr<0?"-":"",tt=Di(this._months)!==Di(dr)?"-":"",hn=Di(this._days)!==Di(dr)?"-":"",Ca=Di(this._milliseconds)!==Di(dr)?"-":"",_r+"P"+(se?tt+se+"Y":"")+(I?tt+I+"M":"")+(A?hn+A+"D":"")+(G||U||g?"T":"")+(G?Ca+G+"H":"")+(U?Ca+U+"M":"")+(g?Ca+Fe+"S":"")):"P0D"}var Vr=ts.prototype;Vr.isValid=Yx,Vr.abs=C1,Vr.add=E1,Vr.subtract=Ka,Vr.as=Pl,Vr.asMilliseconds=wi,Vr.asSeconds=Rl,Vr.asMinutes=T1,Vr.asHours=cu,Vr.asDays=F1,Vr.asWeeks=ql,Vr.asMonths=Jt,Vr.asQuarters=ic,Vr.asYears=kl,Vr.valueOf=Il,Vr._bubble=Wi,Vr.clone=Na,Vr.get=oc,Vr.milliseconds=Yi,Vr.seconds=Ll,Vr.minutes=dn,Vr.hours=sc,Vr.days=_1,Vr.weeks=uc,Vr.months=O1,Vr.years=B1,Vr.humanize=R1,Vr.toISOString=ds,Vr.toString=ds,Vr.toJSON=ds,Vr.locale=os,Vr.localeData=Sl,Vr.toIsoString=_("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ds),Vr.lang=ru,$("X",0,0,"unix"),$("x",0,0,"valueOf"),nr("x",Xt),nr("X",Ef),ot("X",function(g,A,I){I._d=new Date(parseFloat(g)*1e3)}),ot("x",function(g,A,I){I._d=new Date(Ke(g))});return r.version="2.29.4",t(yt),r.fn=Ve,r.min=Lx,r.max=zx,r.now=Ux,r.utc=d,r.unix=sa,r.months=Bl,r.isDate=o,r.locale=Va,r.invalid=w,r.duration=zr,r.isMoment=S,r.weekdays=M1,r.parseZone=N1,r.localeData=It,r.isDuration=oa,r.monthsShort=A1,r.weekdaysMin=ms,r.defineLocale=pn,r.updateLocale=Ox,r.locales=Bx,r.weekdaysShort=tc,r.normalizeUnits=ue,r.relativeTimeRounding=I1,r.relativeTimeThreshold=ps,r.calendarFormat=Kx,r.prototype=Ve,r.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},r})});function _a(e){return _a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_a(e)}function Sn(e){if(e===null||e===!0||e===!1)return NaN;var r=Number(e);return isNaN(r)?r:r<0?Math.ceil(r):Math.floor(r)}function nt(e,r){if(r.length1?"s":"")+" required, but only "+r.length+" present")}function Yt(e){nt(1,arguments);var r=Object.prototype.toString.call(e);return e instanceof Date||_a(e)==="object"&&r==="[object Date]"?new Date(e.getTime()):typeof e=="number"||r==="[object Number]"?new Date(e):((typeof e=="string"||r==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use \`parseISO\` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function xb(e,r){nt(2,arguments);var t=Yt(e).getTime(),n=Sn(r);return new Date(t+n)}var _q={};function Co(){return _q}function bb(e){var r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),e.getTime()-r.getTime()}var Oq=365.2425,Bq=Math.pow(10,8)*24*60*60*1e3,wb=6e4,Db=36e5;var nQ=-Bq;var Pq=3600;var sA=Pq*24,aQ=sA*7,Iq=sA*Oq,Rq=Iq/12,iQ=Rq*3;function Sb(e){return nt(1,arguments),e instanceof Date||_a(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Nb(e){if(nt(1,arguments),!Sb(e)&&typeof e!="number")return!1;var r=Yt(e);return!isNaN(Number(r))}function Ab(e,r){nt(2,arguments);var t=Sn(r);return xb(e,-t)}var qq=864e5;function Mb(e){nt(1,arguments);var r=Yt(e),t=r.getTime();r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0);var n=r.getTime(),a=t-n;return Math.floor(a/qq)+1}function Eo(e){nt(1,arguments);var r=1,t=Yt(e),n=t.getUTCDay(),a=(n=a.getTime()?t+1:r.getTime()>=s.getTime()?t:t-1}function Cb(e){nt(1,arguments);var r=hc(e),t=new Date(0);t.setUTCFullYear(r,0,4),t.setUTCHours(0,0,0,0);var n=Eo(t);return n}var kq=6048e5;function Eb(e){nt(1,arguments);var r=Yt(e),t=Eo(r).getTime()-Cb(r).getTime();return Math.round(t/kq)+1}function To(e,r){var t,n,a,i,s,l,c,o;nt(1,arguments);var u=Co(),m=Sn((t=(n=(a=(i=r?.weekStartsOn)!==null&&i!==void 0?i:r==null||(s=r.locale)===null||s===void 0||(l=s.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&a!==void 0?a:u.weekStartsOn)!==null&&n!==void 0?n:(c=u.locale)===null||c===void 0||(o=c.options)===null||o===void 0?void 0:o.weekStartsOn)!==null&&t!==void 0?t:0);if(!(m>=0&&m<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Yt(e),h=d.getUTCDay(),y=(h=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=new Date(0);y.setUTCFullYear(m+1,0,h),y.setUTCHours(0,0,0,0);var v=To(y,r),x=new Date(0);x.setUTCFullYear(m,0,h),x.setUTCHours(0,0,0,0);var w=To(x,r);return u.getTime()>=v.getTime()?m+1:u.getTime()>=w.getTime()?m:m-1}function Tb(e,r){var t,n,a,i,s,l,c,o;nt(1,arguments);var u=Co(),m=Sn((t=(n=(a=(i=r?.firstWeekContainsDate)!==null&&i!==void 0?i:r==null||(s=r.locale)===null||s===void 0||(l=s.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&a!==void 0?a:u.firstWeekContainsDate)!==null&&n!==void 0?n:(c=u.locale)===null||c===void 0||(o=c.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&t!==void 0?t:1),d=vc(e,r),h=new Date(0);h.setUTCFullYear(d,0,m),h.setUTCHours(0,0,0,0);var y=To(h,r);return y}var Lq=6048e5;function Fb(e,r){nt(1,arguments);var t=Yt(e),n=To(t,r).getTime()-Tb(t,r).getTime();return Math.round(n/Lq)+1}function st(e,r){for(var t=e<0?"-":"",n=Math.abs(e).toString();n.length0?n:1-n;return st(t==="yy"?a%100:a,t.length)},M:function(r,t){var n=r.getUTCMonth();return t==="M"?String(n+1):st(n+1,2)},d:function(r,t){return st(r.getUTCDate(),t.length)},a:function(r,t){var n=r.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h:function(r,t){return st(r.getUTCHours()%12||12,t.length)},H:function(r,t){return st(r.getUTCHours(),t.length)},m:function(r,t){return st(r.getUTCMinutes(),t.length)},s:function(r,t){return st(r.getUTCSeconds(),t.length)},S:function(r,t){var n=t.length,a=r.getUTCMilliseconds(),i=Math.floor(a*Math.pow(10,n-3));return st(i,t.length)}},Xi=zq;var vu={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Uq={G:function(r,t,n){var a=r.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(r,t,n){if(t==="yo"){var a=r.getUTCFullYear(),i=a>0?a:1-a;return n.ordinalNumber(i,{unit:"year"})}return Xi.y(r,t)},Y:function(r,t,n,a){var i=vc(r,a),s=i>0?i:1-i;if(t==="YY"){var l=s%100;return st(l,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):st(s,t.length)},R:function(r,t){var n=hc(r);return st(n,t.length)},u:function(r,t){var n=r.getUTCFullYear();return st(n,t.length)},Q:function(r,t,n){var a=Math.ceil((r.getUTCMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return st(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,t,n){var a=Math.ceil((r.getUTCMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return st(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,t,n){var a=r.getUTCMonth();switch(t){case"M":case"MM":return Xi.M(r,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(r,t,n){var a=r.getUTCMonth();switch(t){case"L":return String(a+1);case"LL":return st(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(r,t,n,a){var i=Fb(r,a);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):st(i,t.length)},I:function(r,t,n){var a=Eb(r);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):st(a,t.length)},d:function(r,t,n){return t==="do"?n.ordinalNumber(r.getUTCDate(),{unit:"date"}):Xi.d(r,t)},D:function(r,t,n){var a=Mb(r);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):st(a,t.length)},E:function(r,t,n){var a=r.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});case"EEEE":default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(r,t,n,a){var i=r.getUTCDay(),s=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return st(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(r,t,n,a){var i=r.getUTCDay(),s=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return st(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(r,t,n){var a=r.getUTCDay(),i=a===0?7:a;switch(t){case"i":return String(i);case"ii":return st(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(r,t,n){var a=r.getUTCHours(),i=a/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,t,n){var a=r.getUTCHours(),i;switch(a===12?i=vu.noon:a===0?i=vu.midnight:i=a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,t,n){var a=r.getUTCHours(),i;switch(a>=17?i=vu.evening:a>=12?i=vu.afternoon:a>=4?i=vu.morning:i=vu.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,t,n){if(t==="ho"){var a=r.getUTCHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return Xi.h(r,t)},H:function(r,t,n){return t==="Ho"?n.ordinalNumber(r.getUTCHours(),{unit:"hour"}):Xi.H(r,t)},K:function(r,t,n){var a=r.getUTCHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):st(a,t.length)},k:function(r,t,n){var a=r.getUTCHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):st(a,t.length)},m:function(r,t,n){return t==="mo"?n.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):Xi.m(r,t)},s:function(r,t,n){return t==="so"?n.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):Xi.s(r,t)},S:function(r,t){return Xi.S(r,t)},X:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return fA(s);case"XXXX":case"XX":return ys(s);case"XXXXX":case"XXX":default:return ys(s,":")}},x:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"x":return fA(s);case"xxxx":case"xx":return ys(s);case"xxxxx":case"xxx":default:return ys(s,":")}},O:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+uA(s,":");case"OOOO":default:return"GMT"+ys(s,":")}},z:function(r,t,n,a){var i=a._originalDate||r,s=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+uA(s,":");case"zzzz":default:return"GMT"+ys(s,":")}},t:function(r,t,n,a){var i=a._originalDate||r,s=Math.floor(i.getTime()/1e3);return st(s,t.length)},T:function(r,t,n,a){var i=a._originalDate||r,s=i.getTime();return st(s,t.length)}};function uA(e,r){var t=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),i=n%60;if(i===0)return t+String(a);var s=r||"";return t+String(a)+s+st(i,2)}function fA(e,r){if(e%60===0){var t=e>0?"-":"+";return t+st(Math.abs(e)/60,2)}return ys(e,r)}function ys(e,r){var t=r||"",n=e>0?"-":"+",a=Math.abs(e),i=st(Math.floor(a/60),2),s=st(a%60,2);return n+i+t+s}var cA=Uq;var lA=function(r,t){switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},mA=function(r,t){switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Wq=function(r,t){var n=r.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return lA(r,t);var s;switch(a){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",lA(a,t)).replace("{{time}}",mA(i,t))},Yq={p:mA,P:Wq},pA=Yq;var Hq=["D","DD"],$q=["YY","YYYY"];function dA(e){return Hq.indexOf(e)!==-1}function hA(e){return $q.indexOf(e)!==-1}function _b(e,r,t){if(e==="YYYY")throw new RangeError("Use \`yyyy\` instead of \`YYYY\` (in \`".concat(r,"\`) for formatting years to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use \`yy\` instead of \`YY\` (in \`".concat(r,"\`) for formatting years to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use \`d\` instead of \`D\` (in \`".concat(r,"\`) for formatting days of the month to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use \`dd\` instead of \`DD\` (in \`".concat(r,"\`) for formatting days of the month to the input \`").concat(t,"\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Gq={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Vq=function(r,t,n){var a,i=Gq[r];return typeof i=="string"?a=i:t===1?a=i.one:a=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},vA=Vq;function gc(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=r.width?String(r.width):e.defaultWidth,n=e.formats[t]||e.formats[e.defaultWidth];return n}}var Zq={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Qq={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Xq={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Jq={date:gc({formats:Zq,defaultWidth:"full"}),time:gc({formats:Qq,defaultWidth:"full"}),dateTime:gc({formats:Xq,defaultWidth:"full"})},gA=Jq;var Kq={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},jq=function(r,t,n,a){return Kq[r]},yA=jq;function xs(e){return function(r,t){var n=t!=null&&t.context?String(t.context):"standalone",a;if(n==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=t!=null&&t.width?String(t.width):i;a=e.formattingValues[s]||e.formattingValues[i]}else{var l=e.defaultWidth,c=t!=null&&t.width?String(t.width):e.defaultWidth;a=e.values[c]||e.values[l]}var o=e.argumentCallback?e.argumentCallback(r):r;return a[o]}}var ek={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},rk={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},tk={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},nk={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ak={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},ik={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ok=function(r,t){var n=Number(r),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},sk={ordinalNumber:ok,era:xs({values:ek,defaultWidth:"wide"}),quarter:xs({values:rk,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:xs({values:tk,defaultWidth:"wide"}),day:xs({values:nk,defaultWidth:"wide"}),dayPeriod:xs({values:ak,defaultWidth:"wide",formattingValues:ik,defaultFormattingWidth:"wide"})},xA=sk;function bs(e){return function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=r.match(a);if(!i)return null;var s=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?fk(l,function(m){return m.test(s)}):uk(l,function(m){return m.test(s)}),o;o=e.valueCallback?e.valueCallback(c):c,o=t.valueCallback?t.valueCallback(o):o;var u=r.slice(s.length);return{value:o,rest:u}}}function uk(e,r){for(var t in e)if(e.hasOwnProperty(t)&&r(e[t]))return t}function fk(e,r){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},n=r.match(e.matchPattern);if(!n)return null;var a=n[0],i=r.match(e.parsePattern);if(!i)return null;var s=e.valueCallback?e.valueCallback(i[0]):i[0];s=t.valueCallback?t.valueCallback(s):s;var l=r.slice(a.length);return{value:s,rest:l}}}var ck=/^(\\d+)(th|st|nd|rd)?/i,lk=/\\d+/i,mk={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},pk={any:[/^b/i,/^(a|c)/i]},dk={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hk={any:[/1/i,/2/i,/3/i,/4/i]},vk={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},gk={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},yk={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},xk={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},bk={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},wk={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Dk={ordinalNumber:Ob({matchPattern:ck,parsePattern:lk,valueCallback:function(r){return parseInt(r,10)}}),era:bs({matchPatterns:mk,defaultMatchWidth:"wide",parsePatterns:pk,defaultParseWidth:"any"}),quarter:bs({matchPatterns:dk,defaultMatchWidth:"wide",parsePatterns:hk,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:bs({matchPatterns:vk,defaultMatchWidth:"wide",parsePatterns:gk,defaultParseWidth:"any"}),day:bs({matchPatterns:yk,defaultMatchWidth:"wide",parsePatterns:xk,defaultParseWidth:"any"}),dayPeriod:bs({matchPatterns:bk,defaultMatchWidth:"any",parsePatterns:wk,defaultParseWidth:"any"})},bA=Dk;var Sk={code:"en-US",formatDistance:vA,formatLong:gA,formatRelative:yA,localize:xA,match:bA,options:{weekStartsOn:0,firstWeekContainsDate:1}},wA=Sk;var DA=wA;var Nk=/[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g,Ak=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Mk=/^'([^]*?)'?$/,Ck=/''/g,Ek=/[a-zA-Z]/;function Ai(e,r,t){var n,a,i,s,l,c,o,u,m,d,h,y,v,x,w,C,b,N;nt(2,arguments);var M=String(r),S=Co(),O=(n=(a=t?.locale)!==null&&a!==void 0?a:S.locale)!==null&&n!==void 0?n:DA,_=Sn((i=(s=(l=(c=t?.firstWeekContainsDate)!==null&&c!==void 0?c:t==null||(o=t.locale)===null||o===void 0||(u=o.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&l!==void 0?l:S.firstWeekContainsDate)!==null&&s!==void 0?s:(m=S.locale)===null||m===void 0||(d=m.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(_>=1&&_<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var E=Sn((h=(y=(v=(x=t?.weekStartsOn)!==null&&x!==void 0?x:t==null||(w=t.locale)===null||w===void 0||(C=w.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&v!==void 0?v:S.weekStartsOn)!==null&&y!==void 0?y:(b=S.locale)===null||b===void 0||(N=b.options)===null||N===void 0?void 0:N.weekStartsOn)!==null&&h!==void 0?h:0);if(!(E>=0&&E<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!O.localize)throw new RangeError("locale must contain localize property");if(!O.formatLong)throw new RangeError("locale must contain formatLong property");var T=Yt(e);if(!Nb(T))throw new RangeError("Invalid time value");var R=bb(T),L=Ab(T,R),H={firstWeekContainsDate:_,weekStartsOn:E,locale:O,_originalDate:T},V=M.match(Ak).map(function(W){var k=W[0];if(k==="p"||k==="P"){var q=pA[k];return q(W,O.formatLong)}return W}).join("").match(Nk).map(function(W){if(W==="''")return"'";var k=W[0];if(k==="'")return Tk(W);var q=cA[k];if(q)return!(t!=null&&t.useAdditionalWeekYearTokens)&&hA(W)&&_b(W,r,String(e)),!(t!=null&&t.useAdditionalDayOfYearTokens)&&dA(W)&&_b(W,r,String(e)),q(L,W,O.localize,H);if(k.match(Ek))throw new RangeError("Format string contains an unescaped latin alphabet character \`"+k+"\`");return W}).join("");return V}function Tk(e){var r=e.match(Mk);return r?r[1].replace(Ck,"'"):e}function Bb(e,r){if(_a(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(_a(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Pb(e){var r=Bb(e,"string");return _a(r)=="symbol"?r:r+""}function Hr(e,r,t){return r=Pb(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function om(e,r){var t;nt(1,arguments);var n=Sn((t=r?.additionalDigits)!==null&&t!==void 0?t:2);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var a=Bk(e),i;if(a.date){var s=Pk(a.date,n);i=Ik(s.restDateString,s.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var l=i.getTime(),c=0,o;if(a.time&&(c=Rk(a.time),isNaN(c)))return new Date(NaN);if(a.timezone){if(o=qk(a.timezone),isNaN(o))return new Date(NaN)}else{var u=new Date(l+c),m=new Date(0);return m.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),m.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),m}return new Date(l+c+o)}var im={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Fk=/^-?(?:(\\d{3})|(\\d{2})(?:-?(\\d{2}))?|W(\\d{2})(?:-?(\\d{1}))?|)$/,_k=/^(\\d{2}(?:[.,]\\d*)?)(?::?(\\d{2}(?:[.,]\\d*)?))?(?::?(\\d{2}(?:[.,]\\d*)?))?$/,Ok=/^([+-])(\\d{2})(?::?(\\d{2}))?$/;function Bk(e){var r={},t=e.split(im.dateTimeDelimiter),n;if(t.length>2)return r;if(/:/.test(t[0])?n=t[0]:(r.date=t[0],n=t[1],im.timeZoneDelimiter.test(r.date)&&(r.date=e.split(im.timeZoneDelimiter)[0],n=e.substr(r.date.length,e.length))),n){var a=im.timezone.exec(n);a?(r.time=n.replace(a[1],""),r.timezone=a[1]):r.time=n}return r}function Pk(e,r){var t=new RegExp("^(?:(\\\\d{4}|[+-]\\\\d{"+(4+r)+"})|(\\\\d{2}|[+-]\\\\d{"+(2+r)+"})$)"),n=e.match(t);if(!n)return{year:NaN,restDateString:""};var a=n[1]?parseInt(n[1]):null,i=n[2]?parseInt(n[2]):null;return{year:i===null?a:i*100,restDateString:e.slice((n[1]||n[2]).length)}}function Ik(e,r){if(r===null)return new Date(NaN);var t=e.match(Fk);if(!t)return new Date(NaN);var n=!!t[4],a=yc(t[1]),i=yc(t[2])-1,s=yc(t[3]),l=yc(t[4]),c=yc(t[5])-1;if(n)return Wk(r,l,c)?kk(r,l,c):new Date(NaN);var o=new Date(0);return!zk(r,i,s)||!Uk(r,a)?new Date(NaN):(o.setUTCFullYear(r,i,Math.max(a,s)),o)}function yc(e){return e?parseInt(e):1}function Rk(e){var r=e.match(_k);if(!r)return NaN;var t=Ib(r[1]),n=Ib(r[2]),a=Ib(r[3]);return Yk(t,n,a)?t*Db+n*wb+a*1e3:NaN}function Ib(e){return e&&parseFloat(e.replace(",","."))||0}function qk(e){if(e==="Z")return 0;var r=e.match(Ok);if(!r)return 0;var t=r[1]==="+"?-1:1,n=parseInt(r[2]),a=r[3]&&parseInt(r[3])||0;return Hk(n,a)?t*(n*Db+a*wb):NaN}function kk(e,r,t){var n=new Date(0);n.setUTCFullYear(e,0,4);var a=n.getUTCDay()||7,i=(r-1)*7+t+1-a;return n.setUTCDate(n.getUTCDate()+i),n}var Lk=[31,null,31,30,31,30,31,31,30,31,30,31];function SA(e){return e%400===0||e%4===0&&e%100!==0}function zk(e,r,t){return r>=0&&r<=11&&t>=1&&t<=(Lk[r]||(SA(e)?29:28))}function Uk(e,r){return r>=1&&r<=(SA(e)?366:365)}function Wk(e,r,t){return r>=1&&r<=53&&t>=0&&t<=6}function Yk(e,r,t){return e===24?r===0&&t===0:t>=0&&t<60&&r>=0&&r<60&&e>=0&&e<25}function Hk(e,r){return r>=0&&r<=59}var pa=e=>[...new Set(e)];var NA=(e,r)=>e.sort(function(t,n){let a=r.indexOf(t),i=r.indexOf(n);return a>i?a!=-1&&i==-1?-1:1:i!=-1&&a==-1?1:-1});var Xn="File";function sm(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}var AA=(e,r)=>r.indexOf(e)>0?r.indexOf(e):r.length;var xc=e=>"spaces://"+e;var MA=e=>e.charAt(0)=="/"?e.substring(1):e;var Rb=(e,r)=>{if(e instanceof Date)return"date";if(typeof e=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(e)||e.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(e))return"date";if(r=="tag"||r=="tags")return"tags-multi";if(/\\[\\[.*?\\]\\]/.test(e))return"link"}else{if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e)if(Array.isArray(e)||typeof e=="string"&&e.indexOf(",")>-1){let t=Array.isArray(e)?e:[];if(typeof e=="string"&&e.indexOf(",")>-1&&(t=gn(e)),r=="tag"||r=="tags")return"tags-multi";if(t.length==1&&Array.isArray(t[0])&&t[0].length==1&&typeof t[0][0]=="string")return"link";let n=pa(t.map(a=>Rb(a,r)));return n.length==1&&n[0]=="link"?"link-multi":n.some(a=>a=="object")?"object-multi":"option-multi"}else return e.isLuxonDateTime?"date":e.isLuxonDuration?"duration":e.type=="file"?"link":typeof e=="object"&&!Array.isArray(e)&&e!==null?"object":"unknown";else return"unknown"}return"text"};var qb=(e,r,t)=>e=="object"||e=="object-multi"?JSON.parse(r):e=="number"?parseFloat(r):e=="boolean"?r=="true":e.includes("-multi")?gn(r).map(n=>qb(e.replace("-multi",""),n,t)):(e.includes("link")||e.includes("context"))&&t?\`[[\${r}]]\`:r;var CA=e=>e.map(r=>r.replace(",","\\\\,")).join(", "),ws=e=>JSON.stringify(e);var gn=e=>e?.startsWith("[")?sm(bc(e)):$k(e),$k=e=>(e?.replace("\\\\,",",")?.match(/(\\\\.|[^,])+/g)??[]).map(r=>r.trim()),Ds=(e,r)=>{switch(Rb(r,e)){case"tags-multi":return r;case"object":case"object-multi":return JSON.stringify(r);case"number":return r.toString();case"boolean":return r?"true":"false";case"date":{if(r instanceof Date){let n=Ai(r,"yyyy-MM-dd");return typeof n=="string"?n:""}return typeof r!="string"?"":r}break;case"duration":return CA(Object.keys(r.values).reduce((n,a)=>[...n,...r.values[a]>0?[r.values[a]+" "+a]:[]],[]));case"option-multi":case"link-multi":return typeof r=="string"?wc(r):ws(r.map(n=>n?typeof n=="string"?wc(n):n.path?n.path:Array.isArray(r)&&n.length==1&&Array.isArray(n[0])&&n[0].length==1&&typeof n[0][0]=="string"?n[0][0]:JSON.stringify(n):""));case"link":return Array.isArray(r)&&r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string"?r[0][0]:typeof r=="string"?wc(r):r.path;case"text":case"tag":case"image":return r}return""};var bc=e=>{let r;try{r=JSON.parse(e)}catch{}return r};var wc=e=>{if(!e)return"";let r=/\\[\\[(.*?)\\]\\]/g.exec(e),t=r?.length>1?r[1].substring(0,AA("|",r[1])):e;return t||e};var yu=ma(um());var kb=e=>(0,yu.isNumber)(e)?new Date(e):(0,yu.isString)(e)?om(e):(0,yu.isDate)(e)?e:new Date;var EA=(e,r,t)=>{let n=e[0];if(!n.isSymbolNode||e.length!==3)return"";let a=n.name,i=e[1];return r.evaluate(\`\${a} = \${i.toString()}\`,t),e[2].compile().evaluate(t)};EA.rawArgs=!0;var TA=(e,r,t)=>{if(e.length%2!==1)return"";for(let a=0;a{if(e.length!==1)return"";let n=e.map(function(i){return i.compile().evaluate(t)});return t.get("$paths").get(n[0])};FA.rawArgs=!0;var _A=(e,r,t)=>t?.get("$current");_A.rawArgs=!0;var OA=(e,r,t)=>t?.get("$index");OA.rawArgs=!0;var BA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.find((a,i)=>{t.set("$current",a),t.set("$index",i),r.evaluate("current = _current(); index = _index()",t);let s=e[1].compile().evaluate?e[1].compile().evaluate(t):e[1];return a===s})??"":""};BA.rawArgs=!0;var PA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.findIndex((a,i)=>{t.set("$current",a),t.set("$index",i),r.evaluate("current = _current(); index = _index()",t);let s=e[1].compile().evaluate?e[1].compile().evaluate(t):e[1];return a===s}):""};PA.rawArgs=!0;var IA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.filter((a,i)=>(t.set("$current",a),t.set("$index",i),r.evaluate("current = _current(); index = _index()",t),e[1].compile().evaluate(t))):""};IA.rawArgs=!0;var RA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.map((a,i)=>(t.set("$current",a),t.set("$index",i),r.evaluate("current = _current(); index = _index()",t),e[1].compile().evaluate(t))):""};RA.rawArgs=!0;var qA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.some((a,i)=>(t.set("$current",a),t.set("$index",i),r.evaluate("current = _current(); index = _index()",t),e[1].compile().evaluate(t))):""};qA.rawArgs=!0;var kA=(e,r,t)=>{if(e.length!==2)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.every((a,i)=>(t.set("$current",a),t.set("$index",i),r.evaluate("current = _current(); index = _index()",t),e[1].compile().evaluate(t))):""};kA.rawArgs=!0;var LA=(e,r,t)=>{if(e.length!==1)return"";let n=e[0].compile().evaluate?e[0].compile().evaluate(t):e[0];return Array.isArray(n)?n.flat():""};LA.rawArgs=!0;var zA=(e,r,t)=>{if(e.length!==1)return"";let n=e.map(function(s){return s.compile().evaluate(t)}),a=t.get("$properties")?.[n[0]]?.type,i=qb(a,t.get(n[0]));return(a=="file"||a=="link"||a=="context")&&(a.includes("multi")?i=gn(i).map(s=>t.get("$paths").get(s)??s):i=t.get("$paths").get(i)??i),a=="date"&&(i=kb(i)),i??""};zA.rawArgs=!0;var UA=(e,r,t)=>{if((e.length-1)%2!==0)return"";for(let n=0;n{if(e.length<1||e.length>2)return"";let n=e[0].compile().evaluate(t);n instanceof Date||(n=new Date(n));let a=e[1]?.compile().evaluate(t);return a?.length>0?Ai(n,a):Ai(n,t.get("$settings")?.dateFormat??"yyyy-MM-dd")};WA.rawArgs=!0;var kn=e=>typeof e=="string"||e instanceof String?e:e instanceof Date?Ai(e,"yyyy-MM-dd"):typeof e=="number"?e.toFixed(0):e?.path?e.path:"",Lb={prop:zA,_current:_A,_index:OA,slice:(e,r,t)=>(e=kn(e),e.slice(r,t)),if:(e,r,t)=>e===!0?r:t,ifs:UA,empty:e=>e.length!==1?"":Array.isArray(e[0])?e[0].length===0:e[0]===""?"true":"false",length:e=>e.length,values:e=>e.flat().length,uniques:e=>pa(e.flat()).length,substring:(e,r,t)=>(e=kn(e),t?e.substring(r,t):e.substring(r)),startsWith:(e,r)=>(e=kn(e),r=kn(r),e.startsWith(r)),contains:(e,r)=>(e=kn(e),r=kn(r),e.includes(r)),test:(e,r)=>(e=kn(e),new RegExp(r).test(e)),match:(e,r)=>(e=kn(e),e.match(new RegExp(r))),replace:(e,r,t)=>(e=kn(e),e.replace(new RegExp(r),t)),replaceAll:(e,r,t)=>(e=kn(e),r=kn(r),t=kn(t),e.replace(new RegExp(r,"g"),t)),lower:e=>(e=kn(e),e.toLowerCase()),upper:e=>(e=kn(e),e.toUpperCase()),repeat:(e,r)=>e.repeat(r),format:kn,toNumber:e=>e instanceof Date?e.getTime():typeof e=="string"?parseFloat(e):e,now:()=>new Date,minute:e=>e.getMinutes(),hour:e=>e.getHours(),day:e=>e.getDay(),date:e=>e.getDate(),week:e=>Ai(e,"w"),month:e=>e.getMonth()+1,year:e=>e.getFullYear(),pad:(e,r,t)=>e.padStart(r,t),range:e=>Math.max(...e)-Math.min(...e),latest:e=>new Date(Math.max(...e.map(r=>r.getTime()))),earliest:e=>new Date(Math.min(...e.map(r=>r.getTime()))),dateRange:(e,r)=>{let t=Math.abs(Math.max(...e.map(n=>n.getTime()))-Math.min(...e.map(n=>n.getTime())));return r.startsWith("day")?t/(1e3*60*60*24):r.startsWith("month")?t/(1e3*60*60*24*30):r.startsWith("year")?t/(1e3*60*60*24*365):r.startsWith("hour")?t/(1e3*60*60):r.startsWith("minute")?t/(1e3*60):r.startsWith("second")?t/1e3:r.startsWith("week")?t/(1e3*60*60*24*7):r.startsWith("quarter")?t/(1e3*60*60*24*30*3):t/(1e3*60*60*24)},dateAdd:(e,r,t)=>(t.startsWith("day")&&e.setDate(e.getDate()+r),t.startsWith("month")&&e.setMonth(e.getMonth()+r),t.startsWith("year")&&e.setFullYear(e.getFullYear()+r),t.startsWith("quarter")&&e.setMonth(e.getMonth()+r*3),t.startsWith("week")&&e.setDate(e.getDate()+r*7),t.startsWith("hour")&&e.setHours(e.getHours()+r),t.startsWith("minute")&&e.setMinutes(e.getMinutes()+r),t.startsWith("second")&&e.setSeconds(e.getSeconds()+r),e),dateSubtract:(e,r,t)=>(t.startsWith("day")&&e.setDate(e.getDate()-r),t.startsWith("month")&&e.setMonth(e.getMonth()-r),t.startsWith("year")&&e.setFullYear(e.getFullYear()-r),t.startsWith("quarter")&&e.setMonth(e.getMonth()-r*3),t.startsWith("week")&&e.setDate(e.getDate()-r*7),t.startsWith("hour")&&e.setHours(e.getHours()-r),t.startsWith("minute")&&e.setMinutes(e.getMinutes()-r),t.startsWith("second")&&e.setSeconds(e.getSeconds()-r),e),dateBetween:(e,r,t)=>{let s=Math.abs(r.getTime()-e.getTime());switch(t){case"days":return Math.round(s/864e5);case"months":return Math.round(s/2592e6);case"years":return Math.round(s/31536e6);case"hours":return Math.round(s/(60*60*1e3));case"minutes":return Math.round(s/(60*1e3));case"seconds":return Math.round(s/1e3);case"weeks":return Math.round(s/(864e5*7));case"quarters":return Math.round(s/(2592e6*3));default:return Math.round(s/864e5)}},style:(e,r)=>e,timeStamp:e=>e.getTime(),at:(e,r)=>e[r],first:e=>e[0],last:e=>e[e.length-1],concat:(e,r)=>e.concat(r),sort:e=>e.sort((r,t)=>t-r),reverse:e=>e.reverse(),join:(e,r)=>e.join(r),includes:(e,r)=>e.includes(r),split:(e,r)=>e.split(r),formatDate:WA,parseDate:e=>kb(e),find:BA,findIndex:PA,filter:IA,map:RA,some:qA,every:kA,flat:LA,path:FA,let:EA,lets:TA};function ht(){return ht=Object.assign?Object.assign.bind():function(e){for(var r=1;re[r])}var Dm=["Matrix","Array"],Sm=["number","BigNumber","Fraction"];function ZA(e,r){function t(n){if(n){var a=wu(e,ar);VA(n,"matrix",Dm),VA(n,"number",Sm),zb(e,n);var i=wu(e,ar),s=wu(n,ar);return r("config",i,a,s),i}else return wu(e,ar)}return t.MATRIX_OPTIONS=Dm,t.NUMBER_OPTIONS=Sm,Object.keys(Ss).forEach(n=>{Object.defineProperty(t,n,{get:()=>e[n],enumerable:!0,configurable:!0})}),t}function Gk(e,r){return e.indexOf(r)!==-1}function VA(e,r,t){e[r]!==void 0&&!Gk(t,e[r])&&console.warn('Warning: Unknown value "'+e[r]+'" for configuration option "'+r+'". Available options: '+t.map(n=>JSON.stringify(n)).join(", ")+".")}var Oe=function(r){if(r)throw new Error(\`The global config is readonly. Please create a mathjs instance if you want to change the default configuration. Example: import { create, all } from 'mathjs'; const mathjs = create(all); mathjs.config({ number: 'BigNumber' }); -\`);return Object.freeze(Ss)};ht(Oe,Ss,{MATRIX_OPTIONS:Sm,NUMBER_OPTIONS:Nm});var ID={};Eq(ID,{createAbs:()=>Ap,createAccessorNode:()=>Sv,createAcos:()=>Oh,createAcosh:()=>Bh,createAcot:()=>Ph,createAcoth:()=>Ih,createAcsc:()=>Rh,createAcsch:()=>qh,createAdd:()=>pv,createAddScalar:()=>Cp,createAnd:()=>ju,createAndTransform:()=>Uy,createApply:()=>Lo,createApplyTransform:()=>wy,createArg:()=>jp,createArrayNode:()=>Av,createAsec:()=>kh,createAsech:()=>Lh,createAsin:()=>zh,createAsinh:()=>Uh,createAssignmentNode:()=>Tv,createAtan:()=>Wh,createAtan2:()=>Yh,createAtanh:()=>Hh,createAtomicMass:()=>j0,createAvogadro:()=>ey,createBellNumbers:()=>Gg,createBigNumberClass:()=>Hm,createBignumber:()=>hp,createBin:()=>Id,createBitAnd:()=>ku,createBitAndTransform:()=>Yy,createBitNot:()=>Jp,createBitOr:()=>Lu,createBitOrTransform:()=>Hy,createBitXor:()=>Kp,createBlockNode:()=>_v,createBohrMagneton:()=>B0,createBohrRadius:()=>L0,createBoltzmann:()=>ry,createBoolean:()=>dp,createCatalan:()=>Vg,createCbrt:()=>Tp,createCeil:()=>Fp,createChain:()=>vg,createChainClass:()=>dg,createClassicalElectronRadius:()=>z0,createClone:()=>Jm,createColumn:()=>Wu,createColumnTransform:()=>Dy,createCombinations:()=>Bg,createCombinationsWithRep:()=>Pg,createCompare:()=>ah,createCompareNatural:()=>ih,createCompareText:()=>oh,createCompile:()=>tg,createComplex:()=>vp,createComplexClass:()=>$m,createComposition:()=>Zg,createConcat:()=>Uu,createConcatTransform:()=>By,createConditionalNode:()=>Bv,createConductanceQuantum:()=>P0,createConj:()=>ed,createConstantNode:()=>qv,createCorr:()=>Og,createCos:()=>$h,createCosh:()=>Gh,createCot:()=>Vh,createCoth:()=>Zh,createCoulomb:()=>_0,createCount:()=>id,createCreateUnit:()=>_h,createCross:()=>od,createCsc:()=>Qh,createCsch:()=>Xh,createCtranspose:()=>Ad,createCube:()=>_p,createCumSum:()=>af,createCumSumTransform:()=>ky,createDeepEqual:()=>yh,createDenseMatrixClass:()=>Xm,createDerivative:()=>r0,createDet:()=>gg,createDeuteronMass:()=>G0,createDiag:()=>sd,createDiff:()=>Yu,createDiffTransform:()=>Py,createDistance:()=>Cg,createDivide:()=>Mg,createDivideScalar:()=>Wd,createDot:()=>vv,createDotDivide:()=>Qd,createDotMultiply:()=>Qp,createDotPow:()=>Zd,createE:()=>d0,createEfimovFactor:()=>K0,createEigs:()=>bg,createElectricConstant:()=>T0,createElectronMass:()=>U0,createElementaryCharge:()=>O0,createEqual:()=>uh,createEqualScalar:()=>cp,createEqualText:()=>fh,createErf:()=>Fd,createEvaluate:()=>ng,createExp:()=>Op,createExpm:()=>wg,createExpm1:()=>Bp,createFactorial:()=>qg,createFalse:()=>u0,createFaraday:()=>ty,createFermiCoupling:()=>W0,createFft:()=>Cd,createFibonacciHeapClass:()=>Ah,createFilter:()=>ud,createFilterTransform:()=>Sy,createFineStructure:()=>Y0,createFirstRadiation:()=>ny,createFix:()=>Pp,createFlatten:()=>fd,createFloor:()=>Pu,createForEach:()=>cd,createForEachTransform:()=>Ny,createFormat:()=>Pd,createFraction:()=>gp,createFractionClass:()=>Gm,createFreqz:()=>a0,createFunctionAssignmentNode:()=>Lv,createFunctionNode:()=>eg,createGamma:()=>Ig,createGasConstant:()=>iy,createGcd:()=>Ip,createGetMatrixDataType:()=>ld,createGravitationConstant:()=>A0,createGravity:()=>dy,createHartreeEnergy:()=>H0,createHasNumericValue:()=>ap,createHelp:()=>hg,createHelpClass:()=>pg,createHex:()=>qd,createHypot:()=>dv,createI:()=>D0,createIdentity:()=>md,createIfft:()=>Ed,createIm:()=>rd,createImmutableDenseMatrixClass:()=>Sh,createIndex:()=>yv,createIndexClass:()=>Nh,createIndexNode:()=>Uv,createIndexTransform:()=>Ay,createInfinity:()=>c0,createIntersect:()=>Eg,createInv:()=>yg,createInverseConductanceQuantum:()=>I0,createInvmod:()=>Vp,createIsInteger:()=>ep,createIsNaN:()=>sp,createIsNegative:()=>tp,createIsNumeric:()=>np,createIsPositive:()=>ip,createIsPrime:()=>zd,createIsZero:()=>op,createKldivergence:()=>kg,createKlitzing:()=>k0,createKron:()=>pd,createLN10:()=>g0,createLN2:()=>v0,createLOG10E:()=>x0,createLOG2E:()=>y0,createLarger:()=>hh,createLargerEq:()=>gh,createLcm:()=>Rp,createLeafCount:()=>Qg,createLeftShift:()=>eh,createLgamma:()=>Rg,createLog:()=>$d,createLog10:()=>qp,createLog1p:()=>Gd,createLog2:()=>kp,createLoschmidt:()=>ay,createLsolve:()=>Xd,createLsolveAll:()=>Kd,createLup:()=>og,createLusolve:()=>lg,createLyap:()=>Ag,createMad:()=>_g,createMagneticConstant:()=>E0,createMagneticFluxQuantum:()=>R0,createMap:()=>dd,createMapTransform:()=>My,createMatrix:()=>yp,createMatrixClass:()=>Zm,createMatrixFromColumns:()=>wp,createMatrixFromFunction:()=>xp,createMatrixFromRows:()=>bp,createMax:()=>ef,createMaxTransform:()=>Cy,createMean:()=>of,createMeanTransform:()=>Ey,createMedian:()=>Fg,createMin:()=>rf,createMinTransform:()=>Ty,createMod:()=>Iu,createMode:()=>Od,createMolarMass:()=>my,createMolarMassC12:()=>py,createMolarPlanckConstant:()=>oy,createMolarVolume:()=>sy,createMultinomial:()=>Lg,createMultiply:()=>zp,createMultiplyScalar:()=>Lp,createNaN:()=>l0,createNeutronMass:()=>V0,createNode:()=>bv,createNorm:()=>hv,createNot:()=>nd,createNthRoot:()=>Up,createNthRoots:()=>Vd,createNuclearMagneton:()=>q0,createNull:()=>f0,createNumber:()=>mp,createNumeric:()=>Ud,createObjectNode:()=>Yv,createOct:()=>Rd,createOnes:()=>hd,createOperatorNode:()=>$v,createOr:()=>zu,createOrTransform:()=>Wy,createParenthesisNode:()=>Vv,createParse:()=>rg,createParser:()=>ig,createParserClass:()=>ag,createPartitionSelect:()=>wh,createPermutations:()=>zg,createPhi:()=>h0,createPi:()=>m0,createPickRandom:()=>Wg,createPinv:()=>xg,createPlanckCharge:()=>yy,createPlanckConstant:()=>M0,createPlanckLength:()=>hy,createPlanckMass:()=>vy,createPlanckTemperature:()=>xy,createPlanckTime:()=>gy,createPolynomialRoot:()=>mg,createPow:()=>Yd,createPrint:()=>Qu,createPrintTransform:()=>zy,createProd:()=>Bd,createProtonMass:()=>$0,createQr:()=>sg,createQuantileSeq:()=>uf,createQuantileSeqTransform:()=>qy,createQuantumOfCirculation:()=>Z0,createRandom:()=>Yg,createRandomInt:()=>Hg,createRange:()=>$u,createRangeClass:()=>Vm,createRangeNode:()=>Qv,createRangeTransform:()=>Fy,createRationalize:()=>t0,createRe:()=>td,createReducedPlanckConstant:()=>C0,createRelationalNode:()=>Jv,createReplacer:()=>o0,createReshape:()=>yd,createResize:()=>xd,createResolve:()=>jg,createResultSet:()=>Rm,createReviver:()=>i0,createRightArithShift:()=>rh,createRightLogShift:()=>th,createRotate:()=>bd,createRotationMatrix:()=>wd,createRound:()=>Hd,createRow:()=>Gu,createRowTransform:()=>_y,createRydberg:()=>Q0,createSQRT1_2:()=>b0,createSQRT2:()=>w0,createSackurTetrode:()=>uy,createSchur:()=>Ng,createSec:()=>Jh,createSech:()=>Kh,createSecondRadiation:()=>fy,createSetCartesian:()=>nv,createSetDifference:()=>av,createSetDistinct:()=>iv,createSetIntersect:()=>ov,createSetIsSubset:()=>sv,createSetMultiplicity:()=>uv,createSetPowerset:()=>fv,createSetSize:()=>cv,createSetSymDifference:()=>lv,createSetUnion:()=>mv,createSign:()=>Wp,createSimplify:()=>Xg,createSimplifyConstant:()=>Jg,createSimplifyCore:()=>Kg,createSin:()=>jh,createSinh:()=>ev,createSize:()=>Dd,createSlu:()=>cg,createSmaller:()=>lh,createSmallerEq:()=>ph,createSolveODE:()=>Td,createSort:()=>Dh,createSpaClass:()=>Mh,createSparse:()=>Fh,createSparseMatrixClass:()=>lp,createSpeedOfLight:()=>N0,createSplitUnit:()=>Dp,createSqrt:()=>Yp,createSqrtm:()=>Dg,createSquare:()=>Hp,createSqueeze:()=>Sd,createStd:()=>ff,createStdTransform:()=>Iy,createStefanBoltzmann:()=>cy,createStirlingS2:()=>$g,createString:()=>pp,createSubset:()=>Vu,createSubsetTransform:()=>Oy,createSubtract:()=>$p,createSubtractScalar:()=>Ep,createSum:()=>nf,createSumTransform:()=>Ry,createSylvester:()=>Sg,createSymbolNode:()=>Kv,createSymbolicEqual:()=>e0,createTan:()=>rv,createTanh:()=>tv,createTau:()=>p0,createThomsonCrossSection:()=>X0,createTo:()=>Ld,createTrace:()=>gv,createTranspose:()=>Nd,createTrue:()=>s0,createTypeOf:()=>up,createTyped:()=>Im,createUnaryMinus:()=>Sp,createUnaryPlus:()=>Np,createUnequal:()=>bh,createUnitClass:()=>Eh,createUnitFunction:()=>Th,createUppercaseE:()=>hP,createUppercasePi:()=>dP,createUsolve:()=>Jd,createUsolveAll:()=>jd,createVacuumImpedance:()=>F0,createVariance:()=>sf,createVarianceTransform:()=>Ly,createVersion:()=>S0,createWeakMixingAngle:()=>J0,createWienDisplacement:()=>ly,createXgcd:()=>Gp,createXor:()=>ad,createZeros:()=>Md,createZeta:()=>_d,createZpk2tf:()=>n0});var iw=ma(Am(),1);function Ze(e){return typeof e=="boolean"?!0:isFinite(e)?e===Math.round(e):!1}var Ba=Math.sign||function(e){return e>0?1:e<0?-1:0},XA=Math.log2||function(r){return Math.log(r)/Math.LN2},JA=Math.log10||function(r){return Math.log(r)/Math.LN10},Mm=Math.log1p||function(e){return Math.log(e+1)},KA=Math.cbrt||function(r){if(r===0)return r;var t=r<0,n;return t&&(r=-r),isFinite(r)?(n=Math.exp(Math.log(r)/3),n=(r/(n*n)+2*n)/3):n=r,t?-n:n},jA=Math.expm1||function(r){return r>=2e-4||r<=-2e-4?Math.exp(r)-1:r+r*r/2+r*r*r/6};function $b(e,r,t){var n={2:"0b",8:"0o",16:"0x"},a=n[r],i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Ze(t))throw new Error("size must be an integer");if(e>2**(t-1)-1||e<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!Ze(e))throw new Error("Value must be an integer");e<0&&(e=e+2**t),i="i".concat(t)}var u="";return e<0&&(e=-e,u="-"),"".concat(u).concat(a).concat(e.toString(r)).concat(i)}function ai(e,r){if(typeof r=="function")return r(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:t,precision:n,wordSize:a}=Gb(r);switch(t){case"fixed":return Vb(e,n);case"exponential":return eM(e,n);case"engineering":return Gk(e,n);case"bin":return $b(e,2,a);case"oct":return $b(e,8,a);case"hex":return $b(e,16,a);case"auto":return Vk(e,n,r).replace(/((\\.\\d*?)(0+))($|e)/,function(){var i=arguments[2],u=arguments[4];return i!=="."?i+u:u});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Gb(e){var r="auto",t,n;if(e!==void 0)if(sr(e))t=e;else if(rr(e))t=e.toNumber();else if(Ci(e))e.precision!==void 0&&(t=ZA(e.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),e.wordSize!==void 0&&(n=ZA(e.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(r=e.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:r,precision:t,wordSize:n}}function Nu(e){var r=String(e).toLowerCase().match(/^(-?)(\\d+\\.?\\d*)(e([+-]?\\d+))?$/);if(!r)throw new SyntaxError("Invalid number "+e);var t=r[1],n=r[2],a=parseFloat(r[4]||"0"),i=n.indexOf(".");a+=i!==-1?i-1:n.length-1;var u=n.replace(".","").replace(/^0*/,function(l){return a-=l.length,""}).replace(/0*$/,"").split("").map(function(l){return parseInt(l)});return u.length===0&&(u.push(0),a++),{sign:t,coefficients:u,exponent:a}}function Gk(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=Nu(e),n=Cm(t,r),a=n.exponent,i=n.coefficients,u=a%3===0?a:a<0?a-3-a%3:a-a%3;if(sr(r))for(;r>i.length||a-u+1>i.length;)i.push(0);else for(var l=Math.abs(a-u)-(i.length-1),c=0;c0;)s++,o--;var m=i.slice(s).join(""),d=sr(r)&&m.length||m.match(/[1-9]/)?"."+m:"",h=i.slice(0,s).join("")+d+"e"+(a>=0?"+":"")+u.toString();return n.sign+h}function Vb(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=Nu(e),n=typeof r=="number"?Cm(t,t.exponent+1+r):t,a=n.coefficients,i=n.exponent+1,u=i+(r||0);return a.length0?"."+a.join(""):"")+"e"+(i>=0?"+":"")+i}function Vk(e,r,t){if(isNaN(e)||!isFinite(e))return String(e);var n=QA(t?.lowerExp,-3),a=QA(t?.upperExp,5),i=Nu(e),u=r?Cm(i,r):i;if(u.exponent=a)return eM(e,r);var l=u.coefficients,c=u.exponent;l.length0?c:0;return or){var a=n.splice(r,n.length-r);if(a[0]>=5){var i=r-1;for(n[i]++;n[i]===10;)n.pop(),i===0&&(n.unshift(0),t.exponent++,i++),i--,n[i]++}}return t}function Su(e){for(var r=[],t=0;t0?!0:e<0?!1:1/e===1/0,n=r>0?!0:r<0?!1:1/r===1/0;return t^n?-e:e}function ZA(e,r){if(sr(e))return e;if(rr(e))return e.toNumber();r()}function QA(e,r){return sr(e)?e:rr(e)?e.toNumber():r}function Zb(e,r,t){var n=e.constructor,a=new n(2),i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Ze(t))throw new Error("size must be an integer");if(e.greaterThan(a.pow(t-1).sub(1))||e.lessThan(a.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(a.pow(t))),i="i".concat(t)}switch(r){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(r," not supported "))}}function fM(e,r){if(typeof r=="function")return r(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:n,wordSize:a}=Gb(r);switch(t){case"fixed":return Xk(e,n);case"exponential":return sM(e,n);case"engineering":return Qk(e,n);case"bin":return Zb(e,2,a);case"oct":return Zb(e,8,a);case"hex":return Zb(e,16,a);case"auto":{var i=uM(r?.lowerExp,-3),u=uM(r?.upperExp,5);if(e.isZero())return"0";var l,c=e.toSignificantDigits(n),o=c.e;return o>=i&&o=0?"+":"")+n.toString()}function sM(e,r){return r!==void 0?e.toExponential(r-1):e.toExponential()}function Xk(e,r){return e.toFixed(r)}function uM(e,r){return sr(e)?e:rr(e)?e.toNumber():r}function lM(e,r){var t=e.length-r.length,n=e.length;return e.substring(t,n)===r}function lr(e,r){var t=Jk(e,r);return r&&typeof r=="object"&&"truncate"in r&&t.length>r.truncate?t.substring(0,r.truncate-3)+"...":t}function Jk(e,r){if(typeof e=="number")return ai(e,r);if(rr(e))return fM(e,r);if(Kk(e))return!r||r.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return mM(e,r);if(St(e))return Ns(e);if(typeof e=="function")return e.syntax?String(e.syntax):"function";if(e&&typeof e=="object"){if(typeof e.format=="function")return e.format(r);if(e&&e.toString(r)!=={}.toString())return e.toString(r);var t=Object.keys(e).map(n=>Ns(n)+": "+lr(e[n],r));return"{"+t.join(", ")+"}"}return String(e)}function Ns(e){for(var r=String(e),t="",n=0;n/g,">"),r}function mM(e,r){if(Array.isArray(e)){for(var t="[",n=e.length,a=0;ar?1:-1}function pr(e,r,t){if(!(this instanceof pr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=r,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=new Error().stack}pr.prototype=new RangeError;pr.prototype.constructor=RangeError;pr.prototype.name="DimensionError";pr.prototype.isDimensionError=!0;function tn(e,r,t){if(!(this instanceof tn))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=r):(this.min=r,this.max=t),this.min!==void 0&&this.index=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}tn.prototype=new RangeError;tn.prototype.constructor=RangeError;tn.prototype.name="IndexError";tn.prototype.isIndexError=!0;function ur(e){for(var r=[];Array.isArray(e);)r.push(e.length),e=e[0];return r}function pM(e,r,t){var n,a=e.length;if(a!==r[t])throw new pr(a,r[t]);if(t")}function Xb(e,r){var t=r.length===0;if(t){if(Array.isArray(e))throw new pr(e.length,0)}else pM(e,r,0)}function Nc(e,r){var t=e.isMatrix?e._size:ur(e),n=r._sourceSize;n.forEach((a,i)=>{if(a!==null&&a!==t[i])throw new pr(a,t[i])})}function Kr(e,r){if(e!==void 0){if(!sr(e)||!Ze(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof r=="number"&&e>=r)throw new tn(e,r)}}function As(e){for(var r=0;r=0,c=r%t===0;if(l)if(c)n[i]=-r/t;else throw new Error("Could not replace wildcard, since "+r+" is no multiple of "+-t);return n}function dM(e){return e.reduce((r,t)=>r*t,1)}function jk(e,r){for(var t=e,n,a=r.length-1;a>0;a--){var i=r[a];n=[];for(var u=t.length/i,l=0;lr.test(t))}function Jb(e,r){return Array.prototype.join.call(e,r)}function Ki(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(e.length===0)return e;var r=[],t=0;r[0]={value:e[0],identifier:0};for(var n=1;n1)return e.slice(1).reduce(function(t,n){return gM(t,n,r,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function eL(){for(var e=arguments.length,r=new Array(e),t=0;td.length),a=Math.max(...n),i=new Array(a).fill(null),u=0;ui[s]&&(i[s]=l[o])}for(var m=0;m1||e[a]>r[i])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[a]," to size ").concat(r[i]))}}function ew(e,r){var t=ur(e);if(ni(t,r))return e;Cc(t,r);var n=eL(t,r),a=n.length,i=[...Array(a-t.length).fill(1),...t],u=tL(e);t.length!aL(i)).every(i=>t[i]!==void 0);if(!n){var a=r.filter(i=>t[i]===void 0);throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(a.map(i=>'"'.concat(i,'"')).join(", "),"."))}}function aL(e){return e&&e[0]==="?"}function rw(e){return e&&e[0]==="?"?e.slice(1):e}function wt(e,r){if(wM(e)&&xM(e,r))return e[r];throw typeof e[r]=="function"&&Bm(e,r)?new Error('Cannot access method "'+r+'" as a property'):new Error('No access to property "'+r+'"')}function Ti(e,r,t){if(wM(e)&&xM(e,r))return e[r]=t,t;throw new Error('No access to property "'+r+'"')}function yM(e,r){return r in e}function xM(e,r){return!e||typeof e!="object"?!1:Xe(iL,r)?!0:!(r in Object.prototype||r in Function.prototype)}function bM(e,r){if(!Bm(e,r))throw new Error('No access to method "'+r+'"');return e[r]}function Bm(e,r){return e==null||typeof e[r]!="function"||Xe(e,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(e)?!1:Xe(oL,r)?!0:!(r in Object.prototype||r in Function.prototype)}function wM(e){return typeof e=="object"&&e&&e.constructor===Object}var iL={length:!0,name:!0},oL={toString:!0,valueOf:!0,toLocaleString:!0};var Cs=class{constructor(r){this.wrappedObject=r,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(r){return wt(this.wrappedObject,r)}set(r,t){return Ti(this.wrappedObject,r,t),this}has(r){return yM(this.wrappedObject,r)}entries(){return DM(this.keys(),r=>[r,this.get(r)])}forEach(r){for(var t of this.keys())r(this.get(t),t,this)}delete(r){delete this.wrappedObject[r]}clear(){for(var r of this.keys())this.delete(r)}get size(){return Object.keys(this.wrappedObject).length}},Eu=class{constructor(r,t,n){this.a=r,this.b=t,this.bKeys=n,this[Symbol.iterator]=this.entries}get(r){return this.bKeys.has(r)?this.b.get(r):this.a.get(r)}set(r,t){return this.bKeys.has(r)?this.b.set(r,t):this.a.set(r,t),this}has(r){return this.b.has(r)||this.a.has(r)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return DM(this.keys(),r=>[r,this.get(r)])}forEach(r){for(var t of this.keys())r(this.get(t),t,this)}delete(r){return this.bKeys.has(r)?this.b.delete(r):this.a.delete(r)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function DM(e,r){return{next:()=>{var t=e.next();return t.done?t:{value:r(t.value),done:!1}}}}function Bo(){return new Map}function ji(e){if(!e)return Bo();if(tw(e))return e;if(Ci(e))return new Cs(e);throw new Error("createMap can create maps from objects or Maps")}function SM(e){if(e instanceof Cs)return e.wrappedObject;var r={};for(var t of e.keys()){var n=e.get(t);Ti(r,t,n)}return r}function tw(e){return e?e instanceof Map||e instanceof Cs||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}var NM=function(){return NM=iw.default.create,iw.default},sL=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Im=F("typed",sL,function(r){var{BigNumber:t,Complex:n,DenseMatrix:a,Fraction:i}=r,u=NM();return u.clear(),u.addTypes([{name:"number",test:sr},{name:"Complex",test:Kt},{name:"BigNumber",test:rr},{name:"Fraction",test:da},{name:"Unit",test:Ht},{name:"identifier",test:l=>St&&/^(?:[A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088E\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5D\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7CA\\uA7D0\\uA7D1\\uA7D3\\uA7D5-\\uA7D9\\uA7F2-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF2D-\\uDF40\\uDF42-\\uDF49\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDD70-\\uDD7A\\uDD7C-\\uDD8A\\uDD8C-\\uDD92\\uDD94\\uDD95\\uDD97-\\uDDA1\\uDDA3-\\uDDB1\\uDDB3-\\uDDB9\\uDDBB\\uDDBC\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67\\uDF80-\\uDF85\\uDF87-\\uDFB0\\uDFB2-\\uDFBA]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDD00-\\uDD23\\uDE80-\\uDEA9\\uDEB0\\uDEB1\\uDF00-\\uDF1C\\uDF27\\uDF30-\\uDF45\\uDF70-\\uDF81\\uDFB0-\\uDFC4\\uDFE0-\\uDFF6]|\\uD804[\\uDC03-\\uDC37\\uDC71\\uDC72\\uDC75\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD44\\uDD47\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE3F\\uDE40\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC5F-\\uDC61\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDEB8\\uDF00-\\uDF1A\\uDF40-\\uDF46]|\\uD806[\\uDC00-\\uDC2B\\uDCA0-\\uDCDF\\uDCFF-\\uDD06\\uDD09\\uDD0C-\\uDD13\\uDD15\\uDD16\\uDD18-\\uDD2F\\uDD3F\\uDD41\\uDDA0-\\uDDA7\\uDDAA-\\uDDD0\\uDDE1\\uDDE3\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE89\\uDE9D\\uDEB0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46\\uDD60-\\uDD65\\uDD67\\uDD68\\uDD6A-\\uDD89\\uDD98\\uDEE0-\\uDEF2\\uDF02\\uDF04-\\uDF10\\uDF12-\\uDF33\\uDFB0]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|\\uD80B[\\uDF90-\\uDFF0]|[\\uD80C\\uD81C-\\uD820\\uD822\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD887][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2F\\uDC41-\\uDC46]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDE40-\\uDE7F\\uDF00-\\uDF4A\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1\\uDFE3]|\\uD821[\\uDC00-\\uDFF7]|\\uD823[\\uDC00-\\uDCD5\\uDD00-\\uDD08]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD32\\uDD50-\\uDD52\\uDD55\\uDD64-\\uDD67\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD837[\\uDF00-\\uDF1E\\uDF25-\\uDF2A]|\\uD838[\\uDC30-\\uDC6D\\uDD00-\\uDD2C\\uDD37-\\uDD3D\\uDD4E\\uDE90-\\uDEAD\\uDEC0-\\uDEEB]|\\uD839[\\uDCD0-\\uDCEB\\uDFE0-\\uDFE6\\uDFE8-\\uDFEB\\uDFED\\uDFEE\\uDFF0-\\uDFFE]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43\\uDD4B]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF39\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD888[\\uDC00-\\uDFAF])(?:[0-9A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088E\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5D\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7CA\\uA7D0\\uA7D1\\uA7D3\\uA7D5-\\uA7D9\\uA7F2-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF2D-\\uDF40\\uDF42-\\uDF49\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDD70-\\uDD7A\\uDD7C-\\uDD8A\\uDD8C-\\uDD92\\uDD94\\uDD95\\uDD97-\\uDDA1\\uDDA3-\\uDDB1\\uDDB3-\\uDDB9\\uDDBB\\uDDBC\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67\\uDF80-\\uDF85\\uDF87-\\uDFB0\\uDFB2-\\uDFBA]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDD00-\\uDD23\\uDE80-\\uDEA9\\uDEB0\\uDEB1\\uDF00-\\uDF1C\\uDF27\\uDF30-\\uDF45\\uDF70-\\uDF81\\uDFB0-\\uDFC4\\uDFE0-\\uDFF6]|\\uD804[\\uDC03-\\uDC37\\uDC71\\uDC72\\uDC75\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD44\\uDD47\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE3F\\uDE40\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC5F-\\uDC61\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDEB8\\uDF00-\\uDF1A\\uDF40-\\uDF46]|\\uD806[\\uDC00-\\uDC2B\\uDCA0-\\uDCDF\\uDCFF-\\uDD06\\uDD09\\uDD0C-\\uDD13\\uDD15\\uDD16\\uDD18-\\uDD2F\\uDD3F\\uDD41\\uDDA0-\\uDDA7\\uDDAA-\\uDDD0\\uDDE1\\uDDE3\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE89\\uDE9D\\uDEB0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46\\uDD60-\\uDD65\\uDD67\\uDD68\\uDD6A-\\uDD89\\uDD98\\uDEE0-\\uDEF2\\uDF02\\uDF04-\\uDF10\\uDF12-\\uDF33\\uDFB0]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|\\uD80B[\\uDF90-\\uDFF0]|[\\uD80C\\uD81C-\\uD820\\uD822\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD887][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2F\\uDC41-\\uDC46]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDE40-\\uDE7F\\uDF00-\\uDF4A\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1\\uDFE3]|\\uD821[\\uDC00-\\uDFF7]|\\uD823[\\uDC00-\\uDCD5\\uDD00-\\uDD08]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD32\\uDD50-\\uDD52\\uDD55\\uDD64-\\uDD67\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD837[\\uDF00-\\uDF1E\\uDF25-\\uDF2A]|\\uD838[\\uDC30-\\uDC6D\\uDD00-\\uDD2C\\uDD37-\\uDD3D\\uDD4E\\uDE90-\\uDEAD\\uDEC0-\\uDEEB]|\\uD839[\\uDCD0-\\uDCEB\\uDFE0-\\uDFE6\\uDFE8-\\uDFEB\\uDFED\\uDFEE\\uDFF0-\\uDFFE]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43\\uDD4B]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF39\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD888[\\uDC00-\\uDFAF])*$/.test(l)},{name:"string",test:St},{name:"Chain",test:bu},{name:"Array",test:Mr},{name:"Matrix",test:Qe},{name:"DenseMatrix",test:Ji},{name:"SparseMatrix",test:ha},{name:"Range",test:Fo},{name:"Index",test:Mi},{name:"boolean",test:cm},{name:"ResultSet",test:lm},{name:"Help",test:xu},{name:"function",test:mm},{name:"Date",test:pm},{name:"RegExp",test:dm},{name:"null",test:hm},{name:"undefined",test:vm},{name:"AccessorNode",test:Ln},{name:"ArrayNode",test:jt},{name:"AssignmentNode",test:gm},{name:"BlockNode",test:ym},{name:"ConditionalNode",test:xm},{name:"ConstantNode",test:xr},{name:"FunctionNode",test:yn},{name:"FunctionAssignmentNode",test:Oa},{name:"IndexNode",test:Jn},{name:"Node",test:Nr},{name:"ObjectNode",test:Ei},{name:"OperatorNode",test:ct},{name:"ParenthesisNode",test:en},{name:"RangeNode",test:bm},{name:"RelationalNode",test:wm},{name:"SymbolNode",test:at},{name:"Map",test:tw},{name:"Object",test:Ci}]),u.addConversions([{from:"number",to:"BigNumber",convert:function(c){if(t||nw(c),rM(c)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+c+"). Use function bignumber(x) to convert to BigNumber.");return new t(c)}},{from:"number",to:"Complex",convert:function(c){return n||Pm(c),new n(c,0)}},{from:"BigNumber",to:"Complex",convert:function(c){return n||Pm(c),new n(c.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(c){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(c){return n||Pm(c),new n(c.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(c){i||aw(c);var o=new i(c);if(o.valueOf()!==c)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+c+"). Use function fraction(x) to convert to Fraction.");return o}},{from:"string",to:"number",convert:function(c){var o=Number(c);if(isNaN(o))throw new Error('Cannot convert "'+c+'" to a number');return o}},{from:"string",to:"BigNumber",convert:function(c){t||nw(c);try{return new t(c)}catch{throw new Error('Cannot convert "'+c+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(c){i||aw(c);try{return new i(c)}catch{throw new Error('Cannot convert "'+c+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(c){n||Pm(c);try{return new n(c)}catch{throw new Error('Cannot convert "'+c+'" to Complex')}}},{from:"boolean",to:"number",convert:function(c){return+c}},{from:"boolean",to:"BigNumber",convert:function(c){return t||nw(c),new t(+c)}},{from:"boolean",to:"Fraction",convert:function(c){return i||aw(c),new i(+c)}},{from:"boolean",to:"string",convert:function(c){return String(c)}},{from:"Array",to:"Matrix",convert:function(c){return a||uL(),new a(c)}},{from:"Matrix",to:"Array",convert:function(c){return c.valueOf()}}]),u.onMismatch=(l,c,o)=>{var s=u.createError(l,c,o);if(["wrongType","mismatch"].includes(s.data.category)&&c.length===1&&Nt(c[0])&&o.some(d=>!d.params.includes(","))){var m=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw m.data=s.data,m}throw s},u.onMismatch=(l,c,o)=>{var s=u.createError(l,c,o);if(["wrongType","mismatch"].includes(s.data.category)&&c.length===1&&Nt(c[0])&&o.some(d=>!d.params.includes(","))){var m=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw m.data=s.data,m}throw s},u});function nw(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function Pm(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function uL(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function aw(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var fL="ResultSet",cL=[],Rm=F(fL,cL,()=>{function e(r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=r||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(r){return new e(r.entries)},e},{isClass:!0});var Tu=9e15,qo=1e9,ow="0123456789abcdef",km="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Lm="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",sw={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Tu,maxE:Tu,crypto:!1},EM,eo,Cr=!0,Um="[DecimalError] ",Ro=Um+"Invalid argument: ",TM=Um+"Precision limit exceeded",FM=Um+"crypto unavailable",_M="[object Decimal]",Nn=Math.floor,nn=Math.pow,lL=/^0b([01]+(\\.[01]*)?|\\.[01]+)(p[+-]?\\d+)?$/i,mL=/^0x([0-9a-f]+(\\.[0-9a-f]*)?|\\.[0-9a-f]+)(p[+-]?\\d+)?$/i,pL=/^0o([0-7]+(\\.[0-7]*)?|\\.[0-7]+)(p[+-]?\\d+)?$/i,OM=/^(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,si=1e7,br=7,dL=9007199254740991,hL=km.length-1,uw=Lm.length-1,Ue={toStringTag:_M};Ue.absoluteValue=Ue.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),hr(e)};Ue.ceil=function(){return hr(new this.constructor(this),this.e+1,2)};Ue.clampedTo=Ue.clamp=function(e,r){var t,n=this,a=n.constructor;if(e=new a(e),r=new a(r),!e.s||!r.s)return new a(NaN);if(e.gt(r))throw Error(Ro+r);return t=n.cmp(e),t<0?e:n.cmp(r)>0?r:new a(n)};Ue.comparedTo=Ue.cmp=function(e){var r,t,n,a,i=this,u=i.d,l=(e=new i.constructor(e)).d,c=i.s,o=e.s;if(!u||!l)return!c||!o?NaN:c!==o?c:u===l?0:!u^c<0?1:-1;if(!u[0]||!l[0])return u[0]?c:l[0]?-o:0;if(c!==o)return c;if(i.e!==e.e)return i.e>e.e^c<0?1:-1;for(n=u.length,a=l.length,r=0,t=nl[r]^c<0?1:-1;return n===a?0:n>a^c<0?1:-1};Ue.cosine=Ue.cos=function(){var e,r,t=this,n=t.constructor;return t.d?t.d[0]?(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+br,n.rounding=1,t=vL(n,qM(n,t)),n.precision=e,n.rounding=r,hr(eo==2||eo==3?t.neg():t,e,r,!0)):new n(1):new n(NaN)};Ue.cubeRoot=Ue.cbrt=function(){var e,r,t,n,a,i,u,l,c,o,s=this,m=s.constructor;if(!s.isFinite()||s.isZero())return new m(s);for(Cr=!1,i=s.s*nn(s.s*s,1/3),!i||Math.abs(i)==1/0?(t=xn(s.d),e=s.e,(i=(e-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=nn(t,1/3),e=Nn((e+1)/3)-(e%3==(e<0?-1:2)),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new m(t),n.s=s.s):n=new m(i.toString()),u=(e=m.precision)+3;;)if(l=n,c=l.times(l).times(l),o=c.plus(s),n=Dt(o.plus(s).times(l),o.plus(c),u+2,1),xn(l.d).slice(0,u)===(t=xn(n.d)).slice(0,u))if(t=t.slice(u-3,u+1),t=="9999"||!a&&t=="4999"){if(!a&&(hr(l,e+1,0),l.times(l).times(l).eq(s))){n=l;break}u+=4,a=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(hr(n,e+1,1),r=!n.times(n).times(n).eq(s));break}return Cr=!0,hr(n,e,m.rounding,r)};Ue.decimalPlaces=Ue.dp=function(){var e,r=this.d,t=NaN;if(r){if(e=r.length-1,t=(e-Nn(this.e/br))*br,e=r[e],e)for(;e%10==0;e/=10)t--;t<0&&(t=0)}return t};Ue.dividedBy=Ue.div=function(e){return Dt(this,new this.constructor(e))};Ue.dividedToIntegerBy=Ue.divToInt=function(e){var r=this,t=r.constructor;return hr(Dt(r,new t(e),0,1,1),t.precision,t.rounding)};Ue.equals=Ue.eq=function(e){return this.cmp(e)===0};Ue.floor=function(){return hr(new this.constructor(this),this.e+1,3)};Ue.greaterThan=Ue.gt=function(e){return this.cmp(e)>0};Ue.greaterThanOrEqualTo=Ue.gte=function(e){var r=this.cmp(e);return r==1||r===0};Ue.hyperbolicCosine=Ue.cosh=function(){var e,r,t,n,a,i=this,u=i.constructor,l=new u(1);if(!i.isFinite())return new u(i.s?1/0:NaN);if(i.isZero())return l;t=u.precision,n=u.rounding,u.precision=t+Math.max(i.e,i.sd())+4,u.rounding=1,a=i.d.length,a<32?(e=Math.ceil(a/3),r=(1/Ym(4,e)).toString()):(e=16,r="2.3283064365386962890625e-10"),i=Fu(u,1,i.times(r),new u(1),!0);for(var c,o=e,s=new u(8);o--;)c=i.times(i),i=l.minus(c.times(s.minus(c.times(s))));return hr(i,u.precision=t,u.rounding=n,!0)};Ue.hyperbolicSine=Ue.sinh=function(){var e,r,t,n,a=this,i=a.constructor;if(!a.isFinite()||a.isZero())return new i(a);if(r=i.precision,t=i.rounding,i.precision=r+Math.max(a.e,a.sd())+4,i.rounding=1,n=a.d.length,n<3)a=Fu(i,2,a,a,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,a=a.times(1/Ym(5,e)),a=Fu(i,2,a,a,!0);for(var u,l=new i(5),c=new i(16),o=new i(20);e--;)u=a.times(a),a=a.times(l.plus(u.times(c.times(u).plus(o))))}return i.precision=r,i.rounding=t,hr(a,r,t,!0)};Ue.hyperbolicTangent=Ue.tanh=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+7,n.rounding=1,Dt(t.sinh(),t.cosh(),n.precision=e,n.rounding=r)):new n(t.s)};Ue.inverseCosine=Ue.acos=function(){var e,r=this,t=r.constructor,n=r.abs().cmp(1),a=t.precision,i=t.rounding;return n!==-1?n===0?r.isNeg()?oi(t,a,i):new t(0):new t(NaN):r.isZero()?oi(t,a+4,i).times(.5):(t.precision=a+6,t.rounding=1,r=r.asin(),e=oi(t,a+4,i).times(.5),t.precision=a,t.rounding=i,e.minus(r))};Ue.inverseHyperbolicCosine=Ue.acosh=function(){var e,r,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(e=n.precision,r=n.rounding,n.precision=e+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,Cr=!1,t=t.times(t).minus(1).sqrt().plus(t),Cr=!0,n.precision=e,n.rounding=r,t.ln()):new n(t)};Ue.inverseHyperbolicSine=Ue.asinh=function(){var e,r,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,Cr=!1,t=t.times(t).plus(1).sqrt().plus(t),Cr=!0,n.precision=e,n.rounding=r,t.ln())};Ue.inverseHyperbolicTangent=Ue.atanh=function(){var e,r,t,n,a=this,i=a.constructor;return a.isFinite()?a.e>=0?new i(a.abs().eq(1)?a.s/0:a.isZero()?a:NaN):(e=i.precision,r=i.rounding,n=a.sd(),Math.max(n,e)<2*-a.e-1?hr(new i(a),e,r,!0):(i.precision=t=n-a.e,a=Dt(a.plus(1),new i(1).minus(a),t+e,1),i.precision=e+4,i.rounding=1,a=a.ln(),i.precision=e,i.rounding=r,a.times(.5))):new i(NaN)};Ue.inverseSine=Ue.asin=function(){var e,r,t,n,a=this,i=a.constructor;return a.isZero()?new i(a):(r=a.abs().cmp(1),t=i.precision,n=i.rounding,r!==-1?r===0?(e=oi(i,t+4,n).times(.5),e.s=a.s,e):new i(NaN):(i.precision=t+6,i.rounding=1,a=a.div(new i(1).minus(a.times(a)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,a.times(2)))};Ue.inverseTangent=Ue.atan=function(){var e,r,t,n,a,i,u,l,c,o=this,s=o.constructor,m=s.precision,d=s.rounding;if(o.isFinite()){if(o.isZero())return new s(o);if(o.abs().eq(1)&&m+4<=uw)return u=oi(s,m+4,d).times(.25),u.s=o.s,u}else{if(!o.s)return new s(NaN);if(m+4<=uw)return u=oi(s,m+4,d).times(.5),u.s=o.s,u}for(s.precision=l=m+10,s.rounding=1,t=Math.min(28,l/br+2|0),e=t;e;--e)o=o.div(o.times(o).plus(1).sqrt().plus(1));for(Cr=!1,r=Math.ceil(l/br),n=1,c=o.times(o),u=new s(o),a=o;e!==-1;)if(a=a.times(c),i=u.minus(a.div(n+=2)),a=a.times(c),u=i.plus(a.div(n+=2)),u.d[r]!==void 0)for(e=r;u.d[e]===i.d[e]&&e--;);return t&&(u=u.times(2<this.d.length-2};Ue.isNaN=function(){return!this.s};Ue.isNegative=Ue.isNeg=function(){return this.s<0};Ue.isPositive=Ue.isPos=function(){return this.s>0};Ue.isZero=function(){return!!this.d&&this.d[0]===0};Ue.lessThan=Ue.lt=function(e){return this.cmp(e)<0};Ue.lessThanOrEqualTo=Ue.lte=function(e){return this.cmp(e)<1};Ue.logarithm=Ue.log=function(e){var r,t,n,a,i,u,l,c,o=this,s=o.constructor,m=s.precision,d=s.rounding,h=5;if(e==null)e=new s(10),r=!0;else{if(e=new s(e),t=e.d,e.s<0||!t||!t[0]||e.eq(1))return new s(NaN);r=e.eq(10)}if(t=o.d,o.s<0||!t||!t[0]||o.eq(1))return new s(t&&!t[0]?-1/0:o.s!=1?NaN:t?0:1/0);if(r)if(t.length>1)i=!0;else{for(a=t[0];a%10===0;)a/=10;i=a!==1}if(Cr=!1,l=m+h,u=Io(o,l),n=r?zm(s,l+10):Io(e,l),c=Dt(u,n,l,1),Ec(c.d,a=m,d))do if(l+=10,u=Io(o,l),n=r?zm(s,l+10):Io(e,l),c=Dt(u,n,l,1),!i){+xn(c.d).slice(a+1,a+15)+1==1e14&&(c=hr(c,m+1,0));break}while(Ec(c.d,a+=10,d));return Cr=!0,hr(c,m,d)};Ue.minus=Ue.sub=function(e){var r,t,n,a,i,u,l,c,o,s,m,d,h=this,y=h.constructor;if(e=new y(e),!h.d||!e.d)return!h.s||!e.s?e=new y(NaN):h.d?e.s=-e.s:e=new y(e.d||h.s!==e.s?h:NaN),e;if(h.s!=e.s)return e.s=-e.s,h.plus(e);if(o=h.d,d=e.d,l=y.precision,c=y.rounding,!o[0]||!d[0]){if(d[0])e.s=-e.s;else if(o[0])e=new y(h);else return new y(c===3?-0:0);return Cr?hr(e,l,c):e}if(t=Nn(e.e/br),s=Nn(h.e/br),o=o.slice(),i=s-t,i){for(m=i<0,m?(r=o,i=-i,u=d.length):(r=d,t=s,u=o.length),n=Math.max(Math.ceil(l/br),u)+2,i>n&&(i=n,r.length=1),r.reverse(),n=i;n--;)r.push(0);r.reverse()}else{for(n=o.length,u=d.length,m=n0;--n)o[u++]=0;for(n=d.length;n>i;){if(o[--n]u?i+1:u+1,a>u&&(a=u,t.length=1),t.reverse();a--;)t.push(0);t.reverse()}for(u=o.length,a=s.length,u-a<0&&(a=u,t=s,s=o,o=t),r=0;a;)r=(o[--a]=o[a]+s[a]+r)/si|0,o[a]%=si;for(r&&(o.unshift(r),++n),u=o.length;o[--u]==0;)o.pop();return e.d=o,e.e=Wm(o,n),Cr?hr(e,l,c):e};Ue.precision=Ue.sd=function(e){var r,t=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Ro+e);return t.d?(r=BM(t.d),e&&t.e+1>r&&(r=t.e+1)):r=NaN,r};Ue.round=function(){var e=this,r=e.constructor;return hr(new r(e),e.e+1,r.rounding)};Ue.sine=Ue.sin=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+br,n.rounding=1,t=yL(n,qM(n,t)),n.precision=e,n.rounding=r,hr(eo>2?t.neg():t,e,r,!0)):new n(NaN)};Ue.squareRoot=Ue.sqrt=function(){var e,r,t,n,a,i,u=this,l=u.d,c=u.e,o=u.s,s=u.constructor;if(o!==1||!l||!l[0])return new s(!o||o<0&&(!l||l[0])?NaN:l?u:1/0);for(Cr=!1,o=Math.sqrt(+u),o==0||o==1/0?(r=xn(l),(r.length+c)%2==0&&(r+="0"),o=Math.sqrt(r),c=Nn((c+1)/2)-(c<0||c%2),o==1/0?r="5e"+c:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+c),n=new s(r)):n=new s(o.toString()),t=(c=s.precision)+3;;)if(i=n,n=i.plus(Dt(u,i,t+2,1)).times(.5),xn(i.d).slice(0,t)===(r=xn(n.d)).slice(0,t))if(r=r.slice(t-3,t+1),r=="9999"||!a&&r=="4999"){if(!a&&(hr(i,c+1,0),i.times(i).eq(u))){n=i;break}t+=4,a=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(hr(n,c+1,1),e=!n.times(n).eq(u));break}return Cr=!0,hr(n,c,s.rounding,e)};Ue.tangent=Ue.tan=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+10,n.rounding=1,t=t.sin(),t.s=1,t=Dt(t,new n(1).minus(t.times(t)).sqrt(),e+10,0),n.precision=e,n.rounding=r,hr(eo==2||eo==4?t.neg():t,e,r,!0)):new n(NaN)};Ue.times=Ue.mul=function(e){var r,t,n,a,i,u,l,c,o,s=this,m=s.constructor,d=s.d,h=(e=new m(e)).d;if(e.s*=s.s,!d||!d[0]||!h||!h[0])return new m(!e.s||d&&!d[0]&&!h||h&&!h[0]&&!d?NaN:!d||!h?e.s/0:e.s*0);for(t=Nn(s.e/br)+Nn(e.e/br),c=d.length,o=h.length,c=0;){for(r=0,a=c+n;a>n;)l=i[a]+h[n]*d[a-n-1]+r,i[a--]=l%si|0,r=l/si|0;i[a]=(i[a]+r)%si|0}for(;!i[--u];)i.pop();return r?++t:i.shift(),e.d=i,e.e=Wm(i,t),Cr?hr(e,m.precision,m.rounding):e};Ue.toBinary=function(e,r){return lw(this,2,e,r)};Ue.toDecimalPlaces=Ue.toDP=function(e,r){var t=this,n=t.constructor;return t=new n(t),e===void 0?t:(jn(e,0,qo),r===void 0?r=n.rounding:jn(r,0,8),hr(t,e+t.e+1,r))};Ue.toExponential=function(e,r){var t,n=this,a=n.constructor;return e===void 0?t=Fi(n,!0):(jn(e,0,qo),r===void 0?r=a.rounding:jn(r,0,8),n=hr(new a(n),e+1,r),t=Fi(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Ue.toFixed=function(e,r){var t,n,a=this,i=a.constructor;return e===void 0?t=Fi(a):(jn(e,0,qo),r===void 0?r=i.rounding:jn(r,0,8),n=hr(new i(a),e+a.e+1,r),t=Fi(n,!1,e+n.e+1)),a.isNeg()&&!a.isZero()?"-"+t:t};Ue.toFraction=function(e){var r,t,n,a,i,u,l,c,o,s,m,d,h=this,y=h.d,v=h.constructor;if(!y)return new v(h);if(o=t=new v(1),n=c=new v(0),r=new v(n),i=r.e=BM(y)-h.e-1,u=i%br,r.d[0]=nn(10,u<0?br+u:u),e==null)e=i>0?r:o;else{if(l=new v(e),!l.isInt()||l.lt(o))throw Error(Ro+l);e=l.gt(r)?i>0?r:o:l}for(Cr=!1,l=new v(xn(y)),s=v.precision,v.precision=i=y.length*br*2;m=Dt(l,r,0,1,1),a=t.plus(m.times(n)),a.cmp(e)!=1;)t=n,n=a,a=o,o=c.plus(m.times(a)),c=a,a=r,r=l.minus(m.times(a)),l=a;return a=Dt(e.minus(t),n,0,1,1),c=c.plus(a.times(o)),t=t.plus(a.times(n)),c.s=o.s=h.s,d=Dt(o,n,i,1).minus(h).abs().cmp(Dt(c,t,i,1).minus(h).abs())<1?[o,n]:[c,t],v.precision=s,Cr=!0,d};Ue.toHexadecimal=Ue.toHex=function(e,r){return lw(this,16,e,r)};Ue.toNearest=function(e,r){var t=this,n=t.constructor;if(t=new n(t),e==null){if(!t.d)return t;e=new n(1),r=n.rounding}else{if(e=new n(e),r===void 0?r=n.rounding:jn(r,0,8),!t.d)return e.s?t:e;if(!e.d)return e.s&&(e.s=t.s),e}return e.d[0]?(Cr=!1,t=Dt(t,e,0,r,1).times(e),Cr=!0,hr(t)):(e.s=t.s,t=e),t};Ue.toNumber=function(){return+this};Ue.toOctal=function(e,r){return lw(this,8,e,r)};Ue.toPower=Ue.pow=function(e){var r,t,n,a,i,u,l=this,c=l.constructor,o=+(e=new c(e));if(!l.d||!e.d||!l.d[0]||!e.d[0])return new c(nn(+l,o));if(l=new c(l),l.eq(1))return l;if(n=c.precision,i=c.rounding,e.eq(1))return hr(l,n,i);if(r=Nn(e.e/br),r>=e.d.length-1&&(t=o<0?-o:o)<=dL)return a=PM(c,l,t,n),e.s<0?new c(1).div(a):hr(a,n,i);if(u=l.s,u<0){if(rc.maxE+1||r0?u/0:0):(Cr=!1,c.rounding=l.s=1,t=Math.min(12,(r+"").length),a=fw(e.times(Io(l,n+t)),n),a.d&&(a=hr(a,n+5,1),Ec(a.d,n,i)&&(r=n+10,a=hr(fw(e.times(Io(l,r+t)),r),r+5,1),+xn(a.d).slice(n+1,n+15)+1==1e14&&(a=hr(a,n+1,0)))),a.s=u,Cr=!0,c.rounding=i,hr(a,n,i))};Ue.toPrecision=function(e,r){var t,n=this,a=n.constructor;return e===void 0?t=Fi(n,n.e<=a.toExpNeg||n.e>=a.toExpPos):(jn(e,1,qo),r===void 0?r=a.rounding:jn(r,0,8),n=hr(new a(n),e,r),t=Fi(n,e<=n.e||n.e<=a.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+t:t};Ue.toSignificantDigits=Ue.toSD=function(e,r){var t=this,n=t.constructor;return e===void 0?(e=n.precision,r=n.rounding):(jn(e,1,qo),r===void 0?r=n.rounding:jn(r,0,8)),hr(new n(t),e,r)};Ue.toString=function(){var e=this,r=e.constructor,t=Fi(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()&&!e.isZero()?"-"+t:t};Ue.truncated=Ue.trunc=function(){return hr(new this.constructor(this),this.e+1,1)};Ue.valueOf=Ue.toJSON=function(){var e=this,r=e.constructor,t=Fi(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()?"-"+t:t};function xn(e){var r,t,n,a=e.length-1,i="",u=e[0];if(a>0){for(i+=u,r=1;rt)throw Error(Ro+e)}function Ec(e,r,t,n){var a,i,u,l;for(i=e[0];i>=10;i/=10)--r;return--r<0?(r+=br,a=0):(a=Math.ceil((r+1)/br),r%=br),i=nn(10,br-r),l=e[a]%i|0,n==null?r<3?(r==0?l=l/100|0:r==1&&(l=l/10|0),u=t<4&&l==99999||t>3&&l==49999||l==5e4||l==0):u=(t<4&&l+1==i||t>3&&l+1==i/2)&&(e[a+1]/i/100|0)==nn(10,r-2)-1||(l==i/2||l==0)&&(e[a+1]/i/100|0)==0:r<4?(r==0?l=l/1e3|0:r==1?l=l/100|0:r==2&&(l=l/10|0),u=(n||t<4)&&l==9999||!n&&t>3&&l==4999):u=((n||t<4)&&l+1==i||!n&&t>3&&l+1==i/2)&&(e[a+1]/i/1e3|0)==nn(10,r-3)-1,u}function qm(e,r,t){for(var n,a=[0],i,u=0,l=e.length;ut-1&&(a[n+1]===void 0&&(a[n+1]=0),a[n+1]+=a[n]/t|0,a[n]%=t)}return a.reverse()}function vL(e,r){var t,n,a;if(r.isZero())return r;n=r.d.length,n<32?(t=Math.ceil(n/3),a=(1/Ym(4,t)).toString()):(t=16,a="2.3283064365386962890625e-10"),e.precision+=t,r=Fu(e,1,r.times(a),new e(1));for(var i=t;i--;){var u=r.times(r);r=u.times(u).minus(u).times(8).plus(1)}return e.precision-=t,r}var Dt=function(){function e(n,a,i){var u,l=0,c=n.length;for(n=n.slice();c--;)u=n[c]*a+l,n[c]=u%i|0,l=u/i|0;return l&&n.unshift(l),n}function r(n,a,i,u){var l,c;if(i!=u)c=i>u?1:-1;else for(l=c=0;la[l]?1:-1;break}return c}function t(n,a,i,u){for(var l=0;i--;)n[i]-=l,l=n[i]1;)n.shift()}return function(n,a,i,u,l,c){var o,s,m,d,h,y,v,x,w,C,b,N,M,S,O,_,E,T,R,k,W=n.constructor,G=n.s==a.s?1:-1,H=n.d,L=a.d;if(!H||!H[0]||!L||!L[0])return new W(!n.s||!a.s||(H?L&&H[0]==L[0]:!L)?NaN:H&&H[0]==0||!L?G*0:G/0);for(c?(h=1,s=n.e-a.e):(c=si,h=br,s=Nn(n.e/h)-Nn(a.e/h)),R=L.length,E=H.length,w=new W(G),C=w.d=[],m=0;L[m]==(H[m]||0);m++);if(L[m]>(H[m]||0)&&s--,i==null?(S=i=W.precision,u=W.rounding):l?S=i+(n.e-a.e)+1:S=i,S<0)C.push(1),y=!0;else{if(S=S/h+2|0,m=0,R==1){for(d=0,L=L[0],S++;(m1&&(L=e(L,d,c),H=e(H,d,c),R=L.length,E=H.length),_=R,b=H.slice(0,R),N=b.length;N=c/2&&++T;do d=0,o=r(L,b,R,N),o<0?(M=b[0],R!=N&&(M=M*c+(b[1]||0)),d=M/T|0,d>1?(d>=c&&(d=c-1),v=e(L,d,c),x=v.length,N=b.length,o=r(v,b,x,N),o==1&&(d--,t(v,R=10;d/=10)m++;w.e=m+s*h-1,hr(w,l?i+w.e+1:i,u,y)}return w}}();function hr(e,r,t,n){var a,i,u,l,c,o,s,m,d,h=e.constructor;e:if(r!=null){if(m=e.d,!m)return e;for(a=1,l=m[0];l>=10;l/=10)a++;if(i=r-a,i<0)i+=br,u=r,s=m[d=0],c=s/nn(10,a-u-1)%10|0;else if(d=Math.ceil((i+1)/br),l=m.length,d>=l)if(n){for(;l++<=d;)m.push(0);s=c=0,a=1,i%=br,u=i-br+1}else break e;else{for(s=l=m[d],a=1;l>=10;l/=10)a++;i%=br,u=i-br+a,c=u<0?0:s/nn(10,a-u-1)%10|0}if(n=n||r<0||m[d+1]!==void 0||(u<0?s:s%nn(10,a-u-1)),o=t<4?(c||n)&&(t==0||t==(e.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(i>0?u>0?s/nn(10,a-u):0:m[d-1])%10&1||t==(e.s<0?8:7)),r<1||!m[0])return m.length=0,o?(r-=e.e+1,m[0]=nn(10,(br-r%br)%br),e.e=-r||0):m[0]=e.e=0,e;if(i==0?(m.length=d,l=1,d--):(m.length=d+1,l=nn(10,br-i),m[d]=u>0?(s/nn(10,a-u)%nn(10,u)|0)*l:0),o)for(;;)if(d==0){for(i=1,u=m[0];u>=10;u/=10)i++;for(u=m[0]+=l,l=1;u>=10;u/=10)l++;i!=l&&(e.e++,m[0]==si&&(m[0]=1));break}else{if(m[d]+=l,m[d]!=si)break;m[d--]=0,l=1}for(i=m.length;m[--i]===0;)m.pop()}return Cr&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e0?i=i.charAt(0)+"."+i.slice(1)+Po(n):u>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(e.e<0?"e":"e+")+e.e):a<0?(i="0."+Po(-a-1)+i,t&&(n=t-u)>0&&(i+=Po(n))):a>=u?(i+=Po(a+1-u),t&&(n=t-a-1)>0&&(i=i+"."+Po(n))):((n=a+1)0&&(a+1===u&&(i+="."),i+=Po(n))),i}function Wm(e,r){var t=e[0];for(r*=br;t>=10;t/=10)r++;return r}function zm(e,r,t){if(r>hL)throw Cr=!0,t&&(e.precision=t),Error(TM);return hr(new e(km),r,1,!0)}function oi(e,r,t){if(r>uw)throw Error(TM);return hr(new e(Lm),r,t,!0)}function BM(e){var r=e.length-1,t=r*br+1;if(r=e[r],r){for(;r%10==0;r/=10)t--;for(r=e[0];r>=10;r/=10)t++}return t}function Po(e){for(var r="";e--;)r+="0";return r}function PM(e,r,t,n){var a,i=new e(1),u=Math.ceil(n/br+4);for(Cr=!1;;){if(t%2&&(i=i.times(r),MM(i.d,u)&&(a=!0)),t=Nn(t/2),t===0){t=i.d.length-1,a&&i.d[t]===0&&++i.d[t];break}r=r.times(r),MM(r.d,u)}return Cr=!0,i}function AM(e){return e.d[e.d.length-1]&1}function IM(e,r,t){for(var n,a=new e(r[0]),i=0;++i17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(r==null?(Cr=!1,c=y):c=r,l=new d(.03125);e.e>-2;)e=e.times(l),m+=5;for(n=Math.log(nn(2,m))/Math.LN10*2+5|0,c+=n,t=i=u=new d(1),d.precision=c;;){if(i=hr(i.times(e),c,1),t=t.times(++s),l=u.plus(Dt(i,t,c,1)),xn(l.d).slice(0,c)===xn(u.d).slice(0,c)){for(a=m;a--;)u=hr(u.times(u),c,1);if(r==null)if(o<3&&Ec(u.d,c-n,h,o))d.precision=c+=10,t=i=l=new d(1),s=0,o++;else return hr(u,d.precision=y,h,Cr=!0);else return d.precision=y,u}u=l}}function Io(e,r){var t,n,a,i,u,l,c,o,s,m,d,h=1,y=10,v=e,x=v.d,w=v.constructor,C=w.rounding,b=w.precision;if(v.s<0||!x||!x[0]||!v.e&&x[0]==1&&x.length==1)return new w(x&&!x[0]?-1/0:v.s!=1?NaN:x?0:v);if(r==null?(Cr=!1,s=b):s=r,w.precision=s+=y,t=xn(x),n=t.charAt(0),Math.abs(i=v.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)v=v.times(e),t=xn(v.d),n=t.charAt(0),h++;i=v.e,n>1?(v=new w("0."+t),i++):v=new w(n+"."+t.slice(1))}else return o=zm(w,s+2,b).times(i+""),v=Io(new w(n+"."+t.slice(1)),s-y).plus(o),w.precision=b,r==null?hr(v,b,C,Cr=!0):v;for(m=v,c=u=v=Dt(v.minus(1),v.plus(1),s,1),d=hr(v.times(v),s,1),a=3;;){if(u=hr(u.times(d),s,1),o=c.plus(Dt(u,new w(a),s,1)),xn(o.d).slice(0,s)===xn(c.d).slice(0,s))if(c=c.times(2),i!==0&&(c=c.plus(zm(w,s+2,b).times(i+""))),c=Dt(c,new w(h),s,1),r==null)if(Ec(c.d,s-y,C,l))w.precision=s+=y,o=u=v=Dt(m.minus(1),m.plus(1),s,1),d=hr(v.times(v),s,1),a=l=1;else return hr(c,w.precision=b,C,Cr=!0);else return w.precision=b,c;c=o,a+=2}}function RM(e){return String(e.s*e.s/0)}function cw(e,r){var t,n,a;for((t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(t<0&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):t<0&&(t=r.length),n=0;r.charCodeAt(n)===48;n++);for(a=r.length;r.charCodeAt(a-1)===48;--a);if(r=r.slice(n,a),r){if(a-=n,e.e=t=t-n-1,e.d=[],n=(t+1)%br,t<0&&(n+=br),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(r=r.replace(/(\\d)_(?=\\d)/g,"$1"),OM.test(r))return cw(e,r)}else if(r==="Infinity"||r==="NaN")return+r||(e.s=NaN),e.e=NaN,e.d=null,e;if(mL.test(r))t=16,r=r.toLowerCase();else if(lL.test(r))t=2;else if(pL.test(r))t=8;else throw Error(Ro+r);for(i=r.search(/p/i),i>0?(c=+r.slice(i+1),r=r.substring(2,i)):r=r.slice(2),i=r.indexOf("."),u=i>=0,n=e.constructor,u&&(r=r.replace(".",""),l=r.length,i=l-i,a=PM(n,new n(t),i,i*2)),o=qm(r,t,si),s=o.length-1,i=s;o[i]===0;--i)o.pop();return i<0?new n(e.s*0):(e.e=Wm(o,s),e.d=o,Cr=!1,u&&(e=Dt(e,a,l*4)),c&&(e=e.times(Math.abs(c)<54?nn(2,c):Tc.pow(2,c))),Cr=!0,e)}function yL(e,r){var t,n=r.d.length;if(n<3)return r.isZero()?r:Fu(e,2,r,r);t=1.4*Math.sqrt(n),t=t>16?16:t|0,r=r.times(1/Ym(5,t)),r=Fu(e,2,r,r);for(var a,i=new e(5),u=new e(16),l=new e(20);t--;)a=r.times(r),r=r.times(i.plus(a.times(u.times(a).minus(l))));return r}function Fu(e,r,t,n,a){var i,u,l,c,o=1,s=e.precision,m=Math.ceil(s/br);for(Cr=!1,c=t.times(t),l=new e(n);;){if(u=Dt(l.times(c),new e(r++*r++),s,1),l=a?n.plus(u):n.minus(u),n=Dt(u.times(c),new e(r++*r++),s,1),u=l.plus(n),u.d[m]!==void 0){for(i=m;u.d[i]===l.d[i]&&i--;);if(i==-1)break}i=l,l=n,n=u,u=i,o++}return Cr=!0,u.d.length=m+1,u}function Ym(e,r){for(var t=e;--r;)t*=e;return t}function qM(e,r){var t,n=r.s<0,a=oi(e,e.precision,1),i=a.times(.5);if(r=r.abs(),r.lte(i))return eo=n?4:1,r;if(t=r.divToInt(a),t.isZero())eo=n?3:2;else{if(r=r.minus(t.times(a)),r.lte(i))return eo=AM(t)?n?2:3:n?4:1,r;eo=AM(t)?n?1:4:n?3:2}return r.minus(a).abs()}function lw(e,r,t,n){var a,i,u,l,c,o,s,m,d,h=e.constructor,y=t!==void 0;if(y?(jn(t,1,qo),n===void 0?n=h.rounding:jn(n,0,8)):(t=h.precision,n=h.rounding),!e.isFinite())s=RM(e);else{for(s=Fi(e),u=s.indexOf("."),y?(a=2,r==16?t=t*4-3:r==8&&(t=t*3-2)):a=r,u>=0&&(s=s.replace(".",""),d=new h(1),d.e=s.length-u,d.d=qm(Fi(d),10,a),d.e=d.d.length),m=qm(s,10,a),i=c=m.length;m[--c]==0;)m.pop();if(!m[0])s=y?"0p+0":"0";else{if(u<0?i--:(e=new h(e),e.d=m,e.e=i,e=Dt(e,d,t,n,0,a),m=e.d,i=e.e,o=EM),u=m[t],l=a/2,o=o||m[t+1]!==void 0,o=n<4?(u!==void 0||o)&&(n===0||n===(e.s<0?3:2)):u>l||u===l&&(n===4||o||n===6&&m[t-1]&1||n===(e.s<0?8:7)),m.length=t,o)for(;++m[--t]>a-1;)m[t]=0,t||(++i,m.unshift(1));for(c=m.length;!m[c-1];--c);for(u=0,s="";u1)if(r==16||r==8){for(u=r==16?4:3,--c;c%u;c++)s+="0";for(m=qm(s,a,r),c=m.length;!m[c-1];--c);for(u=1,s="1.";uc)for(i-=c;i--;)s+="0";else ir)return e.length=r,!0}function xL(e){return new this(e).abs()}function bL(e){return new this(e).acos()}function wL(e){return new this(e).acosh()}function DL(e,r){return new this(e).plus(r)}function SL(e){return new this(e).asin()}function NL(e){return new this(e).asinh()}function AL(e){return new this(e).atan()}function ML(e){return new this(e).atanh()}function CL(e,r){e=new this(e),r=new this(r);var t,n=this.precision,a=this.rounding,i=n+4;return!e.s||!r.s?t=new this(NaN):!e.d&&!r.d?(t=oi(this,i,1).times(r.s>0?.25:.75),t.s=e.s):!r.d||e.isZero()?(t=r.s<0?oi(this,n,a):new this(0),t.s=e.s):!e.d||r.isZero()?(t=oi(this,i,1).times(.5),t.s=e.s):r.s<0?(this.precision=i,this.rounding=1,t=this.atan(Dt(e,r,i,1)),r=oi(this,i,1),this.precision=n,this.rounding=a,t=e.s<0?t.minus(r):t.plus(r)):t=this.atan(Dt(e,r,i,1)),t}function EL(e){return new this(e).cbrt()}function TL(e){return hr(e=new this(e),e.e+1,2)}function FL(e,r,t){return new this(e).clamp(r,t)}function _L(e){if(!e||typeof e!="object")throw Error(Um+"Object expected");var r,t,n,a=e.defaults===!0,i=["precision",1,qo,"rounding",0,8,"toExpNeg",-Tu,0,"toExpPos",0,Tu,"maxE",0,Tu,"minE",-Tu,0,"modulo",0,9];for(r=0;r=i[r+1]&&n<=i[r+2])this[t]=n;else throw Error(Ro+t+": "+n);if(t="crypto",a&&(this[t]=sw[t]),(n=e[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(FM);else this[t]=!1;else throw Error(Ro+t+": "+n);return this}function OL(e){return new this(e).cos()}function BL(e){return new this(e).cosh()}function kM(e){var r,t,n;function a(i){var u,l,c,o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,CM(i)){o.s=i.s,Cr?!i.d||i.e>a.maxE?(o.e=NaN,o.d=null):i.e=10;l/=10)u++;Cr?u>a.maxE?(o.e=NaN,o.d=null):u=429e7?r[i]=crypto.getRandomValues(new Uint32Array(1))[0]:l[i++]=a%1e7;else if(crypto.randomBytes){for(r=crypto.randomBytes(n*=4);i=214e7?crypto.randomBytes(4).copy(r,i):(l.push(a%1e7),i+=4);i=n/4}else throw Error(FM);else for(;i=10;a/=10)n++;n{var{on:r,config:t}=e,n=Es.clone({precision:t.precision,modulo:Es.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(a){return new n(a.value)},r&&r("config",function(a,i){a.precision!==i.precision&&n.config({precision:a.precision})}),n},{isClass:!0});var fn=ma(zM(),1);var oz="Complex",sz=[],$m=F(oz,sz,()=>(Object.defineProperty(fn.default,"name",{value:"Complex"}),fn.default.prototype.constructor=fn.default,fn.default.prototype.type="Complex",fn.default.prototype.isComplex=!0,fn.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},fn.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},fn.default.prototype.format=function(e){var r="",t=this.im,n=this.re,a=ai(this.re,e),i=ai(this.im,e),u=sr(e)?e:e?e.precision:null;if(u!==null){var l=Math.pow(10,-u);Math.abs(n/t)r.re?1:e.rer.im?1:e.im(Object.defineProperty(_i.default,"name",{value:"Fraction"}),_i.default.prototype.constructor=_i.default,_i.default.prototype.type="Fraction",_i.default.prototype.isFraction=!0,_i.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},_i.default.fromJSON=function(e){return new _i.default(e)},_i.default),{isClass:!0});var cz="Range",lz=[],Vm=F(cz,lz,()=>{function e(r,t,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var a=r!=null,i=t!=null,u=n!=null;if(a){if(rr(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter start must be a number")}if(i){if(rr(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter end must be a number")}if(u){if(rr(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=a?parseFloat(r):0,this.end=i?parseFloat(t):0,this.step=u?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(r){if(typeof r!="string")return null;var t=r.split(":"),n=t.map(function(i){return parseFloat(i)}),a=n.some(function(i){return isNaN(i)});if(a)return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var r=0,t=this.start,n=this.step,a=this.end,i=a-t;return Ba(n)===Ba(i)?r=Math.ceil(i/n):i===0&&(r=0),isNaN(r)&&(r=0),[r]},e.prototype.min=function(){var r=this.size()[0];if(r>0)return this.step>0?this.start:this.start+(r-1)*this.step},e.prototype.max=function(){var r=this.size()[0];if(r>0)return this.step>0?this.start+(r-1)*this.step:this.start},e.prototype.forEach=function(r){var t=this.start,n=this.step,a=this.end,i=0;if(n>0)for(;ta;)r(t,[i],this),t+=n,i++},e.prototype.map=function(r){var t=[];return this.forEach(function(n,a,i){t[a[0]]=r(n,a,i)}),t},e.prototype.toArray=function(){var r=[];return this.forEach(function(t,n){r[n[0]]=t}),r},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(r){var t=ai(this.start,r);return this.step!==1&&(t+=":"+ai(this.step,r)),t+=":"+ai(this.end,r),t},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(r){return new e(r.start,r.end,r.step)},e},{isClass:!0});var mz="Matrix",pz=[],Zm=F(mz,pz,()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(r,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(r,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(r){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(r,t,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(r,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(r,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(r,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(r){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(r){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function YM(e){var r=0,t=1,n=Object.create(null),a=Object.create(null),i=0,u=function(c){var o=a[c];if(!!o&&(delete n[o],delete a[c],--r,t===o)){if(!r){i=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++t););}};return e=Math.abs(e),{hit:function(c){var o=a[c],s=++i;if(n[s]=c,a[c]=s,!o)return++r,r<=e?void 0:(c=n[t],u(c),c);if(delete n[o],t===o)for(;!Object.prototype.hasOwnProperty.call(n,++t););},delete:u,clear:function(){r=i=0,t=1,n=Object.create(null),a=Object.create(null)}}}function Ts(e){var{hasher:r,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t??Number.POSITIVE_INFINITY,r=r??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:YM(t||Number.POSITIVE_INFINITY)});for(var a=[],i=0;i{var{Matrix:r}=e;function t(s,m){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(m&&!St(m))throw new Error("Invalid datatype: "+m);if(Qe(s))s.type==="DenseMatrix"?(this._data=ar(s._data),this._size=ar(s._size),this._datatype=m||s._datatype):(this._data=s.toArray(),this._size=s.size(),this._datatype=m||s._datatype);else if(s&&Mr(s.data)&&Mr(s.size))this._data=s.data,this._size=s.size,Xb(this._data,this._size),this._datatype=m||s.datatype;else if(Mr(s))this._data=o(s),this._size=ur(this._data),Xb(this._data,this._size),this._datatype=m;else{if(s)throw new TypeError("Unsupported type of data ("+Tr(s)+")");this._data=[],this._size=[0],this._datatype=m}}t.prototype=new r,t.prototype.createDenseMatrix=function(s,m){return new t(s,m)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return Oo(this._data,Tr)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(s,m){return new t(s,m)},t.prototype.subset=function(s,m,d){switch(arguments.length){case 1:return n(this,s);case 2:case 3:return i(this,s,m,d);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(s){if(!Mr(s))throw new TypeError("Array expected");if(s.length!==this._size.length)throw new pr(s.length,this._size.length);for(var m=0;m");var b=m.max().map(function(S){return S+1});c(s,b,h);var N=y.length,M=0;u(s._data,m,d,N,M)}return s}function u(s,m,d,h,y){var v=y===h-1,x=m.dimension(y);v?x.forEach(function(w,C){Kr(w),s[w]=d[C[0]]}):x.forEach(function(w,C){Kr(w),u(s[w],m,d[C[0]],h,y+1)})}t.prototype.resize=function(s,m,d){if(!Nt(s))throw new TypeError("Array or Matrix expected");var h=s.valueOf().map(v=>Array.isArray(v)&&v.length===1?v[0]:v),y=d?this.clone():this;return l(y,h,m)};function l(s,m,d){if(m.length===0){for(var h=s._data;Mr(h);)h=h[0];return h}return s._size=m.slice(0),s._data=ii(s._data,s._size,d),s}t.prototype.reshape=function(s,m){var d=m?this.clone():this;d._data=Ac(d._data,s);var h=d._size.reduce((y,v)=>y*v);return d._size=Mc(s,h),d};function c(s,m,d){for(var h=s._size.slice(0),y=!1;h.lengthh[v]&&(h[v]=m[v],y=!0);y&&l(s,h,d)}t.prototype.clone=function(){var s=new t({data:ar(this._data),size:ar(this._size),datatype:this._datatype});return s},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(s){var m=this,d=Qm(s),h=function x(w,C){return Mr(w)?w.map(function(b,N){return x(b,C.concat(N))}):d===1?s(w):d===2?s(w,C):s(w,C,m)},y=h(this._data,[]),v=this._datatype!==void 0?Oo(y,Tr):void 0;return new t(y,v)},t.prototype.forEach=function(s){var m=this,d=function h(y,v){Mr(y)?y.forEach(function(x,w){h(x,v.concat(w))}):s(y,v,m)};d(this._data,[])},t.prototype[Symbol.iterator]=function*(){var s=function*m(d,h){if(Mr(d))for(var y=0;y[b[w]]);m.push(new t(C,s._datatype))},v=0;v0?s:0,d=s<0?-s:0,h=this._size[0],y=this._size[1],v=Math.min(h-d,y-m),x=[],w=0;w0?d:0,v=d<0?-d:0,x=s[0],w=s[1],C=Math.min(x-v,w-y),b;if(Mr(m)){if(m.length!==C)throw new Error("Invalid value array length");b=function(_){return m[_]}}else if(Qe(m)){var N=m.size();if(N.length!==1||N[0]!==C)throw new Error("Invalid matrix length");b=function(_){return m.get([_])}}else b=function(){return m};h||(h=rr(b(0))?b(0).mul(0):0);var M=[];if(s.length>0){M=ii(M,s,h);for(var S=0;S{var{typed:r}=e;return r(HM,{any:ar})});function Km(e){var r=e.length,t=e[0].length,n,a,i=[];for(a=0;a=n.length)throw new tn(r,n.length);return Qe(e)?e.create(jm(e.valueOf(),r,t)):jm(e,r,t)}function jm(e,r,t){var n,a,i,u;if(r<=0)if(Array.isArray(e[0])){for(u=Km(e),a=[],n=0;n{var{typed:r}=e;return r($M,{number:Ze,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var ea="number",ro="number, number";function hw(e){return Math.abs(e)}hw.signature=ea;function vw(e,r){return e+r}vw.signature=ro;function gw(e,r){return e-r}gw.signature=ro;function yw(e,r){return e*r}yw.signature=ro;function yz(e,r){return e/r}yz.signature=ro;function xw(e){return-e}xw.signature=ea;function bw(e){return e}bw.signature=ea;function _u(e){return KA(e)}_u.signature=ea;function ww(e){return e*e*e}ww.signature=ea;function Dw(e){return Math.exp(e)}Dw.signature=ea;function Sw(e){return jA(e)}Sw.signature=ea;function xz(e,r){if(!Ze(e)||!Ze(r))throw new Error("Parameters in function gcd must be integer numbers");for(var t;r!==0;)t=e%r,e=r,r=t;return e<0?-e:e}xz.signature=ro;function Nw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Parameters in function lcm must be integer numbers");if(e===0||r===0)return 0;for(var t,n=e*r;r!==0;)t=r,r=e%t,e=t;return Math.abs(n/e)}Nw.signature=ro;function GM(e,r){return r?Math.log(e)/Math.log(r):Math.log(e)}function Aw(e){return JA(e)}Aw.signature=ea;function Mw(e){return XA(e)}Mw.signature=ea;function bz(e){return Mm(e)}bz.signature=ea;function wz(e,r){return r===0?e:e-r*Math.floor(e/r)}wz.signature=ro;function Cw(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,t=r<0;if(t&&(r=-r),r===0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(r)%2!==1)throw new Error("Root must be odd when a is negative.");if(e===0)return t?1/0:0;if(!isFinite(e))return t?0:e;var n=Math.pow(Math.abs(e),1/r);return n=e<0?-n:n,t?1/n:n}function rp(e){return Ba(e)}rp.signature=ea;function Dz(e){return Math.sqrt(e)}Dz.signature=ea;function Ew(e){return e*e}Ew.signature=ea;function Tw(e,r){var t,n,a,i=0,u=1,l=1,c=0;if(!Ze(e)||!Ze(r))throw new Error("Parameters in function xgcd must be integer numbers");for(;r;)n=Math.floor(e/r),a=e-n*r,t=i,i=u-n*i,u=t,t=l,l=c-n*l,c=t,e=r,r=a;var o;return e<0?o=[-e,-u,-c]:o=[e,e?u:0,c],o}Tw.signature=ro;function Fw(e,r){return e*e<1&&r===1/0||e*e>1&&r===-1/0?0:Math.pow(e,r)}Fw.signature=ro;function Ou(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!Ze(r)||r<0||r>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(Vb(e,r))}function Sz(e){return Math.abs(e)}Sz.signature=ea;var Nz="number",Bu="number, number";function _w(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function bitAnd");return e&r}_w.signature=Bu;function Ow(e){if(!Ze(e))throw new Error("Integer expected in function bitNot");return~e}Ow.signature=Nz;function Bw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function bitOr");return e|r}Bw.signature=Bu;function Pw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function bitXor");return e^r}Pw.signature=Bu;function Iw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function leftShift");return e<>r}Rw.signature=Bu;function qw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function rightLogShift");return e>>>r}qw.signature=Bu;function va(e,r){if(r>1;return va(e,t)*va(t+1,r)}function kw(e,r){if(!Ze(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!Ze(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(r>e)throw new TypeError("k must be less than or equal to n");for(var t=e-r,n=1,a=r171?1/0:va(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Fc(1-e));if(e>=171.35)return 1/0;if(e>85){var t=e*e,n=t*e,a=n*e,i=a*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*t)-139/(51840*n)-571/(2488320*a)+163879/(209018880*i)+5246819/(75246796800*i*e))}--e,r=Fs[0];for(var u=1;u=1;n--)t+=JM[n]/(e+n);return $w+(e+.5)*Math.log(r)-r+Math.log(t)}_c.signature="number";var Ct="number",Ez="number, number";function Tz(e){return Math.acos(e)}Tz.signature=Ct;function Gw(e){return tM(e)}Gw.signature=Ct;function Vw(e){return Math.atan(1/e)}Vw.signature=Ct;function Zw(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}Zw.signature=Ct;function Qw(e){return Math.asin(1/e)}Qw.signature=Ct;function Xw(e){var r=1/e;return Math.log(r+Math.sqrt(r*r+1))}Xw.signature=Ct;function Jw(e){return Math.acos(1/e)}Jw.signature=Ct;function Kw(e){var r=1/e,t=Math.sqrt(r*r-1);return Math.log(t+r)}Kw.signature=Ct;function Fz(e){return Math.asin(e)}Fz.signature=Ct;function jw(e){return nM(e)}jw.signature=Ct;function _z(e){return Math.atan(e)}_z.signature=Ct;function Oz(e,r){return Math.atan2(e,r)}Oz.signature=Ez;function eD(e){return aM(e)}eD.signature=Ct;function Bz(e){return Math.cos(e)}Bz.signature=Ct;function Pz(e){return Em(e)}Pz.signature=Ct;function rD(e){return 1/Math.tan(e)}rD.signature=Ct;function tD(e){var r=Math.exp(2*e);return(r+1)/(r-1)}tD.signature=Ct;function nD(e){return 1/Math.sin(e)}nD.signature=Ct;function aD(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Ba(e)}aD.signature=Ct;function iD(e){return 1/Math.cos(e)}iD.signature=Ct;function oD(e){return 2/(Math.exp(e)+Math.exp(-e))}oD.signature=Ct;function Iz(e){return Math.sin(e)}Iz.signature=Ct;function sD(e){return iM(e)}sD.signature=Ct;function Rz(e){return Math.tan(e)}Rz.signature=Ct;function qz(e){return Tm(e)}qz.signature=Ct;var Oc="number";function kz(e){return Ze(e)}kz.signature=Oc;function uD(e){return e<0}uD.signature=Oc;function fD(e){return e>0}fD.signature=Oc;function cD(e){return e===0}cD.signature=Oc;function lD(e){return Number.isNaN(e)}lD.signature=Oc;var KM="isNegative",Lz=["typed"],tp=F(KM,Lz,e=>{var{typed:r}=e;return r(KM,{number:uD,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:r.referToSelf(t=>n=>r.find(t,n.valueType())(n.value)),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var jM="isNumeric",zz=["typed"],np=F(jM,zz,e=>{var{typed:r}=e;return r(jM,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var e2="hasNumericValue",Uz=["typed","isNumeric"],ap=F(e2,Uz,e=>{var{typed:r,isNumeric:t}=e;return r(e2,{boolean:()=>!0,string:function(a){return a.trim().length>0&&!isNaN(Number(a))},any:function(a){return t(a)}})});var r2="isPositive",Wz=["typed"],ip=F(r2,Wz,e=>{var{typed:r}=e;return r(r2,{number:fD,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:r.referToSelf(t=>n=>r.find(t,n.valueType())(n.value)),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var t2="isZero",Yz=["typed"],op=F(t2,Yz,e=>{var{typed:r}=e;return r(t2,{number:cD,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:r.referToSelf(t=>n=>r.find(t,n.valueType())(n.value)),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var n2="isNaN",Hz=["typed"],sp=F(n2,Hz,e=>{var{typed:r}=e;return r(n2,{number:lD,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return je(n,Number.isNaN)}})});var a2="typeOf",$z=["typed"],up=F(a2,$z,e=>{var{typed:r}=e;return r(a2,{any:Tr})});function $t(e,r,t){if(t==null)return e.eq(r);if(e.eq(r))return!0;if(e.isNaN()||r.isNaN())return!1;if(e.isFinite()&&r.isFinite()){var n=e.minus(r).abs();if(n.isZero())return!0;var a=e.constructor.max(e.abs(),r.abs());return n.lte(a.times(t))}return!1}function i2(e,r,t){return At(e.re,r.re,t)&&At(e.im,r.im,t)}var Ia=F("compareUnits",["typed"],e=>{var{typed:r}=e;return{"Unit, Unit":r.referToSelf(t=>(n,a)=>{if(!n.equalBase(a))throw new Error("Cannot compare units with different base");return r.find(t,[n.valueType(),a.valueType()])(n.value,a.value)})}});var fp="equalScalar",Gz=["typed","config"],cp=F(fp,Gz,e=>{var{typed:r,config:t}=e,n=Ia({typed:r});return r(fp,{"boolean, boolean":function(i,u){return i===u},"number, number":function(i,u){return At(i,u,t.epsilon)},"BigNumber, BigNumber":function(i,u){return i.eq(u)||$t(i,u,t.epsilon)},"Fraction, Fraction":function(i,u){return i.equals(u)},"Complex, Complex":function(i,u){return i2(i,u,t.epsilon)}},n)}),mee=F(fp,["typed","config"],e=>{var{typed:r,config:t}=e;return r(fp,{"number, number":function(a,i){return At(a,i,t.epsilon)}})});var Vz="SparseMatrix",Zz=["typed","equalScalar","Matrix"],lp=F(Vz,Zz,e=>{var{typed:r,equalScalar:t,Matrix:n}=e;function a(v,x){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(x&&!St(x))throw new Error("Invalid datatype: "+x);if(Qe(v))i(this,v,x);else if(v&&Mr(v.index)&&Mr(v.ptr)&&Mr(v.size))this._values=v.values,this._index=v.index,this._ptr=v.ptr,this._size=v.size,this._datatype=x||v.datatype;else if(Mr(v))u(this,v,x);else{if(v)throw new TypeError("Unsupported type of data ("+Tr(v)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=x}}function i(v,x,w){x.type==="SparseMatrix"?(v._values=x._values?ar(x._values):void 0,v._index=ar(x._index),v._ptr=ar(x._ptr),v._size=ar(x._size),v._datatype=w||x._datatype):u(v,x.valueOf(),w||x._datatype)}function u(v,x,w){v._values=[],v._index=[],v._ptr=[],v._datatype=w;var C=x.length,b=0,N=t,M=0;if(St(w)&&(N=r.find(t,[w,w])||t,M=r.convert(0,w)),C>0){var S=0;do{v._ptr.push(v._index.length);for(var O=0;O");if(b.length===1){var _=x.dimension(0);_.forEach(function(R,k){Kr(R),v.set([R,0],w[k[0]],C)})}else{var E=x.dimension(0),T=x.dimension(1);E.forEach(function(R,k){Kr(R),T.forEach(function(W,G){Kr(W),v.set([R,W],w[k[0]][G[0]],C)})})}}return v}a.prototype.get=function(v){if(!Mr(v))throw new TypeError("Array expected");if(v.length!==this._size.length)throw new pr(v.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var x=v[0],w=v[1];Kr(x,this._size[0]),Kr(w,this._size[1]);var C=o(x,this._ptr[w],this._ptr[w+1],this._index);return CN-1||b>M-1)&&(d(this,Math.max(C+1,N),Math.max(b+1,M),w),N=this._size[0],M=this._size[1]),Kr(C,N),Kr(b,M);var _=o(C,this._ptr[b],this._ptr[b+1],this._index);return _Array.isArray(N)&&N.length===1?N[0]:N);if(C.length!==2)throw new Error("Only two dimensions matrix are supported");C.forEach(function(N){if(!sr(N)||!Ze(N)||N<0)throw new TypeError("Invalid size, must contain positive integers (size: "+lr(C)+")")});var b=w?this.clone():this;return d(b,C[0],C[1],x)};function d(v,x,w,C){var b=C||0,N=t,M=0;St(v._datatype)&&(N=r.find(t,[v._datatype,v._datatype])||t,M=r.convert(0,v._datatype),b=r.convert(b,v._datatype));var S=!N(b,M),O=v._size[0],_=v._size[1],E,T,R;if(w>_){for(T=_;TO){if(S){var k=0;for(T=0;T<_;T++){v._ptr[T]=v._ptr[T]+k,R=v._ptr[T+1]+k;var W=0;for(E=O;Ex-1&&(v._values.splice(R,1),v._index.splice(R,1),G++)}v._ptr[T]=v._values.length}return v._size[0]=x,v._size[1]=w,v}a.prototype.reshape=function(v,x){if(!Mr(v))throw new TypeError("Array expected");if(v.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");v.forEach(function(z){if(!sr(z)||!Ze(z)||z<=-2||z===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+lr(v)+")")});var w=this._size[0]*this._size[1];v=Mc(v,w);var C=v[0]*v[1];if(w!==C)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var b=x?this.clone():this;if(this._size[0]===v[0]&&this._size[1]===v[1])return b;for(var N=[],M=0;M=x&&L<=w&&R(v._values[H],L-x,k-C)}else{for(var q={},K=W;KNp,createAccessorNode:()=>Dv,createAcos:()=>_h,createAcosh:()=>Oh,createAcot:()=>Bh,createAcoth:()=>Ph,createAcsc:()=>Ih,createAcsch:()=>Rh,createAdd:()=>mv,createAddScalar:()=>Mp,createAnd:()=>ju,createAndTransform:()=>zy,createApply:()=>Lo,createApplyTransform:()=>by,createArg:()=>Kp,createArrayNode:()=>Nv,createAsec:()=>qh,createAsech:()=>kh,createAsin:()=>Lh,createAsinh:()=>zh,createAssignmentNode:()=>Ev,createAtan:()=>Uh,createAtan2:()=>Wh,createAtanh:()=>Yh,createAtomicMass:()=>K0,createAvogadro:()=>j0,createBellNumbers:()=>$g,createBigNumberClass:()=>Ym,createBignumber:()=>dp,createBin:()=>Pd,createBitAnd:()=>ku,createBitAndTransform:()=>Wy,createBitNot:()=>Xp,createBitOr:()=>Lu,createBitOrTransform:()=>Yy,createBitXor:()=>Jp,createBlockNode:()=>Fv,createBohrMagneton:()=>O0,createBohrRadius:()=>k0,createBoltzmann:()=>ey,createBoolean:()=>pp,createCatalan:()=>Gg,createCbrt:()=>Ep,createCeil:()=>Tp,createChain:()=>hg,createChainClass:()=>pg,createClassicalElectronRadius:()=>L0,createClone:()=>Xm,createColumn:()=>Wu,createColumnTransform:()=>wy,createCombinations:()=>Og,createCombinationsWithRep:()=>Bg,createCompare:()=>nh,createCompareNatural:()=>ah,createCompareText:()=>ih,createCompile:()=>rg,createComplex:()=>hp,createComplexClass:()=>Hm,createComposition:()=>Vg,createConcat:()=>Uu,createConcatTransform:()=>Oy,createConditionalNode:()=>Ov,createConductanceQuantum:()=>B0,createConj:()=>jp,createConstantNode:()=>Rv,createCorr:()=>_g,createCos:()=>Hh,createCosh:()=>$h,createCot:()=>Gh,createCoth:()=>Vh,createCoulomb:()=>F0,createCount:()=>ad,createCreateUnit:()=>Fh,createCross:()=>id,createCsc:()=>Zh,createCsch:()=>Qh,createCtranspose:()=>Nd,createCube:()=>Fp,createCumSum:()=>af,createCumSumTransform:()=>qy,createDeepEqual:()=>gh,createDenseMatrixClass:()=>Qm,createDerivative:()=>e0,createDet:()=>vg,createDeuteronMass:()=>$0,createDiag:()=>od,createDiff:()=>Yu,createDiffTransform:()=>By,createDistance:()=>Mg,createDivide:()=>Ag,createDivideScalar:()=>Ud,createDot:()=>hv,createDotDivide:()=>Zd,createDotMultiply:()=>Zp,createDotPow:()=>Vd,createE:()=>p0,createEfimovFactor:()=>J0,createEigs:()=>xg,createElectricConstant:()=>E0,createElectronMass:()=>z0,createElementaryCharge:()=>_0,createEqual:()=>sh,createEqualScalar:()=>fp,createEqualText:()=>uh,createErf:()=>Td,createEvaluate:()=>tg,createExp:()=>_p,createExpm:()=>bg,createExpm1:()=>Op,createFactorial:()=>Rg,createFalse:()=>s0,createFaraday:()=>ry,createFermiCoupling:()=>U0,createFft:()=>Md,createFibonacciHeapClass:()=>Nh,createFilter:()=>sd,createFilterTransform:()=>Dy,createFineStructure:()=>W0,createFirstRadiation:()=>ty,createFix:()=>Bp,createFlatten:()=>ud,createFloor:()=>Pu,createForEach:()=>fd,createForEachTransform:()=>Sy,createFormat:()=>Bd,createFraction:()=>vp,createFractionClass:()=>$m,createFreqz:()=>n0,createFunctionAssignmentNode:()=>kv,createFunctionNode:()=>jv,createGamma:()=>Pg,createGasConstant:()=>ay,createGcd:()=>Pp,createGetMatrixDataType:()=>cd,createGravitationConstant:()=>N0,createGravity:()=>py,createHartreeEnergy:()=>Y0,createHasNumericValue:()=>np,createHelp:()=>dg,createHelpClass:()=>mg,createHex:()=>Rd,createHypot:()=>pv,createI:()=>w0,createIdentity:()=>ld,createIfft:()=>Cd,createIm:()=>ed,createImmutableDenseMatrixClass:()=>Dh,createIndex:()=>gv,createIndexClass:()=>Sh,createIndexNode:()=>zv,createIndexTransform:()=>Ny,createInfinity:()=>f0,createIntersect:()=>Cg,createInv:()=>gg,createInverseConductanceQuantum:()=>P0,createInvmod:()=>Gp,createIsInteger:()=>jm,createIsNaN:()=>op,createIsNegative:()=>rp,createIsNumeric:()=>tp,createIsPositive:()=>ap,createIsPrime:()=>Ld,createIsZero:()=>ip,createKldivergence:()=>qg,createKlitzing:()=>q0,createKron:()=>md,createLN10:()=>v0,createLN2:()=>h0,createLOG10E:()=>y0,createLOG2E:()=>g0,createLarger:()=>dh,createLargerEq:()=>vh,createLcm:()=>Ip,createLeafCount:()=>Zg,createLeftShift:()=>jd,createLgamma:()=>Ig,createLog:()=>Hd,createLog10:()=>Rp,createLog1p:()=>$d,createLog2:()=>qp,createLoschmidt:()=>ny,createLsolve:()=>Qd,createLsolveAll:()=>Jd,createLup:()=>ig,createLusolve:()=>cg,createLyap:()=>Ng,createMad:()=>Fg,createMagneticConstant:()=>C0,createMagneticFluxQuantum:()=>I0,createMap:()=>pd,createMapTransform:()=>Ay,createMatrix:()=>gp,createMatrixClass:()=>Vm,createMatrixFromColumns:()=>bp,createMatrixFromFunction:()=>yp,createMatrixFromRows:()=>xp,createMax:()=>ef,createMaxTransform:()=>My,createMean:()=>of,createMeanTransform:()=>Cy,createMedian:()=>Tg,createMin:()=>rf,createMinTransform:()=>Ey,createMod:()=>Iu,createMode:()=>_d,createMolarMass:()=>ly,createMolarMassC12:()=>my,createMolarPlanckConstant:()=>iy,createMolarVolume:()=>oy,createMultinomial:()=>kg,createMultiply:()=>Lp,createMultiplyScalar:()=>kp,createNaN:()=>c0,createNeutronMass:()=>G0,createNode:()=>xv,createNorm:()=>dv,createNot:()=>td,createNthRoot:()=>zp,createNthRoots:()=>Gd,createNuclearMagneton:()=>R0,createNull:()=>u0,createNumber:()=>lp,createNumeric:()=>zd,createObjectNode:()=>Wv,createOct:()=>Id,createOnes:()=>dd,createOperatorNode:()=>Hv,createOr:()=>zu,createOrTransform:()=>Uy,createParenthesisNode:()=>Gv,createParse:()=>eg,createParser:()=>ag,createParserClass:()=>ng,createPartitionSelect:()=>bh,createPermutations:()=>Lg,createPhi:()=>d0,createPi:()=>l0,createPickRandom:()=>Ug,createPinv:()=>yg,createPlanckCharge:()=>gy,createPlanckConstant:()=>A0,createPlanckLength:()=>dy,createPlanckMass:()=>hy,createPlanckTemperature:()=>yy,createPlanckTime:()=>vy,createPolynomialRoot:()=>lg,createPow:()=>Wd,createPrint:()=>Qu,createPrintTransform:()=>Ly,createProd:()=>Od,createProtonMass:()=>H0,createQr:()=>og,createQuantileSeq:()=>uf,createQuantileSeqTransform:()=>Ry,createQuantumOfCirculation:()=>V0,createRandom:()=>Wg,createRandomInt:()=>Yg,createRange:()=>$u,createRangeClass:()=>Gm,createRangeNode:()=>Zv,createRangeTransform:()=>Ty,createRationalize:()=>r0,createRe:()=>rd,createReducedPlanckConstant:()=>M0,createRelationalNode:()=>Xv,createReplacer:()=>i0,createReshape:()=>gd,createResize:()=>yd,createResolve:()=>Kg,createResultSet:()=>Im,createReviver:()=>a0,createRightArithShift:()=>eh,createRightLogShift:()=>rh,createRotate:()=>xd,createRotationMatrix:()=>bd,createRound:()=>Yd,createRow:()=>Gu,createRowTransform:()=>Fy,createRydberg:()=>Z0,createSQRT1_2:()=>x0,createSQRT2:()=>b0,createSackurTetrode:()=>sy,createSchur:()=>Sg,createSec:()=>Xh,createSech:()=>Jh,createSecondRadiation:()=>uy,createSetCartesian:()=>tv,createSetDifference:()=>nv,createSetDistinct:()=>av,createSetIntersect:()=>iv,createSetIsSubset:()=>ov,createSetMultiplicity:()=>sv,createSetPowerset:()=>uv,createSetSize:()=>fv,createSetSymDifference:()=>cv,createSetUnion:()=>lv,createSign:()=>Up,createSimplify:()=>Qg,createSimplifyConstant:()=>Xg,createSimplifyCore:()=>Jg,createSin:()=>Kh,createSinh:()=>jh,createSize:()=>wd,createSlu:()=>fg,createSmaller:()=>ch,createSmallerEq:()=>mh,createSolveODE:()=>Ed,createSort:()=>wh,createSpaClass:()=>Ah,createSparse:()=>Th,createSparseMatrixClass:()=>cp,createSpeedOfLight:()=>S0,createSplitUnit:()=>wp,createSqrt:()=>Wp,createSqrtm:()=>wg,createSquare:()=>Yp,createSqueeze:()=>Dd,createStd:()=>ff,createStdTransform:()=>Py,createStefanBoltzmann:()=>fy,createStirlingS2:()=>Hg,createString:()=>mp,createSubset:()=>Vu,createSubsetTransform:()=>_y,createSubtract:()=>Hp,createSubtractScalar:()=>Cp,createSum:()=>nf,createSumTransform:()=>Iy,createSylvester:()=>Dg,createSymbolNode:()=>Jv,createSymbolicEqual:()=>jg,createTan:()=>ev,createTanh:()=>rv,createTau:()=>m0,createThomsonCrossSection:()=>Q0,createTo:()=>kd,createTrace:()=>vv,createTranspose:()=>Sd,createTrue:()=>o0,createTypeOf:()=>sp,createTyped:()=>Pm,createUnaryMinus:()=>Dp,createUnaryPlus:()=>Sp,createUnequal:()=>xh,createUnitClass:()=>Ch,createUnitFunction:()=>Eh,createUppercaseE:()=>vP,createUppercasePi:()=>hP,createUsolve:()=>Xd,createUsolveAll:()=>Kd,createVacuumImpedance:()=>T0,createVariance:()=>sf,createVarianceTransform:()=>ky,createVersion:()=>D0,createWeakMixingAngle:()=>X0,createWienDisplacement:()=>cy,createXgcd:()=>$p,createXor:()=>nd,createZeros:()=>Ad,createZeta:()=>Fd,createZpk2tf:()=>t0});var aw=ma(Nm(),1);function Ze(e){return typeof e=="boolean"?!0:isFinite(e)?e===Math.round(e):!1}var Ba=Math.sign||function(e){return e>0?1:e<0?-1:0},JA=Math.log2||function(r){return Math.log(r)/Math.LN2},KA=Math.log10||function(r){return Math.log(r)/Math.LN10},Am=Math.log1p||function(e){return Math.log(e+1)},jA=Math.cbrt||function(r){if(r===0)return r;var t=r<0,n;return t&&(r=-r),isFinite(r)?(n=Math.exp(Math.log(r)/3),n=(r/(n*n)+2*n)/3):n=r,t?-n:n},eM=Math.expm1||function(r){return r>=2e-4||r<=-2e-4?Math.exp(r)-1:r+r*r/2+r*r*r/6};function Hb(e,r,t){var n={2:"0b",8:"0o",16:"0x"},a=n[r],i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Ze(t))throw new Error("size must be an integer");if(e>2**(t-1)-1||e<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!Ze(e))throw new Error("Value must be an integer");e<0&&(e=e+2**t),i="i".concat(t)}var s="";return e<0&&(e=-e,s="-"),"".concat(s).concat(a).concat(e.toString(r)).concat(i)}function ai(e,r){if(typeof r=="function")return r(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:t,precision:n,wordSize:a}=$b(r);switch(t){case"fixed":return Gb(e,n);case"exponential":return rM(e,n);case"engineering":return Vk(e,n);case"bin":return Hb(e,2,a);case"oct":return Hb(e,8,a);case"hex":return Hb(e,16,a);case"auto":return Zk(e,n,r).replace(/((\\.\\d*?)(0+))($|e)/,function(){var i=arguments[2],s=arguments[4];return i!=="."?i+s:s});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function $b(e){var r="auto",t,n;if(e!==void 0)if(sr(e))t=e;else if(rr(e))t=e.toNumber();else if(Ci(e))e.precision!==void 0&&(t=QA(e.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),e.wordSize!==void 0&&(n=QA(e.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(r=e.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:r,precision:t,wordSize:n}}function Nu(e){var r=String(e).toLowerCase().match(/^(-?)(\\d+\\.?\\d*)(e([+-]?\\d+))?$/);if(!r)throw new SyntaxError("Invalid number "+e);var t=r[1],n=r[2],a=parseFloat(r[4]||"0"),i=n.indexOf(".");a+=i!==-1?i-1:n.length-1;var s=n.replace(".","").replace(/^0*/,function(l){return a-=l.length,""}).replace(/0*$/,"").split("").map(function(l){return parseInt(l)});return s.length===0&&(s.push(0),a++),{sign:t,coefficients:s,exponent:a}}function Vk(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=Nu(e),n=Mm(t,r),a=n.exponent,i=n.coefficients,s=a%3===0?a:a<0?a-3-a%3:a-a%3;if(sr(r))for(;r>i.length||a-s+1>i.length;)i.push(0);else for(var l=Math.abs(a-s)-(i.length-1),c=0;c0;)u++,o--;var m=i.slice(u).join(""),d=sr(r)&&m.length||m.match(/[1-9]/)?"."+m:"",h=i.slice(0,u).join("")+d+"e"+(a>=0?"+":"")+s.toString();return n.sign+h}function Gb(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=Nu(e),n=typeof r=="number"?Mm(t,t.exponent+1+r):t,a=n.coefficients,i=n.exponent+1,s=i+(r||0);return a.length0?"."+a.join(""):"")+"e"+(i>=0?"+":"")+i}function Zk(e,r,t){if(isNaN(e)||!isFinite(e))return String(e);var n=XA(t?.lowerExp,-3),a=XA(t?.upperExp,5),i=Nu(e),s=r?Mm(i,r):i;if(s.exponent=a)return rM(e,r);var l=s.coefficients,c=s.exponent;l.length0?c:0;return or){var a=n.splice(r,n.length-r);if(a[0]>=5){var i=r-1;for(n[i]++;n[i]===10;)n.pop(),i===0&&(n.unshift(0),t.exponent++,i++),i--,n[i]++}}return t}function Su(e){for(var r=[],t=0;t0?!0:e<0?!1:1/e===1/0,n=r>0?!0:r<0?!1:1/r===1/0;return t^n?-e:e}function QA(e,r){if(sr(e))return e;if(rr(e))return e.toNumber();r()}function XA(e,r){return sr(e)?e:rr(e)?e.toNumber():r}function Vb(e,r,t){var n=e.constructor,a=new n(2),i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!Ze(t))throw new Error("size must be an integer");if(e.greaterThan(a.pow(t-1).sub(1))||e.lessThan(a.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(a.pow(t))),i="i".concat(t)}switch(r){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(r," not supported "))}}function cM(e,r){if(typeof r=="function")return r(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:n,wordSize:a}=$b(r);switch(t){case"fixed":return Jk(e,n);case"exponential":return uM(e,n);case"engineering":return Xk(e,n);case"bin":return Vb(e,2,a);case"oct":return Vb(e,8,a);case"hex":return Vb(e,16,a);case"auto":{var i=fM(r?.lowerExp,-3),s=fM(r?.upperExp,5);if(e.isZero())return"0";var l,c=e.toSignificantDigits(n),o=c.e;return o>=i&&o=0?"+":"")+n.toString()}function uM(e,r){return r!==void 0?e.toExponential(r-1):e.toExponential()}function Jk(e,r){return e.toFixed(r)}function fM(e,r){return sr(e)?e:rr(e)?e.toNumber():r}function mM(e,r){var t=e.length-r.length,n=e.length;return e.substring(t,n)===r}function lr(e,r){var t=Kk(e,r);return r&&typeof r=="object"&&"truncate"in r&&t.length>r.truncate?t.substring(0,r.truncate-3)+"...":t}function Kk(e,r){if(typeof e=="number")return ai(e,r);if(rr(e))return cM(e,r);if(jk(e))return!r||r.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return pM(e,r);if(St(e))return Ns(e);if(typeof e=="function")return e.syntax?String(e.syntax):"function";if(e&&typeof e=="object"){if(typeof e.format=="function")return e.format(r);if(e&&e.toString(r)!=={}.toString())return e.toString(r);var t=Object.keys(e).map(n=>Ns(n)+": "+lr(e[n],r));return"{"+t.join(", ")+"}"}return String(e)}function Ns(e){for(var r=String(e),t="",n=0;n/g,">"),r}function pM(e,r){if(Array.isArray(e)){for(var t="[",n=e.length,a=0;ar?1:-1}function pr(e,r,t){if(!(this instanceof pr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=r,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=new Error().stack}pr.prototype=new RangeError;pr.prototype.constructor=RangeError;pr.prototype.name="DimensionError";pr.prototype.isDimensionError=!0;function tn(e,r,t){if(!(this instanceof tn))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=r):(this.min=r,this.max=t),this.min!==void 0&&this.index=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}tn.prototype=new RangeError;tn.prototype.constructor=RangeError;tn.prototype.name="IndexError";tn.prototype.isIndexError=!0;function ur(e){for(var r=[];Array.isArray(e);)r.push(e.length),e=e[0];return r}function dM(e,r,t){var n,a=e.length;if(a!==r[t])throw new pr(a,r[t]);if(t")}function Qb(e,r){var t=r.length===0;if(t){if(Array.isArray(e))throw new pr(e.length,0)}else dM(e,r,0)}function Nc(e,r){var t=e.isMatrix?e._size:ur(e),n=r._sourceSize;n.forEach((a,i)=>{if(a!==null&&a!==t[i])throw new pr(a,t[i])})}function Kr(e,r){if(e!==void 0){if(!sr(e)||!Ze(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof r=="number"&&e>=r)throw new tn(e,r)}}function As(e){for(var r=0;r=0,c=r%t===0;if(l)if(c)n[i]=-r/t;else throw new Error("Could not replace wildcard, since "+r+" is no multiple of "+-t);return n}function hM(e){return e.reduce((r,t)=>r*t,1)}function eL(e,r){for(var t=e,n,a=r.length-1;a>0;a--){var i=r[a];n=[];for(var s=t.length/i,l=0;lr.test(t))}function Xb(e,r){return Array.prototype.join.call(e,r)}function Ki(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(e.length===0)return e;var r=[],t=0;r[0]={value:e[0],identifier:0};for(var n=1;n1)return e.slice(1).reduce(function(t,n){return yM(t,n,r,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function rL(){for(var e=arguments.length,r=new Array(e),t=0;td.length),a=Math.max(...n),i=new Array(a).fill(null),s=0;si[u]&&(i[u]=l[o])}for(var m=0;m1||e[a]>r[i])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[a]," to size ").concat(r[i]))}}function jb(e,r){var t=ur(e);if(ni(t,r))return e;Cc(t,r);var n=rL(t,r),a=n.length,i=[...Array(a-t.length).fill(1),...t],s=nL(e);t.length!iL(i)).every(i=>t[i]!==void 0);if(!n){var a=r.filter(i=>t[i]===void 0);throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(a.map(i=>'"'.concat(i,'"')).join(", "),"."))}}function iL(e){return e&&e[0]==="?"}function ew(e){return e&&e[0]==="?"?e.slice(1):e}function wt(e,r){if(DM(e)&&bM(e,r))return e[r];throw typeof e[r]=="function"&&Om(e,r)?new Error('Cannot access method "'+r+'" as a property'):new Error('No access to property "'+r+'"')}function Ti(e,r,t){if(DM(e)&&bM(e,r))return e[r]=t,t;throw new Error('No access to property "'+r+'"')}function xM(e,r){return r in e}function bM(e,r){return!e||typeof e!="object"?!1:Xe(oL,r)?!0:!(r in Object.prototype||r in Function.prototype)}function wM(e,r){if(!Om(e,r))throw new Error('No access to method "'+r+'"');return e[r]}function Om(e,r){return e==null||typeof e[r]!="function"||Xe(e,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(e)?!1:Xe(sL,r)?!0:!(r in Object.prototype||r in Function.prototype)}function DM(e){return typeof e=="object"&&e&&e.constructor===Object}var oL={length:!0,name:!0},sL={toString:!0,valueOf:!0,toLocaleString:!0};var Cs=class{constructor(r){this.wrappedObject=r,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(r){return wt(this.wrappedObject,r)}set(r,t){return Ti(this.wrappedObject,r,t),this}has(r){return xM(this.wrappedObject,r)}entries(){return SM(this.keys(),r=>[r,this.get(r)])}forEach(r){for(var t of this.keys())r(this.get(t),t,this)}delete(r){delete this.wrappedObject[r]}clear(){for(var r of this.keys())this.delete(r)}get size(){return Object.keys(this.wrappedObject).length}},Eu=class{constructor(r,t,n){this.a=r,this.b=t,this.bKeys=n,this[Symbol.iterator]=this.entries}get(r){return this.bKeys.has(r)?this.b.get(r):this.a.get(r)}set(r,t){return this.bKeys.has(r)?this.b.set(r,t):this.a.set(r,t),this}has(r){return this.b.has(r)||this.a.has(r)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return SM(this.keys(),r=>[r,this.get(r)])}forEach(r){for(var t of this.keys())r(this.get(t),t,this)}delete(r){return this.bKeys.has(r)?this.b.delete(r):this.a.delete(r)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function SM(e,r){return{next:()=>{var t=e.next();return t.done?t:{value:r(t.value),done:!1}}}}function Bo(){return new Map}function ji(e){if(!e)return Bo();if(rw(e))return e;if(Ci(e))return new Cs(e);throw new Error("createMap can create maps from objects or Maps")}function NM(e){if(e instanceof Cs)return e.wrappedObject;var r={};for(var t of e.keys()){var n=e.get(t);Ti(r,t,n)}return r}function rw(e){return e?e instanceof Map||e instanceof Cs||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}var AM=function(){return AM=aw.default.create,aw.default},uL=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Pm=F("typed",uL,function(r){var{BigNumber:t,Complex:n,DenseMatrix:a,Fraction:i}=r,s=AM();return s.clear(),s.addTypes([{name:"number",test:sr},{name:"Complex",test:Kt},{name:"BigNumber",test:rr},{name:"Fraction",test:da},{name:"Unit",test:Ht},{name:"identifier",test:l=>St&&/^(?:[A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088E\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5D\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7CA\\uA7D0\\uA7D1\\uA7D3\\uA7D5-\\uA7D9\\uA7F2-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF2D-\\uDF40\\uDF42-\\uDF49\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDD70-\\uDD7A\\uDD7C-\\uDD8A\\uDD8C-\\uDD92\\uDD94\\uDD95\\uDD97-\\uDDA1\\uDDA3-\\uDDB1\\uDDB3-\\uDDB9\\uDDBB\\uDDBC\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67\\uDF80-\\uDF85\\uDF87-\\uDFB0\\uDFB2-\\uDFBA]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDD00-\\uDD23\\uDE80-\\uDEA9\\uDEB0\\uDEB1\\uDF00-\\uDF1C\\uDF27\\uDF30-\\uDF45\\uDF70-\\uDF81\\uDFB0-\\uDFC4\\uDFE0-\\uDFF6]|\\uD804[\\uDC03-\\uDC37\\uDC71\\uDC72\\uDC75\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD44\\uDD47\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE3F\\uDE40\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC5F-\\uDC61\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDEB8\\uDF00-\\uDF1A\\uDF40-\\uDF46]|\\uD806[\\uDC00-\\uDC2B\\uDCA0-\\uDCDF\\uDCFF-\\uDD06\\uDD09\\uDD0C-\\uDD13\\uDD15\\uDD16\\uDD18-\\uDD2F\\uDD3F\\uDD41\\uDDA0-\\uDDA7\\uDDAA-\\uDDD0\\uDDE1\\uDDE3\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE89\\uDE9D\\uDEB0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46\\uDD60-\\uDD65\\uDD67\\uDD68\\uDD6A-\\uDD89\\uDD98\\uDEE0-\\uDEF2\\uDF02\\uDF04-\\uDF10\\uDF12-\\uDF33\\uDFB0]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|\\uD80B[\\uDF90-\\uDFF0]|[\\uD80C\\uD81C-\\uD820\\uD822\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD887][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2F\\uDC41-\\uDC46]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDE40-\\uDE7F\\uDF00-\\uDF4A\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1\\uDFE3]|\\uD821[\\uDC00-\\uDFF7]|\\uD823[\\uDC00-\\uDCD5\\uDD00-\\uDD08]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD32\\uDD50-\\uDD52\\uDD55\\uDD64-\\uDD67\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD837[\\uDF00-\\uDF1E\\uDF25-\\uDF2A]|\\uD838[\\uDC30-\\uDC6D\\uDD00-\\uDD2C\\uDD37-\\uDD3D\\uDD4E\\uDE90-\\uDEAD\\uDEC0-\\uDEEB]|\\uD839[\\uDCD0-\\uDCEB\\uDFE0-\\uDFE6\\uDFE8-\\uDFEB\\uDFED\\uDFEE\\uDFF0-\\uDFFE]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43\\uDD4B]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF39\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD888[\\uDC00-\\uDFAF])(?:[0-9A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088E\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5D\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7CA\\uA7D0\\uA7D1\\uA7D3\\uA7D5-\\uA7D9\\uA7F2-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF2D-\\uDF40\\uDF42-\\uDF49\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDD70-\\uDD7A\\uDD7C-\\uDD8A\\uDD8C-\\uDD92\\uDD94\\uDD95\\uDD97-\\uDDA1\\uDDA3-\\uDDB1\\uDDB3-\\uDDB9\\uDDBB\\uDDBC\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67\\uDF80-\\uDF85\\uDF87-\\uDFB0\\uDFB2-\\uDFBA]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDD00-\\uDD23\\uDE80-\\uDEA9\\uDEB0\\uDEB1\\uDF00-\\uDF1C\\uDF27\\uDF30-\\uDF45\\uDF70-\\uDF81\\uDFB0-\\uDFC4\\uDFE0-\\uDFF6]|\\uD804[\\uDC03-\\uDC37\\uDC71\\uDC72\\uDC75\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD44\\uDD47\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE3F\\uDE40\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC5F-\\uDC61\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDEB8\\uDF00-\\uDF1A\\uDF40-\\uDF46]|\\uD806[\\uDC00-\\uDC2B\\uDCA0-\\uDCDF\\uDCFF-\\uDD06\\uDD09\\uDD0C-\\uDD13\\uDD15\\uDD16\\uDD18-\\uDD2F\\uDD3F\\uDD41\\uDDA0-\\uDDA7\\uDDAA-\\uDDD0\\uDDE1\\uDDE3\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE89\\uDE9D\\uDEB0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46\\uDD60-\\uDD65\\uDD67\\uDD68\\uDD6A-\\uDD89\\uDD98\\uDEE0-\\uDEF2\\uDF02\\uDF04-\\uDF10\\uDF12-\\uDF33\\uDFB0]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|\\uD80B[\\uDF90-\\uDFF0]|[\\uD80C\\uD81C-\\uD820\\uD822\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD887][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2F\\uDC41-\\uDC46]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDE40-\\uDE7F\\uDF00-\\uDF4A\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1\\uDFE3]|\\uD821[\\uDC00-\\uDFF7]|\\uD823[\\uDC00-\\uDCD5\\uDD00-\\uDD08]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD32\\uDD50-\\uDD52\\uDD55\\uDD64-\\uDD67\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD837[\\uDF00-\\uDF1E\\uDF25-\\uDF2A]|\\uD838[\\uDC30-\\uDC6D\\uDD00-\\uDD2C\\uDD37-\\uDD3D\\uDD4E\\uDE90-\\uDEAD\\uDEC0-\\uDEEB]|\\uD839[\\uDCD0-\\uDCEB\\uDFE0-\\uDFE6\\uDFE8-\\uDFEB\\uDFED\\uDFEE\\uDFF0-\\uDFFE]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43\\uDD4B]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF39\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD888[\\uDC00-\\uDFAF])*$/.test(l)},{name:"string",test:St},{name:"Chain",test:bu},{name:"Array",test:Mr},{name:"Matrix",test:Qe},{name:"DenseMatrix",test:Ji},{name:"SparseMatrix",test:ha},{name:"Range",test:Fo},{name:"Index",test:Mi},{name:"boolean",test:fm},{name:"ResultSet",test:cm},{name:"Help",test:xu},{name:"function",test:lm},{name:"Date",test:mm},{name:"RegExp",test:pm},{name:"null",test:dm},{name:"undefined",test:hm},{name:"AccessorNode",test:Ln},{name:"ArrayNode",test:jt},{name:"AssignmentNode",test:vm},{name:"BlockNode",test:gm},{name:"ConditionalNode",test:ym},{name:"ConstantNode",test:xr},{name:"FunctionNode",test:yn},{name:"FunctionAssignmentNode",test:Oa},{name:"IndexNode",test:Jn},{name:"Node",test:Nr},{name:"ObjectNode",test:Ei},{name:"OperatorNode",test:ct},{name:"ParenthesisNode",test:en},{name:"RangeNode",test:xm},{name:"RelationalNode",test:bm},{name:"SymbolNode",test:at},{name:"Map",test:rw},{name:"Object",test:Ci}]),s.addConversions([{from:"number",to:"BigNumber",convert:function(c){if(t||tw(c),tM(c)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+c+"). Use function bignumber(x) to convert to BigNumber.");return new t(c)}},{from:"number",to:"Complex",convert:function(c){return n||Bm(c),new n(c,0)}},{from:"BigNumber",to:"Complex",convert:function(c){return n||Bm(c),new n(c.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(c){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(c){return n||Bm(c),new n(c.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(c){i||nw(c);var o=new i(c);if(o.valueOf()!==c)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+c+"). Use function fraction(x) to convert to Fraction.");return o}},{from:"string",to:"number",convert:function(c){var o=Number(c);if(isNaN(o))throw new Error('Cannot convert "'+c+'" to a number');return o}},{from:"string",to:"BigNumber",convert:function(c){t||tw(c);try{return new t(c)}catch{throw new Error('Cannot convert "'+c+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(c){i||nw(c);try{return new i(c)}catch{throw new Error('Cannot convert "'+c+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(c){n||Bm(c);try{return new n(c)}catch{throw new Error('Cannot convert "'+c+'" to Complex')}}},{from:"boolean",to:"number",convert:function(c){return+c}},{from:"boolean",to:"BigNumber",convert:function(c){return t||tw(c),new t(+c)}},{from:"boolean",to:"Fraction",convert:function(c){return i||nw(c),new i(+c)}},{from:"boolean",to:"string",convert:function(c){return String(c)}},{from:"Array",to:"Matrix",convert:function(c){return a||fL(),new a(c)}},{from:"Matrix",to:"Array",convert:function(c){return c.valueOf()}}]),s.onMismatch=(l,c,o)=>{var u=s.createError(l,c,o);if(["wrongType","mismatch"].includes(u.data.category)&&c.length===1&&Nt(c[0])&&o.some(d=>!d.params.includes(","))){var m=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw m.data=u.data,m}throw u},s.onMismatch=(l,c,o)=>{var u=s.createError(l,c,o);if(["wrongType","mismatch"].includes(u.data.category)&&c.length===1&&Nt(c[0])&&o.some(d=>!d.params.includes(","))){var m=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw m.data=u.data,m}throw u},s});function tw(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function Bm(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function fL(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function nw(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var cL="ResultSet",lL=[],Im=F(cL,lL,()=>{function e(r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=r||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(r){return new e(r.entries)},e},{isClass:!0});var Tu=9e15,qo=1e9,iw="0123456789abcdef",qm="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",km="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ow={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Tu,maxE:Tu,crypto:!1},TM,eo,Cr=!0,zm="[DecimalError] ",Ro=zm+"Invalid argument: ",FM=zm+"Precision limit exceeded",_M=zm+"crypto unavailable",OM="[object Decimal]",Nn=Math.floor,nn=Math.pow,mL=/^0b([01]+(\\.[01]*)?|\\.[01]+)(p[+-]?\\d+)?$/i,pL=/^0x([0-9a-f]+(\\.[0-9a-f]*)?|\\.[0-9a-f]+)(p[+-]?\\d+)?$/i,dL=/^0o([0-7]+(\\.[0-7]*)?|\\.[0-7]+)(p[+-]?\\d+)?$/i,BM=/^(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,si=1e7,br=7,hL=9007199254740991,vL=qm.length-1,sw=km.length-1,Ue={toStringTag:OM};Ue.absoluteValue=Ue.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),hr(e)};Ue.ceil=function(){return hr(new this.constructor(this),this.e+1,2)};Ue.clampedTo=Ue.clamp=function(e,r){var t,n=this,a=n.constructor;if(e=new a(e),r=new a(r),!e.s||!r.s)return new a(NaN);if(e.gt(r))throw Error(Ro+r);return t=n.cmp(e),t<0?e:n.cmp(r)>0?r:new a(n)};Ue.comparedTo=Ue.cmp=function(e){var r,t,n,a,i=this,s=i.d,l=(e=new i.constructor(e)).d,c=i.s,o=e.s;if(!s||!l)return!c||!o?NaN:c!==o?c:s===l?0:!s^c<0?1:-1;if(!s[0]||!l[0])return s[0]?c:l[0]?-o:0;if(c!==o)return c;if(i.e!==e.e)return i.e>e.e^c<0?1:-1;for(n=s.length,a=l.length,r=0,t=nl[r]^c<0?1:-1;return n===a?0:n>a^c<0?1:-1};Ue.cosine=Ue.cos=function(){var e,r,t=this,n=t.constructor;return t.d?t.d[0]?(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+br,n.rounding=1,t=gL(n,kM(n,t)),n.precision=e,n.rounding=r,hr(eo==2||eo==3?t.neg():t,e,r,!0)):new n(1):new n(NaN)};Ue.cubeRoot=Ue.cbrt=function(){var e,r,t,n,a,i,s,l,c,o,u=this,m=u.constructor;if(!u.isFinite()||u.isZero())return new m(u);for(Cr=!1,i=u.s*nn(u.s*u,1/3),!i||Math.abs(i)==1/0?(t=xn(u.d),e=u.e,(i=(e-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=nn(t,1/3),e=Nn((e+1)/3)-(e%3==(e<0?-1:2)),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new m(t),n.s=u.s):n=new m(i.toString()),s=(e=m.precision)+3;;)if(l=n,c=l.times(l).times(l),o=c.plus(u),n=Dt(o.plus(u).times(l),o.plus(c),s+2,1),xn(l.d).slice(0,s)===(t=xn(n.d)).slice(0,s))if(t=t.slice(s-3,s+1),t=="9999"||!a&&t=="4999"){if(!a&&(hr(l,e+1,0),l.times(l).times(l).eq(u))){n=l;break}s+=4,a=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(hr(n,e+1,1),r=!n.times(n).times(n).eq(u));break}return Cr=!0,hr(n,e,m.rounding,r)};Ue.decimalPlaces=Ue.dp=function(){var e,r=this.d,t=NaN;if(r){if(e=r.length-1,t=(e-Nn(this.e/br))*br,e=r[e],e)for(;e%10==0;e/=10)t--;t<0&&(t=0)}return t};Ue.dividedBy=Ue.div=function(e){return Dt(this,new this.constructor(e))};Ue.dividedToIntegerBy=Ue.divToInt=function(e){var r=this,t=r.constructor;return hr(Dt(r,new t(e),0,1,1),t.precision,t.rounding)};Ue.equals=Ue.eq=function(e){return this.cmp(e)===0};Ue.floor=function(){return hr(new this.constructor(this),this.e+1,3)};Ue.greaterThan=Ue.gt=function(e){return this.cmp(e)>0};Ue.greaterThanOrEqualTo=Ue.gte=function(e){var r=this.cmp(e);return r==1||r===0};Ue.hyperbolicCosine=Ue.cosh=function(){var e,r,t,n,a,i=this,s=i.constructor,l=new s(1);if(!i.isFinite())return new s(i.s?1/0:NaN);if(i.isZero())return l;t=s.precision,n=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,a=i.d.length,a<32?(e=Math.ceil(a/3),r=(1/Wm(4,e)).toString()):(e=16,r="2.3283064365386962890625e-10"),i=Fu(s,1,i.times(r),new s(1),!0);for(var c,o=e,u=new s(8);o--;)c=i.times(i),i=l.minus(c.times(u.minus(c.times(u))));return hr(i,s.precision=t,s.rounding=n,!0)};Ue.hyperbolicSine=Ue.sinh=function(){var e,r,t,n,a=this,i=a.constructor;if(!a.isFinite()||a.isZero())return new i(a);if(r=i.precision,t=i.rounding,i.precision=r+Math.max(a.e,a.sd())+4,i.rounding=1,n=a.d.length,n<3)a=Fu(i,2,a,a,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,a=a.times(1/Wm(5,e)),a=Fu(i,2,a,a,!0);for(var s,l=new i(5),c=new i(16),o=new i(20);e--;)s=a.times(a),a=a.times(l.plus(s.times(c.times(s).plus(o))))}return i.precision=r,i.rounding=t,hr(a,r,t,!0)};Ue.hyperbolicTangent=Ue.tanh=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+7,n.rounding=1,Dt(t.sinh(),t.cosh(),n.precision=e,n.rounding=r)):new n(t.s)};Ue.inverseCosine=Ue.acos=function(){var e,r=this,t=r.constructor,n=r.abs().cmp(1),a=t.precision,i=t.rounding;return n!==-1?n===0?r.isNeg()?oi(t,a,i):new t(0):new t(NaN):r.isZero()?oi(t,a+4,i).times(.5):(t.precision=a+6,t.rounding=1,r=r.asin(),e=oi(t,a+4,i).times(.5),t.precision=a,t.rounding=i,e.minus(r))};Ue.inverseHyperbolicCosine=Ue.acosh=function(){var e,r,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(e=n.precision,r=n.rounding,n.precision=e+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,Cr=!1,t=t.times(t).minus(1).sqrt().plus(t),Cr=!0,n.precision=e,n.rounding=r,t.ln()):new n(t)};Ue.inverseHyperbolicSine=Ue.asinh=function(){var e,r,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,Cr=!1,t=t.times(t).plus(1).sqrt().plus(t),Cr=!0,n.precision=e,n.rounding=r,t.ln())};Ue.inverseHyperbolicTangent=Ue.atanh=function(){var e,r,t,n,a=this,i=a.constructor;return a.isFinite()?a.e>=0?new i(a.abs().eq(1)?a.s/0:a.isZero()?a:NaN):(e=i.precision,r=i.rounding,n=a.sd(),Math.max(n,e)<2*-a.e-1?hr(new i(a),e,r,!0):(i.precision=t=n-a.e,a=Dt(a.plus(1),new i(1).minus(a),t+e,1),i.precision=e+4,i.rounding=1,a=a.ln(),i.precision=e,i.rounding=r,a.times(.5))):new i(NaN)};Ue.inverseSine=Ue.asin=function(){var e,r,t,n,a=this,i=a.constructor;return a.isZero()?new i(a):(r=a.abs().cmp(1),t=i.precision,n=i.rounding,r!==-1?r===0?(e=oi(i,t+4,n).times(.5),e.s=a.s,e):new i(NaN):(i.precision=t+6,i.rounding=1,a=a.div(new i(1).minus(a.times(a)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,a.times(2)))};Ue.inverseTangent=Ue.atan=function(){var e,r,t,n,a,i,s,l,c,o=this,u=o.constructor,m=u.precision,d=u.rounding;if(o.isFinite()){if(o.isZero())return new u(o);if(o.abs().eq(1)&&m+4<=sw)return s=oi(u,m+4,d).times(.25),s.s=o.s,s}else{if(!o.s)return new u(NaN);if(m+4<=sw)return s=oi(u,m+4,d).times(.5),s.s=o.s,s}for(u.precision=l=m+10,u.rounding=1,t=Math.min(28,l/br+2|0),e=t;e;--e)o=o.div(o.times(o).plus(1).sqrt().plus(1));for(Cr=!1,r=Math.ceil(l/br),n=1,c=o.times(o),s=new u(o),a=o;e!==-1;)if(a=a.times(c),i=s.minus(a.div(n+=2)),a=a.times(c),s=i.plus(a.div(n+=2)),s.d[r]!==void 0)for(e=r;s.d[e]===i.d[e]&&e--;);return t&&(s=s.times(2<this.d.length-2};Ue.isNaN=function(){return!this.s};Ue.isNegative=Ue.isNeg=function(){return this.s<0};Ue.isPositive=Ue.isPos=function(){return this.s>0};Ue.isZero=function(){return!!this.d&&this.d[0]===0};Ue.lessThan=Ue.lt=function(e){return this.cmp(e)<0};Ue.lessThanOrEqualTo=Ue.lte=function(e){return this.cmp(e)<1};Ue.logarithm=Ue.log=function(e){var r,t,n,a,i,s,l,c,o=this,u=o.constructor,m=u.precision,d=u.rounding,h=5;if(e==null)e=new u(10),r=!0;else{if(e=new u(e),t=e.d,e.s<0||!t||!t[0]||e.eq(1))return new u(NaN);r=e.eq(10)}if(t=o.d,o.s<0||!t||!t[0]||o.eq(1))return new u(t&&!t[0]?-1/0:o.s!=1?NaN:t?0:1/0);if(r)if(t.length>1)i=!0;else{for(a=t[0];a%10===0;)a/=10;i=a!==1}if(Cr=!1,l=m+h,s=Io(o,l),n=r?Lm(u,l+10):Io(e,l),c=Dt(s,n,l,1),Ec(c.d,a=m,d))do if(l+=10,s=Io(o,l),n=r?Lm(u,l+10):Io(e,l),c=Dt(s,n,l,1),!i){+xn(c.d).slice(a+1,a+15)+1==1e14&&(c=hr(c,m+1,0));break}while(Ec(c.d,a+=10,d));return Cr=!0,hr(c,m,d)};Ue.minus=Ue.sub=function(e){var r,t,n,a,i,s,l,c,o,u,m,d,h=this,y=h.constructor;if(e=new y(e),!h.d||!e.d)return!h.s||!e.s?e=new y(NaN):h.d?e.s=-e.s:e=new y(e.d||h.s!==e.s?h:NaN),e;if(h.s!=e.s)return e.s=-e.s,h.plus(e);if(o=h.d,d=e.d,l=y.precision,c=y.rounding,!o[0]||!d[0]){if(d[0])e.s=-e.s;else if(o[0])e=new y(h);else return new y(c===3?-0:0);return Cr?hr(e,l,c):e}if(t=Nn(e.e/br),u=Nn(h.e/br),o=o.slice(),i=u-t,i){for(m=i<0,m?(r=o,i=-i,s=d.length):(r=d,t=u,s=o.length),n=Math.max(Math.ceil(l/br),s)+2,i>n&&(i=n,r.length=1),r.reverse(),n=i;n--;)r.push(0);r.reverse()}else{for(n=o.length,s=d.length,m=n0;--n)o[s++]=0;for(n=d.length;n>i;){if(o[--n]s?i+1:s+1,a>s&&(a=s,t.length=1),t.reverse();a--;)t.push(0);t.reverse()}for(s=o.length,a=u.length,s-a<0&&(a=s,t=u,u=o,o=t),r=0;a;)r=(o[--a]=o[a]+u[a]+r)/si|0,o[a]%=si;for(r&&(o.unshift(r),++n),s=o.length;o[--s]==0;)o.pop();return e.d=o,e.e=Um(o,n),Cr?hr(e,l,c):e};Ue.precision=Ue.sd=function(e){var r,t=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Ro+e);return t.d?(r=PM(t.d),e&&t.e+1>r&&(r=t.e+1)):r=NaN,r};Ue.round=function(){var e=this,r=e.constructor;return hr(new r(e),e.e+1,r.rounding)};Ue.sine=Ue.sin=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+br,n.rounding=1,t=xL(n,kM(n,t)),n.precision=e,n.rounding=r,hr(eo>2?t.neg():t,e,r,!0)):new n(NaN)};Ue.squareRoot=Ue.sqrt=function(){var e,r,t,n,a,i,s=this,l=s.d,c=s.e,o=s.s,u=s.constructor;if(o!==1||!l||!l[0])return new u(!o||o<0&&(!l||l[0])?NaN:l?s:1/0);for(Cr=!1,o=Math.sqrt(+s),o==0||o==1/0?(r=xn(l),(r.length+c)%2==0&&(r+="0"),o=Math.sqrt(r),c=Nn((c+1)/2)-(c<0||c%2),o==1/0?r="5e"+c:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+c),n=new u(r)):n=new u(o.toString()),t=(c=u.precision)+3;;)if(i=n,n=i.plus(Dt(s,i,t+2,1)).times(.5),xn(i.d).slice(0,t)===(r=xn(n.d)).slice(0,t))if(r=r.slice(t-3,t+1),r=="9999"||!a&&r=="4999"){if(!a&&(hr(i,c+1,0),i.times(i).eq(s))){n=i;break}t+=4,a=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(hr(n,c+1,1),e=!n.times(n).eq(s));break}return Cr=!0,hr(n,c,u.rounding,e)};Ue.tangent=Ue.tan=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+10,n.rounding=1,t=t.sin(),t.s=1,t=Dt(t,new n(1).minus(t.times(t)).sqrt(),e+10,0),n.precision=e,n.rounding=r,hr(eo==2||eo==4?t.neg():t,e,r,!0)):new n(NaN)};Ue.times=Ue.mul=function(e){var r,t,n,a,i,s,l,c,o,u=this,m=u.constructor,d=u.d,h=(e=new m(e)).d;if(e.s*=u.s,!d||!d[0]||!h||!h[0])return new m(!e.s||d&&!d[0]&&!h||h&&!h[0]&&!d?NaN:!d||!h?e.s/0:e.s*0);for(t=Nn(u.e/br)+Nn(e.e/br),c=d.length,o=h.length,c=0;){for(r=0,a=c+n;a>n;)l=i[a]+h[n]*d[a-n-1]+r,i[a--]=l%si|0,r=l/si|0;i[a]=(i[a]+r)%si|0}for(;!i[--s];)i.pop();return r?++t:i.shift(),e.d=i,e.e=Um(i,t),Cr?hr(e,m.precision,m.rounding):e};Ue.toBinary=function(e,r){return cw(this,2,e,r)};Ue.toDecimalPlaces=Ue.toDP=function(e,r){var t=this,n=t.constructor;return t=new n(t),e===void 0?t:(jn(e,0,qo),r===void 0?r=n.rounding:jn(r,0,8),hr(t,e+t.e+1,r))};Ue.toExponential=function(e,r){var t,n=this,a=n.constructor;return e===void 0?t=Fi(n,!0):(jn(e,0,qo),r===void 0?r=a.rounding:jn(r,0,8),n=hr(new a(n),e+1,r),t=Fi(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Ue.toFixed=function(e,r){var t,n,a=this,i=a.constructor;return e===void 0?t=Fi(a):(jn(e,0,qo),r===void 0?r=i.rounding:jn(r,0,8),n=hr(new i(a),e+a.e+1,r),t=Fi(n,!1,e+n.e+1)),a.isNeg()&&!a.isZero()?"-"+t:t};Ue.toFraction=function(e){var r,t,n,a,i,s,l,c,o,u,m,d,h=this,y=h.d,v=h.constructor;if(!y)return new v(h);if(o=t=new v(1),n=c=new v(0),r=new v(n),i=r.e=PM(y)-h.e-1,s=i%br,r.d[0]=nn(10,s<0?br+s:s),e==null)e=i>0?r:o;else{if(l=new v(e),!l.isInt()||l.lt(o))throw Error(Ro+l);e=l.gt(r)?i>0?r:o:l}for(Cr=!1,l=new v(xn(y)),u=v.precision,v.precision=i=y.length*br*2;m=Dt(l,r,0,1,1),a=t.plus(m.times(n)),a.cmp(e)!=1;)t=n,n=a,a=o,o=c.plus(m.times(a)),c=a,a=r,r=l.minus(m.times(a)),l=a;return a=Dt(e.minus(t),n,0,1,1),c=c.plus(a.times(o)),t=t.plus(a.times(n)),c.s=o.s=h.s,d=Dt(o,n,i,1).minus(h).abs().cmp(Dt(c,t,i,1).minus(h).abs())<1?[o,n]:[c,t],v.precision=u,Cr=!0,d};Ue.toHexadecimal=Ue.toHex=function(e,r){return cw(this,16,e,r)};Ue.toNearest=function(e,r){var t=this,n=t.constructor;if(t=new n(t),e==null){if(!t.d)return t;e=new n(1),r=n.rounding}else{if(e=new n(e),r===void 0?r=n.rounding:jn(r,0,8),!t.d)return e.s?t:e;if(!e.d)return e.s&&(e.s=t.s),e}return e.d[0]?(Cr=!1,t=Dt(t,e,0,r,1).times(e),Cr=!0,hr(t)):(e.s=t.s,t=e),t};Ue.toNumber=function(){return+this};Ue.toOctal=function(e,r){return cw(this,8,e,r)};Ue.toPower=Ue.pow=function(e){var r,t,n,a,i,s,l=this,c=l.constructor,o=+(e=new c(e));if(!l.d||!e.d||!l.d[0]||!e.d[0])return new c(nn(+l,o));if(l=new c(l),l.eq(1))return l;if(n=c.precision,i=c.rounding,e.eq(1))return hr(l,n,i);if(r=Nn(e.e/br),r>=e.d.length-1&&(t=o<0?-o:o)<=hL)return a=IM(c,l,t,n),e.s<0?new c(1).div(a):hr(a,n,i);if(s=l.s,s<0){if(rc.maxE+1||r0?s/0:0):(Cr=!1,c.rounding=l.s=1,t=Math.min(12,(r+"").length),a=uw(e.times(Io(l,n+t)),n),a.d&&(a=hr(a,n+5,1),Ec(a.d,n,i)&&(r=n+10,a=hr(uw(e.times(Io(l,r+t)),r),r+5,1),+xn(a.d).slice(n+1,n+15)+1==1e14&&(a=hr(a,n+1,0)))),a.s=s,Cr=!0,c.rounding=i,hr(a,n,i))};Ue.toPrecision=function(e,r){var t,n=this,a=n.constructor;return e===void 0?t=Fi(n,n.e<=a.toExpNeg||n.e>=a.toExpPos):(jn(e,1,qo),r===void 0?r=a.rounding:jn(r,0,8),n=hr(new a(n),e,r),t=Fi(n,e<=n.e||n.e<=a.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+t:t};Ue.toSignificantDigits=Ue.toSD=function(e,r){var t=this,n=t.constructor;return e===void 0?(e=n.precision,r=n.rounding):(jn(e,1,qo),r===void 0?r=n.rounding:jn(r,0,8)),hr(new n(t),e,r)};Ue.toString=function(){var e=this,r=e.constructor,t=Fi(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()&&!e.isZero()?"-"+t:t};Ue.truncated=Ue.trunc=function(){return hr(new this.constructor(this),this.e+1,1)};Ue.valueOf=Ue.toJSON=function(){var e=this,r=e.constructor,t=Fi(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()?"-"+t:t};function xn(e){var r,t,n,a=e.length-1,i="",s=e[0];if(a>0){for(i+=s,r=1;rt)throw Error(Ro+e)}function Ec(e,r,t,n){var a,i,s,l;for(i=e[0];i>=10;i/=10)--r;return--r<0?(r+=br,a=0):(a=Math.ceil((r+1)/br),r%=br),i=nn(10,br-r),l=e[a]%i|0,n==null?r<3?(r==0?l=l/100|0:r==1&&(l=l/10|0),s=t<4&&l==99999||t>3&&l==49999||l==5e4||l==0):s=(t<4&&l+1==i||t>3&&l+1==i/2)&&(e[a+1]/i/100|0)==nn(10,r-2)-1||(l==i/2||l==0)&&(e[a+1]/i/100|0)==0:r<4?(r==0?l=l/1e3|0:r==1?l=l/100|0:r==2&&(l=l/10|0),s=(n||t<4)&&l==9999||!n&&t>3&&l==4999):s=((n||t<4)&&l+1==i||!n&&t>3&&l+1==i/2)&&(e[a+1]/i/1e3|0)==nn(10,r-3)-1,s}function Rm(e,r,t){for(var n,a=[0],i,s=0,l=e.length;st-1&&(a[n+1]===void 0&&(a[n+1]=0),a[n+1]+=a[n]/t|0,a[n]%=t)}return a.reverse()}function gL(e,r){var t,n,a;if(r.isZero())return r;n=r.d.length,n<32?(t=Math.ceil(n/3),a=(1/Wm(4,t)).toString()):(t=16,a="2.3283064365386962890625e-10"),e.precision+=t,r=Fu(e,1,r.times(a),new e(1));for(var i=t;i--;){var s=r.times(r);r=s.times(s).minus(s).times(8).plus(1)}return e.precision-=t,r}var Dt=function(){function e(n,a,i){var s,l=0,c=n.length;for(n=n.slice();c--;)s=n[c]*a+l,n[c]=s%i|0,l=s/i|0;return l&&n.unshift(l),n}function r(n,a,i,s){var l,c;if(i!=s)c=i>s?1:-1;else for(l=c=0;la[l]?1:-1;break}return c}function t(n,a,i,s){for(var l=0;i--;)n[i]-=l,l=n[i]1;)n.shift()}return function(n,a,i,s,l,c){var o,u,m,d,h,y,v,x,w,C,b,N,M,S,O,_,E,T,R,L,H=n.constructor,V=n.s==a.s?1:-1,W=n.d,k=a.d;if(!W||!W[0]||!k||!k[0])return new H(!n.s||!a.s||(W?k&&W[0]==k[0]:!k)?NaN:W&&W[0]==0||!k?V*0:V/0);for(c?(h=1,u=n.e-a.e):(c=si,h=br,u=Nn(n.e/h)-Nn(a.e/h)),R=k.length,E=W.length,w=new H(V),C=w.d=[],m=0;k[m]==(W[m]||0);m++);if(k[m]>(W[m]||0)&&u--,i==null?(S=i=H.precision,s=H.rounding):l?S=i+(n.e-a.e)+1:S=i,S<0)C.push(1),y=!0;else{if(S=S/h+2|0,m=0,R==1){for(d=0,k=k[0],S++;(m1&&(k=e(k,d,c),W=e(W,d,c),R=k.length,E=W.length),_=R,b=W.slice(0,R),N=b.length;N=c/2&&++T;do d=0,o=r(k,b,R,N),o<0?(M=b[0],R!=N&&(M=M*c+(b[1]||0)),d=M/T|0,d>1?(d>=c&&(d=c-1),v=e(k,d,c),x=v.length,N=b.length,o=r(v,b,x,N),o==1&&(d--,t(v,R=10;d/=10)m++;w.e=m+u*h-1,hr(w,l?i+w.e+1:i,s,y)}return w}}();function hr(e,r,t,n){var a,i,s,l,c,o,u,m,d,h=e.constructor;e:if(r!=null){if(m=e.d,!m)return e;for(a=1,l=m[0];l>=10;l/=10)a++;if(i=r-a,i<0)i+=br,s=r,u=m[d=0],c=u/nn(10,a-s-1)%10|0;else if(d=Math.ceil((i+1)/br),l=m.length,d>=l)if(n){for(;l++<=d;)m.push(0);u=c=0,a=1,i%=br,s=i-br+1}else break e;else{for(u=l=m[d],a=1;l>=10;l/=10)a++;i%=br,s=i-br+a,c=s<0?0:u/nn(10,a-s-1)%10|0}if(n=n||r<0||m[d+1]!==void 0||(s<0?u:u%nn(10,a-s-1)),o=t<4?(c||n)&&(t==0||t==(e.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(i>0?s>0?u/nn(10,a-s):0:m[d-1])%10&1||t==(e.s<0?8:7)),r<1||!m[0])return m.length=0,o?(r-=e.e+1,m[0]=nn(10,(br-r%br)%br),e.e=-r||0):m[0]=e.e=0,e;if(i==0?(m.length=d,l=1,d--):(m.length=d+1,l=nn(10,br-i),m[d]=s>0?(u/nn(10,a-s)%nn(10,s)|0)*l:0),o)for(;;)if(d==0){for(i=1,s=m[0];s>=10;s/=10)i++;for(s=m[0]+=l,l=1;s>=10;s/=10)l++;i!=l&&(e.e++,m[0]==si&&(m[0]=1));break}else{if(m[d]+=l,m[d]!=si)break;m[d--]=0,l=1}for(i=m.length;m[--i]===0;)m.pop()}return Cr&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e0?i=i.charAt(0)+"."+i.slice(1)+Po(n):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(e.e<0?"e":"e+")+e.e):a<0?(i="0."+Po(-a-1)+i,t&&(n=t-s)>0&&(i+=Po(n))):a>=s?(i+=Po(a+1-s),t&&(n=t-a-1)>0&&(i=i+"."+Po(n))):((n=a+1)0&&(a+1===s&&(i+="."),i+=Po(n))),i}function Um(e,r){var t=e[0];for(r*=br;t>=10;t/=10)r++;return r}function Lm(e,r,t){if(r>vL)throw Cr=!0,t&&(e.precision=t),Error(FM);return hr(new e(qm),r,1,!0)}function oi(e,r,t){if(r>sw)throw Error(FM);return hr(new e(km),r,t,!0)}function PM(e){var r=e.length-1,t=r*br+1;if(r=e[r],r){for(;r%10==0;r/=10)t--;for(r=e[0];r>=10;r/=10)t++}return t}function Po(e){for(var r="";e--;)r+="0";return r}function IM(e,r,t,n){var a,i=new e(1),s=Math.ceil(n/br+4);for(Cr=!1;;){if(t%2&&(i=i.times(r),CM(i.d,s)&&(a=!0)),t=Nn(t/2),t===0){t=i.d.length-1,a&&i.d[t]===0&&++i.d[t];break}r=r.times(r),CM(r.d,s)}return Cr=!0,i}function MM(e){return e.d[e.d.length-1]&1}function RM(e,r,t){for(var n,a=new e(r[0]),i=0;++i17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(r==null?(Cr=!1,c=y):c=r,l=new d(.03125);e.e>-2;)e=e.times(l),m+=5;for(n=Math.log(nn(2,m))/Math.LN10*2+5|0,c+=n,t=i=s=new d(1),d.precision=c;;){if(i=hr(i.times(e),c,1),t=t.times(++u),l=s.plus(Dt(i,t,c,1)),xn(l.d).slice(0,c)===xn(s.d).slice(0,c)){for(a=m;a--;)s=hr(s.times(s),c,1);if(r==null)if(o<3&&Ec(s.d,c-n,h,o))d.precision=c+=10,t=i=l=new d(1),u=0,o++;else return hr(s,d.precision=y,h,Cr=!0);else return d.precision=y,s}s=l}}function Io(e,r){var t,n,a,i,s,l,c,o,u,m,d,h=1,y=10,v=e,x=v.d,w=v.constructor,C=w.rounding,b=w.precision;if(v.s<0||!x||!x[0]||!v.e&&x[0]==1&&x.length==1)return new w(x&&!x[0]?-1/0:v.s!=1?NaN:x?0:v);if(r==null?(Cr=!1,u=b):u=r,w.precision=u+=y,t=xn(x),n=t.charAt(0),Math.abs(i=v.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)v=v.times(e),t=xn(v.d),n=t.charAt(0),h++;i=v.e,n>1?(v=new w("0."+t),i++):v=new w(n+"."+t.slice(1))}else return o=Lm(w,u+2,b).times(i+""),v=Io(new w(n+"."+t.slice(1)),u-y).plus(o),w.precision=b,r==null?hr(v,b,C,Cr=!0):v;for(m=v,c=s=v=Dt(v.minus(1),v.plus(1),u,1),d=hr(v.times(v),u,1),a=3;;){if(s=hr(s.times(d),u,1),o=c.plus(Dt(s,new w(a),u,1)),xn(o.d).slice(0,u)===xn(c.d).slice(0,u))if(c=c.times(2),i!==0&&(c=c.plus(Lm(w,u+2,b).times(i+""))),c=Dt(c,new w(h),u,1),r==null)if(Ec(c.d,u-y,C,l))w.precision=u+=y,o=s=v=Dt(m.minus(1),m.plus(1),u,1),d=hr(v.times(v),u,1),a=l=1;else return hr(c,w.precision=b,C,Cr=!0);else return w.precision=b,c;c=o,a+=2}}function qM(e){return String(e.s*e.s/0)}function fw(e,r){var t,n,a;for((t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(t<0&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):t<0&&(t=r.length),n=0;r.charCodeAt(n)===48;n++);for(a=r.length;r.charCodeAt(a-1)===48;--a);if(r=r.slice(n,a),r){if(a-=n,e.e=t=t-n-1,e.d=[],n=(t+1)%br,t<0&&(n+=br),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(r=r.replace(/(\\d)_(?=\\d)/g,"$1"),BM.test(r))return fw(e,r)}else if(r==="Infinity"||r==="NaN")return+r||(e.s=NaN),e.e=NaN,e.d=null,e;if(pL.test(r))t=16,r=r.toLowerCase();else if(mL.test(r))t=2;else if(dL.test(r))t=8;else throw Error(Ro+r);for(i=r.search(/p/i),i>0?(c=+r.slice(i+1),r=r.substring(2,i)):r=r.slice(2),i=r.indexOf("."),s=i>=0,n=e.constructor,s&&(r=r.replace(".",""),l=r.length,i=l-i,a=IM(n,new n(t),i,i*2)),o=Rm(r,t,si),u=o.length-1,i=u;o[i]===0;--i)o.pop();return i<0?new n(e.s*0):(e.e=Um(o,u),e.d=o,Cr=!1,s&&(e=Dt(e,a,l*4)),c&&(e=e.times(Math.abs(c)<54?nn(2,c):Tc.pow(2,c))),Cr=!0,e)}function xL(e,r){var t,n=r.d.length;if(n<3)return r.isZero()?r:Fu(e,2,r,r);t=1.4*Math.sqrt(n),t=t>16?16:t|0,r=r.times(1/Wm(5,t)),r=Fu(e,2,r,r);for(var a,i=new e(5),s=new e(16),l=new e(20);t--;)a=r.times(r),r=r.times(i.plus(a.times(s.times(a).minus(l))));return r}function Fu(e,r,t,n,a){var i,s,l,c,o=1,u=e.precision,m=Math.ceil(u/br);for(Cr=!1,c=t.times(t),l=new e(n);;){if(s=Dt(l.times(c),new e(r++*r++),u,1),l=a?n.plus(s):n.minus(s),n=Dt(s.times(c),new e(r++*r++),u,1),s=l.plus(n),s.d[m]!==void 0){for(i=m;s.d[i]===l.d[i]&&i--;);if(i==-1)break}i=l,l=n,n=s,s=i,o++}return Cr=!0,s.d.length=m+1,s}function Wm(e,r){for(var t=e;--r;)t*=e;return t}function kM(e,r){var t,n=r.s<0,a=oi(e,e.precision,1),i=a.times(.5);if(r=r.abs(),r.lte(i))return eo=n?4:1,r;if(t=r.divToInt(a),t.isZero())eo=n?3:2;else{if(r=r.minus(t.times(a)),r.lte(i))return eo=MM(t)?n?2:3:n?4:1,r;eo=MM(t)?n?1:4:n?3:2}return r.minus(a).abs()}function cw(e,r,t,n){var a,i,s,l,c,o,u,m,d,h=e.constructor,y=t!==void 0;if(y?(jn(t,1,qo),n===void 0?n=h.rounding:jn(n,0,8)):(t=h.precision,n=h.rounding),!e.isFinite())u=qM(e);else{for(u=Fi(e),s=u.indexOf("."),y?(a=2,r==16?t=t*4-3:r==8&&(t=t*3-2)):a=r,s>=0&&(u=u.replace(".",""),d=new h(1),d.e=u.length-s,d.d=Rm(Fi(d),10,a),d.e=d.d.length),m=Rm(u,10,a),i=c=m.length;m[--c]==0;)m.pop();if(!m[0])u=y?"0p+0":"0";else{if(s<0?i--:(e=new h(e),e.d=m,e.e=i,e=Dt(e,d,t,n,0,a),m=e.d,i=e.e,o=TM),s=m[t],l=a/2,o=o||m[t+1]!==void 0,o=n<4?(s!==void 0||o)&&(n===0||n===(e.s<0?3:2)):s>l||s===l&&(n===4||o||n===6&&m[t-1]&1||n===(e.s<0?8:7)),m.length=t,o)for(;++m[--t]>a-1;)m[t]=0,t||(++i,m.unshift(1));for(c=m.length;!m[c-1];--c);for(s=0,u="";s1)if(r==16||r==8){for(s=r==16?4:3,--c;c%s;c++)u+="0";for(m=Rm(u,a,r),c=m.length;!m[c-1];--c);for(s=1,u="1.";sc)for(i-=c;i--;)u+="0";else ir)return e.length=r,!0}function bL(e){return new this(e).abs()}function wL(e){return new this(e).acos()}function DL(e){return new this(e).acosh()}function SL(e,r){return new this(e).plus(r)}function NL(e){return new this(e).asin()}function AL(e){return new this(e).asinh()}function ML(e){return new this(e).atan()}function CL(e){return new this(e).atanh()}function EL(e,r){e=new this(e),r=new this(r);var t,n=this.precision,a=this.rounding,i=n+4;return!e.s||!r.s?t=new this(NaN):!e.d&&!r.d?(t=oi(this,i,1).times(r.s>0?.25:.75),t.s=e.s):!r.d||e.isZero()?(t=r.s<0?oi(this,n,a):new this(0),t.s=e.s):!e.d||r.isZero()?(t=oi(this,i,1).times(.5),t.s=e.s):r.s<0?(this.precision=i,this.rounding=1,t=this.atan(Dt(e,r,i,1)),r=oi(this,i,1),this.precision=n,this.rounding=a,t=e.s<0?t.minus(r):t.plus(r)):t=this.atan(Dt(e,r,i,1)),t}function TL(e){return new this(e).cbrt()}function FL(e){return hr(e=new this(e),e.e+1,2)}function _L(e,r,t){return new this(e).clamp(r,t)}function OL(e){if(!e||typeof e!="object")throw Error(zm+"Object expected");var r,t,n,a=e.defaults===!0,i=["precision",1,qo,"rounding",0,8,"toExpNeg",-Tu,0,"toExpPos",0,Tu,"maxE",0,Tu,"minE",-Tu,0,"modulo",0,9];for(r=0;r=i[r+1]&&n<=i[r+2])this[t]=n;else throw Error(Ro+t+": "+n);if(t="crypto",a&&(this[t]=ow[t]),(n=e[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(_M);else this[t]=!1;else throw Error(Ro+t+": "+n);return this}function BL(e){return new this(e).cos()}function PL(e){return new this(e).cosh()}function LM(e){var r,t,n;function a(i){var s,l,c,o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,EM(i)){o.s=i.s,Cr?!i.d||i.e>a.maxE?(o.e=NaN,o.d=null):i.e=10;l/=10)s++;Cr?s>a.maxE?(o.e=NaN,o.d=null):s=429e7?r[i]=crypto.getRandomValues(new Uint32Array(1))[0]:l[i++]=a%1e7;else if(crypto.randomBytes){for(r=crypto.randomBytes(n*=4);i=214e7?crypto.randomBytes(4).copy(r,i):(l.push(a%1e7),i+=4);i=n/4}else throw Error(_M);else for(;i=10;a/=10)n++;n{var{on:r,config:t}=e,n=Es.clone({precision:t.precision,modulo:Es.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(a){return new n(a.value)},r&&r("config",function(a,i){a.precision!==i.precision&&n.config({precision:a.precision})}),n},{isClass:!0});var fn=ma(UM(),1);var sz="Complex",uz=[],Hm=F(sz,uz,()=>(Object.defineProperty(fn.default,"name",{value:"Complex"}),fn.default.prototype.constructor=fn.default,fn.default.prototype.type="Complex",fn.default.prototype.isComplex=!0,fn.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},fn.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},fn.default.prototype.format=function(e){var r="",t=this.im,n=this.re,a=ai(this.re,e),i=ai(this.im,e),s=sr(e)?e:e?e.precision:null;if(s!==null){var l=Math.pow(10,-s);Math.abs(n/t)r.re?1:e.rer.im?1:e.im(Object.defineProperty(_i.default,"name",{value:"Fraction"}),_i.default.prototype.constructor=_i.default,_i.default.prototype.type="Fraction",_i.default.prototype.isFraction=!0,_i.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},_i.default.fromJSON=function(e){return new _i.default(e)},_i.default),{isClass:!0});var lz="Range",mz=[],Gm=F(lz,mz,()=>{function e(r,t,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var a=r!=null,i=t!=null,s=n!=null;if(a){if(rr(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter start must be a number")}if(i){if(rr(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter end must be a number")}if(s){if(rr(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=a?parseFloat(r):0,this.end=i?parseFloat(t):0,this.step=s?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(r){if(typeof r!="string")return null;var t=r.split(":"),n=t.map(function(i){return parseFloat(i)}),a=n.some(function(i){return isNaN(i)});if(a)return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var r=0,t=this.start,n=this.step,a=this.end,i=a-t;return Ba(n)===Ba(i)?r=Math.ceil(i/n):i===0&&(r=0),isNaN(r)&&(r=0),[r]},e.prototype.min=function(){var r=this.size()[0];if(r>0)return this.step>0?this.start:this.start+(r-1)*this.step},e.prototype.max=function(){var r=this.size()[0];if(r>0)return this.step>0?this.start+(r-1)*this.step:this.start},e.prototype.forEach=function(r){var t=this.start,n=this.step,a=this.end,i=0;if(n>0)for(;ta;)r(t,[i],this),t+=n,i++},e.prototype.map=function(r){var t=[];return this.forEach(function(n,a,i){t[a[0]]=r(n,a,i)}),t},e.prototype.toArray=function(){var r=[];return this.forEach(function(t,n){r[n[0]]=t}),r},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(r){var t=ai(this.start,r);return this.step!==1&&(t+=":"+ai(this.step,r)),t+=":"+ai(this.end,r),t},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(r){return new e(r.start,r.end,r.step)},e},{isClass:!0});var pz="Matrix",dz=[],Vm=F(pz,dz,()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(r,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(r,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(r){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(r,t,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(r,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(r,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(r,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(r){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(r){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function HM(e){var r=0,t=1,n=Object.create(null),a=Object.create(null),i=0,s=function(c){var o=a[c];if(!!o&&(delete n[o],delete a[c],--r,t===o)){if(!r){i=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++t););}};return e=Math.abs(e),{hit:function(c){var o=a[c],u=++i;if(n[u]=c,a[c]=u,!o)return++r,r<=e?void 0:(c=n[t],s(c),c);if(delete n[o],t===o)for(;!Object.prototype.hasOwnProperty.call(n,++t););},delete:s,clear:function(){r=i=0,t=1,n=Object.create(null),a=Object.create(null)}}}function Ts(e){var{hasher:r,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t??Number.POSITIVE_INFINITY,r=r??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:HM(t||Number.POSITIVE_INFINITY)});for(var a=[],i=0;i{var{Matrix:r}=e;function t(u,m){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(m&&!St(m))throw new Error("Invalid datatype: "+m);if(Qe(u))u.type==="DenseMatrix"?(this._data=ar(u._data),this._size=ar(u._size),this._datatype=m||u._datatype):(this._data=u.toArray(),this._size=u.size(),this._datatype=m||u._datatype);else if(u&&Mr(u.data)&&Mr(u.size))this._data=u.data,this._size=u.size,Qb(this._data,this._size),this._datatype=m||u.datatype;else if(Mr(u))this._data=o(u),this._size=ur(this._data),Qb(this._data,this._size),this._datatype=m;else{if(u)throw new TypeError("Unsupported type of data ("+Tr(u)+")");this._data=[],this._size=[0],this._datatype=m}}t.prototype=new r,t.prototype.createDenseMatrix=function(u,m){return new t(u,m)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return Oo(this._data,Tr)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(u,m){return new t(u,m)},t.prototype.subset=function(u,m,d){switch(arguments.length){case 1:return n(this,u);case 2:case 3:return i(this,u,m,d);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(u){if(!Mr(u))throw new TypeError("Array expected");if(u.length!==this._size.length)throw new pr(u.length,this._size.length);for(var m=0;m");var b=m.max().map(function(S){return S+1});c(u,b,h);var N=y.length,M=0;s(u._data,m,d,N,M)}return u}function s(u,m,d,h,y){var v=y===h-1,x=m.dimension(y);v?x.forEach(function(w,C){Kr(w),u[w]=d[C[0]]}):x.forEach(function(w,C){Kr(w),s(u[w],m,d[C[0]],h,y+1)})}t.prototype.resize=function(u,m,d){if(!Nt(u))throw new TypeError("Array or Matrix expected");var h=u.valueOf().map(v=>Array.isArray(v)&&v.length===1?v[0]:v),y=d?this.clone():this;return l(y,h,m)};function l(u,m,d){if(m.length===0){for(var h=u._data;Mr(h);)h=h[0];return h}return u._size=m.slice(0),u._data=ii(u._data,u._size,d),u}t.prototype.reshape=function(u,m){var d=m?this.clone():this;d._data=Ac(d._data,u);var h=d._size.reduce((y,v)=>y*v);return d._size=Mc(u,h),d};function c(u,m,d){for(var h=u._size.slice(0),y=!1;h.lengthh[v]&&(h[v]=m[v],y=!0);y&&l(u,h,d)}t.prototype.clone=function(){var u=new t({data:ar(this._data),size:ar(this._size),datatype:this._datatype});return u},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(u){var m=this,d=Zm(u),h=function x(w,C){return Mr(w)?w.map(function(b,N){return x(b,C.concat(N))}):d===1?u(w):d===2?u(w,C):u(w,C,m)},y=h(this._data,[]),v=this._datatype!==void 0?Oo(y,Tr):void 0;return new t(y,v)},t.prototype.forEach=function(u){var m=this,d=function h(y,v){Mr(y)?y.forEach(function(x,w){h(x,v.concat(w))}):u(y,v,m)};d(this._data,[])},t.prototype[Symbol.iterator]=function*(){var u=function*m(d,h){if(Mr(d))for(var y=0;y[b[w]]);m.push(new t(C,u._datatype))},v=0;v0?u:0,d=u<0?-u:0,h=this._size[0],y=this._size[1],v=Math.min(h-d,y-m),x=[],w=0;w0?d:0,v=d<0?-d:0,x=u[0],w=u[1],C=Math.min(x-v,w-y),b;if(Mr(m)){if(m.length!==C)throw new Error("Invalid value array length");b=function(_){return m[_]}}else if(Qe(m)){var N=m.size();if(N.length!==1||N[0]!==C)throw new Error("Invalid matrix length");b=function(_){return m.get([_])}}else b=function(){return m};h||(h=rr(b(0))?b(0).mul(0):0);var M=[];if(u.length>0){M=ii(M,u,h);for(var S=0;S{var{typed:r}=e;return r($M,{any:ar})});function Jm(e){var r=e.length,t=e[0].length,n,a,i=[];for(a=0;a=n.length)throw new tn(r,n.length);return Qe(e)?e.create(Km(e.valueOf(),r,t)):Km(e,r,t)}function Km(e,r,t){var n,a,i,s;if(r<=0)if(Array.isArray(e[0])){for(s=Jm(e),a=[],n=0;n{var{typed:r}=e;return r(GM,{number:Ze,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var ea="number",ro="number, number";function dw(e){return Math.abs(e)}dw.signature=ea;function hw(e,r){return e+r}hw.signature=ro;function vw(e,r){return e-r}vw.signature=ro;function gw(e,r){return e*r}gw.signature=ro;function xz(e,r){return e/r}xz.signature=ro;function yw(e){return-e}yw.signature=ea;function xw(e){return e}xw.signature=ea;function _u(e){return jA(e)}_u.signature=ea;function bw(e){return e*e*e}bw.signature=ea;function ww(e){return Math.exp(e)}ww.signature=ea;function Dw(e){return eM(e)}Dw.signature=ea;function bz(e,r){if(!Ze(e)||!Ze(r))throw new Error("Parameters in function gcd must be integer numbers");for(var t;r!==0;)t=e%r,e=r,r=t;return e<0?-e:e}bz.signature=ro;function Sw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Parameters in function lcm must be integer numbers");if(e===0||r===0)return 0;for(var t,n=e*r;r!==0;)t=r,r=e%t,e=t;return Math.abs(n/e)}Sw.signature=ro;function VM(e,r){return r?Math.log(e)/Math.log(r):Math.log(e)}function Nw(e){return KA(e)}Nw.signature=ea;function Aw(e){return JA(e)}Aw.signature=ea;function wz(e){return Am(e)}wz.signature=ea;function Dz(e,r){return r===0?e:e-r*Math.floor(e/r)}Dz.signature=ro;function Mw(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,t=r<0;if(t&&(r=-r),r===0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(r)%2!==1)throw new Error("Root must be odd when a is negative.");if(e===0)return t?1/0:0;if(!isFinite(e))return t?0:e;var n=Math.pow(Math.abs(e),1/r);return n=e<0?-n:n,t?1/n:n}function ep(e){return Ba(e)}ep.signature=ea;function Sz(e){return Math.sqrt(e)}Sz.signature=ea;function Cw(e){return e*e}Cw.signature=ea;function Ew(e,r){var t,n,a,i=0,s=1,l=1,c=0;if(!Ze(e)||!Ze(r))throw new Error("Parameters in function xgcd must be integer numbers");for(;r;)n=Math.floor(e/r),a=e-n*r,t=i,i=s-n*i,s=t,t=l,l=c-n*l,c=t,e=r,r=a;var o;return e<0?o=[-e,-s,-c]:o=[e,e?s:0,c],o}Ew.signature=ro;function Tw(e,r){return e*e<1&&r===1/0||e*e>1&&r===-1/0?0:Math.pow(e,r)}Tw.signature=ro;function Ou(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!Ze(r)||r<0||r>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(Gb(e,r))}function Nz(e){return Math.abs(e)}Nz.signature=ea;var Az="number",Bu="number, number";function Fw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function bitAnd");return e&r}Fw.signature=Bu;function _w(e){if(!Ze(e))throw new Error("Integer expected in function bitNot");return~e}_w.signature=Az;function Ow(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function bitOr");return e|r}Ow.signature=Bu;function Bw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function bitXor");return e^r}Bw.signature=Bu;function Pw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function leftShift");return e<>r}Iw.signature=Bu;function Rw(e,r){if(!Ze(e)||!Ze(r))throw new Error("Integers expected in function rightLogShift");return e>>>r}Rw.signature=Bu;function va(e,r){if(r>1;return va(e,t)*va(t+1,r)}function qw(e,r){if(!Ze(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!Ze(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(r>e)throw new TypeError("k must be less than or equal to n");for(var t=e-r,n=1,a=r171?1/0:va(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Fc(1-e));if(e>=171.35)return 1/0;if(e>85){var t=e*e,n=t*e,a=n*e,i=a*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*t)-139/(51840*n)-571/(2488320*a)+163879/(209018880*i)+5246819/(75246796800*i*e))}--e,r=Fs[0];for(var s=1;s=1;n--)t+=KM[n]/(e+n);return Hw+(e+.5)*Math.log(r)-r+Math.log(t)}_c.signature="number";var Ct="number",Tz="number, number";function Fz(e){return Math.acos(e)}Fz.signature=Ct;function $w(e){return nM(e)}$w.signature=Ct;function Gw(e){return Math.atan(1/e)}Gw.signature=Ct;function Vw(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}Vw.signature=Ct;function Zw(e){return Math.asin(1/e)}Zw.signature=Ct;function Qw(e){var r=1/e;return Math.log(r+Math.sqrt(r*r+1))}Qw.signature=Ct;function Xw(e){return Math.acos(1/e)}Xw.signature=Ct;function Jw(e){var r=1/e,t=Math.sqrt(r*r-1);return Math.log(t+r)}Jw.signature=Ct;function _z(e){return Math.asin(e)}_z.signature=Ct;function Kw(e){return aM(e)}Kw.signature=Ct;function Oz(e){return Math.atan(e)}Oz.signature=Ct;function Bz(e,r){return Math.atan2(e,r)}Bz.signature=Tz;function jw(e){return iM(e)}jw.signature=Ct;function Pz(e){return Math.cos(e)}Pz.signature=Ct;function Iz(e){return Cm(e)}Iz.signature=Ct;function eD(e){return 1/Math.tan(e)}eD.signature=Ct;function rD(e){var r=Math.exp(2*e);return(r+1)/(r-1)}rD.signature=Ct;function tD(e){return 1/Math.sin(e)}tD.signature=Ct;function nD(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Ba(e)}nD.signature=Ct;function aD(e){return 1/Math.cos(e)}aD.signature=Ct;function iD(e){return 2/(Math.exp(e)+Math.exp(-e))}iD.signature=Ct;function Rz(e){return Math.sin(e)}Rz.signature=Ct;function oD(e){return oM(e)}oD.signature=Ct;function qz(e){return Math.tan(e)}qz.signature=Ct;function kz(e){return Em(e)}kz.signature=Ct;var Oc="number";function Lz(e){return Ze(e)}Lz.signature=Oc;function sD(e){return e<0}sD.signature=Oc;function uD(e){return e>0}uD.signature=Oc;function fD(e){return e===0}fD.signature=Oc;function cD(e){return Number.isNaN(e)}cD.signature=Oc;var jM="isNegative",zz=["typed"],rp=F(jM,zz,e=>{var{typed:r}=e;return r(jM,{number:sD,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:r.referToSelf(t=>n=>r.find(t,n.valueType())(n.value)),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var e2="isNumeric",Uz=["typed"],tp=F(e2,Uz,e=>{var{typed:r}=e;return r(e2,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var r2="hasNumericValue",Wz=["typed","isNumeric"],np=F(r2,Wz,e=>{var{typed:r,isNumeric:t}=e;return r(r2,{boolean:()=>!0,string:function(a){return a.trim().length>0&&!isNaN(Number(a))},any:function(a){return t(a)}})});var t2="isPositive",Yz=["typed"],ap=F(t2,Yz,e=>{var{typed:r}=e;return r(t2,{number:uD,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:r.referToSelf(t=>n=>r.find(t,n.valueType())(n.value)),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var n2="isZero",Hz=["typed"],ip=F(n2,Hz,e=>{var{typed:r}=e;return r(n2,{number:fD,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:r.referToSelf(t=>n=>r.find(t,n.valueType())(n.value)),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var a2="isNaN",$z=["typed"],op=F(a2,$z,e=>{var{typed:r}=e;return r(a2,{number:cD,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return je(n,Number.isNaN)}})});var i2="typeOf",Gz=["typed"],sp=F(i2,Gz,e=>{var{typed:r}=e;return r(i2,{any:Tr})});function $t(e,r,t){if(t==null)return e.eq(r);if(e.eq(r))return!0;if(e.isNaN()||r.isNaN())return!1;if(e.isFinite()&&r.isFinite()){var n=e.minus(r).abs();if(n.isZero())return!0;var a=e.constructor.max(e.abs(),r.abs());return n.lte(a.times(t))}return!1}function o2(e,r,t){return At(e.re,r.re,t)&&At(e.im,r.im,t)}var Ia=F("compareUnits",["typed"],e=>{var{typed:r}=e;return{"Unit, Unit":r.referToSelf(t=>(n,a)=>{if(!n.equalBase(a))throw new Error("Cannot compare units with different base");return r.find(t,[n.valueType(),a.valueType()])(n.value,a.value)})}});var up="equalScalar",Vz=["typed","config"],fp=F(up,Vz,e=>{var{typed:r,config:t}=e,n=Ia({typed:r});return r(up,{"boolean, boolean":function(i,s){return i===s},"number, number":function(i,s){return At(i,s,t.epsilon)},"BigNumber, BigNumber":function(i,s){return i.eq(s)||$t(i,s,t.epsilon)},"Fraction, Fraction":function(i,s){return i.equals(s)},"Complex, Complex":function(i,s){return o2(i,s,t.epsilon)}},n)}),cee=F(up,["typed","config"],e=>{var{typed:r,config:t}=e;return r(up,{"number, number":function(a,i){return At(a,i,t.epsilon)}})});var Zz="SparseMatrix",Qz=["typed","equalScalar","Matrix"],cp=F(Zz,Qz,e=>{var{typed:r,equalScalar:t,Matrix:n}=e;function a(v,x){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(x&&!St(x))throw new Error("Invalid datatype: "+x);if(Qe(v))i(this,v,x);else if(v&&Mr(v.index)&&Mr(v.ptr)&&Mr(v.size))this._values=v.values,this._index=v.index,this._ptr=v.ptr,this._size=v.size,this._datatype=x||v.datatype;else if(Mr(v))s(this,v,x);else{if(v)throw new TypeError("Unsupported type of data ("+Tr(v)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=x}}function i(v,x,w){x.type==="SparseMatrix"?(v._values=x._values?ar(x._values):void 0,v._index=ar(x._index),v._ptr=ar(x._ptr),v._size=ar(x._size),v._datatype=w||x._datatype):s(v,x.valueOf(),w||x._datatype)}function s(v,x,w){v._values=[],v._index=[],v._ptr=[],v._datatype=w;var C=x.length,b=0,N=t,M=0;if(St(w)&&(N=r.find(t,[w,w])||t,M=r.convert(0,w)),C>0){var S=0;do{v._ptr.push(v._index.length);for(var O=0;O");if(b.length===1){var _=x.dimension(0);_.forEach(function(R,L){Kr(R),v.set([R,0],w[L[0]],C)})}else{var E=x.dimension(0),T=x.dimension(1);E.forEach(function(R,L){Kr(R),T.forEach(function(H,V){Kr(H),v.set([R,H],w[L[0]][V[0]],C)})})}}return v}a.prototype.get=function(v){if(!Mr(v))throw new TypeError("Array expected");if(v.length!==this._size.length)throw new pr(v.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var x=v[0],w=v[1];Kr(x,this._size[0]),Kr(w,this._size[1]);var C=o(x,this._ptr[w],this._ptr[w+1],this._index);return CN-1||b>M-1)&&(d(this,Math.max(C+1,N),Math.max(b+1,M),w),N=this._size[0],M=this._size[1]),Kr(C,N),Kr(b,M);var _=o(C,this._ptr[b],this._ptr[b+1],this._index);return _Array.isArray(N)&&N.length===1?N[0]:N);if(C.length!==2)throw new Error("Only two dimensions matrix are supported");C.forEach(function(N){if(!sr(N)||!Ze(N)||N<0)throw new TypeError("Invalid size, must contain positive integers (size: "+lr(C)+")")});var b=w?this.clone():this;return d(b,C[0],C[1],x)};function d(v,x,w,C){var b=C||0,N=t,M=0;St(v._datatype)&&(N=r.find(t,[v._datatype,v._datatype])||t,M=r.convert(0,v._datatype),b=r.convert(b,v._datatype));var S=!N(b,M),O=v._size[0],_=v._size[1],E,T,R;if(w>_){for(T=_;TO){if(S){var L=0;for(T=0;T<_;T++){v._ptr[T]=v._ptr[T]+L,R=v._ptr[T+1]+L;var H=0;for(E=O;Ex-1&&(v._values.splice(R,1),v._index.splice(R,1),V++)}v._ptr[T]=v._values.length}return v._size[0]=x,v._size[1]=w,v}a.prototype.reshape=function(v,x){if(!Mr(v))throw new TypeError("Array expected");if(v.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");v.forEach(function(z){if(!sr(z)||!Ze(z)||z<=-2||z===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+lr(v)+")")});var w=this._size[0]*this._size[1];v=Mc(v,w);var C=v[0]*v[1];if(w!==C)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var b=x?this.clone():this;if(this._size[0]===v[0]&&this._size[1]===v[1])return b;for(var N=[],M=0;M=x&&k<=w&&R(v._values[W],k-x,L-C)}else{for(var q={},K=H;K "+(this._values?lr(this._values[O],v):"X")}return b},a.prototype.toString=function(){return lr(this.toArray())},a.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},a.prototype.diagonal=function(v){if(v){if(rr(v)&&(v=v.toNumber()),!sr(v)||!Ze(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var x=v>0?v:0,w=v<0?-v:0,C=this._size[0],b=this._size[1],N=Math.min(C-w,b-x),M=[],S=[],O=[];O[0]=0;for(var _=x;_0?w:0,O=w<0?-w:0,_=v[0],E=v[1],T=Math.min(_-O,E-S),R;if(Mr(x)){if(x.length!==T)throw new Error("Invalid value array length");R=function(oe){return x[oe]}}else if(Qe(x)){var k=x.size();if(k.length!==1||k[0]!==T)throw new Error("Invalid matrix length");R=function(oe){return x.get([oe])}}else R=function(){return x};for(var W=[],G=[],H=[],L=0;L=0&&q=O||b[E]!==x)){var R=C?C[_]:void 0;b.splice(E,0,x),C&&C.splice(E,0,R),b.splice(E<=_?_+1:_,1),C&&C.splice(E<=_?_+1:_,1);continue}if(E=O||b[_]!==v)){var k=C?C[E]:void 0;b.splice(_,0,v),C&&C.splice(_,0,k),b.splice(_<=E?E+1:E,1),C&&C.splice(_<=E?E+1:E,1)}}},a},{isClass:!0});var Qz="number",Xz=["typed"];function Jz(e){var r=e.match(/(0[box])([0-9a-fA-F]*)\\.([0-9a-fA-F]*)/);if(r){var t={"0b":2,"0o":8,"0x":16}[r[1]],n=r[2],a=r[3];return{input:e,radix:t,integerPart:n,fractionalPart:a}}else return null}function Kz(e){for(var r=parseInt(e.integerPart,e.radix),t=0,n=0;n{var{typed:r}=e,t=r("number",{"":function(){return 0},number:function(a){return a},string:function(a){if(a==="NaN")return NaN;var i=Jz(a);if(i)return Kz(i);var u=0,l=a.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);l&&(u=Number(l[2]),a=l[1]);var c=Number(a);if(isNaN(c))throw new SyntaxError('String "'+a+'" is not a valid number');if(l){if(c>2**u-1)throw new SyntaxError('String "'.concat(a,'" is out of range'));c>=2**(u-1)&&(c=c-2**u)}return c},BigNumber:function(a){return a.toNumber()},Fraction:function(a){return a.valueOf()},Unit:r.referToSelf(n=>a=>{var i=a.clone();return i.value=n(a.value),i}),null:function(a){return 0},"Unit, string | Unit":function(a,i){return a.toNumber(i)},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))});return t.fromJSON=function(n){return parseFloat(n.value)},t});var o2="string",jz=["typed"],pp=F(o2,jz,e=>{var{typed:r}=e;return r(o2,{"":function(){return""},number:ai,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":r.referToSelf(t=>n=>je(n,t)),any:function(n){return String(n)}})});var s2="boolean",eU=["typed"],dp=F(s2,eU,e=>{var{typed:r}=e;return r(s2,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var a=n.toLowerCase();if(a==="true")return!0;if(a==="false")return!1;var i=Number(n);if(n!==""&&!isNaN(i))return!!i;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var rU="bignumber",tU=["typed","BigNumber"],hp=F(rU,tU,e=>{var{typed:r,BigNumber:t}=e;return r("bignumber",{"":function(){return new t(0)},number:function(a){return new t(a+"")},string:function(a){var i=a.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(i){var u=i[2],l=t(i[1]),c=new t(2).pow(Number(u));if(l.gt(c.sub(1)))throw new SyntaxError('String "'.concat(a,'" is out of range'));var o=new t(2).pow(Number(u)-1);return l.gte(o)?l.sub(c):l}return new t(a)},BigNumber:function(a){return a},Unit:r.referToSelf(n=>a=>{var i=a.clone();return i.value=n(a.value),i}),Fraction:function(a){return new t(a.n).div(a.d).times(a.s)},null:function(a){return new t(0)},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var nU="complex",aU=["typed","Complex"],vp=F(nU,aU,e=>{var{typed:r,Complex:t}=e;return r("complex",{"":function(){return t.ZERO},number:function(a){return new t(a,0)},"number, number":function(a,i){return new t(a,i)},"BigNumber, BigNumber":function(a,i){return new t(a.toNumber(),i.toNumber())},Fraction:function(a){return new t(a.valueOf(),0)},Complex:function(a){return a.clone()},string:function(a){return t(a)},null:function(a){return t(0)},Object:function(a){if("re"in a&&"im"in a)return new t(a.re,a.im);if("r"in a&&"phi"in a||"abs"in a&&"arg"in a)return new t(a);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var iU="fraction",oU=["typed","Fraction"],gp=F(iU,oU,e=>{var{typed:r,Fraction:t}=e;return r("fraction",{number:function(a){if(!isFinite(a)||isNaN(a))throw new Error(a+" cannot be represented as a fraction");return new t(a)},string:function(a){return new t(a)},"number, number":function(a,i){return new t(a,i)},null:function(a){return new t(0)},BigNumber:function(a){return new t(a.toString())},Fraction:function(a){return a},Unit:r.referToSelf(n=>a=>{var i=a.clone();return i.value=n(a.value),i}),Object:function(a){return new t(a)},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var u2="matrix",sU=["typed","Matrix","DenseMatrix","SparseMatrix"],yp=F(u2,sU,e=>{var{typed:r,Matrix:t,DenseMatrix:n,SparseMatrix:a}=e;return r(u2,{"":function(){return i([])},string:function(l){return i([],l)},"string, string":function(l,c){return i([],l,c)},Array:function(l){return i(l)},Matrix:function(l){return i(l,l.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});function i(u,l,c){if(l==="dense"||l==="default"||l===void 0)return new n(u,c);if(l==="sparse")return new a(u,c);throw new TypeError("Unknown matrix type "+JSON.stringify(l)+".")}});var f2="matrixFromFunction",uU=["typed","matrix","isZero"],xp=F(f2,uU,e=>{var{typed:r,matrix:t,isZero:n}=e;return r(f2,{"Array | Matrix, function, string, string":function(u,l,c,o){return a(u,l,c,o)},"Array | Matrix, function, string":function(u,l,c){return a(u,l,c)},"Matrix, function":function(u,l){return a(u,l,"dense")},"Array, function":function(u,l){return a(u,l,"dense").toArray()},"Array | Matrix, string, function":function(u,l,c){return a(u,c,l)},"Array | Matrix, string, string, function":function(u,l,c,o){return a(u,o,l,c)}});function a(i,u,l,c){var o;return c!==void 0?o=t(l,c):o=t(l),o.resize(i),o.forEach(function(s,m){var d=u(m);n(d)||o.set(m,d)}),o}});var c2="matrixFromRows",fU=["typed","matrix","flatten","size"],bp=F(c2,fU,e=>{var{typed:r,matrix:t,flatten:n,size:a}=e;return r(c2,{"...Array":function(c){return i(c)},"...Matrix":function(c){return t(i(c.map(o=>o.toArray())))}});function i(l){if(l.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var c=u(l[0]),o=[];for(var s of l){var m=u(s);if(m!==c)throw new TypeError("The vectors had different length: "+(c|0)+" \\u2260 "+(m|0));o.push(n(s))}return o}function u(l){var c=a(l);if(c.length===1)return c[0];if(c.length===2){if(c[0]===1)return c[1];if(c[1]===1)return c[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var l2="matrixFromColumns",cU=["typed","matrix","flatten","size"],wp=F(l2,cU,e=>{var{typed:r,matrix:t,flatten:n,size:a}=e;return r(l2,{"...Array":function(c){return i(c)},"...Matrix":function(c){return t(i(c.map(o=>o.toArray())))}});function i(l){if(l.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var c=u(l[0]),o=[],s=0;s{var{typed:r}=e;return r(m2,{"Unit, Array":function(n,a){return n.splitUnit(a)}})});var p2="unaryMinus",mU=["typed"],Sp=F(p2,mU,e=>{var{typed:r}=e;return r(p2,{number:xw,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:r.referToSelf(t=>n=>{var a=n.clone();return a.value=r.find(t,a.valueType())(n.value),a}),"Array | Matrix":r.referToSelf(t=>n=>je(n,t,!0))})});var d2="unaryPlus",pU=["typed","config","BigNumber"],Np=F(d2,pU,e=>{var{typed:r,config:t,BigNumber:n}=e;return r(d2,{number:bw,Complex:function(i){return i},BigNumber:function(i){return i},Fraction:function(i){return i},Unit:function(i){return i.clone()},"Array | Matrix":r.referToSelf(a=>i=>je(i,a,!0)),"boolean | string":function(i){return t.number==="BigNumber"?new n(+i):+i}})});var h2="abs",dU=["typed"],Ap=F(h2,dU,e=>{var{typed:r}=e;return r(h2,{number:hw,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":r.referToSelf(t=>n=>je(n,t,!0))})});var v2="apply",hU=["typed","isInteger"],Lo=F(v2,hU,e=>{var{typed:r,isInteger:t}=e;return r(v2,{"Array | Matrix, number | BigNumber, function":function(a,i,u){if(!t(i))throw new TypeError("Integer number expected for dimension");var l=Array.isArray(a)?ur(a):a.size();if(i<0||i>=l.length)throw new tn(i,l.length);return Qe(a)?a.create(Mp(a.valueOf(),i,u)):Mp(a,i,u)}})});function Mp(e,r,t){var n,a,i;if(r<=0)if(Array.isArray(e[0])){for(i=vU(e),a=[],n=0;n{var{typed:r}=e;return r(g2,{"number, number":vw,"Complex, Complex":function(n,a){return n.add(a)},"BigNumber, BigNumber":function(n,a){return n.plus(a)},"Fraction, Fraction":function(n,a){return n.add(a)},"Unit, Unit":r.referToSelf(t=>(n,a)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(a.value===null||a.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(a))throw new Error("Units do not match");var i=n.clone();return i.value=r.find(t,[i.valueType(),a.valueType()])(i.value,a.value),i.fixPrefix=!1,i})})});var y2="subtractScalar",yU=["typed"],Ep=F(y2,yU,e=>{var{typed:r}=e;return r(y2,{"number, number":gw,"Complex, Complex":function(n,a){return n.sub(a)},"BigNumber, BigNumber":function(n,a){return n.minus(a)},"Fraction, Fraction":function(n,a){return n.sub(a)},"Unit, Unit":r.referToSelf(t=>(n,a)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(a.value===null||a.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(a))throw new Error("Units do not match");var i=n.clone();return i.value=r.find(t,[i.valueType(),a.valueType()])(i.value,a.value),i.fixPrefix=!1,i})})});var x2="cbrt",xU=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],Tp=F(x2,xU,e=>{var{config:r,typed:t,isNegative:n,unaryMinus:a,matrix:i,Complex:u,BigNumber:l,Fraction:c}=e;return t(x2,{number:_u,Complex:o,"Complex, boolean":o,BigNumber:function(d){return d.cbrt()},Unit:s});function o(m,d){var h=m.arg()/3,y=m.abs(),v=new u(_u(y),0).mul(new u(0,h).exp());if(d){var x=[v,new u(_u(y),0).mul(new u(0,h+Math.PI*2/3).exp()),new u(_u(y),0).mul(new u(0,h-Math.PI*2/3).exp())];return r.matrix==="Array"?x:i(x)}else return v}function s(m){if(m.value&&Kt(m.value)){var d=m.clone();return d.value=1,d=d.pow(1/3),d.value=o(m.value),d}else{var h=n(m.value);h&&(m.value=a(m.value));var y;rr(m.value)?y=new l(1).div(3):da(m.value)?y=new c(1,3):y=1/3;var v=m.pow(y);return h&&(v.value=a(v.value)),v}}});var bU="matAlgo11xS0s",wU=["typed","equalScalar"],jr=F(bU,wU,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,u,l){var c=a._values,o=a._index,s=a._ptr,m=a._size,d=a._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=m[0],y=m[1],v,x=t,w=0,C=u;typeof d=="string"&&(v=d,x=r.find(t,[v,v]),w=r.convert(0,v),i=r.convert(i,v),C=r.find(u,[v,v]));for(var b=[],N=[],M=[],S=0;S{var{typed:r,DenseMatrix:t}=e;return function(a,i,u,l){var c=a._values,o=a._index,s=a._ptr,m=a._size,d=a._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=m[0],y=m[1],v,x=u;typeof d=="string"&&(v=d,i=r.convert(i,v),x=r.find(u,[v,v]));for(var w=[],C=[],b=[],N=0;N{var{typed:r}=e;return function(a,i,u,l){var c=a._data,o=a._size,s=a._datatype,m,d=u;typeof s=="string"&&(m=s,i=r.convert(i,m),d=r.find(u,[m,m]));var h=o.length>0?t(d,0,o,o[0],c,i,l):[];return a.createDenseMatrix({data:h,size:ar(o),datatype:m})};function t(n,a,i,u,l,c,o){var s=[];if(a===i.length-1)for(var m=0;m{var{typed:r,config:t,round:n}=e;return r(mD,{number:function(i){return At(i,n(i),t.epsilon)?n(i):Math.ceil(i)},"number, number":function(i,u){if(At(i,n(i,u),t.epsilon))return n(i,u);var[l,c]="".concat(i,"e").split("e"),o=Math.ceil(Number("".concat(l,"e").concat(Number(c)+u)));return[l,c]="".concat(o,"e").split("e"),Number("".concat(l,"e").concat(Number(c)-u))}})}),Fp=F(mD,MU,e=>{var{typed:r,config:t,round:n,matrix:a,equalScalar:i,zeros:u,DenseMatrix:l}=e,c=jr({typed:r,equalScalar:i}),o=Wr({typed:r,DenseMatrix:l}),s=kt({typed:r}),m=CU({typed:r,config:t,round:n});return r("ceil",{number:m.signatures.number,"number,number":m.signatures["number,number"],Complex:function(h){return h.ceil()},"Complex, number":function(h,y){return h.ceil(y)},"Complex, BigNumber":function(h,y){return h.ceil(y.toNumber())},BigNumber:function(h){return $t(h,n(h),t.epsilon)?n(h):h.ceil()},"BigNumber, BigNumber":function(h,y){return $t(h,n(h,y),t.epsilon)?n(h,y):h.toDecimalPlaces(y.toNumber(),Es.ROUND_CEIL)},Fraction:function(h){return h.ceil()},"Fraction, number":function(h,y){return h.ceil(y)},"Fraction, BigNumber":function(h,y){return h.ceil(y.toNumber())},"Array | Matrix":r.referToSelf(d=>h=>je(h,d,!0)),"Array, number | BigNumber":r.referToSelf(d=>(h,y)=>je(h,v=>d(v,y),!0)),"SparseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>c(h,y,d,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>s(h,y,d,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(d=>(h,y)=>s(a(y),h,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(d=>(h,y)=>i(h,0)?u(y.size(),y.storage()):y.storage()==="dense"?s(y,h,d,!0):o(y,h,d,!0))})});var b2="cube",EU=["typed"],_p=F(b2,EU,e=>{var{typed:r}=e;return r(b2,{number:ww,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var w2="exp",TU=["typed"],Op=F(w2,TU,e=>{var{typed:r}=e;return r(w2,{number:Dw,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var D2="expm1",FU=["typed","Complex"],Bp=F(D2,FU,e=>{var{typed:r,Complex:t}=e;return r(D2,{number:Sw,Complex:function(a){var i=Math.exp(a.re);return new t(i*Math.cos(a.im)-1,i*Math.sin(a.im))},BigNumber:function(a){return a.exp().minus(1)}})});var pD="fix",_U=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],OU=F(pD,["typed","ceil","floor"],e=>{var{typed:r,ceil:t,floor:n}=e;return r(pD,{number:function(i){return i>0?n(i):t(i)},"number, number":function(i,u){return i>0?n(i,u):t(i,u)}})}),Pp=F(pD,_U,e=>{var{typed:r,Complex:t,matrix:n,ceil:a,floor:i,equalScalar:u,zeros:l,DenseMatrix:c}=e,o=Wr({typed:r,DenseMatrix:c}),s=kt({typed:r}),m=OU({typed:r,ceil:a,floor:i});return r("fix",{number:m.signatures.number,"number, number | BigNumber":m.signatures["number,number"],Complex:function(h){return new t(h.re>0?Math.floor(h.re):Math.ceil(h.re),h.im>0?Math.floor(h.im):Math.ceil(h.im))},"Complex, number":function(h,y){return new t(h.re>0?i(h.re,y):a(h.re,y),h.im>0?i(h.im,y):a(h.im,y))},"Complex, BigNumber":function(h,y){var v=y.toNumber();return new t(h.re>0?i(h.re,v):a(h.re,v),h.im>0?i(h.im,v):a(h.im,v))},BigNumber:function(h){return h.isNegative()?a(h):i(h)},"BigNumber, number | BigNumber":function(h,y){return h.isNegative()?a(h,y):i(h,y)},Fraction:function(h){return h.s<0?h.ceil():h.floor()},"Fraction, number | BigNumber":function(h,y){return h.s<0?a(h,y):i(h,y)},"Array | Matrix":r.referToSelf(d=>h=>je(h,d,!0)),"Array | Matrix, number | BigNumber":r.referToSelf(d=>(h,y)=>je(h,v=>d(v,y),!0)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(d=>(h,y)=>s(n(y),h,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(d=>(h,y)=>u(h,0)?l(y.size(),y.storage()):y.storage()==="dense"?s(y,h,d,!0):o(y,h,d,!0))})});var dD="floor",BU=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],PU=F(dD,["typed","config","round"],e=>{var{typed:r,config:t,round:n}=e;return r(dD,{number:function(i){return At(i,n(i),t.epsilon)?n(i):Math.floor(i)},"number, number":function(i,u){if(At(i,n(i,u),t.epsilon))return n(i,u);var[l,c]="".concat(i,"e").split("e"),o=Math.floor(Number("".concat(l,"e").concat(Number(c)+u)));return[l,c]="".concat(o,"e").split("e"),Number("".concat(l,"e").concat(Number(c)-u))}})}),Pu=F(dD,BU,e=>{var{typed:r,config:t,round:n,matrix:a,equalScalar:i,zeros:u,DenseMatrix:l}=e,c=jr({typed:r,equalScalar:i}),o=Wr({typed:r,DenseMatrix:l}),s=kt({typed:r}),m=PU({typed:r,config:t,round:n});return r("floor",{number:m.signatures.number,"number,number":m.signatures["number,number"],Complex:function(h){return h.floor()},"Complex, number":function(h,y){return h.floor(y)},"Complex, BigNumber":function(h,y){return h.floor(y.toNumber())},BigNumber:function(h){return $t(h,n(h),t.epsilon)?n(h):h.floor()},"BigNumber, BigNumber":function(h,y){return $t(h,n(h,y),t.epsilon)?n(h,y):h.toDecimalPlaces(y.toNumber(),Es.ROUND_FLOOR)},Fraction:function(h){return h.floor()},"Fraction, number":function(h,y){return h.floor(y)},"Fraction, BigNumber":function(h,y){return h.floor(y.toNumber())},"Array | Matrix":r.referToSelf(d=>h=>je(h,d,!0)),"Array, number | BigNumber":r.referToSelf(d=>(h,y)=>je(h,v=>d(v,y),!0)),"SparseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>c(h,y,d,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>s(h,y,d,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(d=>(h,y)=>s(a(y),h,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(d=>(h,y)=>i(h,0)?u(y.size(),y.storage()):y.storage()==="dense"?s(y,h,d,!0):o(y,h,d,!0))})});var IU="matAlgo02xDS0",RU=["typed","equalScalar"],Lt=F(IU,RU,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,u,l){var c=a._data,o=a._size,s=a._datatype||a.getDataType(),m=i._values,d=i._index,h=i._ptr,y=i._size,v=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(o.length!==y.length)throw new pr(o.length,y.length);if(o[0]!==y[0]||o[1]!==y[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+y+")");if(!m)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var x=o[0],w=o[1],C,b=t,N=0,M=u;typeof s=="string"&&s===v&&s!=="mixed"&&(C=s,b=r.find(t,[C,C]),N=r.convert(0,C),M=r.find(u,[C,C]));for(var S=[],O=[],_=[],E=0;E{var{typed:r}=e;return function(n,a,i,u){var l=n._data,c=n._size,o=n._datatype||n.getDataType(),s=a._values,m=a._index,d=a._ptr,h=a._size,y=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new pr(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=c[0],x=c[1],w,C=0,b=i;typeof o=="string"&&o===y&&o!=="mixed"&&(w=o,C=r.convert(0,w),b=r.find(i,[w,w]));for(var N=[],M=0;M{var{typed:r,equalScalar:t}=e;return function(a,i,u){var l=a._values,c=a._index,o=a._ptr,s=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType(),d=i._values,h=i._index,y=i._ptr,v=i._size,x=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(s.length!==v.length)throw new pr(s.length,v.length);if(s[0]!==v[0]||s[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+v+")");var w=s[0],C=s[1],b,N=t,M=0,S=u;typeof m=="string"&&m===x&&m!=="mixed"&&(b=m,N=r.find(t,[b,b]),M=r.convert(0,b),S=r.find(u,[b,b]));var O=l&&d?[]:void 0,_=[],E=[],T=O?[]:void 0,R=O?[]:void 0,k=[],W=[],G,H,L,q;for(H=0;H{var{typed:r}=e;return function(a,i,u){var l=a._data,c=a._size,o=a._datatype,s=i._data,m=i._size,d=i._datatype,h=[];if(c.length!==m.length)throw new pr(c.length,m.length);for(var y=0;y0?t(x,0,h,h[0],l,s):[];return a.createDenseMatrix({data:w,size:h,datatype:v})};function t(n,a,i,u,l,c){var o=[];if(a===i.length-1)for(var s=0;s{var{concat:r}=e;return function(a,i){var u=Math.max(a._size.length,i._size.length);if(a._size.length===i._size.length&&a._size.every((y,v)=>y===i._size[v]))return[a,i];for(var l=t(a._size,u,0),c=t(i._size,u,0),o=[],s=0;s{var{typed:r,matrix:t,concat:n}=e,a=S2({typed:r}),i=kt({typed:r}),u=N2({concat:n});return function(c){var o=c.elop,s=c.SD||c.DS,m;o?(m={"DenseMatrix, DenseMatrix":(v,x)=>a(...u(v,x),o),"Array, Array":(v,x)=>a(...u(t(v),t(x)),o).valueOf(),"Array, DenseMatrix":(v,x)=>a(...u(t(v),x),o),"DenseMatrix, Array":(v,x)=>a(...u(v,t(x)),o)},c.SS&&(m["SparseMatrix, SparseMatrix"]=(v,x)=>c.SS(...u(v,x),o,!1)),c.DS&&(m["DenseMatrix, SparseMatrix"]=(v,x)=>c.DS(...u(v,x),o,!1),m["Array, SparseMatrix"]=(v,x)=>c.DS(...u(t(v),x),o,!1)),s&&(m["SparseMatrix, DenseMatrix"]=(v,x)=>s(...u(x,v),o,!0),m["SparseMatrix, Array"]=(v,x)=>s(...u(t(x),v),o,!0))):(m={"DenseMatrix, DenseMatrix":r.referToSelf(v=>(x,w)=>a(...u(x,w),v)),"Array, Array":r.referToSelf(v=>(x,w)=>a(...u(t(x),t(w)),v).valueOf()),"Array, DenseMatrix":r.referToSelf(v=>(x,w)=>a(...u(t(x),w),v)),"DenseMatrix, Array":r.referToSelf(v=>(x,w)=>a(...u(x,t(w)),v))},c.SS&&(m["SparseMatrix, SparseMatrix"]=r.referToSelf(v=>(x,w)=>c.SS(...u(x,w),v,!1))),c.DS&&(m["DenseMatrix, SparseMatrix"]=r.referToSelf(v=>(x,w)=>c.DS(...u(x,w),v,!1)),m["Array, SparseMatrix"]=r.referToSelf(v=>(x,w)=>c.DS(...u(t(x),w),v,!1))),s&&(m["SparseMatrix, DenseMatrix"]=r.referToSelf(v=>(x,w)=>s(...u(w,x),v,!0)),m["SparseMatrix, Array"]=r.referToSelf(v=>(x,w)=>s(...u(t(w),x),v,!0))));var d=c.scalar||"any",h=c.Ds||c.Ss;h&&(o?(m["DenseMatrix,"+d]=(v,x)=>i(v,x,o,!1),m[d+", DenseMatrix"]=(v,x)=>i(x,v,o,!0),m["Array,"+d]=(v,x)=>i(t(v),x,o,!1).valueOf(),m[d+", Array"]=(v,x)=>i(t(x),v,o,!0).valueOf()):(m["DenseMatrix,"+d]=r.referToSelf(v=>(x,w)=>i(x,w,v,!1)),m[d+", DenseMatrix"]=r.referToSelf(v=>(x,w)=>i(w,x,v,!0)),m["Array,"+d]=r.referToSelf(v=>(x,w)=>i(t(x),w,v,!1).valueOf()),m[d+", Array"]=r.referToSelf(v=>(x,w)=>i(t(w),x,v,!0).valueOf())));var y=c.sS!==void 0?c.sS:c.Ss;return o?(c.Ss&&(m["SparseMatrix,"+d]=(v,x)=>c.Ss(v,x,o,!1)),y&&(m[d+", SparseMatrix"]=(v,x)=>y(x,v,o,!0))):(c.Ss&&(m["SparseMatrix,"+d]=r.referToSelf(v=>(x,w)=>c.Ss(x,w,v,!1))),y&&(m[d+", SparseMatrix"]=r.referToSelf(v=>(x,w)=>y(w,x,v,!0)))),o&&o.signatures&&Dm(m,o.signatures),m}});var A2="mod",VU=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],Iu=F(A2,VU,e=>{var{typed:r,config:t,round:n,matrix:a,equalScalar:i,zeros:u,DenseMatrix:l,concat:c}=e,o=Pu({typed:r,config:t,round:n,matrix:a,equalScalar:i,zeros:u,DenseMatrix:l}),s=Lt({typed:r,equalScalar:i}),m=lt({typed:r}),d=zo({typed:r,equalScalar:i}),h=jr({typed:r,equalScalar:i}),y=Wr({typed:r,DenseMatrix:l}),v=vr({typed:r,matrix:a,concat:c});return r(A2,{"number, number":x,"BigNumber, BigNumber":function(C,b){return b.isZero()?C:C.sub(b.mul(o(C.div(b))))},"Fraction, Fraction":function(C,b){return b.equals(0)?C:C.sub(b.mul(o(C.div(b))))}},v({SS:d,DS:m,SD:s,Ss:h,sS:y}));function x(w,C){return C===0?w:w-C*o(w/C)}});var ZU="matAlgo01xDSid",QU=["typed"],Mn=F(ZU,QU,e=>{var{typed:r}=e;return function(n,a,i,u){var l=n._data,c=n._size,o=n._datatype||n.getDataType(),s=a._values,m=a._index,d=a._ptr,h=a._size,y=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new pr(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=c[0],x=c[1],w=typeof o=="string"&&o!=="mixed"&&o===y?o:void 0,C=w?r.find(i,[w,w]):i,b,N,M=[];for(b=0;b{var{typed:r,equalScalar:t}=e;return function(a,i,u){var l=a._values,c=a._index,o=a._ptr,s=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType(),d=i._values,h=i._index,y=i._ptr,v=i._size,x=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(s.length!==v.length)throw new pr(s.length,v.length);if(s[0]!==v[0]||s[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+v+")");var w=s[0],C=s[1],b,N=t,M=0,S=u;typeof m=="string"&&m===x&&m!=="mixed"&&(b=m,N=r.find(t,[b,b]),M=r.convert(0,b),S=r.find(u,[b,b]));var O=l&&d?[]:void 0,_=[],E=[],T=l&&d?[]:void 0,R=l&&d?[]:void 0,k=[],W=[],G,H,L,q,K;for(H=0;H{var{typed:r,DenseMatrix:t}=e;return function(a,i,u,l){var c=a._values,o=a._index,s=a._ptr,m=a._size,d=a._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=m[0],y=m[1],v,x=u;typeof d=="string"&&(v=d,i=r.convert(i,v),x=r.find(u,[v,v]));for(var w=[],C=[],b=[],N=0;NArray.isArray(r))}var Ip=F(M2,eW,e=>{var{typed:r,matrix:t,config:n,round:a,equalScalar:i,zeros:u,BigNumber:l,DenseMatrix:c,concat:o}=e,s=Iu({typed:r,config:n,round:a,matrix:t,equalScalar:i,zeros:u,DenseMatrix:c,concat:o}),m=Mn({typed:r}),d=Ru({typed:r,equalScalar:i}),h=ra({typed:r,DenseMatrix:c}),y=vr({typed:r,matrix:t,concat:o});return r(M2,{"number, number":v,"BigNumber, BigNumber":x,"Fraction, Fraction":(w,C)=>w.gcd(C)},y({SS:d,DS:m,Ss:h}),{[rW]:r.referToSelf(w=>(C,b,N)=>{for(var M=w(C,b),S=0;SC=>{if(C.length===1&&Array.isArray(C[0])&&C2(C[0]))return w(...C[0]);if(C2(C))return w(...C);throw new ga("gcd() supports only 1d matrices!")}),Matrix:r.referToSelf(w=>C=>w(C.toArray()))});function v(w,C){if(!Ze(w)||!Ze(C))throw new Error("Parameters in function gcd must be integer numbers");for(var b;C!==0;)b=s(w,C),w=C,C=b;return w<0?-w:w}function x(w,C){if(!w.isInt()||!C.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var b=new l(0);!C.isZero();){var N=s(w,C);w=C,C=N}return w.lt(b)?w.neg():w}});var tW="matAlgo06xS0S0",nW=["typed","equalScalar"],Uo=F(tW,nW,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,u){var l=a._values,c=a._size,o=a._datatype||a._data===void 0?a._datatype:a.getDataType(),s=i._values,m=i._size,d=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(c.length!==m.length)throw new pr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");var h=c[0],y=c[1],v,x=t,w=0,C=u;typeof o=="string"&&o===d&&o!=="mixed"&&(v=o,x=r.find(t,[v,v]),w=r.convert(0,v),C=r.find(u,[v,v]));for(var b=l&&s?[]:void 0,N=[],M=[],S=b?[]:void 0,O=[],_=[],E=0;E{var{typed:r,matrix:t,equalScalar:n,concat:a}=e,i=Lt({typed:r,equalScalar:n}),u=Uo({typed:r,equalScalar:n}),l=jr({typed:r,equalScalar:n}),c=vr({typed:r,matrix:t,concat:a}),o="number | BigNumber | Fraction | Matrix | Array",s={};return s["".concat(o,", ").concat(o,", ...").concat(o)]=r.referToSelf(d=>(h,y,v)=>{for(var x=d(h,y),w=0;wd.lcm(h)},c({SS:u,DS:i,Ss:l}),s);function m(d,h){if(!d.isInt()||!h.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(d.isZero())return d;if(h.isZero())return h;for(var y=d.times(h);!h.isZero();){var v=h;h=d.mod(v),d=v}return y.div(d).abs()}});var T2="log10",iW=["typed","config","Complex"],qp=F(T2,iW,e=>{var{typed:r,config:t,Complex:n}=e;return r(T2,{number:function(i){return i>=0||t.predictable?Aw(i):new n(i,0).log().div(Math.LN10)},Complex:function(i){return new n(i).log().div(Math.LN10)},BigNumber:function(i){return!i.isNegative()||t.predictable?i.log():new n(i.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":r.referToSelf(a=>i=>je(i,a))})});var F2="log2",oW=["typed","config","Complex"],kp=F(F2,oW,e=>{var{typed:r,config:t,Complex:n}=e;return r(F2,{number:function(u){return u>=0||t.predictable?Mw(u):a(new n(u,0))},Complex:a,BigNumber:function(u){return!u.isNegative()||t.predictable?u.log(2):a(new n(u.toNumber(),0))},"Array | Matrix":r.referToSelf(i=>u=>je(u,i))});function a(i){var u=Math.sqrt(i.re*i.re+i.im*i.im);return new n(Math.log2?Math.log2(u):Math.log(u)/Math.LN2,Math.atan2(i.im,i.re)/Math.LN2)}});var sW="multiplyScalar",uW=["typed"],Lp=F(sW,uW,e=>{var{typed:r}=e;return r("multiplyScalar",{"number, number":yw,"Complex, Complex":function(n,a){return n.mul(a)},"BigNumber, BigNumber":function(n,a){return n.times(a)},"Fraction, Fraction":function(n,a){return n.mul(a)},"number | Fraction | BigNumber | Complex, Unit":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});var _2="multiply",fW=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],zp=F(_2,fW,e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:a,equalScalar:i,dot:u}=e,l=jr({typed:r,equalScalar:i}),c=kt({typed:r});function o(M,S){switch(M.length){case 1:switch(S.length){case 1:if(M[0]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(M[0]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+M[0]+") must match Matrix rows ("+S[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+S.length+" dimensions)")}break;case 2:switch(S.length){case 1:if(M[1]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+M[1]+") must match Vector length ("+S[0]+")");break;case 2:if(M[1]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+M[1]+") must match Matrix B rows ("+S[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+S.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+M.length+" dimensions)")}}function s(M,S,O){if(O===0)throw new Error("Cannot multiply two empty vectors");return u(M,S)}function m(M,S){if(S.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return d(M,S)}function d(M,S){var O=M._data,_=M._size,E=M._datatype||M.getDataType(),T=S._data,R=S._size,k=S._datatype||S.getDataType(),W=_[0],G=R[1],H,L=n,q=a;E&&k&&E===k&&typeof E=="string"&&E!=="mixed"&&(H=E,L=r.find(n,[H,H]),q=r.find(a,[H,H]));for(var K=[],z=0;zge)for(var ye=0,be=0;be(S,O)=>{o(ur(S),ur(O));var _=M(t(S),t(O));return Qe(_)?_.valueOf():_}),"Matrix, Matrix":function(S,O){var _=S.size(),E=O.size();return o(_,E),_.length===1?E.length===1?s(S,O,_[0]):m(S,O):E.length===1?h(S,O):y(S,O)},"Matrix, Array":r.referTo("Matrix,Matrix",M=>(S,O)=>M(S,t(O))),"Array, Matrix":r.referToSelf(M=>(S,O)=>M(t(S,O.storage()),O)),"SparseMatrix, any":function(S,O){return l(S,O,a,!1)},"DenseMatrix, any":function(S,O){return c(S,O,a,!1)},"any, SparseMatrix":function(S,O){return l(O,S,a,!0)},"any, DenseMatrix":function(S,O){return c(O,S,a,!0)},"Array, any":function(S,O){return c(t(S),O,a,!1).valueOf()},"any, Array":function(S,O){return c(t(O),S,a,!0).valueOf()},"any, any":a,"any, any, ...any":r.referToSelf(M=>(S,O,_)=>{for(var E=M(S,O),T=0;T<_.length;T++)E=M(E,_[T]);return E})})});var O2="nthRoot",cW=["typed","matrix","equalScalar","BigNumber","concat"],Up=F(O2,cW,e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:a,concat:i}=e,u=Mn({typed:r}),l=Lt({typed:r,equalScalar:n}),c=Uo({typed:r,equalScalar:n}),o=jr({typed:r,equalScalar:n}),s=vr({typed:r,matrix:t,concat:i});function m(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return r(O2,{number:Cw,"number, number":Cw,BigNumber:h=>d(h,new a(2)),"BigNumber, BigNumber":d,Complex:m,"Complex, number":m,Array:r.referTo("DenseMatrix,number",h=>y=>h(t(y),2).valueOf()),DenseMatrix:r.referTo("DenseMatrix,number",h=>y=>h(y,2)),SparseMatrix:r.referTo("SparseMatrix,number",h=>y=>h(y,2)),"SparseMatrix, SparseMatrix":r.referToSelf(h=>(y,v)=>{if(v.density()===1)return c(y,v,h);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":r.referToSelf(h=>(y,v)=>{if(v.density()===1)return u(y,v,h,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":r.referTo("DenseMatrix,SparseMatrix",h=>(y,v)=>h(t(y),v)),"number | BigNumber, SparseMatrix":r.referToSelf(h=>(y,v)=>{if(v.density()===1)return o(v,y,h,!0);throw new Error("Root must be non-zero")})},s({scalar:"number | BigNumber",SD:l,Ss:o,sS:!1}));function d(h,y){var v=a.precision,x=a.clone({precision:v+2}),w=new a(0),C=new x(1),b=y.isNegative();if(b&&(y=y.neg()),y.isZero())throw new Error("Root must be non-zero");if(h.isNegative()&&!y.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(h.isZero())return b?new x(1/0):0;if(!h.isFinite())return b?w:h;var N=h.abs().pow(C.div(y));return N=h.isNeg()?N.neg():N,new a((b?C.div(N):N).toPrecision(v))}});var B2="sign",lW=["typed","BigNumber","Fraction","complex"],Wp=F(B2,lW,e=>{var{typed:r,BigNumber:t,complex:n,Fraction:a}=e;return r(B2,{number:rp,Complex:function(u){return u.im===0?n(rp(u.re)):u.sign()},BigNumber:function(u){return new t(u.cmp(0))},Fraction:function(u){return new a(u.s,1)},"Array | Matrix":r.referToSelf(i=>u=>je(u,i,!0)),Unit:r.referToSelf(i=>u=>{if(!u._isDerived()&&u.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return r.find(i,u.valueType())(u.value)})})});var mW="sqrt",pW=["config","typed","Complex"],Yp=F(mW,pW,e=>{var{config:r,typed:t,Complex:n}=e;return t("sqrt",{number:a,Complex:function(u){return u.sqrt()},BigNumber:function(u){return!u.isNegative()||r.predictable?u.sqrt():a(u.toNumber())},Unit:function(u){return u.pow(.5)}});function a(i){return isNaN(i)?NaN:i>=0||r.predictable?Math.sqrt(i):new n(i,0).sqrt()}});var P2="square",dW=["typed"],Hp=F(P2,dW,e=>{var{typed:r}=e;return r(P2,{number:Ew,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var I2="subtract",hW=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],$p=F(I2,hW,e=>{var{typed:r,matrix:t,equalScalar:n,subtractScalar:a,unaryMinus:i,DenseMatrix:u,concat:l}=e,c=Mn({typed:r}),o=lt({typed:r}),s=zo({typed:r,equalScalar:n}),m=ra({typed:r,DenseMatrix:u}),d=Wr({typed:r,DenseMatrix:u}),h=vr({typed:r,matrix:t,concat:l});return r(I2,{"any, any":a},h({elop:a,SS:s,DS:c,SD:o,Ss:d,sS:m}))});var R2="xgcd",vW=["typed","config","matrix","BigNumber"],Gp=F(R2,vW,e=>{var{typed:r,config:t,matrix:n,BigNumber:a}=e;return r(R2,{"number, number":function(l,c){var o=Tw(l,c);return t.matrix==="Array"?o:n(o)},"BigNumber, BigNumber":i});function i(u,l){var c,o,s,m=new a(0),d=new a(1),h=m,y=d,v=d,x=m;if(!u.isInt()||!l.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!l.isZero();)o=u.div(l).floor(),s=u.mod(l),c=h,h=y.minus(o.times(h)),y=c,c=v,v=x.minus(o.times(v)),x=c,u=l,l=s;var w;return u.lt(m)?w=[u.neg(),y.neg(),x.neg()]:w=[u,u.isZero()?0:y,x],t.matrix==="Array"?w:n(w)}});var q2="invmod",gW=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Vp=F(q2,gW,e=>{var{typed:r,config:t,BigNumber:n,xgcd:a,equal:i,smaller:u,mod:l,add:c,isInteger:o}=e;return r(q2,{"number, number":s,"BigNumber, BigNumber":s});function s(m,d){if(!o(m)||!o(d))throw new Error("Parameters in function invmod must be integer numbers");if(m=l(m,d),i(d,0))throw new Error("Divisor must be non zero");var h=a(m,d);h=h.valueOf();var[y,v]=h;return i(y,n(1))?(v=l(v,d),u(v,n(0))&&(v=c(v,d)),v):NaN}});var yW="matAlgo09xS0Sf",xW=["typed","equalScalar"],Zp=F(yW,xW,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,u){var l=a._values,c=a._index,o=a._ptr,s=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType(),d=i._values,h=i._index,y=i._ptr,v=i._size,x=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(s.length!==v.length)throw new pr(s.length,v.length);if(s[0]!==v[0]||s[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+v+")");var w=s[0],C=s[1],b,N=t,M=0,S=u;typeof m=="string"&&m===x&&m!=="mixed"&&(b=m,N=r.find(t,[b,b]),M=r.convert(0,b),S=r.find(u,[b,b]));var O=l&&d?[]:void 0,_=[],E=[],T=O?[]:void 0,R=[],k,W,G,H,L;for(W=0;W{var{typed:r,matrix:t,equalScalar:n,multiplyScalar:a,concat:i}=e,u=Lt({typed:r,equalScalar:n}),l=Zp({typed:r,equalScalar:n}),c=jr({typed:r,equalScalar:n}),o=vr({typed:r,matrix:t,concat:i});return r(k2,o({elop:a,SS:l,DS:u,Ss:c}))});function L2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitAnd");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero()||r.eq(-1)||e.eq(r))return e;if(r.isZero()||e.eq(-1))return r;if(!e.isFinite()||!r.isFinite()){if(!e.isFinite()&&!r.isFinite())return e.isNegative()===r.isNegative()?e:new t(0);if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r;if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e}return vD(e,r,function(n,a){return n&a})}function qu(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var r=e.constructor,t=r.precision;r.config({precision:1e9});var n=e.plus(new r(1));return n.s=-n.s||null,r.config({precision:t}),n}function z2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitOr");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);var n=new t(-1);return e.isZero()||r.eq(n)||e.eq(r)?r:r.isZero()||e.eq(n)?e:!e.isFinite()||!r.isFinite()?!e.isFinite()&&!e.isNegative()&&r.isNegative()||e.isNegative()&&!r.isNegative()&&!r.isFinite()?n:e.isNegative()&&r.isNegative()?e.isFinite()?e:r:e.isFinite()?r:e:vD(e,r,function(a,i){return a|i})}function vD(e,r,t){var n=e.constructor,a,i,u=+(e.s<0),l=+(r.s<0);if(u){a=Xp(qu(e));for(var c=0;c0;)t(s[--h],m[--y])===v&&(x=x.plus(w)),w=w.times(C);for(;y>0;)t(d,m[--y])===v&&(x=x.plus(w)),w=w.times(C);return n.config({precision:b}),v===0&&(x.s=-x.s),x}function Xp(e){for(var r=e.d,t=r[0]+"",n=1;n0)if(++l>o)for(l-=o;l--;)c+="0";else l1&&((s[h+1]===null||s[h+1]===void 0)&&(s[h+1]=0),s[h+1]+=s[h]>>1,s[h]&=1)}return s.reverse()}function U2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitXor");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero())return r;if(r.isZero())return e;if(e.eq(r))return new t(0);var n=new t(-1);return e.eq(n)?qu(r):r.eq(n)?qu(e):!e.isFinite()||!r.isFinite()?!e.isFinite()&&!r.isFinite()?n:new t(e.isNegative()===r.isNegative()?1/0:-1/0):vD(e,r,function(a,i){return a^i})}function W2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function leftShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:!e.isFinite()&&!r.isFinite()?new t(NaN):r.lt(55)?e.times(Math.pow(2,r.toNumber())+""):e.times(new t(2).pow(r))}function Y2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function rightArithShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:r.isFinite()?r.lt(55)?e.div(Math.pow(2,r.toNumber())+"").floor():e.div(new t(2).pow(r)).floor():e.isNegative()?new t(-1):e.isFinite()?new t(0):new t(NaN)}var H2="bitAnd",wW=["typed","matrix","equalScalar","concat"],ku=F(H2,wW,e=>{var{typed:r,matrix:t,equalScalar:n,concat:a}=e,i=Lt({typed:r,equalScalar:n}),u=Uo({typed:r,equalScalar:n}),l=jr({typed:r,equalScalar:n}),c=vr({typed:r,matrix:t,concat:a});return r(H2,{"number, number":_w,"BigNumber, BigNumber":L2},c({SS:u,DS:i,Ss:l}))});var $2="bitNot",DW=["typed"],Jp=F($2,DW,e=>{var{typed:r}=e;return r($2,{number:Ow,BigNumber:qu,"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var G2="bitOr",SW=["typed","matrix","equalScalar","DenseMatrix","concat"],Lu=F(G2,SW,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=Mn({typed:r}),l=Ru({typed:r,equalScalar:n}),c=ra({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:t,concat:i});return r(G2,{"number, number":Bw,"BigNumber, BigNumber":z2},o({SS:l,DS:u,Ss:c}))});var NW="matAlgo07xSSf",AW=["typed","DenseMatrix"],Zt=F(NW,AW,e=>{var{typed:r,DenseMatrix:t}=e;return function(i,u,l){var c=i._size,o=i._datatype||i._data===void 0?i._datatype:i.getDataType(),s=u._size,m=u._datatype||u._data===void 0?u._datatype:u.getDataType();if(c.length!==s.length)throw new pr(c.length,s.length);if(c[0]!==s[0]||c[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+s+")");var d=c[0],h=c[1],y,v=0,x=l;typeof o=="string"&&o===m&&o!=="mixed"&&(y=o,v=r.convert(0,y),x=r.find(l,[y,y]));var w,C,b=[];for(w=0;w{var{typed:r,matrix:t,DenseMatrix:n,concat:a}=e,i=lt({typed:r}),u=Zt({typed:r,DenseMatrix:n}),l=Wr({typed:r,DenseMatrix:n}),c=vr({typed:r,matrix:t,concat:a});return r(V2,{"number, number":Pw,"BigNumber, BigNumber":U2},c({SS:u,DS:i,Ss:l}))});var Z2="arg",CW=["typed"],jp=F(Z2,CW,e=>{var{typed:r}=e;return r(Z2,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var Q2="conj",EW=["typed"],ed=F(Q2,EW,e=>{var{typed:r}=e;return r(Q2,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var X2="im",TW=["typed"],rd=F(X2,TW,e=>{var{typed:r}=e;return r(X2,{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var J2="re",FW=["typed"],td=F(J2,FW,e=>{var{typed:r}=e;return r(J2,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var K2="not",_W=["typed"],nd=F(K2,_W,e=>{var{typed:r}=e;return r(K2,{"null | undefined":()=>!0,number:zw,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:r.referToSelf(t=>n=>r.find(t,n.valueType())(n.value)),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var j2="or",OW=["typed","matrix","equalScalar","DenseMatrix","concat"],zu=F(j2,OW,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=lt({typed:r}),l=zo({typed:r,equalScalar:n}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:t,concat:i});return r(j2,{"number, number":Uw,"Complex, Complex":function(m,d){return m.re!==0||m.im!==0||d.re!==0||d.im!==0},"BigNumber, BigNumber":function(m,d){return!m.isZero()&&!m.isNaN()||!d.isZero()&&!d.isNaN()},"Unit, Unit":r.referToSelf(s=>(m,d)=>s(m.value||0,d.value||0))},o({SS:l,DS:u,Ss:c}))});var eC="xor",BW=["typed","matrix","DenseMatrix","concat"],ad=F(eC,BW,e=>{var{typed:r,matrix:t,DenseMatrix:n,concat:a}=e,i=lt({typed:r}),u=Zt({typed:r,DenseMatrix:n}),l=Wr({typed:r,DenseMatrix:n}),c=vr({typed:r,matrix:t,concat:a});return r(eC,{"number, number":Ww,"Complex, Complex":function(s,m){return(s.re!==0||s.im!==0)!=(m.re!==0||m.im!==0)},"BigNumber, BigNumber":function(s,m){return(!s.isZero()&&!s.isNaN())!=(!m.isZero()&&!m.isNaN())},"Unit, Unit":r.referToSelf(o=>(s,m)=>o(s.value||0,m.value||0))},c({SS:u,DS:i,Ss:l}))});var rC="concat",PW=["typed","matrix","isInteger"],Uu=F(rC,PW,e=>{var{typed:r,matrix:t,isInteger:n}=e;return r(rC,{"...Array | Matrix | number | BigNumber":function(i){var u,l=i.length,c=-1,o,s=!1,m=[];for(u=0;u0&&c>o)throw new tn(c,o+1)}else{var h=ar(d).valueOf(),y=ur(h);if(m[u]=h,o=c,c=y.length-1,u>0&&c!==o)throw new pr(o+1,c+1)}}if(m.length===0)throw new SyntaxError("At least one matrix expected");for(var v=m.shift();m.length;)v=jb(v,m.shift(),c);return s?t(v):v},"...string":function(i){return i.join("")}})});var tC="column",IW=["typed","Index","matrix","range"],Wu=F(tC,IW,e=>{var{typed:r,Index:t,matrix:n,range:a}=e;return r(tC,{"Matrix, number":i,"Array, number":function(l,c){return i(n(ar(l)),c).valueOf()}});function i(u,l){if(u.size().length!==2)throw new Error("Only two dimensional matrix is supported");Kr(l,u.size()[1]);var c=a(0,u.size()[0]),o=new t(c,l),s=u.subset(o);return Qe(s)?s:n([[s]])}});var nC="count",RW=["typed","size","prod"],id=F(nC,RW,e=>{var{typed:r,size:t,prod:n}=e;return r(nC,{string:function(i){return i.length},"Matrix | Array":function(i){return n(t(i))}})});var aC="cross",qW=["typed","matrix","subtract","multiply"],od=F(aC,qW,e=>{var{typed:r,matrix:t,subtract:n,multiply:a}=e;return r(aC,{"Matrix, Matrix":function(l,c){return t(i(l.toArray(),c.toArray()))},"Matrix, Array":function(l,c){return t(i(l.toArray(),c))},"Array, Matrix":function(l,c){return t(i(l,c.toArray()))},"Array, Array":i});function i(u,l){var c=Math.max(ur(u).length,ur(l).length);u=Au(u),l=Au(l);var o=ur(u),s=ur(l);if(o.length!==1||s.length!==1||o[0]!==3||s[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+o.join(", ")+"], B = ["+s.join(", ")+"])");var m=[n(a(u[1],l[2]),a(u[2],l[1])),n(a(u[2],l[0]),a(u[0],l[2])),n(a(u[0],l[1]),a(u[1],l[0]))];return c>1?[m]:m}});var iC="diag",kW=["typed","matrix","DenseMatrix","SparseMatrix"],sd=F(iC,kW,e=>{var{typed:r,matrix:t,DenseMatrix:n,SparseMatrix:a}=e;return r(iC,{Array:function(o){return i(o,0,ur(o),null)},"Array, number":function(o,s){return i(o,s,ur(o),null)},"Array, BigNumber":function(o,s){return i(o,s.toNumber(),ur(o),null)},"Array, string":function(o,s){return i(o,0,ur(o),s)},"Array, number, string":function(o,s,m){return i(o,s,ur(o),m)},"Array, BigNumber, string":function(o,s,m){return i(o,s.toNumber(),ur(o),m)},Matrix:function(o){return i(o,0,o.size(),o.storage())},"Matrix, number":function(o,s){return i(o,s,o.size(),o.storage())},"Matrix, BigNumber":function(o,s){return i(o,s.toNumber(),o.size(),o.storage())},"Matrix, string":function(o,s){return i(o,0,o.size(),s)},"Matrix, number, string":function(o,s,m){return i(o,s,o.size(),m)},"Matrix, BigNumber, string":function(o,s,m){return i(o,s.toNumber(),o.size(),m)}});function i(c,o,s,m){if(!Ze(o))throw new TypeError("Second parameter in function diag must be an integer");var d=o>0?o:0,h=o<0?-o:0;switch(s.length){case 1:return u(c,o,m,s[0],h,d);case 2:return l(c,o,m,s,h,d)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function u(c,o,s,m,d,h){var y=[m+d,m+h];if(s&&s!=="sparse"&&s!=="dense")throw new TypeError("Unknown matrix type ".concat(s,'"'));var v=s==="sparse"?a.diagonal(y,c,o):n.diagonal(y,c,o);return s!==null?v:v.valueOf()}function l(c,o,s,m,d,h){if(Qe(c)){var y=c.diagonal(o);return s!==null?s!==y.storage()?t(y,s):y:y.valueOf()}for(var v=Math.min(m[0]-d,m[1]-h),x=[],w=0;w=2&&v.push("index: ".concat(Tr(t))),h.length>=3&&v.push("array: ".concat(Tr(n))),new TypeError("Function ".concat(a," cannot apply callback arguments ")+"".concat(e.name,"(").concat(v.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(a," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(x.message))}}}var LW="filter",zW=["typed"],ud=F(LW,zW,e=>{var{typed:r}=e;return r("filter",{"Array, function":oC,"Matrix, function":function(n,a){return n.create(oC(n.toArray(),a))},"Array, RegExp":Mu,"Matrix, RegExp":function(n,a){return n.create(Mu(n.toArray(),a))}})});function oC(e,r){return Om(e,function(t,n,a){return Ra(r,t,[n],a,"filter")})}var sC="flatten",UW=["typed","matrix"],fd=F(sC,UW,e=>{var{typed:r,matrix:t}=e;return r(sC,{Array:function(a){return gr(a)},Matrix:function(a){var i=gr(a.toArray());return t(i)}})});var uC="forEach",WW=["typed"],cd=F(uC,WW,e=>{var{typed:r}=e;return r(uC,{"Array, function":YW,"Matrix, function":function(n,a){n.forEach(a)}})});function YW(e,r){var t=function n(a,i){if(Array.isArray(a))_o(a,function(u,l){n(u,i.concat(l))});else return Ra(r,a,i,e,"forEach")};t(e,[])}var fC="getMatrixDataType",HW=["typed"],ld=F(fC,HW,e=>{var{typed:r}=e;return r(fC,{Array:function(n){return Oo(n,Tr)},Matrix:function(n){return n.getDataType()}})});var cC="identity",$W=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],md=F(cC,$W,e=>{var{typed:r,config:t,matrix:n,BigNumber:a,DenseMatrix:i,SparseMatrix:u}=e;return r(cC,{"":function(){return t.matrix==="Matrix"?n([]):[]},string:function(s){return n(s)},"number | BigNumber":function(s){return c(s,s,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(s,m){return c(s,s,m)},"number | BigNumber, number | BigNumber":function(s,m){return c(s,m,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(s,m,d){return c(s,m,d)},Array:function(s){return l(s)},"Array, string":function(s,m){return l(s,m)},Matrix:function(s){return l(s.valueOf(),s.storage())},"Matrix, string":function(s,m){return l(s.valueOf(),m)}});function l(o,s){switch(o.length){case 0:return s?n(s):[];case 1:return c(o[0],o[0],s);case 2:return c(o[0],o[1],s);default:throw new Error("Vector containing two values expected")}}function c(o,s,m){var d=rr(o)||rr(s)?a:null;if(rr(o)&&(o=o.toNumber()),rr(s)&&(s=s.toNumber()),!Ze(o)||o<1)throw new Error("Parameters in function identity must be positive integers");if(!Ze(s)||s<1)throw new Error("Parameters in function identity must be positive integers");var h=d?new a(1):1,y=d?new d(0):0,v=[o,s];if(m){if(m==="sparse")return u.diagonal(v,h,0,y);if(m==="dense")return i.diagonal(v,h,0,y);throw new TypeError('Unknown matrix type "'.concat(m,'"'))}for(var x=ii([],v,y),w=o{var{typed:r,matrix:t,multiplyScalar:n}=e;return r(lC,{"Matrix, Matrix":function(u,l){return t(a(u.toArray(),l.toArray()))},"Matrix, Array":function(u,l){return t(a(u.toArray(),l))},"Array, Matrix":function(u,l){return t(a(u,l.toArray()))},"Array, Array":a});function a(i,u){if(ur(i).length===1&&(i=[i]),ur(u).length===1&&(u=[u]),ur(i).length>2||ur(u).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(i.length)+", y = "+JSON.stringify(u.length)+")");var l=[],c=[];return i.map(function(o){return u.map(function(s){return c=[],l.push(c),o.map(function(m){return s.map(function(d){return c.push(n(m,d))})})})})&&l}});var mC="map",VW=["typed"],dd=F(mC,VW,e=>{var{typed:r}=e;return r(mC,{"Array, function":ZW,"Matrix, function":function(n,a){return n.map(a)}})});function ZW(e,r){var t=function n(a,i){return Array.isArray(a)?a.map(function(u,l){return n(u,i.concat(l))}):Ra(r,a,i,e,"map")};return t(e,[])}var pC="diff",QW=["typed","matrix","subtract","number"],Yu=F(pC,QW,e=>{var{typed:r,matrix:t,subtract:n,number:a}=e;return r(pC,{"Array | Matrix":function(s){return Qe(s)?t(u(s.toArray())):u(s)},"Array | Matrix, number":function(s,m){if(!Ze(m))throw new RangeError("Dimension must be a whole number");return Qe(s)?t(i(s.toArray(),m)):i(s,m)},"Array, BigNumber":r.referTo("Array,number",o=>(s,m)=>o(s,a(m))),"Matrix, BigNumber":r.referTo("Matrix,number",o=>(s,m)=>o(s,a(m)))});function i(o,s){if(Qe(o)&&(o=o.toArray()),!Array.isArray(o))throw RangeError("Array/Matrix does not have that many dimensions");if(s>0){var m=[];return o.forEach(d=>{m.push(i(d,s-1))}),m}else{if(s===0)return u(o);throw RangeError("Cannot have negative dimension")}}function u(o){for(var s=[],m=o.length,d=1;d{var{typed:r,config:t,matrix:n,BigNumber:a}=e;return r("ones",{"":function(){return t.matrix==="Array"?i([]):i([],"default")},"...number | BigNumber | string":function(o){var s=o[o.length-1];if(typeof s=="string"){var m=o.pop();return i(o,m)}else return t.matrix==="Array"?i(o):i(o,"default")},Array:i,Matrix:function(o){var s=o.storage();return i(o.valueOf(),s)},"Array | Matrix, string":function(o,s){return i(o.valueOf(),s)}});function i(c,o){var s=u(c),m=s?new a(1):1;if(l(c),o){var d=n(o);return c.length>0?d.resize(c,m):d}else{var h=[];return c.length>0?ii(h,c,m):h}}function u(c){var o=!1;return c.forEach(function(s,m,d){rr(s)&&(o=!0,d[m]=s.toNumber())}),o}function l(c){c.forEach(function(o){if(typeof o!="number"||!Ze(o)||o<0)throw new Error("Parameters in function ones must be positive integers")})}});function Hu(){throw new Error('No "bignumber" implementation available')}function vd(){throw new Error('No "fraction" implementation available')}function gd(){throw new Error('No "matrix" implementation available')}var dC="range",KW=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],$u=F(dC,KW,e=>{var{typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:u,larger:l,largerEq:c,add:o,isPositive:s}=e;return r(dC,{string:d,"string, boolean":d,"number, number":function(x,w){return m(h(x,w,1,!1))},"number, number, number":function(x,w,C){return m(h(x,w,C,!1))},"number, number, boolean":function(x,w,C){return m(h(x,w,1,C))},"number, number, number, boolean":function(x,w,C,b){return m(h(x,w,C,b))},"BigNumber, BigNumber":function(x,w){var C=x.constructor;return m(h(x,w,new C(1),!1))},"BigNumber, BigNumber, BigNumber":function(x,w,C){return m(h(x,w,C,!1))},"BigNumber, BigNumber, boolean":function(x,w,C){var b=x.constructor;return m(h(x,w,new b(1),C))},"BigNumber, BigNumber, BigNumber, boolean":function(x,w,C,b){return m(h(x,w,C,b))},"Unit, Unit, Unit":function(x,w,C){return m(h(x,w,C,!1))},"Unit, Unit, Unit, boolean":function(x,w,C,b){return m(h(x,w,C,b))}});function m(v){return t.matrix==="Matrix"?n?n(v):gd():v}function d(v,x){var w=y(v);if(!w)throw new SyntaxError('String "'+v+'" is no valid range');return t.number==="BigNumber"?(a===void 0&&Hu(),m(h(a(w.start),a(w.end),a(w.step)),x)):m(h(w.start,w.end,w.step,x))}function h(v,x,w,C){for(var b=[],N=s(w)?C?u:i:C?c:l,M=v;N(M,x);)b.push(M),M=o(M,w);return b}function y(v){var x=v.split(":"),w=x.map(function(b){return Number(b)}),C=w.some(function(b){return isNaN(b)});if(C)return null;switch(w.length){case 2:return{start:w[0],end:w[1],step:1};case 3:return{start:w[0],end:w[2],step:w[1]};default:return null}}});var hC="reshape",jW=["typed","isInteger","matrix"],yd=F(hC,jW,e=>{var{typed:r,isInteger:t}=e;return r(hC,{"Matrix, Array":function(a,i){return a.reshape(i,!0)},"Array, Array":function(a,i){return i.forEach(function(u){if(!t(u))throw new TypeError("Invalid size for dimension: "+u)}),Ac(a,i)}})});var eY="resize",rY=["config","matrix"],xd=F(eY,rY,e=>{var{config:r,matrix:t}=e;return function(i,u,l){if(arguments.length!==2&&arguments.length!==3)throw new ga("resize",arguments.length,2,3);if(Qe(u)&&(u=u.valueOf()),rr(u[0])&&(u=u.map(function(s){return rr(s)?s.toNumber():s})),Qe(i))return i.resize(u,l,!0);if(typeof i=="string")return n(i,u,l);var c=Array.isArray(i)?!1:r.matrix!=="Array";if(u.length===0){for(;Array.isArray(i);)i=i[0];return ar(i)}else{Array.isArray(i)||(i=[i]),i=ar(i);var o=ii(i,u,l);return c?t(o):o}};function n(a,i,u){if(u!==void 0){if(typeof u!="string"||u.length!==1)throw new TypeError("Single character expected as defaultValue")}else u=" ";if(i.length!==1)throw new pr(i.length,1);var l=i[0];if(typeof l!="number"||!Ze(l))throw new TypeError("Invalid size, must contain positive integers (size: "+lr(i)+")");if(a.length>l)return a.substring(0,l);if(a.length{var{typed:r,multiply:t,rotationMatrix:n}=e;return r(vC,{"Array , number | BigNumber | Complex | Unit":function(u,l){a(u,2);var c=t(n(l),u);return c.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(u,l){return a(u,2),t(n(l),u)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(u,l,c){a(u,3);var o=t(n(l,c),u);return o},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(u,l,c){return a(u,3),t(n(l,c),u)}});function a(i,u){var l=Array.isArray(i)?ur(i):i.size();if(l.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(u));if(l.length===2&&l[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(u));if(l[0]!==u)throw new RangeError("Vector must be of dimensions 1x".concat(u))}});var gC="rotationMatrix",nY=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],wd=F(gC,nY,e=>{var{typed:r,config:t,multiplyScalar:n,addScalar:a,unaryMinus:i,norm:u,BigNumber:l,matrix:c,DenseMatrix:o,SparseMatrix:s,cos:m,sin:d}=e;return r(gC,{"":function(){return t.matrix==="Matrix"?c([]):[]},string:function(b){return c(b)},"number | BigNumber | Complex | Unit":function(b){return h(b,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(b,N){return h(b,N)},"number | BigNumber | Complex | Unit, Array":function(b,N){var M=c(N);return y(M),w(b,M,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(b,N){y(N);var M=N.storage()||(t.matrix==="Matrix"?"dense":void 0);return w(b,N,M)},"number | BigNumber | Complex | Unit, Array, string":function(b,N,M){var S=c(N);return y(S),w(b,S,M)},"number | BigNumber | Complex | Unit, Matrix, string":function(b,N,M){return y(N),w(b,N,M)}});function h(C,b){var N=rr(C),M=N?new l(-1):-1,S=m(C),O=d(C),_=[[S,n(M,O)],[O,S]];return x(_,b)}function y(C){var b=C.size();if(b.length<1||b[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function v(C){return C.reduce((b,N)=>n(b,N))}function x(C,b){if(b){if(b==="sparse")return new s(C);if(b==="dense")return new o(C);throw new TypeError('Unknown matrix type "'.concat(b,'"'))}return C}function w(C,b,N){var M=u(b);if(M===0)throw new RangeError("Rotation around zero vector");var S=rr(C)?l:null,O=S?new S(1):1,_=S?new S(-1):-1,E=S?new S(b.get([0])/M):b.get([0])/M,T=S?new S(b.get([1])/M):b.get([1])/M,R=S?new S(b.get([2])/M):b.get([2])/M,k=m(C),W=a(O,i(k)),G=d(C),H=a(k,v([E,E,W])),L=a(v([E,T,W]),v([_,R,G])),q=a(v([E,R,W]),v([T,G])),K=a(v([E,T,W]),v([R,G])),z=a(k,v([T,T,W])),oe=a(v([T,R,W]),v([_,E,G])),pe=a(v([E,R,W]),v([_,T,G])),ae=a(v([T,R,W]),v([E,G])),$=a(k,v([R,R,W])),le=[[H,L,q],[K,z,oe],[pe,ae,$]];return x(le,N)}});var yC="row",aY=["typed","Index","matrix","range"],Gu=F(yC,aY,e=>{var{typed:r,Index:t,matrix:n,range:a}=e;return r(yC,{"Matrix, number":i,"Array, number":function(l,c){return i(n(ar(l)),c).valueOf()}});function i(u,l){if(u.size().length!==2)throw new Error("Only two dimensional matrix is supported");Kr(l,u.size()[0]);var c=a(0,u.size()[1]),o=new t(l,c),s=u.subset(o);return Qe(s)?s:n([[s]])}});var xC="size",iY=["typed","config","?matrix"],Dd=F(xC,iY,e=>{var{typed:r,config:t,matrix:n}=e;return r(xC,{Matrix:function(i){return i.create(i.size())},Array:ur,string:function(i){return t.matrix==="Array"?[i.length]:n([i.length])},"number | Complex | BigNumber | Unit | boolean | null":function(i){return t.matrix==="Array"?[]:n?n([]):gd()}})});var bC="squeeze",oY=["typed","matrix"],Sd=F(bC,oY,e=>{var{typed:r,matrix:t}=e;return r(bC,{Array:function(a){return Au(ar(a))},Matrix:function(a){var i=Au(a.toArray());return Array.isArray(i)?t(i):i},any:function(a){return ar(a)}})});var wC="subset",sY=["typed","matrix","zeros","add"],Vu=F(wC,sY,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e;return r(wC,{"Matrix, Index":function(l,c){return As(c)?t():(Nc(l,c),l.subset(c))},"Array, Index":r.referTo("Matrix, Index",function(u){return function(l,c){var o=u(t(l),c);return c.isScalar()?o:o.valueOf()}}),"Object, Index":fY,"string, Index":uY,"Matrix, Index, any, any":function(l,c,o,s){return As(c)?l:(Nc(l,c),l.clone().subset(c,i(o,c),s))},"Array, Index, any, any":r.referTo("Matrix, Index, any, any",function(u){return function(l,c,o,s){var m=u(t(l),c,o,s);return m.isMatrix?m.valueOf():m}}),"Array, Index, any":r.referTo("Matrix, Index, any, any",function(u){return function(l,c,o){return u(t(l),c,o,void 0).valueOf()}}),"Matrix, Index, any":r.referTo("Matrix, Index, any, any",function(u){return function(l,c,o){return u(l,c,o,void 0)}}),"string, Index, string":DC,"string, Index, string, string":DC,"Object, Index, any":cY});function i(u,l){if(typeof u=="string")throw new Error("can't boradcast a string");if(l._isScalar)return u;var c=l.size();if(c.every(o=>o>0))try{return a(u,n(c))}catch{return u}else return u}});function uY(e,r){if(!Mi(r))throw new TypeError("Index expected");if(As(r))return"";if(Nc(Array.from(e),r),r.size().length!==1)throw new pr(r.size().length,1);var t=e.length;Kr(r.min()[0],t),Kr(r.max()[0],t);var n=r.dimension(0),a="";return n.forEach(function(i){a+=e.charAt(i)}),a}function DC(e,r,t,n){if(!r||r.isIndex!==!0)throw new TypeError("Index expected");if(As(r))return e;if(Nc(Array.from(e),r),r.size().length!==1)throw new pr(r.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var a=r.dimension(0),i=a.size()[0];if(i!==t.length)throw new pr(a.size()[0],t.length);var u=e.length;Kr(r.min()[0]),Kr(r.max()[0]);for(var l=[],c=0;cu)for(var o=u-1,s=l.length;o{var{typed:r,matrix:t}=e;return r(SC,{Array:u=>n(t(u)).valueOf(),Matrix:n,any:ar});function n(u){var l=u.size(),c;switch(l.length){case 1:c=u.clone();break;case 2:{var o=l[0],s=l[1];if(s===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+lr(l)+")");switch(u.storage()){case"dense":c=a(u,o,s);break;case"sparse":c=i(u,o,s);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+lr(l)+")")}return c}function a(u,l,c){for(var o=u._data,s=[],m,d=0;d{var{typed:r,transpose:t,conj:n}=e;return r(NC,{any:function(i){return n(t(i))}})});var AC="zeros",pY=["typed","config","matrix","BigNumber"],Md=F(AC,pY,e=>{var{typed:r,config:t,matrix:n,BigNumber:a}=e;return r(AC,{"":function(){return t.matrix==="Array"?i([]):i([],"default")},"...number | BigNumber | string":function(o){var s=o[o.length-1];if(typeof s=="string"){var m=o.pop();return i(o,m)}else return t.matrix==="Array"?i(o):i(o,"default")},Array:i,Matrix:function(o){var s=o.storage();return i(o.valueOf(),s)},"Array | Matrix, string":function(o,s){return i(o.valueOf(),s)}});function i(c,o){var s=u(c),m=s?new a(0):0;if(l(c),o){var d=n(o);return c.length>0?d.resize(c,m):d}else{var h=[];return c.length>0?ii(h,c,m):h}}function u(c){var o=!1;return c.forEach(function(s,m,d){rr(s)&&(o=!0,d[m]=s.toNumber())}),o}function l(c){c.forEach(function(o){if(typeof o!="number"||!Ze(o)||o<0)throw new Error("Parameters in function zeros must be positive integers")})}});var MC="fft",dY=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],Cd=F(MC,dY,e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:a,divideScalar:i,exp:u,tau:l,i:c,dotDivide:o,conj:s,pow:m,ceil:d,log2:h}=e;return r(MC,{Array:y,Matrix:function(b){return b.create(y(b.toArray()))}});function y(C){var b=ur(C);return b.length===1?w(C,b[0]):v(C.map(N=>y(N,b.slice(1))),0)}function v(C,b){var N=ur(C);if(b!==0)return new Array(N[0]).fill(0).map((S,O)=>v(C[O],b-1));if(N.length===1)return w(C);function M(S){var O=ur(S);return new Array(O[1]).fill(0).map((_,E)=>new Array(O[0]).fill(0).map((T,R)=>S[R][E]))}return M(v(M(C),1))}function x(C){for(var b=C.length,N=u(i(a(-1,a(c,l)),b)),M=[],S=1-b;Sa(C[q],M[b-1+q])),...new Array(O-b).fill(0)],E=[...new Array(b+b-1).fill(0).map((L,q)=>i(1,M[q])),...new Array(O-(b+b-1)).fill(0)],T=w(_),R=w(E),k=new Array(O).fill(0).map((L,q)=>a(T[q],R[q])),W=o(s(y(s(k))),O),G=[],H=b-1;HE%2===0),b/2),...w(C.filter((_,E)=>E%2===1),b/2)],M=0;M{var{typed:r,fft:t,dotDivide:n,conj:a}=e;return r(CC,{"Array | Matrix":function(u){var l=Qe(u)?u.size():ur(u);return n(a(t(a(u))),l.reduce((c,o)=>c*o,1))}})});function EC(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function vY(e){for(var r=1;r{var{typed:r,add:t,subtract:n,multiply:a,divide:i,max:u,map:l,abs:c,isPositive:o,isNegative:s,larger:m,smaller:d,matrix:h,bignumber:y,unaryMinus:v}=e;function x(_){return function(E,T,R,k){var W=!(T.length===2&&(T.every(S)||T.every(Ht)));if(W)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var G=T[0],H=T[1],L=m(H,G),q=k.firstStep;if(q!==void 0&&!o(q))throw new Error('"firstStep" must be positive');var K=k.maxStep;if(K!==void 0&&!o(K))throw new Error('"maxStep" must be positive');var z=k.minStep;if(z&&s(z))throw new Error('"minStep" must be positive or zero');var oe=[G,H,q,z,K].filter(Le=>Le!==void 0);if(!(oe.every(S)||oe.every(Ht)))throw new Error('Inconsistent type of "t" dependant variables');for(var pe=1,ae=k.tol?k.tol:1e-4,$=k.minDelta?k.minDelta:.2,le=k.maxDelta?k.maxDelta:5,Ee=k.maxIter?k.maxIter:1e4,me=[G,H,...R,K,z].some(rr),[ge,Se,ye,be]=me?[y(_.a),y(_.c),y(_.b),y(_.bp)]:[_.a,_.c,_.b,_.bp],De=q?L?q:v(q):i(n(H,G),pe),Ae=[G],We=[R],Je=n(ye,be),J=0,re=0,xe=N(L),j=M(L);xe(Ae[J],H);){var ne=[];De=j(Ae[J],H,De),ne.push(E(Ae[J],We[J]));for(var ue=1;ueHt(Le)?Le.value:Le)));Me1/4&&(Ae.push(t(Ae[J],De)),We.push(t(We[J],a(De,ye,ne))),J++);var Ce=.84*(ae/Me)**(1/5);if(d(Ce,$)?Ce=$:m(Ce,le)&&(Ce=le),Ce=me?y(Ce):Ce,De=a(De,Ce),K&&m(c(De),K)?De=L?K:v(K):z&&d(c(De),z)&&(De=L?z:v(z)),re++,re>Ee)throw new Error("Maximum number of iterations reached, try changing options")}return{t:Ae,y:We}}}function w(_,E,T,R){var k=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],W=[null,1/2,3/4,1],G=[2/9,1/3,4/9,0],H=[7/24,1/4,1/3,1/8],L={a:k,c:W,b:G,bp:H};return x(L)(_,E,T,R)}function C(_,E,T,R){var k=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],W=[null,1/5,3/10,4/5,8/9,1,1],G=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],H=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],L={a:k,c:W,b:G,bp:H};return x(L)(_,E,T,R)}function b(_,E,T,R){var k=R.method?R.method:"RK45",W={RK23:w,RK45:C};if(k.toUpperCase()in W){var G=vY({},R);return delete G.method,W[k.toUpperCase()](_,E,T,G)}else{var H=Object.keys(W).map(q=>'"'.concat(q,'"')),L="".concat(H.slice(0,-1).join(", ")," and ").concat(H.slice(-1));throw new Error('Unavailable method "'.concat(k,'". Available methods are ').concat(L))}}function N(_){return _?d:m}function M(_){var E=_?m:d;return function(T,R,k){var W=t(T,k);return E(W,R)?n(R,T):k}}function S(_){return rr(_)||sr(_)}function O(_,E,T,R){var k=b(_,E.toArray(),T.toArray(),R);return{t:h(k.t),y:h(k.y)}}return r("solveODE",{"function, Array, Array, Object":b,"function, Matrix, Matrix, Object":O,"function, Array, Array":(_,E,T)=>b(_,E,T,{}),"function, Matrix, Matrix":(_,E,T)=>O(_,E,T,{}),"function, Array, number | BigNumber | Unit":(_,E,T)=>{var R=b(_,E,[T],{});return{t:R.t,y:R.y.map(k=>k[0])}},"function, Matrix, number | BigNumber | Unit":(_,E,T)=>{var R=b(_,E.toArray(),[T],{});return{t:h(R.t),y:h(R.y.map(k=>k[0]))}},"function, Array, number | BigNumber | Unit, Object":(_,E,T,R)=>{var k=b(_,E,[T],R);return{t:k.t,y:k.y.map(W=>W[0])}},"function, Matrix, number | BigNumber | Unit, Object":(_,E,T,R)=>{var k=b(_,E.toArray(),[T],R);return{t:h(k.t),y:h(k.y.map(W=>W[0]))}}})});var xY="erf",bY=["typed"],Fd=F(xY,bY,e=>{var{typed:r}=e;return r("name",{number:function(u){var l=Math.abs(u);return l>=SY?Ba(u):l<=wY?Ba(u)*t(l):l<=4?Ba(u)*(1-n(l)):Ba(u)*(1-a(l))},"Array | Matrix":r.referToSelf(i=>u=>je(u,i))});function t(i){var u=i*i,l=to[0][4]*u,c=u,o;for(o=0;o<3;o+=1)l=(l+to[0][o])*u,c=(c+Zu[0][o])*u;return i*(l+to[0][3])/(c+Zu[0][3])}function n(i){var u=to[1][8]*i,l=i,c;for(c=0;c<7;c+=1)u=(u+to[1][c])*i,l=(l+Zu[1][c])*i;var o=(u+to[1][7])/(l+Zu[1][7]),s=parseInt(i*16)/16,m=(i-s)*(i+s);return Math.exp(-s*s)*Math.exp(-m)*o}function a(i){var u=1/(i*i),l=to[2][5]*u,c=u,o;for(o=0;o<4;o+=1)l=(l+to[2][o])*u,c=(c+Zu[2][o])*u;var s=u*(l+to[2][4])/(c+Zu[2][4]);s=(DY-s)/i,u=parseInt(i*16)/16;var m=(i-u)*(i+u);return Math.exp(-u*u)*Math.exp(-m)*s}}),wY=.46875,DY=.5641895835477563,to=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Zu=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],SY=Math.pow(2,53);var TC="zeta",NY=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],_d=F(TC,NY,e=>{var{typed:r,config:t,multiply:n,pow:a,divide:i,factorial:u,equal:l,smallerEq:c,isNegative:o,gamma:s,sin:m,subtract:d,add:h,Complex:y,BigNumber:v,pi:x}=e;return r(TC,{number:S=>w(S,O=>O,()=>20),BigNumber:S=>w(S,O=>new v(O),()=>Math.abs(Math.log10(t.epsilon))),Complex:C});function w(S,O,_){return l(S,0)?O(-.5):l(S,1)?O(NaN):isFinite(S)?b(S,O,_,E=>E):o(S)?O(NaN):O(1)}function C(S){return S.re===0&&S.im===0?new y(-.5):S.re===1?new y(NaN,NaN):S.re===1/0&&S.im===0?new y(1):S.im===1/0||S.re===-1/0?new y(NaN,NaN):b(S,O=>O,O=>Math.round(1.3*15+.9*Math.abs(O.im)),O=>O.re)}function b(S,O,_,E){var T=_(S);if(E(S)>-(T-1)/2)return M(S,O(T),O);var R=n(a(2,S),a(O(x),d(S,1)));return R=n(R,m(n(i(O(x),2),S))),R=n(R,s(d(1,S))),n(R,b(d(1,S),O,_,E))}function N(S,O){for(var _=S,E=S;c(E,O);E=h(E,1)){var T=i(n(u(h(O,d(E,1))),a(4,E)),n(u(d(O,E)),u(n(2,E))));_=h(_,T)}return n(O,_)}function M(S,O,_){for(var E=i(1,n(N(_(0),O),d(1,a(2,d(1,S))))),T=_(0),R=_(1);c(R,O);R=h(R,1))T=h(T,i(n((-1)**(R-1),N(R,O)),a(R,S)));return n(E,T)}});var FC="mode",AY=["typed","isNaN","isNumeric"],Od=F(FC,AY,e=>{var{typed:r,isNaN:t,isNumeric:n}=e;return r(FC,{"Array | Matrix":a,"...":function(u){return a(u)}});function a(i){i=gr(i.valueOf());var u=i.length;if(u===0)throw new Error("Cannot calculate mode of an empty array");for(var l={},c=[],o=0,s=0;so&&(o=l[m],c=[m])}return c}});function Et(e,r,t){var n;return String(e).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+Tr(t)+", value: "+JSON.stringify(t)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+r+", unexpected type of argument"+n)):String(e).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+Tr(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+r+", no ordering relation is defined for complex numbers"+n)):e}var _C="prod",MY=["typed","config","multiplyScalar","numeric"],Bd=F(_C,MY,e=>{var{typed:r,config:t,multiplyScalar:n,numeric:a}=e;return r(_C,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(l,c){throw new Error("prod(A, dim) is not yet supported")},"...":function(l){return i(l)}});function i(u){var l;if(An(u,function(c){try{l=l===void 0?c:n(l,c)}catch(o){throw Et(o,"prod",c)}}),typeof l=="string"&&(l=a(l,t.number)),l===void 0)throw new Error("Cannot calculate prod of an empty array");return l}});var OC="format",CY=["typed"],Pd=F(OC,CY,e=>{var{typed:r}=e;return r(OC,{any:lr,"any, Object | function | number | BigNumber":lr})});var BC="bin",EY=["typed","format"],Id=F(BC,EY,e=>{var{typed:r,format:t}=e;return r(BC,{"number | BigNumber":function(a){return t(a,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(a,i){return t(a,{notation:"bin",wordSize:i})}})});var PC="oct",TY=["typed","format"],Rd=F(PC,TY,e=>{var{typed:r,format:t}=e;return r(PC,{"number | BigNumber":function(a){return t(a,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(a,i){return t(a,{notation:"oct",wordSize:i})}})});var IC="hex",FY=["typed","format"],qd=F(IC,FY,e=>{var{typed:r,format:t}=e;return r(IC,{"number | BigNumber":function(a){return t(a,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(a,i){return t(a,{notation:"hex",wordSize:i})}})});var kd=/\\$([\\w.]+)/g;var RC="print",_Y=["typed"],Qu=F(RC,_Y,e=>{var{typed:r}=e;return r(RC,{"string, Object | Array":qC,"string, Object | Array, number | Object":qC})});function qC(e,r,t){return e.replace(kd,function(n,a){var i=a.split("."),u=r[i.shift()];for(u!==void 0&&u.isMatrix&&(u=u.toArray());i.length&&u!==void 0;){var l=i.shift();u=l?u[l]:u+"."}return u!==void 0?St(u)?u:lr(u,t):n})}var kC="to",OY=["typed","matrix","concat"],Ld=F(kC,OY,e=>{var{typed:r,matrix:t,concat:n}=e,a=vr({typed:r,matrix:t,concat:n});return r(kC,{"Unit, Unit | string":(i,u)=>i.to(u)},a({Ds:!0}))});var LC="isPrime",BY=["typed"],zd=F(LC,BY,e=>{var{typed:r}=e;return r(LC,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var a=5;a*a<=n;a+=6)if(n%a===0||n%(a+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var a=n.toNumber(),i=5;i*i<=a;i+=6)if(a%i===0||a%(i+2)===0)return!1;return!0}function u(C,b,N){for(var M=1;!b.eq(0);)b.mod(2).eq(0)?(b=b.div(2),C=C.mul(C).mod(N)):(b=b.sub(1),M=C.mul(M).mod(N));return M}var l=n.constructor.clone({precision:n.toFixed(0).length*2});n=new l(n);for(var c=0,o=n.sub(1);o.mod(2).eq(0);)o=o.div(2),c+=1;var s=null;if(n.lt("3317044064679887385961981"))s=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(C=>Cn=>je(n,t))})});var PY="numeric",IY=["number","?bignumber","?fraction"],Ud=F(PY,IY,e=>{var{number:r,bignumber:t,fraction:n}=e,a={string:!0,number:!0,BigNumber:!0,Fraction:!0},i={number:u=>r(u),BigNumber:t?u=>t(u):Hu,Fraction:n?u=>n(u):vd};return function(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",o=arguments.length>2?arguments[2]:void 0;if(o!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var s=Tr(l);if(!(s in a))throw new TypeError("Cannot convert "+l+' of type "'+s+'"; valid input types are '+Object.keys(a).join(", "));if(!(c in i))throw new TypeError("Cannot convert "+l+' to type "'+c+'"; valid output types are '+Object.keys(i).join(", "));return c===s?l:i[c](l)}});var zC="divideScalar",RY=["typed","numeric"],Wd=F(zC,RY,e=>{var{typed:r,numeric:t}=e;return r(zC,{"number, number":function(a,i){return a/i},"Complex, Complex":function(a,i){return a.div(i)},"BigNumber, BigNumber":function(a,i){return a.div(i)},"Fraction, Fraction":function(a,i){return a.div(i)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,a)=>n.divide(a),"number | Fraction | Complex | BigNumber, Unit":(n,a)=>a.divideInto(n)})});var UC="pow",qY=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Yd=F(UC,qY,e=>{var{typed:r,config:t,identity:n,multiply:a,matrix:i,inv:u,number:l,fraction:c,Complex:o}=e;return r(UC,{"number, number":s,"Complex, Complex":function(y,v){return y.pow(v)},"BigNumber, BigNumber":function(y,v){return v.isInteger()||y>=0||t.predictable?y.pow(v):new o(y.toNumber(),0).pow(v.toNumber(),0)},"Fraction, Fraction":function(y,v){var x=y.pow(v);if(x!=null)return x;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return s(y.valueOf(),v.valueOf())},"Array, number":m,"Array, BigNumber":function(y,v){return m(y,v.toNumber())},"Matrix, number":d,"Matrix, BigNumber":function(y,v){return d(y,v.toNumber())},"Unit, number | BigNumber":function(y,v){return y.pow(v)}});function s(h,y){if(t.predictable&&!Ze(y)&&h<0)try{var v=c(y),x=l(v);if((y===x||Math.abs((y-x)/y)<1e-14)&&v.d%2===1)return(v.n%2===0?1:-1)*Math.pow(-h,y)}catch{}return t.predictable&&(h<-1&&y===1/0||h>-1&&h<0&&y===-1/0)?NaN:Ze(y)||h>=0||t.predictable?Fw(h,y):h*h<1&&y===1/0||h*h>1&&y===-1/0?0:new o(h,0).pow(y,0)}function m(h,y){if(!Ze(y))throw new TypeError("For A^b, b must be an integer (value is "+y+")");var v=ur(h);if(v.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+v.length+" dimensions)");if(v[0]!==v[1])throw new Error("For A^b, A must be square (size is "+v[0]+"x"+v[1]+")");if(y<0)try{return m(u(h),-y)}catch(C){throw C.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+y+")"):C}for(var x=n(v[0]).valueOf(),w=h;y>=1;)(y&1)===1&&(x=a(w,x)),y>>=1,w=a(w,w);return x}function d(h,y){return i(m(h.valueOf(),y))}});var Xu="Number of decimals in function round must be an integer",WC="round",kY=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Hd=F(WC,kY,e=>{var{typed:r,config:t,matrix:n,equalScalar:a,zeros:i,BigNumber:u,DenseMatrix:l}=e,c=jr({typed:r,equalScalar:a}),o=Wr({typed:r,DenseMatrix:l}),s=kt({typed:r});function m(d){return Math.abs(Nu(d).exponent)}return r(WC,{number:function(h){var y=Ou(h,m(t.epsilon)),v=At(h,y,t.epsilon)?y:h;return Ou(v)},"number, number":function(h,y){var v=m(t.epsilon);if(y>=v)return Ou(h,y);var x=Ou(h,v),w=At(h,x,t.epsilon)?x:h;return Ou(w,y)},"number, BigNumber":function(h,y){if(!y.isInteger())throw new TypeError(Xu);return new u(h).toDecimalPlaces(y.toNumber())},Complex:function(h){return h.round()},"Complex, number":function(h,y){if(y%1)throw new TypeError(Xu);return h.round(y)},"Complex, BigNumber":function(h,y){if(!y.isInteger())throw new TypeError(Xu);var v=y.toNumber();return h.round(v)},BigNumber:function(h){var y=new u(h).toDecimalPlaces(m(t.epsilon)),v=$t(h,y,t.epsilon)?y:h;return v.toDecimalPlaces(0)},"BigNumber, BigNumber":function(h,y){if(!y.isInteger())throw new TypeError(Xu);var v=m(t.epsilon);if(y>=v)return h.toDecimalPlaces(y.toNumber());var x=h.toDecimalPlaces(v),w=$t(h,x,t.epsilon)?x:h;return w.toDecimalPlaces(y.toNumber())},Fraction:function(h){return h.round()},"Fraction, number":function(h,y){if(y%1)throw new TypeError(Xu);return h.round(y)},"Fraction, BigNumber":function(h,y){if(!y.isInteger())throw new TypeError(Xu);return h.round(y.toNumber())},"Unit, number, Unit":r.referToSelf(d=>function(h,y,v){var x=h.toNumeric(v);return v.multiply(d(x,y))}),"Unit, BigNumber, Unit":r.referToSelf(d=>(h,y,v)=>d(h,y.toNumber(),v)),"Unit, Unit":r.referToSelf(d=>(h,y)=>d(h,0,y)),"Array | Matrix, number, Unit":r.referToSelf(d=>(h,y,v)=>je(h,x=>d(x,y,v),!0)),"Array | Matrix, BigNumber, Unit":r.referToSelf(d=>(h,y,v)=>d(h,y.toNumber(),v)),"Array | Matrix, Unit":r.referToSelf(d=>(h,y)=>d(h,0,y)),"Array | Matrix":r.referToSelf(d=>h=>je(h,d,!0)),"SparseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>c(h,y,d,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>s(h,y,d,!1)),"Array, number | BigNumber":r.referToSelf(d=>(h,y)=>s(n(h),y,d,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":r.referToSelf(d=>(h,y)=>a(h,0)?i(y.size(),y.storage()):o(y,h,d,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":r.referToSelf(d=>(h,y)=>a(h,0)?i(y.size(),y.storage()):s(y,h,d,!0)),"number | Complex | BigNumber | Fraction, Array":r.referToSelf(d=>(h,y)=>s(n(y),h,d,!0).valueOf())})});var YC="log",LY=["config","typed","divideScalar","Complex"],$d=F(YC,LY,e=>{var{typed:r,config:t,divideScalar:n,Complex:a}=e;return r(YC,{number:function(u){return u>=0||t.predictable?GM(u):new a(u,0).log()},Complex:function(u){return u.log()},BigNumber:function(u){return!u.isNegative()||t.predictable?u.ln():new a(u.toNumber(),0).log()},"any, any":r.referToSelf(i=>(u,l)=>n(i(u),i(l)))})});var HC="log1p",zY=["typed","config","divideScalar","log","Complex"],Gd=F(HC,zY,e=>{var{typed:r,config:t,divideScalar:n,log:a,Complex:i}=e;return r(HC,{number:function(c){return c>=-1||t.predictable?Mm(c):u(new i(c,0))},Complex:u,BigNumber:function(c){var o=c.plus(1);return!o.isNegative()||t.predictable?o.ln():u(new i(c.toNumber(),0))},"Array | Matrix":r.referToSelf(l=>c=>je(c,l)),"any, any":r.referToSelf(l=>(c,o)=>n(l(c),a(o)))});function u(l){var c=l.re+1;return new i(Math.log(Math.sqrt(c*c+l.im*l.im)),Math.atan2(l.im,c))}});var $C="nthRoots",UY=["config","typed","divideScalar","Complex"],Vd=F($C,UY,e=>{var{typed:r,config:t,divideScalar:n,Complex:a}=e,i=[function(c){return new a(c,0)},function(c){return new a(0,c)},function(c){return new a(-c,0)},function(c){return new a(0,-c)}];function u(l,c){if(c<0)throw new Error("Root must be greater than zero");if(c===0)throw new Error("Root must be non-zero");if(c%1!==0)throw new Error("Root must be an integer");if(l===0||l.abs()===0)return[new a(0,0)];var o=typeof l=="number",s;(o||l.re===0||l.im===0)&&(o?s=2*+(l<0):l.im===0?s=2*+(l.re<0):s=2*+(l.im<0)+1);for(var m=l.arg(),d=l.abs(),h=[],y=Math.pow(d,1/c),v=0;v{var{typed:r,equalScalar:t,matrix:n,pow:a,DenseMatrix:i,concat:u}=e,l=lt({typed:r}),c=Zt({typed:r,DenseMatrix:i}),o=jr({typed:r,equalScalar:t}),s=Wr({typed:r,DenseMatrix:i}),m=vr({typed:r,matrix:n,concat:u}),d={};for(var h in a.signatures)Object.prototype.hasOwnProperty.call(a.signatures,h)&&!h.includes("Matrix")&&!h.includes("Array")&&(d[h]=a.signatures[h]);var y=r(d);return r(GC,m({elop:y,SS:c,DS:l,Ss:o,sS:s}))});var VC="dotDivide",YY=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Qd=F(VC,YY,e=>{var{typed:r,matrix:t,equalScalar:n,divideScalar:a,DenseMatrix:i,concat:u}=e,l=Lt({typed:r,equalScalar:n}),c=lt({typed:r}),o=Zt({typed:r,DenseMatrix:i}),s=jr({typed:r,equalScalar:n}),m=Wr({typed:r,DenseMatrix:i}),d=vr({typed:r,matrix:t,concat:u});return r(VC,d({elop:a,SS:o,DS:c,SD:l,Ss:s,sS:m}))});function Oi(e){var{DenseMatrix:r}=e;return function(n,a,i){var u=n.size();if(u.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+lr(u)+")");var l=u[0],c=u[1];if(l!==c)throw new RangeError("Matrix must be square (size: "+lr(u)+")");var o=[];if(Qe(a)){var s=a.size(),m=a._data;if(s.length===1){if(s[0]!==l)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var d=0;d{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:a,subtractScalar:i,equalScalar:u,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(ZC,{"SparseMatrix, Array | Matrix":function(d,h){return s(d,h)},"DenseMatrix, Array | Matrix":function(d,h){return o(d,h)},"Array, Array | Matrix":function(d,h){var y=t(d),v=o(y,h);return v.valueOf()}});function o(m,d){d=c(m,d,!0);for(var h=d._data,y=m._size[0],v=m._size[1],x=[],w=m._data,C=0;CN&&(O.push(x[R]),_.push(k))}if(u(S,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var W=n(M,S),G=0,H=_.length;G{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:a,subtractScalar:i,equalScalar:u,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(QC,{"SparseMatrix, Array | Matrix":function(d,h){return s(d,h)},"DenseMatrix, Array | Matrix":function(d,h){return o(d,h)},"Array, Array | Matrix":function(d,h){var y=t(d),v=o(y,h);return v.valueOf()}});function o(m,d){d=c(m,d,!0);for(var h=d._data,y=m._size[0],v=m._size[1],x=[],w=m._data,C=v-1;C>=0;C--){var b=h[C][0]||0,N=void 0;if(u(b,0))N=0;else{var M=w[C][C];if(u(M,0))throw new Error("Linear system cannot be solved since matrix is singular");N=n(b,M);for(var S=C-1;S>=0;S--)h[S]=[i(h[S][0]||0,a(N,w[S][C]))]}x[C]=[N]}return new l({data:x,size:[y,1]})}function s(m,d){d=c(m,d,!0);for(var h=d._data,y=m._size[0],v=m._size[1],x=m._values,w=m._index,C=m._ptr,b=[],N=v-1;N>=0;N--){var M=h[N][0]||0;if(u(M,0))b[N]=[0];else{for(var S=0,O=[],_=[],E=C[N],T=C[N+1],R=T-1;R>=E;R--){var k=w[R];k===N?S=x[R]:k{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:a,subtractScalar:i,equalScalar:u,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(XC,{"SparseMatrix, Array | Matrix":function(d,h){return s(d,h)},"DenseMatrix, Array | Matrix":function(d,h){return o(d,h)},"Array, Array | Matrix":function(d,h){var y=t(d),v=o(y,h);return v.map(x=>x.valueOf())}});function o(m,d){for(var h=[c(m,d,!0)._data.map(_=>_[0])],y=m._data,v=m._size[0],x=m._size[1],w=0;wnew l({data:_.map(E=>[E]),size:[v,1]}))}function s(m,d){for(var h=[c(m,d,!0)._data.map(pe=>pe[0])],y=m._size[0],v=m._size[1],x=m._values,w=m._index,C=m._ptr,b=0;bb&&(O.push(x[k]),_.push(W))}if(u(R,0))if(u(S[b],0)){if(M===0){var q=[...S];q[b]=1;for(var K=0,z=_.length;Knew l({data:pe.map(ae=>[ae]),size:[y,1]}))}});var JC="usolveAll",VY=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],jd=F(JC,VY,e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:a,subtractScalar:i,equalScalar:u,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(JC,{"SparseMatrix, Array | Matrix":function(d,h){return s(d,h)},"DenseMatrix, Array | Matrix":function(d,h){return o(d,h)},"Array, Array | Matrix":function(d,h){var y=t(d),v=o(y,h);return v.map(x=>x.valueOf())}});function o(m,d){for(var h=[c(m,d,!0)._data.map(_=>_[0])],y=m._data,v=m._size[0],x=m._size[1],w=x-1;w>=0;w--)for(var C=h.length,b=0;b=0;O--)S[O]=i(S[O],y[O][w]);h.push(S)}}else{if(b===0)return[];h.splice(b,1),b-=1,C-=1}else{N[w]=n(N[w],y[w][w]);for(var M=w-1;M>=0;M--)N[M]=i(N[M],a(N[w],y[M][w]))}}return h.map(_=>new l({data:_.map(E=>[E]),size:[v,1]}))}function s(m,d){for(var h=[c(m,d,!0)._data.map(pe=>pe[0])],y=m._size[0],v=m._size[1],x=m._values,w=m._index,C=m._ptr,b=v-1;b>=0;b--)for(var N=h.length,M=0;M=E;k--){var W=w[k];W===b?R=x[k]:Wnew l({data:pe.map(ae=>[ae]),size:[y,1]}))}});var ZY="matAlgo08xS0Sid",QY=["typed","equalScalar"],Ju=F(ZY,QY,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,u){var l=a._values,c=a._index,o=a._ptr,s=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType(),d=i._values,h=i._index,y=i._ptr,v=i._size,x=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(s.length!==v.length)throw new pr(s.length,v.length);if(s[0]!==v[0]||s[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+v+")");if(!l||!d)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var w=s[0],C=s[1],b,N=t,M=0,S=u;typeof m=="string"&&m===x&&m!=="mixed"&&(b=m,N=r.find(t,[b,b]),M=r.convert(0,b),S=r.find(u,[b,b]));for(var O=[],_=[],E=[],T=[],R=[],k,W,G,H,L=0;L{var{typed:r,matrix:t}=e;return{"Array, number":r.referTo("DenseMatrix, number",n=>(a,i)=>n(t(a),i).valueOf()),"Array, BigNumber":r.referTo("DenseMatrix, BigNumber",n=>(a,i)=>n(t(a),i).valueOf()),"number, Array":r.referTo("number, DenseMatrix",n=>(a,i)=>n(a,t(i)).valueOf()),"BigNumber, Array":r.referTo("BigNumber, DenseMatrix",n=>(a,i)=>n(a,t(i)).valueOf())}});var KC="leftShift",XY=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],eh=F(KC,XY,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,DenseMatrix:i,concat:u}=e,l=Mn({typed:r}),c=Lt({typed:r,equalScalar:n}),o=Ju({typed:r,equalScalar:n}),s=ra({typed:r,DenseMatrix:i}),m=jr({typed:r,equalScalar:n}),d=kt({typed:r}),h=vr({typed:r,matrix:t,concat:u}),y=Ku({typed:r,matrix:t});return r(KC,{"number, number":Iw,"BigNumber, BigNumber":W2,"SparseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():m(x,w,v,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():d(x,w,v,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):s(w,x,v,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):d(w,x,v,!0))},y,h({SS:o,DS:l,SD:c}))});var jC="rightArithShift",JY=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],rh=F(jC,JY,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,DenseMatrix:i,concat:u}=e,l=Mn({typed:r}),c=Lt({typed:r,equalScalar:n}),o=Ju({typed:r,equalScalar:n}),s=ra({typed:r,DenseMatrix:i}),m=jr({typed:r,equalScalar:n}),d=kt({typed:r}),h=vr({typed:r,matrix:t,concat:u}),y=Ku({typed:r,matrix:t});return r(jC,{"number, number":Rw,"BigNumber, BigNumber":Y2,"SparseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():m(x,w,v,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():d(x,w,v,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):s(w,x,v,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):d(w,x,v,!0))},y,h({SS:o,DS:l,SD:c}))});var eE="rightLogShift",KY=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],th=F(eE,KY,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,DenseMatrix:i,concat:u}=e,l=Mn({typed:r}),c=Lt({typed:r,equalScalar:n}),o=Ju({typed:r,equalScalar:n}),s=ra({typed:r,DenseMatrix:i}),m=jr({typed:r,equalScalar:n}),d=kt({typed:r}),h=vr({typed:r,matrix:t,concat:u}),y=Ku({typed:r,matrix:t});return r(eE,{"number, number":qw,"SparseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():m(x,w,v,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():d(x,w,v,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):s(w,x,v,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):d(w,x,v,!0))},y,h({SS:o,DS:l,SD:c}))});var rE="and",jY=["typed","matrix","equalScalar","zeros","not","concat"],ju=F(rE,jY,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u}=e,l=Lt({typed:r,equalScalar:n}),c=Uo({typed:r,equalScalar:n}),o=jr({typed:r,equalScalar:n}),s=kt({typed:r}),m=vr({typed:r,matrix:t,concat:u});return r(rE,{"number, number":Yw,"Complex, Complex":function(h,y){return(h.re!==0||h.im!==0)&&(y.re!==0||y.im!==0)},"BigNumber, BigNumber":function(h,y){return!h.isZero()&&!y.isZero()&&!h.isNaN()&&!y.isNaN()},"Unit, Unit":r.referToSelf(d=>(h,y)=>d(h.value||0,y.value||0)),"SparseMatrix, any":r.referToSelf(d=>(h,y)=>i(y)?a(h.size(),h.storage()):o(h,y,d,!1)),"DenseMatrix, any":r.referToSelf(d=>(h,y)=>i(y)?a(h.size(),h.storage()):s(h,y,d,!1)),"any, SparseMatrix":r.referToSelf(d=>(h,y)=>i(h)?a(h.size(),h.storage()):o(y,h,d,!0)),"any, DenseMatrix":r.referToSelf(d=>(h,y)=>i(h)?a(h.size(),h.storage()):s(y,h,d,!0)),"Array, any":r.referToSelf(d=>(h,y)=>d(t(h),y).valueOf()),"any, Array":r.referToSelf(d=>(h,y)=>d(h,t(y)).valueOf())},m({SS:c,DS:l}))});var nh="compare",eH=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],ah=F(nh,eH,e=>{var{typed:r,config:t,equalScalar:n,matrix:a,BigNumber:i,Fraction:u,DenseMatrix:l,concat:c}=e,o=lt({typed:r}),s=zo({typed:r,equalScalar:n}),m=Wr({typed:r,DenseMatrix:l}),d=vr({typed:r,matrix:a,concat:c}),h=Ia({typed:r});return r(nh,rH({typed:r,config:t}),{"boolean, boolean":function(v,x){return v===x?0:v>x?1:-1},"BigNumber, BigNumber":function(v,x){return $t(v,x,t.epsilon)?new i(0):new i(v.cmp(x))},"Fraction, Fraction":function(v,x){return new u(v.compare(x))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},h,d({SS:s,DS:o,Ss:m}))}),rH=F(nh,["typed","config"],e=>{var{typed:r,config:t}=e;return r(nh,{"number, number":function(a,i){return At(a,i,t.epsilon)?0:a>i?1:-1}})});var _s=ma(nE(),1);var aE="compareNatural",tH=["typed","compare"],ih=F(aE,tH,e=>{var{typed:r,compare:t}=e,n=t.signatures["boolean,boolean"];return r(aE,{"any, any":a});function a(c,o){var s=Tr(c),m=Tr(o),d;if((s==="number"||s==="BigNumber"||s==="Fraction")&&(m==="number"||m==="BigNumber"||m==="Fraction"))return d=t(c,o),d.toString()!=="0"?d>0?1:-1:(0,_s.default)(s,m);var h=["Array","DenseMatrix","SparseMatrix"];if(h.includes(s)||h.includes(m))return d=i(a,c,o),d!==0?d:(0,_s.default)(s,m);if(s!==m)return(0,_s.default)(s,m);if(s==="Complex")return nH(c,o);if(s==="Unit")return c.equalBase(o)?a(c.value,o.value):u(a,c.formatUnits(),o.formatUnits());if(s==="boolean")return n(c,o);if(s==="string")return(0,_s.default)(c,o);if(s==="Object")return l(a,c,o);if(s==="null"||s==="undefined")return 0;throw new TypeError('Unsupported type of value "'+s+'"')}function i(c,o,s){return ha(o)&&ha(s)?u(c,o.toJSON().values,s.toJSON().values):ha(o)?i(c,o.toArray(),s):ha(s)?i(c,o,s.toArray()):Ji(o)?i(c,o.toJSON().data,s):Ji(s)?i(c,o,s.toJSON().data):Array.isArray(o)?Array.isArray(s)?u(c,o,s):i(c,o,[s]):i(c,[o],s)}function u(c,o,s){for(var m=0,d=Math.min(o.length,s.length);ms.length?1:o.lengthr.re?1:e.rer.im?1:e.im{var{typed:r,matrix:t,concat:n}=e,a=vr({typed:r,matrix:t,concat:n});return r(iE,Fm,a({elop:Fm,Ds:!0}))});var sh="equal",iH=["typed","matrix","equalScalar","DenseMatrix","concat"],uh=F(sh,iH,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:t,concat:i});return r(sh,oH({typed:r,equalScalar:n}),o({elop:n,SS:l,DS:u,Ss:c}))}),oH=F(sh,["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return r(sh,{"any, any":function(a,i){return a===null?i===null:i===null?a===null:a===void 0?i===void 0:i===void 0?a===void 0:t(a,i)}})});var oE="equalText",sH=["typed","compareText","isZero"],fh=F(oE,sH,e=>{var{typed:r,compareText:t,isZero:n}=e;return r(oE,{"any, any":function(i,u){return n(t(i,u))}})});var ch="smaller",uH=["typed","config","matrix","DenseMatrix","concat"],lh=F(ch,uH,e=>{var{typed:r,config:t,matrix:n,DenseMatrix:a,concat:i}=e,u=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:n,concat:i}),s=Ia({typed:r});return r(ch,fH({typed:r,config:t}),{"boolean, boolean":(m,d)=>mm.compare(d)===-1,"Complex, Complex":function(d,h){throw new TypeError("No ordering relation is defined for complex numbers")}},s,o({SS:l,DS:u,Ss:c}))}),fH=F(ch,["typed","config"],e=>{var{typed:r,config:t}=e;return r(ch,{"number, number":function(a,i){return a{var{typed:r,config:t,matrix:n,DenseMatrix:a,concat:i}=e,u=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:n,concat:i}),s=Ia({typed:r});return r(mh,lH({typed:r,config:t}),{"boolean, boolean":(m,d)=>m<=d,"BigNumber, BigNumber":function(d,h){return d.lte(h)||$t(d,h,t.epsilon)},"Fraction, Fraction":(m,d)=>m.compare(d)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},s,o({SS:l,DS:u,Ss:c}))}),lH=F(mh,["typed","config"],e=>{var{typed:r,config:t}=e;return r(mh,{"number, number":function(a,i){return a<=i||At(a,i,t.epsilon)}})});var dh="larger",mH=["typed","config","matrix","DenseMatrix","concat"],hh=F(dh,mH,e=>{var{typed:r,config:t,matrix:n,DenseMatrix:a,concat:i}=e,u=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:n,concat:i}),s=Ia({typed:r});return r(dh,pH({typed:r,config:t}),{"boolean, boolean":(m,d)=>m>d,"BigNumber, BigNumber":function(d,h){return d.gt(h)&&!$t(d,h,t.epsilon)},"Fraction, Fraction":(m,d)=>m.compare(d)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},s,o({SS:l,DS:u,Ss:c}))}),pH=F(dh,["typed","config"],e=>{var{typed:r,config:t}=e;return r(dh,{"number, number":function(a,i){return a>i&&!At(a,i,t.epsilon)}})});var vh="largerEq",dH=["typed","config","matrix","DenseMatrix","concat"],gh=F(vh,dH,e=>{var{typed:r,config:t,matrix:n,DenseMatrix:a,concat:i}=e,u=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:n,concat:i}),s=Ia({typed:r});return r(vh,hH({typed:r,config:t}),{"boolean, boolean":(m,d)=>m>=d,"BigNumber, BigNumber":function(d,h){return d.gte(h)||$t(d,h,t.epsilon)},"Fraction, Fraction":(m,d)=>m.compare(d)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},s,o({SS:l,DS:u,Ss:c}))}),hH=F(vh,["typed","config"],e=>{var{typed:r,config:t}=e;return r(vh,{"number, number":function(a,i){return a>=i||At(a,i,t.epsilon)}})});var sE="deepEqual",vH=["typed","equal"],yh=F(sE,vH,e=>{var{typed:r,equal:t}=e;return r(sE,{"any, any":function(i,u){return n(i.valueOf(),u.valueOf())}});function n(a,i){if(Array.isArray(a))if(Array.isArray(i)){var u=a.length;if(u!==i.length)return!1;for(var l=0;l{var{typed:r,config:t,equalScalar:n,matrix:a,DenseMatrix:i,concat:u}=e,l=lt({typed:r}),c=Zt({typed:r,DenseMatrix:i}),o=Wr({typed:r,DenseMatrix:i}),s=vr({typed:r,matrix:a,concat:u});return r(xh,yH({typed:r,equalScalar:n}),s({elop:m,SS:c,DS:l,Ss:o}));function m(d,h){return!n(d,h)}}),yH=F(xh,["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return r(xh,{"any, any":function(a,i){return a===null?i!==null:i===null?a!==null:a===void 0?i!==void 0:i===void 0?a!==void 0:!t(a,i)}})});var uE="partitionSelect",xH=["typed","isNumeric","isNaN","compare"],wh=F(uE,xH,e=>{var{typed:r,isNumeric:t,isNaN:n,compare:a}=e,i=a,u=(o,s)=>-a(o,s);return r(uE,{"Array | Matrix, number":function(s,m){return l(s,m,i)},"Array | Matrix, number, string":function(s,m,d){if(d==="asc")return l(s,m,i);if(d==="desc")return l(s,m,u);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":l});function l(o,s,m){if(!Ze(s)||s<0)throw new Error("k must be a non-negative integer");if(Qe(o)){var d=o.size();if(d.length>1)throw new Error("Only one dimensional matrices supported");return c(o.valueOf(),s,m)}if(Array.isArray(o))return c(o,s,m)}function c(o,s,m){if(s>=o.length)throw new Error("k out of bounds");for(var d=0;d=0){var C=o[x];o[x]=o[v],o[v]=C,--x}else++v;m(o[v],w)>0&&--v,s<=v?y=v:h=v+1}return o[s]}});var fE="sort",bH=["typed","matrix","compare","compareNatural"],Dh=F(fE,bH,e=>{var{typed:r,matrix:t,compare:n,compareNatural:a}=e,i=n,u=(s,m)=>-n(s,m);return r(fE,{Array:function(m){return c(m),m.sort(i)},Matrix:function(m){return o(m),t(m.toArray().sort(i),m.storage())},"Array, function":function(m,d){return c(m),m.sort(d)},"Matrix, function":function(m,d){return o(m),t(m.toArray().sort(d),m.storage())},"Array, string":function(m,d){return c(m),m.sort(l(d))},"Matrix, string":function(m,d){return o(m),t(m.toArray().sort(l(d)),m.storage())}});function l(s){if(s==="asc")return i;if(s==="desc")return u;if(s==="natural")return a;throw new Error('String "asc", "desc", or "natural" expected')}function c(s){if(ur(s).length!==1)throw new Error("One dimensional array expected")}function o(s){if(s.size().length!==1)throw new Error("One dimensional matrix expected")}});var cE="max",wH=["typed","config","numeric","larger"],ef=F(cE,wH,e=>{var{typed:r,config:t,numeric:n,larger:a}=e;return r(cE,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(c,o){return ko(c,o.valueOf(),i)},"...":function(c){if(Pa(c))throw new TypeError("Scalar values expected in function max");return u(c)}});function i(l,c){try{return a(l,c)?l:c}catch(o){throw Et(o,"max",c)}}function u(l){var c;if(An(l,function(o){try{isNaN(o)&&typeof o=="number"?c=NaN:(c===void 0||a(o,c))&&(c=o)}catch(s){throw Et(s,"max",o)}}),c===void 0)throw new Error("Cannot calculate max of an empty array");return typeof c=="string"&&(c=n(c,t.number)),c}});var lE="min",DH=["typed","config","numeric","smaller"],rf=F(lE,DH,e=>{var{typed:r,config:t,numeric:n,smaller:a}=e;return r(lE,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(c,o){return ko(c,o.valueOf(),i)},"...":function(c){if(Pa(c))throw new TypeError("Scalar values expected in function min");return u(c)}});function i(l,c){try{return a(l,c)?l:c}catch(o){throw Et(o,"min",c)}}function u(l){var c;if(An(l,function(o){try{isNaN(o)&&typeof o=="number"?c=NaN:(c===void 0||a(o,c))&&(c=o)}catch(s){throw Et(s,"min",o)}}),c===void 0)throw new Error("Cannot calculate min of an empty array");return typeof c=="string"&&(c=n(c,t.number)),c}});var SH="ImmutableDenseMatrix",NH=["smaller","DenseMatrix"],Sh=F(SH,NH,e=>{var{smaller:r,DenseMatrix:t}=e;function n(a,i){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(i&&!St(i))throw new Error("Invalid datatype: "+i);if(Qe(a)||Mr(a)){var u=new t(a,i);this._data=u._data,this._size=u._size,this._datatype=u._datatype,this._min=null,this._max=null}else if(a&&Mr(a.data)&&Mr(a.size))this._data=a.data,this._size=a.size,this._datatype=a.datatype,this._min=typeof a.min<"u"?a.min:null,this._max=typeof a.max<"u"?a.max:null;else{if(a)throw new TypeError("Unsupported type of data ("+Tr(a)+")");this._data=[],this._size=[0],this._datatype=i,this._min=null,this._max=null}}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(a){switch(arguments.length){case 1:{var i=t.prototype.subset.call(this,a);return Qe(i)?new n({data:i._data,size:i._size,datatype:i._datatype}):i}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:ar(this._data),size:ar(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(a){return new n(a)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(this._min===null){var a=null;this.forEach(function(i){(a===null||r(i,a))&&(a=i)}),this._min=a!==null?a:void 0}return this._min},n.prototype.max=function(){if(this._max===null){var a=null;this.forEach(function(i){(a===null||r(a,i))&&(a=i)}),this._max=a!==null?a:void 0}return this._max},n},{isClass:!0});var AH="Index",MH=["ImmutableDenseMatrix","getMatrixDataType"],Nh=F(AH,MH,e=>{var{ImmutableDenseMatrix:r,getMatrixDataType:t}=e;function n(i){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var u=0,l=arguments.length;u{t&&r.push(n)}),r}var CH="FibonacciHeap",EH=["smaller","larger"],Ah=F(CH,EH,e=>{var{smaller:r,larger:t}=e,n=1/Math.log((1+Math.sqrt(5))/2);function a(){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}a.prototype.type="FibonacciHeap",a.prototype.isFibonacciHeap=!0,a.prototype.insert=function(s,m){var d={key:s,value:m,degree:0};if(this._minimum){var h=this._minimum;d.left=h,d.right=h.right,h.right=d,d.right.left=d,r(s,h.key)&&(this._minimum=d)}else d.left=d,d.right=d,this._minimum=d;return this._size++,d},a.prototype.size=function(){return this._size},a.prototype.clear=function(){this._minimum=null,this._size=0},a.prototype.isEmpty=function(){return this._size===0},a.prototype.extractMinimum=function(){var s=this._minimum;if(s===null)return s;for(var m=this._minimum,d=s.degree,h=s.child;d>0;){var y=h.right;h.left.right=h.right,h.right.left=h.left,h.left=m,h.right=m.right,m.right=h,h.right.left=h,h.parent=null,h=y,d--}return s.left.right=s.right,s.right.left=s.left,s===s.right?m=null:(m=s.right,m=o(m,this._size)),this._size--,this._minimum=m,s},a.prototype.remove=function(s){this._minimum=i(this._minimum,s,-1),this.extractMinimum()};function i(s,m,d){m.key=d;var h=m.parent;return h&&r(m.key,h.key)&&(u(s,m,h),l(s,h)),r(m.key,s.key)&&(s=m),s}function u(s,m,d){m.left.right=m.right,m.right.left=m.left,d.degree--,d.child===m&&(d.child=m.right),d.degree===0&&(d.child=null),m.left=s,m.right=s.right,s.right=m,m.right.left=m,m.parent=null,m.mark=!1}function l(s,m){var d=m.parent;!d||(m.mark?(u(s,m,d),l(d)):m.mark=!0)}var c=function(m,d){m.left.right=m.right,m.right.left=m.left,m.parent=d,d.child?(m.left=d.child,m.right=d.child.right,d.child.right=m,m.right.left=m):(d.child=m,m.right=m,m.left=m),d.degree++,m.mark=!1};function o(s,m){var d=Math.floor(Math.log(m)*n)+1,h=new Array(d),y=0,v=s;if(v)for(y++,v=v.right;v!==s;)y++,v=v.right;for(var x;y>0;){for(var w=v.degree,C=v.right;x=h[w],!!x;){if(t(v.key,x.key)){var b=x;x=v,v=b}c(x,v),h[w]=null,w++}h[w]=v,v=C,y--}s=null;for(var N=0;N{var{addScalar:r,equalScalar:t,FibonacciHeap:n}=e;function a(){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return a.prototype.type="Spa",a.prototype.isSpa=!0,a.prototype.set=function(i,u){if(this._values[i])this._values[i].value=u;else{var l=this._heap.insert(i,u);this._values[i]=l}},a.prototype.get=function(i){var u=this._values[i];return u?u.value:0},a.prototype.accumulate=function(i,u){var l=this._values[i];l?l.value=r(l.value,u):(l=this._heap.insert(i,u),this._values[i]=l)},a.prototype.forEach=function(i,u,l){var c=this._heap,o=this._values,s=[],m=c.extractMinimum();for(m&&s.push(m);m&&m.key<=u;)m.key>=i&&(t(m.value,0)||l(m.key,m.value,this)),m=c.extractMinimum(),m&&s.push(m);for(var d=0;d{var{on:r,config:t,addScalar:n,subtractScalar:a,multiplyScalar:i,divideScalar:u,pow:l,abs:c,fix:o,round:s,equal:m,isNumeric:d,format:h,number:y,Complex:v,BigNumber:x,Fraction:w}=e,C=y;function b(J,re){if(!(this instanceof b))throw new Error("Constructor must be called with the new operator");if(!(J==null||d(J)||Kt(J)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,re===void 0)this.units=[],this.dimensions=K.map(j=>0);else if(typeof re=="string"){var xe=b.parse(re);this.units=xe.units,this.dimensions=xe.dimensions}else if(Ht(re)&&re.value===null)this.fixPrefix=re.fixPrefix,this.skipAutomaticSimplification=re.skipAutomaticSimplification,this.dimensions=re.dimensions.slice(0),this.units=re.units.map(j=>ht({},j));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(J)}Object.defineProperty(b,"name",{value:"Unit"}),b.prototype.constructor=b,b.prototype.type="Unit",b.prototype.isUnit=!0;var N,M,S;function O(){for(;S===" "||S===" ";)T()}function _(J){return J>="0"&&J<="9"||J==="."}function E(J){return J>="0"&&J<="9"}function T(){M++,S=N.charAt(M)}function R(J){M=J,S=N.charAt(M)}function k(){var J="",re=M;if(S==="+"?T():S==="-"&&(J+=S,T()),!_(S))return R(re),null;if(S==="."){if(J+=S,T(),!E(S))return R(re),null}else{for(;E(S);)J+=S,T();S==="."&&(J+=S,T())}for(;E(S);)J+=S,T();if(S==="E"||S==="e"){var xe="",j=M;if(xe+=S,T(),(S==="+"||S==="-")&&(xe+=S,T()),!E(S))return R(j),J;for(J=J+xe;E(S);)J+=S,T()}return J}function W(){for(var J="";E(S)||b.isValidAlpha(S);)J+=S,T();var re=J.charAt(0);return b.isValidAlpha(re)?J:null}function G(J){return S===J?(T(),J):null}b.parse=function(J,re){if(re=re||{},N=J,M=-1,S="",typeof N!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var xe=new b;xe.units=[];var j=1,ne=!1;T(),O();var ue=k(),Me=null;if(ue){if(t.number==="BigNumber")Me=new x(ue);else if(t.number==="Fraction")try{Me=new w(ue)}catch{Me=parseFloat(ue)}else Me=parseFloat(ue);O(),G("*")?(j=1,ne=!0):G("/")&&(j=-1,ne=!0)}for(var Ce=[],Le=1;;){for(O();S==="(";)Ce.push(j),Le*=j,j=1,T(),O();var Ie=void 0;if(S){var fr=S;if(Ie=W(),Ie===null)throw new SyntaxError('Unexpected "'+fr+'" in "'+N+'" at index '+M.toString())}else break;var or=H(Ie);if(or===null)throw new SyntaxError('Unit "'+Ie+'" not found.');var Ke=j*Le;if(O(),G("^")){O();var Pr=k();if(Pr===null)throw new SyntaxError('In "'+J+'", "^" must be followed by a floating-point number');Ke*=Pr}xe.units.push({unit:or.unit,prefix:or.prefix,power:Ke});for(var ee=0;ee1||Math.abs(this.units[0].power-1)>1e-15},b.prototype._normalize=function(J){if(J==null||this.units.length===0)return J;for(var re=J,xe=b._getNumberConverter(Tr(J)),j=0;j{if(Xe($,J)){var re=$[J],xe=re.prefixes[""];return{unit:re,prefix:xe}}for(var j in $)if(Xe($,j)&&lM(J,j)){var ne=$[j],ue=J.length-j.length,Me=J.substring(0,ue),Ce=Xe(ne.prefixes,Me)?ne.prefixes[Me]:void 0;if(Ce!==void 0)return{unit:ne,prefix:Ce}}return null},{hasher:J=>J[0],limit:100});b.isValuelessUnit=function(J){return H(J)!==null},b.prototype.hasBase=function(J){if(typeof J=="string"&&(J=z[J]),!J)return!1;for(var re=0;re1e-12)return!1;return!0},b.prototype.equalBase=function(J){for(var re=0;re1e-12)return!1;return!0},b.prototype.equals=function(J){return this.equalBase(J)&&m(this.value,J.value)},b.prototype.multiply=function(J){for(var re=this.clone(),xe=Ht(J)?J:new b(J),j=0;j1e-12&&(Xe(ge,Ce)?re.push({unit:ge[Ce].unit,prefix:ge[Ce].prefix,power:J.dimensions[Me]||0}):ue=!0)}re.length1e-12)if(Xe(me.si,j))re.push({unit:me.si[j].unit,prefix:me.si[j].prefix,power:J.dimensions[xe]||0});else throw new Error("Cannot express custom unit "+j+" in SI units")}return J.units=re,J.fixPrefix=!0,J.skipAutomaticSimplification=!0,this.value!==null?(J.value=null,this.to(J)):J},b.prototype.formatUnits=function(){for(var J="",re="",xe=0,j=0,ne=0;ne0?(xe++,J+=" "+this.units[ne].prefix.name+this.units[ne].unit.name,Math.abs(this.units[ne].power-1)>1e-15&&(J+="^"+this.units[ne].power)):this.units[ne].power<0&&j++;if(j>0)for(var ue=0;ue0?(re+=" "+this.units[ue].prefix.name+this.units[ue].unit.name,Math.abs(this.units[ue].power+1)>1e-15&&(re+="^"+-this.units[ue].power)):(re+=" "+this.units[ue].prefix.name+this.units[ue].unit.name,re+="^"+this.units[ue].power));J=J.substr(1),re=re.substr(1),xe>1&&j>0&&(J="("+J+")"),j>1&&xe>0&&(re="("+re+")");var Me=J;return xe>0&&j>0&&(Me+=" / "),Me+=re,Me},b.prototype.format=function(J){var re=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),xe=!1;typeof re.value<"u"&&re.value!==null&&Kt(re.value)&&(xe=Math.abs(re.value.re)<1e-14);for(var j in re.units)Xe(re.units,j)&&re.units[j].unit&&(re.units[j].unit.name==="VA"&&xe?re.units[j].unit=$.VAR:re.units[j].unit.name==="VAR"&&!xe&&(re.units[j].unit=$.VA));re.units.length===1&&!re.fixPrefix&&Math.abs(re.units[0].power-Math.round(re.units[0].power))<1e-14&&(re.units[0].prefix=re._bestPrefix());var ne=re._denormalize(re.value),ue=re.value!==null?h(ne,J||{}):"",Me=re.formatUnits();return re.value&&Kt(re.value)&&(ue="("+ue+")"),Me.length>0&&ue.length>0&&(ue+=" "),ue+=Me,ue},b.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var J=this.value!==null?c(this.value):0,re=c(this.units[0].unit.value),xe=this.units[0].prefix;if(J===0)return xe;var j=this.units[0].power,ne=Math.log(J/Math.pow(xe.value*re,j))/Math.LN10-1.2;if(ne>-2.200001&&ne<1.800001)return xe;ne=Math.abs(ne);var ue=this.units[0].unit.prefixes;for(var Me in ue)if(Xe(ue,Me)){var Ce=ue[Me];if(Ce.scientific){var Le=Math.abs(Math.log(J/Math.pow(Ce.value*re,j))/Math.LN10-1.2);(Le0)},$={meter:{name:"meter",base:z.LENGTH,prefixes:q.LONG,value:1,offset:0},inch:{name:"inch",base:z.LENGTH,prefixes:q.NONE,value:.0254,offset:0},foot:{name:"foot",base:z.LENGTH,prefixes:q.NONE,value:.3048,offset:0},yard:{name:"yard",base:z.LENGTH,prefixes:q.NONE,value:.9144,offset:0},mile:{name:"mile",base:z.LENGTH,prefixes:q.NONE,value:1609.344,offset:0},link:{name:"link",base:z.LENGTH,prefixes:q.NONE,value:.201168,offset:0},rod:{name:"rod",base:z.LENGTH,prefixes:q.NONE,value:5.0292,offset:0},chain:{name:"chain",base:z.LENGTH,prefixes:q.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:z.LENGTH,prefixes:q.NONE,value:1e-10,offset:0},m:{name:"m",base:z.LENGTH,prefixes:q.SHORT,value:1,offset:0},in:{name:"in",base:z.LENGTH,prefixes:q.NONE,value:.0254,offset:0},ft:{name:"ft",base:z.LENGTH,prefixes:q.NONE,value:.3048,offset:0},yd:{name:"yd",base:z.LENGTH,prefixes:q.NONE,value:.9144,offset:0},mi:{name:"mi",base:z.LENGTH,prefixes:q.NONE,value:1609.344,offset:0},li:{name:"li",base:z.LENGTH,prefixes:q.NONE,value:.201168,offset:0},rd:{name:"rd",base:z.LENGTH,prefixes:q.NONE,value:5.02921,offset:0},ch:{name:"ch",base:z.LENGTH,prefixes:q.NONE,value:20.1168,offset:0},mil:{name:"mil",base:z.LENGTH,prefixes:q.NONE,value:254e-7,offset:0},m2:{name:"m2",base:z.SURFACE,prefixes:q.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:z.SURFACE,prefixes:q.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:z.SURFACE,prefixes:q.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:z.SURFACE,prefixes:q.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:z.SURFACE,prefixes:q.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:z.SURFACE,prefixes:q.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:z.SURFACE,prefixes:q.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:z.SURFACE,prefixes:q.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:z.SURFACE,prefixes:q.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:z.SURFACE,prefixes:q.NONE,value:1e4,offset:0},m3:{name:"m3",base:z.VOLUME,prefixes:q.CUBIC,value:1,offset:0},L:{name:"L",base:z.VOLUME,prefixes:q.SHORT,value:.001,offset:0},l:{name:"l",base:z.VOLUME,prefixes:q.SHORT,value:.001,offset:0},litre:{name:"litre",base:z.VOLUME,prefixes:q.LONG,value:.001,offset:0},cuin:{name:"cuin",base:z.VOLUME,prefixes:q.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:z.VOLUME,prefixes:q.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:z.VOLUME,prefixes:q.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:z.VOLUME,prefixes:q.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:z.VOLUME,prefixes:q.NONE,value:15e-6,offset:0},drop:{name:"drop",base:z.VOLUME,prefixes:q.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:z.VOLUME,prefixes:q.NONE,value:5e-8,offset:0},minim:{name:"minim",base:z.VOLUME,prefixes:q.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:z.VOLUME,prefixes:q.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:z.VOLUME,prefixes:q.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:z.VOLUME,prefixes:q.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:z.VOLUME,prefixes:q.NONE,value:1e-6,offset:0},cup:{name:"cup",base:z.VOLUME,prefixes:q.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:z.VOLUME,prefixes:q.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:z.VOLUME,prefixes:q.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:z.VOLUME,prefixes:q.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:z.VOLUME,prefixes:q.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:z.VOLUME,prefixes:q.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:z.VOLUME,prefixes:q.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:z.VOLUME,prefixes:q.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:z.VOLUME,prefixes:q.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:z.VOLUME,prefixes:q.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:z.VOLUME,prefixes:q.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:z.VOLUME,prefixes:q.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:z.VOLUME,prefixes:q.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:z.VOLUME,prefixes:q.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:z.VOLUME,prefixes:q.NONE,value:.1173478,offset:0},obl:{name:"obl",base:z.VOLUME,prefixes:q.NONE,value:.1589873,offset:0},g:{name:"g",base:z.MASS,prefixes:q.SHORT,value:.001,offset:0},gram:{name:"gram",base:z.MASS,prefixes:q.LONG,value:.001,offset:0},ton:{name:"ton",base:z.MASS,prefixes:q.SHORT,value:907.18474,offset:0},t:{name:"t",base:z.MASS,prefixes:q.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:z.MASS,prefixes:q.LONG,value:1e3,offset:0},grain:{name:"grain",base:z.MASS,prefixes:q.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:z.MASS,prefixes:q.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:z.MASS,prefixes:q.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:z.MASS,prefixes:q.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:z.MASS,prefixes:q.NONE,value:45.359237,offset:0},stick:{name:"stick",base:z.MASS,prefixes:q.NONE,value:.115,offset:0},stone:{name:"stone",base:z.MASS,prefixes:q.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:z.MASS,prefixes:q.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:z.MASS,prefixes:q.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:z.MASS,prefixes:q.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:z.MASS,prefixes:q.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:z.MASS,prefixes:q.NONE,value:45.359237,offset:0},s:{name:"s",base:z.TIME,prefixes:q.SHORT,value:1,offset:0},min:{name:"min",base:z.TIME,prefixes:q.NONE,value:60,offset:0},h:{name:"h",base:z.TIME,prefixes:q.NONE,value:3600,offset:0},second:{name:"second",base:z.TIME,prefixes:q.LONG,value:1,offset:0},sec:{name:"sec",base:z.TIME,prefixes:q.LONG,value:1,offset:0},minute:{name:"minute",base:z.TIME,prefixes:q.NONE,value:60,offset:0},hour:{name:"hour",base:z.TIME,prefixes:q.NONE,value:3600,offset:0},day:{name:"day",base:z.TIME,prefixes:q.NONE,value:86400,offset:0},week:{name:"week",base:z.TIME,prefixes:q.NONE,value:7*86400,offset:0},month:{name:"month",base:z.TIME,prefixes:q.NONE,value:2629800,offset:0},year:{name:"year",base:z.TIME,prefixes:q.NONE,value:31557600,offset:0},decade:{name:"decade",base:z.TIME,prefixes:q.NONE,value:315576e3,offset:0},century:{name:"century",base:z.TIME,prefixes:q.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:z.TIME,prefixes:q.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:z.FREQUENCY,prefixes:q.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:z.FREQUENCY,prefixes:q.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:z.ANGLE,prefixes:q.SHORT,value:1,offset:0},radian:{name:"radian",base:z.ANGLE,prefixes:q.LONG,value:1,offset:0},deg:{name:"deg",base:z.ANGLE,prefixes:q.SHORT,value:null,offset:0},degree:{name:"degree",base:z.ANGLE,prefixes:q.LONG,value:null,offset:0},grad:{name:"grad",base:z.ANGLE,prefixes:q.SHORT,value:null,offset:0},gradian:{name:"gradian",base:z.ANGLE,prefixes:q.LONG,value:null,offset:0},cycle:{name:"cycle",base:z.ANGLE,prefixes:q.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:z.ANGLE,prefixes:q.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:z.ANGLE,prefixes:q.NONE,value:null,offset:0},A:{name:"A",base:z.CURRENT,prefixes:q.SHORT,value:1,offset:0},ampere:{name:"ampere",base:z.CURRENT,prefixes:q.LONG,value:1,offset:0},K:{name:"K",base:z.TEMPERATURE,prefixes:q.SHORT,value:1,offset:0},degC:{name:"degC",base:z.TEMPERATURE,prefixes:q.SHORT,value:1,offset:273.15},degF:{name:"degF",base:z.TEMPERATURE,prefixes:q.SHORT,value:new w(5,9),offset:459.67},degR:{name:"degR",base:z.TEMPERATURE,prefixes:q.SHORT,value:new w(5,9),offset:0},kelvin:{name:"kelvin",base:z.TEMPERATURE,prefixes:q.LONG,value:1,offset:0},celsius:{name:"celsius",base:z.TEMPERATURE,prefixes:q.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:z.TEMPERATURE,prefixes:q.LONG,value:new w(5,9),offset:459.67},rankine:{name:"rankine",base:z.TEMPERATURE,prefixes:q.LONG,value:new w(5,9),offset:0},mol:{name:"mol",base:z.AMOUNT_OF_SUBSTANCE,prefixes:q.SHORT,value:1,offset:0},mole:{name:"mole",base:z.AMOUNT_OF_SUBSTANCE,prefixes:q.LONG,value:1,offset:0},cd:{name:"cd",base:z.LUMINOUS_INTENSITY,prefixes:q.SHORT,value:1,offset:0},candela:{name:"candela",base:z.LUMINOUS_INTENSITY,prefixes:q.LONG,value:1,offset:0},N:{name:"N",base:z.FORCE,prefixes:q.SHORT,value:1,offset:0},newton:{name:"newton",base:z.FORCE,prefixes:q.LONG,value:1,offset:0},dyn:{name:"dyn",base:z.FORCE,prefixes:q.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:z.FORCE,prefixes:q.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:z.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:z.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:z.FORCE,prefixes:q.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:z.FORCE,prefixes:q.NONE,value:9.80665,offset:0},J:{name:"J",base:z.ENERGY,prefixes:q.SHORT,value:1,offset:0},joule:{name:"joule",base:z.ENERGY,prefixes:q.LONG,value:1,offset:0},erg:{name:"erg",base:z.ENERGY,prefixes:q.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:z.ENERGY,prefixes:q.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:z.ENERGY,prefixes:q.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:z.ENERGY,prefixes:q.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:z.ENERGY,prefixes:q.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:z.POWER,prefixes:q.SHORT,value:1,offset:0},watt:{name:"watt",base:z.POWER,prefixes:q.LONG,value:1,offset:0},hp:{name:"hp",base:z.POWER,prefixes:q.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:z.POWER,prefixes:q.SHORT,value:v.I,offset:0},VA:{name:"VA",base:z.POWER,prefixes:q.SHORT,value:1,offset:0},Pa:{name:"Pa",base:z.PRESSURE,prefixes:q.SHORT,value:1,offset:0},psi:{name:"psi",base:z.PRESSURE,prefixes:q.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:z.PRESSURE,prefixes:q.NONE,value:101325,offset:0},bar:{name:"bar",base:z.PRESSURE,prefixes:q.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:z.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:z.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:z.PRESSURE,prefixes:q.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:z.PRESSURE,prefixes:q.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:z.ELECTRIC_CHARGE,prefixes:q.LONG,value:1,offset:0},C:{name:"C",base:z.ELECTRIC_CHARGE,prefixes:q.SHORT,value:1,offset:0},farad:{name:"farad",base:z.ELECTRIC_CAPACITANCE,prefixes:q.LONG,value:1,offset:0},F:{name:"F",base:z.ELECTRIC_CAPACITANCE,prefixes:q.SHORT,value:1,offset:0},volt:{name:"volt",base:z.ELECTRIC_POTENTIAL,prefixes:q.LONG,value:1,offset:0},V:{name:"V",base:z.ELECTRIC_POTENTIAL,prefixes:q.SHORT,value:1,offset:0},ohm:{name:"ohm",base:z.ELECTRIC_RESISTANCE,prefixes:q.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:z.ELECTRIC_INDUCTANCE,prefixes:q.LONG,value:1,offset:0},H:{name:"H",base:z.ELECTRIC_INDUCTANCE,prefixes:q.SHORT,value:1,offset:0},siemens:{name:"siemens",base:z.ELECTRIC_CONDUCTANCE,prefixes:q.LONG,value:1,offset:0},S:{name:"S",base:z.ELECTRIC_CONDUCTANCE,prefixes:q.SHORT,value:1,offset:0},weber:{name:"weber",base:z.MAGNETIC_FLUX,prefixes:q.LONG,value:1,offset:0},Wb:{name:"Wb",base:z.MAGNETIC_FLUX,prefixes:q.SHORT,value:1,offset:0},tesla:{name:"tesla",base:z.MAGNETIC_FLUX_DENSITY,prefixes:q.LONG,value:1,offset:0},T:{name:"T",base:z.MAGNETIC_FLUX_DENSITY,prefixes:q.SHORT,value:1,offset:0},b:{name:"b",base:z.BIT,prefixes:q.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:z.BIT,prefixes:q.BINARY_LONG,value:1,offset:0},B:{name:"B",base:z.BIT,prefixes:q.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:z.BIT,prefixes:q.BINARY_LONG,value:8,offset:0}},le={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function Ee(J){if(J.number==="BigNumber"){var re=Pc(x);$.rad.value=new x(1),$.deg.value=re.div(180),$.grad.value=re.div(200),$.cycle.value=re.times(2),$.arcsec.value=re.div(648e3),$.arcmin.value=re.div(10800)}else $.rad.value=1,$.deg.value=Math.PI/180,$.grad.value=Math.PI/200,$.cycle.value=Math.PI*2,$.arcsec.value=Math.PI/648e3,$.arcmin.value=Math.PI/10800;$.radian.value=$.rad.value,$.degree.value=$.deg.value,$.gradian.value=$.grad.value}Ee(t),r&&r("config",function(J,re){J.number!==re.number&&Ee(J)});var me={si:{NONE:{unit:ae,prefix:q.NONE[""]},LENGTH:{unit:$.m,prefix:q.SHORT[""]},MASS:{unit:$.g,prefix:q.SHORT.k},TIME:{unit:$.s,prefix:q.SHORT[""]},CURRENT:{unit:$.A,prefix:q.SHORT[""]},TEMPERATURE:{unit:$.K,prefix:q.SHORT[""]},LUMINOUS_INTENSITY:{unit:$.cd,prefix:q.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:$.mol,prefix:q.SHORT[""]},ANGLE:{unit:$.rad,prefix:q.SHORT[""]},BIT:{unit:$.bits,prefix:q.SHORT[""]},FORCE:{unit:$.N,prefix:q.SHORT[""]},ENERGY:{unit:$.J,prefix:q.SHORT[""]},POWER:{unit:$.W,prefix:q.SHORT[""]},PRESSURE:{unit:$.Pa,prefix:q.SHORT[""]},ELECTRIC_CHARGE:{unit:$.C,prefix:q.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:$.F,prefix:q.SHORT[""]},ELECTRIC_POTENTIAL:{unit:$.V,prefix:q.SHORT[""]},ELECTRIC_RESISTANCE:{unit:$.ohm,prefix:q.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:$.H,prefix:q.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:$.S,prefix:q.SHORT[""]},MAGNETIC_FLUX:{unit:$.Wb,prefix:q.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:$.T,prefix:q.SHORT[""]},FREQUENCY:{unit:$.Hz,prefix:q.SHORT[""]}}};me.cgs=JSON.parse(JSON.stringify(me.si)),me.cgs.LENGTH={unit:$.m,prefix:q.SHORT.c},me.cgs.MASS={unit:$.g,prefix:q.SHORT[""]},me.cgs.FORCE={unit:$.dyn,prefix:q.SHORT[""]},me.cgs.ENERGY={unit:$.erg,prefix:q.NONE[""]},me.us=JSON.parse(JSON.stringify(me.si)),me.us.LENGTH={unit:$.ft,prefix:q.NONE[""]},me.us.MASS={unit:$.lbm,prefix:q.NONE[""]},me.us.TEMPERATURE={unit:$.degF,prefix:q.NONE[""]},me.us.FORCE={unit:$.lbf,prefix:q.NONE[""]},me.us.ENERGY={unit:$.BTU,prefix:q.BTU[""]},me.us.POWER={unit:$.hp,prefix:q.NONE[""]},me.us.PRESSURE={unit:$.psi,prefix:q.NONE[""]},me.auto=JSON.parse(JSON.stringify(me.si));var ge=me.auto;b.setUnitSystem=function(J){if(Xe(me,J))ge=me[J];else throw new Error("Unit system "+J+" does not exist. Choices are: "+Object.keys(me).join(", "))},b.getUnitSystem=function(){for(var J in me)if(Xe(me,J)&&me[J]===ge)return J},b.typeConverters={BigNumber:function(re){return re!=null&&re.isFraction?new x(re.n).div(re.d).times(re.s):new x(re+"")},Fraction:function(re){return new w(re)},Complex:function(re){return re},number:function(re){return re!=null&&re.isFraction?y(re):re}},b.prototype._numberConverter=function(){var J=b.typeConverters[this.valueType()];if(J)return J;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},b._getNumberConverter=function(J){if(!b.typeConverters[J])throw new TypeError('Unsupported type "'+J+'"');return b.typeConverters[J]};for(var Se in $)if(Xe($,Se)){var ye=$[Se];ye.dimensions=ye.base.dimensions}for(var be in le)if(Xe(le,be)){var De=$[le[be]],Ae={};for(var We in De)Xe(De,We)&&(Ae[We]=De[We]);Ae.name=be,$[be]=Ae}b.isValidAlpha=function(re){return/^[a-zA-Z]$/.test(re)};function Je(J){for(var re=0;re0&&!(b.isValidAlpha(S)||E(S)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+J+'"')}}return b.createUnit=function(J,re){if(typeof J!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(re&&re.override){for(var xe in J)if(Xe(J,xe)&&b.deleteUnit(xe),J[xe].aliases)for(var j=0;j"u"||re===null)&&(re={}),typeof J!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Xe($,J))throw new Error('Cannot create unit "'+J+'": a unit with that name already exists');Je(J);var xe=null,j=[],ne=0,ue,Me,Ce;if(re&&re.type==="Unit")xe=re.clone();else if(typeof re=="string")re!==""&&(ue=re);else if(typeof re=="object")ue=re.definition,Me=re.prefixes,ne=re.offset,Ce=re.baseName,re.aliases&&(j=re.aliases.valueOf());else throw new TypeError('Cannot create unit "'+J+'" from "'+re.toString()+'": expecting "string" or "Unit" or "Object"');if(j){for(var Le=0;Le1e-12){ce=!1;break}if(ce){Pr=!0,Ie.base=z[ee];break}}if(!Pr){Ce=Ce||J+"_STUFF";var Be={dimensions:xe.dimensions.slice(0)};Be.key=Ce,z[Ce]=Be,ge[Ce]={unit:Ie,prefix:q.NONE[""]},Ie.base=z[Ce]}}else{if(Ce=Ce||J+"_STUFF",K.indexOf(Ce)>=0)throw new Error('Cannot create new base unit "'+J+'": a base unit with that name already exists (and cannot be overridden)');K.push(Ce);for(var fr in z)Xe(z,fr)&&(z[fr].dimensions[K.length-1]=0);for(var or={dimensions:[]},Ke=0;Ke{var{typed:r,Unit:t}=e;return r(gE,{Unit:function(a){return a.clone()},string:function(a){return t.isValuelessUnit(a)?new t(null,a):t.parse(a,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(a,i){return new t(a,i)},"number | BigNumber | Fraction":function(a){return new t(a)},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var yE="sparse",PH=["typed","SparseMatrix"],Fh=F(yE,PH,e=>{var{typed:r,SparseMatrix:t}=e;return r(yE,{"":function(){return new t([])},string:function(a){return new t([],a)},"Array | Matrix":function(a){return new t(a)},"Array | Matrix, string":function(a,i){return new t(a,i)}})});var xE="createUnit",IH=["typed","Unit"],_h=F(xE,IH,e=>{var{typed:r,Unit:t}=e;return r(xE,{"Object, Object":function(a,i){return t.createUnit(a,i)},Object:function(a){return t.createUnit(a,{})},"string, Unit | string | Object, Object":function(a,i,u){var l={};return l[a]=i,t.createUnit(l,u)},"string, Unit | string | Object":function(a,i){var u={};return u[a]=i,t.createUnit(u,{})},string:function(a){var i={};return i[a]={},t.createUnit(i,{})}})});var bE="acos",RH=["typed","config","Complex"],Oh=F(bE,RH,e=>{var{typed:r,config:t,Complex:n}=e;return r(bE,{number:function(i){return i>=-1&&i<=1||t.predictable?Math.acos(i):new n(i,0).acos()},Complex:function(i){return i.acos()},BigNumber:function(i){return i.acos()}})});var wE="acosh",qH=["typed","config","Complex"],Bh=F(wE,qH,e=>{var{typed:r,config:t,Complex:n}=e;return r(wE,{number:function(i){return i>=1||t.predictable?Gw(i):i<=-1?new n(Math.log(Math.sqrt(i*i-1)-i),Math.PI):new n(i,0).acosh()},Complex:function(i){return i.acosh()},BigNumber:function(i){return i.acosh()}})});var DE="acot",kH=["typed","BigNumber"],Ph=F(DE,kH,e=>{var{typed:r,BigNumber:t}=e;return r(DE,{number:Vw,Complex:function(a){return a.acot()},BigNumber:function(a){return new t(1).div(a).atan()}})});var SE="acoth",LH=["typed","config","Complex","BigNumber"],Ih=F(SE,LH,e=>{var{typed:r,config:t,Complex:n,BigNumber:a}=e;return r(SE,{number:function(u){return u>=1||u<=-1||t.predictable?Zw(u):new n(u,0).acoth()},Complex:function(u){return u.acoth()},BigNumber:function(u){return new a(1).div(u).atanh()}})});var NE="acsc",zH=["typed","config","Complex","BigNumber"],Rh=F(NE,zH,e=>{var{typed:r,config:t,Complex:n,BigNumber:a}=e;return r(NE,{number:function(u){return u<=-1||u>=1||t.predictable?Qw(u):new n(u,0).acsc()},Complex:function(u){return u.acsc()},BigNumber:function(u){return new a(1).div(u).asin()}})});var AE="acsch",UH=["typed","BigNumber"],qh=F(AE,UH,e=>{var{typed:r,BigNumber:t}=e;return r(AE,{number:Xw,Complex:function(a){return a.acsch()},BigNumber:function(a){return new t(1).div(a).asinh()}})});var ME="asec",WH=["typed","config","Complex","BigNumber"],kh=F(ME,WH,e=>{var{typed:r,config:t,Complex:n,BigNumber:a}=e;return r(ME,{number:function(u){return u<=-1||u>=1||t.predictable?Jw(u):new n(u,0).asec()},Complex:function(u){return u.asec()},BigNumber:function(u){return new a(1).div(u).acos()}})});var CE="asech",YH=["typed","config","Complex","BigNumber"],Lh=F(CE,YH,e=>{var{typed:r,config:t,Complex:n,BigNumber:a}=e;return r(CE,{number:function(u){if(u<=1&&u>=-1||t.predictable){var l=1/u;if(l>0||t.predictable)return Kw(u);var c=Math.sqrt(l*l-1);return new n(Math.log(c-l),Math.PI)}return new n(u,0).asech()},Complex:function(u){return u.asech()},BigNumber:function(u){return new a(1).div(u).acosh()}})});var EE="asin",HH=["typed","config","Complex"],zh=F(EE,HH,e=>{var{typed:r,config:t,Complex:n}=e;return r(EE,{number:function(i){return i>=-1&&i<=1||t.predictable?Math.asin(i):new n(i,0).asin()},Complex:function(i){return i.asin()},BigNumber:function(i){return i.asin()}})});var $H="asinh",GH=["typed"],Uh=F($H,GH,e=>{var{typed:r}=e;return r("asinh",{number:jw,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var VH="atan",ZH=["typed"],Wh=F(VH,ZH,e=>{var{typed:r}=e;return r("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var TE="atan2",QH=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Yh=F(TE,QH,e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:a,DenseMatrix:i,concat:u}=e,l=Lt({typed:r,equalScalar:n}),c=lt({typed:r}),o=Zp({typed:r,equalScalar:n}),s=jr({typed:r,equalScalar:n}),m=Wr({typed:r,DenseMatrix:i}),d=vr({typed:r,matrix:t,concat:u});return r(TE,{"number, number":Math.atan2,"BigNumber, BigNumber":(h,y)=>a.atan2(h,y)},d({scalar:"number | BigNumber",SS:o,DS:c,SD:l,Ss:s,sS:m}))});var FE="atanh",XH=["typed","config","Complex"],Hh=F(FE,XH,e=>{var{typed:r,config:t,Complex:n}=e;return r(FE,{number:function(i){return i<=1&&i>=-1||t.predictable?eD(i):new n(i,0).atanh()},Complex:function(i){return i.atanh()},BigNumber:function(i){return i.atanh()}})});var qa=F("trigUnit",["typed"],e=>{var{typed:r}=e;return{Unit:r.referToSelf(t=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return r.find(t,n.valueType())(n.value)})}});var _E="cos",JH=["typed"],$h=F(_E,JH,e=>{var{typed:r}=e,t=qa({typed:r});return r(_E,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},t)});var OE="cosh",KH=["typed"],Gh=F(OE,KH,e=>{var{typed:r}=e;return r(OE,{number:Em,"Complex | BigNumber":t=>t.cosh()})});var BE="cot",jH=["typed","BigNumber"],Vh=F(BE,jH,e=>{var{typed:r,BigNumber:t}=e,n=qa({typed:r});return r(BE,{number:rD,Complex:a=>a.cot(),BigNumber:a=>new t(1).div(a.tan())},n)});var PE="coth",e$=["typed","BigNumber"],Zh=F(PE,e$,e=>{var{typed:r,BigNumber:t}=e;return r(PE,{number:tD,Complex:n=>n.coth(),BigNumber:n=>new t(1).div(n.tanh())})});var IE="csc",r$=["typed","BigNumber"],Qh=F(IE,r$,e=>{var{typed:r,BigNumber:t}=e,n=qa({typed:r});return r(IE,{number:nD,Complex:a=>a.csc(),BigNumber:a=>new t(1).div(a.sin())},n)});var RE="csch",t$=["typed","BigNumber"],Xh=F(RE,t$,e=>{var{typed:r,BigNumber:t}=e;return r(RE,{number:aD,Complex:n=>n.csch(),BigNumber:n=>new t(1).div(n.sinh())})});var qE="sec",n$=["typed","BigNumber"],Jh=F(qE,n$,e=>{var{typed:r,BigNumber:t}=e,n=qa({typed:r});return r(qE,{number:iD,Complex:a=>a.sec(),BigNumber:a=>new t(1).div(a.cos())},n)});var kE="sech",a$=["typed","BigNumber"],Kh=F(kE,a$,e=>{var{typed:r,BigNumber:t}=e;return r(kE,{number:oD,Complex:n=>n.sech(),BigNumber:n=>new t(1).div(n.cosh())})});var LE="sin",i$=["typed"],jh=F(LE,i$,e=>{var{typed:r}=e,t=qa({typed:r});return r(LE,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},t)});var zE="sinh",o$=["typed"],ev=F(zE,o$,e=>{var{typed:r}=e;return r(zE,{number:sD,"Complex | BigNumber":t=>t.sinh()})});var UE="tan",s$=["typed"],rv=F(UE,s$,e=>{var{typed:r}=e,t=qa({typed:r});return r(UE,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},t)});var u$="tanh",f$=["typed"],tv=F(u$,f$,e=>{var{typed:r}=e;return r("tanh",{number:Tm,"Complex | BigNumber":t=>t.tanh()})});var WE="setCartesian",c$=["typed","size","subset","compareNatural","Index","DenseMatrix"],nv=F(WE,c$,e=>{var{typed:r,size:t,subset:n,compareNatural:a,Index:i,DenseMatrix:u}=e;return r(WE,{"Array | Matrix, Array | Matrix":function(c,o){var s=[];if(n(t(c),new i(0))!==0&&n(t(o),new i(0))!==0){var m=gr(Array.isArray(c)?c:c.toArray()).sort(a),d=gr(Array.isArray(o)?o:o.toArray()).sort(a);s=[];for(var h=0;h{var{typed:r,size:t,subset:n,compareNatural:a,Index:i,DenseMatrix:u}=e;return r(YE,{"Array | Matrix, Array | Matrix":function(c,o){var s;if(n(t(c),new i(0))===0)s=[];else{if(n(t(o),new i(0))===0)return gr(c.toArray());var m=Ki(gr(Array.isArray(c)?c:c.toArray()).sort(a)),d=Ki(gr(Array.isArray(o)?o:o.toArray()).sort(a));s=[];for(var h,y=0;y{var{typed:r,size:t,subset:n,compareNatural:a,Index:i,DenseMatrix:u}=e;return r(HE,{"Array | Matrix":function(c){var o;if(n(t(c),new i(0))===0)o=[];else{var s=gr(Array.isArray(c)?c:c.toArray()).sort(a);o=[],o.push(s[0]);for(var m=1;m{var{typed:r,size:t,subset:n,compareNatural:a,Index:i,DenseMatrix:u}=e;return r($E,{"Array | Matrix, Array | Matrix":function(c,o){var s;if(n(t(c),new i(0))===0||n(t(o),new i(0))===0)s=[];else{var m=Ki(gr(Array.isArray(c)?c:c.toArray()).sort(a)),d=Ki(gr(Array.isArray(o)?o:o.toArray()).sort(a));s=[];for(var h=0;h{var{typed:r,size:t,subset:n,compareNatural:a,Index:i}=e;return r(GE,{"Array | Matrix, Array | Matrix":function(l,c){if(n(t(l),new i(0))===0)return!0;if(n(t(c),new i(0))===0)return!1;for(var o=Ki(gr(Array.isArray(l)?l:l.toArray()).sort(a)),s=Ki(gr(Array.isArray(c)?c:c.toArray()).sort(a)),m,d=0;d{var{typed:r,size:t,subset:n,compareNatural:a,Index:i}=e;return r(VE,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(l,c){if(n(t(c),new i(0))===0)return 0;for(var o=gr(Array.isArray(c)?c:c.toArray()),s=0,m=0;m{var{typed:r,size:t,subset:n,compareNatural:a,Index:i}=e;return r(ZE,{"Array | Matrix":function(o){if(n(t(o),new i(0))===0)return[];for(var s=gr(Array.isArray(o)?o:o.toArray()).sort(a),m=[],d=0;d.toString(2).length<=s.length;)m.push(u(s,d.toString(2).split("").reverse())),d++;return l(m)}});function u(c,o){for(var s=[],m=0;m0;s--)for(var m=0;mc[m+1].length&&(o=c[m],c[m]=c[m+1],c[m+1]=o);return c}});var QE="setSize",g$=["typed","compareNatural"],cv=F(QE,g$,e=>{var{typed:r,compareNatural:t}=e;return r(QE,{"Array | Matrix":function(a){return Array.isArray(a)?gr(a).length:gr(a.toArray()).length},"Array | Matrix, boolean":function(a,i){if(i===!1||a.length===0)return Array.isArray(a)?gr(a).length:gr(a.toArray()).length;for(var u=gr(Array.isArray(a)?a:a.toArray()).sort(t),l=1,c=1;c{var{typed:r,size:t,concat:n,subset:a,setDifference:i,Index:u}=e;return r(XE,{"Array | Matrix, Array | Matrix":function(c,o){if(a(t(c),new u(0))===0)return gr(o);if(a(t(o),new u(0))===0)return gr(c);var s=gr(c),m=gr(o);return n(i(s,m),i(m,s))}})});var JE="setUnion",x$=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],mv=F(JE,x$,e=>{var{typed:r,size:t,concat:n,subset:a,setIntersect:i,setSymDifference:u,Index:l}=e;return r(JE,{"Array | Matrix, Array | Matrix":function(o,s){if(a(t(o),new l(0))===0)return gr(s);if(a(t(s),new l(0))===0)return gr(o);var m=gr(o),d=gr(s);return n(u(m,d),i(m,d))}})});var KE="add",b$=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],pv=F(KE,b$,e=>{var{typed:r,matrix:t,addScalar:n,equalScalar:a,DenseMatrix:i,SparseMatrix:u,concat:l}=e,c=Mn({typed:r}),o=Ru({typed:r,equalScalar:a}),s=ra({typed:r,DenseMatrix:i}),m=vr({typed:r,matrix:t,concat:l});return r(KE,{"any, any":n,"any, any, ...any":r.referToSelf(d=>(h,y,v)=>{for(var x=d(h,y),w=0;w{var{typed:r,abs:t,addScalar:n,divideScalar:a,multiplyScalar:i,sqrt:u,smaller:l,isPositive:c}=e;return r(jE,{"... number | BigNumber":o,Array:o,Matrix:s=>o(gr(s.toArray()))});function o(s){for(var m=0,d=0,h=0;h{var{typed:r,abs:t,add:n,pow:a,conj:i,sqrt:u,multiply:l,equalScalar:c,larger:o,smaller:s,matrix:m,ctranspose:d,eigs:h}=e;return r(eT,{number:Math.abs,Complex:function(_){return _.abs()},BigNumber:function(_){return _.abs()},boolean:function(_){return Math.abs(_)},Array:function(_){return S(m(_),2)},Matrix:function(_){return S(_,2)},"Array, number | BigNumber | string":function(_,E){return S(m(_),E)},"Matrix, number | BigNumber | string":function(_,E){return S(_,E)}});function y(O){var _=0;return O.forEach(function(E){var T=t(E);o(T,_)&&(_=T)},!0),_}function v(O){var _;return O.forEach(function(E){var T=t(E);(!_||s(T,_))&&(_=T)},!0),_||0}function x(O,_){if(_===Number.POSITIVE_INFINITY||_==="inf")return y(O);if(_===Number.NEGATIVE_INFINITY||_==="-inf")return v(O);if(_==="fro")return S(O,2);if(typeof _=="number"&&!isNaN(_)){if(!c(_,0)){var E=0;return O.forEach(function(T){E=n(a(t(T),_),E)},!0),a(E,1/_)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function w(O){var _=0;return O.forEach(function(E,T){_=n(_,l(E,i(E)))}),t(u(_))}function C(O){var _=[],E=0;return O.forEach(function(T,R){var k=R[1],W=n(_[k]||0,t(T));o(W,E)&&(E=W),_[k]=W},!0),E}function b(O){var _=O.size();if(_[0]!==_[1])throw new RangeError("Invalid matrix dimensions");var E=d(O),T=l(E,O),R=h(T).values.toArray(),k=R[R.length-1];return t(u(k))}function N(O){var _=[],E=0;return O.forEach(function(T,R){var k=R[0],W=n(_[k]||0,t(T));o(W,E)&&(E=W),_[k]=W},!0),E}function M(O,_){if(_===1)return C(O);if(_===Number.POSITIVE_INFINITY||_==="inf")return N(O);if(_==="fro")return w(O);if(_===2)return b(O);throw new Error("Unsupported parameter value "+_)}function S(O,_){var E=O.size();if(E.length===1)return x(O,_);if(E.length===2){if(E[0]&&E[1])return M(O,_);throw new RangeError("Invalid matrix dimensions")}}});var rT="dot",S$=["typed","addScalar","multiplyScalar","conj","size"],vv=F(rT,S$,e=>{var{typed:r,addScalar:t,multiplyScalar:n,conj:a,size:i}=e;return r(rT,{"Array | DenseMatrix, Array | DenseMatrix":l,"SparseMatrix, SparseMatrix":c});function u(s,m){var d=o(s),h=o(m),y,v;if(d.length===1)y=d[0];else if(d.length===2&&d[1]===1)y=d[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+d.join(", ")+")");if(h.length===1)v=h[0];else if(h.length===2&&h[1]===1)v=h[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+h.join(", ")+")");if(y!==v)throw new RangeError("Vectors must have equal length ("+y+" != "+v+")");if(y===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return y}function l(s,m){var d=u(s,m),h=Qe(s)?s._data:s,y=Qe(s)?s._datatype||s.getDataType():void 0,v=Qe(m)?m._data:m,x=Qe(m)?m._datatype||m.getDataType():void 0,w=o(s).length===2,C=o(m).length===2,b=t,N=n;if(y&&x&&y===x&&typeof y=="string"&&y!=="mixed"){var M=y;b=r.find(t,[M,M]),N=r.find(n,[M,M])}if(!w&&!C){for(var S=N(a(h[0]),v[0]),O=1;OS){N++;continue}M===S&&(x=w(x,C(h[b],v[N])),b++,N++)}return x}function o(s){return Qe(s)?s.size():i(s)}});var N$="trace",A$=["typed","matrix","add"],gv=F(N$,A$,e=>{var{typed:r,matrix:t,add:n}=e;return r("trace",{Array:function(l){return a(t(l))},SparseMatrix:i,DenseMatrix:a,any:ar});function a(u){var l=u._size,c=u._data;switch(l.length){case 1:if(l[0]===1)return ar(c[0]);throw new RangeError("Matrix must be square (size: "+lr(l)+")");case 2:{var o=l[0],s=l[1];if(o===s){for(var m=0,d=0;d0)for(var y=0;yy)break}return h}throw new RangeError("Matrix must be square (size: "+lr(s)+")")}});var tT="index",M$=["typed","Index"],yv=F(tT,M$,e=>{var{typed:r,Index:t}=e;return r(tT,{"...number | string | BigNumber | Range | Array | Matrix":function(a){var i=a.map(function(l){return rr(l)?l.toNumber():Mr(l)||Qe(l)?l.map(function(c){return rr(c)?c.toNumber():c}):l}),u=new t;return t.apply(u,i),u}})});var xv=new Set(["end"]);var C$="Node",E$=["mathWithTransform"],bv=F(C$,E$,e=>{var{mathWithTransform:r}=e;function t(a){for(var i of[...xv])if(a.has(i))throw new Error('Scope contains an illegal symbol, "'+i+'" is a reserved keyword')}class n{get type(){return"Node"}get isNode(){return!0}evaluate(i){return this.compile().evaluate(i)}compile(){var i=this._compile(r,{}),u={},l=null;function c(o){var s=ji(o);return t(s),i(s,u,l)}return{evaluate:c}}_compile(i,u){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(i){throw new Error("Cannot run forEach on a Node interface")}map(i){throw new Error("Cannot run map on a Node interface")}_ifNode(i){if(!Nr(i))throw new TypeError("Callback function must return a Node");return i}traverse(i){i(this,null,null);function u(l,c){l.forEach(function(o,s,m){c(o,s,m),u(o,c)})}u(this,i)}transform(i){function u(l,c,o){var s=i(l,c,o);return s!==l?s:l.map(u)}return u(this,null,null)}filter(i){var u=[];return this.traverse(function(l,c,o){i(l,c,o)&&u.push(l)}),u}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(i){return i.cloneDeep()})}equals(i){return i?this.type===i.type&&ni(this,i):!1}toString(i){var u=this._getCustomString(i);return typeof u<"u"?u:this._toString(i)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(i){var u=this._getCustomString(i);return typeof u<"u"?u:this._toHTML(i)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(i){var u=this._getCustomString(i);return typeof u<"u"?u:this._toTex(i)}_toTex(i){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(i){if(i&&typeof i=="object")switch(typeof i.handler){case"object":case"undefined":return;case"function":return i.handler(this,i);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return n},{isClass:!0,isNode:!0});function mt(e){return e&&e.isIndexError?new tn(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function wv(e){var{subset:r}=e;return function(n,a){try{if(Array.isArray(n))return r(n,a);if(n&&typeof n.subset=="function")return n.subset(a);if(typeof n=="string")return r(n,a);if(typeof n=="object"){if(!a.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return wt(n,a.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(i){throw mt(i)}}}var Dv="AccessorNode",T$=["subset","Node"],Sv=F(Dv,T$,e=>{var{subset:r,Node:t}=e,n=wv({subset:r});function a(u){return!(Ln(u)||jt(u)||xr(u)||yn(u)||Ei(u)||en(u)||at(u))}class i extends t{constructor(l,c){if(super(),!Nr(l))throw new TypeError('Node expected for parameter "object"');if(!Jn(c))throw new TypeError('IndexNode expected for parameter "index"');this.object=l,this.index=c}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Dv}get isAccessorNode(){return!0}_compile(l,c){var o=this.object._compile(l,c),s=this.index._compile(l,c);if(this.index.isObjectProperty()){var m=this.index.getObjectProperty();return function(h,y,v){return wt(o(h,y,v),m)}}else return function(h,y,v){var x=o(h,y,v),w=s(h,y,x);return n(x,w)}}forEach(l){l(this.object,"object",this),l(this.index,"index",this)}map(l){return new i(this._ifNode(l(this.object,"object",this)),this._ifNode(l(this.index,"index",this)))}clone(){return new i(this.object,this.index)}_toString(l){var c=this.object.toString(l);return a(this.object)&&(c="("+c+")"),c+this.index.toString(l)}_toHTML(l){var c=this.object.toHTML(l);return a(this.object)&&(c='('+c+')'),c+this.index.toHTML(l)}_toTex(l){var c=this.object.toTex(l);return a(this.object)&&(c="\\\\left(' + object + '\\\\right)"),c+this.index.toTex(l)}toJSON(){return{mathjs:Dv,object:this.object,index:this.index}}static fromJSON(l){return new i(l.object,l.index)}}return Hr(i,"name",Dv),i},{isClass:!0,isNode:!0});var Nv="ArrayNode",F$=["Node"],Av=F(Nv,F$,e=>{var{Node:r}=e;class t extends r{constructor(a){if(super(),this.items=a||[],!Array.isArray(this.items)||!this.items.every(Nr))throw new TypeError("Array containing Nodes expected")}get type(){return Nv}get isArrayNode(){return!0}_compile(a,i){var u=Kn(this.items,function(o){return o._compile(a,i)}),l=a.config.matrix!=="Array";if(l){var c=a.matrix;return function(s,m,d){return c(Kn(u,function(h){return h(s,m,d)}))}}else return function(s,m,d){return Kn(u,function(h){return h(s,m,d)})}}forEach(a){for(var i=0;i['+i.join(',')+']'}_toTex(a){function i(u,l){var c=u.some(jt)&&!u.every(jt),o=l||c,s=o?"&":"\\\\\\\\",m=u.map(function(d){return d.items?i(d.items,!l):d.toTex(a)}).join(s);return c||!o||o&&!l?"\\\\begin{bmatrix}"+m+"\\\\end{bmatrix}":m}return i(this.items,!1)}}return Hr(t,"name",Nv),t},{isClass:!0,isNode:!0});function nT(e){var{subset:r,matrix:t}=e;return function(a,i,u){try{if(Array.isArray(a)){var l=t(a).subset(i,u).valueOf();return l.forEach((c,o)=>{a[o]=c}),a}else{if(a&&typeof a.subset=="function")return a.subset(i,u);if(typeof a=="string")return r(a,i,u);if(typeof a=="object"){if(!i.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Ti(a,i.getObjectProperty(),u),a}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(c){throw mt(c)}}}var ka=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function Mv(e,r){if(!r||r!=="auto")return e;for(var t=e;en(t);)t=t.content;return t}function Qr(e,r,t,n){var a=e;r!=="keep"&&(a=e.getContent());for(var i=a.getIdentifier(),u=null,l=0;l{var{subset:r,matrix:t,Node:n}=e,a=wv({subset:r}),i=nT({subset:r,matrix:t});function u(c,o,s){o||(o="keep");var m=Qr(c,o,s),d=Qr(c.value,o,s);return o==="all"||d!==null&&d<=m}class l extends n{constructor(o,s,m){if(super(),this.object=o,this.index=m?s:null,this.value=m||s,!at(o)&&!Ln(o))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(at(o)&&o.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!Jn(this.index))throw new TypeError('IndexNode expected as "index"');if(!Nr(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Ev}get isAssignmentNode(){return!0}_compile(o,s){var m=this.object._compile(o,s),d=this.index?this.index._compile(o,s):null,h=this.value._compile(o,s),y=this.object.name;if(this.index)if(this.index.isObjectProperty()){var v=this.index.getObjectProperty();return function(N,M,S){var O=m(N,M,S),_=h(N,M,S);return Ti(O,v,_),_}}else{if(at(this.object))return function(N,M,S){var O=m(N,M,S),_=h(N,M,S),E=d(N,M,O);return N.set(y,i(O,E,_)),_};var x=this.object.object._compile(o,s);if(this.object.index.isObjectProperty()){var w=this.object.index.getObjectProperty();return function(N,M,S){var O=x(N,M,S),_=wt(O,w),E=d(N,M,_),T=h(N,M,S);return Ti(O,w,i(_,E,T)),T}}else{var C=this.object.index._compile(o,s);return function(N,M,S){var O=x(N,M,S),_=C(N,M,O),E=a(O,_),T=d(N,M,E),R=h(N,M,S);return i(O,_,i(E,T,R)),R}}}else{if(!at(this.object))throw new TypeError("SymbolNode expected as object");return function(N,M,S){var O=h(N,M,S);return N.set(y,O),O}}}forEach(o){o(this.object,"object",this),this.index&&o(this.index,"index",this),o(this.value,"value",this)}map(o){var s=this._ifNode(o(this.object,"object",this)),m=this.index?this._ifNode(o(this.index,"index",this)):null,d=this._ifNode(o(this.value,"value",this));return new l(s,m,d)}clone(){return new l(this.object,this.index,this.value)}_toString(o){var s=this.object.toString(o),m=this.index?this.index.toString(o):"",d=this.value.toString(o);return u(this,o&&o.parenthesis,o&&o.implicit)&&(d="("+d+")"),s+m+" = "+d}toJSON(){return{mathjs:Ev,object:this.object,index:this.index,value:this.value}}static fromJSON(o){return new l(o.object,o.index,o.value)}_toHTML(o){var s=this.object.toHTML(o),m=this.index?this.index.toHTML(o):"",d=this.value.toHTML(o);return u(this,o&&o.parenthesis,o&&o.implicit)&&(d='('+d+')'),s+m+'='+d}_toTex(o){var s=this.object.toTex(o),m=this.index?this.index.toTex(o):"",d=this.value.toTex(o);return u(this,o&&o.parenthesis,o&&o.implicit)&&(d="\\\\left(".concat(d,"\\\\right)")),s+m+"="+d}}return Hr(l,"name",Ev),l},{isClass:!0,isNode:!0});var Fv="BlockNode",O$=["ResultSet","Node"],_v=F(Fv,O$,e=>{var{ResultSet:r,Node:t}=e;class n extends t{constructor(i){if(super(),!Array.isArray(i))throw new Error("Array expected");this.blocks=i.map(function(u){var l=u&&u.node,c=u&&u.visible!==void 0?u.visible:!0;if(!Nr(l))throw new TypeError('Property "node" must be a Node');if(typeof c!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:l,visible:c}})}get type(){return Fv}get isBlockNode(){return!0}_compile(i,u){var l=Kn(this.blocks,function(c){return{evaluate:c.node._compile(i,u),visible:c.visible}});return function(o,s,m){var d=[];return _o(l,function(y){var v=y.evaluate(o,s,m);y.visible&&d.push(v)}),new r(d)}}forEach(i){for(var u=0;u;')}).join('
')}_toTex(i){return this.blocks.map(function(u){return u.node.toTex(i)+(u.visible?"":";")}).join(\`\\\\;\\\\; -\`)}}return Hr(n,"name",Fv),n},{isClass:!0,isNode:!0});var Ov="ConditionalNode",B$=["Node"],Bv=F(Ov,B$,e=>{var{Node:r}=e;function t(a){if(typeof a=="number"||typeof a=="boolean"||typeof a=="string")return!!a;if(a){if(rr(a))return!a.isZero();if(Kt(a))return!!(a.re||a.im);if(Ht(a))return!!a.value}if(a==null)return!1;throw new TypeError('Unsupported type of condition "'+Tr(a)+'"')}class n extends r{constructor(i,u,l){if(super(),!Nr(i))throw new TypeError("Parameter condition must be a Node");if(!Nr(u))throw new TypeError("Parameter trueExpr must be a Node");if(!Nr(l))throw new TypeError("Parameter falseExpr must be a Node");this.condition=i,this.trueExpr=u,this.falseExpr=l}get type(){return Ov}get isConditionalNode(){return!0}_compile(i,u){var l=this.condition._compile(i,u),c=this.trueExpr._compile(i,u),o=this.falseExpr._compile(i,u);return function(m,d,h){return t(l(m,d,h))?c(m,d,h):o(m,d,h)}}forEach(i){i(this.condition,"condition",this),i(this.trueExpr,"trueExpr",this),i(this.falseExpr,"falseExpr",this)}map(i){return new n(this._ifNode(i(this.condition,"condition",this)),this._ifNode(i(this.trueExpr,"trueExpr",this)),this._ifNode(i(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(i){var u=i&&i.parenthesis?i.parenthesis:"keep",l=Qr(this,u,i&&i.implicit),c=this.condition.toString(i),o=Qr(this.condition,u,i&&i.implicit);(u==="all"||this.condition.type==="OperatorNode"||o!==null&&o<=l)&&(c="("+c+")");var s=this.trueExpr.toString(i),m=Qr(this.trueExpr,u,i&&i.implicit);(u==="all"||this.trueExpr.type==="OperatorNode"||m!==null&&m<=l)&&(s="("+s+")");var d=this.falseExpr.toString(i),h=Qr(this.falseExpr,u,i&&i.implicit);return(u==="all"||this.falseExpr.type==="OperatorNode"||h!==null&&h<=l)&&(d="("+d+")"),c+" ? "+s+" : "+d}toJSON(){return{mathjs:Ov,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(i){return new n(i.condition,i.trueExpr,i.falseExpr)}_toHTML(i){var u=i&&i.parenthesis?i.parenthesis:"keep",l=Qr(this,u,i&&i.implicit),c=this.condition.toHTML(i),o=Qr(this.condition,u,i&&i.implicit);(u==="all"||this.condition.type==="OperatorNode"||o!==null&&o<=l)&&(c='('+c+')');var s=this.trueExpr.toHTML(i),m=Qr(this.trueExpr,u,i&&i.implicit);(u==="all"||this.trueExpr.type==="OperatorNode"||m!==null&&m<=l)&&(s='('+s+')');var d=this.falseExpr.toHTML(i),h=Qr(this.falseExpr,u,i&&i.implicit);return(u==="all"||this.falseExpr.type==="OperatorNode"||h!==null&&h<=l)&&(d='('+d+')'),c+'?'+s+':'+d}_toTex(i){return"\\\\begin{cases} {"+this.trueExpr.toTex(i)+"}, &\\\\quad{\\\\text{if }\\\\;"+this.condition.toTex(i)+"}\\\\\\\\{"+this.falseExpr.toTex(i)+"}, &\\\\quad{\\\\text{otherwise}}\\\\end{cases}"}}return Hr(n,"name",Ov),n},{isClass:!0,isNode:!0});var uT=ma(oT(),1);var xD={Alpha:"A",alpha:"\\\\alpha",Beta:"B",beta:"\\\\beta",Gamma:"\\\\Gamma",gamma:"\\\\gamma",Delta:"\\\\Delta",delta:"\\\\delta",Epsilon:"E",epsilon:"\\\\epsilon",varepsilon:"\\\\varepsilon",Zeta:"Z",zeta:"\\\\zeta",Eta:"H",eta:"\\\\eta",Theta:"\\\\Theta",theta:"\\\\theta",vartheta:"\\\\vartheta",Iota:"I",iota:"\\\\iota",Kappa:"K",kappa:"\\\\kappa",varkappa:"\\\\varkappa",Lambda:"\\\\Lambda",lambda:"\\\\lambda",Mu:"M",mu:"\\\\mu",Nu:"N",nu:"\\\\nu",Xi:"\\\\Xi",xi:"\\\\xi",Omicron:"O",omicron:"o",Pi:"\\\\Pi",pi:"\\\\pi",varpi:"\\\\varpi",Rho:"P",rho:"\\\\rho",varrho:"\\\\varrho",Sigma:"\\\\Sigma",sigma:"\\\\sigma",varsigma:"\\\\varsigma",Tau:"T",tau:"\\\\tau",Upsilon:"\\\\Upsilon",upsilon:"\\\\upsilon",Phi:"\\\\Phi",phi:"\\\\phi",varphi:"\\\\varphi",Chi:"X",chi:"\\\\chi",Psi:"\\\\Psi",psi:"\\\\psi",Omega:"\\\\Omega",omega:"\\\\omega",true:"\\\\mathrm{True}",false:"\\\\mathrm{False}",i:"i",inf:"\\\\infty",Inf:"\\\\infty",infinity:"\\\\infty",Infinity:"\\\\infty",oo:"\\\\infty",lim:"\\\\lim",undefined:"\\\\mathbf{?}"},$r={transpose:"^\\\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\\\~",not:"\\\\neg",multiply:"\\\\cdot",divide:"\\\\frac",dotMultiply:".\\\\cdot",dotDivide:".:",mod:"\\\\mod",add:"+",subtract:"-",to:"\\\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\\\neq",smaller:"<",larger:">",smallerEq:"\\\\leq",largerEq:"\\\\geq",bitAnd:"\\\\&",bitXor:"\\\\underline{|}",bitOr:"|",and:"\\\\wedge",xor:"\\\\veebar",or:"\\\\vee"},bD={abs:{1:"\\\\left|\${args[0]}\\\\right|"},add:{2:"\\\\left(\${args[0]}".concat($r.add,"\${args[1]}\\\\right)")},cbrt:{1:"\\\\sqrt[3]{\${args[0]}}"},ceil:{1:"\\\\left\\\\lceil\${args[0]}\\\\right\\\\rceil"},cube:{1:"\\\\left(\${args[0]}\\\\right)^3"},divide:{2:"\\\\frac{\${args[0]}}{\${args[1]}}"},dotDivide:{2:"\\\\left(\${args[0]}".concat($r.dotDivide,"\${args[1]}\\\\right)")},dotMultiply:{2:"\\\\left(\${args[0]}".concat($r.dotMultiply,"\${args[1]}\\\\right)")},dotPow:{2:"\\\\left(\${args[0]}".concat($r.dotPow,"\${args[1]}\\\\right)")},exp:{1:"\\\\exp\\\\left(\${args[0]}\\\\right)"},expm1:"\\\\left(e".concat($r.pow,"{\${args[0]}}-1\\\\right)"),fix:{1:"\\\\mathrm{\${name}}\\\\left(\${args[0]}\\\\right)"},floor:{1:"\\\\left\\\\lfloor\${args[0]}\\\\right\\\\rfloor"},gcd:"\\\\gcd\\\\left(\${args}\\\\right)",hypot:"\\\\hypot\\\\left(\${args}\\\\right)",log:{1:"\\\\ln\\\\left(\${args[0]}\\\\right)",2:"\\\\log_{\${args[1]}}\\\\left(\${args[0]}\\\\right)"},log10:{1:"\\\\log_{10}\\\\left(\${args[0]}\\\\right)"},log1p:{1:"\\\\ln\\\\left(\${args[0]}+1\\\\right)",2:"\\\\log_{\${args[1]}}\\\\left(\${args[0]}+1\\\\right)"},log2:"\\\\log_{2}\\\\left(\${args[0]}\\\\right)",mod:{2:"\\\\left(\${args[0]}".concat($r.mod,"\${args[1]}\\\\right)")},multiply:{2:"\\\\left(\${args[0]}".concat($r.multiply,"\${args[1]}\\\\right)")},norm:{1:"\\\\left\\\\|\${args[0]}\\\\right\\\\|",2:void 0},nthRoot:{2:"\\\\sqrt[\${args[1]}]{\${args[0]}}"},nthRoots:{2:"\\\\{y : $y^{args[1]} = {\${args[0]}}\\\\}"},pow:{2:"\\\\left(\${args[0]}\\\\right)".concat($r.pow,"{\${args[1]}}")},round:{1:"\\\\left\\\\lfloor\${args[0]}\\\\right\\\\rceil",2:void 0},sign:{1:"\\\\mathrm{\${name}}\\\\left(\${args[0]}\\\\right)"},sqrt:{1:"\\\\sqrt{\${args[0]}}"},square:{1:"\\\\left(\${args[0]}\\\\right)^2"},subtract:{2:"\\\\left(\${args[0]}".concat($r.subtract,"\${args[1]}\\\\right)")},unaryMinus:{1:"".concat($r.unaryMinus,"\\\\left(\${args[0]}\\\\right)")},unaryPlus:{1:"".concat($r.unaryPlus,"\\\\left(\${args[0]}\\\\right)")},bitAnd:{2:"\\\\left(\${args[0]}".concat($r.bitAnd,"\${args[1]}\\\\right)")},bitNot:{1:$r.bitNot+"\\\\left(\${args[0]}\\\\right)"},bitOr:{2:"\\\\left(\${args[0]}".concat($r.bitOr,"\${args[1]}\\\\right)")},bitXor:{2:"\\\\left(\${args[0]}".concat($r.bitXor,"\${args[1]}\\\\right)")},leftShift:{2:"\\\\left(\${args[0]}".concat($r.leftShift,"\${args[1]}\\\\right)")},rightArithShift:{2:"\\\\left(\${args[0]}".concat($r.rightArithShift,"\${args[1]}\\\\right)")},rightLogShift:{2:"\\\\left(\${args[0]}".concat($r.rightLogShift,"\${args[1]}\\\\right)")},bellNumbers:{1:"\\\\mathrm{B}_{\${args[0]}}"},catalan:{1:"\\\\mathrm{C}_{\${args[0]}}"},stirlingS2:{2:"\\\\mathrm{S}\\\\left(\${args}\\\\right)"},arg:{1:"\\\\arg\\\\left(\${args[0]}\\\\right)"},conj:{1:"\\\\left(\${args[0]}\\\\right)^*"},im:{1:"\\\\Im\\\\left\\\\lbrace\${args[0]}\\\\right\\\\rbrace"},re:{1:"\\\\Re\\\\left\\\\lbrace\${args[0]}\\\\right\\\\rbrace"},and:{2:"\\\\left(\${args[0]}".concat($r.and,"\${args[1]}\\\\right)")},not:{1:$r.not+"\\\\left(\${args[0]}\\\\right)"},or:{2:"\\\\left(\${args[0]}".concat($r.or,"\${args[1]}\\\\right)")},xor:{2:"\\\\left(\${args[0]}".concat($r.xor,"\${args[1]}\\\\right)")},cross:{2:"\\\\left(\${args[0]}\\\\right)\\\\times\\\\left(\${args[1]}\\\\right)"},ctranspose:{1:"\\\\left(\${args[0]}\\\\right)".concat($r.ctranspose)},det:{1:"\\\\det\\\\left(\${args[0]}\\\\right)"},dot:{2:"\\\\left(\${args[0]}\\\\cdot\${args[1]}\\\\right)"},expm:{1:"\\\\exp\\\\left(\${args[0]}\\\\right)"},inv:{1:"\\\\left(\${args[0]}\\\\right)^{-1}"},pinv:{1:"\\\\left(\${args[0]}\\\\right)^{+}"},sqrtm:{1:"{\${args[0]}}".concat($r.pow,"{\\\\frac{1}{2}}")},trace:{1:"\\\\mathrm{tr}\\\\left(\${args[0]}\\\\right)"},transpose:{1:"\\\\left(\${args[0]}\\\\right)".concat($r.transpose)},combinations:{2:"\\\\binom{\${args[0]}}{\${args[1]}}"},combinationsWithRep:{2:"\\\\left(\\\\!\\\\!{\\\\binom{\${args[0]}}{\${args[1]}}}\\\\!\\\\!\\\\right)"},factorial:{1:"\\\\left(\${args[0]}\\\\right)".concat($r.factorial)},gamma:{1:"\\\\Gamma\\\\left(\${args[0]}\\\\right)"},lgamma:{1:"\\\\ln\\\\Gamma\\\\left(\${args[0]}\\\\right)"},equal:{2:"\\\\left(\${args[0]}".concat($r.equal,"\${args[1]}\\\\right)")},larger:{2:"\\\\left(\${args[0]}".concat($r.larger,"\${args[1]}\\\\right)")},largerEq:{2:"\\\\left(\${args[0]}".concat($r.largerEq,"\${args[1]}\\\\right)")},smaller:{2:"\\\\left(\${args[0]}".concat($r.smaller,"\${args[1]}\\\\right)")},smallerEq:{2:"\\\\left(\${args[0]}".concat($r.smallerEq,"\${args[1]}\\\\right)")},unequal:{2:"\\\\left(\${args[0]}".concat($r.unequal,"\${args[1]}\\\\right)")},erf:{1:"erf\\\\left(\${args[0]}\\\\right)"},max:"\\\\max\\\\left(\${args}\\\\right)",min:"\\\\min\\\\left(\${args}\\\\right)",variance:"\\\\mathrm{Var}\\\\left(\${args}\\\\right)",acos:{1:"\\\\cos^{-1}\\\\left(\${args[0]}\\\\right)"},acosh:{1:"\\\\cosh^{-1}\\\\left(\${args[0]}\\\\right)"},acot:{1:"\\\\cot^{-1}\\\\left(\${args[0]}\\\\right)"},acoth:{1:"\\\\coth^{-1}\\\\left(\${args[0]}\\\\right)"},acsc:{1:"\\\\csc^{-1}\\\\left(\${args[0]}\\\\right)"},acsch:{1:"\\\\mathrm{csch}^{-1}\\\\left(\${args[0]}\\\\right)"},asec:{1:"\\\\sec^{-1}\\\\left(\${args[0]}\\\\right)"},asech:{1:"\\\\mathrm{sech}^{-1}\\\\left(\${args[0]}\\\\right)"},asin:{1:"\\\\sin^{-1}\\\\left(\${args[0]}\\\\right)"},asinh:{1:"\\\\sinh^{-1}\\\\left(\${args[0]}\\\\right)"},atan:{1:"\\\\tan^{-1}\\\\left(\${args[0]}\\\\right)"},atan2:{2:"\\\\mathrm{atan2}\\\\left(\${args}\\\\right)"},atanh:{1:"\\\\tanh^{-1}\\\\left(\${args[0]}\\\\right)"},cos:{1:"\\\\cos\\\\left(\${args[0]}\\\\right)"},cosh:{1:"\\\\cosh\\\\left(\${args[0]}\\\\right)"},cot:{1:"\\\\cot\\\\left(\${args[0]}\\\\right)"},coth:{1:"\\\\coth\\\\left(\${args[0]}\\\\right)"},csc:{1:"\\\\csc\\\\left(\${args[0]}\\\\right)"},csch:{1:"\\\\mathrm{csch}\\\\left(\${args[0]}\\\\right)"},sec:{1:"\\\\sec\\\\left(\${args[0]}\\\\right)"},sech:{1:"\\\\mathrm{sech}\\\\left(\${args[0]}\\\\right)"},sin:{1:"\\\\sin\\\\left(\${args[0]}\\\\right)"},sinh:{1:"\\\\sinh\\\\left(\${args[0]}\\\\right)"},tan:{1:"\\\\tan\\\\left(\${args[0]}\\\\right)"},tanh:{1:"\\\\tanh\\\\left(\${args[0]}\\\\right)"},to:{2:"\\\\left(\${args[0]}".concat($r.to,"\${args[1]}\\\\right)")},numeric:function(r,t){return r.args[0].toTex()},number:{0:"0",1:"\\\\left(\${args[0]}\\\\right)",2:"\\\\left(\\\\left(\${args[0]}\\\\right)\${args[1]}\\\\right)"},string:{0:'\\\\mathtt{""}',1:"\\\\mathrm{string}\\\\left(\${args[0]}\\\\right)"},bignumber:{0:"0",1:"\\\\left(\${args[0]}\\\\right)"},complex:{0:"0",1:"\\\\left(\${args[0]}\\\\right)",2:"\\\\left(\\\\left(\${args[0]}\\\\right)+".concat(xD.i,"\\\\cdot\\\\left(\${args[1]}\\\\right)\\\\right)")},matrix:{0:"\\\\begin{bmatrix}\\\\end{bmatrix}",1:"\\\\left(\${args[0]}\\\\right)",2:"\\\\left(\${args[0]}\\\\right)"},sparse:{0:"\\\\begin{bsparse}\\\\end{bsparse}",1:"\\\\left(\${args[0]}\\\\right)"},unit:{1:"\\\\left(\${args[0]}\\\\right)",2:"\\\\left(\\\\left(\${args[0]}\\\\right)\${args[1]}\\\\right)"}},fT="\\\\mathrm{\${name}}\\\\left(\${args}\\\\right)",sT={deg:"^\\\\circ"};function Pv(e){return(0,uT.default)(e,{preserveFormatting:!0})}function Iv(e,r){return r=typeof r>"u"?!1:r,r?Xe(sT,e)?sT[e]:"\\\\mathrm{"+Pv(e)+"}":Xe(xD,e)?xD[e]:Pv(e)}var Rv="ConstantNode",q$=["Node"],qv=F(Rv,q$,e=>{var{Node:r}=e;class t extends r{constructor(a){super(),this.value=a}get type(){return Rv}get isConstantNode(){return!0}_compile(a,i){var u=this.value;return function(){return u}}forEach(a){}map(a){return this.clone()}clone(){return new t(this.value)}_toString(a){return lr(this.value,a)}_toHTML(a){var i=this._toString(a);switch(Tr(this.value)){case"number":case"BigNumber":case"Fraction":return''+i+"";case"string":return''+i+"";case"boolean":return''+i+"";case"null":return''+i+"";case"undefined":return''+i+"";default:return''+i+""}}toJSON(){return{mathjs:Rv,value:this.value}}static fromJSON(a){return new t(a.value)}_toTex(a){var i=this._toString(a),u=Tr(this.value);switch(u){case"string":return"\\\\mathtt{"+Pv(i)+"}";case"number":case"BigNumber":{var l=u==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!l)return this.value.valueOf()<0?"-\\\\infty":"\\\\infty";var c=i.toLowerCase().indexOf("e");return c!==-1?i.substring(0,c)+"\\\\cdot10^{"+i.substring(c+1)+"}":i}case"Fraction":return this.value.toLatex();default:return i}}}return Hr(t,"name",Rv),t},{isClass:!0,isNode:!0});var kv="FunctionAssignmentNode",k$=["typed","Node"],Lv=F(kv,k$,e=>{var{typed:r,Node:t}=e;function n(i,u,l){var c=Qr(i,u,l),o=Qr(i.expr,u,l);return u==="all"||o!==null&&o<=c}class a extends t{constructor(u,l,c){if(super(),typeof u!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(l))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!Nr(c))throw new TypeError('Node expected for parameter "expr"');if(xv.has(u))throw new Error('Illegal function name, "'+u+'" is a reserved keyword');var o=new Set;for(var s of l){var m=typeof s=="string"?s:s.name;if(o.has(m))throw new Error('Duplicate parameter name "'.concat(m,'"'));o.add(m)}this.name=u,this.params=l.map(function(d){return d&&d.name||d}),this.types=l.map(function(d){return d&&d.type||"any"}),this.expr=c}get type(){return kv}get isFunctionAssignmentNode(){return!0}_compile(u,l){var c=Object.create(l);_o(this.params,function(y){c[y]=!0});var o=this.expr._compile(u,c),s=this.name,m=this.params,d=Jb(this.types,","),h=s+"("+Jb(this.params,", ")+")";return function(v,x,w){var C={};C[d]=function(){for(var N=Object.create(x),M=0;M'+rn(this.params[o])+"");var s=this.expr.toHTML(u);return n(this,l,u&&u.implicit)&&(s='('+s+')'),''+rn(this.name)+'('+c.join(',')+')='+s}_toTex(u){var l=u&&u.parenthesis?u.parenthesis:"keep",c=this.expr.toTex(u);return n(this,l,u&&u.implicit)&&(c="\\\\left(".concat(c,"\\\\right)")),"\\\\mathrm{"+this.name+"}\\\\left("+this.params.map(Iv).join(",")+"\\\\right)="+c}}return Hr(a,"name",kv),a},{isClass:!0,isNode:!0});var zv="IndexNode",L$=["Node","size"],Uv=F(zv,L$,e=>{var{Node:r,size:t}=e;class n extends r{constructor(i,u){if(super(),this.dimensions=i,this.dotNotation=u||!1,!Array.isArray(i)||!i.every(Nr))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return zv}get isIndexNode(){return!0}_compile(i,u){var l=Kn(this.dimensions,function(o,s){var m=o.filter(y=>y.isSymbolNode&&y.name==="end").length>0;if(m){var d=Object.create(u);d.end=!0;var h=o._compile(i,d);return function(v,x,w){if(!Qe(w)&&!Mr(w)&&!St(w))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Tr(w));var C=t(w).valueOf(),b=Object.create(x);return b.end=C[s],h(v,b,w)}}else return o._compile(i,u)}),c=wt(i,"index");return function(s,m,d){var h=Kn(l,function(y){return y(s,m,d)});return c(...h)}}forEach(i){for(var u=0;u.'+rn(this.getObjectProperty())+"":'['+u.join(',')+']'}_toTex(i){var u=this.dimensions.map(function(l){return l.toTex(i)});return this.dotNotation?"."+this.getObjectProperty():"_{"+u.join(",")+"}"}}return Hr(n,"name",zv),n},{isClass:!0,isNode:!0});var Wv="ObjectNode",z$=["Node"],Yv=F(Wv,z$,e=>{var{Node:r}=e;class t extends r{constructor(a){if(super(),this.properties=a||{},a&&(typeof a!="object"||!Object.keys(a).every(function(i){return Nr(a[i])})))throw new TypeError("Object containing Nodes expected")}get type(){return Wv}get isObjectNode(){return!0}_compile(a,i){var u={};for(var l in this.properties)if(Xe(this.properties,l)){var c=Ns(l),o=JSON.parse(c),s=wt(this.properties,l);u[o]=s._compile(a,i)}return function(d,h,y){var v={};for(var x in u)Xe(u,x)&&(v[x]=u[x](d,h,y));return v}}forEach(a){for(var i in this.properties)Xe(this.properties,i)&&a(this.properties[i],"properties["+Ns(i)+"]",this)}map(a){var i={};for(var u in this.properties)Xe(this.properties,u)&&(i[u]=this._ifNode(a(this.properties[u],"properties["+Ns(u)+"]",this)));return new t(i)}clone(){var a={};for(var i in this.properties)Xe(this.properties,i)&&(a[i]=this.properties[i]);return new t(a)}_toString(a){var i=[];for(var u in this.properties)Xe(this.properties,u)&&i.push(Ns(u)+": "+this.properties[u].toString(a));return"{"+i.join(", ")+"}"}toJSON(){return{mathjs:Wv,properties:this.properties}}static fromJSON(a){return new t(a.properties)}_toHTML(a){var i=[];for(var u in this.properties)Xe(this.properties,u)&&i.push(''+rn(u)+':'+this.properties[u].toHTML(a));return'{'+i.join(',')+'}'}_toTex(a){var i=[];for(var u in this.properties)Xe(this.properties,u)&&i.push("\\\\mathbf{"+u+":} & "+this.properties[u].toTex(a)+"\\\\\\\\");var l="\\\\left\\\\{\\\\begin{array}{ll}"+i.join(\` -\`)+"\\\\end{array}\\\\right\\\\}";return l}}return Hr(t,"name",Wv),t},{isClass:!0,isNode:!0});function Os(e,r){return new Eu(e,new Cs(r),new Set(Object.keys(r)))}var Hv="OperatorNode",U$=["Node"],$v=F(Hv,U$,e=>{var{Node:r}=e;function t(i,u){var l=i;if(u==="auto")for(;en(l);)l=l.content;return xr(l)?!0:ct(l)?t(l.args[0],u):!1}function n(i,u,l,c,o){var s=Qr(i,u,l),m=tf(i,u);if(u==="all"||c.length>2&&i.getIdentifier()!=="OperatorNode:add"&&i.getIdentifier()!=="OperatorNode:multiply")return c.map(function(T){switch(T.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var d;switch(c.length){case 0:d=[];break;case 1:{var h=Qr(c[0],u,l,i);if(o&&h!==null){var y,v;if(u==="keep"?(y=c[0].getIdentifier(),v=i.getIdentifier()):(y=c[0].getContent().getIdentifier(),v=i.getContent().getIdentifier()),ka[s][v].latexLeftParens===!1){d=[!1];break}if(ka[h][y].latexParens===!1){d=[!1];break}}if(h===null){d=[!1];break}if(h<=s){d=[!0];break}d=[!1]}break;case 2:{var x,w=Qr(c[0],u,l,i),C=Cv(i,c[0],u);w===null?x=!1:w===s&&m==="right"&&!C||w=2&&i.getIdentifier()==="OperatorNode:multiply"&&i.implicit&&u!=="all"&&l==="hide")for(var E=1;E2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var x=o.map(function(w,C){return w=w.toString(u),s[C]&&(w="("+w+")"),w});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?x.join(" "):x.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Hv,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(u){return new a(u.op,u.fn,u.args,u.implicit,u.isPercentage)}_toHTML(u){var l=u&&u.parenthesis?u.parenthesis:"keep",c=u&&u.implicit?u.implicit:"hide",o=this.args,s=n(this,l,c,o,!1);if(o.length===1){var m=tf(this,l),d=o[0].toHTML(u);return s[0]&&(d='('+d+')'),m==="right"?''+rn(this.op)+""+d:d+''+rn(this.op)+""}else if(o.length===2){var h=o[0].toHTML(u),y=o[1].toHTML(u);return s[0]&&(h='('+h+')'),s[1]&&(y='('+y+')'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?h+''+y:h+''+rn(this.op)+""+y}else{var v=o.map(function(x,w){return x=x.toHTML(u),s[w]&&(x='('+x+')'),x});return o.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?v.join(''):v.join(''+rn(this.op)+""):''+rn(this.fn)+'('+v.join(',')+')'}}_toTex(u){var l=u&&u.parenthesis?u.parenthesis:"keep",c=u&&u.implicit?u.implicit:"hide",o=this.args,s=n(this,l,c,o,!0),m=$r[this.fn];if(m=typeof m>"u"?this.op:m,o.length===1){var d=tf(this,l),h=o[0].toTex(u);return s[0]&&(h="\\\\left(".concat(h,"\\\\right)")),d==="right"?m+h:h+m}else if(o.length===2){var y=o[0],v=y.toTex(u);s[0]&&(v="\\\\left(".concat(v,"\\\\right)"));var x=o[1],w=x.toTex(u);s[1]&&(w="\\\\left(".concat(w,"\\\\right)"));var C;switch(l==="keep"?C=y.getIdentifier():C=y.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return m+"{"+v+"}{"+w+"}";case"OperatorNode:pow":switch(v="{"+v+"}",w="{"+w+"}",C){case"ConditionalNode":case"OperatorNode:divide":v="\\\\left(".concat(v,"\\\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&c==="hide")return v+"~"+w}return v+m+w}else if(o.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var b=o.map(function(N,M){return N=N.toTex(u),s[M]&&(N="\\\\left(".concat(N,"\\\\right)")),N});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&c==="hide"?b.join("~"):b.join(m)}else return"\\\\mathrm{"+this.fn+"}\\\\left("+o.map(function(N){return N.toTex(u)}).join(",")+"\\\\right)"}getIdentifier(){return this.type+":"+this.fn}}return Hr(a,"name",Hv),a},{isClass:!0,isNode:!0});var Gv="ParenthesisNode",W$=["Node"],Vv=F(Gv,W$,e=>{var{Node:r}=e;class t extends r{constructor(a){if(super(),!Nr(a))throw new TypeError('Node expected for parameter "content"');this.content=a}get type(){return Gv}get isParenthesisNode(){return!0}_compile(a,i){return this.content._compile(a,i)}getContent(){return this.content.getContent()}forEach(a){a(this.content,"content",this)}map(a){var i=a(this.content,"content",this);return new t(i)}clone(){return new t(this.content)}_toString(a){return!a||a&&!a.parenthesis||a&&a.parenthesis==="keep"?"("+this.content.toString(a)+")":this.content.toString(a)}toJSON(){return{mathjs:Gv,content:this.content}}static fromJSON(a){return new t(a.content)}_toHTML(a){return!a||a&&!a.parenthesis||a&&a.parenthesis==="keep"?'('+this.content.toHTML(a)+')':this.content.toHTML(a)}_toTex(a){return!a||a&&!a.parenthesis||a&&a.parenthesis==="keep"?"\\\\left(".concat(this.content.toTex(a),"\\\\right)"):this.content.toTex(a)}}return Hr(t,"name",Gv),t},{isClass:!0,isNode:!0});var Zv="RangeNode",Y$=["Node"],Qv=F(Zv,Y$,e=>{var{Node:r}=e;function t(a,i,u){var l=Qr(a,i,u),c={},o=Qr(a.start,i,u);if(c.start=o!==null&&o<=l||i==="all",a.step){var s=Qr(a.step,i,u);c.step=s!==null&&s<=l||i==="all"}var m=Qr(a.end,i,u);return c.end=m!==null&&m<=l||i==="all",c}class n extends r{constructor(i,u,l){if(super(),!Nr(i))throw new TypeError("Node expected");if(!Nr(u))throw new TypeError("Node expected");if(l&&!Nr(l))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=i,this.end=u,this.step=l||null}get type(){return Zv}get isRangeNode(){return!0}needsEnd(){var i=this.filter(function(u){return at(u)&&u.name==="end"});return i.length>0}_compile(i,u){var l=i.range,c=this.start._compile(i,u),o=this.end._compile(i,u);if(this.step){var s=this.step._compile(i,u);return function(d,h,y){return l(c(d,h,y),o(d,h,y),s(d,h,y))}}else return function(d,h,y){return l(c(d,h,y),o(d,h,y))}}forEach(i){i(this.start,"start",this),i(this.end,"end",this),this.step&&i(this.step,"step",this)}map(i){return new n(this._ifNode(i(this.start,"start",this)),this._ifNode(i(this.end,"end",this)),this.step&&this._ifNode(i(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(i){var u=i&&i.parenthesis?i.parenthesis:"keep",l=t(this,u,i&&i.implicit),c,o=this.start.toString(i);if(l.start&&(o="("+o+")"),c=o,this.step){var s=this.step.toString(i);l.step&&(s="("+s+")"),c+=":"+s}var m=this.end.toString(i);return l.end&&(m="("+m+")"),c+=":"+m,c}toJSON(){return{mathjs:Zv,start:this.start,end:this.end,step:this.step}}static fromJSON(i){return new n(i.start,i.end,i.step)}_toHTML(i){var u=i&&i.parenthesis?i.parenthesis:"keep",l=t(this,u,i&&i.implicit),c,o=this.start.toHTML(i);if(l.start&&(o='('+o+')'),c=o,this.step){var s=this.step.toHTML(i);l.step&&(s='('+s+')'),c+=':'+s}var m=this.end.toHTML(i);return l.end&&(m='('+m+')'),c+=':'+m,c}_toTex(i){var u=i&&i.parenthesis?i.parenthesis:"keep",l=t(this,u,i&&i.implicit),c=this.start.toTex(i);if(l.start&&(c="\\\\left(".concat(c,"\\\\right)")),this.step){var o=this.step.toTex(i);l.step&&(o="\\\\left(".concat(o,"\\\\right)")),c+=":"+o}var s=this.end.toTex(i);return l.end&&(s="\\\\left(".concat(s,"\\\\right)")),c+=":"+s,c}}return Hr(n,"name",Zv),n},{isClass:!0,isNode:!0});var Xv="RelationalNode",H$=["Node"],Jv=F(Xv,H$,e=>{var{Node:r}=e,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends r{constructor(i,u){if(super(),!Array.isArray(i))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(u))throw new TypeError("Parameter params must be an array");if(i.length!==u.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=i,this.params=u}get type(){return Xv}get isRelationalNode(){return!0}_compile(i,u){var l=this,c=this.params.map(o=>o._compile(i,u));return function(s,m,d){for(var h,y=c[0](s,m,d),v=0;vi(u,"params["+l+"]",this),this)}map(i){return new n(this.conditionals.slice(),this.params.map((u,l)=>this._ifNode(i(u,"params["+l+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(i){for(var u=i&&i.parenthesis?i.parenthesis:"keep",l=Qr(this,u,i&&i.implicit),c=this.params.map(function(m,d){var h=Qr(m,u,i&&i.implicit);return u==="all"||h!==null&&h<=l?"("+m.toString(i)+")":m.toString(i)}),o=c[0],s=0;s('+m.toHTML(i)+')':m.toHTML(i)}),o=c[0],s=0;s'+rn(t[this.conditionals[s]])+""+c[s+1];return o}_toTex(i){for(var u=i&&i.parenthesis?i.parenthesis:"keep",l=Qr(this,u,i&&i.implicit),c=this.params.map(function(m,d){var h=Qr(m,u,i&&i.implicit);return u==="all"||h!==null&&h<=l?"\\\\left("+m.toTex(i)+"\\right)":m.toTex(i)}),o=c[0],s=0;s{var{math:r,Unit:t,Node:n}=e;function a(u){return t?t.isValuelessUnit(u):!1}class i extends n{constructor(l){if(super(),typeof l!="string")throw new TypeError('String expected for parameter "name"');this.name=l}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(l,c){var o=this.name;if(c[o]===!0)return function(m,d,h){return wt(d,o)};if(o in l)return function(m,d,h){return m.has(o)?m.get(o):wt(l,o)};var s=a(o);return function(m,d,h){return m.has(o)?m.get(o):s?new t(null,o):i.onUndefinedSymbol(o)}}forEach(l){}map(l){return this.clone()}static onUndefinedSymbol(l){throw new Error("Undefined symbol "+l)}clone(){return new i(this.name)}_toString(l){return this.name}_toHTML(l){var c=rn(this.name);return c==="true"||c==="false"?''+c+"":c==="i"?''+c+"":c==="Infinity"?''+c+"":c==="NaN"?''+c+"":c==="null"?''+c+"":c==="undefined"?''+c+"":''+c+""}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(l){return new i(l.name)}_toTex(l){var c=!1;typeof r[this.name]>"u"&&a(this.name)&&(c=!0);var o=Iv(this.name,c);return o[0]==="\\\\"?o:" "+o}}return i},{isClass:!0,isNode:!0});var jv="FunctionNode",V$=["math","Node","SymbolNode"],eg=F(jv,V$,e=>{var r,{math:t,Node:n,SymbolNode:a}=e,i=c=>lr(c,{truncate:78});function u(c,o,s){for(var m="",d=/\\$(?:\\{([a-z_][a-z_0-9]*)(?:\\[([0-9]+)\\])?\\}|\\$)/gi,h=0,y;(y=d.exec(c))!==null;)if(m+=c.substring(h,y.index),h=y.index,y[0]==="$$")m+="$",h++;else{h+=y[0].length;var v=o[y[1]];if(!v)throw new ReferenceError("Template: Property "+y[1]+" does not exist.");if(y[2]===void 0)switch(typeof v){case"string":m+=v;break;case"object":if(Nr(v))m+=v.toTex(s);else if(Array.isArray(v))m+=v.map(function(x,w){if(Nr(x))return x.toTex(s);throw new TypeError("Template: "+y[1]+"["+w+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+y[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+y[1]+" has to be a Node, String or array of Nodes")}else if(Nr(v[y[2]]&&v[y[2]]))m+=v[y[2]].toTex(s);else throw new TypeError("Template: "+y[1]+"["+y[2]+"] is not a Node.")}return m+=c.slice(h),m}class l extends n{constructor(o,s){if(super(),typeof o=="string"&&(o=new a(o)),!Nr(o))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(s)||!s.every(Nr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=o,this.args=s||[]}get name(){return this.fn.name||""}get type(){return jv}get isFunctionNode(){return!0}_compile(o,s){var m=this.args.map(_=>_._compile(o,s));if(at(this.fn)){var d=this.fn.name;if(s[d]){var w=this.args;return function(E,T,R){var k=wt(T,d);if(typeof k!="function")throw new TypeError("Argument '".concat(d,"' was not a function; received: ").concat(i(k)));if(k.rawArgs)return k(w,o,Os(E,T));var W=m.map(G=>G(E,T,R));return k.apply(k,W)}}else{var h=d in o?wt(o,d):void 0,y=typeof h=="function"&&h.rawArgs===!0,v=_=>{var E;if(_.has(d))E=_.get(d);else if(d in o)E=wt(o,d);else return l.onUndefinedFunction(d);if(typeof E=="function")return E;throw new TypeError("'".concat(d,\`' is not a function; its value is: - \`).concat(i(E)))};if(y){var x=this.args;return function(E,T,R){var k=v(E);return k(x,o,Os(E,T))}}else switch(m.length){case 0:return function(E,T,R){var k=v(E);return k()};case 1:return function(E,T,R){var k=v(E),W=m[0];return k(W(E,T,R))};case 2:return function(E,T,R){var k=v(E),W=m[0],G=m[1];return k(W(E,T,R),G(E,T,R))};default:return function(E,T,R){var k=v(E),W=m.map(G=>G(E,T,R));return k(...W)}}}}else if(Ln(this.fn)&&Jn(this.fn.index)&&this.fn.index.isObjectProperty()){var C=this.fn.object._compile(o,s),b=this.fn.index.getObjectProperty(),N=this.args;return function(E,T,R){var k=C(E,T,R),W=bM(k,b);if(W!=null&&W.rawArgs)return W(N,o,Os(E,T));var G=m.map(H=>H(E,T,R));return W.apply(k,G)}}else{var M=this.fn.toString(),S=this.fn._compile(o,s),O=this.args;return function(E,T,R){var k=S(E,T,R);if(typeof k!="function")throw new TypeError("Expression '".concat(M,"' did not evaluate to a function; value is:")+\` - \`.concat(i(k)));if(k.rawArgs)return k(O,o,Os(E,T));var W=m.map(G=>G(E,T,R));return k.apply(k,W)}}}forEach(o){o(this.fn,"fn",this);for(var s=0;s'+rn(this.fn)+'('+s.join(',')+')'}toTex(o){var s;return o&&typeof o.handler=="object"&&Xe(o.handler,this.name)&&(s=o.handler[this.name](this,o)),typeof s<"u"?s:super.toTex(o)}_toTex(o){var s=this.args.map(function(h){return h.toTex(o)}),m;bD[this.name]&&(m=bD[this.name]),t[this.name]&&(typeof t[this.name].toTex=="function"||typeof t[this.name].toTex=="object"||typeof t[this.name].toTex=="string")&&(m=t[this.name].toTex);var d;switch(typeof m){case"function":d=m(this,o);break;case"string":d=u(m,this,o);break;case"object":switch(typeof m[s.length]){case"function":d=m[s.length](this,o);break;case"string":d=u(m[s.length],this,o);break}}return typeof d<"u"?d:u(fT,this,o)}getIdentifier(){return this.type+":"+this.name}}return r=l,Hr(l,"name",jv),Hr(l,"onUndefinedFunction",function(c){throw new Error("Undefined function "+c)}),Hr(l,"fromJSON",function(c){return new r(c.fn,c.args)}),l},{isClass:!0,isNode:!0});var cT="parse",Z$=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],rg=F(cT,Z$,e=>{var{typed:r,numeric:t,config:n,AccessorNode:a,ArrayNode:i,AssignmentNode:u,BlockNode:l,ConditionalNode:c,ConstantNode:o,FunctionAssignmentNode:s,FunctionNode:m,IndexNode:d,ObjectNode:h,OperatorNode:y,ParenthesisNode:v,RangeNode:x,RelationalNode:w,SymbolNode:C}=e,b=r(cT,{string:function(Q){return pe(Q,{})},"Array | Matrix":function(Q){return N(Q,{})},"string, Object":function(Q,ve){var Pe=ve.nodes!==void 0?ve.nodes:{};return pe(Q,Pe)},"Array | Matrix, Object":N});function N(B){var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=Q.nodes!==void 0?Q.nodes:{};return je(B,function(Pe){if(typeof Pe!="string")throw new TypeError("String expected");return pe(Pe,ve)})}var M={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},S={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},O={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},_={true:!0,false:!1,null:null,undefined:void 0},E=["NaN","Infinity"],T={'"':'"',"'":"'","\\\\":"\\\\","/":"/",b:"\\b",f:"\\f",n:\` -\`,r:"\\r",t:" "};function R(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:M.NULL,nestingLevel:0,conditionalLevel:null}}function k(B,Q){return B.expression.substr(B.index,Q)}function W(B){return k(B,1)}function G(B){B.index++}function H(B){return B.expression.charAt(B.index-1)}function L(B){return B.expression.charAt(B.index+1)}function q(B){for(B.tokenType=M.NULL,B.token="",B.comment="";;){if(W(B)==="#")for(;W(B)!==\` -\`&&W(B)!=="";)B.comment+=W(B),G(B);if(b.isWhitespace(W(B),B.nestingLevel))G(B);else break}if(W(B)===""){B.tokenType=M.DELIMITER;return}if(W(B)===\` -\`&&!B.nestingLevel){B.tokenType=M.DELIMITER,B.token=W(B),G(B);return}var Q=W(B),ve=k(B,2),Pe=k(B,3);if(Pe.length===3&&S[Pe]){B.tokenType=M.DELIMITER,B.token=Pe,G(B),G(B),G(B);return}if(ve.length===2&&S[ve]){B.tokenType=M.DELIMITER,B.token=ve,G(B),G(B);return}if(S[Q]){B.tokenType=M.DELIMITER,B.token=Q,G(B);return}if(b.isDigitDot(Q)){B.tokenType=M.NUMBER;var tr=k(B,2);if(tr==="0b"||tr==="0o"||tr==="0x"){for(B.token+=W(B),G(B),B.token+=W(B),G(B);b.isHexDigit(W(B));)B.token+=W(B),G(B);if(W(B)===".")for(B.token+=".",G(B);b.isHexDigit(W(B));)B.token+=W(B),G(B);else if(W(B)==="i")for(B.token+="i",G(B);b.isDigit(W(B));)B.token+=W(B),G(B);return}if(W(B)==="."){if(B.token+=W(B),G(B),!b.isDigit(W(B))){B.tokenType=M.DELIMITER;return}}else{for(;b.isDigit(W(B));)B.token+=W(B),G(B);b.isDecimalMark(W(B),L(B))&&(B.token+=W(B),G(B))}for(;b.isDigit(W(B));)B.token+=W(B),G(B);if(W(B)==="E"||W(B)==="e"){if(b.isDigit(L(B))||L(B)==="-"||L(B)==="+"){if(B.token+=W(B),G(B),(W(B)==="+"||W(B)==="-")&&(B.token+=W(B),G(B)),!b.isDigit(W(B)))throw Re(B,'Digit expected, got "'+W(B)+'"');for(;b.isDigit(W(B));)B.token+=W(B),G(B);if(b.isDecimalMark(W(B),L(B)))throw Re(B,'Digit expected, got "'+W(B)+'"')}else if(L(B)===".")throw G(B),Re(B,'Digit expected, got "'+W(B)+'"')}return}if(b.isAlpha(W(B),H(B),L(B))){for(;b.isAlpha(W(B),H(B),L(B))||b.isDigit(W(B));)B.token+=W(B),G(B);Xe(O,B.token)?B.tokenType=M.DELIMITER:B.tokenType=M.SYMBOL;return}for(B.tokenType=M.UNKNOWN;W(B)!=="";)B.token+=W(B),G(B);throw Re(B,'Syntax error in part "'+B.token+'"')}function K(B){do q(B);while(B.token===\` + (\`+lr(_,v)+", "+lr(N,v)+") ==> "+(this._values?lr(this._values[O],v):"X")}return b},a.prototype.toString=function(){return lr(this.toArray())},a.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},a.prototype.diagonal=function(v){if(v){if(rr(v)&&(v=v.toNumber()),!sr(v)||!Ze(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var x=v>0?v:0,w=v<0?-v:0,C=this._size[0],b=this._size[1],N=Math.min(C-w,b-x),M=[],S=[],O=[];O[0]=0;for(var _=x;_0?w:0,O=w<0?-w:0,_=v[0],E=v[1],T=Math.min(_-O,E-S),R;if(Mr(x)){if(x.length!==T)throw new Error("Invalid value array length");R=function(oe){return x[oe]}}else if(Qe(x)){var L=x.size();if(L.length!==1||L[0]!==T)throw new Error("Invalid matrix length");R=function(oe){return x.get([oe])}}else R=function(){return x};for(var H=[],V=[],W=[],k=0;k=0&&q=O||b[E]!==x)){var R=C?C[_]:void 0;b.splice(E,0,x),C&&C.splice(E,0,R),b.splice(E<=_?_+1:_,1),C&&C.splice(E<=_?_+1:_,1);continue}if(E=O||b[_]!==v)){var L=C?C[E]:void 0;b.splice(_,0,v),C&&C.splice(_,0,L),b.splice(_<=E?E+1:E,1),C&&C.splice(_<=E?E+1:E,1)}}},a},{isClass:!0});var Xz="number",Jz=["typed"];function Kz(e){var r=e.match(/(0[box])([0-9a-fA-F]*)\\.([0-9a-fA-F]*)/);if(r){var t={"0b":2,"0o":8,"0x":16}[r[1]],n=r[2],a=r[3];return{input:e,radix:t,integerPart:n,fractionalPart:a}}else return null}function jz(e){for(var r=parseInt(e.integerPart,e.radix),t=0,n=0;n{var{typed:r}=e,t=r("number",{"":function(){return 0},number:function(a){return a},string:function(a){if(a==="NaN")return NaN;var i=Kz(a);if(i)return jz(i);var s=0,l=a.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);l&&(s=Number(l[2]),a=l[1]);var c=Number(a);if(isNaN(c))throw new SyntaxError('String "'+a+'" is not a valid number');if(l){if(c>2**s-1)throw new SyntaxError('String "'.concat(a,'" is out of range'));c>=2**(s-1)&&(c=c-2**s)}return c},BigNumber:function(a){return a.toNumber()},Fraction:function(a){return a.valueOf()},Unit:r.referToSelf(n=>a=>{var i=a.clone();return i.value=n(a.value),i}),null:function(a){return 0},"Unit, string | Unit":function(a,i){return a.toNumber(i)},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))});return t.fromJSON=function(n){return parseFloat(n.value)},t});var s2="string",eU=["typed"],mp=F(s2,eU,e=>{var{typed:r}=e;return r(s2,{"":function(){return""},number:ai,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":r.referToSelf(t=>n=>je(n,t)),any:function(n){return String(n)}})});var u2="boolean",rU=["typed"],pp=F(u2,rU,e=>{var{typed:r}=e;return r(u2,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var a=n.toLowerCase();if(a==="true")return!0;if(a==="false")return!1;var i=Number(n);if(n!==""&&!isNaN(i))return!!i;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var tU="bignumber",nU=["typed","BigNumber"],dp=F(tU,nU,e=>{var{typed:r,BigNumber:t}=e;return r("bignumber",{"":function(){return new t(0)},number:function(a){return new t(a+"")},string:function(a){var i=a.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(i){var s=i[2],l=t(i[1]),c=new t(2).pow(Number(s));if(l.gt(c.sub(1)))throw new SyntaxError('String "'.concat(a,'" is out of range'));var o=new t(2).pow(Number(s)-1);return l.gte(o)?l.sub(c):l}return new t(a)},BigNumber:function(a){return a},Unit:r.referToSelf(n=>a=>{var i=a.clone();return i.value=n(a.value),i}),Fraction:function(a){return new t(a.n).div(a.d).times(a.s)},null:function(a){return new t(0)},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var aU="complex",iU=["typed","Complex"],hp=F(aU,iU,e=>{var{typed:r,Complex:t}=e;return r("complex",{"":function(){return t.ZERO},number:function(a){return new t(a,0)},"number, number":function(a,i){return new t(a,i)},"BigNumber, BigNumber":function(a,i){return new t(a.toNumber(),i.toNumber())},Fraction:function(a){return new t(a.valueOf(),0)},Complex:function(a){return a.clone()},string:function(a){return t(a)},null:function(a){return t(0)},Object:function(a){if("re"in a&&"im"in a)return new t(a.re,a.im);if("r"in a&&"phi"in a||"abs"in a&&"arg"in a)return new t(a);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var oU="fraction",sU=["typed","Fraction"],vp=F(oU,sU,e=>{var{typed:r,Fraction:t}=e;return r("fraction",{number:function(a){if(!isFinite(a)||isNaN(a))throw new Error(a+" cannot be represented as a fraction");return new t(a)},string:function(a){return new t(a)},"number, number":function(a,i){return new t(a,i)},null:function(a){return new t(0)},BigNumber:function(a){return new t(a.toString())},Fraction:function(a){return a},Unit:r.referToSelf(n=>a=>{var i=a.clone();return i.value=n(a.value),i}),Object:function(a){return new t(a)},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var f2="matrix",uU=["typed","Matrix","DenseMatrix","SparseMatrix"],gp=F(f2,uU,e=>{var{typed:r,Matrix:t,DenseMatrix:n,SparseMatrix:a}=e;return r(f2,{"":function(){return i([])},string:function(l){return i([],l)},"string, string":function(l,c){return i([],l,c)},Array:function(l){return i(l)},Matrix:function(l){return i(l,l.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});function i(s,l,c){if(l==="dense"||l==="default"||l===void 0)return new n(s,c);if(l==="sparse")return new a(s,c);throw new TypeError("Unknown matrix type "+JSON.stringify(l)+".")}});var c2="matrixFromFunction",fU=["typed","matrix","isZero"],yp=F(c2,fU,e=>{var{typed:r,matrix:t,isZero:n}=e;return r(c2,{"Array | Matrix, function, string, string":function(s,l,c,o){return a(s,l,c,o)},"Array | Matrix, function, string":function(s,l,c){return a(s,l,c)},"Matrix, function":function(s,l){return a(s,l,"dense")},"Array, function":function(s,l){return a(s,l,"dense").toArray()},"Array | Matrix, string, function":function(s,l,c){return a(s,c,l)},"Array | Matrix, string, string, function":function(s,l,c,o){return a(s,o,l,c)}});function a(i,s,l,c){var o;return c!==void 0?o=t(l,c):o=t(l),o.resize(i),o.forEach(function(u,m){var d=s(m);n(d)||o.set(m,d)}),o}});var l2="matrixFromRows",cU=["typed","matrix","flatten","size"],xp=F(l2,cU,e=>{var{typed:r,matrix:t,flatten:n,size:a}=e;return r(l2,{"...Array":function(c){return i(c)},"...Matrix":function(c){return t(i(c.map(o=>o.toArray())))}});function i(l){if(l.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var c=s(l[0]),o=[];for(var u of l){var m=s(u);if(m!==c)throw new TypeError("The vectors had different length: "+(c|0)+" \\u2260 "+(m|0));o.push(n(u))}return o}function s(l){var c=a(l);if(c.length===1)return c[0];if(c.length===2){if(c[0]===1)return c[1];if(c[1]===1)return c[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var m2="matrixFromColumns",lU=["typed","matrix","flatten","size"],bp=F(m2,lU,e=>{var{typed:r,matrix:t,flatten:n,size:a}=e;return r(m2,{"...Array":function(c){return i(c)},"...Matrix":function(c){return t(i(c.map(o=>o.toArray())))}});function i(l){if(l.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var c=s(l[0]),o=[],u=0;u{var{typed:r}=e;return r(p2,{"Unit, Array":function(n,a){return n.splitUnit(a)}})});var d2="unaryMinus",pU=["typed"],Dp=F(d2,pU,e=>{var{typed:r}=e;return r(d2,{number:yw,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:r.referToSelf(t=>n=>{var a=n.clone();return a.value=r.find(t,a.valueType())(n.value),a}),"Array | Matrix":r.referToSelf(t=>n=>je(n,t,!0))})});var h2="unaryPlus",dU=["typed","config","BigNumber"],Sp=F(h2,dU,e=>{var{typed:r,config:t,BigNumber:n}=e;return r(h2,{number:xw,Complex:function(i){return i},BigNumber:function(i){return i},Fraction:function(i){return i},Unit:function(i){return i.clone()},"Array | Matrix":r.referToSelf(a=>i=>je(i,a,!0)),"boolean | string":function(i){return t.number==="BigNumber"?new n(+i):+i}})});var v2="abs",hU=["typed"],Np=F(v2,hU,e=>{var{typed:r}=e;return r(v2,{number:dw,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":r.referToSelf(t=>n=>je(n,t,!0))})});var g2="apply",vU=["typed","isInteger"],Lo=F(g2,vU,e=>{var{typed:r,isInteger:t}=e;return r(g2,{"Array | Matrix, number | BigNumber, function":function(a,i,s){if(!t(i))throw new TypeError("Integer number expected for dimension");var l=Array.isArray(a)?ur(a):a.size();if(i<0||i>=l.length)throw new tn(i,l.length);return Qe(a)?a.create(Ap(a.valueOf(),i,s)):Ap(a,i,s)}})});function Ap(e,r,t){var n,a,i;if(r<=0)if(Array.isArray(e[0])){for(i=gU(e),a=[],n=0;n{var{typed:r}=e;return r(y2,{"number, number":hw,"Complex, Complex":function(n,a){return n.add(a)},"BigNumber, BigNumber":function(n,a){return n.plus(a)},"Fraction, Fraction":function(n,a){return n.add(a)},"Unit, Unit":r.referToSelf(t=>(n,a)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(a.value===null||a.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(a))throw new Error("Units do not match");var i=n.clone();return i.value=r.find(t,[i.valueType(),a.valueType()])(i.value,a.value),i.fixPrefix=!1,i})})});var x2="subtractScalar",xU=["typed"],Cp=F(x2,xU,e=>{var{typed:r}=e;return r(x2,{"number, number":vw,"Complex, Complex":function(n,a){return n.sub(a)},"BigNumber, BigNumber":function(n,a){return n.minus(a)},"Fraction, Fraction":function(n,a){return n.sub(a)},"Unit, Unit":r.referToSelf(t=>(n,a)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(a.value===null||a.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(a))throw new Error("Units do not match");var i=n.clone();return i.value=r.find(t,[i.valueType(),a.valueType()])(i.value,a.value),i.fixPrefix=!1,i})})});var b2="cbrt",bU=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],Ep=F(b2,bU,e=>{var{config:r,typed:t,isNegative:n,unaryMinus:a,matrix:i,Complex:s,BigNumber:l,Fraction:c}=e;return t(b2,{number:_u,Complex:o,"Complex, boolean":o,BigNumber:function(d){return d.cbrt()},Unit:u});function o(m,d){var h=m.arg()/3,y=m.abs(),v=new s(_u(y),0).mul(new s(0,h).exp());if(d){var x=[v,new s(_u(y),0).mul(new s(0,h+Math.PI*2/3).exp()),new s(_u(y),0).mul(new s(0,h-Math.PI*2/3).exp())];return r.matrix==="Array"?x:i(x)}else return v}function u(m){if(m.value&&Kt(m.value)){var d=m.clone();return d.value=1,d=d.pow(1/3),d.value=o(m.value),d}else{var h=n(m.value);h&&(m.value=a(m.value));var y;rr(m.value)?y=new l(1).div(3):da(m.value)?y=new c(1,3):y=1/3;var v=m.pow(y);return h&&(v.value=a(v.value)),v}}});var wU="matAlgo11xS0s",DU=["typed","equalScalar"],jr=F(wU,DU,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,s,l){var c=a._values,o=a._index,u=a._ptr,m=a._size,d=a._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=m[0],y=m[1],v,x=t,w=0,C=s;typeof d=="string"&&(v=d,x=r.find(t,[v,v]),w=r.convert(0,v),i=r.convert(i,v),C=r.find(s,[v,v]));for(var b=[],N=[],M=[],S=0;S{var{typed:r,DenseMatrix:t}=e;return function(a,i,s,l){var c=a._values,o=a._index,u=a._ptr,m=a._size,d=a._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=m[0],y=m[1],v,x=s;typeof d=="string"&&(v=d,i=r.convert(i,v),x=r.find(s,[v,v]));for(var w=[],C=[],b=[],N=0;N{var{typed:r}=e;return function(a,i,s,l){var c=a._data,o=a._size,u=a._datatype,m,d=s;typeof u=="string"&&(m=u,i=r.convert(i,m),d=r.find(s,[m,m]));var h=o.length>0?t(d,0,o,o[0],c,i,l):[];return a.createDenseMatrix({data:h,size:ar(o),datatype:m})};function t(n,a,i,s,l,c,o){var u=[];if(a===i.length-1)for(var m=0;m{var{typed:r,config:t,round:n}=e;return r(lD,{number:function(i){return At(i,n(i),t.epsilon)?n(i):Math.ceil(i)},"number, number":function(i,s){if(At(i,n(i,s),t.epsilon))return n(i,s);var[l,c]="".concat(i,"e").split("e"),o=Math.ceil(Number("".concat(l,"e").concat(Number(c)+s)));return[l,c]="".concat(o,"e").split("e"),Number("".concat(l,"e").concat(Number(c)-s))}})}),Tp=F(lD,CU,e=>{var{typed:r,config:t,round:n,matrix:a,equalScalar:i,zeros:s,DenseMatrix:l}=e,c=jr({typed:r,equalScalar:i}),o=Wr({typed:r,DenseMatrix:l}),u=kt({typed:r}),m=EU({typed:r,config:t,round:n});return r("ceil",{number:m.signatures.number,"number,number":m.signatures["number,number"],Complex:function(h){return h.ceil()},"Complex, number":function(h,y){return h.ceil(y)},"Complex, BigNumber":function(h,y){return h.ceil(y.toNumber())},BigNumber:function(h){return $t(h,n(h),t.epsilon)?n(h):h.ceil()},"BigNumber, BigNumber":function(h,y){return $t(h,n(h,y),t.epsilon)?n(h,y):h.toDecimalPlaces(y.toNumber(),Es.ROUND_CEIL)},Fraction:function(h){return h.ceil()},"Fraction, number":function(h,y){return h.ceil(y)},"Fraction, BigNumber":function(h,y){return h.ceil(y.toNumber())},"Array | Matrix":r.referToSelf(d=>h=>je(h,d,!0)),"Array, number | BigNumber":r.referToSelf(d=>(h,y)=>je(h,v=>d(v,y),!0)),"SparseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>c(h,y,d,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>u(h,y,d,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(d=>(h,y)=>u(a(y),h,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(d=>(h,y)=>i(h,0)?s(y.size(),y.storage()):y.storage()==="dense"?u(y,h,d,!0):o(y,h,d,!0))})});var w2="cube",TU=["typed"],Fp=F(w2,TU,e=>{var{typed:r}=e;return r(w2,{number:bw,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var D2="exp",FU=["typed"],_p=F(D2,FU,e=>{var{typed:r}=e;return r(D2,{number:ww,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var S2="expm1",_U=["typed","Complex"],Op=F(S2,_U,e=>{var{typed:r,Complex:t}=e;return r(S2,{number:Dw,Complex:function(a){var i=Math.exp(a.re);return new t(i*Math.cos(a.im)-1,i*Math.sin(a.im))},BigNumber:function(a){return a.exp().minus(1)}})});var mD="fix",OU=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],BU=F(mD,["typed","ceil","floor"],e=>{var{typed:r,ceil:t,floor:n}=e;return r(mD,{number:function(i){return i>0?n(i):t(i)},"number, number":function(i,s){return i>0?n(i,s):t(i,s)}})}),Bp=F(mD,OU,e=>{var{typed:r,Complex:t,matrix:n,ceil:a,floor:i,equalScalar:s,zeros:l,DenseMatrix:c}=e,o=Wr({typed:r,DenseMatrix:c}),u=kt({typed:r}),m=BU({typed:r,ceil:a,floor:i});return r("fix",{number:m.signatures.number,"number, number | BigNumber":m.signatures["number,number"],Complex:function(h){return new t(h.re>0?Math.floor(h.re):Math.ceil(h.re),h.im>0?Math.floor(h.im):Math.ceil(h.im))},"Complex, number":function(h,y){return new t(h.re>0?i(h.re,y):a(h.re,y),h.im>0?i(h.im,y):a(h.im,y))},"Complex, BigNumber":function(h,y){var v=y.toNumber();return new t(h.re>0?i(h.re,v):a(h.re,v),h.im>0?i(h.im,v):a(h.im,v))},BigNumber:function(h){return h.isNegative()?a(h):i(h)},"BigNumber, number | BigNumber":function(h,y){return h.isNegative()?a(h,y):i(h,y)},Fraction:function(h){return h.s<0?h.ceil():h.floor()},"Fraction, number | BigNumber":function(h,y){return h.s<0?a(h,y):i(h,y)},"Array | Matrix":r.referToSelf(d=>h=>je(h,d,!0)),"Array | Matrix, number | BigNumber":r.referToSelf(d=>(h,y)=>je(h,v=>d(v,y),!0)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(d=>(h,y)=>u(n(y),h,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(d=>(h,y)=>s(h,0)?l(y.size(),y.storage()):y.storage()==="dense"?u(y,h,d,!0):o(y,h,d,!0))})});var pD="floor",PU=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],IU=F(pD,["typed","config","round"],e=>{var{typed:r,config:t,round:n}=e;return r(pD,{number:function(i){return At(i,n(i),t.epsilon)?n(i):Math.floor(i)},"number, number":function(i,s){if(At(i,n(i,s),t.epsilon))return n(i,s);var[l,c]="".concat(i,"e").split("e"),o=Math.floor(Number("".concat(l,"e").concat(Number(c)+s)));return[l,c]="".concat(o,"e").split("e"),Number("".concat(l,"e").concat(Number(c)-s))}})}),Pu=F(pD,PU,e=>{var{typed:r,config:t,round:n,matrix:a,equalScalar:i,zeros:s,DenseMatrix:l}=e,c=jr({typed:r,equalScalar:i}),o=Wr({typed:r,DenseMatrix:l}),u=kt({typed:r}),m=IU({typed:r,config:t,round:n});return r("floor",{number:m.signatures.number,"number,number":m.signatures["number,number"],Complex:function(h){return h.floor()},"Complex, number":function(h,y){return h.floor(y)},"Complex, BigNumber":function(h,y){return h.floor(y.toNumber())},BigNumber:function(h){return $t(h,n(h),t.epsilon)?n(h):h.floor()},"BigNumber, BigNumber":function(h,y){return $t(h,n(h,y),t.epsilon)?n(h,y):h.toDecimalPlaces(y.toNumber(),Es.ROUND_FLOOR)},Fraction:function(h){return h.floor()},"Fraction, number":function(h,y){return h.floor(y)},"Fraction, BigNumber":function(h,y){return h.floor(y.toNumber())},"Array | Matrix":r.referToSelf(d=>h=>je(h,d,!0)),"Array, number | BigNumber":r.referToSelf(d=>(h,y)=>je(h,v=>d(v,y),!0)),"SparseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>c(h,y,d,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>u(h,y,d,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(d=>(h,y)=>u(a(y),h,d,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(d=>(h,y)=>i(h,0)?s(y.size(),y.storage()):y.storage()==="dense"?u(y,h,d,!0):o(y,h,d,!0))})});var RU="matAlgo02xDS0",qU=["typed","equalScalar"],Lt=F(RU,qU,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,s,l){var c=a._data,o=a._size,u=a._datatype||a.getDataType(),m=i._values,d=i._index,h=i._ptr,y=i._size,v=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(o.length!==y.length)throw new pr(o.length,y.length);if(o[0]!==y[0]||o[1]!==y[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+y+")");if(!m)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var x=o[0],w=o[1],C,b=t,N=0,M=s;typeof u=="string"&&u===v&&u!=="mixed"&&(C=u,b=r.find(t,[C,C]),N=r.convert(0,C),M=r.find(s,[C,C]));for(var S=[],O=[],_=[],E=0;E{var{typed:r}=e;return function(n,a,i,s){var l=n._data,c=n._size,o=n._datatype||n.getDataType(),u=a._values,m=a._index,d=a._ptr,h=a._size,y=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new pr(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=c[0],x=c[1],w,C=0,b=i;typeof o=="string"&&o===y&&o!=="mixed"&&(w=o,C=r.convert(0,w),b=r.find(i,[w,w]));for(var N=[],M=0;M{var{typed:r,equalScalar:t}=e;return function(a,i,s){var l=a._values,c=a._index,o=a._ptr,u=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType(),d=i._values,h=i._index,y=i._ptr,v=i._size,x=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(u.length!==v.length)throw new pr(u.length,v.length);if(u[0]!==v[0]||u[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+v+")");var w=u[0],C=u[1],b,N=t,M=0,S=s;typeof m=="string"&&m===x&&m!=="mixed"&&(b=m,N=r.find(t,[b,b]),M=r.convert(0,b),S=r.find(s,[b,b]));var O=l&&d?[]:void 0,_=[],E=[],T=O?[]:void 0,R=O?[]:void 0,L=[],H=[],V,W,k,q;for(W=0;W{var{typed:r}=e;return function(a,i,s){var l=a._data,c=a._size,o=a._datatype,u=i._data,m=i._size,d=i._datatype,h=[];if(c.length!==m.length)throw new pr(c.length,m.length);for(var y=0;y0?t(x,0,h,h[0],l,u):[];return a.createDenseMatrix({data:w,size:h,datatype:v})};function t(n,a,i,s,l,c){var o=[];if(a===i.length-1)for(var u=0;u{var{concat:r}=e;return function(a,i){var s=Math.max(a._size.length,i._size.length);if(a._size.length===i._size.length&&a._size.every((y,v)=>y===i._size[v]))return[a,i];for(var l=t(a._size,s,0),c=t(i._size,s,0),o=[],u=0;u{var{typed:r,matrix:t,concat:n}=e,a=N2({typed:r}),i=kt({typed:r}),s=A2({concat:n});return function(c){var o=c.elop,u=c.SD||c.DS,m;o?(m={"DenseMatrix, DenseMatrix":(v,x)=>a(...s(v,x),o),"Array, Array":(v,x)=>a(...s(t(v),t(x)),o).valueOf(),"Array, DenseMatrix":(v,x)=>a(...s(t(v),x),o),"DenseMatrix, Array":(v,x)=>a(...s(v,t(x)),o)},c.SS&&(m["SparseMatrix, SparseMatrix"]=(v,x)=>c.SS(...s(v,x),o,!1)),c.DS&&(m["DenseMatrix, SparseMatrix"]=(v,x)=>c.DS(...s(v,x),o,!1),m["Array, SparseMatrix"]=(v,x)=>c.DS(...s(t(v),x),o,!1)),u&&(m["SparseMatrix, DenseMatrix"]=(v,x)=>u(...s(x,v),o,!0),m["SparseMatrix, Array"]=(v,x)=>u(...s(t(x),v),o,!0))):(m={"DenseMatrix, DenseMatrix":r.referToSelf(v=>(x,w)=>a(...s(x,w),v)),"Array, Array":r.referToSelf(v=>(x,w)=>a(...s(t(x),t(w)),v).valueOf()),"Array, DenseMatrix":r.referToSelf(v=>(x,w)=>a(...s(t(x),w),v)),"DenseMatrix, Array":r.referToSelf(v=>(x,w)=>a(...s(x,t(w)),v))},c.SS&&(m["SparseMatrix, SparseMatrix"]=r.referToSelf(v=>(x,w)=>c.SS(...s(x,w),v,!1))),c.DS&&(m["DenseMatrix, SparseMatrix"]=r.referToSelf(v=>(x,w)=>c.DS(...s(x,w),v,!1)),m["Array, SparseMatrix"]=r.referToSelf(v=>(x,w)=>c.DS(...s(t(x),w),v,!1))),u&&(m["SparseMatrix, DenseMatrix"]=r.referToSelf(v=>(x,w)=>u(...s(w,x),v,!0)),m["SparseMatrix, Array"]=r.referToSelf(v=>(x,w)=>u(...s(t(w),x),v,!0))));var d=c.scalar||"any",h=c.Ds||c.Ss;h&&(o?(m["DenseMatrix,"+d]=(v,x)=>i(v,x,o,!1),m[d+", DenseMatrix"]=(v,x)=>i(x,v,o,!0),m["Array,"+d]=(v,x)=>i(t(v),x,o,!1).valueOf(),m[d+", Array"]=(v,x)=>i(t(x),v,o,!0).valueOf()):(m["DenseMatrix,"+d]=r.referToSelf(v=>(x,w)=>i(x,w,v,!1)),m[d+", DenseMatrix"]=r.referToSelf(v=>(x,w)=>i(w,x,v,!0)),m["Array,"+d]=r.referToSelf(v=>(x,w)=>i(t(x),w,v,!1).valueOf()),m[d+", Array"]=r.referToSelf(v=>(x,w)=>i(t(w),x,v,!0).valueOf())));var y=c.sS!==void 0?c.sS:c.Ss;return o?(c.Ss&&(m["SparseMatrix,"+d]=(v,x)=>c.Ss(v,x,o,!1)),y&&(m[d+", SparseMatrix"]=(v,x)=>y(x,v,o,!0))):(c.Ss&&(m["SparseMatrix,"+d]=r.referToSelf(v=>(x,w)=>c.Ss(x,w,v,!1))),y&&(m[d+", SparseMatrix"]=r.referToSelf(v=>(x,w)=>y(w,x,v,!0)))),o&&o.signatures&&wm(m,o.signatures),m}});var M2="mod",ZU=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],Iu=F(M2,ZU,e=>{var{typed:r,config:t,round:n,matrix:a,equalScalar:i,zeros:s,DenseMatrix:l,concat:c}=e,o=Pu({typed:r,config:t,round:n,matrix:a,equalScalar:i,zeros:s,DenseMatrix:l}),u=Lt({typed:r,equalScalar:i}),m=lt({typed:r}),d=zo({typed:r,equalScalar:i}),h=jr({typed:r,equalScalar:i}),y=Wr({typed:r,DenseMatrix:l}),v=vr({typed:r,matrix:a,concat:c});return r(M2,{"number, number":x,"BigNumber, BigNumber":function(C,b){return b.isZero()?C:C.sub(b.mul(o(C.div(b))))},"Fraction, Fraction":function(C,b){return b.equals(0)?C:C.sub(b.mul(o(C.div(b))))}},v({SS:d,DS:m,SD:u,Ss:h,sS:y}));function x(w,C){return C===0?w:w-C*o(w/C)}});var QU="matAlgo01xDSid",XU=["typed"],Mn=F(QU,XU,e=>{var{typed:r}=e;return function(n,a,i,s){var l=n._data,c=n._size,o=n._datatype||n.getDataType(),u=a._values,m=a._index,d=a._ptr,h=a._size,y=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new pr(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=c[0],x=c[1],w=typeof o=="string"&&o!=="mixed"&&o===y?o:void 0,C=w?r.find(i,[w,w]):i,b,N,M=[];for(b=0;b{var{typed:r,equalScalar:t}=e;return function(a,i,s){var l=a._values,c=a._index,o=a._ptr,u=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType(),d=i._values,h=i._index,y=i._ptr,v=i._size,x=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(u.length!==v.length)throw new pr(u.length,v.length);if(u[0]!==v[0]||u[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+v+")");var w=u[0],C=u[1],b,N=t,M=0,S=s;typeof m=="string"&&m===x&&m!=="mixed"&&(b=m,N=r.find(t,[b,b]),M=r.convert(0,b),S=r.find(s,[b,b]));var O=l&&d?[]:void 0,_=[],E=[],T=l&&d?[]:void 0,R=l&&d?[]:void 0,L=[],H=[],V,W,k,q,K;for(W=0;W{var{typed:r,DenseMatrix:t}=e;return function(a,i,s,l){var c=a._values,o=a._index,u=a._ptr,m=a._size,d=a._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=m[0],y=m[1],v,x=s;typeof d=="string"&&(v=d,i=r.convert(i,v),x=r.find(s,[v,v]));for(var w=[],C=[],b=[],N=0;NArray.isArray(r))}var Pp=F(C2,rW,e=>{var{typed:r,matrix:t,config:n,round:a,equalScalar:i,zeros:s,BigNumber:l,DenseMatrix:c,concat:o}=e,u=Iu({typed:r,config:n,round:a,matrix:t,equalScalar:i,zeros:s,DenseMatrix:c,concat:o}),m=Mn({typed:r}),d=Ru({typed:r,equalScalar:i}),h=ra({typed:r,DenseMatrix:c}),y=vr({typed:r,matrix:t,concat:o});return r(C2,{"number, number":v,"BigNumber, BigNumber":x,"Fraction, Fraction":(w,C)=>w.gcd(C)},y({SS:d,DS:m,Ss:h}),{[tW]:r.referToSelf(w=>(C,b,N)=>{for(var M=w(C,b),S=0;SC=>{if(C.length===1&&Array.isArray(C[0])&&E2(C[0]))return w(...C[0]);if(E2(C))return w(...C);throw new ga("gcd() supports only 1d matrices!")}),Matrix:r.referToSelf(w=>C=>w(C.toArray()))});function v(w,C){if(!Ze(w)||!Ze(C))throw new Error("Parameters in function gcd must be integer numbers");for(var b;C!==0;)b=u(w,C),w=C,C=b;return w<0?-w:w}function x(w,C){if(!w.isInt()||!C.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var b=new l(0);!C.isZero();){var N=u(w,C);w=C,C=N}return w.lt(b)?w.neg():w}});var nW="matAlgo06xS0S0",aW=["typed","equalScalar"],Uo=F(nW,aW,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,s){var l=a._values,c=a._size,o=a._datatype||a._data===void 0?a._datatype:a.getDataType(),u=i._values,m=i._size,d=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(c.length!==m.length)throw new pr(c.length,m.length);if(c[0]!==m[0]||c[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+m+")");var h=c[0],y=c[1],v,x=t,w=0,C=s;typeof o=="string"&&o===d&&o!=="mixed"&&(v=o,x=r.find(t,[v,v]),w=r.convert(0,v),C=r.find(s,[v,v]));for(var b=l&&u?[]:void 0,N=[],M=[],S=b?[]:void 0,O=[],_=[],E=0;E{var{typed:r,matrix:t,equalScalar:n,concat:a}=e,i=Lt({typed:r,equalScalar:n}),s=Uo({typed:r,equalScalar:n}),l=jr({typed:r,equalScalar:n}),c=vr({typed:r,matrix:t,concat:a}),o="number | BigNumber | Fraction | Matrix | Array",u={};return u["".concat(o,", ").concat(o,", ...").concat(o)]=r.referToSelf(d=>(h,y,v)=>{for(var x=d(h,y),w=0;wd.lcm(h)},c({SS:s,DS:i,Ss:l}),u);function m(d,h){if(!d.isInt()||!h.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(d.isZero())return d;if(h.isZero())return h;for(var y=d.times(h);!h.isZero();){var v=h;h=d.mod(v),d=v}return y.div(d).abs()}});var F2="log10",oW=["typed","config","Complex"],Rp=F(F2,oW,e=>{var{typed:r,config:t,Complex:n}=e;return r(F2,{number:function(i){return i>=0||t.predictable?Nw(i):new n(i,0).log().div(Math.LN10)},Complex:function(i){return new n(i).log().div(Math.LN10)},BigNumber:function(i){return!i.isNegative()||t.predictable?i.log():new n(i.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":r.referToSelf(a=>i=>je(i,a))})});var _2="log2",sW=["typed","config","Complex"],qp=F(_2,sW,e=>{var{typed:r,config:t,Complex:n}=e;return r(_2,{number:function(s){return s>=0||t.predictable?Aw(s):a(new n(s,0))},Complex:a,BigNumber:function(s){return!s.isNegative()||t.predictable?s.log(2):a(new n(s.toNumber(),0))},"Array | Matrix":r.referToSelf(i=>s=>je(s,i))});function a(i){var s=Math.sqrt(i.re*i.re+i.im*i.im);return new n(Math.log2?Math.log2(s):Math.log(s)/Math.LN2,Math.atan2(i.im,i.re)/Math.LN2)}});var uW="multiplyScalar",fW=["typed"],kp=F(uW,fW,e=>{var{typed:r}=e;return r("multiplyScalar",{"number, number":gw,"Complex, Complex":function(n,a){return n.mul(a)},"BigNumber, BigNumber":function(n,a){return n.times(a)},"Fraction, Fraction":function(n,a){return n.mul(a)},"number | Fraction | BigNumber | Complex, Unit":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});var O2="multiply",cW=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],Lp=F(O2,cW,e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:a,equalScalar:i,dot:s}=e,l=jr({typed:r,equalScalar:i}),c=kt({typed:r});function o(M,S){switch(M.length){case 1:switch(S.length){case 1:if(M[0]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(M[0]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+M[0]+") must match Matrix rows ("+S[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+S.length+" dimensions)")}break;case 2:switch(S.length){case 1:if(M[1]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+M[1]+") must match Vector length ("+S[0]+")");break;case 2:if(M[1]!==S[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+M[1]+") must match Matrix B rows ("+S[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+S.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+M.length+" dimensions)")}}function u(M,S,O){if(O===0)throw new Error("Cannot multiply two empty vectors");return s(M,S)}function m(M,S){if(S.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return d(M,S)}function d(M,S){var O=M._data,_=M._size,E=M._datatype||M.getDataType(),T=S._data,R=S._size,L=S._datatype||S.getDataType(),H=_[0],V=R[1],W,k=n,q=a;E&&L&&E===L&&typeof E=="string"&&E!=="mixed"&&(W=E,k=r.find(n,[W,W]),q=r.find(a,[W,W]));for(var K=[],z=0;zge)for(var ye=0,be=0;be(S,O)=>{o(ur(S),ur(O));var _=M(t(S),t(O));return Qe(_)?_.valueOf():_}),"Matrix, Matrix":function(S,O){var _=S.size(),E=O.size();return o(_,E),_.length===1?E.length===1?u(S,O,_[0]):m(S,O):E.length===1?h(S,O):y(S,O)},"Matrix, Array":r.referTo("Matrix,Matrix",M=>(S,O)=>M(S,t(O))),"Array, Matrix":r.referToSelf(M=>(S,O)=>M(t(S,O.storage()),O)),"SparseMatrix, any":function(S,O){return l(S,O,a,!1)},"DenseMatrix, any":function(S,O){return c(S,O,a,!1)},"any, SparseMatrix":function(S,O){return l(O,S,a,!0)},"any, DenseMatrix":function(S,O){return c(O,S,a,!0)},"Array, any":function(S,O){return c(t(S),O,a,!1).valueOf()},"any, Array":function(S,O){return c(t(O),S,a,!0).valueOf()},"any, any":a,"any, any, ...any":r.referToSelf(M=>(S,O,_)=>{for(var E=M(S,O),T=0;T<_.length;T++)E=M(E,_[T]);return E})})});var B2="nthRoot",lW=["typed","matrix","equalScalar","BigNumber","concat"],zp=F(B2,lW,e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:a,concat:i}=e,s=Mn({typed:r}),l=Lt({typed:r,equalScalar:n}),c=Uo({typed:r,equalScalar:n}),o=jr({typed:r,equalScalar:n}),u=vr({typed:r,matrix:t,concat:i});function m(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return r(B2,{number:Mw,"number, number":Mw,BigNumber:h=>d(h,new a(2)),"BigNumber, BigNumber":d,Complex:m,"Complex, number":m,Array:r.referTo("DenseMatrix,number",h=>y=>h(t(y),2).valueOf()),DenseMatrix:r.referTo("DenseMatrix,number",h=>y=>h(y,2)),SparseMatrix:r.referTo("SparseMatrix,number",h=>y=>h(y,2)),"SparseMatrix, SparseMatrix":r.referToSelf(h=>(y,v)=>{if(v.density()===1)return c(y,v,h);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":r.referToSelf(h=>(y,v)=>{if(v.density()===1)return s(y,v,h,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":r.referTo("DenseMatrix,SparseMatrix",h=>(y,v)=>h(t(y),v)),"number | BigNumber, SparseMatrix":r.referToSelf(h=>(y,v)=>{if(v.density()===1)return o(v,y,h,!0);throw new Error("Root must be non-zero")})},u({scalar:"number | BigNumber",SD:l,Ss:o,sS:!1}));function d(h,y){var v=a.precision,x=a.clone({precision:v+2}),w=new a(0),C=new x(1),b=y.isNegative();if(b&&(y=y.neg()),y.isZero())throw new Error("Root must be non-zero");if(h.isNegative()&&!y.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(h.isZero())return b?new x(1/0):0;if(!h.isFinite())return b?w:h;var N=h.abs().pow(C.div(y));return N=h.isNeg()?N.neg():N,new a((b?C.div(N):N).toPrecision(v))}});var P2="sign",mW=["typed","BigNumber","Fraction","complex"],Up=F(P2,mW,e=>{var{typed:r,BigNumber:t,complex:n,Fraction:a}=e;return r(P2,{number:ep,Complex:function(s){return s.im===0?n(ep(s.re)):s.sign()},BigNumber:function(s){return new t(s.cmp(0))},Fraction:function(s){return new a(s.s,1)},"Array | Matrix":r.referToSelf(i=>s=>je(s,i,!0)),Unit:r.referToSelf(i=>s=>{if(!s._isDerived()&&s.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return r.find(i,s.valueType())(s.value)})})});var pW="sqrt",dW=["config","typed","Complex"],Wp=F(pW,dW,e=>{var{config:r,typed:t,Complex:n}=e;return t("sqrt",{number:a,Complex:function(s){return s.sqrt()},BigNumber:function(s){return!s.isNegative()||r.predictable?s.sqrt():a(s.toNumber())},Unit:function(s){return s.pow(.5)}});function a(i){return isNaN(i)?NaN:i>=0||r.predictable?Math.sqrt(i):new n(i,0).sqrt()}});var I2="square",hW=["typed"],Yp=F(I2,hW,e=>{var{typed:r}=e;return r(I2,{number:Cw,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var R2="subtract",vW=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],Hp=F(R2,vW,e=>{var{typed:r,matrix:t,equalScalar:n,subtractScalar:a,unaryMinus:i,DenseMatrix:s,concat:l}=e,c=Mn({typed:r}),o=lt({typed:r}),u=zo({typed:r,equalScalar:n}),m=ra({typed:r,DenseMatrix:s}),d=Wr({typed:r,DenseMatrix:s}),h=vr({typed:r,matrix:t,concat:l});return r(R2,{"any, any":a},h({elop:a,SS:u,DS:c,SD:o,Ss:d,sS:m}))});var q2="xgcd",gW=["typed","config","matrix","BigNumber"],$p=F(q2,gW,e=>{var{typed:r,config:t,matrix:n,BigNumber:a}=e;return r(q2,{"number, number":function(l,c){var o=Ew(l,c);return t.matrix==="Array"?o:n(o)},"BigNumber, BigNumber":i});function i(s,l){var c,o,u,m=new a(0),d=new a(1),h=m,y=d,v=d,x=m;if(!s.isInt()||!l.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!l.isZero();)o=s.div(l).floor(),u=s.mod(l),c=h,h=y.minus(o.times(h)),y=c,c=v,v=x.minus(o.times(v)),x=c,s=l,l=u;var w;return s.lt(m)?w=[s.neg(),y.neg(),x.neg()]:w=[s,s.isZero()?0:y,x],t.matrix==="Array"?w:n(w)}});var k2="invmod",yW=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],Gp=F(k2,yW,e=>{var{typed:r,config:t,BigNumber:n,xgcd:a,equal:i,smaller:s,mod:l,add:c,isInteger:o}=e;return r(k2,{"number, number":u,"BigNumber, BigNumber":u});function u(m,d){if(!o(m)||!o(d))throw new Error("Parameters in function invmod must be integer numbers");if(m=l(m,d),i(d,0))throw new Error("Divisor must be non zero");var h=a(m,d);h=h.valueOf();var[y,v]=h;return i(y,n(1))?(v=l(v,d),s(v,n(0))&&(v=c(v,d)),v):NaN}});var xW="matAlgo09xS0Sf",bW=["typed","equalScalar"],Vp=F(xW,bW,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,s){var l=a._values,c=a._index,o=a._ptr,u=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType(),d=i._values,h=i._index,y=i._ptr,v=i._size,x=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(u.length!==v.length)throw new pr(u.length,v.length);if(u[0]!==v[0]||u[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+v+")");var w=u[0],C=u[1],b,N=t,M=0,S=s;typeof m=="string"&&m===x&&m!=="mixed"&&(b=m,N=r.find(t,[b,b]),M=r.convert(0,b),S=r.find(s,[b,b]));var O=l&&d?[]:void 0,_=[],E=[],T=O?[]:void 0,R=[],L,H,V,W,k;for(H=0;H{var{typed:r,matrix:t,equalScalar:n,multiplyScalar:a,concat:i}=e,s=Lt({typed:r,equalScalar:n}),l=Vp({typed:r,equalScalar:n}),c=jr({typed:r,equalScalar:n}),o=vr({typed:r,matrix:t,concat:i});return r(L2,o({elop:a,SS:l,DS:s,Ss:c}))});function z2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitAnd");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero()||r.eq(-1)||e.eq(r))return e;if(r.isZero()||e.eq(-1))return r;if(!e.isFinite()||!r.isFinite()){if(!e.isFinite()&&!r.isFinite())return e.isNegative()===r.isNegative()?e:new t(0);if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r;if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e}return hD(e,r,function(n,a){return n&a})}function qu(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var r=e.constructor,t=r.precision;r.config({precision:1e9});var n=e.plus(new r(1));return n.s=-n.s||null,r.config({precision:t}),n}function U2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitOr");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);var n=new t(-1);return e.isZero()||r.eq(n)||e.eq(r)?r:r.isZero()||e.eq(n)?e:!e.isFinite()||!r.isFinite()?!e.isFinite()&&!e.isNegative()&&r.isNegative()||e.isNegative()&&!r.isNegative()&&!r.isFinite()?n:e.isNegative()&&r.isNegative()?e.isFinite()?e:r:e.isFinite()?r:e:hD(e,r,function(a,i){return a|i})}function hD(e,r,t){var n=e.constructor,a,i,s=+(e.s<0),l=+(r.s<0);if(s){a=Qp(qu(e));for(var c=0;c0;)t(u[--h],m[--y])===v&&(x=x.plus(w)),w=w.times(C);for(;y>0;)t(d,m[--y])===v&&(x=x.plus(w)),w=w.times(C);return n.config({precision:b}),v===0&&(x.s=-x.s),x}function Qp(e){for(var r=e.d,t=r[0]+"",n=1;n0)if(++l>o)for(l-=o;l--;)c+="0";else l1&&((u[h+1]===null||u[h+1]===void 0)&&(u[h+1]=0),u[h+1]+=u[h]>>1,u[h]&=1)}return u.reverse()}function W2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitXor");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero())return r;if(r.isZero())return e;if(e.eq(r))return new t(0);var n=new t(-1);return e.eq(n)?qu(r):r.eq(n)?qu(e):!e.isFinite()||!r.isFinite()?!e.isFinite()&&!r.isFinite()?n:new t(e.isNegative()===r.isNegative()?1/0:-1/0):hD(e,r,function(a,i){return a^i})}function Y2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function leftShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:!e.isFinite()&&!r.isFinite()?new t(NaN):r.lt(55)?e.times(Math.pow(2,r.toNumber())+""):e.times(new t(2).pow(r))}function H2(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function rightArithShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:r.isFinite()?r.lt(55)?e.div(Math.pow(2,r.toNumber())+"").floor():e.div(new t(2).pow(r)).floor():e.isNegative()?new t(-1):e.isFinite()?new t(0):new t(NaN)}var $2="bitAnd",DW=["typed","matrix","equalScalar","concat"],ku=F($2,DW,e=>{var{typed:r,matrix:t,equalScalar:n,concat:a}=e,i=Lt({typed:r,equalScalar:n}),s=Uo({typed:r,equalScalar:n}),l=jr({typed:r,equalScalar:n}),c=vr({typed:r,matrix:t,concat:a});return r($2,{"number, number":Fw,"BigNumber, BigNumber":z2},c({SS:s,DS:i,Ss:l}))});var G2="bitNot",SW=["typed"],Xp=F(G2,SW,e=>{var{typed:r}=e;return r(G2,{number:_w,BigNumber:qu,"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var V2="bitOr",NW=["typed","matrix","equalScalar","DenseMatrix","concat"],Lu=F(V2,NW,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=Mn({typed:r}),l=Ru({typed:r,equalScalar:n}),c=ra({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:t,concat:i});return r(V2,{"number, number":Ow,"BigNumber, BigNumber":U2},o({SS:l,DS:s,Ss:c}))});var AW="matAlgo07xSSf",MW=["typed","DenseMatrix"],Zt=F(AW,MW,e=>{var{typed:r,DenseMatrix:t}=e;return function(i,s,l){var c=i._size,o=i._datatype||i._data===void 0?i._datatype:i.getDataType(),u=s._size,m=s._datatype||s._data===void 0?s._datatype:s.getDataType();if(c.length!==u.length)throw new pr(c.length,u.length);if(c[0]!==u[0]||c[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+u+")");var d=c[0],h=c[1],y,v=0,x=l;typeof o=="string"&&o===m&&o!=="mixed"&&(y=o,v=r.convert(0,y),x=r.find(l,[y,y]));var w,C,b=[];for(w=0;w{var{typed:r,matrix:t,DenseMatrix:n,concat:a}=e,i=lt({typed:r}),s=Zt({typed:r,DenseMatrix:n}),l=Wr({typed:r,DenseMatrix:n}),c=vr({typed:r,matrix:t,concat:a});return r(Z2,{"number, number":Bw,"BigNumber, BigNumber":W2},c({SS:s,DS:i,Ss:l}))});var Q2="arg",EW=["typed"],Kp=F(Q2,EW,e=>{var{typed:r}=e;return r(Q2,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var X2="conj",TW=["typed"],jp=F(X2,TW,e=>{var{typed:r}=e;return r(X2,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var J2="im",FW=["typed"],ed=F(J2,FW,e=>{var{typed:r}=e;return r(J2,{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var K2="re",_W=["typed"],rd=F(K2,_W,e=>{var{typed:r}=e;return r(K2,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var j2="not",OW=["typed"],td=F(j2,OW,e=>{var{typed:r}=e;return r(j2,{"null | undefined":()=>!0,number:Lw,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:r.referToSelf(t=>n=>r.find(t,n.valueType())(n.value)),"Array | Matrix":r.referToSelf(t=>n=>je(n,t))})});var eC="or",BW=["typed","matrix","equalScalar","DenseMatrix","concat"],zu=F(eC,BW,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=lt({typed:r}),l=zo({typed:r,equalScalar:n}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:t,concat:i});return r(eC,{"number, number":zw,"Complex, Complex":function(m,d){return m.re!==0||m.im!==0||d.re!==0||d.im!==0},"BigNumber, BigNumber":function(m,d){return!m.isZero()&&!m.isNaN()||!d.isZero()&&!d.isNaN()},"Unit, Unit":r.referToSelf(u=>(m,d)=>u(m.value||0,d.value||0))},o({SS:l,DS:s,Ss:c}))});var rC="xor",PW=["typed","matrix","DenseMatrix","concat"],nd=F(rC,PW,e=>{var{typed:r,matrix:t,DenseMatrix:n,concat:a}=e,i=lt({typed:r}),s=Zt({typed:r,DenseMatrix:n}),l=Wr({typed:r,DenseMatrix:n}),c=vr({typed:r,matrix:t,concat:a});return r(rC,{"number, number":Uw,"Complex, Complex":function(u,m){return(u.re!==0||u.im!==0)!=(m.re!==0||m.im!==0)},"BigNumber, BigNumber":function(u,m){return(!u.isZero()&&!u.isNaN())!=(!m.isZero()&&!m.isNaN())},"Unit, Unit":r.referToSelf(o=>(u,m)=>o(u.value||0,m.value||0))},c({SS:s,DS:i,Ss:l}))});var tC="concat",IW=["typed","matrix","isInteger"],Uu=F(tC,IW,e=>{var{typed:r,matrix:t,isInteger:n}=e;return r(tC,{"...Array | Matrix | number | BigNumber":function(i){var s,l=i.length,c=-1,o,u=!1,m=[];for(s=0;s0&&c>o)throw new tn(c,o+1)}else{var h=ar(d).valueOf(),y=ur(h);if(m[s]=h,o=c,c=y.length-1,s>0&&c!==o)throw new pr(o+1,c+1)}}if(m.length===0)throw new SyntaxError("At least one matrix expected");for(var v=m.shift();m.length;)v=Kb(v,m.shift(),c);return u?t(v):v},"...string":function(i){return i.join("")}})});var nC="column",RW=["typed","Index","matrix","range"],Wu=F(nC,RW,e=>{var{typed:r,Index:t,matrix:n,range:a}=e;return r(nC,{"Matrix, number":i,"Array, number":function(l,c){return i(n(ar(l)),c).valueOf()}});function i(s,l){if(s.size().length!==2)throw new Error("Only two dimensional matrix is supported");Kr(l,s.size()[1]);var c=a(0,s.size()[0]),o=new t(c,l),u=s.subset(o);return Qe(u)?u:n([[u]])}});var aC="count",qW=["typed","size","prod"],ad=F(aC,qW,e=>{var{typed:r,size:t,prod:n}=e;return r(aC,{string:function(i){return i.length},"Matrix | Array":function(i){return n(t(i))}})});var iC="cross",kW=["typed","matrix","subtract","multiply"],id=F(iC,kW,e=>{var{typed:r,matrix:t,subtract:n,multiply:a}=e;return r(iC,{"Matrix, Matrix":function(l,c){return t(i(l.toArray(),c.toArray()))},"Matrix, Array":function(l,c){return t(i(l.toArray(),c))},"Array, Matrix":function(l,c){return t(i(l,c.toArray()))},"Array, Array":i});function i(s,l){var c=Math.max(ur(s).length,ur(l).length);s=Au(s),l=Au(l);var o=ur(s),u=ur(l);if(o.length!==1||u.length!==1||o[0]!==3||u[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+o.join(", ")+"], B = ["+u.join(", ")+"])");var m=[n(a(s[1],l[2]),a(s[2],l[1])),n(a(s[2],l[0]),a(s[0],l[2])),n(a(s[0],l[1]),a(s[1],l[0]))];return c>1?[m]:m}});var oC="diag",LW=["typed","matrix","DenseMatrix","SparseMatrix"],od=F(oC,LW,e=>{var{typed:r,matrix:t,DenseMatrix:n,SparseMatrix:a}=e;return r(oC,{Array:function(o){return i(o,0,ur(o),null)},"Array, number":function(o,u){return i(o,u,ur(o),null)},"Array, BigNumber":function(o,u){return i(o,u.toNumber(),ur(o),null)},"Array, string":function(o,u){return i(o,0,ur(o),u)},"Array, number, string":function(o,u,m){return i(o,u,ur(o),m)},"Array, BigNumber, string":function(o,u,m){return i(o,u.toNumber(),ur(o),m)},Matrix:function(o){return i(o,0,o.size(),o.storage())},"Matrix, number":function(o,u){return i(o,u,o.size(),o.storage())},"Matrix, BigNumber":function(o,u){return i(o,u.toNumber(),o.size(),o.storage())},"Matrix, string":function(o,u){return i(o,0,o.size(),u)},"Matrix, number, string":function(o,u,m){return i(o,u,o.size(),m)},"Matrix, BigNumber, string":function(o,u,m){return i(o,u.toNumber(),o.size(),m)}});function i(c,o,u,m){if(!Ze(o))throw new TypeError("Second parameter in function diag must be an integer");var d=o>0?o:0,h=o<0?-o:0;switch(u.length){case 1:return s(c,o,m,u[0],h,d);case 2:return l(c,o,m,u,h,d)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function s(c,o,u,m,d,h){var y=[m+d,m+h];if(u&&u!=="sparse"&&u!=="dense")throw new TypeError("Unknown matrix type ".concat(u,'"'));var v=u==="sparse"?a.diagonal(y,c,o):n.diagonal(y,c,o);return u!==null?v:v.valueOf()}function l(c,o,u,m,d,h){if(Qe(c)){var y=c.diagonal(o);return u!==null?u!==y.storage()?t(y,u):y:y.valueOf()}for(var v=Math.min(m[0]-d,m[1]-h),x=[],w=0;w=2&&v.push("index: ".concat(Tr(t))),h.length>=3&&v.push("array: ".concat(Tr(n))),new TypeError("Function ".concat(a," cannot apply callback arguments ")+"".concat(e.name,"(").concat(v.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(a," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(x.message))}}}var zW="filter",UW=["typed"],sd=F(zW,UW,e=>{var{typed:r}=e;return r("filter",{"Array, function":sC,"Matrix, function":function(n,a){return n.create(sC(n.toArray(),a))},"Array, RegExp":Mu,"Matrix, RegExp":function(n,a){return n.create(Mu(n.toArray(),a))}})});function sC(e,r){return _m(e,function(t,n,a){return Ra(r,t,[n],a,"filter")})}var uC="flatten",WW=["typed","matrix"],ud=F(uC,WW,e=>{var{typed:r,matrix:t}=e;return r(uC,{Array:function(a){return gr(a)},Matrix:function(a){var i=gr(a.toArray());return t(i)}})});var fC="forEach",YW=["typed"],fd=F(fC,YW,e=>{var{typed:r}=e;return r(fC,{"Array, function":HW,"Matrix, function":function(n,a){n.forEach(a)}})});function HW(e,r){var t=function n(a,i){if(Array.isArray(a))_o(a,function(s,l){n(s,i.concat(l))});else return Ra(r,a,i,e,"forEach")};t(e,[])}var cC="getMatrixDataType",$W=["typed"],cd=F(cC,$W,e=>{var{typed:r}=e;return r(cC,{Array:function(n){return Oo(n,Tr)},Matrix:function(n){return n.getDataType()}})});var lC="identity",GW=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],ld=F(lC,GW,e=>{var{typed:r,config:t,matrix:n,BigNumber:a,DenseMatrix:i,SparseMatrix:s}=e;return r(lC,{"":function(){return t.matrix==="Matrix"?n([]):[]},string:function(u){return n(u)},"number | BigNumber":function(u){return c(u,u,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(u,m){return c(u,u,m)},"number | BigNumber, number | BigNumber":function(u,m){return c(u,m,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(u,m,d){return c(u,m,d)},Array:function(u){return l(u)},"Array, string":function(u,m){return l(u,m)},Matrix:function(u){return l(u.valueOf(),u.storage())},"Matrix, string":function(u,m){return l(u.valueOf(),m)}});function l(o,u){switch(o.length){case 0:return u?n(u):[];case 1:return c(o[0],o[0],u);case 2:return c(o[0],o[1],u);default:throw new Error("Vector containing two values expected")}}function c(o,u,m){var d=rr(o)||rr(u)?a:null;if(rr(o)&&(o=o.toNumber()),rr(u)&&(u=u.toNumber()),!Ze(o)||o<1)throw new Error("Parameters in function identity must be positive integers");if(!Ze(u)||u<1)throw new Error("Parameters in function identity must be positive integers");var h=d?new a(1):1,y=d?new d(0):0,v=[o,u];if(m){if(m==="sparse")return s.diagonal(v,h,0,y);if(m==="dense")return i.diagonal(v,h,0,y);throw new TypeError('Unknown matrix type "'.concat(m,'"'))}for(var x=ii([],v,y),w=o{var{typed:r,matrix:t,multiplyScalar:n}=e;return r(mC,{"Matrix, Matrix":function(s,l){return t(a(s.toArray(),l.toArray()))},"Matrix, Array":function(s,l){return t(a(s.toArray(),l))},"Array, Matrix":function(s,l){return t(a(s,l.toArray()))},"Array, Array":a});function a(i,s){if(ur(i).length===1&&(i=[i]),ur(s).length===1&&(s=[s]),ur(i).length>2||ur(s).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(i.length)+", y = "+JSON.stringify(s.length)+")");var l=[],c=[];return i.map(function(o){return s.map(function(u){return c=[],l.push(c),o.map(function(m){return u.map(function(d){return c.push(n(m,d))})})})})&&l}});var pC="map",ZW=["typed"],pd=F(pC,ZW,e=>{var{typed:r}=e;return r(pC,{"Array, function":QW,"Matrix, function":function(n,a){return n.map(a)}})});function QW(e,r){var t=function n(a,i){return Array.isArray(a)?a.map(function(s,l){return n(s,i.concat(l))}):Ra(r,a,i,e,"map")};return t(e,[])}var dC="diff",XW=["typed","matrix","subtract","number"],Yu=F(dC,XW,e=>{var{typed:r,matrix:t,subtract:n,number:a}=e;return r(dC,{"Array | Matrix":function(u){return Qe(u)?t(s(u.toArray())):s(u)},"Array | Matrix, number":function(u,m){if(!Ze(m))throw new RangeError("Dimension must be a whole number");return Qe(u)?t(i(u.toArray(),m)):i(u,m)},"Array, BigNumber":r.referTo("Array,number",o=>(u,m)=>o(u,a(m))),"Matrix, BigNumber":r.referTo("Matrix,number",o=>(u,m)=>o(u,a(m)))});function i(o,u){if(Qe(o)&&(o=o.toArray()),!Array.isArray(o))throw RangeError("Array/Matrix does not have that many dimensions");if(u>0){var m=[];return o.forEach(d=>{m.push(i(d,u-1))}),m}else{if(u===0)return s(o);throw RangeError("Cannot have negative dimension")}}function s(o){for(var u=[],m=o.length,d=1;d{var{typed:r,config:t,matrix:n,BigNumber:a}=e;return r("ones",{"":function(){return t.matrix==="Array"?i([]):i([],"default")},"...number | BigNumber | string":function(o){var u=o[o.length-1];if(typeof u=="string"){var m=o.pop();return i(o,m)}else return t.matrix==="Array"?i(o):i(o,"default")},Array:i,Matrix:function(o){var u=o.storage();return i(o.valueOf(),u)},"Array | Matrix, string":function(o,u){return i(o.valueOf(),u)}});function i(c,o){var u=s(c),m=u?new a(1):1;if(l(c),o){var d=n(o);return c.length>0?d.resize(c,m):d}else{var h=[];return c.length>0?ii(h,c,m):h}}function s(c){var o=!1;return c.forEach(function(u,m,d){rr(u)&&(o=!0,d[m]=u.toNumber())}),o}function l(c){c.forEach(function(o){if(typeof o!="number"||!Ze(o)||o<0)throw new Error("Parameters in function ones must be positive integers")})}});function Hu(){throw new Error('No "bignumber" implementation available')}function hd(){throw new Error('No "fraction" implementation available')}function vd(){throw new Error('No "matrix" implementation available')}var hC="range",jW=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],$u=F(hC,jW,e=>{var{typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:s,larger:l,largerEq:c,add:o,isPositive:u}=e;return r(hC,{string:d,"string, boolean":d,"number, number":function(x,w){return m(h(x,w,1,!1))},"number, number, number":function(x,w,C){return m(h(x,w,C,!1))},"number, number, boolean":function(x,w,C){return m(h(x,w,1,C))},"number, number, number, boolean":function(x,w,C,b){return m(h(x,w,C,b))},"BigNumber, BigNumber":function(x,w){var C=x.constructor;return m(h(x,w,new C(1),!1))},"BigNumber, BigNumber, BigNumber":function(x,w,C){return m(h(x,w,C,!1))},"BigNumber, BigNumber, boolean":function(x,w,C){var b=x.constructor;return m(h(x,w,new b(1),C))},"BigNumber, BigNumber, BigNumber, boolean":function(x,w,C,b){return m(h(x,w,C,b))},"Unit, Unit, Unit":function(x,w,C){return m(h(x,w,C,!1))},"Unit, Unit, Unit, boolean":function(x,w,C,b){return m(h(x,w,C,b))}});function m(v){return t.matrix==="Matrix"?n?n(v):vd():v}function d(v,x){var w=y(v);if(!w)throw new SyntaxError('String "'+v+'" is no valid range');return t.number==="BigNumber"?(a===void 0&&Hu(),m(h(a(w.start),a(w.end),a(w.step)),x)):m(h(w.start,w.end,w.step,x))}function h(v,x,w,C){for(var b=[],N=u(w)?C?s:i:C?c:l,M=v;N(M,x);)b.push(M),M=o(M,w);return b}function y(v){var x=v.split(":"),w=x.map(function(b){return Number(b)}),C=w.some(function(b){return isNaN(b)});if(C)return null;switch(w.length){case 2:return{start:w[0],end:w[1],step:1};case 3:return{start:w[0],end:w[2],step:w[1]};default:return null}}});var vC="reshape",eY=["typed","isInteger","matrix"],gd=F(vC,eY,e=>{var{typed:r,isInteger:t}=e;return r(vC,{"Matrix, Array":function(a,i){return a.reshape(i,!0)},"Array, Array":function(a,i){return i.forEach(function(s){if(!t(s))throw new TypeError("Invalid size for dimension: "+s)}),Ac(a,i)}})});var rY="resize",tY=["config","matrix"],yd=F(rY,tY,e=>{var{config:r,matrix:t}=e;return function(i,s,l){if(arguments.length!==2&&arguments.length!==3)throw new ga("resize",arguments.length,2,3);if(Qe(s)&&(s=s.valueOf()),rr(s[0])&&(s=s.map(function(u){return rr(u)?u.toNumber():u})),Qe(i))return i.resize(s,l,!0);if(typeof i=="string")return n(i,s,l);var c=Array.isArray(i)?!1:r.matrix!=="Array";if(s.length===0){for(;Array.isArray(i);)i=i[0];return ar(i)}else{Array.isArray(i)||(i=[i]),i=ar(i);var o=ii(i,s,l);return c?t(o):o}};function n(a,i,s){if(s!==void 0){if(typeof s!="string"||s.length!==1)throw new TypeError("Single character expected as defaultValue")}else s=" ";if(i.length!==1)throw new pr(i.length,1);var l=i[0];if(typeof l!="number"||!Ze(l))throw new TypeError("Invalid size, must contain positive integers (size: "+lr(i)+")");if(a.length>l)return a.substring(0,l);if(a.length{var{typed:r,multiply:t,rotationMatrix:n}=e;return r(gC,{"Array , number | BigNumber | Complex | Unit":function(s,l){a(s,2);var c=t(n(l),s);return c.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(s,l){return a(s,2),t(n(l),s)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(s,l,c){a(s,3);var o=t(n(l,c),s);return o},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(s,l,c){return a(s,3),t(n(l,c),s)}});function a(i,s){var l=Array.isArray(i)?ur(i):i.size();if(l.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(s));if(l.length===2&&l[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(s));if(l[0]!==s)throw new RangeError("Vector must be of dimensions 1x".concat(s))}});var yC="rotationMatrix",aY=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],bd=F(yC,aY,e=>{var{typed:r,config:t,multiplyScalar:n,addScalar:a,unaryMinus:i,norm:s,BigNumber:l,matrix:c,DenseMatrix:o,SparseMatrix:u,cos:m,sin:d}=e;return r(yC,{"":function(){return t.matrix==="Matrix"?c([]):[]},string:function(b){return c(b)},"number | BigNumber | Complex | Unit":function(b){return h(b,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(b,N){return h(b,N)},"number | BigNumber | Complex | Unit, Array":function(b,N){var M=c(N);return y(M),w(b,M,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(b,N){y(N);var M=N.storage()||(t.matrix==="Matrix"?"dense":void 0);return w(b,N,M)},"number | BigNumber | Complex | Unit, Array, string":function(b,N,M){var S=c(N);return y(S),w(b,S,M)},"number | BigNumber | Complex | Unit, Matrix, string":function(b,N,M){return y(N),w(b,N,M)}});function h(C,b){var N=rr(C),M=N?new l(-1):-1,S=m(C),O=d(C),_=[[S,n(M,O)],[O,S]];return x(_,b)}function y(C){var b=C.size();if(b.length<1||b[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function v(C){return C.reduce((b,N)=>n(b,N))}function x(C,b){if(b){if(b==="sparse")return new u(C);if(b==="dense")return new o(C);throw new TypeError('Unknown matrix type "'.concat(b,'"'))}return C}function w(C,b,N){var M=s(b);if(M===0)throw new RangeError("Rotation around zero vector");var S=rr(C)?l:null,O=S?new S(1):1,_=S?new S(-1):-1,E=S?new S(b.get([0])/M):b.get([0])/M,T=S?new S(b.get([1])/M):b.get([1])/M,R=S?new S(b.get([2])/M):b.get([2])/M,L=m(C),H=a(O,i(L)),V=d(C),W=a(L,v([E,E,H])),k=a(v([E,T,H]),v([_,R,V])),q=a(v([E,R,H]),v([T,V])),K=a(v([E,T,H]),v([R,V])),z=a(L,v([T,T,H])),oe=a(v([T,R,H]),v([_,E,V])),le=a(v([E,R,H]),v([_,T,V])),ae=a(v([T,R,H]),v([E,V])),$=a(L,v([R,R,H])),me=[[W,k,q],[K,z,oe],[le,ae,$]];return x(me,N)}});var xC="row",iY=["typed","Index","matrix","range"],Gu=F(xC,iY,e=>{var{typed:r,Index:t,matrix:n,range:a}=e;return r(xC,{"Matrix, number":i,"Array, number":function(l,c){return i(n(ar(l)),c).valueOf()}});function i(s,l){if(s.size().length!==2)throw new Error("Only two dimensional matrix is supported");Kr(l,s.size()[0]);var c=a(0,s.size()[1]),o=new t(l,c),u=s.subset(o);return Qe(u)?u:n([[u]])}});var bC="size",oY=["typed","config","?matrix"],wd=F(bC,oY,e=>{var{typed:r,config:t,matrix:n}=e;return r(bC,{Matrix:function(i){return i.create(i.size())},Array:ur,string:function(i){return t.matrix==="Array"?[i.length]:n([i.length])},"number | Complex | BigNumber | Unit | boolean | null":function(i){return t.matrix==="Array"?[]:n?n([]):vd()}})});var wC="squeeze",sY=["typed","matrix"],Dd=F(wC,sY,e=>{var{typed:r,matrix:t}=e;return r(wC,{Array:function(a){return Au(ar(a))},Matrix:function(a){var i=Au(a.toArray());return Array.isArray(i)?t(i):i},any:function(a){return ar(a)}})});var DC="subset",uY=["typed","matrix","zeros","add"],Vu=F(DC,uY,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e;return r(DC,{"Matrix, Index":function(l,c){return As(c)?t():(Nc(l,c),l.subset(c))},"Array, Index":r.referTo("Matrix, Index",function(s){return function(l,c){var o=s(t(l),c);return c.isScalar()?o:o.valueOf()}}),"Object, Index":cY,"string, Index":fY,"Matrix, Index, any, any":function(l,c,o,u){return As(c)?l:(Nc(l,c),l.clone().subset(c,i(o,c),u))},"Array, Index, any, any":r.referTo("Matrix, Index, any, any",function(s){return function(l,c,o,u){var m=s(t(l),c,o,u);return m.isMatrix?m.valueOf():m}}),"Array, Index, any":r.referTo("Matrix, Index, any, any",function(s){return function(l,c,o){return s(t(l),c,o,void 0).valueOf()}}),"Matrix, Index, any":r.referTo("Matrix, Index, any, any",function(s){return function(l,c,o){return s(l,c,o,void 0)}}),"string, Index, string":SC,"string, Index, string, string":SC,"Object, Index, any":lY});function i(s,l){if(typeof s=="string")throw new Error("can't boradcast a string");if(l._isScalar)return s;var c=l.size();if(c.every(o=>o>0))try{return a(s,n(c))}catch{return s}else return s}});function fY(e,r){if(!Mi(r))throw new TypeError("Index expected");if(As(r))return"";if(Nc(Array.from(e),r),r.size().length!==1)throw new pr(r.size().length,1);var t=e.length;Kr(r.min()[0],t),Kr(r.max()[0],t);var n=r.dimension(0),a="";return n.forEach(function(i){a+=e.charAt(i)}),a}function SC(e,r,t,n){if(!r||r.isIndex!==!0)throw new TypeError("Index expected");if(As(r))return e;if(Nc(Array.from(e),r),r.size().length!==1)throw new pr(r.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var a=r.dimension(0),i=a.size()[0];if(i!==t.length)throw new pr(a.size()[0],t.length);var s=e.length;Kr(r.min()[0]),Kr(r.max()[0]);for(var l=[],c=0;cs)for(var o=s-1,u=l.length;o{var{typed:r,matrix:t}=e;return r(NC,{Array:s=>n(t(s)).valueOf(),Matrix:n,any:ar});function n(s){var l=s.size(),c;switch(l.length){case 1:c=s.clone();break;case 2:{var o=l[0],u=l[1];if(u===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+lr(l)+")");switch(s.storage()){case"dense":c=a(s,o,u);break;case"sparse":c=i(s,o,u);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+lr(l)+")")}return c}function a(s,l,c){for(var o=s._data,u=[],m,d=0;d{var{typed:r,transpose:t,conj:n}=e;return r(AC,{any:function(i){return n(t(i))}})});var MC="zeros",dY=["typed","config","matrix","BigNumber"],Ad=F(MC,dY,e=>{var{typed:r,config:t,matrix:n,BigNumber:a}=e;return r(MC,{"":function(){return t.matrix==="Array"?i([]):i([],"default")},"...number | BigNumber | string":function(o){var u=o[o.length-1];if(typeof u=="string"){var m=o.pop();return i(o,m)}else return t.matrix==="Array"?i(o):i(o,"default")},Array:i,Matrix:function(o){var u=o.storage();return i(o.valueOf(),u)},"Array | Matrix, string":function(o,u){return i(o.valueOf(),u)}});function i(c,o){var u=s(c),m=u?new a(0):0;if(l(c),o){var d=n(o);return c.length>0?d.resize(c,m):d}else{var h=[];return c.length>0?ii(h,c,m):h}}function s(c){var o=!1;return c.forEach(function(u,m,d){rr(u)&&(o=!0,d[m]=u.toNumber())}),o}function l(c){c.forEach(function(o){if(typeof o!="number"||!Ze(o)||o<0)throw new Error("Parameters in function zeros must be positive integers")})}});var CC="fft",hY=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],Md=F(CC,hY,e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:a,divideScalar:i,exp:s,tau:l,i:c,dotDivide:o,conj:u,pow:m,ceil:d,log2:h}=e;return r(CC,{Array:y,Matrix:function(b){return b.create(y(b.toArray()))}});function y(C){var b=ur(C);return b.length===1?w(C,b[0]):v(C.map(N=>y(N,b.slice(1))),0)}function v(C,b){var N=ur(C);if(b!==0)return new Array(N[0]).fill(0).map((S,O)=>v(C[O],b-1));if(N.length===1)return w(C);function M(S){var O=ur(S);return new Array(O[1]).fill(0).map((_,E)=>new Array(O[0]).fill(0).map((T,R)=>S[R][E]))}return M(v(M(C),1))}function x(C){for(var b=C.length,N=s(i(a(-1,a(c,l)),b)),M=[],S=1-b;Sa(C[q],M[b-1+q])),...new Array(O-b).fill(0)],E=[...new Array(b+b-1).fill(0).map((k,q)=>i(1,M[q])),...new Array(O-(b+b-1)).fill(0)],T=w(_),R=w(E),L=new Array(O).fill(0).map((k,q)=>a(T[q],R[q])),H=o(u(y(u(L))),O),V=[],W=b-1;WE%2===0),b/2),...w(C.filter((_,E)=>E%2===1),b/2)],M=0;M{var{typed:r,fft:t,dotDivide:n,conj:a}=e;return r(EC,{"Array | Matrix":function(s){var l=Qe(s)?s.size():ur(s);return n(a(t(a(s))),l.reduce((c,o)=>c*o,1))}})});function TC(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function gY(e){for(var r=1;r{var{typed:r,add:t,subtract:n,multiply:a,divide:i,max:s,map:l,abs:c,isPositive:o,isNegative:u,larger:m,smaller:d,matrix:h,bignumber:y,unaryMinus:v}=e;function x(_){return function(E,T,R,L){var H=!(T.length===2&&(T.every(S)||T.every(Ht)));if(H)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var V=T[0],W=T[1],k=m(W,V),q=L.firstStep;if(q!==void 0&&!o(q))throw new Error('"firstStep" must be positive');var K=L.maxStep;if(K!==void 0&&!o(K))throw new Error('"maxStep" must be positive');var z=L.minStep;if(z&&u(z))throw new Error('"minStep" must be positive or zero');var oe=[V,W,q,z,K].filter(Le=>Le!==void 0);if(!(oe.every(S)||oe.every(Ht)))throw new Error('Inconsistent type of "t" dependant variables');for(var le=1,ae=L.tol?L.tol:1e-4,$=L.minDelta?L.minDelta:.2,me=L.maxDelta?L.maxDelta:5,Ee=L.maxIter?L.maxIter:1e4,pe=[V,W,...R,K,z].some(rr),[ge,Se,ye,be]=pe?[y(_.a),y(_.c),y(_.b),y(_.bp)]:[_.a,_.c,_.b,_.bp],De=q?k?q:v(q):i(n(W,V),le),Ae=[V],We=[R],Je=n(ye,be),J=0,re=0,xe=N(k),j=M(k);xe(Ae[J],W);){var ne=[];De=j(Ae[J],W,De),ne.push(E(Ae[J],We[J]));for(var ue=1;ueHt(Le)?Le.value:Le)));Me1/4&&(Ae.push(t(Ae[J],De)),We.push(t(We[J],a(De,ye,ne))),J++);var Ce=.84*(ae/Me)**(1/5);if(d(Ce,$)?Ce=$:m(Ce,me)&&(Ce=me),Ce=pe?y(Ce):Ce,De=a(De,Ce),K&&m(c(De),K)?De=k?K:v(K):z&&d(c(De),z)&&(De=k?z:v(z)),re++,re>Ee)throw new Error("Maximum number of iterations reached, try changing options")}return{t:Ae,y:We}}}function w(_,E,T,R){var L=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],H=[null,1/2,3/4,1],V=[2/9,1/3,4/9,0],W=[7/24,1/4,1/3,1/8],k={a:L,c:H,b:V,bp:W};return x(k)(_,E,T,R)}function C(_,E,T,R){var L=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],H=[null,1/5,3/10,4/5,8/9,1,1],V=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],W=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],k={a:L,c:H,b:V,bp:W};return x(k)(_,E,T,R)}function b(_,E,T,R){var L=R.method?R.method:"RK45",H={RK23:w,RK45:C};if(L.toUpperCase()in H){var V=gY({},R);return delete V.method,H[L.toUpperCase()](_,E,T,V)}else{var W=Object.keys(H).map(q=>'"'.concat(q,'"')),k="".concat(W.slice(0,-1).join(", ")," and ").concat(W.slice(-1));throw new Error('Unavailable method "'.concat(L,'". Available methods are ').concat(k))}}function N(_){return _?d:m}function M(_){var E=_?m:d;return function(T,R,L){var H=t(T,L);return E(H,R)?n(R,T):L}}function S(_){return rr(_)||sr(_)}function O(_,E,T,R){var L=b(_,E.toArray(),T.toArray(),R);return{t:h(L.t),y:h(L.y)}}return r("solveODE",{"function, Array, Array, Object":b,"function, Matrix, Matrix, Object":O,"function, Array, Array":(_,E,T)=>b(_,E,T,{}),"function, Matrix, Matrix":(_,E,T)=>O(_,E,T,{}),"function, Array, number | BigNumber | Unit":(_,E,T)=>{var R=b(_,E,[T],{});return{t:R.t,y:R.y.map(L=>L[0])}},"function, Matrix, number | BigNumber | Unit":(_,E,T)=>{var R=b(_,E.toArray(),[T],{});return{t:h(R.t),y:h(R.y.map(L=>L[0]))}},"function, Array, number | BigNumber | Unit, Object":(_,E,T,R)=>{var L=b(_,E,[T],R);return{t:L.t,y:L.y.map(H=>H[0])}},"function, Matrix, number | BigNumber | Unit, Object":(_,E,T,R)=>{var L=b(_,E.toArray(),[T],R);return{t:h(L.t),y:h(L.y.map(H=>H[0]))}}})});var bY="erf",wY=["typed"],Td=F(bY,wY,e=>{var{typed:r}=e;return r("name",{number:function(s){var l=Math.abs(s);return l>=NY?Ba(s):l<=DY?Ba(s)*t(l):l<=4?Ba(s)*(1-n(l)):Ba(s)*(1-a(l))},"Array | Matrix":r.referToSelf(i=>s=>je(s,i))});function t(i){var s=i*i,l=to[0][4]*s,c=s,o;for(o=0;o<3;o+=1)l=(l+to[0][o])*s,c=(c+Zu[0][o])*s;return i*(l+to[0][3])/(c+Zu[0][3])}function n(i){var s=to[1][8]*i,l=i,c;for(c=0;c<7;c+=1)s=(s+to[1][c])*i,l=(l+Zu[1][c])*i;var o=(s+to[1][7])/(l+Zu[1][7]),u=parseInt(i*16)/16,m=(i-u)*(i+u);return Math.exp(-u*u)*Math.exp(-m)*o}function a(i){var s=1/(i*i),l=to[2][5]*s,c=s,o;for(o=0;o<4;o+=1)l=(l+to[2][o])*s,c=(c+Zu[2][o])*s;var u=s*(l+to[2][4])/(c+Zu[2][4]);u=(SY-u)/i,s=parseInt(i*16)/16;var m=(i-s)*(i+s);return Math.exp(-s*s)*Math.exp(-m)*u}}),DY=.46875,SY=.5641895835477563,to=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Zu=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],NY=Math.pow(2,53);var FC="zeta",AY=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],Fd=F(FC,AY,e=>{var{typed:r,config:t,multiply:n,pow:a,divide:i,factorial:s,equal:l,smallerEq:c,isNegative:o,gamma:u,sin:m,subtract:d,add:h,Complex:y,BigNumber:v,pi:x}=e;return r(FC,{number:S=>w(S,O=>O,()=>20),BigNumber:S=>w(S,O=>new v(O),()=>Math.abs(Math.log10(t.epsilon))),Complex:C});function w(S,O,_){return l(S,0)?O(-.5):l(S,1)?O(NaN):isFinite(S)?b(S,O,_,E=>E):o(S)?O(NaN):O(1)}function C(S){return S.re===0&&S.im===0?new y(-.5):S.re===1?new y(NaN,NaN):S.re===1/0&&S.im===0?new y(1):S.im===1/0||S.re===-1/0?new y(NaN,NaN):b(S,O=>O,O=>Math.round(1.3*15+.9*Math.abs(O.im)),O=>O.re)}function b(S,O,_,E){var T=_(S);if(E(S)>-(T-1)/2)return M(S,O(T),O);var R=n(a(2,S),a(O(x),d(S,1)));return R=n(R,m(n(i(O(x),2),S))),R=n(R,u(d(1,S))),n(R,b(d(1,S),O,_,E))}function N(S,O){for(var _=S,E=S;c(E,O);E=h(E,1)){var T=i(n(s(h(O,d(E,1))),a(4,E)),n(s(d(O,E)),s(n(2,E))));_=h(_,T)}return n(O,_)}function M(S,O,_){for(var E=i(1,n(N(_(0),O),d(1,a(2,d(1,S))))),T=_(0),R=_(1);c(R,O);R=h(R,1))T=h(T,i(n((-1)**(R-1),N(R,O)),a(R,S)));return n(E,T)}});var _C="mode",MY=["typed","isNaN","isNumeric"],_d=F(_C,MY,e=>{var{typed:r,isNaN:t,isNumeric:n}=e;return r(_C,{"Array | Matrix":a,"...":function(s){return a(s)}});function a(i){i=gr(i.valueOf());var s=i.length;if(s===0)throw new Error("Cannot calculate mode of an empty array");for(var l={},c=[],o=0,u=0;uo&&(o=l[m],c=[m])}return c}});function Et(e,r,t){var n;return String(e).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+Tr(t)+", value: "+JSON.stringify(t)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+r+", unexpected type of argument"+n)):String(e).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+Tr(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+r+", no ordering relation is defined for complex numbers"+n)):e}var OC="prod",CY=["typed","config","multiplyScalar","numeric"],Od=F(OC,CY,e=>{var{typed:r,config:t,multiplyScalar:n,numeric:a}=e;return r(OC,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(l,c){throw new Error("prod(A, dim) is not yet supported")},"...":function(l){return i(l)}});function i(s){var l;if(An(s,function(c){try{l=l===void 0?c:n(l,c)}catch(o){throw Et(o,"prod",c)}}),typeof l=="string"&&(l=a(l,t.number)),l===void 0)throw new Error("Cannot calculate prod of an empty array");return l}});var BC="format",EY=["typed"],Bd=F(BC,EY,e=>{var{typed:r}=e;return r(BC,{any:lr,"any, Object | function | number | BigNumber":lr})});var PC="bin",TY=["typed","format"],Pd=F(PC,TY,e=>{var{typed:r,format:t}=e;return r(PC,{"number | BigNumber":function(a){return t(a,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(a,i){return t(a,{notation:"bin",wordSize:i})}})});var IC="oct",FY=["typed","format"],Id=F(IC,FY,e=>{var{typed:r,format:t}=e;return r(IC,{"number | BigNumber":function(a){return t(a,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(a,i){return t(a,{notation:"oct",wordSize:i})}})});var RC="hex",_Y=["typed","format"],Rd=F(RC,_Y,e=>{var{typed:r,format:t}=e;return r(RC,{"number | BigNumber":function(a){return t(a,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(a,i){return t(a,{notation:"hex",wordSize:i})}})});var qd=/\\$([\\w.]+)/g;var qC="print",OY=["typed"],Qu=F(qC,OY,e=>{var{typed:r}=e;return r(qC,{"string, Object | Array":kC,"string, Object | Array, number | Object":kC})});function kC(e,r,t){return e.replace(qd,function(n,a){var i=a.split("."),s=r[i.shift()];for(s!==void 0&&s.isMatrix&&(s=s.toArray());i.length&&s!==void 0;){var l=i.shift();s=l?s[l]:s+"."}return s!==void 0?St(s)?s:lr(s,t):n})}var LC="to",BY=["typed","matrix","concat"],kd=F(LC,BY,e=>{var{typed:r,matrix:t,concat:n}=e,a=vr({typed:r,matrix:t,concat:n});return r(LC,{"Unit, Unit | string":(i,s)=>i.to(s)},a({Ds:!0}))});var zC="isPrime",PY=["typed"],Ld=F(zC,PY,e=>{var{typed:r}=e;return r(zC,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var a=5;a*a<=n;a+=6)if(n%a===0||n%(a+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var a=n.toNumber(),i=5;i*i<=a;i+=6)if(a%i===0||a%(i+2)===0)return!1;return!0}function s(C,b,N){for(var M=1;!b.eq(0);)b.mod(2).eq(0)?(b=b.div(2),C=C.mul(C).mod(N)):(b=b.sub(1),M=C.mul(M).mod(N));return M}var l=n.constructor.clone({precision:n.toFixed(0).length*2});n=new l(n);for(var c=0,o=n.sub(1);o.mod(2).eq(0);)o=o.div(2),c+=1;var u=null;if(n.lt("3317044064679887385961981"))u=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(C=>Cn=>je(n,t))})});var IY="numeric",RY=["number","?bignumber","?fraction"],zd=F(IY,RY,e=>{var{number:r,bignumber:t,fraction:n}=e,a={string:!0,number:!0,BigNumber:!0,Fraction:!0},i={number:s=>r(s),BigNumber:t?s=>t(s):Hu,Fraction:n?s=>n(s):hd};return function(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",o=arguments.length>2?arguments[2]:void 0;if(o!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var u=Tr(l);if(!(u in a))throw new TypeError("Cannot convert "+l+' of type "'+u+'"; valid input types are '+Object.keys(a).join(", "));if(!(c in i))throw new TypeError("Cannot convert "+l+' to type "'+c+'"; valid output types are '+Object.keys(i).join(", "));return c===u?l:i[c](l)}});var UC="divideScalar",qY=["typed","numeric"],Ud=F(UC,qY,e=>{var{typed:r,numeric:t}=e;return r(UC,{"number, number":function(a,i){return a/i},"Complex, Complex":function(a,i){return a.div(i)},"BigNumber, BigNumber":function(a,i){return a.div(i)},"Fraction, Fraction":function(a,i){return a.div(i)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,a)=>n.divide(a),"number | Fraction | Complex | BigNumber, Unit":(n,a)=>a.divideInto(n)})});var WC="pow",kY=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Wd=F(WC,kY,e=>{var{typed:r,config:t,identity:n,multiply:a,matrix:i,inv:s,number:l,fraction:c,Complex:o}=e;return r(WC,{"number, number":u,"Complex, Complex":function(y,v){return y.pow(v)},"BigNumber, BigNumber":function(y,v){return v.isInteger()||y>=0||t.predictable?y.pow(v):new o(y.toNumber(),0).pow(v.toNumber(),0)},"Fraction, Fraction":function(y,v){var x=y.pow(v);if(x!=null)return x;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return u(y.valueOf(),v.valueOf())},"Array, number":m,"Array, BigNumber":function(y,v){return m(y,v.toNumber())},"Matrix, number":d,"Matrix, BigNumber":function(y,v){return d(y,v.toNumber())},"Unit, number | BigNumber":function(y,v){return y.pow(v)}});function u(h,y){if(t.predictable&&!Ze(y)&&h<0)try{var v=c(y),x=l(v);if((y===x||Math.abs((y-x)/y)<1e-14)&&v.d%2===1)return(v.n%2===0?1:-1)*Math.pow(-h,y)}catch{}return t.predictable&&(h<-1&&y===1/0||h>-1&&h<0&&y===-1/0)?NaN:Ze(y)||h>=0||t.predictable?Tw(h,y):h*h<1&&y===1/0||h*h>1&&y===-1/0?0:new o(h,0).pow(y,0)}function m(h,y){if(!Ze(y))throw new TypeError("For A^b, b must be an integer (value is "+y+")");var v=ur(h);if(v.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+v.length+" dimensions)");if(v[0]!==v[1])throw new Error("For A^b, A must be square (size is "+v[0]+"x"+v[1]+")");if(y<0)try{return m(s(h),-y)}catch(C){throw C.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+y+")"):C}for(var x=n(v[0]).valueOf(),w=h;y>=1;)(y&1)===1&&(x=a(w,x)),y>>=1,w=a(w,w);return x}function d(h,y){return i(m(h.valueOf(),y))}});var Xu="Number of decimals in function round must be an integer",YC="round",LY=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Yd=F(YC,LY,e=>{var{typed:r,config:t,matrix:n,equalScalar:a,zeros:i,BigNumber:s,DenseMatrix:l}=e,c=jr({typed:r,equalScalar:a}),o=Wr({typed:r,DenseMatrix:l}),u=kt({typed:r});function m(d){return Math.abs(Nu(d).exponent)}return r(YC,{number:function(h){var y=Ou(h,m(t.epsilon)),v=At(h,y,t.epsilon)?y:h;return Ou(v)},"number, number":function(h,y){var v=m(t.epsilon);if(y>=v)return Ou(h,y);var x=Ou(h,v),w=At(h,x,t.epsilon)?x:h;return Ou(w,y)},"number, BigNumber":function(h,y){if(!y.isInteger())throw new TypeError(Xu);return new s(h).toDecimalPlaces(y.toNumber())},Complex:function(h){return h.round()},"Complex, number":function(h,y){if(y%1)throw new TypeError(Xu);return h.round(y)},"Complex, BigNumber":function(h,y){if(!y.isInteger())throw new TypeError(Xu);var v=y.toNumber();return h.round(v)},BigNumber:function(h){var y=new s(h).toDecimalPlaces(m(t.epsilon)),v=$t(h,y,t.epsilon)?y:h;return v.toDecimalPlaces(0)},"BigNumber, BigNumber":function(h,y){if(!y.isInteger())throw new TypeError(Xu);var v=m(t.epsilon);if(y>=v)return h.toDecimalPlaces(y.toNumber());var x=h.toDecimalPlaces(v),w=$t(h,x,t.epsilon)?x:h;return w.toDecimalPlaces(y.toNumber())},Fraction:function(h){return h.round()},"Fraction, number":function(h,y){if(y%1)throw new TypeError(Xu);return h.round(y)},"Fraction, BigNumber":function(h,y){if(!y.isInteger())throw new TypeError(Xu);return h.round(y.toNumber())},"Unit, number, Unit":r.referToSelf(d=>function(h,y,v){var x=h.toNumeric(v);return v.multiply(d(x,y))}),"Unit, BigNumber, Unit":r.referToSelf(d=>(h,y,v)=>d(h,y.toNumber(),v)),"Unit, Unit":r.referToSelf(d=>(h,y)=>d(h,0,y)),"Array | Matrix, number, Unit":r.referToSelf(d=>(h,y,v)=>je(h,x=>d(x,y,v),!0)),"Array | Matrix, BigNumber, Unit":r.referToSelf(d=>(h,y,v)=>d(h,y.toNumber(),v)),"Array | Matrix, Unit":r.referToSelf(d=>(h,y)=>d(h,0,y)),"Array | Matrix":r.referToSelf(d=>h=>je(h,d,!0)),"SparseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>c(h,y,d,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(d=>(h,y)=>u(h,y,d,!1)),"Array, number | BigNumber":r.referToSelf(d=>(h,y)=>u(n(h),y,d,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":r.referToSelf(d=>(h,y)=>a(h,0)?i(y.size(),y.storage()):o(y,h,d,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":r.referToSelf(d=>(h,y)=>a(h,0)?i(y.size(),y.storage()):u(y,h,d,!0)),"number | Complex | BigNumber | Fraction, Array":r.referToSelf(d=>(h,y)=>u(n(y),h,d,!0).valueOf())})});var HC="log",zY=["config","typed","divideScalar","Complex"],Hd=F(HC,zY,e=>{var{typed:r,config:t,divideScalar:n,Complex:a}=e;return r(HC,{number:function(s){return s>=0||t.predictable?VM(s):new a(s,0).log()},Complex:function(s){return s.log()},BigNumber:function(s){return!s.isNegative()||t.predictable?s.ln():new a(s.toNumber(),0).log()},"any, any":r.referToSelf(i=>(s,l)=>n(i(s),i(l)))})});var $C="log1p",UY=["typed","config","divideScalar","log","Complex"],$d=F($C,UY,e=>{var{typed:r,config:t,divideScalar:n,log:a,Complex:i}=e;return r($C,{number:function(c){return c>=-1||t.predictable?Am(c):s(new i(c,0))},Complex:s,BigNumber:function(c){var o=c.plus(1);return!o.isNegative()||t.predictable?o.ln():s(new i(c.toNumber(),0))},"Array | Matrix":r.referToSelf(l=>c=>je(c,l)),"any, any":r.referToSelf(l=>(c,o)=>n(l(c),a(o)))});function s(l){var c=l.re+1;return new i(Math.log(Math.sqrt(c*c+l.im*l.im)),Math.atan2(l.im,c))}});var GC="nthRoots",WY=["config","typed","divideScalar","Complex"],Gd=F(GC,WY,e=>{var{typed:r,config:t,divideScalar:n,Complex:a}=e,i=[function(c){return new a(c,0)},function(c){return new a(0,c)},function(c){return new a(-c,0)},function(c){return new a(0,-c)}];function s(l,c){if(c<0)throw new Error("Root must be greater than zero");if(c===0)throw new Error("Root must be non-zero");if(c%1!==0)throw new Error("Root must be an integer");if(l===0||l.abs()===0)return[new a(0,0)];var o=typeof l=="number",u;(o||l.re===0||l.im===0)&&(o?u=2*+(l<0):l.im===0?u=2*+(l.re<0):u=2*+(l.im<0)+1);for(var m=l.arg(),d=l.abs(),h=[],y=Math.pow(d,1/c),v=0;v{var{typed:r,equalScalar:t,matrix:n,pow:a,DenseMatrix:i,concat:s}=e,l=lt({typed:r}),c=Zt({typed:r,DenseMatrix:i}),o=jr({typed:r,equalScalar:t}),u=Wr({typed:r,DenseMatrix:i}),m=vr({typed:r,matrix:n,concat:s}),d={};for(var h in a.signatures)Object.prototype.hasOwnProperty.call(a.signatures,h)&&!h.includes("Matrix")&&!h.includes("Array")&&(d[h]=a.signatures[h]);var y=r(d);return r(VC,m({elop:y,SS:c,DS:l,Ss:o,sS:u}))});var ZC="dotDivide",HY=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],Zd=F(ZC,HY,e=>{var{typed:r,matrix:t,equalScalar:n,divideScalar:a,DenseMatrix:i,concat:s}=e,l=Lt({typed:r,equalScalar:n}),c=lt({typed:r}),o=Zt({typed:r,DenseMatrix:i}),u=jr({typed:r,equalScalar:n}),m=Wr({typed:r,DenseMatrix:i}),d=vr({typed:r,matrix:t,concat:s});return r(ZC,d({elop:a,SS:o,DS:c,SD:l,Ss:u,sS:m}))});function Oi(e){var{DenseMatrix:r}=e;return function(n,a,i){var s=n.size();if(s.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+lr(s)+")");var l=s[0],c=s[1];if(l!==c)throw new RangeError("Matrix must be square (size: "+lr(s)+")");var o=[];if(Qe(a)){var u=a.size(),m=a._data;if(u.length===1){if(u[0]!==l)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var d=0;d{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:a,subtractScalar:i,equalScalar:s,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(QC,{"SparseMatrix, Array | Matrix":function(d,h){return u(d,h)},"DenseMatrix, Array | Matrix":function(d,h){return o(d,h)},"Array, Array | Matrix":function(d,h){var y=t(d),v=o(y,h);return v.valueOf()}});function o(m,d){d=c(m,d,!0);for(var h=d._data,y=m._size[0],v=m._size[1],x=[],w=m._data,C=0;CN&&(O.push(x[R]),_.push(L))}if(s(S,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var H=n(M,S),V=0,W=_.length;V{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:a,subtractScalar:i,equalScalar:s,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(XC,{"SparseMatrix, Array | Matrix":function(d,h){return u(d,h)},"DenseMatrix, Array | Matrix":function(d,h){return o(d,h)},"Array, Array | Matrix":function(d,h){var y=t(d),v=o(y,h);return v.valueOf()}});function o(m,d){d=c(m,d,!0);for(var h=d._data,y=m._size[0],v=m._size[1],x=[],w=m._data,C=v-1;C>=0;C--){var b=h[C][0]||0,N=void 0;if(s(b,0))N=0;else{var M=w[C][C];if(s(M,0))throw new Error("Linear system cannot be solved since matrix is singular");N=n(b,M);for(var S=C-1;S>=0;S--)h[S]=[i(h[S][0]||0,a(N,w[S][C]))]}x[C]=[N]}return new l({data:x,size:[y,1]})}function u(m,d){d=c(m,d,!0);for(var h=d._data,y=m._size[0],v=m._size[1],x=m._values,w=m._index,C=m._ptr,b=[],N=v-1;N>=0;N--){var M=h[N][0]||0;if(s(M,0))b[N]=[0];else{for(var S=0,O=[],_=[],E=C[N],T=C[N+1],R=T-1;R>=E;R--){var L=w[R];L===N?S=x[R]:L{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:a,subtractScalar:i,equalScalar:s,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(JC,{"SparseMatrix, Array | Matrix":function(d,h){return u(d,h)},"DenseMatrix, Array | Matrix":function(d,h){return o(d,h)},"Array, Array | Matrix":function(d,h){var y=t(d),v=o(y,h);return v.map(x=>x.valueOf())}});function o(m,d){for(var h=[c(m,d,!0)._data.map(_=>_[0])],y=m._data,v=m._size[0],x=m._size[1],w=0;wnew l({data:_.map(E=>[E]),size:[v,1]}))}function u(m,d){for(var h=[c(m,d,!0)._data.map(le=>le[0])],y=m._size[0],v=m._size[1],x=m._values,w=m._index,C=m._ptr,b=0;bb&&(O.push(x[L]),_.push(H))}if(s(R,0))if(s(S[b],0)){if(M===0){var q=[...S];q[b]=1;for(var K=0,z=_.length;Knew l({data:le.map(ae=>[ae]),size:[y,1]}))}});var KC="usolveAll",ZY=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],Kd=F(KC,ZY,e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:a,subtractScalar:i,equalScalar:s,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(KC,{"SparseMatrix, Array | Matrix":function(d,h){return u(d,h)},"DenseMatrix, Array | Matrix":function(d,h){return o(d,h)},"Array, Array | Matrix":function(d,h){var y=t(d),v=o(y,h);return v.map(x=>x.valueOf())}});function o(m,d){for(var h=[c(m,d,!0)._data.map(_=>_[0])],y=m._data,v=m._size[0],x=m._size[1],w=x-1;w>=0;w--)for(var C=h.length,b=0;b=0;O--)S[O]=i(S[O],y[O][w]);h.push(S)}}else{if(b===0)return[];h.splice(b,1),b-=1,C-=1}else{N[w]=n(N[w],y[w][w]);for(var M=w-1;M>=0;M--)N[M]=i(N[M],a(N[w],y[M][w]))}}return h.map(_=>new l({data:_.map(E=>[E]),size:[v,1]}))}function u(m,d){for(var h=[c(m,d,!0)._data.map(le=>le[0])],y=m._size[0],v=m._size[1],x=m._values,w=m._index,C=m._ptr,b=v-1;b>=0;b--)for(var N=h.length,M=0;M=E;L--){var H=w[L];H===b?R=x[L]:Hnew l({data:le.map(ae=>[ae]),size:[y,1]}))}});var QY="matAlgo08xS0Sid",XY=["typed","equalScalar"],Ju=F(QY,XY,e=>{var{typed:r,equalScalar:t}=e;return function(a,i,s){var l=a._values,c=a._index,o=a._ptr,u=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType(),d=i._values,h=i._index,y=i._ptr,v=i._size,x=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(u.length!==v.length)throw new pr(u.length,v.length);if(u[0]!==v[0]||u[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+v+")");if(!l||!d)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var w=u[0],C=u[1],b,N=t,M=0,S=s;typeof m=="string"&&m===x&&m!=="mixed"&&(b=m,N=r.find(t,[b,b]),M=r.convert(0,b),S=r.find(s,[b,b]));for(var O=[],_=[],E=[],T=[],R=[],L,H,V,W,k=0;k{var{typed:r,matrix:t}=e;return{"Array, number":r.referTo("DenseMatrix, number",n=>(a,i)=>n(t(a),i).valueOf()),"Array, BigNumber":r.referTo("DenseMatrix, BigNumber",n=>(a,i)=>n(t(a),i).valueOf()),"number, Array":r.referTo("number, DenseMatrix",n=>(a,i)=>n(a,t(i)).valueOf()),"BigNumber, Array":r.referTo("BigNumber, DenseMatrix",n=>(a,i)=>n(a,t(i)).valueOf())}});var jC="leftShift",JY=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],jd=F(jC,JY,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,DenseMatrix:i,concat:s}=e,l=Mn({typed:r}),c=Lt({typed:r,equalScalar:n}),o=Ju({typed:r,equalScalar:n}),u=ra({typed:r,DenseMatrix:i}),m=jr({typed:r,equalScalar:n}),d=kt({typed:r}),h=vr({typed:r,matrix:t,concat:s}),y=Ku({typed:r,matrix:t});return r(jC,{"number, number":Pw,"BigNumber, BigNumber":Y2,"SparseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():m(x,w,v,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():d(x,w,v,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):u(w,x,v,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):d(w,x,v,!0))},y,h({SS:o,DS:l,SD:c}))});var eE="rightArithShift",KY=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],eh=F(eE,KY,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,DenseMatrix:i,concat:s}=e,l=Mn({typed:r}),c=Lt({typed:r,equalScalar:n}),o=Ju({typed:r,equalScalar:n}),u=ra({typed:r,DenseMatrix:i}),m=jr({typed:r,equalScalar:n}),d=kt({typed:r}),h=vr({typed:r,matrix:t,concat:s}),y=Ku({typed:r,matrix:t});return r(eE,{"number, number":Iw,"BigNumber, BigNumber":H2,"SparseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():m(x,w,v,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():d(x,w,v,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):u(w,x,v,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):d(w,x,v,!0))},y,h({SS:o,DS:l,SD:c}))});var rE="rightLogShift",jY=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],rh=F(rE,jY,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,DenseMatrix:i,concat:s}=e,l=Mn({typed:r}),c=Lt({typed:r,equalScalar:n}),o=Ju({typed:r,equalScalar:n}),u=ra({typed:r,DenseMatrix:i}),m=jr({typed:r,equalScalar:n}),d=kt({typed:r}),h=vr({typed:r,matrix:t,concat:s}),y=Ku({typed:r,matrix:t});return r(rE,{"number, number":Rw,"SparseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():m(x,w,v,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(v=>(x,w)=>n(w,0)?x.clone():d(x,w,v,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):u(w,x,v,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(v=>(x,w)=>n(x,0)?a(w.size(),w.storage()):d(w,x,v,!0))},y,h({SS:o,DS:l,SD:c}))});var tE="and",eH=["typed","matrix","equalScalar","zeros","not","concat"],ju=F(tE,eH,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s}=e,l=Lt({typed:r,equalScalar:n}),c=Uo({typed:r,equalScalar:n}),o=jr({typed:r,equalScalar:n}),u=kt({typed:r}),m=vr({typed:r,matrix:t,concat:s});return r(tE,{"number, number":Ww,"Complex, Complex":function(h,y){return(h.re!==0||h.im!==0)&&(y.re!==0||y.im!==0)},"BigNumber, BigNumber":function(h,y){return!h.isZero()&&!y.isZero()&&!h.isNaN()&&!y.isNaN()},"Unit, Unit":r.referToSelf(d=>(h,y)=>d(h.value||0,y.value||0)),"SparseMatrix, any":r.referToSelf(d=>(h,y)=>i(y)?a(h.size(),h.storage()):o(h,y,d,!1)),"DenseMatrix, any":r.referToSelf(d=>(h,y)=>i(y)?a(h.size(),h.storage()):u(h,y,d,!1)),"any, SparseMatrix":r.referToSelf(d=>(h,y)=>i(h)?a(h.size(),h.storage()):o(y,h,d,!0)),"any, DenseMatrix":r.referToSelf(d=>(h,y)=>i(h)?a(h.size(),h.storage()):u(y,h,d,!0)),"Array, any":r.referToSelf(d=>(h,y)=>d(t(h),y).valueOf()),"any, Array":r.referToSelf(d=>(h,y)=>d(h,t(y)).valueOf())},m({SS:c,DS:l}))});var th="compare",rH=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],nh=F(th,rH,e=>{var{typed:r,config:t,equalScalar:n,matrix:a,BigNumber:i,Fraction:s,DenseMatrix:l,concat:c}=e,o=lt({typed:r}),u=zo({typed:r,equalScalar:n}),m=Wr({typed:r,DenseMatrix:l}),d=vr({typed:r,matrix:a,concat:c}),h=Ia({typed:r});return r(th,tH({typed:r,config:t}),{"boolean, boolean":function(v,x){return v===x?0:v>x?1:-1},"BigNumber, BigNumber":function(v,x){return $t(v,x,t.epsilon)?new i(0):new i(v.cmp(x))},"Fraction, Fraction":function(v,x){return new s(v.compare(x))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},h,d({SS:u,DS:o,Ss:m}))}),tH=F(th,["typed","config"],e=>{var{typed:r,config:t}=e;return r(th,{"number, number":function(a,i){return At(a,i,t.epsilon)?0:a>i?1:-1}})});var _s=ma(aE(),1);var iE="compareNatural",nH=["typed","compare"],ah=F(iE,nH,e=>{var{typed:r,compare:t}=e,n=t.signatures["boolean,boolean"];return r(iE,{"any, any":a});function a(c,o){var u=Tr(c),m=Tr(o),d;if((u==="number"||u==="BigNumber"||u==="Fraction")&&(m==="number"||m==="BigNumber"||m==="Fraction"))return d=t(c,o),d.toString()!=="0"?d>0?1:-1:(0,_s.default)(u,m);var h=["Array","DenseMatrix","SparseMatrix"];if(h.includes(u)||h.includes(m))return d=i(a,c,o),d!==0?d:(0,_s.default)(u,m);if(u!==m)return(0,_s.default)(u,m);if(u==="Complex")return aH(c,o);if(u==="Unit")return c.equalBase(o)?a(c.value,o.value):s(a,c.formatUnits(),o.formatUnits());if(u==="boolean")return n(c,o);if(u==="string")return(0,_s.default)(c,o);if(u==="Object")return l(a,c,o);if(u==="null"||u==="undefined")return 0;throw new TypeError('Unsupported type of value "'+u+'"')}function i(c,o,u){return ha(o)&&ha(u)?s(c,o.toJSON().values,u.toJSON().values):ha(o)?i(c,o.toArray(),u):ha(u)?i(c,o,u.toArray()):Ji(o)?i(c,o.toJSON().data,u):Ji(u)?i(c,o,u.toJSON().data):Array.isArray(o)?Array.isArray(u)?s(c,o,u):i(c,o,[u]):i(c,[o],u)}function s(c,o,u){for(var m=0,d=Math.min(o.length,u.length);mu.length?1:o.lengthr.re?1:e.rer.im?1:e.im{var{typed:r,matrix:t,concat:n}=e,a=vr({typed:r,matrix:t,concat:n});return r(oE,Tm,a({elop:Tm,Ds:!0}))});var oh="equal",oH=["typed","matrix","equalScalar","DenseMatrix","concat"],sh=F(oh,oH,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:t,concat:i});return r(oh,sH({typed:r,equalScalar:n}),o({elop:n,SS:l,DS:s,Ss:c}))}),sH=F(oh,["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return r(oh,{"any, any":function(a,i){return a===null?i===null:i===null?a===null:a===void 0?i===void 0:i===void 0?a===void 0:t(a,i)}})});var sE="equalText",uH=["typed","compareText","isZero"],uh=F(sE,uH,e=>{var{typed:r,compareText:t,isZero:n}=e;return r(sE,{"any, any":function(i,s){return n(t(i,s))}})});var fh="smaller",fH=["typed","config","matrix","DenseMatrix","concat"],ch=F(fh,fH,e=>{var{typed:r,config:t,matrix:n,DenseMatrix:a,concat:i}=e,s=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:n,concat:i}),u=Ia({typed:r});return r(fh,cH({typed:r,config:t}),{"boolean, boolean":(m,d)=>mm.compare(d)===-1,"Complex, Complex":function(d,h){throw new TypeError("No ordering relation is defined for complex numbers")}},u,o({SS:l,DS:s,Ss:c}))}),cH=F(fh,["typed","config"],e=>{var{typed:r,config:t}=e;return r(fh,{"number, number":function(a,i){return a{var{typed:r,config:t,matrix:n,DenseMatrix:a,concat:i}=e,s=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:n,concat:i}),u=Ia({typed:r});return r(lh,mH({typed:r,config:t}),{"boolean, boolean":(m,d)=>m<=d,"BigNumber, BigNumber":function(d,h){return d.lte(h)||$t(d,h,t.epsilon)},"Fraction, Fraction":(m,d)=>m.compare(d)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},u,o({SS:l,DS:s,Ss:c}))}),mH=F(lh,["typed","config"],e=>{var{typed:r,config:t}=e;return r(lh,{"number, number":function(a,i){return a<=i||At(a,i,t.epsilon)}})});var ph="larger",pH=["typed","config","matrix","DenseMatrix","concat"],dh=F(ph,pH,e=>{var{typed:r,config:t,matrix:n,DenseMatrix:a,concat:i}=e,s=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:n,concat:i}),u=Ia({typed:r});return r(ph,dH({typed:r,config:t}),{"boolean, boolean":(m,d)=>m>d,"BigNumber, BigNumber":function(d,h){return d.gt(h)&&!$t(d,h,t.epsilon)},"Fraction, Fraction":(m,d)=>m.compare(d)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},u,o({SS:l,DS:s,Ss:c}))}),dH=F(ph,["typed","config"],e=>{var{typed:r,config:t}=e;return r(ph,{"number, number":function(a,i){return a>i&&!At(a,i,t.epsilon)}})});var hh="largerEq",hH=["typed","config","matrix","DenseMatrix","concat"],vh=F(hh,hH,e=>{var{typed:r,config:t,matrix:n,DenseMatrix:a,concat:i}=e,s=lt({typed:r}),l=Zt({typed:r,DenseMatrix:a}),c=Wr({typed:r,DenseMatrix:a}),o=vr({typed:r,matrix:n,concat:i}),u=Ia({typed:r});return r(hh,vH({typed:r,config:t}),{"boolean, boolean":(m,d)=>m>=d,"BigNumber, BigNumber":function(d,h){return d.gte(h)||$t(d,h,t.epsilon)},"Fraction, Fraction":(m,d)=>m.compare(d)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},u,o({SS:l,DS:s,Ss:c}))}),vH=F(hh,["typed","config"],e=>{var{typed:r,config:t}=e;return r(hh,{"number, number":function(a,i){return a>=i||At(a,i,t.epsilon)}})});var uE="deepEqual",gH=["typed","equal"],gh=F(uE,gH,e=>{var{typed:r,equal:t}=e;return r(uE,{"any, any":function(i,s){return n(i.valueOf(),s.valueOf())}});function n(a,i){if(Array.isArray(a))if(Array.isArray(i)){var s=a.length;if(s!==i.length)return!1;for(var l=0;l{var{typed:r,config:t,equalScalar:n,matrix:a,DenseMatrix:i,concat:s}=e,l=lt({typed:r}),c=Zt({typed:r,DenseMatrix:i}),o=Wr({typed:r,DenseMatrix:i}),u=vr({typed:r,matrix:a,concat:s});return r(yh,xH({typed:r,equalScalar:n}),u({elop:m,SS:c,DS:l,Ss:o}));function m(d,h){return!n(d,h)}}),xH=F(yh,["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return r(yh,{"any, any":function(a,i){return a===null?i!==null:i===null?a!==null:a===void 0?i!==void 0:i===void 0?a!==void 0:!t(a,i)}})});var fE="partitionSelect",bH=["typed","isNumeric","isNaN","compare"],bh=F(fE,bH,e=>{var{typed:r,isNumeric:t,isNaN:n,compare:a}=e,i=a,s=(o,u)=>-a(o,u);return r(fE,{"Array | Matrix, number":function(u,m){return l(u,m,i)},"Array | Matrix, number, string":function(u,m,d){if(d==="asc")return l(u,m,i);if(d==="desc")return l(u,m,s);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":l});function l(o,u,m){if(!Ze(u)||u<0)throw new Error("k must be a non-negative integer");if(Qe(o)){var d=o.size();if(d.length>1)throw new Error("Only one dimensional matrices supported");return c(o.valueOf(),u,m)}if(Array.isArray(o))return c(o,u,m)}function c(o,u,m){if(u>=o.length)throw new Error("k out of bounds");for(var d=0;d=0){var C=o[x];o[x]=o[v],o[v]=C,--x}else++v;m(o[v],w)>0&&--v,u<=v?y=v:h=v+1}return o[u]}});var cE="sort",wH=["typed","matrix","compare","compareNatural"],wh=F(cE,wH,e=>{var{typed:r,matrix:t,compare:n,compareNatural:a}=e,i=n,s=(u,m)=>-n(u,m);return r(cE,{Array:function(m){return c(m),m.sort(i)},Matrix:function(m){return o(m),t(m.toArray().sort(i),m.storage())},"Array, function":function(m,d){return c(m),m.sort(d)},"Matrix, function":function(m,d){return o(m),t(m.toArray().sort(d),m.storage())},"Array, string":function(m,d){return c(m),m.sort(l(d))},"Matrix, string":function(m,d){return o(m),t(m.toArray().sort(l(d)),m.storage())}});function l(u){if(u==="asc")return i;if(u==="desc")return s;if(u==="natural")return a;throw new Error('String "asc", "desc", or "natural" expected')}function c(u){if(ur(u).length!==1)throw new Error("One dimensional array expected")}function o(u){if(u.size().length!==1)throw new Error("One dimensional matrix expected")}});var lE="max",DH=["typed","config","numeric","larger"],ef=F(lE,DH,e=>{var{typed:r,config:t,numeric:n,larger:a}=e;return r(lE,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(c,o){return ko(c,o.valueOf(),i)},"...":function(c){if(Pa(c))throw new TypeError("Scalar values expected in function max");return s(c)}});function i(l,c){try{return a(l,c)?l:c}catch(o){throw Et(o,"max",c)}}function s(l){var c;if(An(l,function(o){try{isNaN(o)&&typeof o=="number"?c=NaN:(c===void 0||a(o,c))&&(c=o)}catch(u){throw Et(u,"max",o)}}),c===void 0)throw new Error("Cannot calculate max of an empty array");return typeof c=="string"&&(c=n(c,t.number)),c}});var mE="min",SH=["typed","config","numeric","smaller"],rf=F(mE,SH,e=>{var{typed:r,config:t,numeric:n,smaller:a}=e;return r(mE,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(c,o){return ko(c,o.valueOf(),i)},"...":function(c){if(Pa(c))throw new TypeError("Scalar values expected in function min");return s(c)}});function i(l,c){try{return a(l,c)?l:c}catch(o){throw Et(o,"min",c)}}function s(l){var c;if(An(l,function(o){try{isNaN(o)&&typeof o=="number"?c=NaN:(c===void 0||a(o,c))&&(c=o)}catch(u){throw Et(u,"min",o)}}),c===void 0)throw new Error("Cannot calculate min of an empty array");return typeof c=="string"&&(c=n(c,t.number)),c}});var NH="ImmutableDenseMatrix",AH=["smaller","DenseMatrix"],Dh=F(NH,AH,e=>{var{smaller:r,DenseMatrix:t}=e;function n(a,i){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(i&&!St(i))throw new Error("Invalid datatype: "+i);if(Qe(a)||Mr(a)){var s=new t(a,i);this._data=s._data,this._size=s._size,this._datatype=s._datatype,this._min=null,this._max=null}else if(a&&Mr(a.data)&&Mr(a.size))this._data=a.data,this._size=a.size,this._datatype=a.datatype,this._min=typeof a.min<"u"?a.min:null,this._max=typeof a.max<"u"?a.max:null;else{if(a)throw new TypeError("Unsupported type of data ("+Tr(a)+")");this._data=[],this._size=[0],this._datatype=i,this._min=null,this._max=null}}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(a){switch(arguments.length){case 1:{var i=t.prototype.subset.call(this,a);return Qe(i)?new n({data:i._data,size:i._size,datatype:i._datatype}):i}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:ar(this._data),size:ar(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(a){return new n(a)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(this._min===null){var a=null;this.forEach(function(i){(a===null||r(i,a))&&(a=i)}),this._min=a!==null?a:void 0}return this._min},n.prototype.max=function(){if(this._max===null){var a=null;this.forEach(function(i){(a===null||r(a,i))&&(a=i)}),this._max=a!==null?a:void 0}return this._max},n},{isClass:!0});var MH="Index",CH=["ImmutableDenseMatrix","getMatrixDataType"],Sh=F(MH,CH,e=>{var{ImmutableDenseMatrix:r,getMatrixDataType:t}=e;function n(i){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var s=0,l=arguments.length;s{t&&r.push(n)}),r}var EH="FibonacciHeap",TH=["smaller","larger"],Nh=F(EH,TH,e=>{var{smaller:r,larger:t}=e,n=1/Math.log((1+Math.sqrt(5))/2);function a(){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}a.prototype.type="FibonacciHeap",a.prototype.isFibonacciHeap=!0,a.prototype.insert=function(u,m){var d={key:u,value:m,degree:0};if(this._minimum){var h=this._minimum;d.left=h,d.right=h.right,h.right=d,d.right.left=d,r(u,h.key)&&(this._minimum=d)}else d.left=d,d.right=d,this._minimum=d;return this._size++,d},a.prototype.size=function(){return this._size},a.prototype.clear=function(){this._minimum=null,this._size=0},a.prototype.isEmpty=function(){return this._size===0},a.prototype.extractMinimum=function(){var u=this._minimum;if(u===null)return u;for(var m=this._minimum,d=u.degree,h=u.child;d>0;){var y=h.right;h.left.right=h.right,h.right.left=h.left,h.left=m,h.right=m.right,m.right=h,h.right.left=h,h.parent=null,h=y,d--}return u.left.right=u.right,u.right.left=u.left,u===u.right?m=null:(m=u.right,m=o(m,this._size)),this._size--,this._minimum=m,u},a.prototype.remove=function(u){this._minimum=i(this._minimum,u,-1),this.extractMinimum()};function i(u,m,d){m.key=d;var h=m.parent;return h&&r(m.key,h.key)&&(s(u,m,h),l(u,h)),r(m.key,u.key)&&(u=m),u}function s(u,m,d){m.left.right=m.right,m.right.left=m.left,d.degree--,d.child===m&&(d.child=m.right),d.degree===0&&(d.child=null),m.left=u,m.right=u.right,u.right=m,m.right.left=m,m.parent=null,m.mark=!1}function l(u,m){var d=m.parent;!d||(m.mark?(s(u,m,d),l(d)):m.mark=!0)}var c=function(m,d){m.left.right=m.right,m.right.left=m.left,m.parent=d,d.child?(m.left=d.child,m.right=d.child.right,d.child.right=m,m.right.left=m):(d.child=m,m.right=m,m.left=m),d.degree++,m.mark=!1};function o(u,m){var d=Math.floor(Math.log(m)*n)+1,h=new Array(d),y=0,v=u;if(v)for(y++,v=v.right;v!==u;)y++,v=v.right;for(var x;y>0;){for(var w=v.degree,C=v.right;x=h[w],!!x;){if(t(v.key,x.key)){var b=x;x=v,v=b}c(x,v),h[w]=null,w++}h[w]=v,v=C,y--}u=null;for(var N=0;N{var{addScalar:r,equalScalar:t,FibonacciHeap:n}=e;function a(){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return a.prototype.type="Spa",a.prototype.isSpa=!0,a.prototype.set=function(i,s){if(this._values[i])this._values[i].value=s;else{var l=this._heap.insert(i,s);this._values[i]=l}},a.prototype.get=function(i){var s=this._values[i];return s?s.value:0},a.prototype.accumulate=function(i,s){var l=this._values[i];l?l.value=r(l.value,s):(l=this._heap.insert(i,s),this._values[i]=l)},a.prototype.forEach=function(i,s,l){var c=this._heap,o=this._values,u=[],m=c.extractMinimum();for(m&&u.push(m);m&&m.key<=s;)m.key>=i&&(t(m.value,0)||l(m.key,m.value,this)),m=c.extractMinimum(),m&&u.push(m);for(var d=0;d{var{on:r,config:t,addScalar:n,subtractScalar:a,multiplyScalar:i,divideScalar:s,pow:l,abs:c,fix:o,round:u,equal:m,isNumeric:d,format:h,number:y,Complex:v,BigNumber:x,Fraction:w}=e,C=y;function b(J,re){if(!(this instanceof b))throw new Error("Constructor must be called with the new operator");if(!(J==null||d(J)||Kt(J)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,re===void 0)this.units=[],this.dimensions=K.map(j=>0);else if(typeof re=="string"){var xe=b.parse(re);this.units=xe.units,this.dimensions=xe.dimensions}else if(Ht(re)&&re.value===null)this.fixPrefix=re.fixPrefix,this.skipAutomaticSimplification=re.skipAutomaticSimplification,this.dimensions=re.dimensions.slice(0),this.units=re.units.map(j=>ht({},j));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(J)}Object.defineProperty(b,"name",{value:"Unit"}),b.prototype.constructor=b,b.prototype.type="Unit",b.prototype.isUnit=!0;var N,M,S;function O(){for(;S===" "||S===" ";)T()}function _(J){return J>="0"&&J<="9"||J==="."}function E(J){return J>="0"&&J<="9"}function T(){M++,S=N.charAt(M)}function R(J){M=J,S=N.charAt(M)}function L(){var J="",re=M;if(S==="+"?T():S==="-"&&(J+=S,T()),!_(S))return R(re),null;if(S==="."){if(J+=S,T(),!E(S))return R(re),null}else{for(;E(S);)J+=S,T();S==="."&&(J+=S,T())}for(;E(S);)J+=S,T();if(S==="E"||S==="e"){var xe="",j=M;if(xe+=S,T(),(S==="+"||S==="-")&&(xe+=S,T()),!E(S))return R(j),J;for(J=J+xe;E(S);)J+=S,T()}return J}function H(){for(var J="";E(S)||b.isValidAlpha(S);)J+=S,T();var re=J.charAt(0);return b.isValidAlpha(re)?J:null}function V(J){return S===J?(T(),J):null}b.parse=function(J,re){if(re=re||{},N=J,M=-1,S="",typeof N!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var xe=new b;xe.units=[];var j=1,ne=!1;T(),O();var ue=L(),Me=null;if(ue){if(t.number==="BigNumber")Me=new x(ue);else if(t.number==="Fraction")try{Me=new w(ue)}catch{Me=parseFloat(ue)}else Me=parseFloat(ue);O(),V("*")?(j=1,ne=!0):V("/")&&(j=-1,ne=!0)}for(var Ce=[],Le=1;;){for(O();S==="(";)Ce.push(j),Le*=j,j=1,T(),O();var Ie=void 0;if(S){var fr=S;if(Ie=H(),Ie===null)throw new SyntaxError('Unexpected "'+fr+'" in "'+N+'" at index '+M.toString())}else break;var or=W(Ie);if(or===null)throw new SyntaxError('Unit "'+Ie+'" not found.');var Ke=j*Le;if(O(),V("^")){O();var Pr=L();if(Pr===null)throw new SyntaxError('In "'+J+'", "^" must be followed by a floating-point number');Ke*=Pr}xe.units.push({unit:or.unit,prefix:or.prefix,power:Ke});for(var ee=0;ee1||Math.abs(this.units[0].power-1)>1e-15},b.prototype._normalize=function(J){if(J==null||this.units.length===0)return J;for(var re=J,xe=b._getNumberConverter(Tr(J)),j=0;j{if(Xe($,J)){var re=$[J],xe=re.prefixes[""];return{unit:re,prefix:xe}}for(var j in $)if(Xe($,j)&&mM(J,j)){var ne=$[j],ue=J.length-j.length,Me=J.substring(0,ue),Ce=Xe(ne.prefixes,Me)?ne.prefixes[Me]:void 0;if(Ce!==void 0)return{unit:ne,prefix:Ce}}return null},{hasher:J=>J[0],limit:100});b.isValuelessUnit=function(J){return W(J)!==null},b.prototype.hasBase=function(J){if(typeof J=="string"&&(J=z[J]),!J)return!1;for(var re=0;re1e-12)return!1;return!0},b.prototype.equalBase=function(J){for(var re=0;re1e-12)return!1;return!0},b.prototype.equals=function(J){return this.equalBase(J)&&m(this.value,J.value)},b.prototype.multiply=function(J){for(var re=this.clone(),xe=Ht(J)?J:new b(J),j=0;j1e-12&&(Xe(ge,Ce)?re.push({unit:ge[Ce].unit,prefix:ge[Ce].prefix,power:J.dimensions[Me]||0}):ue=!0)}re.length1e-12)if(Xe(pe.si,j))re.push({unit:pe.si[j].unit,prefix:pe.si[j].prefix,power:J.dimensions[xe]||0});else throw new Error("Cannot express custom unit "+j+" in SI units")}return J.units=re,J.fixPrefix=!0,J.skipAutomaticSimplification=!0,this.value!==null?(J.value=null,this.to(J)):J},b.prototype.formatUnits=function(){for(var J="",re="",xe=0,j=0,ne=0;ne0?(xe++,J+=" "+this.units[ne].prefix.name+this.units[ne].unit.name,Math.abs(this.units[ne].power-1)>1e-15&&(J+="^"+this.units[ne].power)):this.units[ne].power<0&&j++;if(j>0)for(var ue=0;ue0?(re+=" "+this.units[ue].prefix.name+this.units[ue].unit.name,Math.abs(this.units[ue].power+1)>1e-15&&(re+="^"+-this.units[ue].power)):(re+=" "+this.units[ue].prefix.name+this.units[ue].unit.name,re+="^"+this.units[ue].power));J=J.substr(1),re=re.substr(1),xe>1&&j>0&&(J="("+J+")"),j>1&&xe>0&&(re="("+re+")");var Me=J;return xe>0&&j>0&&(Me+=" / "),Me+=re,Me},b.prototype.format=function(J){var re=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),xe=!1;typeof re.value<"u"&&re.value!==null&&Kt(re.value)&&(xe=Math.abs(re.value.re)<1e-14);for(var j in re.units)Xe(re.units,j)&&re.units[j].unit&&(re.units[j].unit.name==="VA"&&xe?re.units[j].unit=$.VAR:re.units[j].unit.name==="VAR"&&!xe&&(re.units[j].unit=$.VA));re.units.length===1&&!re.fixPrefix&&Math.abs(re.units[0].power-Math.round(re.units[0].power))<1e-14&&(re.units[0].prefix=re._bestPrefix());var ne=re._denormalize(re.value),ue=re.value!==null?h(ne,J||{}):"",Me=re.formatUnits();return re.value&&Kt(re.value)&&(ue="("+ue+")"),Me.length>0&&ue.length>0&&(ue+=" "),ue+=Me,ue},b.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var J=this.value!==null?c(this.value):0,re=c(this.units[0].unit.value),xe=this.units[0].prefix;if(J===0)return xe;var j=this.units[0].power,ne=Math.log(J/Math.pow(xe.value*re,j))/Math.LN10-1.2;if(ne>-2.200001&&ne<1.800001)return xe;ne=Math.abs(ne);var ue=this.units[0].unit.prefixes;for(var Me in ue)if(Xe(ue,Me)){var Ce=ue[Me];if(Ce.scientific){var Le=Math.abs(Math.log(J/Math.pow(Ce.value*re,j))/Math.LN10-1.2);(Le0)},$={meter:{name:"meter",base:z.LENGTH,prefixes:q.LONG,value:1,offset:0},inch:{name:"inch",base:z.LENGTH,prefixes:q.NONE,value:.0254,offset:0},foot:{name:"foot",base:z.LENGTH,prefixes:q.NONE,value:.3048,offset:0},yard:{name:"yard",base:z.LENGTH,prefixes:q.NONE,value:.9144,offset:0},mile:{name:"mile",base:z.LENGTH,prefixes:q.NONE,value:1609.344,offset:0},link:{name:"link",base:z.LENGTH,prefixes:q.NONE,value:.201168,offset:0},rod:{name:"rod",base:z.LENGTH,prefixes:q.NONE,value:5.0292,offset:0},chain:{name:"chain",base:z.LENGTH,prefixes:q.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:z.LENGTH,prefixes:q.NONE,value:1e-10,offset:0},m:{name:"m",base:z.LENGTH,prefixes:q.SHORT,value:1,offset:0},in:{name:"in",base:z.LENGTH,prefixes:q.NONE,value:.0254,offset:0},ft:{name:"ft",base:z.LENGTH,prefixes:q.NONE,value:.3048,offset:0},yd:{name:"yd",base:z.LENGTH,prefixes:q.NONE,value:.9144,offset:0},mi:{name:"mi",base:z.LENGTH,prefixes:q.NONE,value:1609.344,offset:0},li:{name:"li",base:z.LENGTH,prefixes:q.NONE,value:.201168,offset:0},rd:{name:"rd",base:z.LENGTH,prefixes:q.NONE,value:5.02921,offset:0},ch:{name:"ch",base:z.LENGTH,prefixes:q.NONE,value:20.1168,offset:0},mil:{name:"mil",base:z.LENGTH,prefixes:q.NONE,value:254e-7,offset:0},m2:{name:"m2",base:z.SURFACE,prefixes:q.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:z.SURFACE,prefixes:q.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:z.SURFACE,prefixes:q.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:z.SURFACE,prefixes:q.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:z.SURFACE,prefixes:q.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:z.SURFACE,prefixes:q.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:z.SURFACE,prefixes:q.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:z.SURFACE,prefixes:q.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:z.SURFACE,prefixes:q.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:z.SURFACE,prefixes:q.NONE,value:1e4,offset:0},m3:{name:"m3",base:z.VOLUME,prefixes:q.CUBIC,value:1,offset:0},L:{name:"L",base:z.VOLUME,prefixes:q.SHORT,value:.001,offset:0},l:{name:"l",base:z.VOLUME,prefixes:q.SHORT,value:.001,offset:0},litre:{name:"litre",base:z.VOLUME,prefixes:q.LONG,value:.001,offset:0},cuin:{name:"cuin",base:z.VOLUME,prefixes:q.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:z.VOLUME,prefixes:q.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:z.VOLUME,prefixes:q.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:z.VOLUME,prefixes:q.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:z.VOLUME,prefixes:q.NONE,value:15e-6,offset:0},drop:{name:"drop",base:z.VOLUME,prefixes:q.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:z.VOLUME,prefixes:q.NONE,value:5e-8,offset:0},minim:{name:"minim",base:z.VOLUME,prefixes:q.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:z.VOLUME,prefixes:q.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:z.VOLUME,prefixes:q.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:z.VOLUME,prefixes:q.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:z.VOLUME,prefixes:q.NONE,value:1e-6,offset:0},cup:{name:"cup",base:z.VOLUME,prefixes:q.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:z.VOLUME,prefixes:q.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:z.VOLUME,prefixes:q.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:z.VOLUME,prefixes:q.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:z.VOLUME,prefixes:q.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:z.VOLUME,prefixes:q.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:z.VOLUME,prefixes:q.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:z.VOLUME,prefixes:q.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:z.VOLUME,prefixes:q.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:z.VOLUME,prefixes:q.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:z.VOLUME,prefixes:q.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:z.VOLUME,prefixes:q.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:z.VOLUME,prefixes:q.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:z.VOLUME,prefixes:q.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:z.VOLUME,prefixes:q.NONE,value:.1173478,offset:0},obl:{name:"obl",base:z.VOLUME,prefixes:q.NONE,value:.1589873,offset:0},g:{name:"g",base:z.MASS,prefixes:q.SHORT,value:.001,offset:0},gram:{name:"gram",base:z.MASS,prefixes:q.LONG,value:.001,offset:0},ton:{name:"ton",base:z.MASS,prefixes:q.SHORT,value:907.18474,offset:0},t:{name:"t",base:z.MASS,prefixes:q.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:z.MASS,prefixes:q.LONG,value:1e3,offset:0},grain:{name:"grain",base:z.MASS,prefixes:q.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:z.MASS,prefixes:q.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:z.MASS,prefixes:q.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:z.MASS,prefixes:q.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:z.MASS,prefixes:q.NONE,value:45.359237,offset:0},stick:{name:"stick",base:z.MASS,prefixes:q.NONE,value:.115,offset:0},stone:{name:"stone",base:z.MASS,prefixes:q.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:z.MASS,prefixes:q.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:z.MASS,prefixes:q.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:z.MASS,prefixes:q.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:z.MASS,prefixes:q.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:z.MASS,prefixes:q.NONE,value:45.359237,offset:0},s:{name:"s",base:z.TIME,prefixes:q.SHORT,value:1,offset:0},min:{name:"min",base:z.TIME,prefixes:q.NONE,value:60,offset:0},h:{name:"h",base:z.TIME,prefixes:q.NONE,value:3600,offset:0},second:{name:"second",base:z.TIME,prefixes:q.LONG,value:1,offset:0},sec:{name:"sec",base:z.TIME,prefixes:q.LONG,value:1,offset:0},minute:{name:"minute",base:z.TIME,prefixes:q.NONE,value:60,offset:0},hour:{name:"hour",base:z.TIME,prefixes:q.NONE,value:3600,offset:0},day:{name:"day",base:z.TIME,prefixes:q.NONE,value:86400,offset:0},week:{name:"week",base:z.TIME,prefixes:q.NONE,value:7*86400,offset:0},month:{name:"month",base:z.TIME,prefixes:q.NONE,value:2629800,offset:0},year:{name:"year",base:z.TIME,prefixes:q.NONE,value:31557600,offset:0},decade:{name:"decade",base:z.TIME,prefixes:q.NONE,value:315576e3,offset:0},century:{name:"century",base:z.TIME,prefixes:q.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:z.TIME,prefixes:q.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:z.FREQUENCY,prefixes:q.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:z.FREQUENCY,prefixes:q.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:z.ANGLE,prefixes:q.SHORT,value:1,offset:0},radian:{name:"radian",base:z.ANGLE,prefixes:q.LONG,value:1,offset:0},deg:{name:"deg",base:z.ANGLE,prefixes:q.SHORT,value:null,offset:0},degree:{name:"degree",base:z.ANGLE,prefixes:q.LONG,value:null,offset:0},grad:{name:"grad",base:z.ANGLE,prefixes:q.SHORT,value:null,offset:0},gradian:{name:"gradian",base:z.ANGLE,prefixes:q.LONG,value:null,offset:0},cycle:{name:"cycle",base:z.ANGLE,prefixes:q.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:z.ANGLE,prefixes:q.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:z.ANGLE,prefixes:q.NONE,value:null,offset:0},A:{name:"A",base:z.CURRENT,prefixes:q.SHORT,value:1,offset:0},ampere:{name:"ampere",base:z.CURRENT,prefixes:q.LONG,value:1,offset:0},K:{name:"K",base:z.TEMPERATURE,prefixes:q.SHORT,value:1,offset:0},degC:{name:"degC",base:z.TEMPERATURE,prefixes:q.SHORT,value:1,offset:273.15},degF:{name:"degF",base:z.TEMPERATURE,prefixes:q.SHORT,value:new w(5,9),offset:459.67},degR:{name:"degR",base:z.TEMPERATURE,prefixes:q.SHORT,value:new w(5,9),offset:0},kelvin:{name:"kelvin",base:z.TEMPERATURE,prefixes:q.LONG,value:1,offset:0},celsius:{name:"celsius",base:z.TEMPERATURE,prefixes:q.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:z.TEMPERATURE,prefixes:q.LONG,value:new w(5,9),offset:459.67},rankine:{name:"rankine",base:z.TEMPERATURE,prefixes:q.LONG,value:new w(5,9),offset:0},mol:{name:"mol",base:z.AMOUNT_OF_SUBSTANCE,prefixes:q.SHORT,value:1,offset:0},mole:{name:"mole",base:z.AMOUNT_OF_SUBSTANCE,prefixes:q.LONG,value:1,offset:0},cd:{name:"cd",base:z.LUMINOUS_INTENSITY,prefixes:q.SHORT,value:1,offset:0},candela:{name:"candela",base:z.LUMINOUS_INTENSITY,prefixes:q.LONG,value:1,offset:0},N:{name:"N",base:z.FORCE,prefixes:q.SHORT,value:1,offset:0},newton:{name:"newton",base:z.FORCE,prefixes:q.LONG,value:1,offset:0},dyn:{name:"dyn",base:z.FORCE,prefixes:q.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:z.FORCE,prefixes:q.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:z.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:z.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:z.FORCE,prefixes:q.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:z.FORCE,prefixes:q.NONE,value:9.80665,offset:0},J:{name:"J",base:z.ENERGY,prefixes:q.SHORT,value:1,offset:0},joule:{name:"joule",base:z.ENERGY,prefixes:q.LONG,value:1,offset:0},erg:{name:"erg",base:z.ENERGY,prefixes:q.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:z.ENERGY,prefixes:q.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:z.ENERGY,prefixes:q.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:z.ENERGY,prefixes:q.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:z.ENERGY,prefixes:q.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:z.POWER,prefixes:q.SHORT,value:1,offset:0},watt:{name:"watt",base:z.POWER,prefixes:q.LONG,value:1,offset:0},hp:{name:"hp",base:z.POWER,prefixes:q.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:z.POWER,prefixes:q.SHORT,value:v.I,offset:0},VA:{name:"VA",base:z.POWER,prefixes:q.SHORT,value:1,offset:0},Pa:{name:"Pa",base:z.PRESSURE,prefixes:q.SHORT,value:1,offset:0},psi:{name:"psi",base:z.PRESSURE,prefixes:q.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:z.PRESSURE,prefixes:q.NONE,value:101325,offset:0},bar:{name:"bar",base:z.PRESSURE,prefixes:q.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:z.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:z.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:z.PRESSURE,prefixes:q.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:z.PRESSURE,prefixes:q.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:z.ELECTRIC_CHARGE,prefixes:q.LONG,value:1,offset:0},C:{name:"C",base:z.ELECTRIC_CHARGE,prefixes:q.SHORT,value:1,offset:0},farad:{name:"farad",base:z.ELECTRIC_CAPACITANCE,prefixes:q.LONG,value:1,offset:0},F:{name:"F",base:z.ELECTRIC_CAPACITANCE,prefixes:q.SHORT,value:1,offset:0},volt:{name:"volt",base:z.ELECTRIC_POTENTIAL,prefixes:q.LONG,value:1,offset:0},V:{name:"V",base:z.ELECTRIC_POTENTIAL,prefixes:q.SHORT,value:1,offset:0},ohm:{name:"ohm",base:z.ELECTRIC_RESISTANCE,prefixes:q.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:z.ELECTRIC_INDUCTANCE,prefixes:q.LONG,value:1,offset:0},H:{name:"H",base:z.ELECTRIC_INDUCTANCE,prefixes:q.SHORT,value:1,offset:0},siemens:{name:"siemens",base:z.ELECTRIC_CONDUCTANCE,prefixes:q.LONG,value:1,offset:0},S:{name:"S",base:z.ELECTRIC_CONDUCTANCE,prefixes:q.SHORT,value:1,offset:0},weber:{name:"weber",base:z.MAGNETIC_FLUX,prefixes:q.LONG,value:1,offset:0},Wb:{name:"Wb",base:z.MAGNETIC_FLUX,prefixes:q.SHORT,value:1,offset:0},tesla:{name:"tesla",base:z.MAGNETIC_FLUX_DENSITY,prefixes:q.LONG,value:1,offset:0},T:{name:"T",base:z.MAGNETIC_FLUX_DENSITY,prefixes:q.SHORT,value:1,offset:0},b:{name:"b",base:z.BIT,prefixes:q.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:z.BIT,prefixes:q.BINARY_LONG,value:1,offset:0},B:{name:"B",base:z.BIT,prefixes:q.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:z.BIT,prefixes:q.BINARY_LONG,value:8,offset:0}},me={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function Ee(J){if(J.number==="BigNumber"){var re=Pc(x);$.rad.value=new x(1),$.deg.value=re.div(180),$.grad.value=re.div(200),$.cycle.value=re.times(2),$.arcsec.value=re.div(648e3),$.arcmin.value=re.div(10800)}else $.rad.value=1,$.deg.value=Math.PI/180,$.grad.value=Math.PI/200,$.cycle.value=Math.PI*2,$.arcsec.value=Math.PI/648e3,$.arcmin.value=Math.PI/10800;$.radian.value=$.rad.value,$.degree.value=$.deg.value,$.gradian.value=$.grad.value}Ee(t),r&&r("config",function(J,re){J.number!==re.number&&Ee(J)});var pe={si:{NONE:{unit:ae,prefix:q.NONE[""]},LENGTH:{unit:$.m,prefix:q.SHORT[""]},MASS:{unit:$.g,prefix:q.SHORT.k},TIME:{unit:$.s,prefix:q.SHORT[""]},CURRENT:{unit:$.A,prefix:q.SHORT[""]},TEMPERATURE:{unit:$.K,prefix:q.SHORT[""]},LUMINOUS_INTENSITY:{unit:$.cd,prefix:q.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:$.mol,prefix:q.SHORT[""]},ANGLE:{unit:$.rad,prefix:q.SHORT[""]},BIT:{unit:$.bits,prefix:q.SHORT[""]},FORCE:{unit:$.N,prefix:q.SHORT[""]},ENERGY:{unit:$.J,prefix:q.SHORT[""]},POWER:{unit:$.W,prefix:q.SHORT[""]},PRESSURE:{unit:$.Pa,prefix:q.SHORT[""]},ELECTRIC_CHARGE:{unit:$.C,prefix:q.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:$.F,prefix:q.SHORT[""]},ELECTRIC_POTENTIAL:{unit:$.V,prefix:q.SHORT[""]},ELECTRIC_RESISTANCE:{unit:$.ohm,prefix:q.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:$.H,prefix:q.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:$.S,prefix:q.SHORT[""]},MAGNETIC_FLUX:{unit:$.Wb,prefix:q.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:$.T,prefix:q.SHORT[""]},FREQUENCY:{unit:$.Hz,prefix:q.SHORT[""]}}};pe.cgs=JSON.parse(JSON.stringify(pe.si)),pe.cgs.LENGTH={unit:$.m,prefix:q.SHORT.c},pe.cgs.MASS={unit:$.g,prefix:q.SHORT[""]},pe.cgs.FORCE={unit:$.dyn,prefix:q.SHORT[""]},pe.cgs.ENERGY={unit:$.erg,prefix:q.NONE[""]},pe.us=JSON.parse(JSON.stringify(pe.si)),pe.us.LENGTH={unit:$.ft,prefix:q.NONE[""]},pe.us.MASS={unit:$.lbm,prefix:q.NONE[""]},pe.us.TEMPERATURE={unit:$.degF,prefix:q.NONE[""]},pe.us.FORCE={unit:$.lbf,prefix:q.NONE[""]},pe.us.ENERGY={unit:$.BTU,prefix:q.BTU[""]},pe.us.POWER={unit:$.hp,prefix:q.NONE[""]},pe.us.PRESSURE={unit:$.psi,prefix:q.NONE[""]},pe.auto=JSON.parse(JSON.stringify(pe.si));var ge=pe.auto;b.setUnitSystem=function(J){if(Xe(pe,J))ge=pe[J];else throw new Error("Unit system "+J+" does not exist. Choices are: "+Object.keys(pe).join(", "))},b.getUnitSystem=function(){for(var J in pe)if(Xe(pe,J)&&pe[J]===ge)return J},b.typeConverters={BigNumber:function(re){return re!=null&&re.isFraction?new x(re.n).div(re.d).times(re.s):new x(re+"")},Fraction:function(re){return new w(re)},Complex:function(re){return re},number:function(re){return re!=null&&re.isFraction?y(re):re}},b.prototype._numberConverter=function(){var J=b.typeConverters[this.valueType()];if(J)return J;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},b._getNumberConverter=function(J){if(!b.typeConverters[J])throw new TypeError('Unsupported type "'+J+'"');return b.typeConverters[J]};for(var Se in $)if(Xe($,Se)){var ye=$[Se];ye.dimensions=ye.base.dimensions}for(var be in me)if(Xe(me,be)){var De=$[me[be]],Ae={};for(var We in De)Xe(De,We)&&(Ae[We]=De[We]);Ae.name=be,$[be]=Ae}b.isValidAlpha=function(re){return/^[a-zA-Z]$/.test(re)};function Je(J){for(var re=0;re0&&!(b.isValidAlpha(S)||E(S)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+J+'"')}}return b.createUnit=function(J,re){if(typeof J!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(re&&re.override){for(var xe in J)if(Xe(J,xe)&&b.deleteUnit(xe),J[xe].aliases)for(var j=0;j"u"||re===null)&&(re={}),typeof J!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Xe($,J))throw new Error('Cannot create unit "'+J+'": a unit with that name already exists');Je(J);var xe=null,j=[],ne=0,ue,Me,Ce;if(re&&re.type==="Unit")xe=re.clone();else if(typeof re=="string")re!==""&&(ue=re);else if(typeof re=="object")ue=re.definition,Me=re.prefixes,ne=re.offset,Ce=re.baseName,re.aliases&&(j=re.aliases.valueOf());else throw new TypeError('Cannot create unit "'+J+'" from "'+re.toString()+'": expecting "string" or "Unit" or "Object"');if(j){for(var Le=0;Le1e-12){ce=!1;break}if(ce){Pr=!0,Ie.base=z[ee];break}}if(!Pr){Ce=Ce||J+"_STUFF";var Be={dimensions:xe.dimensions.slice(0)};Be.key=Ce,z[Ce]=Be,ge[Ce]={unit:Ie,prefix:q.NONE[""]},Ie.base=z[Ce]}}else{if(Ce=Ce||J+"_STUFF",K.indexOf(Ce)>=0)throw new Error('Cannot create new base unit "'+J+'": a base unit with that name already exists (and cannot be overridden)');K.push(Ce);for(var fr in z)Xe(z,fr)&&(z[fr].dimensions[K.length-1]=0);for(var or={dimensions:[]},Ke=0;Ke{var{typed:r,Unit:t}=e;return r(yE,{Unit:function(a){return a.clone()},string:function(a){return t.isValuelessUnit(a)?new t(null,a):t.parse(a,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(a,i){return new t(a,i)},"number | BigNumber | Fraction":function(a){return new t(a)},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var xE="sparse",IH=["typed","SparseMatrix"],Th=F(xE,IH,e=>{var{typed:r,SparseMatrix:t}=e;return r(xE,{"":function(){return new t([])},string:function(a){return new t([],a)},"Array | Matrix":function(a){return new t(a)},"Array | Matrix, string":function(a,i){return new t(a,i)}})});var bE="createUnit",RH=["typed","Unit"],Fh=F(bE,RH,e=>{var{typed:r,Unit:t}=e;return r(bE,{"Object, Object":function(a,i){return t.createUnit(a,i)},Object:function(a){return t.createUnit(a,{})},"string, Unit | string | Object, Object":function(a,i,s){var l={};return l[a]=i,t.createUnit(l,s)},"string, Unit | string | Object":function(a,i){var s={};return s[a]=i,t.createUnit(s,{})},string:function(a){var i={};return i[a]={},t.createUnit(i,{})}})});var wE="acos",qH=["typed","config","Complex"],_h=F(wE,qH,e=>{var{typed:r,config:t,Complex:n}=e;return r(wE,{number:function(i){return i>=-1&&i<=1||t.predictable?Math.acos(i):new n(i,0).acos()},Complex:function(i){return i.acos()},BigNumber:function(i){return i.acos()}})});var DE="acosh",kH=["typed","config","Complex"],Oh=F(DE,kH,e=>{var{typed:r,config:t,Complex:n}=e;return r(DE,{number:function(i){return i>=1||t.predictable?$w(i):i<=-1?new n(Math.log(Math.sqrt(i*i-1)-i),Math.PI):new n(i,0).acosh()},Complex:function(i){return i.acosh()},BigNumber:function(i){return i.acosh()}})});var SE="acot",LH=["typed","BigNumber"],Bh=F(SE,LH,e=>{var{typed:r,BigNumber:t}=e;return r(SE,{number:Gw,Complex:function(a){return a.acot()},BigNumber:function(a){return new t(1).div(a).atan()}})});var NE="acoth",zH=["typed","config","Complex","BigNumber"],Ph=F(NE,zH,e=>{var{typed:r,config:t,Complex:n,BigNumber:a}=e;return r(NE,{number:function(s){return s>=1||s<=-1||t.predictable?Vw(s):new n(s,0).acoth()},Complex:function(s){return s.acoth()},BigNumber:function(s){return new a(1).div(s).atanh()}})});var AE="acsc",UH=["typed","config","Complex","BigNumber"],Ih=F(AE,UH,e=>{var{typed:r,config:t,Complex:n,BigNumber:a}=e;return r(AE,{number:function(s){return s<=-1||s>=1||t.predictable?Zw(s):new n(s,0).acsc()},Complex:function(s){return s.acsc()},BigNumber:function(s){return new a(1).div(s).asin()}})});var ME="acsch",WH=["typed","BigNumber"],Rh=F(ME,WH,e=>{var{typed:r,BigNumber:t}=e;return r(ME,{number:Qw,Complex:function(a){return a.acsch()},BigNumber:function(a){return new t(1).div(a).asinh()}})});var CE="asec",YH=["typed","config","Complex","BigNumber"],qh=F(CE,YH,e=>{var{typed:r,config:t,Complex:n,BigNumber:a}=e;return r(CE,{number:function(s){return s<=-1||s>=1||t.predictable?Xw(s):new n(s,0).asec()},Complex:function(s){return s.asec()},BigNumber:function(s){return new a(1).div(s).acos()}})});var EE="asech",HH=["typed","config","Complex","BigNumber"],kh=F(EE,HH,e=>{var{typed:r,config:t,Complex:n,BigNumber:a}=e;return r(EE,{number:function(s){if(s<=1&&s>=-1||t.predictable){var l=1/s;if(l>0||t.predictable)return Jw(s);var c=Math.sqrt(l*l-1);return new n(Math.log(c-l),Math.PI)}return new n(s,0).asech()},Complex:function(s){return s.asech()},BigNumber:function(s){return new a(1).div(s).acosh()}})});var TE="asin",$H=["typed","config","Complex"],Lh=F(TE,$H,e=>{var{typed:r,config:t,Complex:n}=e;return r(TE,{number:function(i){return i>=-1&&i<=1||t.predictable?Math.asin(i):new n(i,0).asin()},Complex:function(i){return i.asin()},BigNumber:function(i){return i.asin()}})});var GH="asinh",VH=["typed"],zh=F(GH,VH,e=>{var{typed:r}=e;return r("asinh",{number:Kw,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var ZH="atan",QH=["typed"],Uh=F(ZH,QH,e=>{var{typed:r}=e;return r("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var FE="atan2",XH=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Wh=F(FE,XH,e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:a,DenseMatrix:i,concat:s}=e,l=Lt({typed:r,equalScalar:n}),c=lt({typed:r}),o=Vp({typed:r,equalScalar:n}),u=jr({typed:r,equalScalar:n}),m=Wr({typed:r,DenseMatrix:i}),d=vr({typed:r,matrix:t,concat:s});return r(FE,{"number, number":Math.atan2,"BigNumber, BigNumber":(h,y)=>a.atan2(h,y)},d({scalar:"number | BigNumber",SS:o,DS:c,SD:l,Ss:u,sS:m}))});var _E="atanh",JH=["typed","config","Complex"],Yh=F(_E,JH,e=>{var{typed:r,config:t,Complex:n}=e;return r(_E,{number:function(i){return i<=1&&i>=-1||t.predictable?jw(i):new n(i,0).atanh()},Complex:function(i){return i.atanh()},BigNumber:function(i){return i.atanh()}})});var qa=F("trigUnit",["typed"],e=>{var{typed:r}=e;return{Unit:r.referToSelf(t=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return r.find(t,n.valueType())(n.value)})}});var OE="cos",KH=["typed"],Hh=F(OE,KH,e=>{var{typed:r}=e,t=qa({typed:r});return r(OE,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},t)});var BE="cosh",jH=["typed"],$h=F(BE,jH,e=>{var{typed:r}=e;return r(BE,{number:Cm,"Complex | BigNumber":t=>t.cosh()})});var PE="cot",e$=["typed","BigNumber"],Gh=F(PE,e$,e=>{var{typed:r,BigNumber:t}=e,n=qa({typed:r});return r(PE,{number:eD,Complex:a=>a.cot(),BigNumber:a=>new t(1).div(a.tan())},n)});var IE="coth",r$=["typed","BigNumber"],Vh=F(IE,r$,e=>{var{typed:r,BigNumber:t}=e;return r(IE,{number:rD,Complex:n=>n.coth(),BigNumber:n=>new t(1).div(n.tanh())})});var RE="csc",t$=["typed","BigNumber"],Zh=F(RE,t$,e=>{var{typed:r,BigNumber:t}=e,n=qa({typed:r});return r(RE,{number:tD,Complex:a=>a.csc(),BigNumber:a=>new t(1).div(a.sin())},n)});var qE="csch",n$=["typed","BigNumber"],Qh=F(qE,n$,e=>{var{typed:r,BigNumber:t}=e;return r(qE,{number:nD,Complex:n=>n.csch(),BigNumber:n=>new t(1).div(n.sinh())})});var kE="sec",a$=["typed","BigNumber"],Xh=F(kE,a$,e=>{var{typed:r,BigNumber:t}=e,n=qa({typed:r});return r(kE,{number:aD,Complex:a=>a.sec(),BigNumber:a=>new t(1).div(a.cos())},n)});var LE="sech",i$=["typed","BigNumber"],Jh=F(LE,i$,e=>{var{typed:r,BigNumber:t}=e;return r(LE,{number:iD,Complex:n=>n.sech(),BigNumber:n=>new t(1).div(n.cosh())})});var zE="sin",o$=["typed"],Kh=F(zE,o$,e=>{var{typed:r}=e,t=qa({typed:r});return r(zE,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},t)});var UE="sinh",s$=["typed"],jh=F(UE,s$,e=>{var{typed:r}=e;return r(UE,{number:oD,"Complex | BigNumber":t=>t.sinh()})});var WE="tan",u$=["typed"],ev=F(WE,u$,e=>{var{typed:r}=e,t=qa({typed:r});return r(WE,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},t)});var f$="tanh",c$=["typed"],rv=F(f$,c$,e=>{var{typed:r}=e;return r("tanh",{number:Em,"Complex | BigNumber":t=>t.tanh()})});var YE="setCartesian",l$=["typed","size","subset","compareNatural","Index","DenseMatrix"],tv=F(YE,l$,e=>{var{typed:r,size:t,subset:n,compareNatural:a,Index:i,DenseMatrix:s}=e;return r(YE,{"Array | Matrix, Array | Matrix":function(c,o){var u=[];if(n(t(c),new i(0))!==0&&n(t(o),new i(0))!==0){var m=gr(Array.isArray(c)?c:c.toArray()).sort(a),d=gr(Array.isArray(o)?o:o.toArray()).sort(a);u=[];for(var h=0;h{var{typed:r,size:t,subset:n,compareNatural:a,Index:i,DenseMatrix:s}=e;return r(HE,{"Array | Matrix, Array | Matrix":function(c,o){var u;if(n(t(c),new i(0))===0)u=[];else{if(n(t(o),new i(0))===0)return gr(c.toArray());var m=Ki(gr(Array.isArray(c)?c:c.toArray()).sort(a)),d=Ki(gr(Array.isArray(o)?o:o.toArray()).sort(a));u=[];for(var h,y=0;y{var{typed:r,size:t,subset:n,compareNatural:a,Index:i,DenseMatrix:s}=e;return r($E,{"Array | Matrix":function(c){var o;if(n(t(c),new i(0))===0)o=[];else{var u=gr(Array.isArray(c)?c:c.toArray()).sort(a);o=[],o.push(u[0]);for(var m=1;m{var{typed:r,size:t,subset:n,compareNatural:a,Index:i,DenseMatrix:s}=e;return r(GE,{"Array | Matrix, Array | Matrix":function(c,o){var u;if(n(t(c),new i(0))===0||n(t(o),new i(0))===0)u=[];else{var m=Ki(gr(Array.isArray(c)?c:c.toArray()).sort(a)),d=Ki(gr(Array.isArray(o)?o:o.toArray()).sort(a));u=[];for(var h=0;h{var{typed:r,size:t,subset:n,compareNatural:a,Index:i}=e;return r(VE,{"Array | Matrix, Array | Matrix":function(l,c){if(n(t(l),new i(0))===0)return!0;if(n(t(c),new i(0))===0)return!1;for(var o=Ki(gr(Array.isArray(l)?l:l.toArray()).sort(a)),u=Ki(gr(Array.isArray(c)?c:c.toArray()).sort(a)),m,d=0;d{var{typed:r,size:t,subset:n,compareNatural:a,Index:i}=e;return r(ZE,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(l,c){if(n(t(c),new i(0))===0)return 0;for(var o=gr(Array.isArray(c)?c:c.toArray()),u=0,m=0;m{var{typed:r,size:t,subset:n,compareNatural:a,Index:i}=e;return r(QE,{"Array | Matrix":function(o){if(n(t(o),new i(0))===0)return[];for(var u=gr(Array.isArray(o)?o:o.toArray()).sort(a),m=[],d=0;d.toString(2).length<=u.length;)m.push(s(u,d.toString(2).split("").reverse())),d++;return l(m)}});function s(c,o){for(var u=[],m=0;m0;u--)for(var m=0;mc[m+1].length&&(o=c[m],c[m]=c[m+1],c[m+1]=o);return c}});var XE="setSize",y$=["typed","compareNatural"],fv=F(XE,y$,e=>{var{typed:r,compareNatural:t}=e;return r(XE,{"Array | Matrix":function(a){return Array.isArray(a)?gr(a).length:gr(a.toArray()).length},"Array | Matrix, boolean":function(a,i){if(i===!1||a.length===0)return Array.isArray(a)?gr(a).length:gr(a.toArray()).length;for(var s=gr(Array.isArray(a)?a:a.toArray()).sort(t),l=1,c=1;c{var{typed:r,size:t,concat:n,subset:a,setDifference:i,Index:s}=e;return r(JE,{"Array | Matrix, Array | Matrix":function(c,o){if(a(t(c),new s(0))===0)return gr(o);if(a(t(o),new s(0))===0)return gr(c);var u=gr(c),m=gr(o);return n(i(u,m),i(m,u))}})});var KE="setUnion",b$=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],lv=F(KE,b$,e=>{var{typed:r,size:t,concat:n,subset:a,setIntersect:i,setSymDifference:s,Index:l}=e;return r(KE,{"Array | Matrix, Array | Matrix":function(o,u){if(a(t(o),new l(0))===0)return gr(u);if(a(t(u),new l(0))===0)return gr(o);var m=gr(o),d=gr(u);return n(s(m,d),i(m,d))}})});var jE="add",w$=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],mv=F(jE,w$,e=>{var{typed:r,matrix:t,addScalar:n,equalScalar:a,DenseMatrix:i,SparseMatrix:s,concat:l}=e,c=Mn({typed:r}),o=Ru({typed:r,equalScalar:a}),u=ra({typed:r,DenseMatrix:i}),m=vr({typed:r,matrix:t,concat:l});return r(jE,{"any, any":n,"any, any, ...any":r.referToSelf(d=>(h,y,v)=>{for(var x=d(h,y),w=0;w{var{typed:r,abs:t,addScalar:n,divideScalar:a,multiplyScalar:i,sqrt:s,smaller:l,isPositive:c}=e;return r(eT,{"... number | BigNumber":o,Array:o,Matrix:u=>o(gr(u.toArray()))});function o(u){for(var m=0,d=0,h=0;h{var{typed:r,abs:t,add:n,pow:a,conj:i,sqrt:s,multiply:l,equalScalar:c,larger:o,smaller:u,matrix:m,ctranspose:d,eigs:h}=e;return r(rT,{number:Math.abs,Complex:function(_){return _.abs()},BigNumber:function(_){return _.abs()},boolean:function(_){return Math.abs(_)},Array:function(_){return S(m(_),2)},Matrix:function(_){return S(_,2)},"Array, number | BigNumber | string":function(_,E){return S(m(_),E)},"Matrix, number | BigNumber | string":function(_,E){return S(_,E)}});function y(O){var _=0;return O.forEach(function(E){var T=t(E);o(T,_)&&(_=T)},!0),_}function v(O){var _;return O.forEach(function(E){var T=t(E);(!_||u(T,_))&&(_=T)},!0),_||0}function x(O,_){if(_===Number.POSITIVE_INFINITY||_==="inf")return y(O);if(_===Number.NEGATIVE_INFINITY||_==="-inf")return v(O);if(_==="fro")return S(O,2);if(typeof _=="number"&&!isNaN(_)){if(!c(_,0)){var E=0;return O.forEach(function(T){E=n(a(t(T),_),E)},!0),a(E,1/_)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function w(O){var _=0;return O.forEach(function(E,T){_=n(_,l(E,i(E)))}),t(s(_))}function C(O){var _=[],E=0;return O.forEach(function(T,R){var L=R[1],H=n(_[L]||0,t(T));o(H,E)&&(E=H),_[L]=H},!0),E}function b(O){var _=O.size();if(_[0]!==_[1])throw new RangeError("Invalid matrix dimensions");var E=d(O),T=l(E,O),R=h(T).values.toArray(),L=R[R.length-1];return t(s(L))}function N(O){var _=[],E=0;return O.forEach(function(T,R){var L=R[0],H=n(_[L]||0,t(T));o(H,E)&&(E=H),_[L]=H},!0),E}function M(O,_){if(_===1)return C(O);if(_===Number.POSITIVE_INFINITY||_==="inf")return N(O);if(_==="fro")return w(O);if(_===2)return b(O);throw new Error("Unsupported parameter value "+_)}function S(O,_){var E=O.size();if(E.length===1)return x(O,_);if(E.length===2){if(E[0]&&E[1])return M(O,_);throw new RangeError("Invalid matrix dimensions")}}});var tT="dot",N$=["typed","addScalar","multiplyScalar","conj","size"],hv=F(tT,N$,e=>{var{typed:r,addScalar:t,multiplyScalar:n,conj:a,size:i}=e;return r(tT,{"Array | DenseMatrix, Array | DenseMatrix":l,"SparseMatrix, SparseMatrix":c});function s(u,m){var d=o(u),h=o(m),y,v;if(d.length===1)y=d[0];else if(d.length===2&&d[1]===1)y=d[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+d.join(", ")+")");if(h.length===1)v=h[0];else if(h.length===2&&h[1]===1)v=h[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+h.join(", ")+")");if(y!==v)throw new RangeError("Vectors must have equal length ("+y+" != "+v+")");if(y===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return y}function l(u,m){var d=s(u,m),h=Qe(u)?u._data:u,y=Qe(u)?u._datatype||u.getDataType():void 0,v=Qe(m)?m._data:m,x=Qe(m)?m._datatype||m.getDataType():void 0,w=o(u).length===2,C=o(m).length===2,b=t,N=n;if(y&&x&&y===x&&typeof y=="string"&&y!=="mixed"){var M=y;b=r.find(t,[M,M]),N=r.find(n,[M,M])}if(!w&&!C){for(var S=N(a(h[0]),v[0]),O=1;OS){N++;continue}M===S&&(x=w(x,C(h[b],v[N])),b++,N++)}return x}function o(u){return Qe(u)?u.size():i(u)}});var A$="trace",M$=["typed","matrix","add"],vv=F(A$,M$,e=>{var{typed:r,matrix:t,add:n}=e;return r("trace",{Array:function(l){return a(t(l))},SparseMatrix:i,DenseMatrix:a,any:ar});function a(s){var l=s._size,c=s._data;switch(l.length){case 1:if(l[0]===1)return ar(c[0]);throw new RangeError("Matrix must be square (size: "+lr(l)+")");case 2:{var o=l[0],u=l[1];if(o===u){for(var m=0,d=0;d0)for(var y=0;yy)break}return h}throw new RangeError("Matrix must be square (size: "+lr(u)+")")}});var nT="index",C$=["typed","Index"],gv=F(nT,C$,e=>{var{typed:r,Index:t}=e;return r(nT,{"...number | string | BigNumber | Range | Array | Matrix":function(a){var i=a.map(function(l){return rr(l)?l.toNumber():Mr(l)||Qe(l)?l.map(function(c){return rr(c)?c.toNumber():c}):l}),s=new t;return t.apply(s,i),s}})});var yv=new Set(["end"]);var E$="Node",T$=["mathWithTransform"],xv=F(E$,T$,e=>{var{mathWithTransform:r}=e;function t(a){for(var i of[...yv])if(a.has(i))throw new Error('Scope contains an illegal symbol, "'+i+'" is a reserved keyword')}class n{get type(){return"Node"}get isNode(){return!0}evaluate(i){return this.compile().evaluate(i)}compile(){var i=this._compile(r,{}),s={},l=null;function c(o){var u=ji(o);return t(u),i(u,s,l)}return{evaluate:c}}_compile(i,s){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(i){throw new Error("Cannot run forEach on a Node interface")}map(i){throw new Error("Cannot run map on a Node interface")}_ifNode(i){if(!Nr(i))throw new TypeError("Callback function must return a Node");return i}traverse(i){i(this,null,null);function s(l,c){l.forEach(function(o,u,m){c(o,u,m),s(o,c)})}s(this,i)}transform(i){function s(l,c,o){var u=i(l,c,o);return u!==l?u:l.map(s)}return s(this,null,null)}filter(i){var s=[];return this.traverse(function(l,c,o){i(l,c,o)&&s.push(l)}),s}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(i){return i.cloneDeep()})}equals(i){return i?this.type===i.type&&ni(this,i):!1}toString(i){var s=this._getCustomString(i);return typeof s<"u"?s:this._toString(i)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(i){var s=this._getCustomString(i);return typeof s<"u"?s:this._toHTML(i)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(i){var s=this._getCustomString(i);return typeof s<"u"?s:this._toTex(i)}_toTex(i){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(i){if(i&&typeof i=="object")switch(typeof i.handler){case"object":case"undefined":return;case"function":return i.handler(this,i);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return n},{isClass:!0,isNode:!0});function mt(e){return e&&e.isIndexError?new tn(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function bv(e){var{subset:r}=e;return function(n,a){try{if(Array.isArray(n))return r(n,a);if(n&&typeof n.subset=="function")return n.subset(a);if(typeof n=="string")return r(n,a);if(typeof n=="object"){if(!a.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return wt(n,a.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(i){throw mt(i)}}}var wv="AccessorNode",F$=["subset","Node"],Dv=F(wv,F$,e=>{var{subset:r,Node:t}=e,n=bv({subset:r});function a(s){return!(Ln(s)||jt(s)||xr(s)||yn(s)||Ei(s)||en(s)||at(s))}class i extends t{constructor(l,c){if(super(),!Nr(l))throw new TypeError('Node expected for parameter "object"');if(!Jn(c))throw new TypeError('IndexNode expected for parameter "index"');this.object=l,this.index=c}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return wv}get isAccessorNode(){return!0}_compile(l,c){var o=this.object._compile(l,c),u=this.index._compile(l,c);if(this.index.isObjectProperty()){var m=this.index.getObjectProperty();return function(h,y,v){return wt(o(h,y,v),m)}}else return function(h,y,v){var x=o(h,y,v),w=u(h,y,x);return n(x,w)}}forEach(l){l(this.object,"object",this),l(this.index,"index",this)}map(l){return new i(this._ifNode(l(this.object,"object",this)),this._ifNode(l(this.index,"index",this)))}clone(){return new i(this.object,this.index)}_toString(l){var c=this.object.toString(l);return a(this.object)&&(c="("+c+")"),c+this.index.toString(l)}_toHTML(l){var c=this.object.toHTML(l);return a(this.object)&&(c='('+c+')'),c+this.index.toHTML(l)}_toTex(l){var c=this.object.toTex(l);return a(this.object)&&(c="\\\\left(' + object + '\\\\right)"),c+this.index.toTex(l)}toJSON(){return{mathjs:wv,object:this.object,index:this.index}}static fromJSON(l){return new i(l.object,l.index)}}return Hr(i,"name",wv),i},{isClass:!0,isNode:!0});var Sv="ArrayNode",_$=["Node"],Nv=F(Sv,_$,e=>{var{Node:r}=e;class t extends r{constructor(a){if(super(),this.items=a||[],!Array.isArray(this.items)||!this.items.every(Nr))throw new TypeError("Array containing Nodes expected")}get type(){return Sv}get isArrayNode(){return!0}_compile(a,i){var s=Kn(this.items,function(o){return o._compile(a,i)}),l=a.config.matrix!=="Array";if(l){var c=a.matrix;return function(u,m,d){return c(Kn(s,function(h){return h(u,m,d)}))}}else return function(u,m,d){return Kn(s,function(h){return h(u,m,d)})}}forEach(a){for(var i=0;i['+i.join(',')+']'}_toTex(a){function i(s,l){var c=s.some(jt)&&!s.every(jt),o=l||c,u=o?"&":"\\\\\\\\",m=s.map(function(d){return d.items?i(d.items,!l):d.toTex(a)}).join(u);return c||!o||o&&!l?"\\\\begin{bmatrix}"+m+"\\\\end{bmatrix}":m}return i(this.items,!1)}}return Hr(t,"name",Sv),t},{isClass:!0,isNode:!0});function aT(e){var{subset:r,matrix:t}=e;return function(a,i,s){try{if(Array.isArray(a)){var l=t(a).subset(i,s).valueOf();return l.forEach((c,o)=>{a[o]=c}),a}else{if(a&&typeof a.subset=="function")return a.subset(i,s);if(typeof a=="string")return r(a,i,s);if(typeof a=="object"){if(!i.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Ti(a,i.getObjectProperty(),s),a}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(c){throw mt(c)}}}var ka=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function Av(e,r){if(!r||r!=="auto")return e;for(var t=e;en(t);)t=t.content;return t}function Qr(e,r,t,n){var a=e;r!=="keep"&&(a=e.getContent());for(var i=a.getIdentifier(),s=null,l=0;l{var{subset:r,matrix:t,Node:n}=e,a=bv({subset:r}),i=aT({subset:r,matrix:t});function s(c,o,u){o||(o="keep");var m=Qr(c,o,u),d=Qr(c.value,o,u);return o==="all"||d!==null&&d<=m}class l extends n{constructor(o,u,m){if(super(),this.object=o,this.index=m?u:null,this.value=m||u,!at(o)&&!Ln(o))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(at(o)&&o.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!Jn(this.index))throw new TypeError('IndexNode expected as "index"');if(!Nr(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Cv}get isAssignmentNode(){return!0}_compile(o,u){var m=this.object._compile(o,u),d=this.index?this.index._compile(o,u):null,h=this.value._compile(o,u),y=this.object.name;if(this.index)if(this.index.isObjectProperty()){var v=this.index.getObjectProperty();return function(N,M,S){var O=m(N,M,S),_=h(N,M,S);return Ti(O,v,_),_}}else{if(at(this.object))return function(N,M,S){var O=m(N,M,S),_=h(N,M,S),E=d(N,M,O);return N.set(y,i(O,E,_)),_};var x=this.object.object._compile(o,u);if(this.object.index.isObjectProperty()){var w=this.object.index.getObjectProperty();return function(N,M,S){var O=x(N,M,S),_=wt(O,w),E=d(N,M,_),T=h(N,M,S);return Ti(O,w,i(_,E,T)),T}}else{var C=this.object.index._compile(o,u);return function(N,M,S){var O=x(N,M,S),_=C(N,M,O),E=a(O,_),T=d(N,M,E),R=h(N,M,S);return i(O,_,i(E,T,R)),R}}}else{if(!at(this.object))throw new TypeError("SymbolNode expected as object");return function(N,M,S){var O=h(N,M,S);return N.set(y,O),O}}}forEach(o){o(this.object,"object",this),this.index&&o(this.index,"index",this),o(this.value,"value",this)}map(o){var u=this._ifNode(o(this.object,"object",this)),m=this.index?this._ifNode(o(this.index,"index",this)):null,d=this._ifNode(o(this.value,"value",this));return new l(u,m,d)}clone(){return new l(this.object,this.index,this.value)}_toString(o){var u=this.object.toString(o),m=this.index?this.index.toString(o):"",d=this.value.toString(o);return s(this,o&&o.parenthesis,o&&o.implicit)&&(d="("+d+")"),u+m+" = "+d}toJSON(){return{mathjs:Cv,object:this.object,index:this.index,value:this.value}}static fromJSON(o){return new l(o.object,o.index,o.value)}_toHTML(o){var u=this.object.toHTML(o),m=this.index?this.index.toHTML(o):"",d=this.value.toHTML(o);return s(this,o&&o.parenthesis,o&&o.implicit)&&(d='('+d+')'),u+m+'='+d}_toTex(o){var u=this.object.toTex(o),m=this.index?this.index.toTex(o):"",d=this.value.toTex(o);return s(this,o&&o.parenthesis,o&&o.implicit)&&(d="\\\\left(".concat(d,"\\\\right)")),u+m+"="+d}}return Hr(l,"name",Cv),l},{isClass:!0,isNode:!0});var Tv="BlockNode",B$=["ResultSet","Node"],Fv=F(Tv,B$,e=>{var{ResultSet:r,Node:t}=e;class n extends t{constructor(i){if(super(),!Array.isArray(i))throw new Error("Array expected");this.blocks=i.map(function(s){var l=s&&s.node,c=s&&s.visible!==void 0?s.visible:!0;if(!Nr(l))throw new TypeError('Property "node" must be a Node');if(typeof c!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:l,visible:c}})}get type(){return Tv}get isBlockNode(){return!0}_compile(i,s){var l=Kn(this.blocks,function(c){return{evaluate:c.node._compile(i,s),visible:c.visible}});return function(o,u,m){var d=[];return _o(l,function(y){var v=y.evaluate(o,u,m);y.visible&&d.push(v)}),new r(d)}}forEach(i){for(var s=0;s;')}).join('
')}_toTex(i){return this.blocks.map(function(s){return s.node.toTex(i)+(s.visible?"":";")}).join(\`\\\\;\\\\; +\`)}}return Hr(n,"name",Tv),n},{isClass:!0,isNode:!0});var _v="ConditionalNode",P$=["Node"],Ov=F(_v,P$,e=>{var{Node:r}=e;function t(a){if(typeof a=="number"||typeof a=="boolean"||typeof a=="string")return!!a;if(a){if(rr(a))return!a.isZero();if(Kt(a))return!!(a.re||a.im);if(Ht(a))return!!a.value}if(a==null)return!1;throw new TypeError('Unsupported type of condition "'+Tr(a)+'"')}class n extends r{constructor(i,s,l){if(super(),!Nr(i))throw new TypeError("Parameter condition must be a Node");if(!Nr(s))throw new TypeError("Parameter trueExpr must be a Node");if(!Nr(l))throw new TypeError("Parameter falseExpr must be a Node");this.condition=i,this.trueExpr=s,this.falseExpr=l}get type(){return _v}get isConditionalNode(){return!0}_compile(i,s){var l=this.condition._compile(i,s),c=this.trueExpr._compile(i,s),o=this.falseExpr._compile(i,s);return function(m,d,h){return t(l(m,d,h))?c(m,d,h):o(m,d,h)}}forEach(i){i(this.condition,"condition",this),i(this.trueExpr,"trueExpr",this),i(this.falseExpr,"falseExpr",this)}map(i){return new n(this._ifNode(i(this.condition,"condition",this)),this._ifNode(i(this.trueExpr,"trueExpr",this)),this._ifNode(i(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(i){var s=i&&i.parenthesis?i.parenthesis:"keep",l=Qr(this,s,i&&i.implicit),c=this.condition.toString(i),o=Qr(this.condition,s,i&&i.implicit);(s==="all"||this.condition.type==="OperatorNode"||o!==null&&o<=l)&&(c="("+c+")");var u=this.trueExpr.toString(i),m=Qr(this.trueExpr,s,i&&i.implicit);(s==="all"||this.trueExpr.type==="OperatorNode"||m!==null&&m<=l)&&(u="("+u+")");var d=this.falseExpr.toString(i),h=Qr(this.falseExpr,s,i&&i.implicit);return(s==="all"||this.falseExpr.type==="OperatorNode"||h!==null&&h<=l)&&(d="("+d+")"),c+" ? "+u+" : "+d}toJSON(){return{mathjs:_v,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(i){return new n(i.condition,i.trueExpr,i.falseExpr)}_toHTML(i){var s=i&&i.parenthesis?i.parenthesis:"keep",l=Qr(this,s,i&&i.implicit),c=this.condition.toHTML(i),o=Qr(this.condition,s,i&&i.implicit);(s==="all"||this.condition.type==="OperatorNode"||o!==null&&o<=l)&&(c='('+c+')');var u=this.trueExpr.toHTML(i),m=Qr(this.trueExpr,s,i&&i.implicit);(s==="all"||this.trueExpr.type==="OperatorNode"||m!==null&&m<=l)&&(u='('+u+')');var d=this.falseExpr.toHTML(i),h=Qr(this.falseExpr,s,i&&i.implicit);return(s==="all"||this.falseExpr.type==="OperatorNode"||h!==null&&h<=l)&&(d='('+d+')'),c+'?'+u+':'+d}_toTex(i){return"\\\\begin{cases} {"+this.trueExpr.toTex(i)+"}, &\\\\quad{\\\\text{if }\\\\;"+this.condition.toTex(i)+"}\\\\\\\\{"+this.falseExpr.toTex(i)+"}, &\\\\quad{\\\\text{otherwise}}\\\\end{cases}"}}return Hr(n,"name",_v),n},{isClass:!0,isNode:!0});var fT=ma(sT(),1);var yD={Alpha:"A",alpha:"\\\\alpha",Beta:"B",beta:"\\\\beta",Gamma:"\\\\Gamma",gamma:"\\\\gamma",Delta:"\\\\Delta",delta:"\\\\delta",Epsilon:"E",epsilon:"\\\\epsilon",varepsilon:"\\\\varepsilon",Zeta:"Z",zeta:"\\\\zeta",Eta:"H",eta:"\\\\eta",Theta:"\\\\Theta",theta:"\\\\theta",vartheta:"\\\\vartheta",Iota:"I",iota:"\\\\iota",Kappa:"K",kappa:"\\\\kappa",varkappa:"\\\\varkappa",Lambda:"\\\\Lambda",lambda:"\\\\lambda",Mu:"M",mu:"\\\\mu",Nu:"N",nu:"\\\\nu",Xi:"\\\\Xi",xi:"\\\\xi",Omicron:"O",omicron:"o",Pi:"\\\\Pi",pi:"\\\\pi",varpi:"\\\\varpi",Rho:"P",rho:"\\\\rho",varrho:"\\\\varrho",Sigma:"\\\\Sigma",sigma:"\\\\sigma",varsigma:"\\\\varsigma",Tau:"T",tau:"\\\\tau",Upsilon:"\\\\Upsilon",upsilon:"\\\\upsilon",Phi:"\\\\Phi",phi:"\\\\phi",varphi:"\\\\varphi",Chi:"X",chi:"\\\\chi",Psi:"\\\\Psi",psi:"\\\\psi",Omega:"\\\\Omega",omega:"\\\\omega",true:"\\\\mathrm{True}",false:"\\\\mathrm{False}",i:"i",inf:"\\\\infty",Inf:"\\\\infty",infinity:"\\\\infty",Infinity:"\\\\infty",oo:"\\\\infty",lim:"\\\\lim",undefined:"\\\\mathbf{?}"},$r={transpose:"^\\\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\\\~",not:"\\\\neg",multiply:"\\\\cdot",divide:"\\\\frac",dotMultiply:".\\\\cdot",dotDivide:".:",mod:"\\\\mod",add:"+",subtract:"-",to:"\\\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\\\neq",smaller:"<",larger:">",smallerEq:"\\\\leq",largerEq:"\\\\geq",bitAnd:"\\\\&",bitXor:"\\\\underline{|}",bitOr:"|",and:"\\\\wedge",xor:"\\\\veebar",or:"\\\\vee"},xD={abs:{1:"\\\\left|\${args[0]}\\\\right|"},add:{2:"\\\\left(\${args[0]}".concat($r.add,"\${args[1]}\\\\right)")},cbrt:{1:"\\\\sqrt[3]{\${args[0]}}"},ceil:{1:"\\\\left\\\\lceil\${args[0]}\\\\right\\\\rceil"},cube:{1:"\\\\left(\${args[0]}\\\\right)^3"},divide:{2:"\\\\frac{\${args[0]}}{\${args[1]}}"},dotDivide:{2:"\\\\left(\${args[0]}".concat($r.dotDivide,"\${args[1]}\\\\right)")},dotMultiply:{2:"\\\\left(\${args[0]}".concat($r.dotMultiply,"\${args[1]}\\\\right)")},dotPow:{2:"\\\\left(\${args[0]}".concat($r.dotPow,"\${args[1]}\\\\right)")},exp:{1:"\\\\exp\\\\left(\${args[0]}\\\\right)"},expm1:"\\\\left(e".concat($r.pow,"{\${args[0]}}-1\\\\right)"),fix:{1:"\\\\mathrm{\${name}}\\\\left(\${args[0]}\\\\right)"},floor:{1:"\\\\left\\\\lfloor\${args[0]}\\\\right\\\\rfloor"},gcd:"\\\\gcd\\\\left(\${args}\\\\right)",hypot:"\\\\hypot\\\\left(\${args}\\\\right)",log:{1:"\\\\ln\\\\left(\${args[0]}\\\\right)",2:"\\\\log_{\${args[1]}}\\\\left(\${args[0]}\\\\right)"},log10:{1:"\\\\log_{10}\\\\left(\${args[0]}\\\\right)"},log1p:{1:"\\\\ln\\\\left(\${args[0]}+1\\\\right)",2:"\\\\log_{\${args[1]}}\\\\left(\${args[0]}+1\\\\right)"},log2:"\\\\log_{2}\\\\left(\${args[0]}\\\\right)",mod:{2:"\\\\left(\${args[0]}".concat($r.mod,"\${args[1]}\\\\right)")},multiply:{2:"\\\\left(\${args[0]}".concat($r.multiply,"\${args[1]}\\\\right)")},norm:{1:"\\\\left\\\\|\${args[0]}\\\\right\\\\|",2:void 0},nthRoot:{2:"\\\\sqrt[\${args[1]}]{\${args[0]}}"},nthRoots:{2:"\\\\{y : $y^{args[1]} = {\${args[0]}}\\\\}"},pow:{2:"\\\\left(\${args[0]}\\\\right)".concat($r.pow,"{\${args[1]}}")},round:{1:"\\\\left\\\\lfloor\${args[0]}\\\\right\\\\rceil",2:void 0},sign:{1:"\\\\mathrm{\${name}}\\\\left(\${args[0]}\\\\right)"},sqrt:{1:"\\\\sqrt{\${args[0]}}"},square:{1:"\\\\left(\${args[0]}\\\\right)^2"},subtract:{2:"\\\\left(\${args[0]}".concat($r.subtract,"\${args[1]}\\\\right)")},unaryMinus:{1:"".concat($r.unaryMinus,"\\\\left(\${args[0]}\\\\right)")},unaryPlus:{1:"".concat($r.unaryPlus,"\\\\left(\${args[0]}\\\\right)")},bitAnd:{2:"\\\\left(\${args[0]}".concat($r.bitAnd,"\${args[1]}\\\\right)")},bitNot:{1:$r.bitNot+"\\\\left(\${args[0]}\\\\right)"},bitOr:{2:"\\\\left(\${args[0]}".concat($r.bitOr,"\${args[1]}\\\\right)")},bitXor:{2:"\\\\left(\${args[0]}".concat($r.bitXor,"\${args[1]}\\\\right)")},leftShift:{2:"\\\\left(\${args[0]}".concat($r.leftShift,"\${args[1]}\\\\right)")},rightArithShift:{2:"\\\\left(\${args[0]}".concat($r.rightArithShift,"\${args[1]}\\\\right)")},rightLogShift:{2:"\\\\left(\${args[0]}".concat($r.rightLogShift,"\${args[1]}\\\\right)")},bellNumbers:{1:"\\\\mathrm{B}_{\${args[0]}}"},catalan:{1:"\\\\mathrm{C}_{\${args[0]}}"},stirlingS2:{2:"\\\\mathrm{S}\\\\left(\${args}\\\\right)"},arg:{1:"\\\\arg\\\\left(\${args[0]}\\\\right)"},conj:{1:"\\\\left(\${args[0]}\\\\right)^*"},im:{1:"\\\\Im\\\\left\\\\lbrace\${args[0]}\\\\right\\\\rbrace"},re:{1:"\\\\Re\\\\left\\\\lbrace\${args[0]}\\\\right\\\\rbrace"},and:{2:"\\\\left(\${args[0]}".concat($r.and,"\${args[1]}\\\\right)")},not:{1:$r.not+"\\\\left(\${args[0]}\\\\right)"},or:{2:"\\\\left(\${args[0]}".concat($r.or,"\${args[1]}\\\\right)")},xor:{2:"\\\\left(\${args[0]}".concat($r.xor,"\${args[1]}\\\\right)")},cross:{2:"\\\\left(\${args[0]}\\\\right)\\\\times\\\\left(\${args[1]}\\\\right)"},ctranspose:{1:"\\\\left(\${args[0]}\\\\right)".concat($r.ctranspose)},det:{1:"\\\\det\\\\left(\${args[0]}\\\\right)"},dot:{2:"\\\\left(\${args[0]}\\\\cdot\${args[1]}\\\\right)"},expm:{1:"\\\\exp\\\\left(\${args[0]}\\\\right)"},inv:{1:"\\\\left(\${args[0]}\\\\right)^{-1}"},pinv:{1:"\\\\left(\${args[0]}\\\\right)^{+}"},sqrtm:{1:"{\${args[0]}}".concat($r.pow,"{\\\\frac{1}{2}}")},trace:{1:"\\\\mathrm{tr}\\\\left(\${args[0]}\\\\right)"},transpose:{1:"\\\\left(\${args[0]}\\\\right)".concat($r.transpose)},combinations:{2:"\\\\binom{\${args[0]}}{\${args[1]}}"},combinationsWithRep:{2:"\\\\left(\\\\!\\\\!{\\\\binom{\${args[0]}}{\${args[1]}}}\\\\!\\\\!\\\\right)"},factorial:{1:"\\\\left(\${args[0]}\\\\right)".concat($r.factorial)},gamma:{1:"\\\\Gamma\\\\left(\${args[0]}\\\\right)"},lgamma:{1:"\\\\ln\\\\Gamma\\\\left(\${args[0]}\\\\right)"},equal:{2:"\\\\left(\${args[0]}".concat($r.equal,"\${args[1]}\\\\right)")},larger:{2:"\\\\left(\${args[0]}".concat($r.larger,"\${args[1]}\\\\right)")},largerEq:{2:"\\\\left(\${args[0]}".concat($r.largerEq,"\${args[1]}\\\\right)")},smaller:{2:"\\\\left(\${args[0]}".concat($r.smaller,"\${args[1]}\\\\right)")},smallerEq:{2:"\\\\left(\${args[0]}".concat($r.smallerEq,"\${args[1]}\\\\right)")},unequal:{2:"\\\\left(\${args[0]}".concat($r.unequal,"\${args[1]}\\\\right)")},erf:{1:"erf\\\\left(\${args[0]}\\\\right)"},max:"\\\\max\\\\left(\${args}\\\\right)",min:"\\\\min\\\\left(\${args}\\\\right)",variance:"\\\\mathrm{Var}\\\\left(\${args}\\\\right)",acos:{1:"\\\\cos^{-1}\\\\left(\${args[0]}\\\\right)"},acosh:{1:"\\\\cosh^{-1}\\\\left(\${args[0]}\\\\right)"},acot:{1:"\\\\cot^{-1}\\\\left(\${args[0]}\\\\right)"},acoth:{1:"\\\\coth^{-1}\\\\left(\${args[0]}\\\\right)"},acsc:{1:"\\\\csc^{-1}\\\\left(\${args[0]}\\\\right)"},acsch:{1:"\\\\mathrm{csch}^{-1}\\\\left(\${args[0]}\\\\right)"},asec:{1:"\\\\sec^{-1}\\\\left(\${args[0]}\\\\right)"},asech:{1:"\\\\mathrm{sech}^{-1}\\\\left(\${args[0]}\\\\right)"},asin:{1:"\\\\sin^{-1}\\\\left(\${args[0]}\\\\right)"},asinh:{1:"\\\\sinh^{-1}\\\\left(\${args[0]}\\\\right)"},atan:{1:"\\\\tan^{-1}\\\\left(\${args[0]}\\\\right)"},atan2:{2:"\\\\mathrm{atan2}\\\\left(\${args}\\\\right)"},atanh:{1:"\\\\tanh^{-1}\\\\left(\${args[0]}\\\\right)"},cos:{1:"\\\\cos\\\\left(\${args[0]}\\\\right)"},cosh:{1:"\\\\cosh\\\\left(\${args[0]}\\\\right)"},cot:{1:"\\\\cot\\\\left(\${args[0]}\\\\right)"},coth:{1:"\\\\coth\\\\left(\${args[0]}\\\\right)"},csc:{1:"\\\\csc\\\\left(\${args[0]}\\\\right)"},csch:{1:"\\\\mathrm{csch}\\\\left(\${args[0]}\\\\right)"},sec:{1:"\\\\sec\\\\left(\${args[0]}\\\\right)"},sech:{1:"\\\\mathrm{sech}\\\\left(\${args[0]}\\\\right)"},sin:{1:"\\\\sin\\\\left(\${args[0]}\\\\right)"},sinh:{1:"\\\\sinh\\\\left(\${args[0]}\\\\right)"},tan:{1:"\\\\tan\\\\left(\${args[0]}\\\\right)"},tanh:{1:"\\\\tanh\\\\left(\${args[0]}\\\\right)"},to:{2:"\\\\left(\${args[0]}".concat($r.to,"\${args[1]}\\\\right)")},numeric:function(r,t){return r.args[0].toTex()},number:{0:"0",1:"\\\\left(\${args[0]}\\\\right)",2:"\\\\left(\\\\left(\${args[0]}\\\\right)\${args[1]}\\\\right)"},string:{0:'\\\\mathtt{""}',1:"\\\\mathrm{string}\\\\left(\${args[0]}\\\\right)"},bignumber:{0:"0",1:"\\\\left(\${args[0]}\\\\right)"},complex:{0:"0",1:"\\\\left(\${args[0]}\\\\right)",2:"\\\\left(\\\\left(\${args[0]}\\\\right)+".concat(yD.i,"\\\\cdot\\\\left(\${args[1]}\\\\right)\\\\right)")},matrix:{0:"\\\\begin{bmatrix}\\\\end{bmatrix}",1:"\\\\left(\${args[0]}\\\\right)",2:"\\\\left(\${args[0]}\\\\right)"},sparse:{0:"\\\\begin{bsparse}\\\\end{bsparse}",1:"\\\\left(\${args[0]}\\\\right)"},unit:{1:"\\\\left(\${args[0]}\\\\right)",2:"\\\\left(\\\\left(\${args[0]}\\\\right)\${args[1]}\\\\right)"}},cT="\\\\mathrm{\${name}}\\\\left(\${args}\\\\right)",uT={deg:"^\\\\circ"};function Bv(e){return(0,fT.default)(e,{preserveFormatting:!0})}function Pv(e,r){return r=typeof r>"u"?!1:r,r?Xe(uT,e)?uT[e]:"\\\\mathrm{"+Bv(e)+"}":Xe(yD,e)?yD[e]:Bv(e)}var Iv="ConstantNode",k$=["Node"],Rv=F(Iv,k$,e=>{var{Node:r}=e;class t extends r{constructor(a){super(),this.value=a}get type(){return Iv}get isConstantNode(){return!0}_compile(a,i){var s=this.value;return function(){return s}}forEach(a){}map(a){return this.clone()}clone(){return new t(this.value)}_toString(a){return lr(this.value,a)}_toHTML(a){var i=this._toString(a);switch(Tr(this.value)){case"number":case"BigNumber":case"Fraction":return''+i+"";case"string":return''+i+"";case"boolean":return''+i+"";case"null":return''+i+"";case"undefined":return''+i+"";default:return''+i+""}}toJSON(){return{mathjs:Iv,value:this.value}}static fromJSON(a){return new t(a.value)}_toTex(a){var i=this._toString(a),s=Tr(this.value);switch(s){case"string":return"\\\\mathtt{"+Bv(i)+"}";case"number":case"BigNumber":{var l=s==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!l)return this.value.valueOf()<0?"-\\\\infty":"\\\\infty";var c=i.toLowerCase().indexOf("e");return c!==-1?i.substring(0,c)+"\\\\cdot10^{"+i.substring(c+1)+"}":i}case"Fraction":return this.value.toLatex();default:return i}}}return Hr(t,"name",Iv),t},{isClass:!0,isNode:!0});var qv="FunctionAssignmentNode",L$=["typed","Node"],kv=F(qv,L$,e=>{var{typed:r,Node:t}=e;function n(i,s,l){var c=Qr(i,s,l),o=Qr(i.expr,s,l);return s==="all"||o!==null&&o<=c}class a extends t{constructor(s,l,c){if(super(),typeof s!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(l))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!Nr(c))throw new TypeError('Node expected for parameter "expr"');if(yv.has(s))throw new Error('Illegal function name, "'+s+'" is a reserved keyword');var o=new Set;for(var u of l){var m=typeof u=="string"?u:u.name;if(o.has(m))throw new Error('Duplicate parameter name "'.concat(m,'"'));o.add(m)}this.name=s,this.params=l.map(function(d){return d&&d.name||d}),this.types=l.map(function(d){return d&&d.type||"any"}),this.expr=c}get type(){return qv}get isFunctionAssignmentNode(){return!0}_compile(s,l){var c=Object.create(l);_o(this.params,function(y){c[y]=!0});var o=this.expr._compile(s,c),u=this.name,m=this.params,d=Xb(this.types,","),h=u+"("+Xb(this.params,", ")+")";return function(v,x,w){var C={};C[d]=function(){for(var N=Object.create(x),M=0;M'+rn(this.params[o])+"");var u=this.expr.toHTML(s);return n(this,l,s&&s.implicit)&&(u='('+u+')'),''+rn(this.name)+'('+c.join(',')+')='+u}_toTex(s){var l=s&&s.parenthesis?s.parenthesis:"keep",c=this.expr.toTex(s);return n(this,l,s&&s.implicit)&&(c="\\\\left(".concat(c,"\\\\right)")),"\\\\mathrm{"+this.name+"}\\\\left("+this.params.map(Pv).join(",")+"\\\\right)="+c}}return Hr(a,"name",qv),a},{isClass:!0,isNode:!0});var Lv="IndexNode",z$=["Node","size"],zv=F(Lv,z$,e=>{var{Node:r,size:t}=e;class n extends r{constructor(i,s){if(super(),this.dimensions=i,this.dotNotation=s||!1,!Array.isArray(i)||!i.every(Nr))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return Lv}get isIndexNode(){return!0}_compile(i,s){var l=Kn(this.dimensions,function(o,u){var m=o.filter(y=>y.isSymbolNode&&y.name==="end").length>0;if(m){var d=Object.create(s);d.end=!0;var h=o._compile(i,d);return function(v,x,w){if(!Qe(w)&&!Mr(w)&&!St(w))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Tr(w));var C=t(w).valueOf(),b=Object.create(x);return b.end=C[u],h(v,b,w)}}else return o._compile(i,s)}),c=wt(i,"index");return function(u,m,d){var h=Kn(l,function(y){return y(u,m,d)});return c(...h)}}forEach(i){for(var s=0;s.'+rn(this.getObjectProperty())+"":'['+s.join(',')+']'}_toTex(i){var s=this.dimensions.map(function(l){return l.toTex(i)});return this.dotNotation?"."+this.getObjectProperty():"_{"+s.join(",")+"}"}}return Hr(n,"name",Lv),n},{isClass:!0,isNode:!0});var Uv="ObjectNode",U$=["Node"],Wv=F(Uv,U$,e=>{var{Node:r}=e;class t extends r{constructor(a){if(super(),this.properties=a||{},a&&(typeof a!="object"||!Object.keys(a).every(function(i){return Nr(a[i])})))throw new TypeError("Object containing Nodes expected")}get type(){return Uv}get isObjectNode(){return!0}_compile(a,i){var s={};for(var l in this.properties)if(Xe(this.properties,l)){var c=Ns(l),o=JSON.parse(c),u=wt(this.properties,l);s[o]=u._compile(a,i)}return function(d,h,y){var v={};for(var x in s)Xe(s,x)&&(v[x]=s[x](d,h,y));return v}}forEach(a){for(var i in this.properties)Xe(this.properties,i)&&a(this.properties[i],"properties["+Ns(i)+"]",this)}map(a){var i={};for(var s in this.properties)Xe(this.properties,s)&&(i[s]=this._ifNode(a(this.properties[s],"properties["+Ns(s)+"]",this)));return new t(i)}clone(){var a={};for(var i in this.properties)Xe(this.properties,i)&&(a[i]=this.properties[i]);return new t(a)}_toString(a){var i=[];for(var s in this.properties)Xe(this.properties,s)&&i.push(Ns(s)+": "+this.properties[s].toString(a));return"{"+i.join(", ")+"}"}toJSON(){return{mathjs:Uv,properties:this.properties}}static fromJSON(a){return new t(a.properties)}_toHTML(a){var i=[];for(var s in this.properties)Xe(this.properties,s)&&i.push(''+rn(s)+':'+this.properties[s].toHTML(a));return'{'+i.join(',')+'}'}_toTex(a){var i=[];for(var s in this.properties)Xe(this.properties,s)&&i.push("\\\\mathbf{"+s+":} & "+this.properties[s].toTex(a)+"\\\\\\\\");var l="\\\\left\\\\{\\\\begin{array}{ll}"+i.join(\` +\`)+"\\\\end{array}\\\\right\\\\}";return l}}return Hr(t,"name",Uv),t},{isClass:!0,isNode:!0});function Os(e,r){return new Eu(e,new Cs(r),new Set(Object.keys(r)))}var Yv="OperatorNode",W$=["Node"],Hv=F(Yv,W$,e=>{var{Node:r}=e;function t(i,s){var l=i;if(s==="auto")for(;en(l);)l=l.content;return xr(l)?!0:ct(l)?t(l.args[0],s):!1}function n(i,s,l,c,o){var u=Qr(i,s,l),m=tf(i,s);if(s==="all"||c.length>2&&i.getIdentifier()!=="OperatorNode:add"&&i.getIdentifier()!=="OperatorNode:multiply")return c.map(function(T){switch(T.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var d;switch(c.length){case 0:d=[];break;case 1:{var h=Qr(c[0],s,l,i);if(o&&h!==null){var y,v;if(s==="keep"?(y=c[0].getIdentifier(),v=i.getIdentifier()):(y=c[0].getContent().getIdentifier(),v=i.getContent().getIdentifier()),ka[u][v].latexLeftParens===!1){d=[!1];break}if(ka[h][y].latexParens===!1){d=[!1];break}}if(h===null){d=[!1];break}if(h<=u){d=[!0];break}d=[!1]}break;case 2:{var x,w=Qr(c[0],s,l,i),C=Mv(i,c[0],s);w===null?x=!1:w===u&&m==="right"&&!C||w=2&&i.getIdentifier()==="OperatorNode:multiply"&&i.implicit&&s!=="all"&&l==="hide")for(var E=1;E2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var x=o.map(function(w,C){return w=w.toString(s),u[C]&&(w="("+w+")"),w});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?x.join(" "):x.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Yv,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(s){return new a(s.op,s.fn,s.args,s.implicit,s.isPercentage)}_toHTML(s){var l=s&&s.parenthesis?s.parenthesis:"keep",c=s&&s.implicit?s.implicit:"hide",o=this.args,u=n(this,l,c,o,!1);if(o.length===1){var m=tf(this,l),d=o[0].toHTML(s);return u[0]&&(d='('+d+')'),m==="right"?''+rn(this.op)+""+d:d+''+rn(this.op)+""}else if(o.length===2){var h=o[0].toHTML(s),y=o[1].toHTML(s);return u[0]&&(h='('+h+')'),u[1]&&(y='('+y+')'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?h+''+y:h+''+rn(this.op)+""+y}else{var v=o.map(function(x,w){return x=x.toHTML(s),u[w]&&(x='('+x+')'),x});return o.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?v.join(''):v.join(''+rn(this.op)+""):''+rn(this.fn)+'('+v.join(',')+')'}}_toTex(s){var l=s&&s.parenthesis?s.parenthesis:"keep",c=s&&s.implicit?s.implicit:"hide",o=this.args,u=n(this,l,c,o,!0),m=$r[this.fn];if(m=typeof m>"u"?this.op:m,o.length===1){var d=tf(this,l),h=o[0].toTex(s);return u[0]&&(h="\\\\left(".concat(h,"\\\\right)")),d==="right"?m+h:h+m}else if(o.length===2){var y=o[0],v=y.toTex(s);u[0]&&(v="\\\\left(".concat(v,"\\\\right)"));var x=o[1],w=x.toTex(s);u[1]&&(w="\\\\left(".concat(w,"\\\\right)"));var C;switch(l==="keep"?C=y.getIdentifier():C=y.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return m+"{"+v+"}{"+w+"}";case"OperatorNode:pow":switch(v="{"+v+"}",w="{"+w+"}",C){case"ConditionalNode":case"OperatorNode:divide":v="\\\\left(".concat(v,"\\\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&c==="hide")return v+"~"+w}return v+m+w}else if(o.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var b=o.map(function(N,M){return N=N.toTex(s),u[M]&&(N="\\\\left(".concat(N,"\\\\right)")),N});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&c==="hide"?b.join("~"):b.join(m)}else return"\\\\mathrm{"+this.fn+"}\\\\left("+o.map(function(N){return N.toTex(s)}).join(",")+"\\\\right)"}getIdentifier(){return this.type+":"+this.fn}}return Hr(a,"name",Yv),a},{isClass:!0,isNode:!0});var $v="ParenthesisNode",Y$=["Node"],Gv=F($v,Y$,e=>{var{Node:r}=e;class t extends r{constructor(a){if(super(),!Nr(a))throw new TypeError('Node expected for parameter "content"');this.content=a}get type(){return $v}get isParenthesisNode(){return!0}_compile(a,i){return this.content._compile(a,i)}getContent(){return this.content.getContent()}forEach(a){a(this.content,"content",this)}map(a){var i=a(this.content,"content",this);return new t(i)}clone(){return new t(this.content)}_toString(a){return!a||a&&!a.parenthesis||a&&a.parenthesis==="keep"?"("+this.content.toString(a)+")":this.content.toString(a)}toJSON(){return{mathjs:$v,content:this.content}}static fromJSON(a){return new t(a.content)}_toHTML(a){return!a||a&&!a.parenthesis||a&&a.parenthesis==="keep"?'('+this.content.toHTML(a)+')':this.content.toHTML(a)}_toTex(a){return!a||a&&!a.parenthesis||a&&a.parenthesis==="keep"?"\\\\left(".concat(this.content.toTex(a),"\\\\right)"):this.content.toTex(a)}}return Hr(t,"name",$v),t},{isClass:!0,isNode:!0});var Vv="RangeNode",H$=["Node"],Zv=F(Vv,H$,e=>{var{Node:r}=e;function t(a,i,s){var l=Qr(a,i,s),c={},o=Qr(a.start,i,s);if(c.start=o!==null&&o<=l||i==="all",a.step){var u=Qr(a.step,i,s);c.step=u!==null&&u<=l||i==="all"}var m=Qr(a.end,i,s);return c.end=m!==null&&m<=l||i==="all",c}class n extends r{constructor(i,s,l){if(super(),!Nr(i))throw new TypeError("Node expected");if(!Nr(s))throw new TypeError("Node expected");if(l&&!Nr(l))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=i,this.end=s,this.step=l||null}get type(){return Vv}get isRangeNode(){return!0}needsEnd(){var i=this.filter(function(s){return at(s)&&s.name==="end"});return i.length>0}_compile(i,s){var l=i.range,c=this.start._compile(i,s),o=this.end._compile(i,s);if(this.step){var u=this.step._compile(i,s);return function(d,h,y){return l(c(d,h,y),o(d,h,y),u(d,h,y))}}else return function(d,h,y){return l(c(d,h,y),o(d,h,y))}}forEach(i){i(this.start,"start",this),i(this.end,"end",this),this.step&&i(this.step,"step",this)}map(i){return new n(this._ifNode(i(this.start,"start",this)),this._ifNode(i(this.end,"end",this)),this.step&&this._ifNode(i(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(i){var s=i&&i.parenthesis?i.parenthesis:"keep",l=t(this,s,i&&i.implicit),c,o=this.start.toString(i);if(l.start&&(o="("+o+")"),c=o,this.step){var u=this.step.toString(i);l.step&&(u="("+u+")"),c+=":"+u}var m=this.end.toString(i);return l.end&&(m="("+m+")"),c+=":"+m,c}toJSON(){return{mathjs:Vv,start:this.start,end:this.end,step:this.step}}static fromJSON(i){return new n(i.start,i.end,i.step)}_toHTML(i){var s=i&&i.parenthesis?i.parenthesis:"keep",l=t(this,s,i&&i.implicit),c,o=this.start.toHTML(i);if(l.start&&(o='('+o+')'),c=o,this.step){var u=this.step.toHTML(i);l.step&&(u='('+u+')'),c+=':'+u}var m=this.end.toHTML(i);return l.end&&(m='('+m+')'),c+=':'+m,c}_toTex(i){var s=i&&i.parenthesis?i.parenthesis:"keep",l=t(this,s,i&&i.implicit),c=this.start.toTex(i);if(l.start&&(c="\\\\left(".concat(c,"\\\\right)")),this.step){var o=this.step.toTex(i);l.step&&(o="\\\\left(".concat(o,"\\\\right)")),c+=":"+o}var u=this.end.toTex(i);return l.end&&(u="\\\\left(".concat(u,"\\\\right)")),c+=":"+u,c}}return Hr(n,"name",Vv),n},{isClass:!0,isNode:!0});var Qv="RelationalNode",$$=["Node"],Xv=F(Qv,$$,e=>{var{Node:r}=e,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends r{constructor(i,s){if(super(),!Array.isArray(i))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(s))throw new TypeError("Parameter params must be an array");if(i.length!==s.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=i,this.params=s}get type(){return Qv}get isRelationalNode(){return!0}_compile(i,s){var l=this,c=this.params.map(o=>o._compile(i,s));return function(u,m,d){for(var h,y=c[0](u,m,d),v=0;vi(s,"params["+l+"]",this),this)}map(i){return new n(this.conditionals.slice(),this.params.map((s,l)=>this._ifNode(i(s,"params["+l+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(i){for(var s=i&&i.parenthesis?i.parenthesis:"keep",l=Qr(this,s,i&&i.implicit),c=this.params.map(function(m,d){var h=Qr(m,s,i&&i.implicit);return s==="all"||h!==null&&h<=l?"("+m.toString(i)+")":m.toString(i)}),o=c[0],u=0;u('+m.toHTML(i)+')':m.toHTML(i)}),o=c[0],u=0;u'+rn(t[this.conditionals[u]])+""+c[u+1];return o}_toTex(i){for(var s=i&&i.parenthesis?i.parenthesis:"keep",l=Qr(this,s,i&&i.implicit),c=this.params.map(function(m,d){var h=Qr(m,s,i&&i.implicit);return s==="all"||h!==null&&h<=l?"\\\\left("+m.toTex(i)+"\\right)":m.toTex(i)}),o=c[0],u=0;u{var{math:r,Unit:t,Node:n}=e;function a(s){return t?t.isValuelessUnit(s):!1}class i extends n{constructor(l){if(super(),typeof l!="string")throw new TypeError('String expected for parameter "name"');this.name=l}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(l,c){var o=this.name;if(c[o]===!0)return function(m,d,h){return wt(d,o)};if(o in l)return function(m,d,h){return m.has(o)?m.get(o):wt(l,o)};var u=a(o);return function(m,d,h){return m.has(o)?m.get(o):u?new t(null,o):i.onUndefinedSymbol(o)}}forEach(l){}map(l){return this.clone()}static onUndefinedSymbol(l){throw new Error("Undefined symbol "+l)}clone(){return new i(this.name)}_toString(l){return this.name}_toHTML(l){var c=rn(this.name);return c==="true"||c==="false"?''+c+"":c==="i"?''+c+"":c==="Infinity"?''+c+"":c==="NaN"?''+c+"":c==="null"?''+c+"":c==="undefined"?''+c+"":''+c+""}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(l){return new i(l.name)}_toTex(l){var c=!1;typeof r[this.name]>"u"&&a(this.name)&&(c=!0);var o=Pv(this.name,c);return o[0]==="\\\\"?o:" "+o}}return i},{isClass:!0,isNode:!0});var Kv="FunctionNode",Z$=["math","Node","SymbolNode"],jv=F(Kv,Z$,e=>{var r,{math:t,Node:n,SymbolNode:a}=e,i=c=>lr(c,{truncate:78});function s(c,o,u){for(var m="",d=/\\$(?:\\{([a-z_][a-z_0-9]*)(?:\\[([0-9]+)\\])?\\}|\\$)/gi,h=0,y;(y=d.exec(c))!==null;)if(m+=c.substring(h,y.index),h=y.index,y[0]==="$$")m+="$",h++;else{h+=y[0].length;var v=o[y[1]];if(!v)throw new ReferenceError("Template: Property "+y[1]+" does not exist.");if(y[2]===void 0)switch(typeof v){case"string":m+=v;break;case"object":if(Nr(v))m+=v.toTex(u);else if(Array.isArray(v))m+=v.map(function(x,w){if(Nr(x))return x.toTex(u);throw new TypeError("Template: "+y[1]+"["+w+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+y[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+y[1]+" has to be a Node, String or array of Nodes")}else if(Nr(v[y[2]]&&v[y[2]]))m+=v[y[2]].toTex(u);else throw new TypeError("Template: "+y[1]+"["+y[2]+"] is not a Node.")}return m+=c.slice(h),m}class l extends n{constructor(o,u){if(super(),typeof o=="string"&&(o=new a(o)),!Nr(o))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(u)||!u.every(Nr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=o,this.args=u||[]}get name(){return this.fn.name||""}get type(){return Kv}get isFunctionNode(){return!0}_compile(o,u){var m=this.args.map(_=>_._compile(o,u));if(at(this.fn)){var d=this.fn.name;if(u[d]){var w=this.args;return function(E,T,R){var L=wt(T,d);if(typeof L!="function")throw new TypeError("Argument '".concat(d,"' was not a function; received: ").concat(i(L)));if(L.rawArgs)return L(w,o,Os(E,T));var H=m.map(V=>V(E,T,R));return L.apply(L,H)}}else{var h=d in o?wt(o,d):void 0,y=typeof h=="function"&&h.rawArgs===!0,v=_=>{var E;if(_.has(d))E=_.get(d);else if(d in o)E=wt(o,d);else return l.onUndefinedFunction(d);if(typeof E=="function")return E;throw new TypeError("'".concat(d,\`' is not a function; its value is: + \`).concat(i(E)))};if(y){var x=this.args;return function(E,T,R){var L=v(E);return L(x,o,Os(E,T))}}else switch(m.length){case 0:return function(E,T,R){var L=v(E);return L()};case 1:return function(E,T,R){var L=v(E),H=m[0];return L(H(E,T,R))};case 2:return function(E,T,R){var L=v(E),H=m[0],V=m[1];return L(H(E,T,R),V(E,T,R))};default:return function(E,T,R){var L=v(E),H=m.map(V=>V(E,T,R));return L(...H)}}}}else if(Ln(this.fn)&&Jn(this.fn.index)&&this.fn.index.isObjectProperty()){var C=this.fn.object._compile(o,u),b=this.fn.index.getObjectProperty(),N=this.args;return function(E,T,R){var L=C(E,T,R),H=wM(L,b);if(H!=null&&H.rawArgs)return H(N,o,Os(E,T));var V=m.map(W=>W(E,T,R));return H.apply(L,V)}}else{var M=this.fn.toString(),S=this.fn._compile(o,u),O=this.args;return function(E,T,R){var L=S(E,T,R);if(typeof L!="function")throw new TypeError("Expression '".concat(M,"' did not evaluate to a function; value is:")+\` + \`.concat(i(L)));if(L.rawArgs)return L(O,o,Os(E,T));var H=m.map(V=>V(E,T,R));return L.apply(L,H)}}}forEach(o){o(this.fn,"fn",this);for(var u=0;u'+rn(this.fn)+'('+u.join(',')+')'}toTex(o){var u;return o&&typeof o.handler=="object"&&Xe(o.handler,this.name)&&(u=o.handler[this.name](this,o)),typeof u<"u"?u:super.toTex(o)}_toTex(o){var u=this.args.map(function(h){return h.toTex(o)}),m;xD[this.name]&&(m=xD[this.name]),t[this.name]&&(typeof t[this.name].toTex=="function"||typeof t[this.name].toTex=="object"||typeof t[this.name].toTex=="string")&&(m=t[this.name].toTex);var d;switch(typeof m){case"function":d=m(this,o);break;case"string":d=s(m,this,o);break;case"object":switch(typeof m[u.length]){case"function":d=m[u.length](this,o);break;case"string":d=s(m[u.length],this,o);break}}return typeof d<"u"?d:s(cT,this,o)}getIdentifier(){return this.type+":"+this.name}}return r=l,Hr(l,"name",Kv),Hr(l,"onUndefinedFunction",function(c){throw new Error("Undefined function "+c)}),Hr(l,"fromJSON",function(c){return new r(c.fn,c.args)}),l},{isClass:!0,isNode:!0});var lT="parse",Q$=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],eg=F(lT,Q$,e=>{var{typed:r,numeric:t,config:n,AccessorNode:a,ArrayNode:i,AssignmentNode:s,BlockNode:l,ConditionalNode:c,ConstantNode:o,FunctionAssignmentNode:u,FunctionNode:m,IndexNode:d,ObjectNode:h,OperatorNode:y,ParenthesisNode:v,RangeNode:x,RelationalNode:w,SymbolNode:C}=e,b=r(lT,{string:function(Q){return le(Q,{})},"Array | Matrix":function(Q){return N(Q,{})},"string, Object":function(Q,ve){var Pe=ve.nodes!==void 0?ve.nodes:{};return le(Q,Pe)},"Array | Matrix, Object":N});function N(B){var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=Q.nodes!==void 0?Q.nodes:{};return je(B,function(Pe){if(typeof Pe!="string")throw new TypeError("String expected");return le(Pe,ve)})}var M={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},S={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},O={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},_={true:!0,false:!1,null:null,undefined:void 0},E=["NaN","Infinity"],T={'"':'"',"'":"'","\\\\":"\\\\","/":"/",b:"\\b",f:"\\f",n:\` +\`,r:"\\r",t:" "};function R(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:M.NULL,nestingLevel:0,conditionalLevel:null}}function L(B,Q){return B.expression.substr(B.index,Q)}function H(B){return L(B,1)}function V(B){B.index++}function W(B){return B.expression.charAt(B.index-1)}function k(B){return B.expression.charAt(B.index+1)}function q(B){for(B.tokenType=M.NULL,B.token="",B.comment="";;){if(H(B)==="#")for(;H(B)!==\` +\`&&H(B)!=="";)B.comment+=H(B),V(B);if(b.isWhitespace(H(B),B.nestingLevel))V(B);else break}if(H(B)===""){B.tokenType=M.DELIMITER;return}if(H(B)===\` +\`&&!B.nestingLevel){B.tokenType=M.DELIMITER,B.token=H(B),V(B);return}var Q=H(B),ve=L(B,2),Pe=L(B,3);if(Pe.length===3&&S[Pe]){B.tokenType=M.DELIMITER,B.token=Pe,V(B),V(B),V(B);return}if(ve.length===2&&S[ve]){B.tokenType=M.DELIMITER,B.token=ve,V(B),V(B);return}if(S[Q]){B.tokenType=M.DELIMITER,B.token=Q,V(B);return}if(b.isDigitDot(Q)){B.tokenType=M.NUMBER;var tr=L(B,2);if(tr==="0b"||tr==="0o"||tr==="0x"){for(B.token+=H(B),V(B),B.token+=H(B),V(B);b.isHexDigit(H(B));)B.token+=H(B),V(B);if(H(B)===".")for(B.token+=".",V(B);b.isHexDigit(H(B));)B.token+=H(B),V(B);else if(H(B)==="i")for(B.token+="i",V(B);b.isDigit(H(B));)B.token+=H(B),V(B);return}if(H(B)==="."){if(B.token+=H(B),V(B),!b.isDigit(H(B))){B.tokenType=M.DELIMITER;return}}else{for(;b.isDigit(H(B));)B.token+=H(B),V(B);b.isDecimalMark(H(B),k(B))&&(B.token+=H(B),V(B))}for(;b.isDigit(H(B));)B.token+=H(B),V(B);if(H(B)==="E"||H(B)==="e"){if(b.isDigit(k(B))||k(B)==="-"||k(B)==="+"){if(B.token+=H(B),V(B),(H(B)==="+"||H(B)==="-")&&(B.token+=H(B),V(B)),!b.isDigit(H(B)))throw Re(B,'Digit expected, got "'+H(B)+'"');for(;b.isDigit(H(B));)B.token+=H(B),V(B);if(b.isDecimalMark(H(B),k(B)))throw Re(B,'Digit expected, got "'+H(B)+'"')}else if(k(B)===".")throw V(B),Re(B,'Digit expected, got "'+H(B)+'"')}return}if(b.isAlpha(H(B),W(B),k(B))){for(;b.isAlpha(H(B),W(B),k(B))||b.isDigit(H(B));)B.token+=H(B),V(B);Xe(O,B.token)?B.tokenType=M.DELIMITER:B.tokenType=M.SYMBOL;return}for(B.tokenType=M.UNKNOWN;H(B)!=="";)B.token+=H(B),V(B);throw Re(B,'Syntax error in part "'+B.token+'"')}function K(B){do q(B);while(B.token===\` \`)}function z(B){B.nestingLevel++}function oe(B){B.nestingLevel--}b.isAlpha=function(Q,ve,Pe){return b.isValidLatinOrGreek(Q)||b.isValidMathSymbol(Q,Pe)||b.isValidMathSymbol(ve,Q)},b.isValidLatinOrGreek=function(Q){return/^[a-zA-Z_$\\u00C0-\\u02AF\\u0370-\\u03FF\\u2100-\\u214F]$/.test(Q)},b.isValidMathSymbol=function(Q,ve){return/^[\\uD835]$/.test(Q)&&/^[\\uDC00-\\uDFFF]$/.test(ve)&&/^[^\\uDC55\\uDC9D\\uDCA0\\uDCA1\\uDCA3\\uDCA4\\uDCA7\\uDCA8\\uDCAD\\uDCBA\\uDCBC\\uDCC4\\uDD06\\uDD0B\\uDD0C\\uDD15\\uDD1D\\uDD3A\\uDD3F\\uDD45\\uDD47-\\uDD49\\uDD51\\uDEA6\\uDEA7\\uDFCC\\uDFCD]$/.test(ve)},b.isWhitespace=function(Q,ve){return Q===" "||Q===" "||Q===\` -\`&&ve>0},b.isDecimalMark=function(Q,ve){return Q==="."&&ve!=="/"&&ve!=="*"&&ve!=="^"},b.isDigitDot=function(Q){return Q>="0"&&Q<="9"||Q==="."},b.isDigit=function(Q){return Q>="0"&&Q<="9"},b.isHexDigit=function(Q){return Q>="0"&&Q<="9"||Q>="a"&&Q<="f"||Q>="A"&&Q<="F"};function pe(B,Q){var ve=R();ht(ve,{expression:B,extraNodes:Q}),q(ve);var Pe=ae(ve);if(ve.token!=="")throw ve.tokenType===M.DELIMITER?Ye(ve,"Unexpected operator "+ve.token):Re(ve,'Unexpected part "'+ve.token+'"');return Pe}function ae(B){var Q,ve=[],Pe;for(B.token!==""&&B.token!==\` +\`&&ve>0},b.isDecimalMark=function(Q,ve){return Q==="."&&ve!=="/"&&ve!=="*"&&ve!=="^"},b.isDigitDot=function(Q){return Q>="0"&&Q<="9"||Q==="."},b.isDigit=function(Q){return Q>="0"&&Q<="9"},b.isHexDigit=function(Q){return Q>="0"&&Q<="9"||Q>="a"&&Q<="f"||Q>="A"&&Q<="F"};function le(B,Q){var ve=R();ht(ve,{expression:B,extraNodes:Q}),q(ve);var Pe=ae(ve);if(ve.token!=="")throw ve.tokenType===M.DELIMITER?Ye(ve,"Unexpected operator "+ve.token):Re(ve,'Unexpected part "'+ve.token+'"');return Pe}function ae(B){var Q,ve=[],Pe;for(B.token!==""&&B.token!==\` \`&&B.token!==";"&&(Q=$(B),B.comment&&(Q.comment=B.comment));B.token===\` \`||B.token===";";)ve.length===0&&Q&&(Pe=B.token!==";",ve.push({node:Q,visible:Pe})),q(B),B.token!==\` -\`&&B.token!==";"&&B.token!==""&&(Q=$(B),B.comment&&(Q.comment=B.comment),Pe=B.token!==";",ve.push({node:Q,visible:Pe}));return ve.length>0?new l(ve):(Q||(Q=new o(void 0),B.comment&&(Q.comment=B.comment)),Q)}function $(B){var Q,ve,Pe,tr,cr=le(B);if(B.token==="="){if(at(cr))return Q=cr.name,K(B),Pe=$(B),new u(new C(Q),Pe);if(Ln(cr))return K(B),Pe=$(B),new u(cr.object,cr.index,Pe);if(yn(cr)&&at(cr.fn)&&(tr=!0,ve=[],Q=cr.name,cr.args.forEach(function(Xr,Pt){at(Xr)?ve[Pt]=Xr.name:tr=!1}),tr))return K(B),Pe=$(B),new s(Q,ve,Pe);throw Re(B,"Invalid left hand side of assignment operator =")}return cr}function le(B){for(var Q=Ee(B);B.token==="?";){var ve=B.conditionalLevel;B.conditionalLevel=B.nestingLevel,K(B);var Pe=Q,tr=$(B);if(B.token!==":")throw Re(B,"False part of conditional expression expected");B.conditionalLevel=null,K(B);var cr=$(B);Q=new c(Pe,tr,cr),B.conditionalLevel=ve}return Q}function Ee(B){for(var Q=me(B);B.token==="or";)K(B),Q=new y("or","or",[Q,me(B)]);return Q}function me(B){for(var Q=ge(B);B.token==="xor";)K(B),Q=new y("xor","xor",[Q,ge(B)]);return Q}function ge(B){for(var Q=Se(B);B.token==="and";)K(B),Q=new y("and","and",[Q,Se(B)]);return Q}function Se(B){for(var Q=ye(B);B.token==="|";)K(B),Q=new y("|","bitOr",[Q,ye(B)]);return Q}function ye(B){for(var Q=be(B);B.token==="^|";)K(B),Q=new y("^|","bitXor",[Q,be(B)]);return Q}function be(B){for(var Q=De(B);B.token==="&";)K(B),Q=new y("&","bitAnd",[Q,De(B)]);return Q}function De(B){for(var Q=[Ae(B)],ve=[],Pe={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Xe(Pe,B.token);){var tr={name:B.token,fn:Pe[B.token]};ve.push(tr),K(B),Q.push(Ae(B))}return Q.length===1?Q[0]:Q.length===2?new y(ve[0].name,ve[0].fn,Q):new w(ve.map(cr=>cr.fn),Q)}function Ae(B){var Q,ve,Pe,tr;Q=We(B);for(var cr={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Xe(cr,B.token);)ve=B.token,Pe=cr[ve],K(B),tr=[Q,We(B)],Q=new y(ve,Pe,tr);return Q}function We(B){var Q,ve,Pe,tr;Q=Je(B);for(var cr={to:"to",in:"to"};Xe(cr,B.token);)ve=B.token,Pe=cr[ve],K(B),ve==="in"&&B.token===""?Q=new y("*","multiply",[Q,new C("in")],!0):(tr=[Q,Je(B)],Q=new y(ve,Pe,tr));return Q}function Je(B){var Q,ve=[];if(B.token===":"?Q=new o(1):Q=J(B),B.token===":"&&B.conditionalLevel!==B.nestingLevel){for(ve.push(Q);B.token===":"&&ve.length<3;)K(B),B.token===")"||B.token==="]"||B.token===","||B.token===""?ve.push(new C("end")):ve.push(J(B));ve.length===3?Q=new x(ve[0],ve[2],ve[1]):Q=new x(ve[0],ve[1])}return Q}function J(B){var Q,ve,Pe,tr;Q=re(B);for(var cr={"+":"add","-":"subtract"};Xe(cr,B.token);){ve=B.token,Pe=cr[ve],K(B);var Xr=re(B);Xr.isPercentage?tr=[Q,new y("*","multiply",[Q,Xr])]:tr=[Q,Xr],Q=new y(ve,Pe,tr)}return Q}function re(B){var Q,ve,Pe,tr;Q=xe(B),ve=Q;for(var cr={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Xe(cr,B.token);)Pe=B.token,tr=cr[Pe],K(B),ve=xe(B),Q=new y(Pe,tr,[Q,ve]);return Q}function xe(B){var Q,ve;for(Q=j(B),ve=Q;B.tokenType===M.SYMBOL||B.token==="in"&&xr(Q)||B.tokenType===M.NUMBER&&!xr(ve)&&(!ct(ve)||ve.op==="!")||B.token==="(";)ve=j(B),Q=new y("*","multiply",[Q,ve],!0);return Q}function j(B){for(var Q=ne(B),ve=Q,Pe=[];B.token==="/"&&Sc(ve);)if(Pe.push(ht({},B)),K(B),B.tokenType===M.NUMBER)if(Pe.push(ht({},B)),K(B),B.tokenType===M.SYMBOL||B.token==="(")ht(B,Pe.pop()),Pe.pop(),ve=ne(B),Q=new y("/","divide",[Q,ve]);else{Pe.pop(),ht(B,Pe.pop());break}else{ht(B,Pe.pop());break}return Q}function ne(B){var Q,ve,Pe,tr;Q=ue(B);for(var cr={"%":"mod",mod:"mod"};Xe(cr,B.token);)ve=B.token,Pe=cr[ve],K(B),ve==="%"&&B.tokenType===M.DELIMITER&&B.token!=="("?Q=new y("/","divide",[Q,new o(100)],!1,!0):(tr=[Q,ue(B)],Q=new y(ve,Pe,tr));return Q}function ue(B){var Q,ve,Pe,tr={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Xe(tr,B.token)?(Pe=tr[B.token],Q=B.token,K(B),ve=[ue(B)],new y(Q,Pe,ve)):Me(B)}function Me(B){var Q,ve,Pe,tr;return Q=Ce(B),(B.token==="^"||B.token===".^")&&(ve=B.token,Pe=ve==="^"?"pow":"dotPow",K(B),tr=[Q,ue(B)],Q=new y(ve,Pe,tr)),Q}function Ce(B){var Q,ve,Pe,tr;Q=Le(B);for(var cr={"!":"factorial","'":"ctranspose"};Xe(cr,B.token);)ve=B.token,Pe=cr[ve],q(B),tr=[Q],Q=new y(ve,Pe,tr),Q=fr(B,Q);return Q}function Le(B){var Q=[];if(B.tokenType===M.SYMBOL&&Xe(B.extraNodes,B.token)){var ve=B.extraNodes[B.token];if(q(B),B.token==="("){if(Q=[],z(B),q(B),B.token!==")")for(Q.push($(B));B.token===",";)q(B),Q.push($(B));if(B.token!==")")throw Re(B,"Parenthesis ) expected");oe(B),q(B)}return new ve(Q)}return Ie(B)}function Ie(B){var Q,ve;return B.tokenType===M.SYMBOL||B.tokenType===M.DELIMITER&&B.token in O?(ve=B.token,q(B),Xe(_,ve)?Q=new o(_[ve]):E.indexOf(ve)!==-1?Q=new o(t(ve,"number")):Q=new C(ve),Q=fr(B,Q),Q):or(B)}function fr(B,Q,ve){for(var Pe;(B.token==="("||B.token==="["||B.token===".")&&(!ve||ve.indexOf(B.token)!==-1);)if(Pe=[],B.token==="(")if(at(Q)||Ln(Q)){if(z(B),q(B),B.token!==")")for(Pe.push($(B));B.token===",";)q(B),Pe.push($(B));if(B.token!==")")throw Re(B,"Parenthesis ) expected");oe(B),q(B),Q=new m(Q,Pe)}else return Q;else if(B.token==="["){if(z(B),q(B),B.token!=="]")for(Pe.push($(B));B.token===",";)q(B),Pe.push($(B));if(B.token!=="]")throw Re(B,"Parenthesis ] expected");oe(B),q(B),Q=new a(Q,new d(Pe))}else{q(B);var tr=B.tokenType===M.SYMBOL||B.tokenType===M.DELIMITER&&B.token in O;if(!tr)throw Re(B,"Property name expected after dot");Pe.push(new o(B.token)),q(B);var cr=!0;Q=new a(Q,new d(Pe,cr))}return Q}function or(B){var Q,ve;return B.token==='"'||B.token==="'"?(ve=Ke(B,B.token),Q=new o(ve),Q=fr(B,Q),Q):Pr(B)}function Ke(B,Q){for(var ve="";W(B)!==""&&W(B)!==Q;)if(W(B)==="\\\\"){G(B);var Pe=W(B),tr=T[Pe];if(tr!==void 0)ve+=tr,B.index+=1;else if(Pe==="u"){var cr=B.expression.slice(B.index+1,B.index+5);if(/^[0-9A-Fa-f]{4}$/.test(cr))ve+=String.fromCharCode(parseInt(cr,16)),B.index+=5;else throw Re(B,"Invalid unicode character \\\\u".concat(cr))}else throw Re(B,"Bad escape character \\\\".concat(Pe))}else ve+=W(B),G(B);if(q(B),B.token!==Q)throw Re(B,"End of string ".concat(Q," expected"));return q(B),ve}function Pr(B){var Q,ve,Pe,tr;if(B.token==="["){if(z(B),q(B),B.token!=="]"){var cr=ee(B);if(B.token===";"){for(Pe=1,ve=[cr];B.token===";";)q(B),B.token!=="]"&&(ve[Pe]=ee(B),Pe++);if(B.token!=="]")throw Re(B,"End of matrix ] expected");oe(B),q(B),tr=ve[0].items.length;for(var Xr=1;Xr{var{typed:r,parse:t}=e;return r(lT,{string:function(a){return t(a).compile()},"Array | Matrix":function(a){return je(a,function(i){return t(i).compile()})}})});var mT="evaluate",X$=["typed","parse"],ng=F(mT,X$,e=>{var{typed:r,parse:t}=e;return r(mT,{string:function(a){var i=Bo();return t(a).compile().evaluate(i)},"string, Map | Object":function(a,i){return t(a).compile().evaluate(i)},"Array | Matrix":function(a){var i=Bo();return je(a,function(u){return t(u).compile().evaluate(i)})},"Array | Matrix, Map | Object":function(a,i){return je(a,function(u){return t(u).compile().evaluate(i)})}})});var J$="Parser",K$=["evaluate"],ag=F(J$,K$,e=>{var{evaluate:r}=e;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Bo(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(n){return r(n,this.scope)},t.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},t.prototype.getAll=function(){return SM(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(n,a){return this.scope.set(n,a),a},t.prototype.remove=function(n){this.scope.delete(n)},t.prototype.clear=function(){this.scope.clear()},t},{isClass:!0});var pT="parser",j$=["typed","Parser"],ig=F(pT,j$,e=>{var{typed:r,Parser:t}=e;return r(pT,{"":function(){return new t}})});var dT="lup",eG=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],og=F(dT,eG,e=>{var{typed:r,matrix:t,abs:n,addScalar:a,divideScalar:i,multiplyScalar:u,subtractScalar:l,larger:c,equalScalar:o,unaryMinus:s,DenseMatrix:m,SparseMatrix:d,Spa:h}=e;return r(dT,{DenseMatrix:function(w){return y(w)},SparseMatrix:function(w){return v(w)},Array:function(w){var C=t(w),b=y(C);return{L:b.L.valueOf(),U:b.U.valueOf(),p:b.p}}});function y(x){var w=x._size[0],C=x._size[1],b=Math.min(w,C),N=ar(x._data),M=[],S=[w,b],O=[],_=[b,C],E,T,R,k=[];for(E=0;E0)for(E=0;E0?new l(ve):(Q||(Q=new o(void 0),B.comment&&(Q.comment=B.comment)),Q)}function $(B){var Q,ve,Pe,tr,cr=me(B);if(B.token==="="){if(at(cr))return Q=cr.name,K(B),Pe=$(B),new s(new C(Q),Pe);if(Ln(cr))return K(B),Pe=$(B),new s(cr.object,cr.index,Pe);if(yn(cr)&&at(cr.fn)&&(tr=!0,ve=[],Q=cr.name,cr.args.forEach(function(Xr,Pt){at(Xr)?ve[Pt]=Xr.name:tr=!1}),tr))return K(B),Pe=$(B),new u(Q,ve,Pe);throw Re(B,"Invalid left hand side of assignment operator =")}return cr}function me(B){for(var Q=Ee(B);B.token==="?";){var ve=B.conditionalLevel;B.conditionalLevel=B.nestingLevel,K(B);var Pe=Q,tr=$(B);if(B.token!==":")throw Re(B,"False part of conditional expression expected");B.conditionalLevel=null,K(B);var cr=$(B);Q=new c(Pe,tr,cr),B.conditionalLevel=ve}return Q}function Ee(B){for(var Q=pe(B);B.token==="or";)K(B),Q=new y("or","or",[Q,pe(B)]);return Q}function pe(B){for(var Q=ge(B);B.token==="xor";)K(B),Q=new y("xor","xor",[Q,ge(B)]);return Q}function ge(B){for(var Q=Se(B);B.token==="and";)K(B),Q=new y("and","and",[Q,Se(B)]);return Q}function Se(B){for(var Q=ye(B);B.token==="|";)K(B),Q=new y("|","bitOr",[Q,ye(B)]);return Q}function ye(B){for(var Q=be(B);B.token==="^|";)K(B),Q=new y("^|","bitXor",[Q,be(B)]);return Q}function be(B){for(var Q=De(B);B.token==="&";)K(B),Q=new y("&","bitAnd",[Q,De(B)]);return Q}function De(B){for(var Q=[Ae(B)],ve=[],Pe={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Xe(Pe,B.token);){var tr={name:B.token,fn:Pe[B.token]};ve.push(tr),K(B),Q.push(Ae(B))}return Q.length===1?Q[0]:Q.length===2?new y(ve[0].name,ve[0].fn,Q):new w(ve.map(cr=>cr.fn),Q)}function Ae(B){var Q,ve,Pe,tr;Q=We(B);for(var cr={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Xe(cr,B.token);)ve=B.token,Pe=cr[ve],K(B),tr=[Q,We(B)],Q=new y(ve,Pe,tr);return Q}function We(B){var Q,ve,Pe,tr;Q=Je(B);for(var cr={to:"to",in:"to"};Xe(cr,B.token);)ve=B.token,Pe=cr[ve],K(B),ve==="in"&&B.token===""?Q=new y("*","multiply",[Q,new C("in")],!0):(tr=[Q,Je(B)],Q=new y(ve,Pe,tr));return Q}function Je(B){var Q,ve=[];if(B.token===":"?Q=new o(1):Q=J(B),B.token===":"&&B.conditionalLevel!==B.nestingLevel){for(ve.push(Q);B.token===":"&&ve.length<3;)K(B),B.token===")"||B.token==="]"||B.token===","||B.token===""?ve.push(new C("end")):ve.push(J(B));ve.length===3?Q=new x(ve[0],ve[2],ve[1]):Q=new x(ve[0],ve[1])}return Q}function J(B){var Q,ve,Pe,tr;Q=re(B);for(var cr={"+":"add","-":"subtract"};Xe(cr,B.token);){ve=B.token,Pe=cr[ve],K(B);var Xr=re(B);Xr.isPercentage?tr=[Q,new y("*","multiply",[Q,Xr])]:tr=[Q,Xr],Q=new y(ve,Pe,tr)}return Q}function re(B){var Q,ve,Pe,tr;Q=xe(B),ve=Q;for(var cr={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Xe(cr,B.token);)Pe=B.token,tr=cr[Pe],K(B),ve=xe(B),Q=new y(Pe,tr,[Q,ve]);return Q}function xe(B){var Q,ve;for(Q=j(B),ve=Q;B.tokenType===M.SYMBOL||B.token==="in"&&xr(Q)||B.tokenType===M.NUMBER&&!xr(ve)&&(!ct(ve)||ve.op==="!")||B.token==="(";)ve=j(B),Q=new y("*","multiply",[Q,ve],!0);return Q}function j(B){for(var Q=ne(B),ve=Q,Pe=[];B.token==="/"&&Sc(ve);)if(Pe.push(ht({},B)),K(B),B.tokenType===M.NUMBER)if(Pe.push(ht({},B)),K(B),B.tokenType===M.SYMBOL||B.token==="(")ht(B,Pe.pop()),Pe.pop(),ve=ne(B),Q=new y("/","divide",[Q,ve]);else{Pe.pop(),ht(B,Pe.pop());break}else{ht(B,Pe.pop());break}return Q}function ne(B){var Q,ve,Pe,tr;Q=ue(B);for(var cr={"%":"mod",mod:"mod"};Xe(cr,B.token);)ve=B.token,Pe=cr[ve],K(B),ve==="%"&&B.tokenType===M.DELIMITER&&B.token!=="("?Q=new y("/","divide",[Q,new o(100)],!1,!0):(tr=[Q,ue(B)],Q=new y(ve,Pe,tr));return Q}function ue(B){var Q,ve,Pe,tr={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Xe(tr,B.token)?(Pe=tr[B.token],Q=B.token,K(B),ve=[ue(B)],new y(Q,Pe,ve)):Me(B)}function Me(B){var Q,ve,Pe,tr;return Q=Ce(B),(B.token==="^"||B.token===".^")&&(ve=B.token,Pe=ve==="^"?"pow":"dotPow",K(B),tr=[Q,ue(B)],Q=new y(ve,Pe,tr)),Q}function Ce(B){var Q,ve,Pe,tr;Q=Le(B);for(var cr={"!":"factorial","'":"ctranspose"};Xe(cr,B.token);)ve=B.token,Pe=cr[ve],q(B),tr=[Q],Q=new y(ve,Pe,tr),Q=fr(B,Q);return Q}function Le(B){var Q=[];if(B.tokenType===M.SYMBOL&&Xe(B.extraNodes,B.token)){var ve=B.extraNodes[B.token];if(q(B),B.token==="("){if(Q=[],z(B),q(B),B.token!==")")for(Q.push($(B));B.token===",";)q(B),Q.push($(B));if(B.token!==")")throw Re(B,"Parenthesis ) expected");oe(B),q(B)}return new ve(Q)}return Ie(B)}function Ie(B){var Q,ve;return B.tokenType===M.SYMBOL||B.tokenType===M.DELIMITER&&B.token in O?(ve=B.token,q(B),Xe(_,ve)?Q=new o(_[ve]):E.indexOf(ve)!==-1?Q=new o(t(ve,"number")):Q=new C(ve),Q=fr(B,Q),Q):or(B)}function fr(B,Q,ve){for(var Pe;(B.token==="("||B.token==="["||B.token===".")&&(!ve||ve.indexOf(B.token)!==-1);)if(Pe=[],B.token==="(")if(at(Q)||Ln(Q)){if(z(B),q(B),B.token!==")")for(Pe.push($(B));B.token===",";)q(B),Pe.push($(B));if(B.token!==")")throw Re(B,"Parenthesis ) expected");oe(B),q(B),Q=new m(Q,Pe)}else return Q;else if(B.token==="["){if(z(B),q(B),B.token!=="]")for(Pe.push($(B));B.token===",";)q(B),Pe.push($(B));if(B.token!=="]")throw Re(B,"Parenthesis ] expected");oe(B),q(B),Q=new a(Q,new d(Pe))}else{q(B);var tr=B.tokenType===M.SYMBOL||B.tokenType===M.DELIMITER&&B.token in O;if(!tr)throw Re(B,"Property name expected after dot");Pe.push(new o(B.token)),q(B);var cr=!0;Q=new a(Q,new d(Pe,cr))}return Q}function or(B){var Q,ve;return B.token==='"'||B.token==="'"?(ve=Ke(B,B.token),Q=new o(ve),Q=fr(B,Q),Q):Pr(B)}function Ke(B,Q){for(var ve="";H(B)!==""&&H(B)!==Q;)if(H(B)==="\\\\"){V(B);var Pe=H(B),tr=T[Pe];if(tr!==void 0)ve+=tr,B.index+=1;else if(Pe==="u"){var cr=B.expression.slice(B.index+1,B.index+5);if(/^[0-9A-Fa-f]{4}$/.test(cr))ve+=String.fromCharCode(parseInt(cr,16)),B.index+=5;else throw Re(B,"Invalid unicode character \\\\u".concat(cr))}else throw Re(B,"Bad escape character \\\\".concat(Pe))}else ve+=H(B),V(B);if(q(B),B.token!==Q)throw Re(B,"End of string ".concat(Q," expected"));return q(B),ve}function Pr(B){var Q,ve,Pe,tr;if(B.token==="["){if(z(B),q(B),B.token!=="]"){var cr=ee(B);if(B.token===";"){for(Pe=1,ve=[cr];B.token===";";)q(B),B.token!=="]"&&(ve[Pe]=ee(B),Pe++);if(B.token!=="]")throw Re(B,"End of matrix ] expected");oe(B),q(B),tr=ve[0].items.length;for(var Xr=1;Xr{var{typed:r,parse:t}=e;return r(mT,{string:function(a){return t(a).compile()},"Array | Matrix":function(a){return je(a,function(i){return t(i).compile()})}})});var pT="evaluate",J$=["typed","parse"],tg=F(pT,J$,e=>{var{typed:r,parse:t}=e;return r(pT,{string:function(a){var i=Bo();return t(a).compile().evaluate(i)},"string, Map | Object":function(a,i){return t(a).compile().evaluate(i)},"Array | Matrix":function(a){var i=Bo();return je(a,function(s){return t(s).compile().evaluate(i)})},"Array | Matrix, Map | Object":function(a,i){return je(a,function(s){return t(s).compile().evaluate(i)})}})});var K$="Parser",j$=["evaluate"],ng=F(K$,j$,e=>{var{evaluate:r}=e;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Bo(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(n){return r(n,this.scope)},t.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},t.prototype.getAll=function(){return NM(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(n,a){return this.scope.set(n,a),a},t.prototype.remove=function(n){this.scope.delete(n)},t.prototype.clear=function(){this.scope.clear()},t},{isClass:!0});var dT="parser",eG=["typed","Parser"],ag=F(dT,eG,e=>{var{typed:r,Parser:t}=e;return r(dT,{"":function(){return new t}})});var hT="lup",rG=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],ig=F(hT,rG,e=>{var{typed:r,matrix:t,abs:n,addScalar:a,divideScalar:i,multiplyScalar:s,subtractScalar:l,larger:c,equalScalar:o,unaryMinus:u,DenseMatrix:m,SparseMatrix:d,Spa:h}=e;return r(hT,{DenseMatrix:function(w){return y(w)},SparseMatrix:function(w){return v(w)},Array:function(w){var C=t(w),b=y(C);return{L:b.L.valueOf(),U:b.U.valueOf(),p:b.p}}});function y(x){var w=x._size[0],C=x._size[1],b=Math.min(w,C),N=ar(x._data),M=[],S=[w,b],O=[],_=[b,C],E,T,R,L=[];for(E=0;E0)for(E=0;E0&&$.forEach(0,L-1,function(ye,be){d._forEachRow(ye,O,_,E,function(De,Ae){De>ye&&$.accumulate(De,s(u(Ae,be)))})});var me=L,ge=$.get(L),Se=n(ge);$.forEach(L+1,w-1,function(ye,be){var De=n(be);c(De,Se)&&(me=ye,Se=De,ge=be)}),L!==me&&(d._swapRows(L,me,T[1],O,_,E),d._swapRows(L,me,G[1],R,k,W),$.swap(L,me),oe(L,me)),$.forEach(0,w-1,function(ye,be){ye<=L?(R.push(be),k.push(ye)):(be=i(be,ge),o(be,0)||(O.push(be),_.push(ye)))})};for(L=0;L0&&$.forEach(0,k-1,function(ye,be){d._forEachRow(ye,O,_,E,function(De,Ae){De>ye&&$.accumulate(De,u(s(Ae,be)))})});var pe=k,ge=$.get(k),Se=n(ge);$.forEach(k+1,w-1,function(ye,be){var De=n(be);c(De,Se)&&(pe=ye,Se=De,ge=be)}),k!==pe&&(d._swapRows(k,pe,T[1],O,_,E),d._swapRows(k,pe,V[1],R,L,H),$.swap(k,pe),oe(k,pe)),$.forEach(0,w-1,function(ye,be){ye<=k?(R.push(be),L.push(ye)):(be=i(be,ge),o(be,0)||(O.push(be),_.push(ye)))})};for(k=0;k{var{typed:r,matrix:t,zeros:n,identity:a,isZero:i,equal:u,sign:l,sqrt:c,conj:o,unaryMinus:s,addScalar:m,divideScalar:d,multiplyScalar:h,subtractScalar:y,complex:v}=e;return ht(r(hT,{DenseMatrix:function(N){return w(N)},SparseMatrix:function(N){return C(N)},Array:function(N){var M=t(N),S=w(M);return{Q:S.Q.valueOf(),R:S.R.valueOf()}}}),{_denseQRimpl:x});function x(b){var N=b._size[0],M=b._size[1],S=a([N],"dense"),O=S._data,_=b.clone(),E=_._data,T,R,k,W=n([N],"");for(k=0;k0)for(var S=M[0][0].type==="Complex"?v(0):0,O=0;O=0;){var c=t[u+l],o=t[n+c];o===-1?(l--,i[r++]=c):(t[n+c]=t[a+o],++l,t[u+l]=o)}return r}function gT(e,r){if(!e)return null;var t=0,n,a=[],i=[],u=0,l=r,c=2*r;for(n=0;n=0;n--)e[n]!==-1&&(i[l+n]=i[u+e[n]],i[u+e[n]]=n);for(n=0;n{var{add:r,multiply:t,transpose:n}=e;return function(s,m){if(!m||s<=0||s>3)return null;var d=m._size,h=d[0],y=d[1],v=0,x=Math.max(16,10*Math.sqrt(y));x=Math.min(y-2,x);var w=a(s,m,h,y,x);xT(w,c,null);for(var C=w._index,b=w._ptr,N=b[y],M=[],S=[],O=0,_=y+1,E=2*(y+1),T=3*(y+1),R=4*(y+1),k=5*(y+1),W=6*(y+1),G=7*(y+1),H=M,L=i(y,b,S,O,T,H,E,G,_,W,R,k),q=u(y,b,S,k,R,W,x,_,T,H,E),K=0,z,oe,pe,ae,$,le,Ee,me,ge,Se,ye,be,De,Ae,We,Je;qJ?(le=pe,Ee=j,me=S[O+pe]-J):(le=C[j++],Ee=b[le],me=S[O+le]),$=1;$<=me;$++)z=C[Ee++],!((ge=S[_+z])<=0)&&(xe+=ge,S[_+z]=-ge,C[ue++]=z,S[E+z]!==-1&&(H[S[E+z]]=H[z]),H[z]!==-1?S[E+H[z]]=S[E+z]:S[T+S[k+z]]=S[E+z]);le!==pe&&(b[le]=ui(pe),S[W+le]=0)}for(J!==0&&(N=ue),S[k+pe]=xe,b[pe]=ne,S[O+pe]=ue-ne,S[R+pe]=-2,L=l(L,v,S,W,y),Se=ne;Se=L?S[W+le]-=ge:S[W+le]!==0&&(S[W+le]=S[k+le]+Me)}for(Se=ne;Se0?(Je+=Ce,C[Ae++]=le,We+=le):(b[le]=ui(pe),S[W+le]=0)}S[R+z]=Ae-be+1;var Le=Ae,Ie=be+S[O+z];for(j=De+1;j=0))for(We=H[z],z=S[G+We],S[G+We]=-1;z!==-1&&S[E+z]!==-1;z=S[E+z],L++){for(me=S[O+z],ye=S[R+z],j=b[z]+1;j<=b[z]+me-1;j++)S[W+C[j]]=L;var or=z;for(oe=S[E+z];oe!==-1;){var Ke=S[O+oe]===me&&S[R+oe]===ye;for(j=b[oe]+1;Ke&&j<=b[oe]+me-1;j++)S[W+C[j]]!==L&&(Ke=0);Ke?(b[oe]=ui(z),S[_+z]+=S[_+oe],S[_+oe]=0,S[R+oe]=-1,oe=S[E+oe],S[E+or]=oe):(or=oe,oe=S[E+oe])}}for(j=ne,Se=ne;Se=0;oe--)S[_+oe]>0||(S[E+oe]=S[T+b[oe]],S[T+b[oe]]=oe);for(le=y;le>=0;le--)S[_+le]<=0||b[le]!==-1&&(S[E+le]=S[T+b[le]],S[T+b[le]]=le);for(pe=0,z=0;z<=y;z++)b[z]===-1&&(pe=ug(z,pe,S,T,E,M,W));return M.splice(M.length-1,1),M};function a(o,s,m,d,h){var y=n(s);if(o===1&&d===m)return r(s,y);if(o===2){for(var v=y._index,x=y._ptr,w=0,C=0;Ch))for(var N=x[C+1];bv)m[x+M]=0,m[h+M]=-1,N++,s[M]=ui(o),m[x+o]++;else{var O=m[w+S];O!==-1&&(C[O]=M),m[b+M]=m[w+S],m[w+S]=M}}return N}function l(o,s,m,d,h){if(o<2||o+s<0){for(var y=0;y{var{transpose:r}=e;return function(t,n,a,i){if(!t||!n||!a)return null;var u=t._size,l=u[0],c=u[1],o,s,m,d,h,y,v,x=4*c+(i?c+l+1:0),w=[],C=0,b=c,N=2*c,M=3*c,S=4*c,O=5*c+1;for(m=0;m=1&&_[s]++,k.jleaf===2&&_[k.q]--}n[s]!==-1&&(w[C+s]=n[s])}for(s=0;s{var{add:r,multiply:t,transpose:n}=e,a=bT({add:r,multiply:t,transpose:n}),i=DT({transpose:n});return function(c,o,s){var m=o._ptr,d=o._size,h=d[1],y,v={};if(v.q=a(c,o),c&&!v.q)return null;if(s){var x=c?vT(o,null,v.q,0):o;v.parent=yT(x,1);var w=gT(v.parent,h);if(v.cp=i(x,v.parent,w,1),x&&v.parent&&v.cp&&u(x,v))for(v.unz=0,y=0;y=0;O--)for(E=o[O],T=o[O+1],_=E;_=0;S--)v[S]=-1,O=x[S],O!==-1&&(w[M+O]++===0&&(w[N+O]=S),w[C+S]=w[b+O],w[b+O]=S);for(c.lnz=0,c.m2=d,O=0;O=0;){e=n[d];var h=a?a[e]:e;Ic(u,e)||(fg(u,e),n[c+d]=h<0?0:wD(u[h]));var y=1;for(s=n[c+d],m=h<0?0:wD(u[h+1]);s{var{divideScalar:r,multiply:t,subtract:n}=e;return function(i,u,l,c,o,s,m){var d=i._values,h=i._index,y=i._ptr,v=i._size,x=v[1],w=u._values,C=u._index,b=u._ptr,N,M,S,O,_=AT(i,u,l,c,s);for(N=_;N{var{abs:r,divideScalar:t,multiply:n,subtract:a,larger:i,largerEq:u,SparseMatrix:l}=e,c=MT({divideScalar:t,multiply:n,subtract:a});return function(s,m,d){if(!s)return null;var h=s._size,y=h[1],v,x=100,w=100;m&&(v=m.q,x=m.lnz||x,w=m.unz||w);var C=[],b=[],N=[],M=new l({values:C,index:b,ptr:N,size:[y,y]}),S=[],O=[],_=[],E=new l({values:S,index:O,ptr:_,size:[y,y]}),T=[],R,k,W=[],G=[];for(R=0;R{var{typed:r,abs:t,add:n,multiply:a,transpose:i,divideScalar:u,subtract:l,larger:c,largerEq:o,SparseMatrix:s}=e,m=ST({add:n,multiply:a,transpose:i}),d=CT({abs:t,divideScalar:u,multiply:a,subtract:l,larger:c,largerEq:o,SparseMatrix:s});return r(ET,{"SparseMatrix, number, number":function(y,v,x){if(!Ze(v)||v<0||v>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(x<0||x>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var w=m(v,y,!1),C=d(y,w,x);return{L:C.L,U:C.U,p:C.pinv,q:w.q,toString:function(){return"L: "+this.L.toString()+\` +P: \`+this.p}}}});var vT="qr",tG=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],og=F(vT,tG,e=>{var{typed:r,matrix:t,zeros:n,identity:a,isZero:i,equal:s,sign:l,sqrt:c,conj:o,unaryMinus:u,addScalar:m,divideScalar:d,multiplyScalar:h,subtractScalar:y,complex:v}=e;return ht(r(vT,{DenseMatrix:function(N){return w(N)},SparseMatrix:function(N){return C(N)},Array:function(N){var M=t(N),S=w(M);return{Q:S.Q.valueOf(),R:S.R.valueOf()}}}),{_denseQRimpl:x});function x(b){var N=b._size[0],M=b._size[1],S=a([N],"dense"),O=S._data,_=b.clone(),E=_._data,T,R,L,H=n([N],"");for(L=0;L0)for(var S=M[0][0].type==="Complex"?v(0):0,O=0;O=0;){var c=t[s+l],o=t[n+c];o===-1?(l--,i[r++]=c):(t[n+c]=t[a+o],++l,t[s+l]=o)}return r}function yT(e,r){if(!e)return null;var t=0,n,a=[],i=[],s=0,l=r,c=2*r;for(n=0;n=0;n--)e[n]!==-1&&(i[l+n]=i[s+e[n]],i[s+e[n]]=n);for(n=0;n{var{add:r,multiply:t,transpose:n}=e;return function(u,m){if(!m||u<=0||u>3)return null;var d=m._size,h=d[0],y=d[1],v=0,x=Math.max(16,10*Math.sqrt(y));x=Math.min(y-2,x);var w=a(u,m,h,y,x);bT(w,c,null);for(var C=w._index,b=w._ptr,N=b[y],M=[],S=[],O=0,_=y+1,E=2*(y+1),T=3*(y+1),R=4*(y+1),L=5*(y+1),H=6*(y+1),V=7*(y+1),W=M,k=i(y,b,S,O,T,W,E,V,_,H,R,L),q=s(y,b,S,L,R,H,x,_,T,W,E),K=0,z,oe,le,ae,$,me,Ee,pe,ge,Se,ye,be,De,Ae,We,Je;qJ?(me=le,Ee=j,pe=S[O+le]-J):(me=C[j++],Ee=b[me],pe=S[O+me]),$=1;$<=pe;$++)z=C[Ee++],!((ge=S[_+z])<=0)&&(xe+=ge,S[_+z]=-ge,C[ue++]=z,S[E+z]!==-1&&(W[S[E+z]]=W[z]),W[z]!==-1?S[E+W[z]]=S[E+z]:S[T+S[L+z]]=S[E+z]);me!==le&&(b[me]=ui(le),S[H+me]=0)}for(J!==0&&(N=ue),S[L+le]=xe,b[le]=ne,S[O+le]=ue-ne,S[R+le]=-2,k=l(k,v,S,H,y),Se=ne;Se=k?S[H+me]-=ge:S[H+me]!==0&&(S[H+me]=S[L+me]+Me)}for(Se=ne;Se0?(Je+=Ce,C[Ae++]=me,We+=me):(b[me]=ui(le),S[H+me]=0)}S[R+z]=Ae-be+1;var Le=Ae,Ie=be+S[O+z];for(j=De+1;j=0))for(We=W[z],z=S[V+We],S[V+We]=-1;z!==-1&&S[E+z]!==-1;z=S[E+z],k++){for(pe=S[O+z],ye=S[R+z],j=b[z]+1;j<=b[z]+pe-1;j++)S[H+C[j]]=k;var or=z;for(oe=S[E+z];oe!==-1;){var Ke=S[O+oe]===pe&&S[R+oe]===ye;for(j=b[oe]+1;Ke&&j<=b[oe]+pe-1;j++)S[H+C[j]]!==k&&(Ke=0);Ke?(b[oe]=ui(z),S[_+z]+=S[_+oe],S[_+oe]=0,S[R+oe]=-1,oe=S[E+oe],S[E+or]=oe):(or=oe,oe=S[E+oe])}}for(j=ne,Se=ne;Se=0;oe--)S[_+oe]>0||(S[E+oe]=S[T+b[oe]],S[T+b[oe]]=oe);for(me=y;me>=0;me--)S[_+me]<=0||b[me]!==-1&&(S[E+me]=S[T+b[me]],S[T+b[me]]=me);for(le=0,z=0;z<=y;z++)b[z]===-1&&(le=sg(z,le,S,T,E,M,H));return M.splice(M.length-1,1),M};function a(o,u,m,d,h){var y=n(u);if(o===1&&d===m)return r(u,y);if(o===2){for(var v=y._index,x=y._ptr,w=0,C=0;Ch))for(var N=x[C+1];bv)m[x+M]=0,m[h+M]=-1,N++,u[M]=ui(o),m[x+o]++;else{var O=m[w+S];O!==-1&&(C[O]=M),m[b+M]=m[w+S],m[w+S]=M}}return N}function l(o,u,m,d,h){if(o<2||o+u<0){for(var y=0;y{var{transpose:r}=e;return function(t,n,a,i){if(!t||!n||!a)return null;var s=t._size,l=s[0],c=s[1],o,u,m,d,h,y,v,x=4*c+(i?c+l+1:0),w=[],C=0,b=c,N=2*c,M=3*c,S=4*c,O=5*c+1;for(m=0;m=1&&_[u]++,L.jleaf===2&&_[L.q]--}n[u]!==-1&&(w[C+u]=n[u])}for(u=0;u{var{add:r,multiply:t,transpose:n}=e,a=wT({add:r,multiply:t,transpose:n}),i=ST({transpose:n});return function(c,o,u){var m=o._ptr,d=o._size,h=d[1],y,v={};if(v.q=a(c,o),c&&!v.q)return null;if(u){var x=c?gT(o,null,v.q,0):o;v.parent=xT(x,1);var w=yT(v.parent,h);if(v.cp=i(x,v.parent,w,1),x&&v.parent&&v.cp&&s(x,v))for(v.unz=0,y=0;y=0;O--)for(E=o[O],T=o[O+1],_=E;_=0;S--)v[S]=-1,O=x[S],O!==-1&&(w[M+O]++===0&&(w[N+O]=S),w[C+S]=w[b+O],w[b+O]=S);for(c.lnz=0,c.m2=d,O=0;O=0;){e=n[d];var h=a?a[e]:e;Ic(s,e)||(ug(s,e),n[c+d]=h<0?0:bD(s[h]));var y=1;for(u=n[c+d],m=h<0?0:bD(s[h+1]);u{var{divideScalar:r,multiply:t,subtract:n}=e;return function(i,s,l,c,o,u,m){var d=i._values,h=i._index,y=i._ptr,v=i._size,x=v[1],w=s._values,C=s._index,b=s._ptr,N,M,S,O,_=MT(i,s,l,c,u);for(N=_;N{var{abs:r,divideScalar:t,multiply:n,subtract:a,larger:i,largerEq:s,SparseMatrix:l}=e,c=CT({divideScalar:t,multiply:n,subtract:a});return function(u,m,d){if(!u)return null;var h=u._size,y=h[1],v,x=100,w=100;m&&(v=m.q,x=m.lnz||x,w=m.unz||w);var C=[],b=[],N=[],M=new l({values:C,index:b,ptr:N,size:[y,y]}),S=[],O=[],_=[],E=new l({values:S,index:O,ptr:_,size:[y,y]}),T=[],R,L,H=[],V=[];for(R=0;R{var{typed:r,abs:t,add:n,multiply:a,transpose:i,divideScalar:s,subtract:l,larger:c,largerEq:o,SparseMatrix:u}=e,m=NT({add:n,multiply:a,transpose:i}),d=ET({abs:t,divideScalar:s,multiply:a,subtract:l,larger:c,largerEq:o,SparseMatrix:u});return r(TT,{"SparseMatrix, number, number":function(y,v,x){if(!Ze(v)||v<0||v>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(x<0||x>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var w=m(v,y,!1),C=d(y,w,x);return{L:C.L,U:C.U,p:C.pinv,q:w.q,toString:function(){return"L: "+this.L.toString()+\` U: \`+this.U.toString()+\` p: \`+this.p.toString()+(this.q?\` q: \`+this.q.toString():"")+\` -\`}}}})});function DD(e,r){var t,n=r.length,a=[];if(e)for(t=0;t{var{typed:r,matrix:t,lup:n,slu:a,usolve:i,lsolve:u,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(TT,{"Array, Array | Matrix":function(d,h){d=t(d);var y=n(d),v=s(y.L,y.U,y.p,null,h);return v.valueOf()},"DenseMatrix, Array | Matrix":function(d,h){var y=n(d);return s(y.L,y.U,y.p,null,h)},"SparseMatrix, Array | Matrix":function(d,h){var y=n(d);return s(y.L,y.U,y.p,null,h)},"SparseMatrix, Array | Matrix, number, number":function(d,h,y,v){var x=a(d,y,v);return s(x.L,x.U,x.p,x.q,h)},"Object, Array | Matrix":function(d,h){return s(d.L,d.U,d.p,d.q,h)}});function o(m){if(Qe(m))return m;if(Mr(m))return t(m);throw new TypeError("Invalid Matrix LU decomposition")}function s(m,d,h,y,v){m=o(m),d=o(d),h&&(v=c(m,v,!0),v._data=DD(h,v._data));var x=u(m,v),w=i(d,x);return y&&(w._data=DD(y,w._data)),w}});var FT="polynomialRoot",dG=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],mg=F(FT,dG,e=>{var{typed:r,isZero:t,equalScalar:n,add:a,subtract:i,multiply:u,divide:l,sqrt:c,unaryMinus:o,cbrt:s,typeOf:m,im:d,re:h}=e;return r(FT,{"number|Complex, ...number|Complex":(y,v)=>{for(var x=[y,...v];x.length>0&&t(x[x.length-1]);)x.pop();if(x.length<2)throw new RangeError("Polynomial [".concat(y,", ").concat(v,"] must have a non-zero non-constant coefficient"));switch(x.length){case 2:return[o(l(x[0],x[1]))];case 3:{var[w,C,b]=x,N=u(2,b),M=u(C,C),S=u(4,b,w);if(n(M,S))return[l(o(C),N)];var O=c(i(M,S));return[l(i(O,C),N),l(i(o(O),C),N)]}case 4:{var[_,E,T,R]=x,k=o(u(3,R)),W=u(T,T),G=u(3,R,E),H=a(u(2,T,T,T),u(27,R,R,_)),L=u(9,R,T,E);if(n(W,G)&&n(H,L))return[l(T,k)];var q=i(W,G),K=i(H,L),z=a(u(18,R,T,E,_),u(T,T,E,E)),oe=a(u(4,T,T,T,_),u(4,R,E,E,E),u(27,R,R,_,_));if(n(z,oe))return[l(i(u(4,R,T,E),a(u(9,R,R,_),u(T,T,T))),u(R,q)),l(i(u(9,R,_),u(T,E)),u(2,q))];var pe;n(W,G)?pe=K:pe=l(a(K,c(i(u(K,K),u(4,q,q,q)))),2);var ae=!0,$=s(pe,ae).toArray().map(le=>l(a(T,le,l(q,le)),k));return $.map(le=>m(le)==="Complex"&&n(h(le),h(le)+d(le))?h(le):le)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(x))}}})});var hG="Help",vG=["evaluate"],pg=F(hG,vG,e=>{var{evaluate:r}=e;function t(n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var n=this.doc||{},a=\` +\`}}}})});function wD(e,r){var t,n=r.length,a=[];if(e)for(t=0;t{var{typed:r,matrix:t,lup:n,slu:a,usolve:i,lsolve:s,DenseMatrix:l}=e,c=Oi({DenseMatrix:l});return r(FT,{"Array, Array | Matrix":function(d,h){d=t(d);var y=n(d),v=u(y.L,y.U,y.p,null,h);return v.valueOf()},"DenseMatrix, Array | Matrix":function(d,h){var y=n(d);return u(y.L,y.U,y.p,null,h)},"SparseMatrix, Array | Matrix":function(d,h){var y=n(d);return u(y.L,y.U,y.p,null,h)},"SparseMatrix, Array | Matrix, number, number":function(d,h,y,v){var x=a(d,y,v);return u(x.L,x.U,x.p,x.q,h)},"Object, Array | Matrix":function(d,h){return u(d.L,d.U,d.p,d.q,h)}});function o(m){if(Qe(m))return m;if(Mr(m))return t(m);throw new TypeError("Invalid Matrix LU decomposition")}function u(m,d,h,y,v){m=o(m),d=o(d),h&&(v=c(m,v,!0),v._data=wD(h,v._data));var x=s(m,v),w=i(d,x);return y&&(w._data=wD(y,w._data)),w}});var _T="polynomialRoot",hG=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],lg=F(_T,hG,e=>{var{typed:r,isZero:t,equalScalar:n,add:a,subtract:i,multiply:s,divide:l,sqrt:c,unaryMinus:o,cbrt:u,typeOf:m,im:d,re:h}=e;return r(_T,{"number|Complex, ...number|Complex":(y,v)=>{for(var x=[y,...v];x.length>0&&t(x[x.length-1]);)x.pop();if(x.length<2)throw new RangeError("Polynomial [".concat(y,", ").concat(v,"] must have a non-zero non-constant coefficient"));switch(x.length){case 2:return[o(l(x[0],x[1]))];case 3:{var[w,C,b]=x,N=s(2,b),M=s(C,C),S=s(4,b,w);if(n(M,S))return[l(o(C),N)];var O=c(i(M,S));return[l(i(O,C),N),l(i(o(O),C),N)]}case 4:{var[_,E,T,R]=x,L=o(s(3,R)),H=s(T,T),V=s(3,R,E),W=a(s(2,T,T,T),s(27,R,R,_)),k=s(9,R,T,E);if(n(H,V)&&n(W,k))return[l(T,L)];var q=i(H,V),K=i(W,k),z=a(s(18,R,T,E,_),s(T,T,E,E)),oe=a(s(4,T,T,T,_),s(4,R,E,E,E),s(27,R,R,_,_));if(n(z,oe))return[l(i(s(4,R,T,E),a(s(9,R,R,_),s(T,T,T))),s(R,q)),l(i(s(9,R,_),s(T,E)),s(2,q))];var le;n(H,V)?le=K:le=l(a(K,c(i(s(K,K),s(4,q,q,q)))),2);var ae=!0,$=u(le,ae).toArray().map(me=>l(a(T,me,l(q,me)),L));return $.map(me=>m(me)==="Complex"&&n(h(me),h(me)+d(me))?h(me):me)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(x))}}})});var vG="Help",gG=["evaluate"],mg=F(vG,gG,e=>{var{evaluate:r}=e;function t(n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var n=this.doc||{},a=\` \`;if(n.name&&(a+="Name: "+n.name+\` \`),n.category&&(a+="Category: "+n.category+\` @@ -109669,15 +109722,15 @@ q: \`+this.q.toString():"")+\` \`)+\` \`),n.examples){a+=\`Examples: -\`;for(var i=!1,u=r("config()"),l={config:m=>(i=!0,r("config(newConfig)",{newConfig:m}))},c=0;c(i=!0,r("config(newConfig)",{newConfig:m}))},c=0;ci!=="mathjs").forEach(i=>{a[i]=n[i]}),new t(a)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var gG="Chain",yG=["?on","math","typed"],dg=F(gG,yG,e=>{var{on:r,math:t,typed:n}=e;function a(o){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");bu(o)?this.value=o.value:this.value=o}a.prototype.type="Chain",a.prototype.isChain=!0,a.prototype.done=function(){return this.value},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return lr(this.value)},a.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},a.fromJSON=function(o){return new a(o.value)};function i(o,s){typeof s=="function"&&(a.prototype[o]=l(s))}function u(o,s){Du(a.prototype,o,function(){var d=s();if(typeof d=="function")return l(d)})}function l(o){return function(){if(arguments.length===0)return new a(o(this.value));for(var s=[this.value],m=0;mo[y])};for(var d in o)m(d)}};var c={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return a.createProxy(t),r&&r("import",function(o,s,m){m||u(o,s)}),a},{isClass:!0});var SD={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]};var _T={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var OT={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]};var BT={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]};var PT={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var IT={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var RT={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};var qT={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]};var kT={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var LT={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var zT={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as \`(1 + sqrt(5)) / 2\` and is approximately 1.618034...",examples:["phi"],seealso:[]};var ND={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]};var UT={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};var WT={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var YT={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};var HT={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var $T={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var GT={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var VT={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]};var ZT={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]};var QT={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]};var XT={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]};var JT={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};var KT={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]};var jT={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var eF={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]};var rF={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]};var tF={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]};var nF={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]};var aF={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]};var iF={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]};var oF={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]};var sF={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]};var uF={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]};var fF={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]};var cF={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]};var lF={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]};var mF={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]};var pF={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]};var dF={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix \`A\` is decomposed in two matrices (\`Q\`, \`R\`) where \`Q\` is an orthogonal matrix and \`R\` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]};var hF={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]};var vF={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]};var gF={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]};var yF={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]};var xF={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]};var bF={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]};var wF={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]};var DF={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]};var SF={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]};var NF={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var AF={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]};var MF={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When \`x\` is a number or complex number, an optional second argument \`allRoots\` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]};var CF={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var EF={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]};var TF={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]};var FF={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]};var _F={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]};var OF={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]};var BF={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]};var PF={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]};var IF={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]};var RF={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var qF={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var kF={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]};var LF={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var zF={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \\u2263 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]};var UF={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]};var WF={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]};var YF={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]};var HF={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a \`value+1\`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]};var $F={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating \`log(x, 2)\`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]};var GF={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]};var VF={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]};var ZF={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']};var QF={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]};var XF={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]};var JF={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]};var KF={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]};var jF={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var e_={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]};var r_={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix \`X\` of another matrix \`A\` is such that \`X * X = A\`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]};var t_={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]};var n_={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]};var a_={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]};var i_={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]};var o_={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]};var s_={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]};var u_={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var f_={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]};var c_={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var l_={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var m_={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]};var p_={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]};var d_={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]};var h_={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]};var v_={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]};var g_={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. \`bellNumbers\` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]};var y_={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]};var x_={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]};var b_={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. \`stirlingS2\` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]};var w_={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]};var D_={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]};var S_={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]};var N_={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]};var A_={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]};var M_={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]};var C_={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]};var E_={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]};var T_={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]};var F_={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]};var __={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]};var O_={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]};var B_={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]};var P_={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var I_={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]};var R_={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]};var q_={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var k_={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var L_={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var z_={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]};var U_={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]};var W_={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]};var Y_={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]};var H_={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]};var $_={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]};var G_={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]};var V_={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var Z_={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var Q_={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]};var X_={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]};var J_={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var K_={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]};var j_={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]};var eO={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]};var rO={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]};var tO={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]};var nO={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]};var aO={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]};var iO={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]};var oO={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]};var sO={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]};var uO={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]};var fO={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]};var cO={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]};var lO={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]};var mO={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation \`l:u\`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]};var pO={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]};var dO={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var hO={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]};var vO={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var gO={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var yO={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]};var xO={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]};var bO={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]};var wO={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]};var DO={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]};var SO={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]};var NO={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from \`n\` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]};var AO={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]};var MO={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]};var CO={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]};var EO={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]};var TO={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]};var FO={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]};var _O={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]};var OO={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]};var BO={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]};var PO={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]};var IO={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};var RO={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]};var qO={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};var kO={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]};var LO={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]};var zO={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]};var UO={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]};var WO={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]};var YO={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]};var HO={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]};var $O={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]};var GO={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]};var VO={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]};var ZO={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]};var QO={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]};var XO={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]};var JO={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]};var KO={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]};var jO={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var e3={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]};var r3={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]};var t3={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]};var n3={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]};var a3={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]};var i3={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]};var o3={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]};var s3={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:\`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. +\`),a},t.prototype.toJSON=function(){var n=ar(this.doc);return n.mathjs="Help",n},t.fromJSON=function(n){var a={};return Object.keys(n).filter(i=>i!=="mathjs").forEach(i=>{a[i]=n[i]}),new t(a)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var yG="Chain",xG=["?on","math","typed"],pg=F(yG,xG,e=>{var{on:r,math:t,typed:n}=e;function a(o){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");bu(o)?this.value=o.value:this.value=o}a.prototype.type="Chain",a.prototype.isChain=!0,a.prototype.done=function(){return this.value},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return lr(this.value)},a.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},a.fromJSON=function(o){return new a(o.value)};function i(o,u){typeof u=="function"&&(a.prototype[o]=l(u))}function s(o,u){Du(a.prototype,o,function(){var d=u();if(typeof d=="function")return l(d)})}function l(o){return function(){if(arguments.length===0)return new a(o(this.value));for(var u=[this.value],m=0;mo[y])};for(var d in o)m(d)}};var c={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return a.createProxy(t),r&&r("import",function(o,u,m){m||s(o,u)}),a},{isClass:!0});var DD={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]};var OT={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var BT={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]};var PT={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]};var IT={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var RT={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var qT={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};var kT={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]};var LT={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var zT={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var UT={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as \`(1 + sqrt(5)) / 2\` and is approximately 1.618034...",examples:["phi"],seealso:[]};var SD={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]};var WT={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};var YT={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var HT={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};var $T={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var GT={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var VT={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var ZT={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]};var QT={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]};var XT={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]};var JT={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]};var KT={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};var jT={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]};var eF={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var rF={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]};var tF={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]};var nF={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]};var aF={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]};var iF={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]};var oF={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]};var sF={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]};var uF={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]};var fF={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]};var cF={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]};var lF={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]};var mF={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]};var pF={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]};var dF={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]};var hF={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix \`A\` is decomposed in two matrices (\`Q\`, \`R\`) where \`Q\` is an orthogonal matrix and \`R\` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]};var vF={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]};var gF={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]};var yF={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]};var xF={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]};var bF={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]};var wF={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]};var DF={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]};var SF={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]};var NF={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]};var AF={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var MF={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]};var CF={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When \`x\` is a number or complex number, an optional second argument \`allRoots\` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]};var EF={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var TF={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]};var FF={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]};var _F={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]};var OF={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]};var BF={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]};var PF={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]};var IF={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]};var RF={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]};var qF={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var kF={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var LF={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]};var zF={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var UF={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \\u2263 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]};var WF={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]};var YF={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]};var HF={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]};var $F={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a \`value+1\`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]};var GF={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating \`log(x, 2)\`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]};var VF={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]};var ZF={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]};var QF={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']};var XF={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]};var JF={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]};var KF={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]};var jF={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]};var e_={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var r_={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]};var t_={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix \`X\` of another matrix \`A\` is such that \`X * X = A\`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]};var n_={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]};var a_={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]};var i_={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]};var o_={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]};var s_={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]};var u_={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]};var f_={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var c_={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]};var l_={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var m_={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var p_={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]};var d_={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]};var h_={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]};var v_={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]};var g_={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]};var y_={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. \`bellNumbers\` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]};var x_={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]};var b_={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]};var w_={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. \`stirlingS2\` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]};var D_={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]};var S_={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]};var N_={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]};var A_={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]};var M_={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]};var C_={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]};var E_={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]};var T_={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]};var F_={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]};var __={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]};var O_={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]};var B_={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]};var P_={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]};var I_={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var R_={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]};var q_={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]};var k_={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var L_={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var z_={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var U_={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]};var W_={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]};var Y_={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]};var H_={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]};var $_={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]};var G_={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]};var V_={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]};var Z_={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var Q_={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var X_={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]};var J_={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]};var K_={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var j_={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]};var eO={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]};var rO={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]};var tO={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]};var nO={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]};var aO={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]};var iO={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]};var oO={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]};var sO={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]};var uO={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]};var fO={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]};var cO={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]};var lO={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]};var mO={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]};var pO={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation \`l:u\`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]};var dO={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]};var hO={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var vO={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]};var gO={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var yO={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var xO={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]};var bO={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]};var wO={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]};var DO={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]};var SO={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]};var NO={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]};var AO={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from \`n\` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]};var MO={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]};var CO={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]};var EO={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]};var TO={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]};var FO={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]};var _O={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]};var OO={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]};var BO={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]};var PO={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]};var IO={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]};var RO={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};var qO={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]};var kO={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};var LO={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]};var zO={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]};var UO={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]};var WO={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]};var YO={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]};var HO={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]};var $O={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]};var GO={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]};var VO={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]};var ZO={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]};var QO={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]};var XO={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]};var JO={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]};var KO={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]};var jO={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]};var e3={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var r3={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]};var t3={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]};var n3={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]};var a3={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]};var i3={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]};var o3={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]};var s3={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]};var u3={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:\`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. -In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.\`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var u3={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var f3={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var c3={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var l3={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var m3={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var p3={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var d3={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as \`acosh(x) = ln(sqrt(x^2 - 1) + x)\`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var h3={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var v3={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as \`acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2\`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var g3={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var y3={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as \`acsch(x) = ln(1/x + sqrt(1/x^2 + 1))\`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var x3={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var b3={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var w3={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var D3={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as \`asinh(x) = ln(x + sqrt(x^2 + 1))\`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var S3={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var N3={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var A3={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as \`atanh(x) = ln((1 + x)/(1 - x)) / 2\`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var M3={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var C3={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var E3={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var T3={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var F3={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var _3={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var O3={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var B3={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var P3={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var I3={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var R3={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var q3={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var k3={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var L3={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var z3={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var U3={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var W3={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var Y3={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var H3={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var $3={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var G3={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var V3={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var Z3={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var Q3={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var X3={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var J3={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var K3={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var j3={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var eB={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var rB={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var tB={bignumber:GT,boolean:VT,complex:ZT,createUnit:QT,fraction:XT,index:JT,matrix:KT,number:jT,sparse:eF,splitUnit:rF,string:tF,unit:nF,e:SD,E:SD,false:_T,i:OT,Infinity:BT,LN2:IT,LN10:PT,LOG2E:qT,LOG10E:RT,NaN:kT,null:LT,pi:ND,PI:ND,phi:zT,SQRT1_2:UT,SQRT2:WT,tau:YT,true:HT,version:$T,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:sF,lsolve:fF,lsolveAll:cF,lup:lF,lusolve:mF,leafCount:uF,polynomialRoot:pF,resolve:vF,simplify:gF,simplifyConstant:yF,simplifyCore:xF,symbolicEqual:wF,rationalize:hF,slu:bF,usolve:DF,usolveAll:SF,qr:dF,abs:NF,add:AF,cbrt:MF,ceil:CF,cube:EF,divide:TF,dotDivide:FF,dotMultiply:_F,dotPow:OF,exp:BF,expm:PF,expm1:IF,fix:RF,floor:qF,gcd:kF,hypot:LF,lcm:UF,log:WF,log2:$F,log1p:HF,log10:YF,mod:GF,multiply:VF,norm:ZF,nthRoot:QF,nthRoots:XF,pow:JF,round:KF,sign:jF,sqrt:e_,sqrtm:r_,square:i_,subtract:o_,unaryMinus:s_,unaryPlus:u_,xgcd:f_,invmod:zF,bitAnd:c_,bitNot:l_,bitOr:m_,bitXor:p_,leftShift:d_,rightArithShift:h_,rightLogShift:v_,bellNumbers:g_,catalan:y_,composition:x_,stirlingS2:b_,config:aF,import:iF,typed:oF,arg:w_,conj:D_,re:N_,im:S_,evaluate:A_,help:M_,distance:C_,intersect:E_,and:T_,not:F_,or:__,xor:O_,concat:P_,count:I_,cross:R_,column:B_,ctranspose:q_,det:k_,diag:L_,diff:z_,dot:U_,getMatrixDataType:G_,identity:V_,filter:Y_,flatten:H_,forEach:$_,inv:Z_,pinv:Q_,eigs:W_,kron:X_,matrixFromFunction:j_,matrixFromRows:eO,matrixFromColumns:K_,map:J_,ones:rO,partitionSelect:tO,range:nO,resize:iO,reshape:aO,rotate:oO,rotationMatrix:sO,row:uO,size:fO,sort:cO,squeeze:lO,subset:mO,trace:pO,transpose:dO,zeros:hO,fft:vO,ifft:gO,sylvester:t_,schur:n_,lyap:a_,solveODE:rB,combinations:yO,combinationsWithRep:xO,factorial:bO,gamma:wO,kldivergence:SO,lgamma:DO,multinomial:NO,permutations:AO,pickRandom:MO,random:CO,randomInt:EO,compare:TO,compareNatural:FO,compareText:_O,deepEqual:OO,equal:BO,equalText:PO,larger:IO,largerEq:RO,smaller:qO,smallerEq:kO,unequal:LO,setCartesian:zO,setDifference:UO,setDistinct:WO,setIntersect:YO,setIsSubset:HO,setMultiplicity:$O,setPowerset:GO,setSize:VO,setSymDifference:ZO,setUnion:QO,zpk2tf:XO,freqz:JO,erf:KO,zeta:jO,cumsum:f3,mad:e3,max:r3,mean:t3,median:n3,min:a3,mode:i3,prod:o3,quantileSeq:s3,std:u3,sum:c3,variance:l3,corr:m3,acos:p3,acosh:d3,acot:h3,acoth:v3,acsc:g3,acsch:y3,asec:x3,asech:b3,asin:w3,asinh:D3,atan:S3,atanh:A3,atan2:N3,cos:M3,cosh:C3,cot:E3,coth:T3,csc:F3,csch:_3,sec:O3,sech:B3,sin:P3,sinh:I3,tan:R3,tanh:q3,to:k3,clone:z3,format:U3,bin:L3,oct:K3,hex:Y3,isNaN:$3,isInteger:H3,isNegative:G3,isNumeric:V3,hasNumericValue:W3,isPositive:Z3,isPrime:Q3,isZero:X3,print:j3,typeOf:eB,numeric:J3};var nB="help",xG=["typed","mathWithTransform","Help"],hg=F(nB,xG,e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(nB,{any:function(i){var u,l=i;if(typeof i!="string"){for(u in t)if(Xe(t,u)&&i===t[u]){l=u;break}}var c=wt(tB,l);if(!c){var o=typeof l=="function"?l.name:l;throw new Error('No documentation found on "'+o+'"')}return new n(c)}})});var aB="chain",bG=["typed","Chain"],vg=F(aB,bG,e=>{var{typed:r,Chain:t}=e;return r(aB,{"":function(){return new t},any:function(a){return new t(a)}})});var iB="det",wG=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],gg=F(iB,wG,e=>{var{typed:r,matrix:t,subtractScalar:n,multiply:a,divideScalar:i,isZero:u,unaryMinus:l}=e;return r(iB,{any:function(s){return ar(s)},"Array | Matrix":function(s){var m;switch(Qe(s)?m=s.size():Array.isArray(s)?(s=t(s),m=s.size()):m=[],m.length){case 0:return ar(s);case 1:if(m[0]===1)return ar(s.valueOf()[0]);if(m[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+lr(m)+")");case 2:{var d=m[0],h=m[1];if(d===h)return c(s.clone().valueOf(),d,h);if(h===0)return 1;throw new RangeError("Matrix must be square (size: "+lr(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(m)+")")}}});function c(o,s,m){if(s===1)return ar(o[0][0]);if(s===2)return n(a(o[0][0],o[1][1]),a(o[1][0],o[0][1]));for(var d=!1,h=new Array(s).fill(0).map((O,_)=>_),y=0;y{var{typed:r,matrix:t,divideScalar:n,addScalar:a,multiply:i,unaryMinus:u,det:l,identity:c,abs:o}=e;return r(oB,{"Array | Matrix":function(d){var h=Qe(d)?d.size():ur(d);switch(h.length){case 1:if(h[0]===1)return Qe(d)?t([n(1,d.valueOf()[0])]):[n(1,d[0])];throw new RangeError("Matrix must be square (size: "+lr(h)+")");case 2:{var y=h[0],v=h[1];if(y===v)return Qe(d)?t(s(d.valueOf(),y,v),d.storage()):s(d,y,v);throw new RangeError("Matrix must be square (size: "+lr(h)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(h)+")")}},any:function(d){return n(1,d)}});function s(m,d,h){var y,v,x,w,C;if(d===1){if(w=m[0][0],w===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,w)]]}else if(d===2){var b=l(m);if(b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(m[1][1],b),n(u(m[0][1]),b)],[n(u(m[1][0]),b),n(m[0][0],b)]]}else{var N=m.concat();for(y=0;yO&&(O=o(N[y][S]),_=y),y++;if(O===0)throw Error("Cannot calculate inverse, determinant is zero");y=_,y!==S&&(C=N[S],N[S]=N[y],N[y]=C,C=M[S],M[S]=M[y],M[y]=C);var E=N[S],T=M[S];for(y=0;y{var{typed:r,matrix:t,inv:n,deepEqual:a,equal:i,dotDivide:u,dot:l,ctranspose:c,divideScalar:o,multiply:s,add:m,Complex:d}=e;return r(sB,{"Array | Matrix":function(b){var N=Qe(b)?b.size():ur(b);switch(N.length){case 1:return w(b)?c(b):N[0]===1?n(b):u(c(b),l(b,b));case 2:{if(w(b))return c(b);var M=N[0],S=N[1];if(M===S)try{return n(b)}catch(O){if(!(O instanceof Error&&O.message.match(/Cannot calculate inverse, determinant is zero/)))throw O}return Qe(b)?t(h(b.valueOf(),M,S),b.storage()):h(b,M,S)}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(N)+")")}},any:function(b){return i(b,0)?ar(b):o(1,b)}});function h(C,b,N){var{C:M,F:S}=v(C,b,N),O=s(n(s(c(M),M)),c(M)),_=s(c(S),n(s(S,c(S))));return s(_,O)}function y(C,b,N){for(var M=ar(C),S=0,O=0;O_.filter((T,R)=>R!x(l(M[E],M[E])));return{C:S,F:O}}function x(C){return i(m(C,d(1,1)),m(0,d(1,1)))}function w(C){return a(m(C,d(1,1)),m(s(C,0),d(1,1)))}});function uB(e){var{addScalar:r,subtract:t,flatten:n,multiply:a,multiplyScalar:i,divideScalar:u,sqrt:l,abs:c,bignumber:o,diag:s,size:m,reshape:d,inv:h,qr:y,usolve:v,usolveAll:x,equal:w,complex:C,larger:b,smaller:N,matrixFromColumns:M,dot:S}=e;function O(ae,$,le,Ee){var me=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ge=_(ae,$,le,Ee,me);E(ae,$,le,Ee,me,ge);var{values:Se,C:ye}=T(ae,$,le,Ee,me);if(me){var be=R(ae,$,ye,ge,Se,le,Ee);return{values:Se,eigenvectors:be}}return{values:Se}}function _(ae,$,le,Ee,me){var ge=Ee==="BigNumber",Se=Ee==="Complex",ye=ge?o(0):0,be=ge?o(1):Se?C(1):1,De=ge?o(1):1,Ae=ge?o(10):2,We=i(Ae,Ae),Je;me&&(Je=Array($).fill(be));for(var J=!1;!J;){J=!0;for(var re=0;re<$;re++){for(var xe=ye,j=ye,ne=0;ne<$;ne++)re!==ne&&(xe=r(xe,c(ae[ne][re])),j=r(j,c(ae[re][ne])));if(!w(xe,0)&&!w(j,0)){for(var ue=De,Me=xe,Ce=u(j,Ae),Le=i(j,Ae);N(Me,Ce);)Me=i(Me,We),ue=i(ue,Ae);for(;b(Me,Le);)Me=u(Me,We),ue=u(ue,Ae);var Ie=N(u(r(Me,j),ue),i(r(xe,j),.95));if(Ie){J=!1;for(var fr=u(1,ue),or=0;or<$;or++)re!==or&&(ae[re][or]=i(ae[re][or],fr),ae[or][re]=i(ae[or][re],ue));me&&(Je[re]=i(Je[re],fr))}}}}return me?s(Je):null}function E(ae,$,le,Ee,me,ge){var Se=Ee==="BigNumber",ye=Ee==="Complex",be=Se?o(0):ye?C(0):0;Se&&(le=o(le));for(var De=0;De<$-2;De++){for(var Ae=0,We=be,Je=De+1;Je<$;Je++){var J=ae[Je][De];N(c(We),c(J))&&(We=J,Ae=Je)}if(!N(c(We),le)){if(Ae!==De+1){var re=ae[Ae];ae[Ae]=ae[De+1],ae[De+1]=re;for(var xe=0;xe<$;xe++){var j=ae[xe][Ae];ae[xe][Ae]=ae[xe][De+1],ae[xe][De+1]=j}if(me){var ne=ge[Ae];ge[Ae]=ge[De+1],ge[De+1]=ne}}for(var ue=De+2;ue<$;ue++){var Me=u(ae[ue][De],We);if(Me!==0){for(var Ce=0;Ce<$;Ce++)ae[ue][Ce]=t(ae[ue][Ce],i(Me,ae[De+1][Ce]));for(var Le=0;Le<$;Le++)ae[Le][De+1]=r(ae[Le][De+1],i(Me,ae[Le][ue]));if(me)for(var Ie=0;Ie<$;Ie++)ge[ue][Ie]=t(ge[ue][Ie],i(Me,ge[De+1][Ie]))}}}}return ge}function T(ae,$,le,Ee,me){var ge=Ee==="BigNumber",Se=Ee==="Complex",ye=ge?o(1):Se?C(1):1;ge&&(le=o(le));for(var be=ar(ae),De=[],Ae=$,We=[],Je=me?s(Array($).fill(ye)):void 0,J=me?s(Array(Ae).fill(ye)):void 0,re=0;re<=100;){re+=1;for(var xe=be[Ae-1][Ae-1],j=0;j1&&(J=s(Array(Ae-1).fill(ye)))),Ae-=1,be.pop();for(var Ce=0;Ce2&&(J=s(Array(Ae-2).fill(ye)))),Ae-=2,be.pop(),be.pop();for(var Ie=0;Ie+t(c(Ke),c(Pr))),re>100){var fr=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+De.join(", "));throw fr.values=De,fr.vectors=[],fr}var or=me?a(Je,H(We,$)):void 0;return{values:De,C:or}}function R(ae,$,le,Ee,me,ge,Se){var ye=h(le),be=a(ye,ae,le),De=Se==="BigNumber",Ae=Se==="Complex",We=De?o(0):Ae?C(0):0,Je=De?o(1):Ae?C(1):1,J=[],re=[];for(var xe of me){var j=L(J,xe,w);j===-1?(J.push(xe),re.push(1)):re[j]+=1}for(var ne=[],ue=J.length,Me=Array($).fill(We),Ce=s(Array($).fill(Je)),Le=function(){var or=J[Ie],Ke=t(be,a(or,Ce)),Pr=x(Ke,Me);for(Pr.shift();Pr.lengtha(ce,we)),ne.push(...Pr.map(we=>({value:or,vector:n(we)})))},Ie=0;Ie=5)return null;for(ye=0;;){var be=v(ae,Se);if(N(oe(z(Se,[be])),Ee))break;if(++ye>=10)return null;Se=pe(be)}return Se}function K(ae,$,le){var Ee=le==="BigNumber",me=le==="Complex",ge=Array(ae).fill(0).map(Se=>2*Math.random()-1);return Ee&&(ge=ge.map(Se=>o(Se))),me&&(ge=ge.map(Se=>C(Se))),ge=z(ge,$),pe(ge,le)}function z(ae,$){var le=m(ae);for(var Ee of $)Ee=d(Ee,le),ae=t(ae,a(u(S(Ee,ae),S(Ee,Ee)),Ee));return ae}function oe(ae){return c(l(S(ae,ae)))}function pe(ae,$){var le=$==="BigNumber",Ee=$==="Complex",me=le?o(1):Ee?C(1):1;return a(u(me,oe(ae)),ae)}return O}function fB(e){var{config:r,addScalar:t,subtract:n,abs:a,atan:i,cos:u,sin:l,multiplyScalar:c,inv:o,bignumber:s,multiply:m,add:d}=e;function h(E,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.epsilon,k=arguments.length>3?arguments[3]:void 0,W=arguments.length>4?arguments[4]:void 0;if(k==="number")return y(E,R,W);if(k==="BigNumber")return v(E,R,W);throw TypeError("Unsupported data type: "+k)}function y(E,T,R){var k=E.length,W=Math.abs(T/k),G,H;if(R){H=new Array(k);for(var L=0;L=Math.abs(W);){var K=q[0][0],z=q[0][1];G=x(E[K][K],E[z][z],E[K][z]),E=M(E,G,K,z),R&&(H=C(H,G,K,z)),q=S(E)}for(var oe=Array(k).fill(0),pe=0;pe=a(W);){var K=q[0][0],z=q[0][1];G=w(E[K][K],E[z][z],E[K][z]),E=N(E,G,K,z),R&&(H=b(H,G,K,z)),q=O(E)}for(var oe=Array(k).fill(0),pe=0;pe({value:W[$],vector:ae}));return{values:W,eigenvectors:pe}}return h}var NG="eigs",AG=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],bg=F(NG,AG,e=>{var{config:r,typed:t,matrix:n,addScalar:a,subtract:i,equal:u,abs:l,atan:c,cos:o,sin:s,multiplyScalar:m,divideScalar:d,inv:h,bignumber:y,multiply:v,add:x,larger:w,column:C,flatten:b,number:N,complex:M,sqrt:S,diag:O,size:_,reshape:E,qr:T,usolve:R,usolveAll:k,im:W,re:G,smaller:H,matrixFromColumns:L,dot:q}=e,K=fB({config:r,addScalar:a,subtract:i,column:C,flatten:b,equal:u,abs:l,atan:c,cos:o,sin:s,multiplyScalar:m,inv:h,bignumber:y,complex:M,multiply:v,add:x}),z=uB({config:r,addScalar:a,subtract:i,multiply:v,multiplyScalar:m,flatten:b,divideScalar:d,sqrt:S,abs:l,bignumber:y,diag:O,size:_,reshape:E,qr:T,inv:h,usolve:R,usolveAll:k,equal:u,complex:M,larger:w,smaller:H,matrixFromColumns:L,dot:q});return t("eigs",{Array:function(ge){return oe(n(ge))},"Array, number|BigNumber":function(ge,Se){return oe(n(ge),{precision:Se})},"Array, Object"(me,ge){return oe(n(me),ge)},Matrix:function(ge){return oe(ge,{matricize:!0})},"Matrix, number|BigNumber":function(ge,Se){return oe(ge,{precision:Se,matricize:!0})},"Matrix, Object":function(ge,Se){var ye={matricize:!0};return ht(ye,Se),oe(ge,ye)}});function oe(me){var ge,Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye="eigenvectors"in Se?Se.eigenvectors:!0,be=(ge=Se.precision)!==null&&ge!==void 0?ge:r.epsilon,De=pe(me,be,ye);return Se.matricize&&(De.values=n(De.values),ye&&(De.eigenvectors=De.eigenvectors.map(Ae=>{var{value:We,vector:Je}=Ae;return{value:We,vector:n(Je)}}))),ye&&Object.defineProperty(De,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),De}function pe(me,ge,Se){var ye=me.toArray(),be=me.size();if(be.length!==2||be[0]!==be[1])throw new RangeError("Matrix must be square (size: ".concat(lr(be),")"));var De=be[0];if($(ye,De,ge)&&(le(ye,De),ae(ye,De,ge))){var Ae=Ee(me,ye,De);return K(ye,De,ge,Ae,Se)}var We=Ee(me,ye,De);return z(ye,De,ge,We,Se)}function ae(me,ge,Se){for(var ye=0;ye{var{typed:r,abs:t,add:n,identity:a,inv:i,multiply:u}=e;return r(cB,{Matrix:function(m){var d=m.size();if(d.length!==2||d[0]!==d[1])throw new RangeError("Matrix must be square (size: "+lr(d)+")");for(var h=d[0],y=1e-15,v=l(m),x=c(v,y),w=x.q,C=x.j,b=u(m,Math.pow(2,-C)),N=a(h),M=a(h),S=1,O=b,_=-1,E=1;E<=w;E++)E>1&&(O=u(O,b),_=-_),S=S*(w-E+1)/((2*w-E+1)*E),N=n(N,u(S,O)),M=n(M,u(S*_,O));for(var T=u(i(M),N),R=0;R{var{typed:r,abs:t,add:n,multiply:a,map:i,sqrt:u,subtract:l,inv:c,size:o,max:s,identity:m}=e,d=1e3,h=1e-6;function y(v){var x,w=0,C=v,b=m(o(v));do{var N=C;if(C=a(.5,n(N,c(b))),b=a(.5,n(b,c(N))),x=s(t(l(C,N))),x>h&&++w>d)throw new Error("computing square root of matrix: iterative method could not converge")}while(x>h);return C}return r(lB,{"Array | Matrix":function(x){var w=Qe(x)?x.size():ur(x);switch(w.length){case 1:if(w[0]===1)return i(x,u);throw new RangeError("Matrix must be square (size: "+lr(w)+")");case 2:{var C=w[0],b=w[1];if(C===b)return y(x);throw new RangeError("Matrix must be square (size: "+lr(w)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+lr(w)+")")}}})});var mB="sylvester",EG=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Sg=F(mB,EG,e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:a,multiply:i,range:u,concat:l,transpose:c,index:o,subset:s,add:m,subtract:d,identity:h,lusolve:y,abs:v}=e;return r(mB,{"Matrix, Matrix, Matrix":x,"Array, Matrix, Matrix":function(C,b,N){return x(a(C),b,N)},"Array, Array, Matrix":function(C,b,N){return x(a(C),a(b),N)},"Array, Matrix, Array":function(C,b,N){return x(a(C),b,a(N))},"Matrix, Array, Matrix":function(C,b,N){return x(C,a(b),N)},"Matrix, Array, Array":function(C,b,N){return x(C,a(b),a(N))},"Matrix, Matrix, Array":function(C,b,N){return x(C,b,a(N))},"Array, Array, Array":function(C,b,N){return x(a(C),a(b),a(N)).toArray()}});function x(w,C,b){for(var N=C.size()[0],M=w.size()[0],S=t(w),O=S.T,_=S.U,E=t(i(-1,C)),T=E.T,R=E.U,k=i(i(c(_),b),R),W=u(0,M),G=[],H=(Ae,We)=>l(Ae,We,1),L=(Ae,We)=>l(Ae,We,0),q=0;q1e-5){for(var K=L(s(k,o(W,q)),s(k,o(W,q+1))),z=0;z{var{typed:r,matrix:t,identity:n,multiply:a,qr:i,norm:u,subtract:l}=e;return r(pB,{Array:function(s){var m=c(t(s));return{U:m.U.valueOf(),T:m.T.valueOf()}},Matrix:function(s){return c(s)}});function c(o){var s=o.size()[0],m=o,d=n(s),h=0,y;do{y=m;var v=i(m),x=v.Q,w=v.R;if(m=a(w,x),d=a(d,x),h++>100)break}while(u(l(m,y))>1e-4);return{U:d,T:m}}});var dB="lyap",FG=["typed","matrix","sylvester","multiply","transpose"],Ag=F(dB,FG,e=>{var{typed:r,matrix:t,sylvester:n,multiply:a,transpose:i}=e;return r(dB,{"Matrix, Matrix":function(l,c){return n(l,i(l),a(-1,c))},"Array, Matrix":function(l,c){return n(t(l),i(t(l)),a(-1,c))},"Matrix, Array":function(l,c){return n(l,i(t(l)),t(a(-1,c)))},"Array, Array":function(l,c){return n(t(l),i(t(l)),t(a(-1,c))).toArray()}})});var _G="divide",OG=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Mg=F(_G,OG,e=>{var{typed:r,matrix:t,multiply:n,equalScalar:a,divideScalar:i,inv:u}=e,l=jr({typed:r,equalScalar:a}),c=kt({typed:r});return r("divide",Dm({"Array | Matrix, Array | Matrix":function(s,m){return n(s,u(m))},"DenseMatrix, any":function(s,m){return c(s,m,i,!1)},"SparseMatrix, any":function(s,m){return l(s,m,i,!1)},"Array, any":function(s,m){return c(t(s),m,i,!1).valueOf()},"any, Array | Matrix":function(s,m){return n(s,u(m))}},i.signatures))});var hB="distance",BG=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],Cg=F(hB,BG,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,deepEqual:u,sqrt:l,abs:c}=e;return r(hB,{"Array, Array, Array":function(M,S,O){if(M.length===2&&S.length===2&&O.length===2){if(!s(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!s(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!s(O))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(u(S,O))throw new TypeError("LinePoint1 should not be same with LinePoint2");var _=n(O[1],S[1]),E=n(S[0],O[0]),T=n(a(O[0],S[1]),a(S[0],O[1]));return x(M[0],M[1],_,E,T)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(M,S,O){if(Object.keys(M).length===2&&Object.keys(S).length===2&&Object.keys(O).length===2){if(!s(M))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!s(S))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!s(O))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(u(y(S),y(O)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in M&&"pointY"in M&&"lineOnePtX"in S&&"lineOnePtY"in S&&"lineTwoPtX"in O&&"lineTwoPtY"in O){var _=n(O.lineTwoPtY,S.lineOnePtY),E=n(S.lineOnePtX,O.lineTwoPtX),T=n(a(O.lineTwoPtX,S.lineOnePtY),a(S.lineOnePtX,O.lineTwoPtY));return x(M.pointX,M.pointY,_,E,T)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(M,S){if(M.length===2&&S.length===3){if(!s(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!m(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return x(M[0],M[1],S[0],S[1],S[2])}else if(M.length===3&&S.length===6){if(!m(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!h(S))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return w(M[0],M[1],M[2],S[0],S[1],S[2],S[3],S[4],S[5])}else if(M.length===S.length&&M.length>0){if(!d(M))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!d(S))throw new TypeError("All values of an array should be numbers or BigNumbers");return C(M,S)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(M,S){if(Object.keys(M).length===2&&Object.keys(S).length===3){if(!s(M))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!m(S))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in M&&"pointY"in M&&"xCoeffLine"in S&&"yCoeffLine"in S&&"constant"in S)return x(M.pointX,M.pointY,S.xCoeffLine,S.yCoeffLine,S.constant);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===3&&Object.keys(S).length===6){if(!m(M))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!h(S))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in M&&"pointY"in M&&"x0"in S&&"y0"in S&&"z0"in S&&"a"in S&&"b"in S&&"c"in S)return w(M.pointX,M.pointY,M.pointZ,S.x0,S.y0,S.z0,S.a,S.b,S.c);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===2&&Object.keys(S).length===2){if(!s(M))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!s(S))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in M&&"pointOneY"in M&&"pointTwoX"in S&&"pointTwoY"in S)return C([M.pointOneX,M.pointOneY],[S.pointTwoX,S.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===3&&Object.keys(S).length===3){if(!m(M))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!m(S))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in M&&"pointOneY"in M&&"pointOneZ"in M&&"pointTwoX"in S&&"pointTwoY"in S&&"pointTwoZ"in S)return C([M.pointOneX,M.pointOneY,M.pointOneZ],[S.pointTwoX,S.pointTwoY,S.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(M){if(!v(M))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return b(M)}});function o(N){return typeof N=="number"||rr(N)}function s(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])}function m(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])&&o(N[2])}function d(N){return Array.isArray(N)||(N=y(N)),N.every(o)}function h(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])&&o(N[2])&&o(N[3])&&o(N[4])&&o(N[5])}function y(N){for(var M=Object.keys(N),S=[],O=0;OM.length!==2||!o(M[0])||!o(M[1])))return!1}else if(N[0].length===3&&o(N[0][0])&&o(N[0][1])&&o(N[0][2])){if(N.some(M=>M.length!==3||!o(M[0])||!o(M[1])||!o(M[2])))return!1}else return!1;return!0}function x(N,M,S,O,_){var E=c(t(t(a(S,N),a(O,M)),_)),T=l(t(a(S,S),a(O,O)));return i(E,T)}function w(N,M,S,O,_,E,T,R,k){var W=[n(a(n(_,M),k),a(n(E,S),R)),n(a(n(E,S),T),a(n(O,N),k)),n(a(n(O,N),R),a(n(_,M),T))];W=l(t(t(a(W[0],W[0]),a(W[1],W[1])),a(W[2],W[2])));var G=l(t(t(a(T,T),a(R,R)),a(k,k)));return i(W,G)}function C(N,M){for(var S=N.length,O=0,_=0,E=0;E{var{typed:r,config:t,abs:n,add:a,addScalar:i,matrix:u,multiply:l,multiplyScalar:c,divideScalar:o,subtract:s,smaller:m,equalScalar:d,flatten:h,isZero:y,isNumeric:v}=e;return r("intersect",{"Array, Array, Array":x,"Array, Array, Array, Array":w,"Matrix, Matrix, Matrix":function(R,k,W){var G=x(R.valueOf(),k.valueOf(),W.valueOf());return G===null?null:u(G)},"Matrix, Matrix, Matrix, Matrix":function(R,k,W,G){var H=w(R.valueOf(),k.valueOf(),W.valueOf(),G.valueOf());return H===null?null:u(H)}});function x(T,R,k){if(T=C(T),R=C(R),k=C(k),!N(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!M(k))throw new TypeError("Array with 4 numbers expected as third argument");return E(T[0],T[1],T[2],R[0],R[1],R[2],k[0],k[1],k[2],k[3])}function w(T,R,k,W){if(T=C(T),R=C(R),k=C(k),W=C(W),T.length===2){if(!b(T))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(R))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(k))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(W))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return S(T,R,k,W)}else if(T.length===3){if(!N(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!N(k))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!N(W))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return _(T[0],T[1],T[2],R[0],R[1],R[2],k[0],k[1],k[2],W[0],W[1],W[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function C(T){return T.length===1?T[0]:T.length>1&&Array.isArray(T[0])&&T.every(R=>Array.isArray(R)&&R.length===1)?h(T):T}function b(T){return T.length===2&&v(T[0])&&v(T[1])}function N(T){return T.length===3&&v(T[0])&&v(T[1])&&v(T[2])}function M(T){return T.length===4&&v(T[0])&&v(T[1])&&v(T[2])&&v(T[3])}function S(T,R,k,W){var G=T,H=k,L=s(G,R),q=s(H,W),K=s(c(L[0],q[1]),c(q[0],L[1]));if(y(K)||m(n(K),t.epsilon))return null;var z=c(q[0],G[1]),oe=c(q[1],G[0]),pe=c(q[0],H[1]),ae=c(q[1],H[0]),$=o(i(s(s(z,oe),pe),ae),K);return a(l(L,$),G)}function O(T,R,k,W,G,H,L,q,K,z,oe,pe){var ae=c(s(T,R),s(k,W)),$=c(s(G,H),s(L,q)),le=c(s(K,z),s(oe,pe));return i(i(ae,$),le)}function _(T,R,k,W,G,H,L,q,K,z,oe,pe){var ae=O(T,L,z,L,R,q,oe,q,k,K,pe,K),$=O(z,L,W,T,oe,q,G,R,pe,K,H,k),le=O(T,L,W,T,R,q,G,R,k,K,H,k),Ee=O(z,L,z,L,oe,q,oe,q,pe,K,pe,K),me=O(W,T,W,T,G,R,G,R,H,k,H,k),ge=s(c(ae,$),c(le,Ee)),Se=s(c(me,Ee),c($,$));if(y(Se))return null;var ye=o(ge,Se),be=o(i(ae,c(ye,$)),Ee),De=i(T,c(ye,s(W,T))),Ae=i(R,c(ye,s(G,R))),We=i(k,c(ye,s(H,k))),Je=i(L,c(be,s(z,L))),J=i(q,c(be,s(oe,q))),re=i(K,c(be,s(pe,K)));return d(De,Je)&&d(Ae,J)&&d(We,re)?[De,Ae,We]:null}function E(T,R,k,W,G,H,L,q,K,z){var oe=c(T,L),pe=c(W,L),ae=c(R,q),$=c(G,q),le=c(k,K),Ee=c(H,K),me=s(s(s(z,oe),ae),le),ge=s(s(s(i(i(pe,$),Ee),oe),ae),le),Se=o(me,ge),ye=i(T,c(Se,s(W,T))),be=i(R,c(Se,s(G,R))),De=i(k,c(Se,s(H,k)));return[ye,be,De]}});var vB="sum",RG=["typed","config","add","numeric"],nf=F(vB,RG,e=>{var{typed:r,config:t,add:n,numeric:a}=e;return r(vB,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":u,"...":function(c){if(Pa(c))throw new TypeError("Scalar values expected in function sum");return i(c)}});function i(l){var c;return An(l,function(o){try{c=c===void 0?o:n(c,o)}catch(s){throw Et(s,"sum",o)}}),c===void 0&&(c=a(0,t.number)),typeof c=="string"&&(c=a(c,t.number)),c}function u(l,c){try{var o=ko(l,c,n);return o}catch(s){throw Et(s,"sum")}}});var Tg="cumsum",qG=["typed","add","unaryPlus"],af=F(Tg,qG,e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(Tg,{Array:a,Matrix:function(o){return o.create(a(o.valueOf()))},"Array, number | BigNumber":u,"Matrix, number | BigNumber":function(o,s){return o.create(u(o.valueOf(),s))},"...":function(o){if(Pa(o))throw new TypeError("All values expected to be scalar in function cumsum");return a(o)}});function a(c){try{return i(c)}catch(o){throw Et(o,Tg)}}function i(c){if(c.length===0)return[];for(var o=[n(c[0])],s=1;s=s.length)throw new tn(o,s.length);try{return l(c,o)}catch(m){throw Et(m,Tg)}}function l(c,o){var s,m,d;if(o<=0){var h=c[0][0];if(Array.isArray(h)){for(d=Km(c),m=[],s=0;s{var{typed:r,add:t,divide:n}=e;return r(gB,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(l){if(Pa(l))throw new TypeError("Scalar values expected in function mean");return i(l)}});function a(u,l){try{var c=ko(u,l,t),o=Array.isArray(u)?ur(u):u.size();return n(c,o[l])}catch(s){throw Et(s,"mean")}}function i(u){var l,c=0;if(An(u,function(o){try{l=l===void 0?o:t(l,o),c++}catch(s){throw Et(s,"mean",o)}}),c===0)throw new Error("Cannot calculate the mean of an empty array");return n(l,c)}});var yB="median",LG=["typed","add","divide","compare","partitionSelect"],Fg=F(yB,LG,e=>{var{typed:r,add:t,divide:n,compare:a,partitionSelect:i}=e;function u(o){try{o=gr(o.valueOf());var s=o.length;if(s===0)throw new Error("Cannot calculate median of an empty array");if(s%2===0){for(var m=s/2-1,d=i(o,m+1),h=o[m],y=0;y0&&(h=o[y]);return c(h,d)}else{var v=i(o,(s-1)/2);return l(v)}}catch(x){throw Et(x,"median")}}var l=r({"number | BigNumber | Complex | Unit":function(s){return s}}),c=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(s,m){return n(t(s,m),2)}});return r(yB,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(s,m){throw new Error("median(A, dim) is not yet supported")},"...":function(s){if(Pa(s))throw new TypeError("Scalar values expected in function median");return u(s)}})});var xB="mad",zG=["typed","abs","map","median","subtract"],_g=F(xB,zG,e=>{var{typed:r,abs:t,map:n,median:a,subtract:i}=e;return r(xB,{"Array | Matrix":u,"...":function(c){return u(c)}});function u(l){if(l=gr(l.valueOf()),l.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var c=a(l);return a(n(l,function(o){return t(i(o,c))}))}catch(o){throw o instanceof TypeError&&o.message.indexOf("median")!==-1?new TypeError(o.message.replace("median","mad")):Et(o,"mad")}}});var AD="unbiased",bB="variance",UG=["typed","add","subtract","multiply","divide","apply","isNaN"],sf=F(bB,UG,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l}=e;return r(bB,{"Array | Matrix":function(m){return c(m,AD)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(m,d){return o(m,d,AD)},"Array | Matrix, number | BigNumber, string":o,"...":function(m){return c(m,AD)}});function c(s,m){var d,h=0;if(s.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(An(s,function(x){try{d=d===void 0?x:t(d,x),h++}catch(w){throw Et(w,"variance",x)}}),h===0)throw new Error("Cannot calculate variance of an empty array");var y=i(d,h);if(d=void 0,An(s,function(x){var w=n(x,y);d=d===void 0?a(w,w):t(d,a(w,w))}),l(d))return d;switch(m){case"uncorrected":return i(d,h);case"biased":return i(d,h+1);case"unbiased":{var v=rr(d)?d.mul(0):0;return h===1?v:i(d,h-1)}default:throw new Error('Unknown normalization "'+m+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function o(s,m,d){try{if(s.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return u(s,m,h=>c(h,d))}catch(h){throw Et(h,"variance")}}});var wB="quantileSeq",WG=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],uf=F(wB,WG,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d}=e,h=Lo({typed:r,isInteger:o});return r(wB,{"Array | Matrix, number | BigNumber":(C,b)=>v(C,b,!1),"Array | Matrix, number | BigNumber, number":(C,b,N)=>y(C,b,!1,N,v),"Array | Matrix, number | BigNumber, boolean":v,"Array | Matrix, number | BigNumber, boolean, number":(C,b,N,M)=>y(C,b,N,M,v),"Array | Matrix, Array | Matrix":(C,b)=>x(C,b,!1),"Array | Matrix, Array | Matrix, number":(C,b,N)=>y(C,b,!1,N,x),"Array | Matrix, Array | Matrix, boolean":x,"Array | Matrix, Array | Matrix, boolean, number":(C,b,N,M)=>y(C,b,N,M,x)});function y(C,b,N,M,S){return h(C,M,O=>S(O,b,N))}function v(C,b,N){var M,S=C.valueOf();if(s(b,0))throw new Error("N/prob must be non-negative");if(m(b,1))return sr(b)?w(S,b,N):t(w(S,b,N));if(d(b,1)){if(!o(b))throw new Error("N must be a positive integer");if(d(b,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var O=n(b,1);M=[];for(var _=0;s(_,b);_++){var E=i(_+1,O);M.push(w(S,E,N))}return sr(b)?M:t(M)}}function x(C,b,N){for(var M=C.valueOf(),S=b.valueOf(),O=[],_=0;_0&&(T=M[k])}return n(u(T,a(1,E)),u(R,E))}});var DB="std",YG=["typed","map","sqrt","variance"],ff=F(DB,YG,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e;return r(DB,{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(l){return i(l)}});function i(u,l){if(u.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var c=a.apply(null,arguments);return Nt(c)?t(c,n):n(c)}catch(o){throw o instanceof TypeError&&o.message.indexOf(" variance")!==-1?new TypeError(o.message.replace(" variance"," std")):o}}});var SB="corr",HG=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],Og=F(SB,HG,e=>{var{typed:r,matrix:t,sqrt:n,sum:a,add:i,subtract:u,multiply:l,pow:c,divide:o}=e;return r(SB,{"Array, Array":function(h,y){return s(h,y)},"Matrix, Matrix":function(h,y){var v=s(h.toArray(),y.toArray());return Array.isArray(v)?t(v):v}});function s(d,h){var y=[];if(Array.isArray(d[0])&&Array.isArray(h[0])){if(d.length!==h.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var v=0;vi(S,l(O,h[_])),0),C=a(d.map(S=>c(S,2))),b=a(h.map(S=>c(S,2))),N=u(l(y,w),l(v,x)),M=n(l(u(l(y,C),c(v,2)),u(l(y,b),c(x,2))));return o(N,M)}});var NB="combinations",$G=["typed"],Bg=F(NB,$G,e=>{var{typed:r}=e;return r(NB,{"number, number":kw,"BigNumber, BigNumber":function(n,a){var i=n.constructor,u,l,c=n.minus(a),o=new i(1);if(!AB(n)||!AB(a))throw new TypeError("Positive integer value expected in function combinations");if(a.gt(n))throw new TypeError("k must be less than n in function combinations");if(u=o,a.lt(c))for(l=o;l.lte(c);l=l.plus(o))u=u.times(a.plus(l)).dividedBy(l);else for(l=o;l.lte(a);l=l.plus(o))u=u.times(c.plus(l)).dividedBy(l);return u}})});function AB(e){return e.isInteger()&&e.gte(0)}var MB="combinationsWithRep",GG=["typed"],Pg=F(MB,GG,e=>{var{typed:r}=e;return r(MB,{"number, number":function(n,a){if(!Ze(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(a{var{typed:r,config:t,multiplyScalar:n,pow:a,BigNumber:i,Complex:u}=e;function l(o){if(o.im===0)return Fc(o.re);if(o.re<.5){var s=new u(1-o.re,-o.im),m=new u(Math.PI*o.re,Math.PI*o.im);return new u(Math.PI).div(m.sin()).div(l(s))}o=new u(o.re-1,o.im);for(var d=new u(Fs[0],0),h=1;h2;)d-=2,y+=d,h=h.times(y);return new i(h.toPrecision(i.precision))}});var TB="lgamma",ZG=["Complex","typed"],Rg=F(TB,ZG,e=>{var{Complex:r,typed:t}=e,n=7,a=7,i=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(TB,{number:_c,Complex:u,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function u(o){var s=6.283185307179586,m=1.1447298858494002,d=.1;if(o.isNaN())return new r(NaN,NaN);if(o.im===0)return new r(_c(o.re),0);if(o.re>=n||Math.abs(o.im)>=a)return l(o);if(o.re<=d){var h=oM(s,o.im)*Math.floor(.5*o.re+.25),y=o.mul(Math.PI).sin().log(),v=u(new r(1-o.re,-o.im));return new r(m,h).sub(y).sub(v)}else return o.im>=0?c(o):c(o.conjugate()).conjugate()}function l(o){for(var s=o.sub(.5).mul(o.log()).sub(o).add($w),m=new r(1,0).div(o),d=m.div(o),h=i[0],y=i[1],v=2*d.re,x=d.re*d.re+d.im*d.im,w=2;w<8;w++){var C=y;y=-x*h+i[w],h=v*h+C}var b=m.mul(d.mul(h).add(y));return s.add(b)}function c(o){var s=0,m=0,d=o;for(o=o.add(1);o.re<=n;){d=d.mul(o);var h=d.im<0?1:0;h!==0&&m===0&&s++,m=h,o=o.add(1)}return l(o).sub(d.log()).sub(new r(0,s*2*Math.PI*1))}});var FB="factorial",QG=["typed","gamma"],qg=F(FB,QG,e=>{var{typed:r,gamma:t}=e;return r(FB,{number:function(a){if(a<0)throw new Error("Value must be non-negative");return t(a+1)},BigNumber:function(a){if(a.isNegative())throw new Error("Value must be non-negative");return t(a.plus(1))},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var _B="kldivergence",XG=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],kg=F(_B,XG,e=>{var{typed:r,matrix:t,divide:n,sum:a,multiply:i,map:u,dotDivide:l,log:c,isNumeric:o}=e;return r(_B,{"Array, Array":function(d,h){return s(t(d),t(h))},"Matrix, Array":function(d,h){return s(d,t(h))},"Array, Matrix":function(d,h){return s(t(d),h)},"Matrix, Matrix":function(d,h){return s(d,h)}});function s(m,d){var h=d.size().length,y=m.size().length;if(h>1)throw new Error("first object must be one dimensional");if(y>1)throw new Error("second object must be one dimensional");if(h!==y)throw new Error("Length of two vectors must be equal");var v=a(m);if(v===0)throw new Error("Sum of elements in first object must be non zero");var x=a(d);if(x===0)throw new Error("Sum of elements in second object must be non zero");var w=n(m,a(m)),C=n(d,a(d)),b=a(i(w,u(l(w,C),N=>c(N))));return o(b)?b:Number.NaN}});var OB="multinomial",JG=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Lg=F(OB,JG,e=>{var{typed:r,add:t,divide:n,multiply:a,factorial:i,isInteger:u,isPositive:l}=e;return r(OB,{"Array | Matrix":function(o){var s=0,m=1;return An(o,function(d){if(!u(d)||!l(d))throw new TypeError("Positive integer value expected in function multinomial");s=t(s,d),m=a(m,i(d))}),n(i(s),m)}})});var BB="permutations",KG=["typed","factorial"],zg=F(BB,KG,e=>{var{typed:r,factorial:t}=e;return r(BB,{"number | BigNumber":t,"number, number":function(a,i){if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(!Ze(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(i>a)throw new TypeError("second argument k must be less than or equal to first argument n");return va(a-i+1,a)},"BigNumber, BigNumber":function(a,i){var u,l;if(!PB(a)||!PB(i))throw new TypeError("Positive integer value expected in function permutations");if(i.gt(a))throw new TypeError("second argument k must be less than or equal to first argument n");var c=a.mul(0).add(1);for(u=c,l=a.minus(i).plus(1);l.lte(a);l=l.plus(1))u=u.times(l);return u}})});function PB(e){return e.isInteger()&&e.gte(0)}var OD=ma(JB(),1),iV=(0,OD.default)(Date.now());function no(e){var r;function t(a){r=a===null?iV:(0,OD.default)(String(a))}t(e);function n(){return r()}return n}var KB="pickRandom",oV=["typed","config","?on"],Wg=F(KB,oV,e=>{var{typed:r,config:t,on:n}=e,a=no(t.randomSeed);return n&&n("config",function(u,l){u.randomSeed!==l.randomSeed&&(a=no(u.randomSeed))}),r(KB,{"Array | Matrix":function(l){return i(l,{})},"Array | Matrix, Object":function(l,c){return i(l,c)},"Array | Matrix, number":function(l,c){return i(l,{number:c})},"Array | Matrix, Array | Matrix":function(l,c){return i(l,{weights:c})},"Array | Matrix, Array | Matrix, number":function(l,c,o){return i(l,{number:o,weights:c})},"Array | Matrix, number, Array | Matrix":function(l,c,o){return i(l,{number:c,weights:o})}});function i(u,l){var{number:c,weights:o,elementWise:s=!0}=l,m=typeof c>"u";m&&(c=1);var d=Qe(u)?u.create:Qe(o)?o.create:null;u=u.valueOf(),o&&(o=o.valueOf()),s===!0&&(u=gr(u),o=gr(o));var h=0;if(typeof o<"u"){if(o.length!==u.length)throw new Error("Weights must have the same length as possibles");for(var y=0,v=o.length;y"u")C=u[Math.floor(a()*x)];else for(var b=a()*h,N=0,M=u.length;N1)for(var n=0,a=e.shift();n{var{typed:r,config:t,on:n}=e,a=no(t.randomSeed);return n&&n("config",function(l,c){l.randomSeed!==c.randomSeed&&(a=no(l.randomSeed))}),r(jB,{"":()=>u(0,1),number:l=>u(0,l),"number, number":(l,c)=>u(l,c),"Array | Matrix":l=>i(l,0,1),"Array | Matrix, number":(l,c)=>i(l,0,c),"Array | Matrix, number, number":(l,c,o)=>i(l,c,o)});function i(l,c,o){var s=Rc(l.valueOf(),()=>u(c,o));return Qe(l)?l.create(s):s}function u(l,c){return l+a()*(c-l)}});var eP="randomInt",uV=["typed","config","?on"],Hg=F(eP,uV,e=>{var{typed:r,config:t,on:n}=e,a=no(t.randomSeed);return n&&n("config",function(l,c){l.randomSeed!==c.randomSeed&&(a=no(l.randomSeed))}),r(eP,{"":()=>u(0,1),number:l=>u(0,l),"number, number":(l,c)=>u(l,c),"Array | Matrix":l=>i(l,0,1),"Array | Matrix, number":(l,c)=>i(l,0,c),"Array | Matrix, number, number":(l,c,o)=>i(l,c,o)});function i(l,c,o){var s=Rc(l.valueOf(),()=>u(c,o));return Qe(l)?l.create(s):s}function u(l,c){return Math.floor(l+a()*(c-l))}});var rP="stirlingS2",fV=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],$g=F(rP,fV,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,pow:u,factorial:l,combinations:c,isNegative:o,isInteger:s,number:m,bignumber:d,larger:h}=e,y=[],v=[];return r(rP,{"number | BigNumber, number | BigNumber":function(w,C){if(!s(w)||o(w)||!s(C)||o(C))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(h(C,w))throw new TypeError("k must be less than or equal to n in function stirlingS2");var b=!(sr(w)&&sr(C)),N=b?v:y,M=b?d:m,S=m(w),O=m(C);if(N[S]&&N[S].length>O)return N[S][O];for(var _=0;_<=S;++_)if(N[_]||(N[_]=[M(_===0?1:0)]),_!==0)for(var E=N[_],T=N[_-1],R=E.length;R<=_&&R<=O;++R)R===_?E[R]=1:E[R]=t(a(M(R),T[R]),T[R-1]);return N[S][O]}})});var tP="bellNumbers",cV=["typed","addScalar","isNegative","isInteger","stirlingS2"],Gg=F(tP,cV,e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:a,stirlingS2:i}=e;return r(tP,{"number | BigNumber":function(l){if(!a(l)||n(l))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var c=0,o=0;o<=l;o++)c=t(c,i(l,o));return c}})});var nP="catalan",lV=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Vg=F(nP,lV,e=>{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:a,combinations:i,isNegative:u,isInteger:l}=e;return r(nP,{"number | BigNumber":function(o){if(!l(o)||u(o))throw new TypeError("Non-negative integer value expected in function catalan");return n(i(a(o,2),o),t(o,1))}})});var aP="composition",mV=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Zg=F(aP,mV,e=>{var{typed:r,addScalar:t,combinations:n,isPositive:a,isNegative:i,isInteger:u,larger:l}=e;return r(aP,{"number | BigNumber, number | BigNumber":function(o,s){if(!u(o)||!a(o)||!u(s)||!a(s))throw new TypeError("Positive integer value expected in function composition");if(l(s,o))throw new TypeError("k must be less than or equal to n in function composition");return n(t(o,-1),t(s,-1))}})});var iP="leafCount",pV=["parse","typed"],Qg=F(iP,pV,e=>{var{parse:r,typed:t}=e;function n(a){var i=0;return a.forEach(u=>{i+=n(u)}),i||1}return t(iP,{Node:function(i){return n(i)}})});function BD(e){return xr(e)||ct(e)&&e.isUnary()&&xr(e.args[0])}function qc(e){return!!(xr(e)||(yn(e)||ct(e))&&e.args.every(qc)||en(e)&&qc(e.content))}function oP(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function PD(e){for(var r=1;r{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,a=!0,i=!1,u="defaultF",l={add:{trivial:a,total:a,commutative:a,associative:a},unaryPlus:{trivial:a,total:a,commutative:a,associative:a},subtract:{trivial:i,total:a,commutative:i,associative:i},multiply:{trivial:a,total:a,commutative:a,associative:a},divide:{trivial:i,total:a,commutative:i,associative:i},paren:{trivial:a,total:a,commutative:a,associative:i},defaultF:{trivial:i,total:a,commutative:i,associative:i}},c={divide:{total:i},log:{total:i}},o={subtract:{total:i},abs:{trivial:a},log:{total:a}};function s(b,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l,S=u;if(typeof b=="string"?S=b:ct(b)?S=b.fn.toString():yn(b)?S=b.name:en(b)&&(S="paren"),Xe(M,S)){var O=M[S];if(Xe(O,N))return O[N];if(Xe(l,S))return l[S][N]}if(Xe(M,u)){var _=M[u];return Xe(_,N)?_[N]:l[u][N]}if(Xe(l,S)){var E=l[S];if(Xe(E,N))return E[N]}return l[u][N]}function m(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return s(b,"commutative",N)}function d(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return s(b,"associative",N)}function h(b,N){var M=PD({},b);for(var S in N)Xe(b,S)?M[S]=PD(PD({},N[S]),b[S]):M[S]=N[S];return M}function y(b,N){if(!b.args||b.args.length===0)return b;b.args=v(b,N);for(var M=0;M2&&d(b,N)){for(var _=b.args.pop();b.args.length>0;)_=M([b.args.pop(),_]);b.args=_.args}}}function w(b,N){if(!(!b.args||b.args.length===0)){for(var M=C(b),S=b.args.length,O=0;O2&&d(b,N)){for(var _=b.args.shift();b.args.length>0;)_=M([_,b.args.shift()]);b.args=_.args}}}function C(b){return ct(b)?function(N){try{return new t(b.op,b.fn,N,b.implicit)}catch(M){return console.error(M),[]}}:function(N){return new r(new n(b.name),N)}}return{createMakeNodeFunction:C,hasProperty:s,isCommutative:m,isAssociative:d,mergeContext:h,flatten:y,allChildren:v,unflattenr:x,unflattenl:w,defaultContext:l,realContext:c,positiveContext:o}});var vV="simplify",gV=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Xg=F(vV,gV,e=>{var{config:r,typed:t,parse:n,add:a,subtract:i,multiply:u,divide:l,pow:c,isZero:o,equal:s,resolve:m,simplifyConstant:d,simplifyCore:h,fraction:y,bignumber:v,mathWithTransform:x,matrix:w,AccessorNode:C,ArrayNode:b,ConstantNode:N,FunctionNode:M,IndexNode:S,ObjectNode:O,OperatorNode:_,ParenthesisNode:E,SymbolNode:T}=e,{hasProperty:R,isCommutative:k,isAssociative:W,mergeContext:G,flatten:H,unflattenr:L,unflattenl:q,createMakeNodeFunction:K,defaultContext:z,realContext:oe,positiveContext:pe}=cf({FunctionNode:M,OperatorNode:_,SymbolNode:T});t.addConversion({from:"Object",to:"Map",convert:ji});var ae=t("simplify",{Node:ye,"Node, Map":(j,ne)=>ye(j,!1,ne),"Node, Map, Object":(j,ne,ue)=>ye(j,!1,ne,ue),"Node, Array":ye,"Node, Array, Map":ye,"Node, Array, Map, Object":ye});t.removeConversion({from:"Object",to:"Map",convert:ji}),ae.defaultContext=z,ae.realContext=oe,ae.positiveContext=pe;function $(j){return j.transform(function(ne,ue,Me){return en(ne)?$(ne.content):ne})}var le={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};ae.rules=[h,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},d,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},d,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ee(j,ne){var ue={};if(j.s){var Me=j.s.split("->");if(Me.length===2)ue.l=Me[0],ue.r=Me[1];else throw SyntaxError("Could not parse rule: "+j.s)}else ue.l=j.l,ue.r=j.r;ue.l=$(n(ue.l)),ue.r=$(n(ue.r));for(var Ce of["imposeContext","repeat","assuming"])Ce in j&&(ue[Ce]=j[Ce]);if(j.evaluate&&(ue.evaluate=n(j.evaluate)),W(ue.l,ne)){var Le=!k(ue.l,ne),Ie;Le&&(Ie=Se());var fr=K(ue.l),or=Se();ue.expanded={},ue.expanded.l=fr([ue.l,or]),H(ue.expanded.l,ne),L(ue.expanded.l,ne),ue.expanded.r=fr([ue.r,or]),Le&&(ue.expandedNC1={},ue.expandedNC1.l=fr([Ie,ue.l]),ue.expandedNC1.r=fr([Ie,ue.r]),ue.expandedNC2={},ue.expandedNC2.l=fr([Ie,ue.expanded.l]),ue.expandedNC2.r=fr([Ie,ue.expanded.r]))}return ue}function me(j,ne){for(var ue=[],Me=0;Me2&&arguments[2]!==void 0?arguments[2]:Bo(),Me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ce=Me.consoleDebug;ne=me(ne||ae.rules,Me.context);var Le=m(j,ue);Le=$(Le);for(var Ie={},fr=Le.toString({parenthesis:"all"});!Ie[fr];){Ie[fr]=!0,ge=0;var or=fr;Ce&&console.log("Working on: ",fr);for(var Ke=0;Ke ").concat(ne[Ke].r.toString()))),Ce){var ee=Le.toString({parenthesis:"all"});ee!==or&&(console.log("Applying",Pr,"produced",ee),or=ee)}q(Le,Me.context)}fr=Le.toString({parenthesis:"all"})}return Le}function be(j,ne,ue){var Me=j;if(j)for(var Ce=0;Ce1&&(or=Le(j.args.slice(0,fr))),Ce=j.args.slice(fr),Me=Ce.length===1?Ce[0]:Le(Ce),ue.push(Le([or,Me]))}return ue}function We(j,ne){var ue={placeholders:{}};if(!j.placeholders&&!ne.placeholders)return ue;if(j.placeholders){if(!ne.placeholders)return j}else return ne;for(var Me in j.placeholders)if(Xe(j.placeholders,Me)&&(ue.placeholders[Me]=j.placeholders[Me],Xe(ne.placeholders,Me)&&!xe(j.placeholders[Me],ne.placeholders[Me])))return null;for(var Ce in ne.placeholders)Xe(ne.placeholders,Ce)&&(ue.placeholders[Ce]=ne.placeholders[Ce]);return ue}function Je(j,ne){var ue=[];if(j.length===0||ne.length===0)return ue;for(var Me,Ce=0;Ce2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var or=re(j.args[0],ne.args[1],ue);if(or.length===0)return[];var Ke=re(j.args[1],ne.args[0],ue);if(Ke.length===0)return[];Le=[or,Ke]}Ce=J(Le)}else if(ne.args.length>=2&&j.args.length===2){for(var Pr=Ae(ne,ue),ee=[],ce=0;ce2)throw Error("Unexpected non-binary associative function: "+j.toString());return[]}}else if(j instanceof T){if(j.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(le[j.name]){if(j.name!==ne.name)return[]}else switch(j.name[1]>="a"&&j.name[1]<="z"?j.name.substring(0,2):j.name[0]){case"n":case"_p":Ce[0].placeholders[j.name]=ne;break;case"c":case"cl":if(xr(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"v":if(!xr(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"vl":if(at(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"cd":if(BD(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"vd":if(!BD(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"ce":if(qc(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"ve":if(!qc(ne))Ce[0].placeholders[j.name]=ne;else return[];break;default:throw new Error("Invalid symbol in rule: "+j.name)}}else if(j instanceof N){if(!s(j.value,ne.value))return[]}else return[];return Ce}function xe(j,ne){if(j instanceof N&&ne instanceof N){if(!s(j.value,ne.value))return!1}else if(j instanceof T&&ne instanceof T){if(j.name!==ne.name)return!1}else if(j instanceof _&&ne instanceof _||j instanceof M&&ne instanceof M){if(j instanceof _){if(j.op!==ne.op||j.fn!==ne.fn)return!1}else if(j instanceof M&&j.name!==ne.name)return!1;if(j.args.length!==ne.args.length)return!1;for(var ue=0;ue{var{typed:r,config:t,mathWithTransform:n,matrix:a,fraction:i,bignumber:u,AccessorNode:l,ArrayNode:c,ConstantNode:o,FunctionNode:s,IndexNode:m,ObjectNode:d,OperatorNode:h,SymbolNode:y}=e,{isCommutative:v,isAssociative:x,allChildren:w,createMakeNodeFunction:C}=cf({FunctionNode:s,OperatorNode:h,SymbolNode:y}),b=r("simplifyConstant",{Node:H=>O(G(H,{})),"Node, Object":function(L,q){return O(G(L,q))}});function N(H){return da(H)?H.valueOf():H instanceof Array?H.map(N):Qe(H)?a(N(H.valueOf())):H}function M(H,L,q){try{return n[H].apply(null,L)}catch{return L=L.map(N),E(n[H].apply(null,L),q)}}var S=r({Fraction:R,number:function(L){return L<0?T(new o(-L)):new o(L)},BigNumber:function(L){return L<0?T(new o(-L)):new o(L)},Complex:function(L){throw new Error("Cannot convert Complex number to Node")},string:function(L){return new o(L)},Matrix:function(L){return new c(L.valueOf().map(q=>S(q)))}});function O(H){return Nr(H)?H:S(H)}function _(H,L){var q=L&&L.exactFractions!==!1;if(q&&isFinite(H)&&i){var K=i(H),z=L&&typeof L.fractionsLimit=="number"?L.fractionsLimit:1/0;if(K.valueOf()===H&&K.n0;)if(xr(K[0])&&typeof K[0].value!="string"){var z=E(K.shift().value,q);jt(H)?H=H.items[z-1]:(H=H.valueOf()[z-1],H instanceof Array&&(H=a(H)))}else if(K.length>1&&xr(K[1])&&typeof K[1].value!="string"){var oe=E(K[1].value,q),pe=[],ae=jt(H)?H.items:H.valueOf();for(var $ of ae)if(jt($))pe.push($.items[oe-1]);else if(Qe(H))pe.push($[oe-1]);else break;if(pe.length===ae.length)jt(H)?H=new c(pe):H=a(pe),K.splice(1,1);else break}else break;return K.length===L.dimensions.length?new l(O(H),L):K.length>0?(L=new m(K),new l(O(H),L)):H}if(Ei(H)&&L.dimensions.length===1&&xr(L.dimensions[0])){var le=L.dimensions[0].value;return le in H.properties?H.properties[le]:new o}return new l(O(H),L)}function W(H,L,q,K){var z=L.shift(),oe=L.reduce((pe,ae)=>{if(!Nr(ae)){var $=pe.pop();if(Nr($))return[$,ae];try{return pe.push(M(H,[$,ae],K)),pe}catch{pe.push($)}}pe.push(O(pe.pop()));var le=pe.length===1?pe[0]:q(pe);return[q([le,O(ae)])]},[z]);return oe.length===1?oe[0]:q([oe[0],S(oe[1])])}function G(H,L){switch(H.type){case"SymbolNode":return H;case"ConstantNode":switch(typeof H.value){case"number":return E(H.value,L);case"string":return H.value;default:if(!isNaN(H.value))return E(H.value,L)}return H;case"FunctionNode":if(n[H.name]&&n[H.name].rawArgs)return H;{var q=["add","multiply"];if(q.indexOf(H.name)===-1){var K=H.args.map(De=>G(De,L));if(!K.some(Nr))try{return M(H.name,K,L)}catch{}if(H.name==="size"&&K.length===1&&jt(K[0])){for(var z=[],oe=K[0];jt(oe);)z.push(oe.items.length),oe=oe.items[0];return a(z)}return new s(H.name,K.map(O))}}case"OperatorNode":{var pe=H.fn.toString(),ae,$,le=C(H);if(ct(H)&&H.isUnary())ae=[G(H.args[0],L)],Nr(ae[0])?$=le(ae):$=M(pe,ae,L);else if(x(H,L.context))if(ae=w(H,L.context),ae=ae.map(De=>G(De,L)),v(pe,L.context)){for(var Ee=[],me=[],ge=0;ge1?($=W(pe,Ee,le,L),me.unshift($),$=W(pe,me,le,L)):$=W(pe,ae,le,L)}else $=W(pe,ae,le,L);else ae=H.args.map(De=>G(De,L)),$=W(pe,ae,le,L);return $}case"ParenthesisNode":return G(H.content,L);case"AccessorNode":return k(G(H.object,L),G(H.index,L),L);case"ArrayNode":{var Se=H.items.map(De=>G(De,L));return Se.some(Nr)?new c(Se.map(O)):a(Se)}case"IndexNode":return new m(H.dimensions.map(De=>b(De,L)));case"ObjectNode":{var ye={};for(var be in H.properties)ye[be]=b(H.properties[be],L);return new d(ye)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(H.type))}}return b});var sP="simplifyCore",bV=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Kg=F(sP,bV,e=>{var{typed:r,parse:t,equal:n,isZero:a,add:i,subtract:u,multiply:l,divide:c,pow:o,AccessorNode:s,ArrayNode:m,ConstantNode:d,FunctionNode:h,IndexNode:y,ObjectNode:v,OperatorNode:x,ParenthesisNode:w,SymbolNode:C}=e,b=new d(0),N=new d(1),M=new d(!0),S=new d(!1);function O(R){return ct(R)&&["and","not","or"].includes(R.op)}var{hasProperty:_,isCommutative:E}=cf({FunctionNode:h,OperatorNode:x,SymbolNode:C});function T(R){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=k?k.context:void 0;if(_(R,"trivial",W)){if(yn(R)&&R.args.length===1)return T(R.args[0],k);var G=!1,H=0;if(R.forEach(me=>{++H,H===1&&(G=T(me,k))}),H===1)return G}var L=R;if(yn(L)){var q=aT(L.name);if(q){if(L.args.length>2&&_(L,"associative",W))for(;L.args.length>2;){var K=L.args.pop(),z=L.args.pop();L.args.push(new x(q,L.name,[K,z]))}L=new x(q,L.name,L.args)}else return new h(T(L.fn),L.args.map(me=>T(me,k)))}if(ct(L)&&L.isUnary()){var oe=T(L.args[0],k);if(L.op==="~"&&ct(oe)&&oe.isUnary()&&oe.op==="~"||L.op==="not"&&ct(oe)&&oe.isUnary()&&oe.op==="not"&&O(oe.args[0]))return oe.args[0];var pe=!0;if(L.op==="-"&&ct(oe)&&(oe.isBinary()&&oe.fn==="subtract"&&(L=new x("-","subtract",[oe.args[1],oe.args[0]]),pe=!1),oe.isUnary()&&oe.op==="-"))return oe.args[0];if(pe)return new x(L.op,L.fn,[oe])}if(ct(L)&&L.isBinary()){var ae=T(L.args[0],k),$=T(L.args[1],k);if(L.op==="+"){if(xr(ae)&&a(ae.value))return $;if(xr($)&&a($.value))return ae;ct($)&&$.isUnary()&&$.op==="-"&&($=$.args[0],L=new x("-","subtract",[ae,$]))}if(L.op==="-")return ct($)&&$.isUnary()&&$.op==="-"?T(new x("+","add",[ae,$.args[0]]),k):xr(ae)&&a(ae.value)?T(new x("-","unaryMinus",[$])):xr($)&&a($.value)?ae:new x(L.op,L.fn,[ae,$]);if(L.op==="*"){if(xr(ae)){if(a(ae.value))return b;if(n(ae.value,1))return $}if(xr($)){if(a($.value))return b;if(n($.value,1))return ae;if(E(L,W))return new x(L.op,L.fn,[$,ae],L.implicit)}return new x(L.op,L.fn,[ae,$],L.implicit)}if(L.op==="/")return xr(ae)&&a(ae.value)?b:xr($)&&n($.value,1)?ae:new x(L.op,L.fn,[ae,$]);if(L.op==="^"&&xr($)){if(a($.value))return N;if(n($.value,1))return ae}if(L.op==="and"){if(xr(ae))if(ae.value){if(O($))return $;if(xr($))return $.value?M:S}else return S;if(xr($))if($.value){if(O(ae))return ae}else return S}if(L.op==="or"){if(xr(ae)){if(ae.value)return M;if(O($))return $}if(xr($)){if($.value)return M;if(O(ae))return ae}}return new x(L.op,L.fn,[ae,$])}if(ct(L))return new x(L.op,L.fn,L.args.map(me=>T(me,k)));if(jt(L))return new m(L.items.map(me=>T(me,k)));if(Ln(L))return new s(T(L.object,k),T(L.index,k));if(Jn(L))return new y(L.dimensions.map(me=>T(me,k)));if(Ei(L)){var le={};for(var Ee in L.properties)le[Ee]=T(L.properties[Ee],k);return new v(le)}return L}return r(sP,{Node:T,"Node,Object":T})});var wV="resolve",DV=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],jg=F(wV,DV,e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:a,OperatorNode:i,ParenthesisNode:u}=e;function l(c,o){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!o)return c;if(at(c)){if(s.has(c.name)){var m=Array.from(s).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(m,"}"))}var d=o.get(c.name);if(Nr(d)){var h=new Set(s);return h.add(c.name),l(d,o,h)}else return typeof d=="number"?t(String(d)):d!==void 0?new n(d):c}else if(ct(c)){var y=c.args.map(function(x){return l(x,o,s)});return new i(c.op,c.fn,y,c.implicit)}else{if(en(c))return new u(l(c.content,o,s));if(yn(c)){var v=c.args.map(function(x){return l(x,o,s)});return new a(c.name,v)}}return c.map(x=>l(x,o,s))}return r("resolve",{Node:l,"Node, Map | null | undefined":l,"Node, Object":(c,o)=>l(c,ji(o)),"Array | Matrix":r.referToSelf(c=>o=>o.map(s=>c(s))),"Array | Matrix, null | undefined":r.referToSelf(c=>o=>o.map(s=>c(s))),"Array, Object":r.referTo("Array,Map",c=>(o,s)=>c(o,ji(s))),"Matrix, Object":r.referTo("Matrix,Map",c=>(o,s)=>c(o,ji(s))),"Array | Matrix, Map":r.referToSelf(c=>(o,s)=>o.map(m=>c(m,s)))})});var uP="symbolicEqual",SV=["parse","simplify","typed","OperatorNode"],e0=F(uP,SV,e=>{var{parse:r,simplify:t,typed:n,OperatorNode:a}=e;function i(u,l){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=new a("-","subtract",[u,l]),s=t(o,{},c);return xr(s)&&!s.value}return n(uP,{"Node, Node":i,"Node, Node, Object":i})});var fP="derivative",NV=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],r0=F(fP,NV,e=>{var{typed:r,config:t,parse:n,simplify:a,equal:i,isZero:u,numeric:l,ConstantNode:c,FunctionNode:o,OperatorNode:s,ParenthesisNode:m,SymbolNode:d}=e;function h(b,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},S={};x(S,b,N.name);var O=w(b,S);return M.simplify?a(O):O}r.addConversion({from:"identifier",to:"SymbolNode",convert:n});var y=r(fP,{"Node, SymbolNode":h,"Node, SymbolNode, Object":h});r.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),y._simplify=!0,y.toTex=function(b){return v.apply(null,b.args)};var v=r("_derivTex",{"Node, SymbolNode":function(N,M){return xr(N)&&Tr(N.value)==="string"?v(n(N.value).toString(),M.toString(),1):v(N.toTex(),M.toString(),1)},"Node, ConstantNode":function(N,M){if(Tr(M.value)==="string")return v(N,n(M.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(N,M,S){return v(N.toString(),M.name,S.value)},"string, string, number":function(N,M,S){var O;return S===1?O="{d\\\\over d"+M+"}":O="{d^{"+S+"}\\\\over d"+M+"^{"+S+"}}",O+"\\\\left[".concat(N,"\\\\right]")}}),x=r("constTag",{"Object, ConstantNode, string":function(N,M){return N[M]=!0,!0},"Object, SymbolNode, string":function(N,M,S){return M.name!==S?(N[M]=!0,!0):!1},"Object, ParenthesisNode, string":function(N,M,S){return x(N,M.content,S)},"Object, FunctionAssignmentNode, string":function(N,M,S){return M.params.indexOf(S)===-1?(N[M]=!0,!0):x(N,M.expr,S)},"Object, FunctionNode | OperatorNode, string":function(N,M,S){if(M.args.length>0){for(var O=x(N,M.args[0],S),_=1;_0){var O=N.args.filter(function(H){return M[H]===void 0}),_=O.length===1?O[0]:new s("*","multiply",O),E=S.concat(w(_,M));return new s("*","multiply",E)}return new s("+","add",N.args.map(function(H){return new s("*","multiply",N.args.map(function(L){return L===H?w(L,M):L.clone()}))}))}if(N.op==="/"&&N.isBinary()){var T=N.args[0],R=N.args[1];return M[R]!==void 0?new s("/","divide",[w(T,M),R]):M[T]!==void 0?new s("*","multiply",[new s("-","unaryMinus",[T]),new s("/","divide",[w(R,M),new s("^","pow",[R.clone(),C(2)])])]):new s("/","divide",[new s("-","subtract",[new s("*","multiply",[w(T,M),R.clone()]),new s("*","multiply",[T.clone(),w(R,M)])]),new s("^","pow",[R.clone(),C(2)])])}if(N.op==="^"&&N.isBinary()){var k=N.args[0],W=N.args[1];if(M[k]!==void 0)return xr(k)&&(u(k.value)||i(k.value,1))?C(0):new s("*","multiply",[N,new s("*","multiply",[new o("log",[k.clone()]),w(W.clone(),M)])]);if(M[W]!==void 0){if(xr(W)){if(u(W.value))return C(0);if(i(W.value,1))return w(k,M)}var G=new s("^","pow",[k.clone(),new s("-","subtract",[W,C(1)])]);return new s("*","multiply",[W.clone(),new s("*","multiply",[w(k,M),G])])}return new s("*","multiply",[new s("^","pow",[k.clone(),W.clone()]),new s("+","add",[new s("*","multiply",[w(k,M),new s("/","divide",[W.clone(),k.clone()])]),new s("*","multiply",[w(W,M),new o("log",[k.clone()])])])])}throw new Error('Cannot process operator "'+N.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function C(b,N){return new c(l(b,N||t.number))}return y});var cP="rationalize",AV=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],t0=F(cP,AV,e=>{var{config:r,typed:t,equal:n,isZero:a,add:i,subtract:u,multiply:l,divide:c,pow:o,parse:s,simplifyConstant:m,simplifyCore:d,simplify:h,fraction:y,bignumber:v,mathWithTransform:x,matrix:w,AccessorNode:C,ArrayNode:b,ConstantNode:N,FunctionNode:M,IndexNode:S,ObjectNode:O,OperatorNode:_,SymbolNode:E,ParenthesisNode:T}=e;function R(L){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,z=W(),oe=k(L,q,!0,z.firstRules),pe=oe.variables.length,ae={exactFractions:!1},$={exactFractions:!0};if(L=oe.expression,pe>=1){L=G(L);var le,Ee,me=!0,ge=!1;L=h(L,z.firstRules,{},ae);for(var Se;Ee=me?z.distrDivRules:z.sucDivRules,L=h(L,Ee,{},$),me=!me,Se=L.toString(),Se!==le;)ge=!0,le=Se;ge&&(L=h(L,z.firstRulesAgain,{},ae)),L=h(L,z.finalRules,{},ae)}var ye=[],be={};return L.type==="OperatorNode"&&L.isBinary()&&L.op==="/"?(pe===1&&(L.args[0]=H(L.args[0],ye),L.args[1]=H(L.args[1])),K&&(be.numerator=L.args[0],be.denominator=L.args[1])):(pe===1&&(L=H(L,ye)),K&&(be.numerator=L,be.denominator=null)),K?(be.coefficients=ye,be.variables=oe.variables,be.expression=L,be):L}return t(cP,{Node:R,"Node, boolean":(L,q)=>R(L,{},q),"Node, Object":R,"Node, Object, boolean":R});function k(L,q,K,z){var oe=[],pe=h(L,z,q,{exactFractions:!1});K=!!K;var ae="+-*"+(K?"/":"");le(pe);var $={};return $.expression=pe,$.variables=oe,$;function le(Ee){var me=Ee.type;if(me==="FunctionNode")throw new Error("There is an unsolved function call");if(me==="OperatorNode")if(Ee.op==="^"){if(Ee.args[1].type!=="ConstantNode"||!Ze(parseFloat(Ee.args[1].value)))throw new Error("There is a non-integer exponent");le(Ee.args[0])}else{if(ae.indexOf(Ee.op)===-1)throw new Error("Operator "+Ee.op+" invalid in polynomial expression");for(var ge=0;ge1;if(z==="OperatorNode"&&L.isBinary()){var pe=!1,ae;if(L.op==="^"&&(L.args[0].type==="ParenthesisNode"||L.args[0].type==="OperatorNode")&&L.args[1].type==="ConstantNode"&&(ae=parseFloat(L.args[1].value),pe=ae>=2&&Ze(ae)),pe){if(ae>2){var $=L.args[0],le=new _("^","pow",[L.args[0].cloneDeep(),new N(ae-1)]);L=new _("*","multiply",[$,le])}else L=new _("*","multiply",[L.args[0],L.args[0].cloneDeep()]);oe&&(K==="content"?q.content=L:q.args[K]=L)}}if(z==="ParenthesisNode")G(L.content,L,"content");else if(z!=="ConstantNode"&&z!=="SymbolNode")for(var Ee=0;Ee=0;$--)if(q[$]!==0){var le=new N(pe?q[$]:Math.abs(q[$])),Ee=q[$]<0?"-":"+";if($>0){var me=new E(oe);if($>1){var ge=new N($);me=new _("^","pow",[me,ge])}q[$]===-1&&pe?le=new _("-","unaryMinus",[me]):Math.abs(q[$])===1?le=me:le=new _("*","multiply",[le,me])}pe?ae=le:Ee==="+"?ae=new _("+","add",[ae,le]):ae=new _("-","subtract",[ae,le]),pe=!1}if(pe)return new N(0);return ae;function Se(ye,be,De){var Ae=ye.type;if(Ae==="FunctionNode")throw new Error("There is an unsolved function call");if(Ae==="OperatorNode"){if("+-*^".indexOf(ye.op)===-1)throw new Error("Operator "+ye.op+" invalid");if(be!==null){if((ye.fn==="unaryMinus"||ye.fn==="pow")&&be.fn!=="add"&&be.fn!=="subtract"&&be.fn!=="multiply")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="multiply")&&be.fn!=="add"&&be.fn!=="subtract")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="unaryMinus")&&De.noFil!==0)throw new Error("Invalid "+ye.op+" placing")}(ye.op==="^"||ye.op==="*")&&(De.fire=ye.op);for(var We=0;Wez&&(q[Je]=0),q[Je]+=De.cte*(De.oper==="+"?1:-1),z=Math.max(Je,z);return}De.cte=Je,De.fire===""&&(q[0]+=De.cte*(De.oper==="+"?1:-1))}else throw new Error("Type "+Ae+" is not allowed")}}});var lP="zpk2tf",MV=["typed","add","multiply","Complex","number"],n0=F(lP,MV,e=>{var{typed:r,add:t,multiply:n,Complex:a,number:i}=e;return r(lP,{"Array,Array,number":function(o,s,m){return u(o,s,m)},"Array,Array":function(o,s){return u(o,s,1)},"Matrix,Matrix,number":function(o,s,m){return u(o.valueOf(),s.valueOf(),m)},"Matrix,Matrix":function(o,s){return u(o.valueOf(),s.valueOf(),1)}});function u(c,o,s){c.some(C=>C.type==="BigNumber")&&(c=c.map(C=>i(C))),o.some(C=>C.type==="BigNumber")&&(o=o.map(C=>i(C)));for(var m=[a(1,0)],d=[a(1,0)],h=0;h=0&&m-d{var{typed:r,add:t,multiply:n,Complex:a,divide:i,matrix:u}=e;return r(mP,{"Array, Array":function(s,m){var d=c(512);return l(s,m,d)},"Array, Array, Array":function(s,m,d){return l(s,m,d)},"Array, Array, number":function(s,m,d){if(d<0)throw new Error("w must be a positive number");var h=c(d);return l(s,m,h)},"Matrix, Matrix":function(s,m){var d=c(512),{w:h,h:y}=l(s.valueOf(),m.valueOf(),d);return{w:u(h),h:u(y)}},"Matrix, Matrix, Matrix":function(s,m,d){var{h}=l(s.valueOf(),m.valueOf(),d.valueOf());return{h:u(h),w:u(d)}},"Matrix, Matrix, number":function(s,m,d){if(d<0)throw new Error("w must be a positive number");var h=c(d),{h:y}=l(s.valueOf(),m.valueOf(),h);return{h:u(y),w:u(h)}}});function l(o,s,m){for(var d=[],h=[],y=0;y{var{classes:r}=e;return function(n,a){var i=r[a&&a.mathjs];return i&&typeof i.fromJSON=="function"?i.fromJSON(a):a}});var FV="replacer",_V=[],o0=F(FV,_V,()=>function(r,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var pP="12.4.1";var s0=F("true",[],()=>!0),u0=F("false",[],()=>!1),f0=F("null",[],()=>null),c0=ya("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1/0):1/0}),l0=ya("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(NaN):NaN}),m0=ya("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?Pc(t):VM}),p0=ya("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?hE(t):ZM}),d0=ya("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?pE(t):QM}),h0=ya("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?dE(t):XM}),v0=ya("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).ln():Math.LN2}),g0=ya("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(10).ln():Math.LN10}),y0=ya("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),x0=ya("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),b0=ya("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),w0=ya("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),D0=ya("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),dP=F("PI",["pi"],e=>{var{pi:r}=e;return r}),hP=F("E",["e"],e=>{var{e:r}=e;return r}),S0=F("version",[],()=>pP);function ya(e,r,t){return F(e,r,t,{recreateOnConfigChange:!0})}var N0=Er("speedOfLight","299792458","m s^-1"),A0=Er("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),M0=Er("planckConstant","6.62607015e-34","J s"),C0=Er("reducedPlanckConstant","1.0545718176461565e-34","J s"),E0=Er("magneticConstant","1.25663706212e-6","N A^-2"),T0=Er("electricConstant","8.8541878128e-12","F m^-1"),F0=Er("vacuumImpedance","376.730313667","ohm"),_0=Er("coulomb","8.987551792261171e9","N m^2 C^-2"),O0=Er("elementaryCharge","1.602176634e-19","C"),B0=Er("bohrMagneton","9.2740100783e-24","J T^-1"),P0=Er("conductanceQuantum","7.748091729863649e-5","S"),I0=Er("inverseConductanceQuantum","12906.403729652257","ohm"),R0=Er("magneticFluxQuantum","2.0678338484619295e-15","Wb"),q0=Er("nuclearMagneton","5.0507837461e-27","J T^-1"),k0=Er("klitzing","25812.807459304513","ohm");var L0=Er("bohrRadius","5.29177210903e-11","m"),z0=Er("classicalElectronRadius","2.8179403262e-15","m"),U0=Er("electronMass","9.1093837015e-31","kg"),W0=Er("fermiCoupling","1.1663787e-5","GeV^-2"),Y0=by("fineStructure",.0072973525693),H0=Er("hartreeEnergy","4.3597447222071e-18","J"),$0=Er("protonMass","1.67262192369e-27","kg"),G0=Er("deuteronMass","3.3435830926e-27","kg"),V0=Er("neutronMass","1.6749271613e-27","kg"),Z0=Er("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Q0=Er("rydberg","10973731.568160","m^-1"),X0=Er("thomsonCrossSection","6.6524587321e-29","m^2"),J0=by("weakMixingAngle",.2229),K0=by("efimovFactor",22.7),j0=Er("atomicMass","1.66053906660e-27","kg"),ey=Er("avogadro","6.02214076e23","mol^-1"),ry=Er("boltzmann","1.380649e-23","J K^-1"),ty=Er("faraday","96485.33212331001","C mol^-1"),ny=Er("firstRadiation","3.7417718521927573e-16","W m^2"),ay=Er("loschmidt","2.686780111798444e25","m^-3"),iy=Er("gasConstant","8.31446261815324","J K^-1 mol^-1"),oy=Er("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),sy=Er("molarVolume","0.022413969545014137","m^3 mol^-1"),uy=by("sackurTetrode",-1.16487052358),fy=Er("secondRadiation","0.014387768775039337","m K"),cy=Er("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),ly=Er("wienDisplacement","2.897771955e-3","m K"),my=Er("molarMass","0.99999999965e-3","kg mol^-1"),py=Er("molarMassC12","11.9999999958e-3","kg mol^-1"),dy=Er("gravity","9.80665","m s^-2"),hy=Er("planckLength","1.616255e-35","m"),vy=Er("planckMass","2.176435e-8","kg"),gy=Er("planckTime","5.391245e-44","s"),yy=Er("planckCharge","1.87554603778e-18","C"),xy=Er("planckTemperature","1.416785e+32","K");function Er(e,r,t){var n=["config","Unit","BigNumber"];return F(e,n,a=>{var{config:i,Unit:u,BigNumber:l}=a,c=i.number==="BigNumber"?new l(r):parseFloat(r),o=new u(c,t);return o.fixPrefix=!0,o})}function by(e,r){var t=["config","BigNumber"];return F(e,t,n=>{var{config:a,BigNumber:i}=n;return a.number==="BigNumber"?new i(r):r})}var OV="apply",BV=["typed","isInteger"],wy=F(OV,BV,e=>{var{typed:r,isInteger:t}=e,n=Lo({typed:r,isInteger:t});return r("apply",{"...any":function(i){var u=i[1];sr(u)?i[1]=u-1:rr(u)&&(i[1]=u.minus(1));try{return n.apply(null,i)}catch(l){throw mt(l)}}})},{isTransformFunction:!0});var PV="column",IV=["typed","Index","matrix","range"],Dy=F(PV,IV,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Wu({typed:r,Index:t,matrix:n,range:a});return r("column",{"...any":function(l){var c=l.length-1,o=l[c];sr(o)&&(l[c]=o-1);try{return i.apply(null,l)}catch(s){throw mt(s)}}})},{isTransformFunction:!0});function lf(e,r,t){var n=e.filter(function(c){return at(c)&&!(c.name in r)&&!t.has(c.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var a=n.name,i=new Map,u=new Eu(t,i,new Set([a])),l=e.compile();return function(o){return i.set(a,o),l.evaluate(u)}}var RV="filter",qV=["typed"],Sy=F(RV,qV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||Oa(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("filter",{"Array, function":vP,"Matrix, function":function(i,u){return i.create(vP(i.toArray(),u))},"Array, RegExp":Mu,"Matrix, RegExp":function(i,u){return i.create(Mu(i.toArray(),u))}});return t},{isTransformFunction:!0});function vP(e,r){return Om(e,function(t,n,a){return Ra(r,t,[n+1],a,"filter")})}var kV="forEach",LV=["typed"],Ny=F(kV,LV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||Oa(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("forEach",{"Array | Matrix, function":function(i,u){var l=function c(o,s){if(Array.isArray(o))_o(o,function(m,d){c(m,s.concat(d+1))});else return Ra(u,o,s,i,"forEach")};l(i.valueOf(),[])}});return t},{isTransformFunction:!0});var zV="index",UV=["Index","getMatrixDataType"],Ay=F(zV,UV,e=>{var{Index:r,getMatrixDataType:t}=e;return function(){for(var a=[],i=0,u=arguments.length;i0?0:2;else if(l&&l.isSet===!0)l=l.map(function(o){return o-1});else if(Mr(l)||Qe(l))t(l)!=="boolean"&&(l=l.map(function(o){return o-1}));else if(sr(l))l--;else if(rr(l))l=l.toNumber()-1;else if(typeof l!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");a[i]=l}var c=new r;return r.apply(c,a),c}},{isTransformFunction:!0});var WV="map",YV=["typed"],My=F(WV,YV,e=>{var{typed:r}=e;function t(a,i,u){var l,c;return a[0]&&(l=a[0].compile().evaluate(u)),a[1]&&(at(a[1])||Oa(a[1])?c=a[1].compile().evaluate(u):c=lf(a[1],i,u)),n(l,c)}t.rawArgs=!0;var n=r("map",{"Array, function":function(i,u){return gP(i,u,i)},"Matrix, function":function(i,u){return i.create(gP(i.valueOf(),u,i))}});return t},{isTransformFunction:!0});function gP(e,r,t){function n(a,i){return Array.isArray(a)?Kn(a,function(u,l){return n(u,i.concat(l+1))}):Ra(r,a,i,t,"map")}return n(e,[])}function Cn(e){if(e.length===2&&Nt(e[0])){e=e.slice();var r=e[1];sr(r)?e[1]=r-1:rr(r)&&(e[1]=r.minus(1))}return e}var HV="max",$V=["typed","config","numeric","larger"],Cy=F(HV,$V,e=>{var{typed:r,config:t,numeric:n,larger:a}=e,i=ef({typed:r,config:t,numeric:n,larger:a});return r("max",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var GV="mean",VV=["typed","add","divide"],Ey=F(GV,VV,e=>{var{typed:r,add:t,divide:n}=e,a=of({typed:r,add:t,divide:n});return r("mean",{"...any":function(u){u=Cn(u);try{return a.apply(null,u)}catch(l){throw mt(l)}}})},{isTransformFunction:!0});var ZV="min",QV=["typed","config","numeric","smaller"],Ty=F(ZV,QV,e=>{var{typed:r,config:t,numeric:n,smaller:a}=e,i=rf({typed:r,config:t,numeric:n,smaller:a});return r("min",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var XV="range",JV=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Fy=F(XV,JV,e=>{var{typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:u,larger:l,largerEq:c,add:o,isPositive:s}=e,m=$u({typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:u,larger:l,largerEq:c,add:o,isPositive:s});return r("range",{"...any":function(h){var y=h.length-1,v=h[y];return typeof v!="boolean"&&h.push(!0),m.apply(null,h)}})},{isTransformFunction:!0});var KV="row",jV=["typed","Index","matrix","range"],_y=F(KV,jV,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Gu({typed:r,Index:t,matrix:n,range:a});return r("row",{"...any":function(l){var c=l.length-1,o=l[c];sr(o)&&(l[c]=o-1);try{return i.apply(null,l)}catch(s){throw mt(s)}}})},{isTransformFunction:!0});var eZ="subset",rZ=["typed","matrix","zeros","add"],Oy=F(eZ,rZ,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Vu({typed:r,matrix:t,zeros:n,add:a});return r("subset",{"...any":function(l){try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var tZ="concat",nZ=["typed","matrix","isInteger"],By=F(tZ,nZ,e=>{var{typed:r,matrix:t,isInteger:n}=e,a=Uu({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(u){var l=u.length-1,c=u[l];sr(c)?u[l]=c-1:rr(c)&&(u[l]=c.minus(1));try{return a.apply(null,u)}catch(o){throw mt(o)}}})},{isTransformFunction:!0});var yP="diff",aZ=["typed","matrix","subtract","number","bignumber"],Py=F(yP,aZ,e=>{var{typed:r,matrix:t,subtract:n,number:a,bignumber:i}=e,u=Yu({typed:r,matrix:t,subtract:n,number:a,bignumber:i});return r(yP,{"...any":function(c){c=Cn(c);try{return u.apply(null,c)}catch(o){throw mt(o)}}})},{isTransformFunction:!0});var iZ="std",oZ=["typed","map","sqrt","variance"],Iy=F(iZ,oZ,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e,i=ff({typed:r,map:t,sqrt:n,variance:a});return r("std",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var xP="sum",sZ=["typed","config","add","numeric"],Ry=F(xP,sZ,e=>{var{typed:r,config:t,add:n,numeric:a}=e,i=nf({typed:r,config:t,add:n,numeric:a});return r(xP,{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var uZ="quantileSeq",fZ=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],qy=F(uZ,fZ,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d}=e,h=uf({typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:u,partitionSelect:l,compare:c,isInteger:o,smaller:s,smallerEq:m,larger:d});return r("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(v,x,w)=>h(v,x,y(w)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(v,x,w,C)=>h(v,x,w,y(C)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(v,x,w)=>h(v,x,y(w)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(v,x,w,C)=>h(v,x,w,y(C))});function y(v){return Cn([[],v])[1]}},{isTransformFunction:!0});var bP="cumsum",cZ=["typed","add","unaryPlus"],ky=F(bP,cZ,e=>{var{typed:r,add:t,unaryPlus:n}=e,a=af({typed:r,add:t,unaryPlus:n});return r(bP,{"...any":function(u){if(u.length===2&&Nt(u[0])){var l=u[1];sr(l)?u[1]=l-1:rr(l)&&(u[1]=l.minus(1))}try{return a.apply(null,u)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var wP="variance",lZ=["typed","add","subtract","multiply","divide","apply","isNaN"],Ly=F(wP,lZ,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l}=e,c=sf({typed:r,add:t,subtract:n,multiply:a,divide:i,apply:u,isNaN:l});return r(wP,{"...any":function(s){s=Cn(s);try{return c.apply(null,s)}catch(m){throw mt(m)}}})},{isTransformFunction:!0});var DP="print",mZ=["typed","matrix","zeros","add"],zy=F(DP,mZ,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Qu({typed:r,matrix:t,zeros:n,add:a});return r(DP,{"string, Object | Array":function(c,o){return i(u(c),o)},"string, Object | Array, number | Object":function(c,o,s){return i(u(c),o,s)}});function u(l){return l.replace(kd,c=>{var o=c.slice(1).split("."),s=o.map(function(m){return!isNaN(m)&&m.length>0?parseInt(m)-1:m});return"$"+s.join(".")})}},{isTransformFunction:!0});var pZ="and",dZ=["typed","matrix","zeros","add","equalScalar","not","concat"],Uy=F(pZ,dZ,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u}=e,l=ju({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u});function c(o,s,m){var d=o[0].compile().evaluate(m);if(!Nt(d)&&!l(d,!0))return!1;var h=o[1].compile().evaluate(m);return l(d,h)}return c.rawArgs=!0,c},{isTransformFunction:!0});var hZ="or",vZ=["typed","matrix","equalScalar","DenseMatrix","concat"],Wy=F(hZ,vZ,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=zu({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function l(c,o,s){var m=c[0].compile().evaluate(s);if(!Nt(m)&&u(m,!1))return!0;var d=c[1].compile().evaluate(s);return u(m,d)}return l.rawArgs=!0,l},{isTransformFunction:!0});var gZ="bitAnd",yZ=["typed","matrix","zeros","add","equalScalar","not","concat"],Yy=F(gZ,yZ,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u}=e,l=ku({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:u});function c(o,s,m){var d=o[0].compile().evaluate(m);if(!Nt(d)){if(isNaN(d))return NaN;if(d===0||d===!1)return 0}var h=o[1].compile().evaluate(m);return l(d,h)}return c.rawArgs=!0,c},{isTransformFunction:!0});var xZ="bitOr",bZ=["typed","matrix","equalScalar","DenseMatrix","concat"],Hy=F(xZ,bZ,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,u=Lu({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function l(c,o,s){var m=c[0].compile().evaluate(s);if(!Nt(m)){if(isNaN(m))return NaN;if(m===-1)return-1;if(m===!0)return 1}var d=c[1].compile().evaluate(s);return u(m,d)}return l.rawArgs=!0,l},{isTransformFunction:!0});var Ge=Hm({config:Oe}),pt=$m({}),RD=d0({BigNumber:Ge,config:Oe}),SP=u0({}),NP=Y0({BigNumber:Ge,config:Oe}),Wo=Gm({}),qD=D0({Complex:pt}),AP=c0({BigNumber:Ge,config:Oe}),MP=g0({BigNumber:Ge,config:Oe}),CP=x0({BigNumber:Ge,config:Oe}),kc=Zm({}),EP=l0({BigNumber:Ge,config:Oe}),TP=f0({}),FP=h0({BigNumber:Ge,config:Oe}),_P=Vm({}),kD=Rm({}),OP=b0({BigNumber:Ge,config:Oe}),BP=uy({BigNumber:Ge,config:Oe}),LD=p0({BigNumber:Ge,config:Oe}),PP=s0({}),IP=S0({}),Fr=Xm({Matrix:kc}),RP=K0({BigNumber:Ge,config:Oe}),qP=v0({BigNumber:Ge,config:Oe}),$y=m0({BigNumber:Ge,config:Oe}),kP=o0({}),LP=w0({BigNumber:Ge,config:Oe}),te=Im({BigNumber:Ge,Complex:pt,DenseMatrix:Fr,Fraction:Wo}),Gy=Np({BigNumber:Ge,config:Oe,typed:te}),zP=J0({BigNumber:Ge,config:Oe}),En=Ap({typed:te}),UP=Oh({Complex:pt,config:Oe,typed:te}),WP=Ph({BigNumber:Ge,typed:te}),YP=Rh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),Qt=Cp({typed:te}),HP=jp({typed:te}),$P=Lh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),GP=Uh({typed:te}),zD=Wh({typed:te}),VP=Hh({Complex:pt,config:Oe,typed:te}),ta=hp({BigNumber:Ge,typed:te}),ZP=Jp({typed:te}),QP=dp({typed:te}),XP=Jm({typed:te}),Lc=Bg({typed:te}),zc=vp({Complex:pt,typed:te}),Yo=ed({typed:te}),Vy=$h({typed:te}),JP=Vh({BigNumber:Ge,typed:te}),KP=Qh({BigNumber:Ge,typed:te}),jP=_p({typed:te}),Ir=cp({config:Oe,typed:te}),eI=Fd({typed:te}),UD=Op({typed:te}),rI=Bp({Complex:pt,typed:te}),tI=ud({typed:te}),nI=cd({typed:te}),mf=Pd({typed:te}),Zy=ld({typed:te}),aI=qd({format:mf,typed:te}),Qy=rd({typed:te}),zn=ep({typed:te}),ao=tp({typed:te}),Ho=ip({typed:te}),La=op({typed:te}),iI=y0({BigNumber:Ge,config:Oe}),oI=Rg({Complex:pt,typed:te}),sI=qp({Complex:pt,config:Oe,typed:te}),WD=kp({Complex:pt,config:Oe,typed:te}),$o=dd({typed:te}),Ot=Lp({typed:te}),Uc=nd({typed:te}),Bi=mp({typed:te}),uI=Rd({format:mf,typed:te}),fI=Wg({config:Oe,typed:te}),cI=Qu({typed:te}),lI=Yg({config:Oe,typed:te}),Xy=td({typed:te}),mI=Jh({BigNumber:Ge,typed:te}),YD=Wp({BigNumber:Ge,Fraction:Wo,complex:zc,typed:te}),Wc=jh({typed:te}),Pi=lp({Matrix:kc,equalScalar:Ir,typed:te}),pI=Dp({typed:te}),dI=Hp({typed:te}),hI=pp({typed:te}),xa=Ep({typed:te}),vI=rv({typed:te}),HD=up({typed:te}),gI=Bh({Complex:pt,config:Oe,typed:te}),yI=qh({BigNumber:Ge,typed:te}),Jy=Lo({isInteger:zn,typed:te}),xI=kh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),bI=Id({format:mf,typed:te}),wI=Pg({typed:te}),DI=Gh({typed:te}),SI=Xh({BigNumber:Ge,typed:te}),pf=sp({typed:te}),NI=zd({typed:te}),AI=Hg({config:Oe,typed:te}),MI=Kh({BigNumber:Ge,typed:te}),CI=ev({typed:te}),EI=Fh({SparseMatrix:Pi,typed:te}),za=Yp({Complex:pt,config:Oe,typed:te}),TI=tv({typed:te}),fi=Sp({typed:te}),FI=Ih({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),_I=Zh({BigNumber:Ge,typed:te}),Ps=gp({Fraction:Wo,typed:te}),Go=np({typed:te}),$e=yp({DenseMatrix:Fr,Matrix:kc,SparseMatrix:Pi,typed:te}),OI=xp({isZero:La,matrix:$e,typed:te}),BI=Od({isNaN:pf,isNumeric:Go,typed:te}),Ua=Ud({bignumber:ta,fraction:Ps,number:Bi}),$D=Bd({config:Oe,multiplyScalar:Ot,numeric:Ua,typed:te}),GD=yd({isInteger:zn,matrix:$e,typed:te}),cn=Dd({matrix:$e,config:Oe,typed:te}),PI=Sd({matrix:$e,typed:te}),df=Nd({matrix:$e,typed:te}),VD=Gp({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),ln=Md({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),II=zh({Complex:pt,config:Oe,typed:te}),ZD=Tp({BigNumber:Ge,Complex:pt,Fraction:Wo,config:Oe,isNegative:ao,matrix:$e,typed:te,unaryMinus:fi}),Gr=Uu({isInteger:zn,matrix:$e,typed:te}),RI=id({prod:$D,size:cn,typed:te}),Ky=Ad({conj:Yo,transpose:df,typed:te}),QD=sd({DenseMatrix:Fr,SparseMatrix:Pi,matrix:$e,typed:te}),Mt=Wd({numeric:Ua,typed:te}),hf=Qd({DenseMatrix:Fr,concat:Gr,divideScalar:Mt,equalScalar:Ir,matrix:$e,typed:te}),ba=uh({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),vf=fd({matrix:$e,typed:te}),qI=ap({isNumeric:Go,typed:te}),io=md({BigNumber:Ge,DenseMatrix:Fr,SparseMatrix:Pi,config:Oe,matrix:$e,typed:te}),kI=pd({matrix:$e,multiplyScalar:Ot,typed:te}),Yc=gh({DenseMatrix:Fr,concat:Gr,config:Oe,matrix:$e,typed:te}),LI=eh({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),XD=Xd({DenseMatrix:Fr,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te}),jy=wp({flatten:vf,matrix:$e,size:cn,typed:te}),zI=Up({BigNumber:Ge,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),UI=hd({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),ex=sg({addScalar:Qt,complex:zc,conj:Yo,divideScalar:Mt,equal:ba,identity:io,isZero:La,matrix:$e,multiplyScalar:Ot,sign:YD,sqrt:za,subtractScalar:xa,typed:te,unaryMinus:fi,zeros:ln}),WI=xd({config:Oe,matrix:$e}),YI=rh({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),Is=Hd({BigNumber:Ge,DenseMatrix:Fr,config:Oe,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),Tn=lh({DenseMatrix:Fr,concat:Gr,config:Oe,matrix:$e,typed:te}),Bt=$p({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,subtractScalar:xa,typed:te,unaryMinus:fi}),HI=Ld({concat:Gr,matrix:$e,typed:te}),$I=bh({DenseMatrix:Fr,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,typed:te}),rx=Jd({DenseMatrix:Fr,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te}),GI=ad({DenseMatrix:Fr,concat:Gr,matrix:$e,typed:te}),Lr=pv({DenseMatrix:Fr,SparseMatrix:Pi,addScalar:Qt,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),VI=Yh({BigNumber:Ge,DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),ZI=ku({concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),QI=Lu({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),XI=Kp({DenseMatrix:Fr,concat:Gr,matrix:$e,typed:te}),JI=Vg({addScalar:Qt,combinations:Lc,divideScalar:Mt,isInteger:zn,isNegative:ao,multiplyScalar:Ot,typed:te}),Vo=ah({BigNumber:Ge,DenseMatrix:Fr,Fraction:Wo,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,typed:te}),JD=oh({concat:Gr,matrix:$e,typed:te}),KI=af({add:Lr,typed:te,unaryPlus:Gy}),tx=yh({equal:ba,typed:te}),jI=Yu({matrix:$e,number:Bi,subtract:Bt,typed:te}),e4=Cg({abs:En,addScalar:Qt,deepEqual:tx,divideScalar:Mt,multiplyScalar:Ot,sqrt:za,subtractScalar:xa,typed:te}),Hc=vv({addScalar:Qt,conj:Yo,multiplyScalar:Ot,size:cn,typed:te}),r4=fh({compareText:JD,isZero:La,typed:te}),KD=Pu({DenseMatrix:Fr,config:Oe,equalScalar:Ir,matrix:$e,round:Is,typed:te,zeros:ln}),t4=Ip({BigNumber:Ge,DenseMatrix:Fr,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,round:Is,typed:te,zeros:ln}),n4=dv({abs:En,addScalar:Qt,divideScalar:Mt,isPositive:Ho,multiplyScalar:Ot,smaller:Tn,sqrt:za,typed:te}),jD=Sh({DenseMatrix:Fr,smaller:Tn}),bn=Nh({ImmutableDenseMatrix:jD,getMatrixDataType:Zy}),Fn=hh({DenseMatrix:Fr,concat:Gr,config:Oe,matrix:$e,typed:te}),nx=$d({Complex:pt,config:Oe,divideScalar:Mt,typed:te}),a4=Kd({DenseMatrix:Fr,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te}),i4=bp({flatten:vf,matrix:$e,size:cn,typed:te}),o4=rf({config:Oe,numeric:Ua,smaller:Tn,typed:te}),eS=Iu({DenseMatrix:Fr,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,round:Is,typed:te,zeros:ln}),it=zp({addScalar:Qt,dot:Hc,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,typed:te}),s4=Vd({Complex:pt,config:Oe,divideScalar:Mt,typed:te}),u4=zu({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),$c=wh({compare:Vo,isNaN:pf,isNumeric:Go,typed:te}),f4=th({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),rS=cg({SparseMatrix:Pi,abs:En,add:Lr,divideScalar:Mt,larger:Fn,largerEq:Yc,multiply:it,subtract:Bt,transpose:df,typed:te}),na=Vu({add:Lr,matrix:$e,typed:te,zeros:ln}),ax=nf({add:Lr,config:Oe,numeric:Ua,typed:te}),c4=gv({add:Lr,matrix:$e,typed:te}),tS=jd({DenseMatrix:Fr,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te}),l4=n0({Complex:pt,add:Lr,multiply:it,number:Bi,typed:te}),ix=Fp({DenseMatrix:Fr,config:Oe,equalScalar:Ir,matrix:$e,round:Is,typed:te,zeros:ln}),ci=ih({compare:Vo,typed:te}),m4=Zg({addScalar:Qt,combinations:Lc,isInteger:zn,isNegative:ao,isPositive:Ho,larger:Fn,typed:te}),p4=od({matrix:$e,multiply:it,subtract:Bt,typed:te}),nS=gg({divideScalar:Mt,isZero:La,matrix:$e,multiply:it,subtractScalar:xa,typed:te,unaryMinus:fi}),d4=Qp({concat:Gr,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,typed:te}),aS=Ah({larger:Fn,smaller:Tn}),iS=Pp({Complex:pt,DenseMatrix:Fr,ceil:ix,equalScalar:Ir,floor:KD,matrix:$e,typed:te,zeros:ln}),oS=yv({Index:bn,typed:te}),h4=Eg({abs:En,add:Lr,addScalar:Qt,config:Oe,divideScalar:Mt,equalScalar:Ir,flatten:vf,isNumeric:Go,isZero:La,matrix:$e,multiply:it,multiplyScalar:Ot,smaller:Tn,subtract:Bt,typed:te}),v4=Vp({BigNumber:Ge,add:Lr,config:Oe,equal:ba,isInteger:zn,mod:eS,smaller:Tn,typed:te,xgcd:VD}),g4=Rp({concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),y4=Gd({Complex:pt,config:Oe,divideScalar:Mt,log:nx,typed:te}),ox=ef({config:Oe,larger:Fn,numeric:Ua,typed:te}),x4=nv({DenseMatrix:Fr,Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),b4=iv({DenseMatrix:Fr,Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),w4=sv({Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),D4=fv({Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),Rs=ph({DenseMatrix:Fr,concat:Gr,config:Oe,matrix:$e,typed:te}),S4=Dh({compare:Vo,compareNatural:ci,matrix:$e,typed:te}),N4=ju({concat:Gr,equalScalar:Ir,matrix:$e,not:Uc,typed:te,zeros:ln}),qs=$u({bignumber:ta,matrix:$e,add:Lr,config:Oe,isPositive:Ho,larger:Fn,largerEq:Yc,smaller:Tn,smallerEq:Rs,typed:te}),A4=Gu({Index:bn,matrix:$e,range:qs,typed:te}),sS=av({DenseMatrix:Fr,Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),M4=uv({Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),uS=lv({Index:bn,concat:Gr,setDifference:sS,size:cn,subset:na,typed:te}),fS=Mh({FibonacciHeap:aS,addScalar:Qt,equalScalar:Ir}),cS=Wu({Index:bn,matrix:$e,range:qs,typed:te}),Zo=yg({abs:En,addScalar:Qt,det:nS,divideScalar:Mt,identity:io,matrix:$e,multiply:it,typed:te,unaryMinus:fi}),lS=og({DenseMatrix:Fr,Spa:fS,SparseMatrix:Pi,abs:En,addScalar:Qt,divideScalar:Mt,equalScalar:Ir,larger:Fn,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te,unaryMinus:fi}),C4=xg({Complex:pt,add:Lr,ctranspose:Ky,deepEqual:tx,divideScalar:Mt,dot:Hc,dotDivide:hf,equal:ba,inv:Zo,matrix:$e,multiply:it,typed:te}),wa=Yd({Complex:pt,config:Oe,fraction:Ps,identity:io,inv:Zo,matrix:$e,multiply:it,number:Bi,typed:te}),mS=ov({DenseMatrix:Fr,Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),E4=mv({Index:bn,concat:Gr,setIntersect:mS,setSymDifference:uS,size:cn,subset:na,typed:te}),T4=Dg({abs:En,add:Lr,identity:io,inv:Zo,map:$o,max:ox,multiply:it,size:cn,sqrt:za,subtract:Bt,typed:te}),wr=Eh({BigNumber:Ge,Complex:pt,Fraction:Wo,abs:En,addScalar:Qt,config:Oe,divideScalar:Mt,equal:ba,fix:iS,format:mf,isNumeric:Go,multiplyScalar:Ot,number:Bi,pow:wa,round:Is,subtractScalar:xa}),F4=F0({BigNumber:Ge,Unit:wr,config:Oe}),_4=ly({BigNumber:Ge,Unit:wr,config:Oe}),O4=j0({BigNumber:Ge,Unit:wr,config:Oe}),B4=B0({BigNumber:Ge,Unit:wr,config:Oe}),P4=ry({BigNumber:Ge,Unit:wr,config:Oe}),I4=P0({BigNumber:Ge,Unit:wr,config:Oe}),R4=_0({BigNumber:Ge,Unit:wr,config:Oe}),q4=G0({BigNumber:Ge,Unit:wr,config:Oe}),k4=Zd({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,pow:wa,typed:te}),L4=T0({BigNumber:Ge,Unit:wr,config:Oe}),z4=O0({BigNumber:Ge,Unit:wr,config:Oe}),U4=wg({abs:En,add:Lr,identity:io,inv:Zo,multiply:it,typed:te}),W4=ty({BigNumber:Ge,Unit:wr,config:Oe}),pS=Cd({addScalar:Qt,ceil:ix,conj:Yo,divideScalar:Mt,dotDivide:hf,exp:UD,i:qD,log2:WD,matrix:$e,multiplyScalar:Ot,pow:wa,tau:LD,typed:te}),sx=Ig({BigNumber:Ge,Complex:pt,config:Oe,multiplyScalar:Ot,pow:wa,typed:te}),Y4=A0({BigNumber:Ge,Unit:wr,config:Oe}),H4=H0({BigNumber:Ge,Unit:wr,config:Oe}),$4=Ed({conj:Yo,dotDivide:hf,fft:pS,typed:te}),G4=k0({BigNumber:Ge,Unit:wr,config:Oe}),V4=ay({BigNumber:Ge,Unit:wr,config:Oe}),Z4=E0({BigNumber:Ge,Unit:wr,config:Oe}),Q4=my({BigNumber:Ge,Unit:wr,config:Oe}),X4=oy({BigNumber:Ge,Unit:wr,config:Oe}),J4=V0({BigNumber:Ge,Unit:wr,config:Oe}),K4=q0({BigNumber:Ge,Unit:wr,config:Oe}),j4=yy({BigNumber:Ge,Unit:wr,config:Oe}),eR=hy({BigNumber:Ge,Unit:wr,config:Oe}),rR=xy({BigNumber:Ge,Unit:wr,config:Oe}),tR=$0({BigNumber:Ge,Unit:wr,config:Oe}),nR=Z0({BigNumber:Ge,Unit:wr,config:Oe}),aR=C0({BigNumber:Ge,Unit:wr,config:Oe}),iR=Q0({BigNumber:Ge,Unit:wr,config:Oe}),oR=fy({BigNumber:Ge,Unit:wr,config:Oe}),sR=N0({BigNumber:Ge,Unit:wr,config:Oe}),uR=cy({BigNumber:Ge,Unit:wr,config:Oe}),fR=X0({BigNumber:Ge,Unit:wr,config:Oe}),cR=ey({BigNumber:Ge,Unit:wr,config:Oe}),lR=L0({BigNumber:Ge,Unit:wr,config:Oe}),mR=_h({Unit:wr,typed:te}),an=Mg({divideScalar:Mt,equalScalar:Ir,inv:Zo,matrix:$e,multiply:it,typed:te}),pR=U0({BigNumber:Ge,Unit:wr,config:Oe}),gf=qg({gamma:sx,typed:te}),dR=ny({BigNumber:Ge,Unit:wr,config:Oe}),hR=dy({BigNumber:Ge,Unit:wr,config:Oe}),vR=I0({BigNumber:Ge,Unit:wr,config:Oe}),dS=lg({DenseMatrix:Fr,lsolve:XD,lup:lS,matrix:$e,slu:rS,typed:te,usolve:rx}),gR=R0({BigNumber:Ge,Unit:wr,config:Oe}),yR=py({BigNumber:Ge,Unit:wr,config:Oe}),xR=Lg({add:Lr,divide:an,factorial:gf,isInteger:zn,isPositive:Ho,multiply:it,typed:te}),bR=zg({factorial:gf,typed:te}),wR=vy({BigNumber:Ge,Unit:wr,config:Oe}),DR=mg({add:Lr,cbrt:ZD,divide:an,equalScalar:Ir,im:Qy,isZero:La,multiply:it,re:Xy,sqrt:za,subtract:Bt,typeOf:HD,typed:te,unaryMinus:fi}),SR=cv({compareNatural:ci,typed:te}),NR=Td({abs:En,add:Lr,bignumber:ta,divide:an,isNegative:ao,isPositive:Ho,larger:Fn,map:$o,matrix:$e,max:ox,multiply:it,smaller:Tn,subtract:Bt,typed:te,unaryMinus:fi}),hS=$g({bignumber:ta,addScalar:Qt,combinations:Lc,divideScalar:Mt,factorial:gf,isInteger:zn,isNegative:ao,larger:Fn,multiplyScalar:Ot,number:Bi,pow:wa,subtractScalar:xa,typed:te}),AR=Th({Unit:wr,typed:te}),MR=Gg({addScalar:Qt,isInteger:zn,isNegative:ao,stirlingS2:hS,typed:te}),vS=bg({abs:En,add:Lr,addScalar:Qt,atan:zD,bignumber:ta,column:cS,complex:zc,config:Oe,cos:Vy,diag:QD,divideScalar:Mt,dot:Hc,equal:ba,flatten:vf,im:Qy,inv:Zo,larger:Fn,matrix:$e,matrixFromColumns:jy,multiply:it,multiplyScalar:Ot,number:Bi,qr:ex,re:Xy,reshape:GD,sin:Wc,size:cn,smaller:Tn,sqrt:za,subtract:Bt,typed:te,usolve:rx,usolveAll:tS}),CR=W0({BigNumber:Ge,Unit:wr,config:Oe}),ER=iy({BigNumber:Ge,Unit:wr,config:Oe}),TR=kg({divide:an,dotDivide:hf,isNumeric:Go,log:nx,map:$o,matrix:$e,multiply:it,sum:ax,typed:te}),gS=of({add:Lr,divide:an,typed:te}),FR=sy({BigNumber:Ge,Unit:wr,config:Oe}),_R=M0({BigNumber:Ge,Unit:wr,config:Oe}),OR=uf({bignumber:ta,add:Lr,compare:Vo,divide:an,isInteger:zn,larger:Fn,multiply:it,partitionSelect:$c,smaller:Tn,smallerEq:Rs,subtract:Bt,typed:te}),ux=sf({add:Lr,apply:Jy,divide:an,isNaN:pf,multiply:it,subtract:Bt,typed:te}),BR=z0({BigNumber:Ge,Unit:wr,config:Oe}),yS=Fg({add:Lr,compare:Vo,divide:an,partitionSelect:$c,typed:te}),PR=Og({add:Lr,divide:an,matrix:$e,mean:gS,multiply:it,pow:wa,sqrt:za,subtract:Bt,sum:ax,typed:te}),IR=a0({Complex:pt,add:Lr,divide:an,matrix:$e,multiply:it,typed:te}),RR=_g({abs:En,map:$o,median:yS,subtract:Bt,typed:te}),qR=ff({map:$o,sqrt:za,typed:te,variance:ux}),kR=_d({BigNumber:Ge,Complex:pt,add:Lr,config:Oe,divide:an,equal:ba,factorial:gf,gamma:sx,isNegative:ao,multiply:it,pi:$y,pow:wa,sin:Wc,smallerEq:Rs,subtract:Bt,typed:te}),fx=hv({abs:En,add:Lr,conj:Yo,ctranspose:Ky,eigs:vS,equalScalar:Ir,larger:Fn,matrix:$e,multiply:it,pow:wa,smaller:Tn,sqrt:za,typed:te}),xS=wd({BigNumber:Ge,DenseMatrix:Fr,SparseMatrix:Pi,addScalar:Qt,config:Oe,cos:Vy,matrix:$e,multiplyScalar:Ot,norm:fx,sin:Wc,typed:te,unaryMinus:fi}),LR=gy({BigNumber:Ge,Unit:wr,config:Oe}),bS=Ng({identity:io,matrix:$e,multiply:it,norm:fx,qr:ex,subtract:Bt,typed:te}),zR=bd({multiply:it,rotationMatrix:xS,typed:te}),wS=Sg({abs:En,add:Lr,concat:Gr,identity:io,index:oS,lusolve:dS,matrix:$e,matrixFromColumns:jy,multiply:it,range:qs,schur:bS,subset:na,subtract:Bt,transpose:df,typed:te}),UR=Ag({matrix:$e,multiply:it,sylvester:wS,transpose:df,typed:te});var yf={},xf={},WR={},_n=bv({mathWithTransform:xf}),bf=Yv({Node:_n}),oo=$v({Node:_n}),ks=Vv({Node:_n}),YR=Jv({Node:_n}),wf=Av({Node:_n}),HR=_v({Node:_n,ResultSet:kD}),$R=Bv({Node:_n}),Qo=qv({Node:_n}),GR=Qv({Node:_n}),wZ=i0({classes:WR}),DS=dg({math:yf,typed:te}),VR=Lv({Node:_n,typed:te}),DZ=vg({Chain:DS,typed:te}),Df=Uv({Node:_n,size:cn}),Sf=Sv({Node:_n,subset:na}),ZR=Tv({matrix:$e,Node:_n,subset:na}),Xo=Kv({Unit:wr,Node:_n,math:yf}),Jo=eg({Node:_n,SymbolNode:Xo,math:yf}),Wa=rg({AccessorNode:Sf,ArrayNode:wf,AssignmentNode:ZR,BlockNode:HR,ConditionalNode:$R,ConstantNode:Qo,FunctionAssignmentNode:VR,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,RangeNode:GR,RelationalNode:YR,SymbolNode:Xo,config:Oe,numeric:Ua,typed:te}),QR=jg({ConstantNode:Qo,FunctionNode:Jo,OperatorNode:oo,ParenthesisNode:ks,parse:Wa,typed:te}),SS=Jg({bignumber:ta,fraction:Ps,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Qo,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,SymbolNode:Xo,config:Oe,mathWithTransform:xf,matrix:$e,typed:te}),SZ=tg({parse:Wa,typed:te}),NS=Kg({AccessorNode:Sf,ArrayNode:wf,ConstantNode:Qo,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,SymbolNode:Xo,add:Lr,divide:an,equal:ba,isZero:La,multiply:it,parse:Wa,pow:wa,subtract:Bt,typed:te}),AS=ng({parse:Wa,typed:te}),XR=pg({evaluate:AS}),JR=ag({evaluate:AS}),cx=Xg({bignumber:ta,fraction:Ps,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Qo,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,SymbolNode:Xo,add:Lr,config:Oe,divide:an,equal:ba,isZero:La,mathWithTransform:xf,matrix:$e,multiply:it,parse:Wa,pow:wa,resolve:QR,simplifyConstant:SS,simplifyCore:NS,subtract:Bt,typed:te}),NZ=e0({OperatorNode:oo,parse:Wa,simplify:cx,typed:te}),AZ=Qg({parse:Wa,typed:te}),MZ=ig({Parser:JR,typed:te}),CZ=t0({bignumber:ta,fraction:Ps,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Qo,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,SymbolNode:Xo,add:Lr,config:Oe,divide:an,equal:ba,isZero:La,mathWithTransform:xf,matrix:$e,multiply:it,parse:Wa,pow:wa,simplify:cx,simplifyConstant:SS,simplifyCore:NS,subtract:Bt,typed:te}),EZ=r0({ConstantNode:Qo,FunctionNode:Jo,OperatorNode:oo,ParenthesisNode:ks,SymbolNode:Xo,config:Oe,equal:ba,isZero:La,numeric:Ua,parse:Wa,simplify:cx,typed:te}),TZ=hg({Help:XR,mathWithTransform:xf,typed:te});ht(yf,{e:RD,false:SP,fineStructure:NP,i:qD,Infinity:AP,LN10:MP,LOG10E:CP,NaN:EP,null:TP,phi:FP,SQRT1_2:OP,sackurTetrode:BP,tau:LD,true:PP,E:RD,version:IP,efimovFactor:RP,LN2:qP,pi:$y,replacer:kP,reviver:wZ,SQRT2:LP,typed:te,unaryPlus:Gy,PI:$y,weakMixingAngle:zP,abs:En,acos:UP,acot:WP,acsc:YP,addScalar:Qt,arg:HP,asech:$P,asinh:GP,atan:zD,atanh:VP,bignumber:ta,bitNot:ZP,boolean:QP,clone:XP,combinations:Lc,complex:zc,conj:Yo,cos:Vy,cot:JP,csc:KP,cube:jP,equalScalar:Ir,erf:eI,exp:UD,expm1:rI,filter:tI,forEach:nI,format:mf,getMatrixDataType:Zy,hex:aI,im:Qy,isInteger:zn,isNegative:ao,isPositive:Ho,isZero:La,LOG2E:iI,lgamma:oI,log10:sI,log2:WD,map:$o,multiplyScalar:Ot,not:Uc,number:Bi,oct:uI,pickRandom:fI,print:cI,random:lI,re:Xy,sec:mI,sign:YD,sin:Wc,splitUnit:pI,square:dI,string:hI,subtractScalar:xa,tan:vI,typeOf:HD,acosh:gI,acsch:yI,apply:Jy,asec:xI,bin:bI,chain:DZ,combinationsWithRep:wI,cosh:DI,csch:SI,isNaN:pf,isPrime:NI,randomInt:AI,sech:MI,sinh:CI,sparse:EI,sqrt:za,tanh:TI,unaryMinus:fi,acoth:FI,coth:_I,fraction:Ps,isNumeric:Go,matrix:$e,matrixFromFunction:OI,mode:BI,numeric:Ua,prod:$D,reshape:GD,size:cn,squeeze:PI,transpose:df,xgcd:VD,zeros:ln,asin:II,cbrt:ZD,concat:Gr,count:RI,ctranspose:Ky,diag:QD,divideScalar:Mt,dotDivide:hf,equal:ba,flatten:vf,hasNumericValue:qI,identity:io,kron:kI,largerEq:Yc,leftShift:LI,lsolve:XD,matrixFromColumns:jy,nthRoot:zI,ones:UI,qr:ex,resize:WI,rightArithShift:YI,round:Is,smaller:Tn,subtract:Bt,to:HI,unequal:$I,usolve:rx,xor:GI,add:Lr,atan2:VI,bitAnd:ZI,bitOr:QI,bitXor:XI,catalan:JI,compare:Vo,compareText:JD,cumsum:KI,deepEqual:tx,diff:jI,distance:e4,dot:Hc,equalText:r4,floor:KD,gcd:t4,hypot:n4,larger:Fn,log:nx,lsolveAll:a4,matrixFromRows:i4,min:o4,mod:eS,multiply:it,nthRoots:s4,or:u4,partitionSelect:$c,rightLogShift:f4,slu:rS,subset:na,sum:ax,trace:c4,usolveAll:tS,zpk2tf:l4,ceil:ix,compareNatural:ci,composition:m4,cross:p4,det:nS,dotMultiply:d4,fix:iS,index:oS,intersect:h4,invmod:v4,lcm:g4,log1p:y4,max:ox,setCartesian:x4,setDistinct:b4,setIsSubset:w4,setPowerset:D4,smallerEq:Rs,sort:S4,and:N4,range:qs,row:A4,setDifference:sS,setMultiplicity:M4,setSymDifference:uS,column:cS,inv:Zo,lup:lS,pinv:C4,pow:wa,setIntersect:mS,setUnion:E4,sqrtm:T4,vacuumImpedance:F4,wienDisplacement:_4,atomicMass:O4,bohrMagneton:B4,boltzmann:P4,conductanceQuantum:I4,coulomb:R4,deuteronMass:q4,dotPow:k4,electricConstant:L4,elementaryCharge:z4,expm:U4,faraday:W4,fft:pS,gamma:sx,gravitationConstant:Y4,hartreeEnergy:H4,ifft:$4,klitzing:G4,loschmidt:V4,magneticConstant:Z4,molarMass:Q4,molarPlanckConstant:X4,neutronMass:J4,nuclearMagneton:K4,planckCharge:j4,planckLength:eR,planckTemperature:rR,protonMass:tR,quantumOfCirculation:nR,reducedPlanckConstant:aR,rydberg:iR,secondRadiation:oR,speedOfLight:sR,stefanBoltzmann:uR,thomsonCrossSection:fR,avogadro:cR,bohrRadius:lR,createUnit:mR,divide:an,electronMass:pR,factorial:gf,firstRadiation:dR,gravity:hR,inverseConductanceQuantum:vR,lusolve:dS,magneticFluxQuantum:gR,molarMassC12:yR,multinomial:xR,parse:Wa,permutations:bR,planckMass:wR,polynomialRoot:DR,resolve:QR,setSize:SR,simplifyConstant:SS,solveODE:NR,stirlingS2:hS,unit:AR,bellNumbers:MR,compile:SZ,eigs:vS,fermiCoupling:CR,gasConstant:ER,kldivergence:TR,mean:gS,molarVolume:FR,planckConstant:_R,quantileSeq:OR,simplifyCore:NS,variance:ux,classicalElectronRadius:BR,evaluate:AS,median:yS,simplify:cx,symbolicEqual:NZ,corr:PR,freqz:IR,leafCount:AZ,mad:RR,parser:MZ,rationalize:CZ,std:qR,zeta:kR,derivative:EZ,norm:fx,rotationMatrix:xS,help:TZ,planckTime:LR,schur:bS,rotate:zR,sylvester:wS,lyap:UR,config:Oe});ht(xf,yf,{filter:Sy({typed:te}),forEach:Ny({typed:te}),map:My({typed:te}),apply:wy({isInteger:zn,typed:te}),or:Wy({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),and:Uy({add:Lr,concat:Gr,equalScalar:Ir,matrix:$e,not:Uc,typed:te,zeros:ln}),concat:By({isInteger:zn,matrix:$e,typed:te}),max:Cy({config:Oe,larger:Fn,numeric:Ua,typed:te}),print:zy({add:Lr,matrix:$e,typed:te,zeros:ln}),bitAnd:Yy({add:Lr,concat:Gr,equalScalar:Ir,matrix:$e,not:Uc,typed:te,zeros:ln}),diff:Py({bignumber:ta,matrix:$e,number:Bi,subtract:Bt,typed:te}),min:Ty({config:Oe,numeric:Ua,smaller:Tn,typed:te}),subset:Oy({add:Lr,matrix:$e,typed:te,zeros:ln}),bitOr:Hy({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),cumsum:ky({add:Lr,typed:te,unaryPlus:Gy}),index:Ay({Index:bn,getMatrixDataType:Zy}),sum:Ry({add:Lr,config:Oe,numeric:Ua,typed:te}),range:Fy({bignumber:ta,matrix:$e,add:Lr,config:Oe,isPositive:Ho,larger:Fn,largerEq:Yc,smaller:Tn,smallerEq:Rs,typed:te}),row:_y({Index:bn,matrix:$e,range:qs,typed:te}),column:Dy({Index:bn,matrix:$e,range:qs,typed:te}),mean:Ey({add:Lr,divide:an,typed:te}),quantileSeq:qy({add:Lr,bignumber:ta,compare:Vo,divide:an,isInteger:zn,larger:Fn,multiply:it,partitionSelect:$c,smaller:Tn,smallerEq:Rs,subtract:Bt,typed:te}),variance:Ly({add:Lr,apply:Jy,divide:an,isNaN:pf,multiply:it,subtract:Bt,typed:te}),std:Iy({map:$o,sqrt:za,typed:te,variance:ux})});ht(WR,{BigNumber:Ge,Complex:pt,Fraction:Wo,Matrix:kc,Node:_n,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,Range:_P,RelationalNode:YR,ResultSet:kD,ArrayNode:wf,BlockNode:HR,ConditionalNode:$R,ConstantNode:Qo,DenseMatrix:Fr,RangeNode:GR,Chain:DS,FunctionAssignmentNode:VR,SparseMatrix:Pi,IndexNode:Df,ImmutableDenseMatrix:jD,Index:bn,AccessorNode:Sf,AssignmentNode:ZR,FibonacciHeap:aS,Spa:fS,Unit:wr,SymbolNode:Xo,FunctionNode:Jo,Help:XR,Parser:JR});DS.createProxy(yf);var MS=ID;var t5=ma(Am(),1);var jR=ma(KR(),1);function e5(e){var r=new jR.default;return e.on=r.on.bind(r),e.off=r.off.bind(r),e.once=r.once.bind(r),e.emit=r.emit.bind(r),e}function r5(e,r,t,n){function a(x,w){var C=arguments.length;if(C!==1&&C!==2)throw new ga("import",C,1,2);w||(w={});function b(O,_,E){if(Array.isArray(_))_.forEach(k=>b(O,k));else if(typeof _=="object")for(var T in _)Xe(_,T)&&b(O,_[T],T);else if(Ms(_)||E!==void 0){var R=Ms(_)?y(_)?_.fn+".transform":_.fn:E;if(Xe(O,R)&&O[R]!==_&&!w.silent)throw new Error('Cannot import "'+R+'" twice');O[R]=_}else if(!w.silent)throw new TypeError("Factory, Object, or Array expected")}var N={};b(N,x);for(var M in N)if(Xe(N,M)){var S=N[M];if(Ms(S))o(S,w);else if(s(S))i(M,S,w);else if(!w.silent)throw new TypeError("Factory, Object, or Array expected")}}function i(x,w,C){if(C.wrap&&typeof w=="function"&&(w=c(w)),m(w)&&(w=e(x,{[w.signature]:w})),e.isTypedFunction(t[x])&&e.isTypedFunction(w)){C.override?w=e(x,w.signatures):w=e(t[x],w),t[x]=w,delete n[x],u(x,w),t.emit("import",x,function(){return w});return}if(t[x]===void 0||C.override){t[x]=w,delete n[x],u(x,w),t.emit("import",x,function(){return w});return}if(!C.silent)throw new Error('Cannot import "'+x+'": already exists')}function u(x,w){w&&typeof w.transform=="function"?(t.expression.transform[x]=w.transform,d(x)&&(t.expression.mathWithTransform[x]=w.transform)):(delete t.expression.transform[x],d(x)&&(t.expression.mathWithTransform[x]=w))}function l(x){delete t.expression.transform[x],d(x)?t.expression.mathWithTransform[x]=t[x]:delete t.expression.mathWithTransform[x]}function c(x){var w=function(){for(var b=[],N=0,M=arguments.length;N2&&arguments[2]!==void 0?arguments[2]:x.fn;if(Kb(C,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(C));var b=y(x)?t.expression.transform:t,N=C in t.expression.transform,M=Xe(b,C)?b[C]:void 0,S=function(){var _={};x.dependencies.map(rw).forEach(T=>{if(Kb(T,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(T));T==="math"?_.math=t:T==="mathWithTransform"?_.mathWithTransform=t.expression.mathWithTransform:T==="classes"?_.classes=t:_[T]=t[T]});var E=x(_);if(E&&typeof E.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(M===void 0||w.override)return E;if(e.isTypedFunction(M)&&e.isTypedFunction(E))return e(M,E);if(w.silent)return M;throw new Error('Cannot import "'+C+'": already exists')};!x.meta||x.meta.lazy!==!1?(Du(b,C,S),M&&N?l(C):(y(x)||h(x))&&Du(t.expression.mathWithTransform,C,()=>b[C])):(b[C]=S(),M&&N?l(C):(y(x)||h(x))&&Du(t.expression.mathWithTransform,C,()=>b[C])),n[C]=x,t.emit("import",C,S)}function s(x){return typeof x=="function"||typeof x=="number"||typeof x=="string"||typeof x=="boolean"||x===null||Ht(x)||Kt(x)||rr(x)||da(x)||Qe(x)||Array.isArray(x)}function m(x){return typeof x=="function"&&typeof x.signature=="string"}function d(x){return!Xe(v,x)}function h(x){return x.fn.indexOf(".")===-1&&!Xe(v,x.fn)&&(!x.meta||!x.meta.isClass)}function y(x){return x!==void 0&&x.meta!==void 0&&x.meta.isTransformFunction===!0||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return a}function lx(e,r){var t=ht({},Ss,r);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=e5({isNumber:sr,isComplex:Kt,isBigNumber:rr,isFraction:da,isUnit:Ht,isString:St,isArray:Mr,isMatrix:Qe,isCollection:Nt,isDenseMatrix:Ji,isSparseMatrix:ha,isRange:Fo,isIndex:Mi,isBoolean:cm,isResultSet:lm,isHelp:xu,isFunction:mm,isDate:pm,isRegExp:dm,isObject:Ci,isNull:hm,isUndefined:vm,isAccessorNode:Ln,isArrayNode:jt,isAssignmentNode:gm,isBlockNode:ym,isConditionalNode:xm,isConstantNode:xr,isFunctionAssignmentNode:Oa,isFunctionNode:yn,isIndexNode:Jn,isNode:Nr,isObjectNode:Ei,isOperatorNode:ct,isParenthesisNode:en,isRangeNode:bm,isRelationalNode:wm,isSymbolNode:at,isChain:bu});n.config=VA(t,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var a=[],i=[];function u(s){if(Ms(s))return s(n);var m=s[Object.keys(s)[0]];if(Ms(m))return m(n);if(!HA(s))throw console.warn("Factory object with properties \`type\`, \`name\`, and \`factory\` expected",s),new Error("Factory object with properties \`type\`, \`name\`, and \`factory\` expected");var d=a.indexOf(s),h;return d===-1?(s.math===!0?h=s.factory(n.type,t,u,n.typed,n):h=s.factory(n.type,t,u,n.typed),a.push(s),i.push(h)):h=i[d],h}var l={};function c(){for(var s=arguments.length,m=new Array(s),d=0;d{Wb(l).forEach(s=>{s&&s.meta&&s.meta.recreateOnConfigChange&&o(s,{override:!0})})}),n.create=lx.bind(null,e),n.factory=F,n.import(Wb(WA(e))),n.ArgumentsError=ga,n.DimensionError=pr,n.IndexError=tn,n}var LS=ma(fm());var a5=ma(n5()),FS=class{constructor(){this.lang="en";this.all={en:{hintText:{dragDropModifierKeys:"Hold \${1} to Pin and \${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"New Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Spaces",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Spaces",releaseNotes:"Release Notes",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{layout:"Layout",newView:"New View",calendarView:"Calendar View",closeSpace:"Close Space",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open Space",revealInDefault:"Reveal in Finder",revealInExplorer:"Reveal in Explorer",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Spaces",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",waypoints:"Waypoints",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group",sortBy:"Sort",filters:"Filters",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",removeFromWaypoints:"Unpin from Waypoints",editCode:"Edit Code",editProperties:"Edit Properties",properties:"Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"\${1} Link",linkThumbnail:"\${1} Thumbnail",linkSticker:"\${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",addFilter:"Add Filter",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",addDisplay:"Display Name",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete From Note",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \\u2192 Unchecked",checkDesc:"Unchecked \\u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"Action",newTable:"List",template:"Template",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",changeCoverShort:"Change",reposition:"Reposition",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type '\${1}' for commands",notePlaceholder:"New Note for \${1}",itemsSelected:"\${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Quickly Search a File, Folder, Tag... Press Tab to Edit",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueProperty:"Property",propertyLookup:"Edit Formula",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",contexts:"Contexts",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"\${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete \${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: ",tableDeleted:"Table removed from note, you can find the table in the folder space"},settings:{layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Stickers",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},generateThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Spaces as Default Tab",desc:"Open the Spaces tab when Obsidian launches"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Show Toggles to Open Flow Editor on Links",desc:"Turn on to toggle Flow Blocks directly in inline links"},internalLinkSticker:{name:"Show Stickers on Links",desc:"Turn on to toggle stickers shown directly by beside internal links"},syncContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},inlineBacklinks:{name:"Show Inline Backlinks (Inline Context required)",desc:"Show editable backlinks at the bottom of your notes"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContextExplorer:{name:"Inline Context",desc:"Display the context and a banner at the top of your notes"},inlineContextProperties:{name:"Inline Context Properties",desc:"Show the properties in the inline context"},inlineContextExpanded:{name:"Auto Expand Inline Context",desc:"Expand the inline context sections when opening a note"},inlineContextHorizontal:{name:"Inline Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Frontmatter Properties",desc:"Hide the frontmatter properties in inline context"},openFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},folderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},expandFolder:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},hoverPreview:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},activeFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Spaces"},contexts:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},spaces:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesAlias:{name:"Alias",desc:"Use the alias metadata to show in Spaces"},spacesFileExplorerDual:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using Spaces"},spacesDeleteOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},hideRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceView:{name:"Space View",desc:"Open the space view when you click on a space"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},tagSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Performance Mode",desc:"Turn on performance mode for Spaces, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \\u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in spaces (in pixels), default is 28"},coverHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \\u{1F9EA}",desc:"Use the editor without Markdown."},editorMakerMode:{name:"Flow (Beta)",desc:"An integrated and intuitive editor experience"},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blink:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",classic:"Classic",minimal:"Minimal"}}}};this.lang="en";let r=a5.default.locale();["en"].includes(r)&&(this.lang=r)}get texts(){return this.all.en}},Br=new FS().texts;var qZ=ma(fm());var OZ=(e,r)=>{let t=n=>n=="builtin"?"Builtin":n=="api"?"Spaces":"Action";return[...(e.actionsIndex.get(r)??[]).map(n=>({name:n.schema.name,description:"Action",value:\`\${r}/#;\${n.schema.id}\`,section:"Action"}))??[],...[...e.cli.allCommands()].map(n=>({name:n.schema.name,description:t(n.schema.type),value:n.path,section:t(n.schema.type)}))]};var i5=({field:e,value:r})=>r=="ctime"?{value:"parseDate(prop('File')['metadata']['ctime'])",type:"date"}:{value:"",type:"string"},mx=(e,r,t,n)=>{let a=bc(e);if(a)return r=="fileprop"&&a.field?i5(a):(r=="option"&&a.source?.length>0&&(a.source=="$commands"?a.options=t.cli.allCommands():a.source=="$links"?a.options=t.spaceManager.allPaths().map(i=>({name:i,value:i})):a.source=="$super"?a.options=OZ(t,n):a.source=="$properties"&&(a.options=t.contextsIndex.get(n)?.contextTable?.cols?.map(i=>({name:i.name,value:i.name}))??[])),[...o5(r).configKeys??[],"alias","default"].reduce((i,u)=>({...i,[u]:a[u]}),{}));if(!r)return{};if(!a)if(r=="context")e?.length>0?a={space:e}:a={};else if(r.startsWith("date"))e?.length>0?a={format:e}:a={};else if(r.startsWith("fileprop"))if(e?.length>0){let[i,u]=e.split(".");a=i5({field:i,value:u})}else a={};else r.startsWith("option")&&(e?.length>0?a={options:gn(e).map(u=>({name:u,value:u}))}:a={});return a??{}};var o5=(e,r)=>r==Xn?Af.find(t=>t.type=="file"):r=="tags"?Af.find(t=>t.type=="tags-multi"):r=="aliases"?Af.find(t=>t.type=="option-multi"):r=="sticker"?Af.find(t=>e=="icon"):Af.find(t=>e==t.type)||Af.find(t=>e==t.multiType),Af=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"any",label:"",restricted:!0,icon:"ui//wildcard",multi:!0,multiType:"any-multi"},{type:"text",label:Br.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:Br.properties.text.description},{type:"number",label:Br.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:Br.properties.number.description},{type:"boolean",label:Br.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:Br.properties.boolean.description},{type:"date",label:Br.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:Br.properties.date.description},{type:"option",label:Br.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:Br.properties.option.description},{type:"tags-multi",label:Br.properties.tags.label,icon:"ui//tags",description:Br.properties.tags.description},{type:"file",label:Br.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:Br.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:Br.properties.fileProperty.description},{type:"link",label:Br.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:Br.properties.link.description},{type:"context",label:Br.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space"],description:Br.properties.context.description},{type:"object",label:Br.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:Br.properties.object.description},{type:"icon",label:Br.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:Br.properties.icon.description},{type:"image",label:Br.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:Br.properties.image.description},{type:"color",label:Br.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:Br.properties.color.description},{type:"space",label:Br.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Br.properties.space.description},{type:"table",label:Br.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Br.properties.space.description},{type:"super",label:Br.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:Br.properties.super.label,icon:"ui//input",restricted:!0}];var li="files",hx={id:li,name:"Items",type:"db",primary:"true"},BZ="filesView",PZ={id:BZ,name:"All",type:"view",def:JSON.stringify({db:li,icon:"ui//file-stack"})},IZ="main",RZ=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),C4e={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[RZ(IZ),PZ]},px={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[hx]},s5={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},dx={...s5,rows:[{name:Xn,schemaId:li,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:Br.properties.fileProperty.createdTime,schemaId:li,type:"fileprop",value:Xn+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]};var E4e=[{name:Br.properties.defaultField,schemaId:"",type:"text",primary:"true"}],_S={...s5,rows:[{name:Xn,schemaId:li,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var T4e={schema:hx,cols:dx.rows,rows:[]},F4e={schema:hx,cols:dx.rows,rows:[]},_4e={schema:hx,cols:_S.rows,rows:[]},u5=(e,r)=>e.filter(t=>r.find(n=>n.id==t.schemaId&&n.type=="db")).reduce((t,n)=>({...t,...t[n.schemaId]?{[n.schemaId]:{uniques:n.unique=="true"?[...t[n.schemaId].uniques,n.name]:t[n.schemaId].uniques,cols:[...t[n.schemaId].cols,n.name],rows:[]}}:{[n.schemaId]:{uniques:n.unique=="true"?[n.name]:[],cols:[n.name],rows:[]}}}),{});var O4e={m_schema:px,m_fields:dx,...u5(dx.rows,px.rows)},B4e={m_schema:px,m_fields:_S,...u5(_S.rows,px.rows)};var OS="spaces://$tags";var mRe={name:Br.menu.waypoints,readOnly:!1,path:"spaces://$waypoints",label:{name:Br.menu.waypoints,thumbnail:"",sticker:"ui//tags",color:""},type:"default"},pRe={name:Br.menu.tags,readOnly:!1,path:"spaces://$tags",label:{thumbnail:"",name:Br.menu.tags,sticker:"ui//tags",color:""},type:"default"},dRe={name:Br.menu.vault,readOnly:!1,path:"/",label:{thumbnail:"",name:Br.menu.vault,sticker:"ui//vault",color:""},type:"default"};var f5=(e,r,t,n,a,i,u)=>{if(!t)return"";let l=new Map;Object.keys(a).forEach(o=>l.set(o,a[o])),l.set("$properties",n),l.set("$paths",r),i&&l.set("$current",i);let c;try{e.evaluate("current = _current()",l),c=e.evaluate(t,l),c=Ds("",c)}catch(o){if(c="",u)throw o;console.log(i,t,o)}return c};var BS=e=>{let r=new Map;e.filter(u=>u.type=="fileprop"||u.name.startsWith("tags")).forEach(u=>{let{value:l}=mx(u.value,u.type),c=[];try{let s=Wa(l).filter(m=>m.type=="FunctionNode").filter(m=>m.fn.name=="prop"&&m.args[0].type=="ConstantNode").map(m=>m.args[0]?.value);c.push(...s)}catch{}let o=u.name;r.has(o)||r.set(o,new Set);for(let s of c){let m=s;m!==o&&r.get(o).add(m)}});let t=new Set,n=[],a=new Set,i=u=>{if(a.has(u))throw new Error("Circular dependency detected");if(!t.has(u)){a.add(u);let l=r.get(u)||new Set;for(let c of l)i(c);t.add(u),a.delete(u),n.push(u)}};for(let u of e)t.has(u.name)||i(u.name);return n},c5=(e,r,t,n,a,i)=>{if(!t)return{};let u=i??BS(n),l=r.get(t[Xn])?.metadata?.property??{},c=Object.keys(l).filter(m=>n.some(d=>d.name==m)).reduce((m,d)=>({...m,[d]:Ds(d,l[d])}),{}),o=u.map(m=>n.find(d=>d.name==m)).filter(m=>m&&(m.type=="fileprop"||m.name=="tags")),s=n.reduce((m,d)=>({...m,[d.name]:d}),{});return{...t,...c,...o.reduce((m,d)=>{let{value:h}=mx(d.value,d.type);return{...m,[d.name]:f5(e,r,h,s,{...t,...m},a)}},{})}};var l5=(e,r)=>{let t=e?gn(e):[],n=r?gn(r):[];return n.every(a=>t.some(i=>i==a))&&t.every(a=>n.some(i=>i==a))},Mf=(e,r)=>e==r,PS=(e,r)=>(e??"").length==0,IS=(e,r)=>(e??"").toLowerCase().includes((r??"").toLowerCase()),RS=(e,r)=>parseFloat(e)>parseFloat(r),qS=(e,r)=>parseInt(e){let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf()>=n.valueOf()},p5=(e,r)=>{let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf(){let t=e?gn(e):[],n=r?gn(r):[];return t.length==0?!1:n.some(a=>t.some(i=>i==a))},d5=(e,r)=>{if(!e)return!1;let t=new Date(\`\${e.toString().replace(".",":")}\`),n=new Date(\`\${r}\`);return t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()},h5=e=>{if(!e)return!1;let r=new Date(\`\${e.toString()}T00:00\`),t=new Date;return r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()};var Cf={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>!PS(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>PS(e,""),valueType:"none"},include:{fn:(e,r)=>IS(e,r),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,r)=>!IS(e,r),valueType:"text"},is:{type:["text"],fn:(e,r)=>Mf(e,r),valueType:"text"},isNot:{type:["text"],fn:(e,r)=>!Mf(e,r),valueType:"text"},equal:{type:["number"],fn:(e,r)=>Mf(e,r),valueType:"number"},isLink:{type:["link","context"],fn:(e,r)=>Mf(e,r),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,r)=>!Mf(e,r),valueType:"link"},isGreatThan:{type:["number"],fn:(e,r)=>RS(e,r),valueType:"number"},isLessThan:{type:["number"],fn:(e,r)=>qS(e,r),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,r)=>!RS(e,r),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,r)=>!qS(e,r),valueType:"number"},dateBefore:{type:["date"],fn:(e,r)=>p5(e,r),valueType:"date"},dateAfter:{type:["date"],fn:(e,r)=>m5(e,r),valueType:"date"},isSameDate:{type:["date"],fn:(e,r)=>d5(e,r),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,r)=>h5(e,r),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>l5(e,r),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>kS(e,r),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>!kS(e,r),valueType:"list"},isTrue:{type:["boolean"],fn:(e,r)=>e=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(e,r)=>e!="true",valueType:"none"}};var LZ=(e,r,t)=>r.reduce((a,i)=>{let[u,l]=a,c=i.type=="context"?v5(l,i,t):i.type=="path"?y5(l,i,t):i.type=="frontmatter"?g5(l,i,t):x5(l,i,t),o=l.filter(s=>!c.includes(s));return[[...u,...c],o]},[[],e])[0],zZ=(e,r,t)=>r.reduce((n,a)=>a.type=="context"?v5(n,a,t):a.type=="path"?y5(n,a,t):a.type=="frontmatter"?g5(n,a,t):x5(n,a,t),e),v5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let[i,u]=r.field.split("."),l=a.metadata?.property;if(!a.spaces?.includes(i)||!l||!l[u])return!1;let c=!0;if(n){let o=r.fType=="property"?t[r.value]:r.value;c=n.fn(Ds(u,l[u]),o)}return c})},g5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=a.metadata?.property;if(!i||i[r.field]===void 0)return!1;let u=!0;if(n){let l=r.fType=="property"?t[r.value]:r.value;u=n.fn(Ds(r.field,i[r.field]),l)}return u})},y5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i="";r.field=="outlinks"?i=ws(a.outlinks??[]):r.field=="inlinks"?i=ws(a.inlinks??[]):r.field=="tags"&&(i=ws(a.tags??[]));let u=!0;if(n){let l=r.fType=="property"?t[r.value]:r.value;u=n.fn(i,l)}return u})},x5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=!0;if(n){let u=r.fType=="property"?t[r.value]:r.value;i=n.fn(a.metadata?.[r.type]?.[r.field],u)}return i})},b5=(e,r,t)=>e.reduce((a,i)=>!a||i.filters.length==0?!1:i.type=="any"?LZ([r],i.filters,t).length>0:zZ([r],i.filters,t).length>0,!0);var w5=(e,r)=>e.hiddenExtensions.some(t=>r.endsWith(t))||r.startsWith(e.spacesFolder+"/#")||e.hiddenFiles.some(t=>t==r);var D5=(e,r,t,n,a,i)=>{let u={};if(!e)return{changed:!1,cache:null};if(!r)return{changed:!1,cache:{path:e.path,schemas:[],outlinks:[],contexts:[],paths:[],contextTable:null,spaceMap:u,dbExists:!1}};let l=Object.values(r).map(N=>N.schema),c=r[li]?.rows?.map(N=>N[Xn])??[],o=t.filter(N=>!c.includes(N)),s=[...NA(t??[],c),...o],m=BS(r[li].cols),d=[...r[li].rows.filter(N=>t.includes(N[Xn])),...o.map(N=>({[Xn]:N}))].map(N=>c5(i,a,N,r[li].cols,a.get(e.path),m)),h={...r[li],rows:d},y=h.cols?.filter(N=>N.type.startsWith("context"))??[],v=h.cols?.filter(N=>N.type.startsWith("link"))??[],x=pa(y.map(N=>N.value));y.forEach(N=>{u[N.name]={},h.rows.forEach(M=>{gn(M[N.name]).forEach(S=>u[N.name][S]=[...u[N.name][S]??[],M[Xn]])})});let w=pa(h.rows.reduce((N,M)=>pa([...N,...[...y,...v].flatMap(S=>gn(M[S.name]).map(O=>wc(O)))]),[])),C={contextTable:h,path:e.path,contexts:x,outlinks:w,paths:s,schemas:l,spaceMap:u,dbExists:n},b=!1;return LS.default.isEqual(h,r)||(b=!0),{changed:b,cache:C}},S5=(e,r,t,n)=>{let a={};for(let[i,u]of e){let l=r.enableFolderNote?t.get(i)?.space.notePath??i:i,c=e.get(l)??u;if(!u)continue;let o=u?.parent??"",s=u?.type??"",m=u?.subtype??"",d=c?.label,h=n?.get(i),{changed:y,cache:v}=zS(i,r,t,c,d,s,m,o,h);a[i]={changed:y,cache:v}}return a},zS=(e,r,t,n,a,i,u,l,c)=>{let o=(W,G,H)=>W?.length>0||W?.length>0?W:G=="space"?H=="Spaces/Home"?"ui//home":H=="/"?"ui//vault":H.startsWith("spaces://")?"ui//tags":"ui//folder":"ui//file",s={label:n?.label,path:e,name:sm(e),readOnly:n?.readOnly},m=[],d=n?.tags?.map(W=>W)??[],h=w5(r,e),y=(W,G,H=new Set)=>{let L=[];for(let q of G){let K=W.get(q)?.contexts??[];for(let z of K)H.has(z)||(L.push(z),H.add(z),L.push(...y(W,[xc(z)],H)))}return L};if(t.has(l))for(let W of t.get(l).contexts??[])m.push(W);m.push(...d);let v=a?.name,x=n?.properties?um(n.properties[r.fmKeyAlias]):[],w=o(a?.sticker,i,e),C=a?.color??"",b=n?.resolvedLinks??[],N=!1,M,S={...s,name:v,tags:pa(m),type:i,subtype:u,parent:l,label:{name:v,sticker:w,color:C,thumbnail:a?.thumbnail??"",preview:a?.preview??""},metadata:{...n},outlinks:b},O=[];u=="tag"&&O.push(OS);for(let W of m)O.push(xc(W));let _=new Set,E=(W,G)=>{if(!_.has(W)){if(_.add(W),G.dependencies?.length>0)for(let H of G.dependencies)t.has(H)&&E(H,t.get(H));if(G.space.notePath==e&&G.path!=G.space.notePath&&(N=!0,M=G.path,h=!0),u!="tag"&&u!="default"&&G.space&&G.space.path==l){O.push(W);return}if(G.metadata?.filters?.length>0&&b5(G.metadata.filters,{...S,spaces:O},G.properties)){O.push(W);return}if(G.metadata?.links?.length>0&&(G.metadata?.links??[]).find(L=>L==S.path)){O.push(W);return}}};for(let[W,G]of t)E(W,G);let T=y(t,O);O.push(...T.map(W=>xc(W))),S.tags.push(...T),N&&(S.metadata.spacePath=M);let R=h?{...S,spaces:[],hidden:h}:{...S,spaces:pa(O),hidden:h},k=!0;return c&&LS.default.isEqual(R,c)&&(k=!1),{changed:k,cache:R}};function N5(e){let{path:r,settings:t,spacesCache:n,pathMetadata:a,label:i,type:u,subtype:l,parent:c,oldMetadata:o}=e;return zS(r,t,n,a,i,u,l,c,o)}function US(e,r){let{space:t,mdb:n,paths:a,dbExists:i,pathsIndex:u}=e;return D5(t,n,a,i,u,r)}function A5(e,r){let{map:t,pathsIndex:n}=e,a=new Map;for(let[i,u]of t)a.set(i,US({...u,pathsIndex:n},r));return a}function M5(e){let{pathCache:r,settings:t,spacesCache:n,oldMetadata:a}=e;return S5(r,t,n,a)}var UZ=self,WZ={...MS,createAdd:F("add",[],()=>function(r,t){return r+t}),createEqual:F("equal",[],()=>function(r,t){return r==t}),createUnequal:F("unequal",[],()=>function(r,t){return r!=t})},WS=lx(WZ);WS.import(zb,{override:!0});UZ.onmessage=async e=>{let{payload:r,job:t}=e.data,n;t.type=="path"?n=N5(r):t.type=="context"?n=US(r,WS):t.type=="contexts"?n=A5(r,WS):t.type=="paths"&&(n=M5(r));try{postMessage({job:t,result:n})}catch(a){console.log(a),postMessage({job:t,result:{$error:\`Failed to index \${t.type} \${t.path}: \${a}\`}})}}; +In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.\`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var f3={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var c3={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var l3={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var m3={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var p3={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var d3={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var h3={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as \`acosh(x) = ln(sqrt(x^2 - 1) + x)\`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var v3={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var g3={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as \`acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2\`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var y3={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var x3={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as \`acsch(x) = ln(1/x + sqrt(1/x^2 + 1))\`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var b3={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var w3={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var D3={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var S3={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as \`asinh(x) = ln(x + sqrt(x^2 + 1))\`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var N3={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var A3={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var M3={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as \`atanh(x) = ln((1 + x)/(1 - x)) / 2\`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var C3={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var E3={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var T3={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var F3={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var _3={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var O3={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var B3={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var P3={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var I3={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var R3={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var q3={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var k3={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var L3={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var z3={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var U3={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var W3={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var Y3={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var H3={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var $3={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var G3={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var V3={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var Z3={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var Q3={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var X3={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var J3={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var K3={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var j3={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var eB={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var rB={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var tB={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var nB={bignumber:VT,boolean:ZT,complex:QT,createUnit:XT,fraction:JT,index:KT,matrix:jT,number:eF,sparse:rF,splitUnit:tF,string:nF,unit:aF,e:DD,E:DD,false:OT,i:BT,Infinity:PT,LN2:RT,LN10:IT,LOG2E:kT,LOG10E:qT,NaN:LT,null:zT,pi:SD,PI:SD,phi:UT,SQRT1_2:WT,SQRT2:YT,tau:HT,true:$T,version:GT,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:uF,lsolve:cF,lsolveAll:lF,lup:mF,lusolve:pF,leafCount:fF,polynomialRoot:dF,resolve:gF,simplify:yF,simplifyConstant:xF,simplifyCore:bF,symbolicEqual:DF,rationalize:vF,slu:wF,usolve:SF,usolveAll:NF,qr:hF,abs:AF,add:MF,cbrt:CF,ceil:EF,cube:TF,divide:FF,dotDivide:_F,dotMultiply:OF,dotPow:BF,exp:PF,expm:IF,expm1:RF,fix:qF,floor:kF,gcd:LF,hypot:zF,lcm:WF,log:YF,log2:GF,log1p:$F,log10:HF,mod:VF,multiply:ZF,norm:QF,nthRoot:XF,nthRoots:JF,pow:KF,round:jF,sign:e_,sqrt:r_,sqrtm:t_,square:o_,subtract:s_,unaryMinus:u_,unaryPlus:f_,xgcd:c_,invmod:UF,bitAnd:l_,bitNot:m_,bitOr:p_,bitXor:d_,leftShift:h_,rightArithShift:v_,rightLogShift:g_,bellNumbers:y_,catalan:x_,composition:b_,stirlingS2:w_,config:iF,import:oF,typed:sF,arg:D_,conj:S_,re:A_,im:N_,evaluate:M_,help:C_,distance:E_,intersect:T_,and:F_,not:__,or:O_,xor:B_,concat:I_,count:R_,cross:q_,column:P_,ctranspose:k_,det:L_,diag:z_,diff:U_,dot:W_,getMatrixDataType:V_,identity:Z_,filter:H_,flatten:$_,forEach:G_,inv:Q_,pinv:X_,eigs:Y_,kron:J_,matrixFromFunction:eO,matrixFromRows:rO,matrixFromColumns:j_,map:K_,ones:tO,partitionSelect:nO,range:aO,resize:oO,reshape:iO,rotate:sO,rotationMatrix:uO,row:fO,size:cO,sort:lO,squeeze:mO,subset:pO,trace:dO,transpose:hO,zeros:vO,fft:gO,ifft:yO,sylvester:n_,schur:a_,lyap:i_,solveODE:tB,combinations:xO,combinationsWithRep:bO,factorial:wO,gamma:DO,kldivergence:NO,lgamma:SO,multinomial:AO,permutations:MO,pickRandom:CO,random:EO,randomInt:TO,compare:FO,compareNatural:_O,compareText:OO,deepEqual:BO,equal:PO,equalText:IO,larger:RO,largerEq:qO,smaller:kO,smallerEq:LO,unequal:zO,setCartesian:UO,setDifference:WO,setDistinct:YO,setIntersect:HO,setIsSubset:$O,setMultiplicity:GO,setPowerset:VO,setSize:ZO,setSymDifference:QO,setUnion:XO,zpk2tf:JO,freqz:KO,erf:jO,zeta:e3,cumsum:c3,mad:r3,max:t3,mean:n3,median:a3,min:i3,mode:o3,prod:s3,quantileSeq:u3,std:f3,sum:l3,variance:m3,corr:p3,acos:d3,acosh:h3,acot:v3,acoth:g3,acsc:y3,acsch:x3,asec:b3,asech:w3,asin:D3,asinh:S3,atan:N3,atanh:M3,atan2:A3,cos:C3,cosh:E3,cot:T3,coth:F3,csc:_3,csch:O3,sec:B3,sech:P3,sin:I3,sinh:R3,tan:q3,tanh:k3,to:L3,clone:U3,format:W3,bin:z3,oct:j3,hex:H3,isNaN:G3,isInteger:$3,isNegative:V3,isNumeric:Z3,hasNumericValue:Y3,isPositive:Q3,isPrime:X3,isZero:J3,print:eB,typeOf:rB,numeric:K3};var aB="help",bG=["typed","mathWithTransform","Help"],dg=F(aB,bG,e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(aB,{any:function(i){var s,l=i;if(typeof i!="string"){for(s in t)if(Xe(t,s)&&i===t[s]){l=s;break}}var c=wt(nB,l);if(!c){var o=typeof l=="function"?l.name:l;throw new Error('No documentation found on "'+o+'"')}return new n(c)}})});var iB="chain",wG=["typed","Chain"],hg=F(iB,wG,e=>{var{typed:r,Chain:t}=e;return r(iB,{"":function(){return new t},any:function(a){return new t(a)}})});var oB="det",DG=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],vg=F(oB,DG,e=>{var{typed:r,matrix:t,subtractScalar:n,multiply:a,divideScalar:i,isZero:s,unaryMinus:l}=e;return r(oB,{any:function(u){return ar(u)},"Array | Matrix":function(u){var m;switch(Qe(u)?m=u.size():Array.isArray(u)?(u=t(u),m=u.size()):m=[],m.length){case 0:return ar(u);case 1:if(m[0]===1)return ar(u.valueOf()[0]);if(m[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+lr(m)+")");case 2:{var d=m[0],h=m[1];if(d===h)return c(u.clone().valueOf(),d,h);if(h===0)return 1;throw new RangeError("Matrix must be square (size: "+lr(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(m)+")")}}});function c(o,u,m){if(u===1)return ar(o[0][0]);if(u===2)return n(a(o[0][0],o[1][1]),a(o[1][0],o[0][1]));for(var d=!1,h=new Array(u).fill(0).map((O,_)=>_),y=0;y{var{typed:r,matrix:t,divideScalar:n,addScalar:a,multiply:i,unaryMinus:s,det:l,identity:c,abs:o}=e;return r(sB,{"Array | Matrix":function(d){var h=Qe(d)?d.size():ur(d);switch(h.length){case 1:if(h[0]===1)return Qe(d)?t([n(1,d.valueOf()[0])]):[n(1,d[0])];throw new RangeError("Matrix must be square (size: "+lr(h)+")");case 2:{var y=h[0],v=h[1];if(y===v)return Qe(d)?t(u(d.valueOf(),y,v),d.storage()):u(d,y,v);throw new RangeError("Matrix must be square (size: "+lr(h)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(h)+")")}},any:function(d){return n(1,d)}});function u(m,d,h){var y,v,x,w,C;if(d===1){if(w=m[0][0],w===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,w)]]}else if(d===2){var b=l(m);if(b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(m[1][1],b),n(s(m[0][1]),b)],[n(s(m[1][0]),b),n(m[0][0],b)]]}else{var N=m.concat();for(y=0;yO&&(O=o(N[y][S]),_=y),y++;if(O===0)throw Error("Cannot calculate inverse, determinant is zero");y=_,y!==S&&(C=N[S],N[S]=N[y],N[y]=C,C=M[S],M[S]=M[y],M[y]=C);var E=N[S],T=M[S];for(y=0;y{var{typed:r,matrix:t,inv:n,deepEqual:a,equal:i,dotDivide:s,dot:l,ctranspose:c,divideScalar:o,multiply:u,add:m,Complex:d}=e;return r(uB,{"Array | Matrix":function(b){var N=Qe(b)?b.size():ur(b);switch(N.length){case 1:return w(b)?c(b):N[0]===1?n(b):s(c(b),l(b,b));case 2:{if(w(b))return c(b);var M=N[0],S=N[1];if(M===S)try{return n(b)}catch(O){if(!(O instanceof Error&&O.message.match(/Cannot calculate inverse, determinant is zero/)))throw O}return Qe(b)?t(h(b.valueOf(),M,S),b.storage()):h(b,M,S)}default:throw new RangeError("Matrix must be two dimensional (size: "+lr(N)+")")}},any:function(b){return i(b,0)?ar(b):o(1,b)}});function h(C,b,N){var{C:M,F:S}=v(C,b,N),O=u(n(u(c(M),M)),c(M)),_=u(c(S),n(u(S,c(S))));return u(_,O)}function y(C,b,N){for(var M=ar(C),S=0,O=0;O_.filter((T,R)=>R!x(l(M[E],M[E])));return{C:S,F:O}}function x(C){return i(m(C,d(1,1)),m(0,d(1,1)))}function w(C){return a(m(C,d(1,1)),m(u(C,0),d(1,1)))}});function fB(e){var{addScalar:r,subtract:t,flatten:n,multiply:a,multiplyScalar:i,divideScalar:s,sqrt:l,abs:c,bignumber:o,diag:u,size:m,reshape:d,inv:h,qr:y,usolve:v,usolveAll:x,equal:w,complex:C,larger:b,smaller:N,matrixFromColumns:M,dot:S}=e;function O(ae,$,me,Ee){var pe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,ge=_(ae,$,me,Ee,pe);E(ae,$,me,Ee,pe,ge);var{values:Se,C:ye}=T(ae,$,me,Ee,pe);if(pe){var be=R(ae,$,ye,ge,Se,me,Ee);return{values:Se,eigenvectors:be}}return{values:Se}}function _(ae,$,me,Ee,pe){var ge=Ee==="BigNumber",Se=Ee==="Complex",ye=ge?o(0):0,be=ge?o(1):Se?C(1):1,De=ge?o(1):1,Ae=ge?o(10):2,We=i(Ae,Ae),Je;pe&&(Je=Array($).fill(be));for(var J=!1;!J;){J=!0;for(var re=0;re<$;re++){for(var xe=ye,j=ye,ne=0;ne<$;ne++)re!==ne&&(xe=r(xe,c(ae[ne][re])),j=r(j,c(ae[re][ne])));if(!w(xe,0)&&!w(j,0)){for(var ue=De,Me=xe,Ce=s(j,Ae),Le=i(j,Ae);N(Me,Ce);)Me=i(Me,We),ue=i(ue,Ae);for(;b(Me,Le);)Me=s(Me,We),ue=s(ue,Ae);var Ie=N(s(r(Me,j),ue),i(r(xe,j),.95));if(Ie){J=!1;for(var fr=s(1,ue),or=0;or<$;or++)re!==or&&(ae[re][or]=i(ae[re][or],fr),ae[or][re]=i(ae[or][re],ue));pe&&(Je[re]=i(Je[re],fr))}}}}return pe?u(Je):null}function E(ae,$,me,Ee,pe,ge){var Se=Ee==="BigNumber",ye=Ee==="Complex",be=Se?o(0):ye?C(0):0;Se&&(me=o(me));for(var De=0;De<$-2;De++){for(var Ae=0,We=be,Je=De+1;Je<$;Je++){var J=ae[Je][De];N(c(We),c(J))&&(We=J,Ae=Je)}if(!N(c(We),me)){if(Ae!==De+1){var re=ae[Ae];ae[Ae]=ae[De+1],ae[De+1]=re;for(var xe=0;xe<$;xe++){var j=ae[xe][Ae];ae[xe][Ae]=ae[xe][De+1],ae[xe][De+1]=j}if(pe){var ne=ge[Ae];ge[Ae]=ge[De+1],ge[De+1]=ne}}for(var ue=De+2;ue<$;ue++){var Me=s(ae[ue][De],We);if(Me!==0){for(var Ce=0;Ce<$;Ce++)ae[ue][Ce]=t(ae[ue][Ce],i(Me,ae[De+1][Ce]));for(var Le=0;Le<$;Le++)ae[Le][De+1]=r(ae[Le][De+1],i(Me,ae[Le][ue]));if(pe)for(var Ie=0;Ie<$;Ie++)ge[ue][Ie]=t(ge[ue][Ie],i(Me,ge[De+1][Ie]))}}}}return ge}function T(ae,$,me,Ee,pe){var ge=Ee==="BigNumber",Se=Ee==="Complex",ye=ge?o(1):Se?C(1):1;ge&&(me=o(me));for(var be=ar(ae),De=[],Ae=$,We=[],Je=pe?u(Array($).fill(ye)):void 0,J=pe?u(Array(Ae).fill(ye)):void 0,re=0;re<=100;){re+=1;for(var xe=be[Ae-1][Ae-1],j=0;j1&&(J=u(Array(Ae-1).fill(ye)))),Ae-=1,be.pop();for(var Ce=0;Ce2&&(J=u(Array(Ae-2).fill(ye)))),Ae-=2,be.pop(),be.pop();for(var Ie=0;Ie+t(c(Ke),c(Pr))),re>100){var fr=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+De.join(", "));throw fr.values=De,fr.vectors=[],fr}var or=pe?a(Je,W(We,$)):void 0;return{values:De,C:or}}function R(ae,$,me,Ee,pe,ge,Se){var ye=h(me),be=a(ye,ae,me),De=Se==="BigNumber",Ae=Se==="Complex",We=De?o(0):Ae?C(0):0,Je=De?o(1):Ae?C(1):1,J=[],re=[];for(var xe of pe){var j=k(J,xe,w);j===-1?(J.push(xe),re.push(1)):re[j]+=1}for(var ne=[],ue=J.length,Me=Array($).fill(We),Ce=u(Array($).fill(Je)),Le=function(){var or=J[Ie],Ke=t(be,a(or,Ce)),Pr=x(Ke,Me);for(Pr.shift();Pr.lengtha(ce,we)),ne.push(...Pr.map(we=>({value:or,vector:n(we)})))},Ie=0;Ie=5)return null;for(ye=0;;){var be=v(ae,Se);if(N(oe(z(Se,[be])),Ee))break;if(++ye>=10)return null;Se=le(be)}return Se}function K(ae,$,me){var Ee=me==="BigNumber",pe=me==="Complex",ge=Array(ae).fill(0).map(Se=>2*Math.random()-1);return Ee&&(ge=ge.map(Se=>o(Se))),pe&&(ge=ge.map(Se=>C(Se))),ge=z(ge,$),le(ge,me)}function z(ae,$){var me=m(ae);for(var Ee of $)Ee=d(Ee,me),ae=t(ae,a(s(S(Ee,ae),S(Ee,Ee)),Ee));return ae}function oe(ae){return c(l(S(ae,ae)))}function le(ae,$){var me=$==="BigNumber",Ee=$==="Complex",pe=me?o(1):Ee?C(1):1;return a(s(pe,oe(ae)),ae)}return O}function cB(e){var{config:r,addScalar:t,subtract:n,abs:a,atan:i,cos:s,sin:l,multiplyScalar:c,inv:o,bignumber:u,multiply:m,add:d}=e;function h(E,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.epsilon,L=arguments.length>3?arguments[3]:void 0,H=arguments.length>4?arguments[4]:void 0;if(L==="number")return y(E,R,H);if(L==="BigNumber")return v(E,R,H);throw TypeError("Unsupported data type: "+L)}function y(E,T,R){var L=E.length,H=Math.abs(T/L),V,W;if(R){W=new Array(L);for(var k=0;k=Math.abs(H);){var K=q[0][0],z=q[0][1];V=x(E[K][K],E[z][z],E[K][z]),E=M(E,V,K,z),R&&(W=C(W,V,K,z)),q=S(E)}for(var oe=Array(L).fill(0),le=0;le=a(H);){var K=q[0][0],z=q[0][1];V=w(E[K][K],E[z][z],E[K][z]),E=N(E,V,K,z),R&&(W=b(W,V,K,z)),q=O(E)}for(var oe=Array(L).fill(0),le=0;le({value:H[$],vector:ae}));return{values:H,eigenvectors:le}}return h}var AG="eigs",MG=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],xg=F(AG,MG,e=>{var{config:r,typed:t,matrix:n,addScalar:a,subtract:i,equal:s,abs:l,atan:c,cos:o,sin:u,multiplyScalar:m,divideScalar:d,inv:h,bignumber:y,multiply:v,add:x,larger:w,column:C,flatten:b,number:N,complex:M,sqrt:S,diag:O,size:_,reshape:E,qr:T,usolve:R,usolveAll:L,im:H,re:V,smaller:W,matrixFromColumns:k,dot:q}=e,K=cB({config:r,addScalar:a,subtract:i,column:C,flatten:b,equal:s,abs:l,atan:c,cos:o,sin:u,multiplyScalar:m,inv:h,bignumber:y,complex:M,multiply:v,add:x}),z=fB({config:r,addScalar:a,subtract:i,multiply:v,multiplyScalar:m,flatten:b,divideScalar:d,sqrt:S,abs:l,bignumber:y,diag:O,size:_,reshape:E,qr:T,inv:h,usolve:R,usolveAll:L,equal:s,complex:M,larger:w,smaller:W,matrixFromColumns:k,dot:q});return t("eigs",{Array:function(ge){return oe(n(ge))},"Array, number|BigNumber":function(ge,Se){return oe(n(ge),{precision:Se})},"Array, Object"(pe,ge){return oe(n(pe),ge)},Matrix:function(ge){return oe(ge,{matricize:!0})},"Matrix, number|BigNumber":function(ge,Se){return oe(ge,{precision:Se,matricize:!0})},"Matrix, Object":function(ge,Se){var ye={matricize:!0};return ht(ye,Se),oe(ge,ye)}});function oe(pe){var ge,Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye="eigenvectors"in Se?Se.eigenvectors:!0,be=(ge=Se.precision)!==null&&ge!==void 0?ge:r.epsilon,De=le(pe,be,ye);return Se.matricize&&(De.values=n(De.values),ye&&(De.eigenvectors=De.eigenvectors.map(Ae=>{var{value:We,vector:Je}=Ae;return{value:We,vector:n(Je)}}))),ye&&Object.defineProperty(De,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),De}function le(pe,ge,Se){var ye=pe.toArray(),be=pe.size();if(be.length!==2||be[0]!==be[1])throw new RangeError("Matrix must be square (size: ".concat(lr(be),")"));var De=be[0];if($(ye,De,ge)&&(me(ye,De),ae(ye,De,ge))){var Ae=Ee(pe,ye,De);return K(ye,De,ge,Ae,Se)}var We=Ee(pe,ye,De);return z(ye,De,ge,We,Se)}function ae(pe,ge,Se){for(var ye=0;ye{var{typed:r,abs:t,add:n,identity:a,inv:i,multiply:s}=e;return r(lB,{Matrix:function(m){var d=m.size();if(d.length!==2||d[0]!==d[1])throw new RangeError("Matrix must be square (size: "+lr(d)+")");for(var h=d[0],y=1e-15,v=l(m),x=c(v,y),w=x.q,C=x.j,b=s(m,Math.pow(2,-C)),N=a(h),M=a(h),S=1,O=b,_=-1,E=1;E<=w;E++)E>1&&(O=s(O,b),_=-_),S=S*(w-E+1)/((2*w-E+1)*E),N=n(N,s(S,O)),M=n(M,s(S*_,O));for(var T=s(i(M),N),R=0;R{var{typed:r,abs:t,add:n,multiply:a,map:i,sqrt:s,subtract:l,inv:c,size:o,max:u,identity:m}=e,d=1e3,h=1e-6;function y(v){var x,w=0,C=v,b=m(o(v));do{var N=C;if(C=a(.5,n(N,c(b))),b=a(.5,n(b,c(N))),x=u(t(l(C,N))),x>h&&++w>d)throw new Error("computing square root of matrix: iterative method could not converge")}while(x>h);return C}return r(mB,{"Array | Matrix":function(x){var w=Qe(x)?x.size():ur(x);switch(w.length){case 1:if(w[0]===1)return i(x,s);throw new RangeError("Matrix must be square (size: "+lr(w)+")");case 2:{var C=w[0],b=w[1];if(C===b)return y(x);throw new RangeError("Matrix must be square (size: "+lr(w)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+lr(w)+")")}}})});var pB="sylvester",TG=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Dg=F(pB,TG,e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:a,multiply:i,range:s,concat:l,transpose:c,index:o,subset:u,add:m,subtract:d,identity:h,lusolve:y,abs:v}=e;return r(pB,{"Matrix, Matrix, Matrix":x,"Array, Matrix, Matrix":function(C,b,N){return x(a(C),b,N)},"Array, Array, Matrix":function(C,b,N){return x(a(C),a(b),N)},"Array, Matrix, Array":function(C,b,N){return x(a(C),b,a(N))},"Matrix, Array, Matrix":function(C,b,N){return x(C,a(b),N)},"Matrix, Array, Array":function(C,b,N){return x(C,a(b),a(N))},"Matrix, Matrix, Array":function(C,b,N){return x(C,b,a(N))},"Array, Array, Array":function(C,b,N){return x(a(C),a(b),a(N)).toArray()}});function x(w,C,b){for(var N=C.size()[0],M=w.size()[0],S=t(w),O=S.T,_=S.U,E=t(i(-1,C)),T=E.T,R=E.U,L=i(i(c(_),b),R),H=s(0,M),V=[],W=(Ae,We)=>l(Ae,We,1),k=(Ae,We)=>l(Ae,We,0),q=0;q1e-5){for(var K=k(u(L,o(H,q)),u(L,o(H,q+1))),z=0;z{var{typed:r,matrix:t,identity:n,multiply:a,qr:i,norm:s,subtract:l}=e;return r(dB,{Array:function(u){var m=c(t(u));return{U:m.U.valueOf(),T:m.T.valueOf()}},Matrix:function(u){return c(u)}});function c(o){var u=o.size()[0],m=o,d=n(u),h=0,y;do{y=m;var v=i(m),x=v.Q,w=v.R;if(m=a(w,x),d=a(d,x),h++>100)break}while(s(l(m,y))>1e-4);return{U:d,T:m}}});var hB="lyap",_G=["typed","matrix","sylvester","multiply","transpose"],Ng=F(hB,_G,e=>{var{typed:r,matrix:t,sylvester:n,multiply:a,transpose:i}=e;return r(hB,{"Matrix, Matrix":function(l,c){return n(l,i(l),a(-1,c))},"Array, Matrix":function(l,c){return n(t(l),i(t(l)),a(-1,c))},"Matrix, Array":function(l,c){return n(l,i(t(l)),t(a(-1,c)))},"Array, Array":function(l,c){return n(t(l),i(t(l)),t(a(-1,c))).toArray()}})});var OG="divide",BG=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Ag=F(OG,BG,e=>{var{typed:r,matrix:t,multiply:n,equalScalar:a,divideScalar:i,inv:s}=e,l=jr({typed:r,equalScalar:a}),c=kt({typed:r});return r("divide",wm({"Array | Matrix, Array | Matrix":function(u,m){return n(u,s(m))},"DenseMatrix, any":function(u,m){return c(u,m,i,!1)},"SparseMatrix, any":function(u,m){return l(u,m,i,!1)},"Array, any":function(u,m){return c(t(u),m,i,!1).valueOf()},"any, Array | Matrix":function(u,m){return n(u,s(m))}},i.signatures))});var vB="distance",PG=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],Mg=F(vB,PG,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,deepEqual:s,sqrt:l,abs:c}=e;return r(vB,{"Array, Array, Array":function(M,S,O){if(M.length===2&&S.length===2&&O.length===2){if(!u(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!u(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!u(O))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(s(S,O))throw new TypeError("LinePoint1 should not be same with LinePoint2");var _=n(O[1],S[1]),E=n(S[0],O[0]),T=n(a(O[0],S[1]),a(S[0],O[1]));return x(M[0],M[1],_,E,T)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(M,S,O){if(Object.keys(M).length===2&&Object.keys(S).length===2&&Object.keys(O).length===2){if(!u(M))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!u(S))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!u(O))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(s(y(S),y(O)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in M&&"pointY"in M&&"lineOnePtX"in S&&"lineOnePtY"in S&&"lineTwoPtX"in O&&"lineTwoPtY"in O){var _=n(O.lineTwoPtY,S.lineOnePtY),E=n(S.lineOnePtX,O.lineTwoPtX),T=n(a(O.lineTwoPtX,S.lineOnePtY),a(S.lineOnePtX,O.lineTwoPtY));return x(M.pointX,M.pointY,_,E,T)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(M,S){if(M.length===2&&S.length===3){if(!u(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!m(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return x(M[0],M[1],S[0],S[1],S[2])}else if(M.length===3&&S.length===6){if(!m(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!h(S))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return w(M[0],M[1],M[2],S[0],S[1],S[2],S[3],S[4],S[5])}else if(M.length===S.length&&M.length>0){if(!d(M))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!d(S))throw new TypeError("All values of an array should be numbers or BigNumbers");return C(M,S)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(M,S){if(Object.keys(M).length===2&&Object.keys(S).length===3){if(!u(M))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!m(S))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in M&&"pointY"in M&&"xCoeffLine"in S&&"yCoeffLine"in S&&"constant"in S)return x(M.pointX,M.pointY,S.xCoeffLine,S.yCoeffLine,S.constant);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===3&&Object.keys(S).length===6){if(!m(M))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!h(S))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in M&&"pointY"in M&&"x0"in S&&"y0"in S&&"z0"in S&&"a"in S&&"b"in S&&"c"in S)return w(M.pointX,M.pointY,M.pointZ,S.x0,S.y0,S.z0,S.a,S.b,S.c);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===2&&Object.keys(S).length===2){if(!u(M))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!u(S))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in M&&"pointOneY"in M&&"pointTwoX"in S&&"pointTwoY"in S)return C([M.pointOneX,M.pointOneY],[S.pointTwoX,S.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(M).length===3&&Object.keys(S).length===3){if(!m(M))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!m(S))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in M&&"pointOneY"in M&&"pointOneZ"in M&&"pointTwoX"in S&&"pointTwoY"in S&&"pointTwoZ"in S)return C([M.pointOneX,M.pointOneY,M.pointOneZ],[S.pointTwoX,S.pointTwoY,S.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(M){if(!v(M))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return b(M)}});function o(N){return typeof N=="number"||rr(N)}function u(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])}function m(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])&&o(N[2])}function d(N){return Array.isArray(N)||(N=y(N)),N.every(o)}function h(N){return N.constructor!==Array&&(N=y(N)),o(N[0])&&o(N[1])&&o(N[2])&&o(N[3])&&o(N[4])&&o(N[5])}function y(N){for(var M=Object.keys(N),S=[],O=0;OM.length!==2||!o(M[0])||!o(M[1])))return!1}else if(N[0].length===3&&o(N[0][0])&&o(N[0][1])&&o(N[0][2])){if(N.some(M=>M.length!==3||!o(M[0])||!o(M[1])||!o(M[2])))return!1}else return!1;return!0}function x(N,M,S,O,_){var E=c(t(t(a(S,N),a(O,M)),_)),T=l(t(a(S,S),a(O,O)));return i(E,T)}function w(N,M,S,O,_,E,T,R,L){var H=[n(a(n(_,M),L),a(n(E,S),R)),n(a(n(E,S),T),a(n(O,N),L)),n(a(n(O,N),R),a(n(_,M),T))];H=l(t(t(a(H[0],H[0]),a(H[1],H[1])),a(H[2],H[2])));var V=l(t(t(a(T,T),a(R,R)),a(L,L)));return i(H,V)}function C(N,M){for(var S=N.length,O=0,_=0,E=0;E{var{typed:r,config:t,abs:n,add:a,addScalar:i,matrix:s,multiply:l,multiplyScalar:c,divideScalar:o,subtract:u,smaller:m,equalScalar:d,flatten:h,isZero:y,isNumeric:v}=e;return r("intersect",{"Array, Array, Array":x,"Array, Array, Array, Array":w,"Matrix, Matrix, Matrix":function(R,L,H){var V=x(R.valueOf(),L.valueOf(),H.valueOf());return V===null?null:s(V)},"Matrix, Matrix, Matrix, Matrix":function(R,L,H,V){var W=w(R.valueOf(),L.valueOf(),H.valueOf(),V.valueOf());return W===null?null:s(W)}});function x(T,R,L){if(T=C(T),R=C(R),L=C(L),!N(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!M(L))throw new TypeError("Array with 4 numbers expected as third argument");return E(T[0],T[1],T[2],R[0],R[1],R[2],L[0],L[1],L[2],L[3])}function w(T,R,L,H){if(T=C(T),R=C(R),L=C(L),H=C(H),T.length===2){if(!b(T))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(R))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(L))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(H))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return S(T,R,L,H)}else if(T.length===3){if(!N(T))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!N(L))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!N(H))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return _(T[0],T[1],T[2],R[0],R[1],R[2],L[0],L[1],L[2],H[0],H[1],H[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function C(T){return T.length===1?T[0]:T.length>1&&Array.isArray(T[0])&&T.every(R=>Array.isArray(R)&&R.length===1)?h(T):T}function b(T){return T.length===2&&v(T[0])&&v(T[1])}function N(T){return T.length===3&&v(T[0])&&v(T[1])&&v(T[2])}function M(T){return T.length===4&&v(T[0])&&v(T[1])&&v(T[2])&&v(T[3])}function S(T,R,L,H){var V=T,W=L,k=u(V,R),q=u(W,H),K=u(c(k[0],q[1]),c(q[0],k[1]));if(y(K)||m(n(K),t.epsilon))return null;var z=c(q[0],V[1]),oe=c(q[1],V[0]),le=c(q[0],W[1]),ae=c(q[1],W[0]),$=o(i(u(u(z,oe),le),ae),K);return a(l(k,$),V)}function O(T,R,L,H,V,W,k,q,K,z,oe,le){var ae=c(u(T,R),u(L,H)),$=c(u(V,W),u(k,q)),me=c(u(K,z),u(oe,le));return i(i(ae,$),me)}function _(T,R,L,H,V,W,k,q,K,z,oe,le){var ae=O(T,k,z,k,R,q,oe,q,L,K,le,K),$=O(z,k,H,T,oe,q,V,R,le,K,W,L),me=O(T,k,H,T,R,q,V,R,L,K,W,L),Ee=O(z,k,z,k,oe,q,oe,q,le,K,le,K),pe=O(H,T,H,T,V,R,V,R,W,L,W,L),ge=u(c(ae,$),c(me,Ee)),Se=u(c(pe,Ee),c($,$));if(y(Se))return null;var ye=o(ge,Se),be=o(i(ae,c(ye,$)),Ee),De=i(T,c(ye,u(H,T))),Ae=i(R,c(ye,u(V,R))),We=i(L,c(ye,u(W,L))),Je=i(k,c(be,u(z,k))),J=i(q,c(be,u(oe,q))),re=i(K,c(be,u(le,K)));return d(De,Je)&&d(Ae,J)&&d(We,re)?[De,Ae,We]:null}function E(T,R,L,H,V,W,k,q,K,z){var oe=c(T,k),le=c(H,k),ae=c(R,q),$=c(V,q),me=c(L,K),Ee=c(W,K),pe=u(u(u(z,oe),ae),me),ge=u(u(u(i(i(le,$),Ee),oe),ae),me),Se=o(pe,ge),ye=i(T,c(Se,u(H,T))),be=i(R,c(Se,u(V,R))),De=i(L,c(Se,u(W,L)));return[ye,be,De]}});var gB="sum",qG=["typed","config","add","numeric"],nf=F(gB,qG,e=>{var{typed:r,config:t,add:n,numeric:a}=e;return r(gB,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":s,"...":function(c){if(Pa(c))throw new TypeError("Scalar values expected in function sum");return i(c)}});function i(l){var c;return An(l,function(o){try{c=c===void 0?o:n(c,o)}catch(u){throw Et(u,"sum",o)}}),c===void 0&&(c=a(0,t.number)),typeof c=="string"&&(c=a(c,t.number)),c}function s(l,c){try{var o=ko(l,c,n);return o}catch(u){throw Et(u,"sum")}}});var Eg="cumsum",kG=["typed","add","unaryPlus"],af=F(Eg,kG,e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(Eg,{Array:a,Matrix:function(o){return o.create(a(o.valueOf()))},"Array, number | BigNumber":s,"Matrix, number | BigNumber":function(o,u){return o.create(s(o.valueOf(),u))},"...":function(o){if(Pa(o))throw new TypeError("All values expected to be scalar in function cumsum");return a(o)}});function a(c){try{return i(c)}catch(o){throw Et(o,Eg)}}function i(c){if(c.length===0)return[];for(var o=[n(c[0])],u=1;u=u.length)throw new tn(o,u.length);try{return l(c,o)}catch(m){throw Et(m,Eg)}}function l(c,o){var u,m,d;if(o<=0){var h=c[0][0];if(Array.isArray(h)){for(d=Jm(c),m=[],u=0;u{var{typed:r,add:t,divide:n}=e;return r(yB,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":a,"...":function(l){if(Pa(l))throw new TypeError("Scalar values expected in function mean");return i(l)}});function a(s,l){try{var c=ko(s,l,t),o=Array.isArray(s)?ur(s):s.size();return n(c,o[l])}catch(u){throw Et(u,"mean")}}function i(s){var l,c=0;if(An(s,function(o){try{l=l===void 0?o:t(l,o),c++}catch(u){throw Et(u,"mean",o)}}),c===0)throw new Error("Cannot calculate the mean of an empty array");return n(l,c)}});var xB="median",zG=["typed","add","divide","compare","partitionSelect"],Tg=F(xB,zG,e=>{var{typed:r,add:t,divide:n,compare:a,partitionSelect:i}=e;function s(o){try{o=gr(o.valueOf());var u=o.length;if(u===0)throw new Error("Cannot calculate median of an empty array");if(u%2===0){for(var m=u/2-1,d=i(o,m+1),h=o[m],y=0;y0&&(h=o[y]);return c(h,d)}else{var v=i(o,(u-1)/2);return l(v)}}catch(x){throw Et(x,"median")}}var l=r({"number | BigNumber | Complex | Unit":function(u){return u}}),c=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(u,m){return n(t(u,m),2)}});return r(xB,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(u,m){throw new Error("median(A, dim) is not yet supported")},"...":function(u){if(Pa(u))throw new TypeError("Scalar values expected in function median");return s(u)}})});var bB="mad",UG=["typed","abs","map","median","subtract"],Fg=F(bB,UG,e=>{var{typed:r,abs:t,map:n,median:a,subtract:i}=e;return r(bB,{"Array | Matrix":s,"...":function(c){return s(c)}});function s(l){if(l=gr(l.valueOf()),l.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var c=a(l);return a(n(l,function(o){return t(i(o,c))}))}catch(o){throw o instanceof TypeError&&o.message.indexOf("median")!==-1?new TypeError(o.message.replace("median","mad")):Et(o,"mad")}}});var ND="unbiased",wB="variance",WG=["typed","add","subtract","multiply","divide","apply","isNaN"],sf=F(wB,WG,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:l}=e;return r(wB,{"Array | Matrix":function(m){return c(m,ND)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(m,d){return o(m,d,ND)},"Array | Matrix, number | BigNumber, string":o,"...":function(m){return c(m,ND)}});function c(u,m){var d,h=0;if(u.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(An(u,function(x){try{d=d===void 0?x:t(d,x),h++}catch(w){throw Et(w,"variance",x)}}),h===0)throw new Error("Cannot calculate variance of an empty array");var y=i(d,h);if(d=void 0,An(u,function(x){var w=n(x,y);d=d===void 0?a(w,w):t(d,a(w,w))}),l(d))return d;switch(m){case"uncorrected":return i(d,h);case"biased":return i(d,h+1);case"unbiased":{var v=rr(d)?d.mul(0):0;return h===1?v:i(d,h-1)}default:throw new Error('Unknown normalization "'+m+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function o(u,m,d){try{if(u.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return s(u,m,h=>c(h,d))}catch(h){throw Et(h,"variance")}}});var DB="quantileSeq",YG=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],uf=F(DB,YG,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:l,compare:c,isInteger:o,smaller:u,smallerEq:m,larger:d}=e,h=Lo({typed:r,isInteger:o});return r(DB,{"Array | Matrix, number | BigNumber":(C,b)=>v(C,b,!1),"Array | Matrix, number | BigNumber, number":(C,b,N)=>y(C,b,!1,N,v),"Array | Matrix, number | BigNumber, boolean":v,"Array | Matrix, number | BigNumber, boolean, number":(C,b,N,M)=>y(C,b,N,M,v),"Array | Matrix, Array | Matrix":(C,b)=>x(C,b,!1),"Array | Matrix, Array | Matrix, number":(C,b,N)=>y(C,b,!1,N,x),"Array | Matrix, Array | Matrix, boolean":x,"Array | Matrix, Array | Matrix, boolean, number":(C,b,N,M)=>y(C,b,N,M,x)});function y(C,b,N,M,S){return h(C,M,O=>S(O,b,N))}function v(C,b,N){var M,S=C.valueOf();if(u(b,0))throw new Error("N/prob must be non-negative");if(m(b,1))return sr(b)?w(S,b,N):t(w(S,b,N));if(d(b,1)){if(!o(b))throw new Error("N must be a positive integer");if(d(b,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var O=n(b,1);M=[];for(var _=0;u(_,b);_++){var E=i(_+1,O);M.push(w(S,E,N))}return sr(b)?M:t(M)}}function x(C,b,N){for(var M=C.valueOf(),S=b.valueOf(),O=[],_=0;_0&&(T=M[L])}return n(s(T,a(1,E)),s(R,E))}});var SB="std",HG=["typed","map","sqrt","variance"],ff=F(SB,HG,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e;return r(SB,{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(l){return i(l)}});function i(s,l){if(s.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var c=a.apply(null,arguments);return Nt(c)?t(c,n):n(c)}catch(o){throw o instanceof TypeError&&o.message.indexOf(" variance")!==-1?new TypeError(o.message.replace(" variance"," std")):o}}});var NB="corr",$G=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],_g=F(NB,$G,e=>{var{typed:r,matrix:t,sqrt:n,sum:a,add:i,subtract:s,multiply:l,pow:c,divide:o}=e;return r(NB,{"Array, Array":function(h,y){return u(h,y)},"Matrix, Matrix":function(h,y){var v=u(h.toArray(),y.toArray());return Array.isArray(v)?t(v):v}});function u(d,h){var y=[];if(Array.isArray(d[0])&&Array.isArray(h[0])){if(d.length!==h.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var v=0;vi(S,l(O,h[_])),0),C=a(d.map(S=>c(S,2))),b=a(h.map(S=>c(S,2))),N=s(l(y,w),l(v,x)),M=n(l(s(l(y,C),c(v,2)),s(l(y,b),c(x,2))));return o(N,M)}});var AB="combinations",GG=["typed"],Og=F(AB,GG,e=>{var{typed:r}=e;return r(AB,{"number, number":qw,"BigNumber, BigNumber":function(n,a){var i=n.constructor,s,l,c=n.minus(a),o=new i(1);if(!MB(n)||!MB(a))throw new TypeError("Positive integer value expected in function combinations");if(a.gt(n))throw new TypeError("k must be less than n in function combinations");if(s=o,a.lt(c))for(l=o;l.lte(c);l=l.plus(o))s=s.times(a.plus(l)).dividedBy(l);else for(l=o;l.lte(a);l=l.plus(o))s=s.times(c.plus(l)).dividedBy(l);return s}})});function MB(e){return e.isInteger()&&e.gte(0)}var CB="combinationsWithRep",VG=["typed"],Bg=F(CB,VG,e=>{var{typed:r}=e;return r(CB,{"number, number":function(n,a){if(!Ze(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(a{var{typed:r,config:t,multiplyScalar:n,pow:a,BigNumber:i,Complex:s}=e;function l(o){if(o.im===0)return Fc(o.re);if(o.re<.5){var u=new s(1-o.re,-o.im),m=new s(Math.PI*o.re,Math.PI*o.im);return new s(Math.PI).div(m.sin()).div(l(u))}o=new s(o.re-1,o.im);for(var d=new s(Fs[0],0),h=1;h2;)d-=2,y+=d,h=h.times(y);return new i(h.toPrecision(i.precision))}});var FB="lgamma",QG=["Complex","typed"],Ig=F(FB,QG,e=>{var{Complex:r,typed:t}=e,n=7,a=7,i=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(FB,{number:_c,Complex:s,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function s(o){var u=6.283185307179586,m=1.1447298858494002,d=.1;if(o.isNaN())return new r(NaN,NaN);if(o.im===0)return new r(_c(o.re),0);if(o.re>=n||Math.abs(o.im)>=a)return l(o);if(o.re<=d){var h=sM(u,o.im)*Math.floor(.5*o.re+.25),y=o.mul(Math.PI).sin().log(),v=s(new r(1-o.re,-o.im));return new r(m,h).sub(y).sub(v)}else return o.im>=0?c(o):c(o.conjugate()).conjugate()}function l(o){for(var u=o.sub(.5).mul(o.log()).sub(o).add(Hw),m=new r(1,0).div(o),d=m.div(o),h=i[0],y=i[1],v=2*d.re,x=d.re*d.re+d.im*d.im,w=2;w<8;w++){var C=y;y=-x*h+i[w],h=v*h+C}var b=m.mul(d.mul(h).add(y));return u.add(b)}function c(o){var u=0,m=0,d=o;for(o=o.add(1);o.re<=n;){d=d.mul(o);var h=d.im<0?1:0;h!==0&&m===0&&u++,m=h,o=o.add(1)}return l(o).sub(d.log()).sub(new r(0,u*2*Math.PI*1))}});var _B="factorial",XG=["typed","gamma"],Rg=F(_B,XG,e=>{var{typed:r,gamma:t}=e;return r(_B,{number:function(a){if(a<0)throw new Error("Value must be non-negative");return t(a+1)},BigNumber:function(a){if(a.isNegative())throw new Error("Value must be non-negative");return t(a.plus(1))},"Array | Matrix":r.referToSelf(n=>a=>je(a,n))})});var OB="kldivergence",JG=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],qg=F(OB,JG,e=>{var{typed:r,matrix:t,divide:n,sum:a,multiply:i,map:s,dotDivide:l,log:c,isNumeric:o}=e;return r(OB,{"Array, Array":function(d,h){return u(t(d),t(h))},"Matrix, Array":function(d,h){return u(d,t(h))},"Array, Matrix":function(d,h){return u(t(d),h)},"Matrix, Matrix":function(d,h){return u(d,h)}});function u(m,d){var h=d.size().length,y=m.size().length;if(h>1)throw new Error("first object must be one dimensional");if(y>1)throw new Error("second object must be one dimensional");if(h!==y)throw new Error("Length of two vectors must be equal");var v=a(m);if(v===0)throw new Error("Sum of elements in first object must be non zero");var x=a(d);if(x===0)throw new Error("Sum of elements in second object must be non zero");var w=n(m,a(m)),C=n(d,a(d)),b=a(i(w,s(l(w,C),N=>c(N))));return o(b)?b:Number.NaN}});var BB="multinomial",KG=["typed","add","divide","multiply","factorial","isInteger","isPositive"],kg=F(BB,KG,e=>{var{typed:r,add:t,divide:n,multiply:a,factorial:i,isInteger:s,isPositive:l}=e;return r(BB,{"Array | Matrix":function(o){var u=0,m=1;return An(o,function(d){if(!s(d)||!l(d))throw new TypeError("Positive integer value expected in function multinomial");u=t(u,d),m=a(m,i(d))}),n(i(u),m)}})});var PB="permutations",jG=["typed","factorial"],Lg=F(PB,jG,e=>{var{typed:r,factorial:t}=e;return r(PB,{"number | BigNumber":t,"number, number":function(a,i){if(!Ze(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(!Ze(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(i>a)throw new TypeError("second argument k must be less than or equal to first argument n");return va(a-i+1,a)},"BigNumber, BigNumber":function(a,i){var s,l;if(!IB(a)||!IB(i))throw new TypeError("Positive integer value expected in function permutations");if(i.gt(a))throw new TypeError("second argument k must be less than or equal to first argument n");var c=a.mul(0).add(1);for(s=c,l=a.minus(i).plus(1);l.lte(a);l=l.plus(1))s=s.times(l);return s}})});function IB(e){return e.isInteger()&&e.gte(0)}var _D=ma(KB(),1),oV=(0,_D.default)(Date.now());function no(e){var r;function t(a){r=a===null?oV:(0,_D.default)(String(a))}t(e);function n(){return r()}return n}var jB="pickRandom",sV=["typed","config","?on"],Ug=F(jB,sV,e=>{var{typed:r,config:t,on:n}=e,a=no(t.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(a=no(s.randomSeed))}),r(jB,{"Array | Matrix":function(l){return i(l,{})},"Array | Matrix, Object":function(l,c){return i(l,c)},"Array | Matrix, number":function(l,c){return i(l,{number:c})},"Array | Matrix, Array | Matrix":function(l,c){return i(l,{weights:c})},"Array | Matrix, Array | Matrix, number":function(l,c,o){return i(l,{number:o,weights:c})},"Array | Matrix, number, Array | Matrix":function(l,c,o){return i(l,{number:c,weights:o})}});function i(s,l){var{number:c,weights:o,elementWise:u=!0}=l,m=typeof c>"u";m&&(c=1);var d=Qe(s)?s.create:Qe(o)?o.create:null;s=s.valueOf(),o&&(o=o.valueOf()),u===!0&&(s=gr(s),o=gr(o));var h=0;if(typeof o<"u"){if(o.length!==s.length)throw new Error("Weights must have the same length as possibles");for(var y=0,v=o.length;y"u")C=s[Math.floor(a()*x)];else for(var b=a()*h,N=0,M=s.length;N1)for(var n=0,a=e.shift();n{var{typed:r,config:t,on:n}=e,a=no(t.randomSeed);return n&&n("config",function(l,c){l.randomSeed!==c.randomSeed&&(a=no(l.randomSeed))}),r(eP,{"":()=>s(0,1),number:l=>s(0,l),"number, number":(l,c)=>s(l,c),"Array | Matrix":l=>i(l,0,1),"Array | Matrix, number":(l,c)=>i(l,0,c),"Array | Matrix, number, number":(l,c,o)=>i(l,c,o)});function i(l,c,o){var u=Rc(l.valueOf(),()=>s(c,o));return Qe(l)?l.create(u):u}function s(l,c){return l+a()*(c-l)}});var rP="randomInt",fV=["typed","config","?on"],Yg=F(rP,fV,e=>{var{typed:r,config:t,on:n}=e,a=no(t.randomSeed);return n&&n("config",function(l,c){l.randomSeed!==c.randomSeed&&(a=no(l.randomSeed))}),r(rP,{"":()=>s(0,1),number:l=>s(0,l),"number, number":(l,c)=>s(l,c),"Array | Matrix":l=>i(l,0,1),"Array | Matrix, number":(l,c)=>i(l,0,c),"Array | Matrix, number, number":(l,c,o)=>i(l,c,o)});function i(l,c,o){var u=Rc(l.valueOf(),()=>s(c,o));return Qe(l)?l.create(u):u}function s(l,c){return Math.floor(l+a()*(c-l))}});var tP="stirlingS2",cV=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],Hg=F(tP,cV,e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:a,divideScalar:i,pow:s,factorial:l,combinations:c,isNegative:o,isInteger:u,number:m,bignumber:d,larger:h}=e,y=[],v=[];return r(tP,{"number | BigNumber, number | BigNumber":function(w,C){if(!u(w)||o(w)||!u(C)||o(C))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(h(C,w))throw new TypeError("k must be less than or equal to n in function stirlingS2");var b=!(sr(w)&&sr(C)),N=b?v:y,M=b?d:m,S=m(w),O=m(C);if(N[S]&&N[S].length>O)return N[S][O];for(var _=0;_<=S;++_)if(N[_]||(N[_]=[M(_===0?1:0)]),_!==0)for(var E=N[_],T=N[_-1],R=E.length;R<=_&&R<=O;++R)R===_?E[R]=1:E[R]=t(a(M(R),T[R]),T[R-1]);return N[S][O]}})});var nP="bellNumbers",lV=["typed","addScalar","isNegative","isInteger","stirlingS2"],$g=F(nP,lV,e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:a,stirlingS2:i}=e;return r(nP,{"number | BigNumber":function(l){if(!a(l)||n(l))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var c=0,o=0;o<=l;o++)c=t(c,i(l,o));return c}})});var aP="catalan",mV=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Gg=F(aP,mV,e=>{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:a,combinations:i,isNegative:s,isInteger:l}=e;return r(aP,{"number | BigNumber":function(o){if(!l(o)||s(o))throw new TypeError("Non-negative integer value expected in function catalan");return n(i(a(o,2),o),t(o,1))}})});var iP="composition",pV=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Vg=F(iP,pV,e=>{var{typed:r,addScalar:t,combinations:n,isPositive:a,isNegative:i,isInteger:s,larger:l}=e;return r(iP,{"number | BigNumber, number | BigNumber":function(o,u){if(!s(o)||!a(o)||!s(u)||!a(u))throw new TypeError("Positive integer value expected in function composition");if(l(u,o))throw new TypeError("k must be less than or equal to n in function composition");return n(t(o,-1),t(u,-1))}})});var oP="leafCount",dV=["parse","typed"],Zg=F(oP,dV,e=>{var{parse:r,typed:t}=e;function n(a){var i=0;return a.forEach(s=>{i+=n(s)}),i||1}return t(oP,{Node:function(i){return n(i)}})});function OD(e){return xr(e)||ct(e)&&e.isUnary()&&xr(e.args[0])}function qc(e){return!!(xr(e)||(yn(e)||ct(e))&&e.args.every(qc)||en(e)&&qc(e.content))}function sP(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function BD(e){for(var r=1;r{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,a=!0,i=!1,s="defaultF",l={add:{trivial:a,total:a,commutative:a,associative:a},unaryPlus:{trivial:a,total:a,commutative:a,associative:a},subtract:{trivial:i,total:a,commutative:i,associative:i},multiply:{trivial:a,total:a,commutative:a,associative:a},divide:{trivial:i,total:a,commutative:i,associative:i},paren:{trivial:a,total:a,commutative:a,associative:i},defaultF:{trivial:i,total:a,commutative:i,associative:i}},c={divide:{total:i},log:{total:i}},o={subtract:{total:i},abs:{trivial:a},log:{total:a}};function u(b,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l,S=s;if(typeof b=="string"?S=b:ct(b)?S=b.fn.toString():yn(b)?S=b.name:en(b)&&(S="paren"),Xe(M,S)){var O=M[S];if(Xe(O,N))return O[N];if(Xe(l,S))return l[S][N]}if(Xe(M,s)){var _=M[s];return Xe(_,N)?_[N]:l[s][N]}if(Xe(l,S)){var E=l[S];if(Xe(E,N))return E[N]}return l[s][N]}function m(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return u(b,"commutative",N)}function d(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return u(b,"associative",N)}function h(b,N){var M=BD({},b);for(var S in N)Xe(b,S)?M[S]=BD(BD({},N[S]),b[S]):M[S]=N[S];return M}function y(b,N){if(!b.args||b.args.length===0)return b;b.args=v(b,N);for(var M=0;M2&&d(b,N)){for(var _=b.args.pop();b.args.length>0;)_=M([b.args.pop(),_]);b.args=_.args}}}function w(b,N){if(!(!b.args||b.args.length===0)){for(var M=C(b),S=b.args.length,O=0;O2&&d(b,N)){for(var _=b.args.shift();b.args.length>0;)_=M([_,b.args.shift()]);b.args=_.args}}}function C(b){return ct(b)?function(N){try{return new t(b.op,b.fn,N,b.implicit)}catch(M){return console.error(M),[]}}:function(N){return new r(new n(b.name),N)}}return{createMakeNodeFunction:C,hasProperty:u,isCommutative:m,isAssociative:d,mergeContext:h,flatten:y,allChildren:v,unflattenr:x,unflattenl:w,defaultContext:l,realContext:c,positiveContext:o}});var gV="simplify",yV=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Qg=F(gV,yV,e=>{var{config:r,typed:t,parse:n,add:a,subtract:i,multiply:s,divide:l,pow:c,isZero:o,equal:u,resolve:m,simplifyConstant:d,simplifyCore:h,fraction:y,bignumber:v,mathWithTransform:x,matrix:w,AccessorNode:C,ArrayNode:b,ConstantNode:N,FunctionNode:M,IndexNode:S,ObjectNode:O,OperatorNode:_,ParenthesisNode:E,SymbolNode:T}=e,{hasProperty:R,isCommutative:L,isAssociative:H,mergeContext:V,flatten:W,unflattenr:k,unflattenl:q,createMakeNodeFunction:K,defaultContext:z,realContext:oe,positiveContext:le}=cf({FunctionNode:M,OperatorNode:_,SymbolNode:T});t.addConversion({from:"Object",to:"Map",convert:ji});var ae=t("simplify",{Node:ye,"Node, Map":(j,ne)=>ye(j,!1,ne),"Node, Map, Object":(j,ne,ue)=>ye(j,!1,ne,ue),"Node, Array":ye,"Node, Array, Map":ye,"Node, Array, Map, Object":ye});t.removeConversion({from:"Object",to:"Map",convert:ji}),ae.defaultContext=z,ae.realContext=oe,ae.positiveContext=le;function $(j){return j.transform(function(ne,ue,Me){return en(ne)?$(ne.content):ne})}var me={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};ae.rules=[h,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},d,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},d,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function Ee(j,ne){var ue={};if(j.s){var Me=j.s.split("->");if(Me.length===2)ue.l=Me[0],ue.r=Me[1];else throw SyntaxError("Could not parse rule: "+j.s)}else ue.l=j.l,ue.r=j.r;ue.l=$(n(ue.l)),ue.r=$(n(ue.r));for(var Ce of["imposeContext","repeat","assuming"])Ce in j&&(ue[Ce]=j[Ce]);if(j.evaluate&&(ue.evaluate=n(j.evaluate)),H(ue.l,ne)){var Le=!L(ue.l,ne),Ie;Le&&(Ie=Se());var fr=K(ue.l),or=Se();ue.expanded={},ue.expanded.l=fr([ue.l,or]),W(ue.expanded.l,ne),k(ue.expanded.l,ne),ue.expanded.r=fr([ue.r,or]),Le&&(ue.expandedNC1={},ue.expandedNC1.l=fr([Ie,ue.l]),ue.expandedNC1.r=fr([Ie,ue.r]),ue.expandedNC2={},ue.expandedNC2.l=fr([Ie,ue.expanded.l]),ue.expandedNC2.r=fr([Ie,ue.expanded.r]))}return ue}function pe(j,ne){for(var ue=[],Me=0;Me2&&arguments[2]!==void 0?arguments[2]:Bo(),Me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ce=Me.consoleDebug;ne=pe(ne||ae.rules,Me.context);var Le=m(j,ue);Le=$(Le);for(var Ie={},fr=Le.toString({parenthesis:"all"});!Ie[fr];){Ie[fr]=!0,ge=0;var or=fr;Ce&&console.log("Working on: ",fr);for(var Ke=0;Ke ").concat(ne[Ke].r.toString()))),Ce){var ee=Le.toString({parenthesis:"all"});ee!==or&&(console.log("Applying",Pr,"produced",ee),or=ee)}q(Le,Me.context)}fr=Le.toString({parenthesis:"all"})}return Le}function be(j,ne,ue){var Me=j;if(j)for(var Ce=0;Ce1&&(or=Le(j.args.slice(0,fr))),Ce=j.args.slice(fr),Me=Ce.length===1?Ce[0]:Le(Ce),ue.push(Le([or,Me]))}return ue}function We(j,ne){var ue={placeholders:{}};if(!j.placeholders&&!ne.placeholders)return ue;if(j.placeholders){if(!ne.placeholders)return j}else return ne;for(var Me in j.placeholders)if(Xe(j.placeholders,Me)&&(ue.placeholders[Me]=j.placeholders[Me],Xe(ne.placeholders,Me)&&!xe(j.placeholders[Me],ne.placeholders[Me])))return null;for(var Ce in ne.placeholders)Xe(ne.placeholders,Ce)&&(ue.placeholders[Ce]=ne.placeholders[Ce]);return ue}function Je(j,ne){var ue=[];if(j.length===0||ne.length===0)return ue;for(var Me,Ce=0;Ce2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var or=re(j.args[0],ne.args[1],ue);if(or.length===0)return[];var Ke=re(j.args[1],ne.args[0],ue);if(Ke.length===0)return[];Le=[or,Ke]}Ce=J(Le)}else if(ne.args.length>=2&&j.args.length===2){for(var Pr=Ae(ne,ue),ee=[],ce=0;ce2)throw Error("Unexpected non-binary associative function: "+j.toString());return[]}}else if(j instanceof T){if(j.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(me[j.name]){if(j.name!==ne.name)return[]}else switch(j.name[1]>="a"&&j.name[1]<="z"?j.name.substring(0,2):j.name[0]){case"n":case"_p":Ce[0].placeholders[j.name]=ne;break;case"c":case"cl":if(xr(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"v":if(!xr(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"vl":if(at(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"cd":if(OD(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"vd":if(!OD(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"ce":if(qc(ne))Ce[0].placeholders[j.name]=ne;else return[];break;case"ve":if(!qc(ne))Ce[0].placeholders[j.name]=ne;else return[];break;default:throw new Error("Invalid symbol in rule: "+j.name)}}else if(j instanceof N){if(!u(j.value,ne.value))return[]}else return[];return Ce}function xe(j,ne){if(j instanceof N&&ne instanceof N){if(!u(j.value,ne.value))return!1}else if(j instanceof T&&ne instanceof T){if(j.name!==ne.name)return!1}else if(j instanceof _&&ne instanceof _||j instanceof M&&ne instanceof M){if(j instanceof _){if(j.op!==ne.op||j.fn!==ne.fn)return!1}else if(j instanceof M&&j.name!==ne.name)return!1;if(j.args.length!==ne.args.length)return!1;for(var ue=0;ue{var{typed:r,config:t,mathWithTransform:n,matrix:a,fraction:i,bignumber:s,AccessorNode:l,ArrayNode:c,ConstantNode:o,FunctionNode:u,IndexNode:m,ObjectNode:d,OperatorNode:h,SymbolNode:y}=e,{isCommutative:v,isAssociative:x,allChildren:w,createMakeNodeFunction:C}=cf({FunctionNode:u,OperatorNode:h,SymbolNode:y}),b=r("simplifyConstant",{Node:W=>O(V(W,{})),"Node, Object":function(k,q){return O(V(k,q))}});function N(W){return da(W)?W.valueOf():W instanceof Array?W.map(N):Qe(W)?a(N(W.valueOf())):W}function M(W,k,q){try{return n[W].apply(null,k)}catch{return k=k.map(N),E(n[W].apply(null,k),q)}}var S=r({Fraction:R,number:function(k){return k<0?T(new o(-k)):new o(k)},BigNumber:function(k){return k<0?T(new o(-k)):new o(k)},Complex:function(k){throw new Error("Cannot convert Complex number to Node")},string:function(k){return new o(k)},Matrix:function(k){return new c(k.valueOf().map(q=>S(q)))}});function O(W){return Nr(W)?W:S(W)}function _(W,k){var q=k&&k.exactFractions!==!1;if(q&&isFinite(W)&&i){var K=i(W),z=k&&typeof k.fractionsLimit=="number"?k.fractionsLimit:1/0;if(K.valueOf()===W&&K.n0;)if(xr(K[0])&&typeof K[0].value!="string"){var z=E(K.shift().value,q);jt(W)?W=W.items[z-1]:(W=W.valueOf()[z-1],W instanceof Array&&(W=a(W)))}else if(K.length>1&&xr(K[1])&&typeof K[1].value!="string"){var oe=E(K[1].value,q),le=[],ae=jt(W)?W.items:W.valueOf();for(var $ of ae)if(jt($))le.push($.items[oe-1]);else if(Qe(W))le.push($[oe-1]);else break;if(le.length===ae.length)jt(W)?W=new c(le):W=a(le),K.splice(1,1);else break}else break;return K.length===k.dimensions.length?new l(O(W),k):K.length>0?(k=new m(K),new l(O(W),k)):W}if(Ei(W)&&k.dimensions.length===1&&xr(k.dimensions[0])){var me=k.dimensions[0].value;return me in W.properties?W.properties[me]:new o}return new l(O(W),k)}function H(W,k,q,K){var z=k.shift(),oe=k.reduce((le,ae)=>{if(!Nr(ae)){var $=le.pop();if(Nr($))return[$,ae];try{return le.push(M(W,[$,ae],K)),le}catch{le.push($)}}le.push(O(le.pop()));var me=le.length===1?le[0]:q(le);return[q([me,O(ae)])]},[z]);return oe.length===1?oe[0]:q([oe[0],S(oe[1])])}function V(W,k){switch(W.type){case"SymbolNode":return W;case"ConstantNode":switch(typeof W.value){case"number":return E(W.value,k);case"string":return W.value;default:if(!isNaN(W.value))return E(W.value,k)}return W;case"FunctionNode":if(n[W.name]&&n[W.name].rawArgs)return W;{var q=["add","multiply"];if(q.indexOf(W.name)===-1){var K=W.args.map(De=>V(De,k));if(!K.some(Nr))try{return M(W.name,K,k)}catch{}if(W.name==="size"&&K.length===1&&jt(K[0])){for(var z=[],oe=K[0];jt(oe);)z.push(oe.items.length),oe=oe.items[0];return a(z)}return new u(W.name,K.map(O))}}case"OperatorNode":{var le=W.fn.toString(),ae,$,me=C(W);if(ct(W)&&W.isUnary())ae=[V(W.args[0],k)],Nr(ae[0])?$=me(ae):$=M(le,ae,k);else if(x(W,k.context))if(ae=w(W,k.context),ae=ae.map(De=>V(De,k)),v(le,k.context)){for(var Ee=[],pe=[],ge=0;ge1?($=H(le,Ee,me,k),pe.unshift($),$=H(le,pe,me,k)):$=H(le,ae,me,k)}else $=H(le,ae,me,k);else ae=W.args.map(De=>V(De,k)),$=H(le,ae,me,k);return $}case"ParenthesisNode":return V(W.content,k);case"AccessorNode":return L(V(W.object,k),V(W.index,k),k);case"ArrayNode":{var Se=W.items.map(De=>V(De,k));return Se.some(Nr)?new c(Se.map(O)):a(Se)}case"IndexNode":return new m(W.dimensions.map(De=>b(De,k)));case"ObjectNode":{var ye={};for(var be in W.properties)ye[be]=b(W.properties[be],k);return new d(ye)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(W.type))}}return b});var uP="simplifyCore",wV=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Jg=F(uP,wV,e=>{var{typed:r,parse:t,equal:n,isZero:a,add:i,subtract:s,multiply:l,divide:c,pow:o,AccessorNode:u,ArrayNode:m,ConstantNode:d,FunctionNode:h,IndexNode:y,ObjectNode:v,OperatorNode:x,ParenthesisNode:w,SymbolNode:C}=e,b=new d(0),N=new d(1),M=new d(!0),S=new d(!1);function O(R){return ct(R)&&["and","not","or"].includes(R.op)}var{hasProperty:_,isCommutative:E}=cf({FunctionNode:h,OperatorNode:x,SymbolNode:C});function T(R){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},H=L?L.context:void 0;if(_(R,"trivial",H)){if(yn(R)&&R.args.length===1)return T(R.args[0],L);var V=!1,W=0;if(R.forEach(pe=>{++W,W===1&&(V=T(pe,L))}),W===1)return V}var k=R;if(yn(k)){var q=iT(k.name);if(q){if(k.args.length>2&&_(k,"associative",H))for(;k.args.length>2;){var K=k.args.pop(),z=k.args.pop();k.args.push(new x(q,k.name,[K,z]))}k=new x(q,k.name,k.args)}else return new h(T(k.fn),k.args.map(pe=>T(pe,L)))}if(ct(k)&&k.isUnary()){var oe=T(k.args[0],L);if(k.op==="~"&&ct(oe)&&oe.isUnary()&&oe.op==="~"||k.op==="not"&&ct(oe)&&oe.isUnary()&&oe.op==="not"&&O(oe.args[0]))return oe.args[0];var le=!0;if(k.op==="-"&&ct(oe)&&(oe.isBinary()&&oe.fn==="subtract"&&(k=new x("-","subtract",[oe.args[1],oe.args[0]]),le=!1),oe.isUnary()&&oe.op==="-"))return oe.args[0];if(le)return new x(k.op,k.fn,[oe])}if(ct(k)&&k.isBinary()){var ae=T(k.args[0],L),$=T(k.args[1],L);if(k.op==="+"){if(xr(ae)&&a(ae.value))return $;if(xr($)&&a($.value))return ae;ct($)&&$.isUnary()&&$.op==="-"&&($=$.args[0],k=new x("-","subtract",[ae,$]))}if(k.op==="-")return ct($)&&$.isUnary()&&$.op==="-"?T(new x("+","add",[ae,$.args[0]]),L):xr(ae)&&a(ae.value)?T(new x("-","unaryMinus",[$])):xr($)&&a($.value)?ae:new x(k.op,k.fn,[ae,$]);if(k.op==="*"){if(xr(ae)){if(a(ae.value))return b;if(n(ae.value,1))return $}if(xr($)){if(a($.value))return b;if(n($.value,1))return ae;if(E(k,H))return new x(k.op,k.fn,[$,ae],k.implicit)}return new x(k.op,k.fn,[ae,$],k.implicit)}if(k.op==="/")return xr(ae)&&a(ae.value)?b:xr($)&&n($.value,1)?ae:new x(k.op,k.fn,[ae,$]);if(k.op==="^"&&xr($)){if(a($.value))return N;if(n($.value,1))return ae}if(k.op==="and"){if(xr(ae))if(ae.value){if(O($))return $;if(xr($))return $.value?M:S}else return S;if(xr($))if($.value){if(O(ae))return ae}else return S}if(k.op==="or"){if(xr(ae)){if(ae.value)return M;if(O($))return $}if(xr($)){if($.value)return M;if(O(ae))return ae}}return new x(k.op,k.fn,[ae,$])}if(ct(k))return new x(k.op,k.fn,k.args.map(pe=>T(pe,L)));if(jt(k))return new m(k.items.map(pe=>T(pe,L)));if(Ln(k))return new u(T(k.object,L),T(k.index,L));if(Jn(k))return new y(k.dimensions.map(pe=>T(pe,L)));if(Ei(k)){var me={};for(var Ee in k.properties)me[Ee]=T(k.properties[Ee],L);return new v(me)}return k}return r(uP,{Node:T,"Node,Object":T})});var DV="resolve",SV=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],Kg=F(DV,SV,e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:a,OperatorNode:i,ParenthesisNode:s}=e;function l(c,o){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!o)return c;if(at(c)){if(u.has(c.name)){var m=Array.from(u).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(m,"}"))}var d=o.get(c.name);if(Nr(d)){var h=new Set(u);return h.add(c.name),l(d,o,h)}else return typeof d=="number"?t(String(d)):d!==void 0?new n(d):c}else if(ct(c)){var y=c.args.map(function(x){return l(x,o,u)});return new i(c.op,c.fn,y,c.implicit)}else{if(en(c))return new s(l(c.content,o,u));if(yn(c)){var v=c.args.map(function(x){return l(x,o,u)});return new a(c.name,v)}}return c.map(x=>l(x,o,u))}return r("resolve",{Node:l,"Node, Map | null | undefined":l,"Node, Object":(c,o)=>l(c,ji(o)),"Array | Matrix":r.referToSelf(c=>o=>o.map(u=>c(u))),"Array | Matrix, null | undefined":r.referToSelf(c=>o=>o.map(u=>c(u))),"Array, Object":r.referTo("Array,Map",c=>(o,u)=>c(o,ji(u))),"Matrix, Object":r.referTo("Matrix,Map",c=>(o,u)=>c(o,ji(u))),"Array | Matrix, Map":r.referToSelf(c=>(o,u)=>o.map(m=>c(m,u)))})});var fP="symbolicEqual",NV=["parse","simplify","typed","OperatorNode"],jg=F(fP,NV,e=>{var{parse:r,simplify:t,typed:n,OperatorNode:a}=e;function i(s,l){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=new a("-","subtract",[s,l]),u=t(o,{},c);return xr(u)&&!u.value}return n(fP,{"Node, Node":i,"Node, Node, Object":i})});var cP="derivative",AV=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],e0=F(cP,AV,e=>{var{typed:r,config:t,parse:n,simplify:a,equal:i,isZero:s,numeric:l,ConstantNode:c,FunctionNode:o,OperatorNode:u,ParenthesisNode:m,SymbolNode:d}=e;function h(b,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},S={};x(S,b,N.name);var O=w(b,S);return M.simplify?a(O):O}r.addConversion({from:"identifier",to:"SymbolNode",convert:n});var y=r(cP,{"Node, SymbolNode":h,"Node, SymbolNode, Object":h});r.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),y._simplify=!0,y.toTex=function(b){return v.apply(null,b.args)};var v=r("_derivTex",{"Node, SymbolNode":function(N,M){return xr(N)&&Tr(N.value)==="string"?v(n(N.value).toString(),M.toString(),1):v(N.toTex(),M.toString(),1)},"Node, ConstantNode":function(N,M){if(Tr(M.value)==="string")return v(N,n(M.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(N,M,S){return v(N.toString(),M.name,S.value)},"string, string, number":function(N,M,S){var O;return S===1?O="{d\\\\over d"+M+"}":O="{d^{"+S+"}\\\\over d"+M+"^{"+S+"}}",O+"\\\\left[".concat(N,"\\\\right]")}}),x=r("constTag",{"Object, ConstantNode, string":function(N,M){return N[M]=!0,!0},"Object, SymbolNode, string":function(N,M,S){return M.name!==S?(N[M]=!0,!0):!1},"Object, ParenthesisNode, string":function(N,M,S){return x(N,M.content,S)},"Object, FunctionAssignmentNode, string":function(N,M,S){return M.params.indexOf(S)===-1?(N[M]=!0,!0):x(N,M.expr,S)},"Object, FunctionNode | OperatorNode, string":function(N,M,S){if(M.args.length>0){for(var O=x(N,M.args[0],S),_=1;_0){var O=N.args.filter(function(W){return M[W]===void 0}),_=O.length===1?O[0]:new u("*","multiply",O),E=S.concat(w(_,M));return new u("*","multiply",E)}return new u("+","add",N.args.map(function(W){return new u("*","multiply",N.args.map(function(k){return k===W?w(k,M):k.clone()}))}))}if(N.op==="/"&&N.isBinary()){var T=N.args[0],R=N.args[1];return M[R]!==void 0?new u("/","divide",[w(T,M),R]):M[T]!==void 0?new u("*","multiply",[new u("-","unaryMinus",[T]),new u("/","divide",[w(R,M),new u("^","pow",[R.clone(),C(2)])])]):new u("/","divide",[new u("-","subtract",[new u("*","multiply",[w(T,M),R.clone()]),new u("*","multiply",[T.clone(),w(R,M)])]),new u("^","pow",[R.clone(),C(2)])])}if(N.op==="^"&&N.isBinary()){var L=N.args[0],H=N.args[1];if(M[L]!==void 0)return xr(L)&&(s(L.value)||i(L.value,1))?C(0):new u("*","multiply",[N,new u("*","multiply",[new o("log",[L.clone()]),w(H.clone(),M)])]);if(M[H]!==void 0){if(xr(H)){if(s(H.value))return C(0);if(i(H.value,1))return w(L,M)}var V=new u("^","pow",[L.clone(),new u("-","subtract",[H,C(1)])]);return new u("*","multiply",[H.clone(),new u("*","multiply",[w(L,M),V])])}return new u("*","multiply",[new u("^","pow",[L.clone(),H.clone()]),new u("+","add",[new u("*","multiply",[w(L,M),new u("/","divide",[H.clone(),L.clone()])]),new u("*","multiply",[w(H,M),new o("log",[L.clone()])])])])}throw new Error('Cannot process operator "'+N.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function C(b,N){return new c(l(b,N||t.number))}return y});var lP="rationalize",MV=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],r0=F(lP,MV,e=>{var{config:r,typed:t,equal:n,isZero:a,add:i,subtract:s,multiply:l,divide:c,pow:o,parse:u,simplifyConstant:m,simplifyCore:d,simplify:h,fraction:y,bignumber:v,mathWithTransform:x,matrix:w,AccessorNode:C,ArrayNode:b,ConstantNode:N,FunctionNode:M,IndexNode:S,ObjectNode:O,OperatorNode:_,SymbolNode:E,ParenthesisNode:T}=e;function R(k){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,z=H(),oe=L(k,q,!0,z.firstRules),le=oe.variables.length,ae={exactFractions:!1},$={exactFractions:!0};if(k=oe.expression,le>=1){k=V(k);var me,Ee,pe=!0,ge=!1;k=h(k,z.firstRules,{},ae);for(var Se;Ee=pe?z.distrDivRules:z.sucDivRules,k=h(k,Ee,{},$),pe=!pe,Se=k.toString(),Se!==me;)ge=!0,me=Se;ge&&(k=h(k,z.firstRulesAgain,{},ae)),k=h(k,z.finalRules,{},ae)}var ye=[],be={};return k.type==="OperatorNode"&&k.isBinary()&&k.op==="/"?(le===1&&(k.args[0]=W(k.args[0],ye),k.args[1]=W(k.args[1])),K&&(be.numerator=k.args[0],be.denominator=k.args[1])):(le===1&&(k=W(k,ye)),K&&(be.numerator=k,be.denominator=null)),K?(be.coefficients=ye,be.variables=oe.variables,be.expression=k,be):k}return t(lP,{Node:R,"Node, boolean":(k,q)=>R(k,{},q),"Node, Object":R,"Node, Object, boolean":R});function L(k,q,K,z){var oe=[],le=h(k,z,q,{exactFractions:!1});K=!!K;var ae="+-*"+(K?"/":"");me(le);var $={};return $.expression=le,$.variables=oe,$;function me(Ee){var pe=Ee.type;if(pe==="FunctionNode")throw new Error("There is an unsolved function call");if(pe==="OperatorNode")if(Ee.op==="^"){if(Ee.args[1].type!=="ConstantNode"||!Ze(parseFloat(Ee.args[1].value)))throw new Error("There is a non-integer exponent");me(Ee.args[0])}else{if(ae.indexOf(Ee.op)===-1)throw new Error("Operator "+Ee.op+" invalid in polynomial expression");for(var ge=0;ge1;if(z==="OperatorNode"&&k.isBinary()){var le=!1,ae;if(k.op==="^"&&(k.args[0].type==="ParenthesisNode"||k.args[0].type==="OperatorNode")&&k.args[1].type==="ConstantNode"&&(ae=parseFloat(k.args[1].value),le=ae>=2&&Ze(ae)),le){if(ae>2){var $=k.args[0],me=new _("^","pow",[k.args[0].cloneDeep(),new N(ae-1)]);k=new _("*","multiply",[$,me])}else k=new _("*","multiply",[k.args[0],k.args[0].cloneDeep()]);oe&&(K==="content"?q.content=k:q.args[K]=k)}}if(z==="ParenthesisNode")V(k.content,k,"content");else if(z!=="ConstantNode"&&z!=="SymbolNode")for(var Ee=0;Ee=0;$--)if(q[$]!==0){var me=new N(le?q[$]:Math.abs(q[$])),Ee=q[$]<0?"-":"+";if($>0){var pe=new E(oe);if($>1){var ge=new N($);pe=new _("^","pow",[pe,ge])}q[$]===-1&&le?me=new _("-","unaryMinus",[pe]):Math.abs(q[$])===1?me=pe:me=new _("*","multiply",[me,pe])}le?ae=me:Ee==="+"?ae=new _("+","add",[ae,me]):ae=new _("-","subtract",[ae,me]),le=!1}if(le)return new N(0);return ae;function Se(ye,be,De){var Ae=ye.type;if(Ae==="FunctionNode")throw new Error("There is an unsolved function call");if(Ae==="OperatorNode"){if("+-*^".indexOf(ye.op)===-1)throw new Error("Operator "+ye.op+" invalid");if(be!==null){if((ye.fn==="unaryMinus"||ye.fn==="pow")&&be.fn!=="add"&&be.fn!=="subtract"&&be.fn!=="multiply")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="multiply")&&be.fn!=="add"&&be.fn!=="subtract")throw new Error("Invalid "+ye.op+" placing");if((ye.fn==="subtract"||ye.fn==="add"||ye.fn==="unaryMinus")&&De.noFil!==0)throw new Error("Invalid "+ye.op+" placing")}(ye.op==="^"||ye.op==="*")&&(De.fire=ye.op);for(var We=0;Wez&&(q[Je]=0),q[Je]+=De.cte*(De.oper==="+"?1:-1),z=Math.max(Je,z);return}De.cte=Je,De.fire===""&&(q[0]+=De.cte*(De.oper==="+"?1:-1))}else throw new Error("Type "+Ae+" is not allowed")}}});var mP="zpk2tf",CV=["typed","add","multiply","Complex","number"],t0=F(mP,CV,e=>{var{typed:r,add:t,multiply:n,Complex:a,number:i}=e;return r(mP,{"Array,Array,number":function(o,u,m){return s(o,u,m)},"Array,Array":function(o,u){return s(o,u,1)},"Matrix,Matrix,number":function(o,u,m){return s(o.valueOf(),u.valueOf(),m)},"Matrix,Matrix":function(o,u){return s(o.valueOf(),u.valueOf(),1)}});function s(c,o,u){c.some(C=>C.type==="BigNumber")&&(c=c.map(C=>i(C))),o.some(C=>C.type==="BigNumber")&&(o=o.map(C=>i(C)));for(var m=[a(1,0)],d=[a(1,0)],h=0;h=0&&m-d{var{typed:r,add:t,multiply:n,Complex:a,divide:i,matrix:s}=e;return r(pP,{"Array, Array":function(u,m){var d=c(512);return l(u,m,d)},"Array, Array, Array":function(u,m,d){return l(u,m,d)},"Array, Array, number":function(u,m,d){if(d<0)throw new Error("w must be a positive number");var h=c(d);return l(u,m,h)},"Matrix, Matrix":function(u,m){var d=c(512),{w:h,h:y}=l(u.valueOf(),m.valueOf(),d);return{w:s(h),h:s(y)}},"Matrix, Matrix, Matrix":function(u,m,d){var{h}=l(u.valueOf(),m.valueOf(),d.valueOf());return{h:s(h),w:s(d)}},"Matrix, Matrix, number":function(u,m,d){if(d<0)throw new Error("w must be a positive number");var h=c(d),{h:y}=l(u.valueOf(),m.valueOf(),h);return{h:s(y),w:s(h)}}});function l(o,u,m){for(var d=[],h=[],y=0;y{var{classes:r}=e;return function(n,a){var i=r[a&&a.mathjs];return i&&typeof i.fromJSON=="function"?i.fromJSON(a):a}});var _V="replacer",OV=[],i0=F(_V,OV,()=>function(r,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var dP="12.4.1";var o0=F("true",[],()=>!0),s0=F("false",[],()=>!1),u0=F("null",[],()=>null),f0=ya("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1/0):1/0}),c0=ya("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(NaN):NaN}),l0=ya("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?Pc(t):ZM}),m0=ya("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?vE(t):QM}),p0=ya("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?dE(t):XM}),d0=ya("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?hE(t):JM}),h0=ya("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).ln():Math.LN2}),v0=ya("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(10).ln():Math.LN10}),g0=ya("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),y0=ya("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),x0=ya("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),b0=ya("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return r.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),w0=ya("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),hP=F("PI",["pi"],e=>{var{pi:r}=e;return r}),vP=F("E",["e"],e=>{var{e:r}=e;return r}),D0=F("version",[],()=>dP);function ya(e,r,t){return F(e,r,t,{recreateOnConfigChange:!0})}var S0=Er("speedOfLight","299792458","m s^-1"),N0=Er("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),A0=Er("planckConstant","6.62607015e-34","J s"),M0=Er("reducedPlanckConstant","1.0545718176461565e-34","J s"),C0=Er("magneticConstant","1.25663706212e-6","N A^-2"),E0=Er("electricConstant","8.8541878128e-12","F m^-1"),T0=Er("vacuumImpedance","376.730313667","ohm"),F0=Er("coulomb","8.987551792261171e9","N m^2 C^-2"),_0=Er("elementaryCharge","1.602176634e-19","C"),O0=Er("bohrMagneton","9.2740100783e-24","J T^-1"),B0=Er("conductanceQuantum","7.748091729863649e-5","S"),P0=Er("inverseConductanceQuantum","12906.403729652257","ohm"),I0=Er("magneticFluxQuantum","2.0678338484619295e-15","Wb"),R0=Er("nuclearMagneton","5.0507837461e-27","J T^-1"),q0=Er("klitzing","25812.807459304513","ohm");var k0=Er("bohrRadius","5.29177210903e-11","m"),L0=Er("classicalElectronRadius","2.8179403262e-15","m"),z0=Er("electronMass","9.1093837015e-31","kg"),U0=Er("fermiCoupling","1.1663787e-5","GeV^-2"),W0=xy("fineStructure",.0072973525693),Y0=Er("hartreeEnergy","4.3597447222071e-18","J"),H0=Er("protonMass","1.67262192369e-27","kg"),$0=Er("deuteronMass","3.3435830926e-27","kg"),G0=Er("neutronMass","1.6749271613e-27","kg"),V0=Er("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Z0=Er("rydberg","10973731.568160","m^-1"),Q0=Er("thomsonCrossSection","6.6524587321e-29","m^2"),X0=xy("weakMixingAngle",.2229),J0=xy("efimovFactor",22.7),K0=Er("atomicMass","1.66053906660e-27","kg"),j0=Er("avogadro","6.02214076e23","mol^-1"),ey=Er("boltzmann","1.380649e-23","J K^-1"),ry=Er("faraday","96485.33212331001","C mol^-1"),ty=Er("firstRadiation","3.7417718521927573e-16","W m^2"),ny=Er("loschmidt","2.686780111798444e25","m^-3"),ay=Er("gasConstant","8.31446261815324","J K^-1 mol^-1"),iy=Er("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),oy=Er("molarVolume","0.022413969545014137","m^3 mol^-1"),sy=xy("sackurTetrode",-1.16487052358),uy=Er("secondRadiation","0.014387768775039337","m K"),fy=Er("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),cy=Er("wienDisplacement","2.897771955e-3","m K"),ly=Er("molarMass","0.99999999965e-3","kg mol^-1"),my=Er("molarMassC12","11.9999999958e-3","kg mol^-1"),py=Er("gravity","9.80665","m s^-2"),dy=Er("planckLength","1.616255e-35","m"),hy=Er("planckMass","2.176435e-8","kg"),vy=Er("planckTime","5.391245e-44","s"),gy=Er("planckCharge","1.87554603778e-18","C"),yy=Er("planckTemperature","1.416785e+32","K");function Er(e,r,t){var n=["config","Unit","BigNumber"];return F(e,n,a=>{var{config:i,Unit:s,BigNumber:l}=a,c=i.number==="BigNumber"?new l(r):parseFloat(r),o=new s(c,t);return o.fixPrefix=!0,o})}function xy(e,r){var t=["config","BigNumber"];return F(e,t,n=>{var{config:a,BigNumber:i}=n;return a.number==="BigNumber"?new i(r):r})}var BV="apply",PV=["typed","isInteger"],by=F(BV,PV,e=>{var{typed:r,isInteger:t}=e,n=Lo({typed:r,isInteger:t});return r("apply",{"...any":function(i){var s=i[1];sr(s)?i[1]=s-1:rr(s)&&(i[1]=s.minus(1));try{return n.apply(null,i)}catch(l){throw mt(l)}}})},{isTransformFunction:!0});var IV="column",RV=["typed","Index","matrix","range"],wy=F(IV,RV,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Wu({typed:r,Index:t,matrix:n,range:a});return r("column",{"...any":function(l){var c=l.length-1,o=l[c];sr(o)&&(l[c]=o-1);try{return i.apply(null,l)}catch(u){throw mt(u)}}})},{isTransformFunction:!0});function lf(e,r,t){var n=e.filter(function(c){return at(c)&&!(c.name in r)&&!t.has(c.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var a=n.name,i=new Map,s=new Eu(t,i,new Set([a])),l=e.compile();return function(o){return i.set(a,o),l.evaluate(s)}}var qV="filter",kV=["typed"],Dy=F(qV,kV,e=>{var{typed:r}=e;function t(a,i,s){var l,c;return a[0]&&(l=a[0].compile().evaluate(s)),a[1]&&(at(a[1])||Oa(a[1])?c=a[1].compile().evaluate(s):c=lf(a[1],i,s)),n(l,c)}t.rawArgs=!0;var n=r("filter",{"Array, function":gP,"Matrix, function":function(i,s){return i.create(gP(i.toArray(),s))},"Array, RegExp":Mu,"Matrix, RegExp":function(i,s){return i.create(Mu(i.toArray(),s))}});return t},{isTransformFunction:!0});function gP(e,r){return _m(e,function(t,n,a){return Ra(r,t,[n+1],a,"filter")})}var LV="forEach",zV=["typed"],Sy=F(LV,zV,e=>{var{typed:r}=e;function t(a,i,s){var l,c;return a[0]&&(l=a[0].compile().evaluate(s)),a[1]&&(at(a[1])||Oa(a[1])?c=a[1].compile().evaluate(s):c=lf(a[1],i,s)),n(l,c)}t.rawArgs=!0;var n=r("forEach",{"Array | Matrix, function":function(i,s){var l=function c(o,u){if(Array.isArray(o))_o(o,function(m,d){c(m,u.concat(d+1))});else return Ra(s,o,u,i,"forEach")};l(i.valueOf(),[])}});return t},{isTransformFunction:!0});var UV="index",WV=["Index","getMatrixDataType"],Ny=F(UV,WV,e=>{var{Index:r,getMatrixDataType:t}=e;return function(){for(var a=[],i=0,s=arguments.length;i0?0:2;else if(l&&l.isSet===!0)l=l.map(function(o){return o-1});else if(Mr(l)||Qe(l))t(l)!=="boolean"&&(l=l.map(function(o){return o-1}));else if(sr(l))l--;else if(rr(l))l=l.toNumber()-1;else if(typeof l!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");a[i]=l}var c=new r;return r.apply(c,a),c}},{isTransformFunction:!0});var YV="map",HV=["typed"],Ay=F(YV,HV,e=>{var{typed:r}=e;function t(a,i,s){var l,c;return a[0]&&(l=a[0].compile().evaluate(s)),a[1]&&(at(a[1])||Oa(a[1])?c=a[1].compile().evaluate(s):c=lf(a[1],i,s)),n(l,c)}t.rawArgs=!0;var n=r("map",{"Array, function":function(i,s){return yP(i,s,i)},"Matrix, function":function(i,s){return i.create(yP(i.valueOf(),s,i))}});return t},{isTransformFunction:!0});function yP(e,r,t){function n(a,i){return Array.isArray(a)?Kn(a,function(s,l){return n(s,i.concat(l+1))}):Ra(r,a,i,t,"map")}return n(e,[])}function Cn(e){if(e.length===2&&Nt(e[0])){e=e.slice();var r=e[1];sr(r)?e[1]=r-1:rr(r)&&(e[1]=r.minus(1))}return e}var $V="max",GV=["typed","config","numeric","larger"],My=F($V,GV,e=>{var{typed:r,config:t,numeric:n,larger:a}=e,i=ef({typed:r,config:t,numeric:n,larger:a});return r("max",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var VV="mean",ZV=["typed","add","divide"],Cy=F(VV,ZV,e=>{var{typed:r,add:t,divide:n}=e,a=of({typed:r,add:t,divide:n});return r("mean",{"...any":function(s){s=Cn(s);try{return a.apply(null,s)}catch(l){throw mt(l)}}})},{isTransformFunction:!0});var QV="min",XV=["typed","config","numeric","smaller"],Ey=F(QV,XV,e=>{var{typed:r,config:t,numeric:n,smaller:a}=e,i=rf({typed:r,config:t,numeric:n,smaller:a});return r("min",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var JV="range",KV=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Ty=F(JV,KV,e=>{var{typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:s,larger:l,largerEq:c,add:o,isPositive:u}=e,m=$u({typed:r,config:t,matrix:n,bignumber:a,smaller:i,smallerEq:s,larger:l,largerEq:c,add:o,isPositive:u});return r("range",{"...any":function(h){var y=h.length-1,v=h[y];return typeof v!="boolean"&&h.push(!0),m.apply(null,h)}})},{isTransformFunction:!0});var jV="row",eZ=["typed","Index","matrix","range"],Fy=F(jV,eZ,e=>{var{typed:r,Index:t,matrix:n,range:a}=e,i=Gu({typed:r,Index:t,matrix:n,range:a});return r("row",{"...any":function(l){var c=l.length-1,o=l[c];sr(o)&&(l[c]=o-1);try{return i.apply(null,l)}catch(u){throw mt(u)}}})},{isTransformFunction:!0});var rZ="subset",tZ=["typed","matrix","zeros","add"],_y=F(rZ,tZ,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Vu({typed:r,matrix:t,zeros:n,add:a});return r("subset",{"...any":function(l){try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var nZ="concat",aZ=["typed","matrix","isInteger"],Oy=F(nZ,aZ,e=>{var{typed:r,matrix:t,isInteger:n}=e,a=Uu({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(s){var l=s.length-1,c=s[l];sr(c)?s[l]=c-1:rr(c)&&(s[l]=c.minus(1));try{return a.apply(null,s)}catch(o){throw mt(o)}}})},{isTransformFunction:!0});var xP="diff",iZ=["typed","matrix","subtract","number","bignumber"],By=F(xP,iZ,e=>{var{typed:r,matrix:t,subtract:n,number:a,bignumber:i}=e,s=Yu({typed:r,matrix:t,subtract:n,number:a,bignumber:i});return r(xP,{"...any":function(c){c=Cn(c);try{return s.apply(null,c)}catch(o){throw mt(o)}}})},{isTransformFunction:!0});var oZ="std",sZ=["typed","map","sqrt","variance"],Py=F(oZ,sZ,e=>{var{typed:r,map:t,sqrt:n,variance:a}=e,i=ff({typed:r,map:t,sqrt:n,variance:a});return r("std",{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var bP="sum",uZ=["typed","config","add","numeric"],Iy=F(bP,uZ,e=>{var{typed:r,config:t,add:n,numeric:a}=e,i=nf({typed:r,config:t,add:n,numeric:a});return r(bP,{"...any":function(l){l=Cn(l);try{return i.apply(null,l)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var fZ="quantileSeq",cZ=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Ry=F(fZ,cZ,e=>{var{typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:l,compare:c,isInteger:o,smaller:u,smallerEq:m,larger:d}=e,h=uf({typed:r,bignumber:t,add:n,subtract:a,divide:i,multiply:s,partitionSelect:l,compare:c,isInteger:o,smaller:u,smallerEq:m,larger:d});return r("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(v,x,w)=>h(v,x,y(w)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(v,x,w,C)=>h(v,x,w,y(C)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(v,x,w)=>h(v,x,y(w)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(v,x,w,C)=>h(v,x,w,y(C))});function y(v){return Cn([[],v])[1]}},{isTransformFunction:!0});var wP="cumsum",lZ=["typed","add","unaryPlus"],qy=F(wP,lZ,e=>{var{typed:r,add:t,unaryPlus:n}=e,a=af({typed:r,add:t,unaryPlus:n});return r(wP,{"...any":function(s){if(s.length===2&&Nt(s[0])){var l=s[1];sr(l)?s[1]=l-1:rr(l)&&(s[1]=l.minus(1))}try{return a.apply(null,s)}catch(c){throw mt(c)}}})},{isTransformFunction:!0});var DP="variance",mZ=["typed","add","subtract","multiply","divide","apply","isNaN"],ky=F(DP,mZ,e=>{var{typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:l}=e,c=sf({typed:r,add:t,subtract:n,multiply:a,divide:i,apply:s,isNaN:l});return r(DP,{"...any":function(u){u=Cn(u);try{return c.apply(null,u)}catch(m){throw mt(m)}}})},{isTransformFunction:!0});var SP="print",pZ=["typed","matrix","zeros","add"],Ly=F(SP,pZ,e=>{var{typed:r,matrix:t,zeros:n,add:a}=e,i=Qu({typed:r,matrix:t,zeros:n,add:a});return r(SP,{"string, Object | Array":function(c,o){return i(s(c),o)},"string, Object | Array, number | Object":function(c,o,u){return i(s(c),o,u)}});function s(l){return l.replace(qd,c=>{var o=c.slice(1).split("."),u=o.map(function(m){return!isNaN(m)&&m.length>0?parseInt(m)-1:m});return"$"+u.join(".")})}},{isTransformFunction:!0});var dZ="and",hZ=["typed","matrix","zeros","add","equalScalar","not","concat"],zy=F(dZ,hZ,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s}=e,l=ju({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s});function c(o,u,m){var d=o[0].compile().evaluate(m);if(!Nt(d)&&!l(d,!0))return!1;var h=o[1].compile().evaluate(m);return l(d,h)}return c.rawArgs=!0,c},{isTransformFunction:!0});var vZ="or",gZ=["typed","matrix","equalScalar","DenseMatrix","concat"],Uy=F(vZ,gZ,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=zu({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function l(c,o,u){var m=c[0].compile().evaluate(u);if(!Nt(m)&&s(m,!1))return!0;var d=c[1].compile().evaluate(u);return s(m,d)}return l.rawArgs=!0,l},{isTransformFunction:!0});var yZ="bitAnd",xZ=["typed","matrix","zeros","add","equalScalar","not","concat"],Wy=F(yZ,xZ,e=>{var{typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s}=e,l=ku({typed:r,matrix:t,equalScalar:n,zeros:a,not:i,concat:s});function c(o,u,m){var d=o[0].compile().evaluate(m);if(!Nt(d)){if(isNaN(d))return NaN;if(d===0||d===!1)return 0}var h=o[1].compile().evaluate(m);return l(d,h)}return c.rawArgs=!0,c},{isTransformFunction:!0});var bZ="bitOr",wZ=["typed","matrix","equalScalar","DenseMatrix","concat"],Yy=F(bZ,wZ,e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i}=e,s=Lu({typed:r,matrix:t,equalScalar:n,DenseMatrix:a,concat:i});function l(c,o,u){var m=c[0].compile().evaluate(u);if(!Nt(m)){if(isNaN(m))return NaN;if(m===-1)return-1;if(m===!0)return 1}var d=c[1].compile().evaluate(u);return s(m,d)}return l.rawArgs=!0,l},{isTransformFunction:!0});var Ge=Ym({config:Oe}),pt=Hm({}),ID=p0({BigNumber:Ge,config:Oe}),NP=s0({}),AP=W0({BigNumber:Ge,config:Oe}),Wo=$m({}),RD=w0({Complex:pt}),MP=f0({BigNumber:Ge,config:Oe}),CP=v0({BigNumber:Ge,config:Oe}),EP=y0({BigNumber:Ge,config:Oe}),kc=Vm({}),TP=c0({BigNumber:Ge,config:Oe}),FP=u0({}),_P=d0({BigNumber:Ge,config:Oe}),OP=Gm({}),qD=Im({}),BP=x0({BigNumber:Ge,config:Oe}),PP=sy({BigNumber:Ge,config:Oe}),kD=m0({BigNumber:Ge,config:Oe}),IP=o0({}),RP=D0({}),Fr=Qm({Matrix:kc}),qP=J0({BigNumber:Ge,config:Oe}),kP=h0({BigNumber:Ge,config:Oe}),Hy=l0({BigNumber:Ge,config:Oe}),LP=i0({}),zP=b0({BigNumber:Ge,config:Oe}),te=Pm({BigNumber:Ge,Complex:pt,DenseMatrix:Fr,Fraction:Wo}),$y=Sp({BigNumber:Ge,config:Oe,typed:te}),UP=X0({BigNumber:Ge,config:Oe}),En=Np({typed:te}),WP=_h({Complex:pt,config:Oe,typed:te}),YP=Bh({BigNumber:Ge,typed:te}),HP=Ih({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),Qt=Mp({typed:te}),$P=Kp({typed:te}),GP=kh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),VP=zh({typed:te}),LD=Uh({typed:te}),ZP=Yh({Complex:pt,config:Oe,typed:te}),ta=dp({BigNumber:Ge,typed:te}),QP=Xp({typed:te}),XP=pp({typed:te}),JP=Xm({typed:te}),Lc=Og({typed:te}),zc=hp({Complex:pt,typed:te}),Yo=jp({typed:te}),Gy=Hh({typed:te}),KP=Gh({BigNumber:Ge,typed:te}),jP=Zh({BigNumber:Ge,typed:te}),eI=Fp({typed:te}),Ir=fp({config:Oe,typed:te}),rI=Td({typed:te}),zD=_p({typed:te}),tI=Op({Complex:pt,typed:te}),nI=sd({typed:te}),aI=fd({typed:te}),mf=Bd({typed:te}),Vy=cd({typed:te}),iI=Rd({format:mf,typed:te}),Zy=ed({typed:te}),zn=jm({typed:te}),ao=rp({typed:te}),Ho=ap({typed:te}),La=ip({typed:te}),oI=g0({BigNumber:Ge,config:Oe}),sI=Ig({Complex:pt,typed:te}),uI=Rp({Complex:pt,config:Oe,typed:te}),UD=qp({Complex:pt,config:Oe,typed:te}),$o=pd({typed:te}),Ot=kp({typed:te}),Uc=td({typed:te}),Bi=lp({typed:te}),fI=Id({format:mf,typed:te}),cI=Ug({config:Oe,typed:te}),lI=Qu({typed:te}),mI=Wg({config:Oe,typed:te}),Qy=rd({typed:te}),pI=Xh({BigNumber:Ge,typed:te}),WD=Up({BigNumber:Ge,Fraction:Wo,complex:zc,typed:te}),Wc=Kh({typed:te}),Pi=cp({Matrix:kc,equalScalar:Ir,typed:te}),dI=wp({typed:te}),hI=Yp({typed:te}),vI=mp({typed:te}),xa=Cp({typed:te}),gI=ev({typed:te}),YD=sp({typed:te}),yI=Oh({Complex:pt,config:Oe,typed:te}),xI=Rh({BigNumber:Ge,typed:te}),Xy=Lo({isInteger:zn,typed:te}),bI=qh({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),wI=Pd({format:mf,typed:te}),DI=Bg({typed:te}),SI=$h({typed:te}),NI=Qh({BigNumber:Ge,typed:te}),pf=op({typed:te}),AI=Ld({typed:te}),MI=Yg({config:Oe,typed:te}),CI=Jh({BigNumber:Ge,typed:te}),EI=jh({typed:te}),TI=Th({SparseMatrix:Pi,typed:te}),za=Wp({Complex:pt,config:Oe,typed:te}),FI=rv({typed:te}),fi=Dp({typed:te}),_I=Ph({BigNumber:Ge,Complex:pt,config:Oe,typed:te}),OI=Vh({BigNumber:Ge,typed:te}),Ps=vp({Fraction:Wo,typed:te}),Go=tp({typed:te}),$e=gp({DenseMatrix:Fr,Matrix:kc,SparseMatrix:Pi,typed:te}),BI=yp({isZero:La,matrix:$e,typed:te}),PI=_d({isNaN:pf,isNumeric:Go,typed:te}),Ua=zd({bignumber:ta,fraction:Ps,number:Bi}),HD=Od({config:Oe,multiplyScalar:Ot,numeric:Ua,typed:te}),$D=gd({isInteger:zn,matrix:$e,typed:te}),cn=wd({matrix:$e,config:Oe,typed:te}),II=Dd({matrix:$e,typed:te}),df=Sd({matrix:$e,typed:te}),GD=$p({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),ln=Ad({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),RI=Lh({Complex:pt,config:Oe,typed:te}),VD=Ep({BigNumber:Ge,Complex:pt,Fraction:Wo,config:Oe,isNegative:ao,matrix:$e,typed:te,unaryMinus:fi}),Gr=Uu({isInteger:zn,matrix:$e,typed:te}),qI=ad({prod:HD,size:cn,typed:te}),Jy=Nd({conj:Yo,transpose:df,typed:te}),ZD=od({DenseMatrix:Fr,SparseMatrix:Pi,matrix:$e,typed:te}),Mt=Ud({numeric:Ua,typed:te}),hf=Zd({DenseMatrix:Fr,concat:Gr,divideScalar:Mt,equalScalar:Ir,matrix:$e,typed:te}),ba=sh({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),vf=ud({matrix:$e,typed:te}),kI=np({isNumeric:Go,typed:te}),io=ld({BigNumber:Ge,DenseMatrix:Fr,SparseMatrix:Pi,config:Oe,matrix:$e,typed:te}),LI=md({matrix:$e,multiplyScalar:Ot,typed:te}),Yc=vh({DenseMatrix:Fr,concat:Gr,config:Oe,matrix:$e,typed:te}),zI=jd({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),QD=Qd({DenseMatrix:Fr,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te}),Ky=bp({flatten:vf,matrix:$e,size:cn,typed:te}),UI=zp({BigNumber:Ge,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),WI=dd({BigNumber:Ge,config:Oe,matrix:$e,typed:te}),jy=og({addScalar:Qt,complex:zc,conj:Yo,divideScalar:Mt,equal:ba,identity:io,isZero:La,matrix:$e,multiplyScalar:Ot,sign:WD,sqrt:za,subtractScalar:xa,typed:te,unaryMinus:fi,zeros:ln}),YI=yd({config:Oe,matrix:$e}),HI=eh({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),Is=Yd({BigNumber:Ge,DenseMatrix:Fr,config:Oe,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),Tn=ch({DenseMatrix:Fr,concat:Gr,config:Oe,matrix:$e,typed:te}),Bt=Hp({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,subtractScalar:xa,typed:te,unaryMinus:fi}),$I=kd({concat:Gr,matrix:$e,typed:te}),GI=xh({DenseMatrix:Fr,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,typed:te}),ex=Xd({DenseMatrix:Fr,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te}),VI=nd({DenseMatrix:Fr,concat:Gr,matrix:$e,typed:te}),Lr=mv({DenseMatrix:Fr,SparseMatrix:Pi,addScalar:Qt,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),ZI=Wh({BigNumber:Ge,DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),QI=ku({concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),XI=Lu({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),JI=Jp({DenseMatrix:Fr,concat:Gr,matrix:$e,typed:te}),KI=Gg({addScalar:Qt,combinations:Lc,divideScalar:Mt,isInteger:zn,isNegative:ao,multiplyScalar:Ot,typed:te}),Vo=nh({BigNumber:Ge,DenseMatrix:Fr,Fraction:Wo,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,typed:te}),XD=ih({concat:Gr,matrix:$e,typed:te}),jI=af({add:Lr,typed:te,unaryPlus:$y}),rx=gh({equal:ba,typed:te}),e4=Yu({matrix:$e,number:Bi,subtract:Bt,typed:te}),r4=Mg({abs:En,addScalar:Qt,deepEqual:rx,divideScalar:Mt,multiplyScalar:Ot,sqrt:za,subtractScalar:xa,typed:te}),Hc=hv({addScalar:Qt,conj:Yo,multiplyScalar:Ot,size:cn,typed:te}),t4=uh({compareText:XD,isZero:La,typed:te}),JD=Pu({DenseMatrix:Fr,config:Oe,equalScalar:Ir,matrix:$e,round:Is,typed:te,zeros:ln}),n4=Pp({BigNumber:Ge,DenseMatrix:Fr,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,round:Is,typed:te,zeros:ln}),a4=pv({abs:En,addScalar:Qt,divideScalar:Mt,isPositive:Ho,multiplyScalar:Ot,smaller:Tn,sqrt:za,typed:te}),KD=Dh({DenseMatrix:Fr,smaller:Tn}),bn=Sh({ImmutableDenseMatrix:KD,getMatrixDataType:Vy}),Fn=dh({DenseMatrix:Fr,concat:Gr,config:Oe,matrix:$e,typed:te}),tx=Hd({Complex:pt,config:Oe,divideScalar:Mt,typed:te}),i4=Jd({DenseMatrix:Fr,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te}),o4=xp({flatten:vf,matrix:$e,size:cn,typed:te}),s4=rf({config:Oe,numeric:Ua,smaller:Tn,typed:te}),jD=Iu({DenseMatrix:Fr,concat:Gr,config:Oe,equalScalar:Ir,matrix:$e,round:Is,typed:te,zeros:ln}),it=Lp({addScalar:Qt,dot:Hc,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,typed:te}),u4=Gd({Complex:pt,config:Oe,divideScalar:Mt,typed:te}),f4=zu({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),$c=bh({compare:Vo,isNaN:pf,isNumeric:Go,typed:te}),c4=rh({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te,zeros:ln}),eS=fg({SparseMatrix:Pi,abs:En,add:Lr,divideScalar:Mt,larger:Fn,largerEq:Yc,multiply:it,subtract:Bt,transpose:df,typed:te}),na=Vu({add:Lr,matrix:$e,typed:te,zeros:ln}),nx=nf({add:Lr,config:Oe,numeric:Ua,typed:te}),l4=vv({add:Lr,matrix:$e,typed:te}),rS=Kd({DenseMatrix:Fr,divideScalar:Mt,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te}),m4=t0({Complex:pt,add:Lr,multiply:it,number:Bi,typed:te}),ax=Tp({DenseMatrix:Fr,config:Oe,equalScalar:Ir,matrix:$e,round:Is,typed:te,zeros:ln}),ci=ah({compare:Vo,typed:te}),p4=Vg({addScalar:Qt,combinations:Lc,isInteger:zn,isNegative:ao,isPositive:Ho,larger:Fn,typed:te}),d4=id({matrix:$e,multiply:it,subtract:Bt,typed:te}),tS=vg({divideScalar:Mt,isZero:La,matrix:$e,multiply:it,subtractScalar:xa,typed:te,unaryMinus:fi}),h4=Zp({concat:Gr,equalScalar:Ir,matrix:$e,multiplyScalar:Ot,typed:te}),nS=Nh({larger:Fn,smaller:Tn}),aS=Bp({Complex:pt,DenseMatrix:Fr,ceil:ax,equalScalar:Ir,floor:JD,matrix:$e,typed:te,zeros:ln}),iS=gv({Index:bn,typed:te}),v4=Cg({abs:En,add:Lr,addScalar:Qt,config:Oe,divideScalar:Mt,equalScalar:Ir,flatten:vf,isNumeric:Go,isZero:La,matrix:$e,multiply:it,multiplyScalar:Ot,smaller:Tn,subtract:Bt,typed:te}),g4=Gp({BigNumber:Ge,add:Lr,config:Oe,equal:ba,isInteger:zn,mod:jD,smaller:Tn,typed:te,xgcd:GD}),y4=Ip({concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),x4=$d({Complex:pt,config:Oe,divideScalar:Mt,log:tx,typed:te}),ix=ef({config:Oe,larger:Fn,numeric:Ua,typed:te}),b4=tv({DenseMatrix:Fr,Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),w4=av({DenseMatrix:Fr,Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),D4=ov({Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),S4=uv({Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),Rs=mh({DenseMatrix:Fr,concat:Gr,config:Oe,matrix:$e,typed:te}),N4=wh({compare:Vo,compareNatural:ci,matrix:$e,typed:te}),A4=ju({concat:Gr,equalScalar:Ir,matrix:$e,not:Uc,typed:te,zeros:ln}),qs=$u({bignumber:ta,matrix:$e,add:Lr,config:Oe,isPositive:Ho,larger:Fn,largerEq:Yc,smaller:Tn,smallerEq:Rs,typed:te}),M4=Gu({Index:bn,matrix:$e,range:qs,typed:te}),oS=nv({DenseMatrix:Fr,Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),C4=sv({Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),sS=cv({Index:bn,concat:Gr,setDifference:oS,size:cn,subset:na,typed:te}),uS=Ah({FibonacciHeap:nS,addScalar:Qt,equalScalar:Ir}),fS=Wu({Index:bn,matrix:$e,range:qs,typed:te}),Zo=gg({abs:En,addScalar:Qt,det:tS,divideScalar:Mt,identity:io,matrix:$e,multiply:it,typed:te,unaryMinus:fi}),cS=ig({DenseMatrix:Fr,Spa:uS,SparseMatrix:Pi,abs:En,addScalar:Qt,divideScalar:Mt,equalScalar:Ir,larger:Fn,matrix:$e,multiplyScalar:Ot,subtractScalar:xa,typed:te,unaryMinus:fi}),E4=yg({Complex:pt,add:Lr,ctranspose:Jy,deepEqual:rx,divideScalar:Mt,dot:Hc,dotDivide:hf,equal:ba,inv:Zo,matrix:$e,multiply:it,typed:te}),wa=Wd({Complex:pt,config:Oe,fraction:Ps,identity:io,inv:Zo,matrix:$e,multiply:it,number:Bi,typed:te}),lS=iv({DenseMatrix:Fr,Index:bn,compareNatural:ci,size:cn,subset:na,typed:te}),T4=lv({Index:bn,concat:Gr,setIntersect:lS,setSymDifference:sS,size:cn,subset:na,typed:te}),F4=wg({abs:En,add:Lr,identity:io,inv:Zo,map:$o,max:ix,multiply:it,size:cn,sqrt:za,subtract:Bt,typed:te}),wr=Ch({BigNumber:Ge,Complex:pt,Fraction:Wo,abs:En,addScalar:Qt,config:Oe,divideScalar:Mt,equal:ba,fix:aS,format:mf,isNumeric:Go,multiplyScalar:Ot,number:Bi,pow:wa,round:Is,subtractScalar:xa}),_4=T0({BigNumber:Ge,Unit:wr,config:Oe}),O4=cy({BigNumber:Ge,Unit:wr,config:Oe}),B4=K0({BigNumber:Ge,Unit:wr,config:Oe}),P4=O0({BigNumber:Ge,Unit:wr,config:Oe}),I4=ey({BigNumber:Ge,Unit:wr,config:Oe}),R4=B0({BigNumber:Ge,Unit:wr,config:Oe}),q4=F0({BigNumber:Ge,Unit:wr,config:Oe}),k4=$0({BigNumber:Ge,Unit:wr,config:Oe}),L4=Vd({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,pow:wa,typed:te}),z4=E0({BigNumber:Ge,Unit:wr,config:Oe}),U4=_0({BigNumber:Ge,Unit:wr,config:Oe}),W4=bg({abs:En,add:Lr,identity:io,inv:Zo,multiply:it,typed:te}),Y4=ry({BigNumber:Ge,Unit:wr,config:Oe}),mS=Md({addScalar:Qt,ceil:ax,conj:Yo,divideScalar:Mt,dotDivide:hf,exp:zD,i:RD,log2:UD,matrix:$e,multiplyScalar:Ot,pow:wa,tau:kD,typed:te}),ox=Pg({BigNumber:Ge,Complex:pt,config:Oe,multiplyScalar:Ot,pow:wa,typed:te}),H4=N0({BigNumber:Ge,Unit:wr,config:Oe}),$4=Y0({BigNumber:Ge,Unit:wr,config:Oe}),G4=Cd({conj:Yo,dotDivide:hf,fft:mS,typed:te}),V4=q0({BigNumber:Ge,Unit:wr,config:Oe}),Z4=ny({BigNumber:Ge,Unit:wr,config:Oe}),Q4=C0({BigNumber:Ge,Unit:wr,config:Oe}),X4=ly({BigNumber:Ge,Unit:wr,config:Oe}),J4=iy({BigNumber:Ge,Unit:wr,config:Oe}),K4=G0({BigNumber:Ge,Unit:wr,config:Oe}),j4=R0({BigNumber:Ge,Unit:wr,config:Oe}),eR=gy({BigNumber:Ge,Unit:wr,config:Oe}),rR=dy({BigNumber:Ge,Unit:wr,config:Oe}),tR=yy({BigNumber:Ge,Unit:wr,config:Oe}),nR=H0({BigNumber:Ge,Unit:wr,config:Oe}),aR=V0({BigNumber:Ge,Unit:wr,config:Oe}),iR=M0({BigNumber:Ge,Unit:wr,config:Oe}),oR=Z0({BigNumber:Ge,Unit:wr,config:Oe}),sR=uy({BigNumber:Ge,Unit:wr,config:Oe}),uR=S0({BigNumber:Ge,Unit:wr,config:Oe}),fR=fy({BigNumber:Ge,Unit:wr,config:Oe}),cR=Q0({BigNumber:Ge,Unit:wr,config:Oe}),lR=j0({BigNumber:Ge,Unit:wr,config:Oe}),mR=k0({BigNumber:Ge,Unit:wr,config:Oe}),pR=Fh({Unit:wr,typed:te}),an=Ag({divideScalar:Mt,equalScalar:Ir,inv:Zo,matrix:$e,multiply:it,typed:te}),dR=z0({BigNumber:Ge,Unit:wr,config:Oe}),gf=Rg({gamma:ox,typed:te}),hR=ty({BigNumber:Ge,Unit:wr,config:Oe}),vR=py({BigNumber:Ge,Unit:wr,config:Oe}),gR=P0({BigNumber:Ge,Unit:wr,config:Oe}),pS=cg({DenseMatrix:Fr,lsolve:QD,lup:cS,matrix:$e,slu:eS,typed:te,usolve:ex}),yR=I0({BigNumber:Ge,Unit:wr,config:Oe}),xR=my({BigNumber:Ge,Unit:wr,config:Oe}),bR=kg({add:Lr,divide:an,factorial:gf,isInteger:zn,isPositive:Ho,multiply:it,typed:te}),wR=Lg({factorial:gf,typed:te}),DR=hy({BigNumber:Ge,Unit:wr,config:Oe}),SR=lg({add:Lr,cbrt:VD,divide:an,equalScalar:Ir,im:Zy,isZero:La,multiply:it,re:Qy,sqrt:za,subtract:Bt,typeOf:YD,typed:te,unaryMinus:fi}),NR=fv({compareNatural:ci,typed:te}),AR=Ed({abs:En,add:Lr,bignumber:ta,divide:an,isNegative:ao,isPositive:Ho,larger:Fn,map:$o,matrix:$e,max:ix,multiply:it,smaller:Tn,subtract:Bt,typed:te,unaryMinus:fi}),dS=Hg({bignumber:ta,addScalar:Qt,combinations:Lc,divideScalar:Mt,factorial:gf,isInteger:zn,isNegative:ao,larger:Fn,multiplyScalar:Ot,number:Bi,pow:wa,subtractScalar:xa,typed:te}),MR=Eh({Unit:wr,typed:te}),CR=$g({addScalar:Qt,isInteger:zn,isNegative:ao,stirlingS2:dS,typed:te}),hS=xg({abs:En,add:Lr,addScalar:Qt,atan:LD,bignumber:ta,column:fS,complex:zc,config:Oe,cos:Gy,diag:ZD,divideScalar:Mt,dot:Hc,equal:ba,flatten:vf,im:Zy,inv:Zo,larger:Fn,matrix:$e,matrixFromColumns:Ky,multiply:it,multiplyScalar:Ot,number:Bi,qr:jy,re:Qy,reshape:$D,sin:Wc,size:cn,smaller:Tn,sqrt:za,subtract:Bt,typed:te,usolve:ex,usolveAll:rS}),ER=U0({BigNumber:Ge,Unit:wr,config:Oe}),TR=ay({BigNumber:Ge,Unit:wr,config:Oe}),FR=qg({divide:an,dotDivide:hf,isNumeric:Go,log:tx,map:$o,matrix:$e,multiply:it,sum:nx,typed:te}),vS=of({add:Lr,divide:an,typed:te}),_R=oy({BigNumber:Ge,Unit:wr,config:Oe}),OR=A0({BigNumber:Ge,Unit:wr,config:Oe}),BR=uf({bignumber:ta,add:Lr,compare:Vo,divide:an,isInteger:zn,larger:Fn,multiply:it,partitionSelect:$c,smaller:Tn,smallerEq:Rs,subtract:Bt,typed:te}),sx=sf({add:Lr,apply:Xy,divide:an,isNaN:pf,multiply:it,subtract:Bt,typed:te}),PR=L0({BigNumber:Ge,Unit:wr,config:Oe}),gS=Tg({add:Lr,compare:Vo,divide:an,partitionSelect:$c,typed:te}),IR=_g({add:Lr,divide:an,matrix:$e,mean:vS,multiply:it,pow:wa,sqrt:za,subtract:Bt,sum:nx,typed:te}),RR=n0({Complex:pt,add:Lr,divide:an,matrix:$e,multiply:it,typed:te}),qR=Fg({abs:En,map:$o,median:gS,subtract:Bt,typed:te}),kR=ff({map:$o,sqrt:za,typed:te,variance:sx}),LR=Fd({BigNumber:Ge,Complex:pt,add:Lr,config:Oe,divide:an,equal:ba,factorial:gf,gamma:ox,isNegative:ao,multiply:it,pi:Hy,pow:wa,sin:Wc,smallerEq:Rs,subtract:Bt,typed:te}),ux=dv({abs:En,add:Lr,conj:Yo,ctranspose:Jy,eigs:hS,equalScalar:Ir,larger:Fn,matrix:$e,multiply:it,pow:wa,smaller:Tn,sqrt:za,typed:te}),yS=bd({BigNumber:Ge,DenseMatrix:Fr,SparseMatrix:Pi,addScalar:Qt,config:Oe,cos:Gy,matrix:$e,multiplyScalar:Ot,norm:ux,sin:Wc,typed:te,unaryMinus:fi}),zR=vy({BigNumber:Ge,Unit:wr,config:Oe}),xS=Sg({identity:io,matrix:$e,multiply:it,norm:ux,qr:jy,subtract:Bt,typed:te}),UR=xd({multiply:it,rotationMatrix:yS,typed:te}),bS=Dg({abs:En,add:Lr,concat:Gr,identity:io,index:iS,lusolve:pS,matrix:$e,matrixFromColumns:Ky,multiply:it,range:qs,schur:xS,subset:na,subtract:Bt,transpose:df,typed:te}),WR=Ng({matrix:$e,multiply:it,sylvester:bS,transpose:df,typed:te});var yf={},xf={},YR={},_n=xv({mathWithTransform:xf}),bf=Wv({Node:_n}),oo=Hv({Node:_n}),ks=Gv({Node:_n}),HR=Xv({Node:_n}),wf=Nv({Node:_n}),$R=Fv({Node:_n,ResultSet:qD}),GR=Ov({Node:_n}),Qo=Rv({Node:_n}),VR=Zv({Node:_n}),DZ=a0({classes:YR}),wS=pg({math:yf,typed:te}),ZR=kv({Node:_n,typed:te}),SZ=hg({Chain:wS,typed:te}),Df=zv({Node:_n,size:cn}),Sf=Dv({Node:_n,subset:na}),QR=Ev({matrix:$e,Node:_n,subset:na}),Xo=Jv({Unit:wr,Node:_n,math:yf}),Jo=jv({Node:_n,SymbolNode:Xo,math:yf}),Wa=eg({AccessorNode:Sf,ArrayNode:wf,AssignmentNode:QR,BlockNode:$R,ConditionalNode:GR,ConstantNode:Qo,FunctionAssignmentNode:ZR,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,RangeNode:VR,RelationalNode:HR,SymbolNode:Xo,config:Oe,numeric:Ua,typed:te}),XR=Kg({ConstantNode:Qo,FunctionNode:Jo,OperatorNode:oo,ParenthesisNode:ks,parse:Wa,typed:te}),DS=Xg({bignumber:ta,fraction:Ps,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Qo,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,SymbolNode:Xo,config:Oe,mathWithTransform:xf,matrix:$e,typed:te}),NZ=rg({parse:Wa,typed:te}),SS=Jg({AccessorNode:Sf,ArrayNode:wf,ConstantNode:Qo,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,SymbolNode:Xo,add:Lr,divide:an,equal:ba,isZero:La,multiply:it,parse:Wa,pow:wa,subtract:Bt,typed:te}),NS=tg({parse:Wa,typed:te}),JR=mg({evaluate:NS}),KR=ng({evaluate:NS}),fx=Qg({bignumber:ta,fraction:Ps,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Qo,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,SymbolNode:Xo,add:Lr,config:Oe,divide:an,equal:ba,isZero:La,mathWithTransform:xf,matrix:$e,multiply:it,parse:Wa,pow:wa,resolve:XR,simplifyConstant:DS,simplifyCore:SS,subtract:Bt,typed:te}),AZ=jg({OperatorNode:oo,parse:Wa,simplify:fx,typed:te}),MZ=Zg({parse:Wa,typed:te}),CZ=ag({Parser:KR,typed:te}),EZ=r0({bignumber:ta,fraction:Ps,AccessorNode:Sf,ArrayNode:wf,ConstantNode:Qo,FunctionNode:Jo,IndexNode:Df,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,SymbolNode:Xo,add:Lr,config:Oe,divide:an,equal:ba,isZero:La,mathWithTransform:xf,matrix:$e,multiply:it,parse:Wa,pow:wa,simplify:fx,simplifyConstant:DS,simplifyCore:SS,subtract:Bt,typed:te}),TZ=e0({ConstantNode:Qo,FunctionNode:Jo,OperatorNode:oo,ParenthesisNode:ks,SymbolNode:Xo,config:Oe,equal:ba,isZero:La,numeric:Ua,parse:Wa,simplify:fx,typed:te}),FZ=dg({Help:JR,mathWithTransform:xf,typed:te});ht(yf,{e:ID,false:NP,fineStructure:AP,i:RD,Infinity:MP,LN10:CP,LOG10E:EP,NaN:TP,null:FP,phi:_P,SQRT1_2:BP,sackurTetrode:PP,tau:kD,true:IP,E:ID,version:RP,efimovFactor:qP,LN2:kP,pi:Hy,replacer:LP,reviver:DZ,SQRT2:zP,typed:te,unaryPlus:$y,PI:Hy,weakMixingAngle:UP,abs:En,acos:WP,acot:YP,acsc:HP,addScalar:Qt,arg:$P,asech:GP,asinh:VP,atan:LD,atanh:ZP,bignumber:ta,bitNot:QP,boolean:XP,clone:JP,combinations:Lc,complex:zc,conj:Yo,cos:Gy,cot:KP,csc:jP,cube:eI,equalScalar:Ir,erf:rI,exp:zD,expm1:tI,filter:nI,forEach:aI,format:mf,getMatrixDataType:Vy,hex:iI,im:Zy,isInteger:zn,isNegative:ao,isPositive:Ho,isZero:La,LOG2E:oI,lgamma:sI,log10:uI,log2:UD,map:$o,multiplyScalar:Ot,not:Uc,number:Bi,oct:fI,pickRandom:cI,print:lI,random:mI,re:Qy,sec:pI,sign:WD,sin:Wc,splitUnit:dI,square:hI,string:vI,subtractScalar:xa,tan:gI,typeOf:YD,acosh:yI,acsch:xI,apply:Xy,asec:bI,bin:wI,chain:SZ,combinationsWithRep:DI,cosh:SI,csch:NI,isNaN:pf,isPrime:AI,randomInt:MI,sech:CI,sinh:EI,sparse:TI,sqrt:za,tanh:FI,unaryMinus:fi,acoth:_I,coth:OI,fraction:Ps,isNumeric:Go,matrix:$e,matrixFromFunction:BI,mode:PI,numeric:Ua,prod:HD,reshape:$D,size:cn,squeeze:II,transpose:df,xgcd:GD,zeros:ln,asin:RI,cbrt:VD,concat:Gr,count:qI,ctranspose:Jy,diag:ZD,divideScalar:Mt,dotDivide:hf,equal:ba,flatten:vf,hasNumericValue:kI,identity:io,kron:LI,largerEq:Yc,leftShift:zI,lsolve:QD,matrixFromColumns:Ky,nthRoot:UI,ones:WI,qr:jy,resize:YI,rightArithShift:HI,round:Is,smaller:Tn,subtract:Bt,to:$I,unequal:GI,usolve:ex,xor:VI,add:Lr,atan2:ZI,bitAnd:QI,bitOr:XI,bitXor:JI,catalan:KI,compare:Vo,compareText:XD,cumsum:jI,deepEqual:rx,diff:e4,distance:r4,dot:Hc,equalText:t4,floor:JD,gcd:n4,hypot:a4,larger:Fn,log:tx,lsolveAll:i4,matrixFromRows:o4,min:s4,mod:jD,multiply:it,nthRoots:u4,or:f4,partitionSelect:$c,rightLogShift:c4,slu:eS,subset:na,sum:nx,trace:l4,usolveAll:rS,zpk2tf:m4,ceil:ax,compareNatural:ci,composition:p4,cross:d4,det:tS,dotMultiply:h4,fix:aS,index:iS,intersect:v4,invmod:g4,lcm:y4,log1p:x4,max:ix,setCartesian:b4,setDistinct:w4,setIsSubset:D4,setPowerset:S4,smallerEq:Rs,sort:N4,and:A4,range:qs,row:M4,setDifference:oS,setMultiplicity:C4,setSymDifference:sS,column:fS,inv:Zo,lup:cS,pinv:E4,pow:wa,setIntersect:lS,setUnion:T4,sqrtm:F4,vacuumImpedance:_4,wienDisplacement:O4,atomicMass:B4,bohrMagneton:P4,boltzmann:I4,conductanceQuantum:R4,coulomb:q4,deuteronMass:k4,dotPow:L4,electricConstant:z4,elementaryCharge:U4,expm:W4,faraday:Y4,fft:mS,gamma:ox,gravitationConstant:H4,hartreeEnergy:$4,ifft:G4,klitzing:V4,loschmidt:Z4,magneticConstant:Q4,molarMass:X4,molarPlanckConstant:J4,neutronMass:K4,nuclearMagneton:j4,planckCharge:eR,planckLength:rR,planckTemperature:tR,protonMass:nR,quantumOfCirculation:aR,reducedPlanckConstant:iR,rydberg:oR,secondRadiation:sR,speedOfLight:uR,stefanBoltzmann:fR,thomsonCrossSection:cR,avogadro:lR,bohrRadius:mR,createUnit:pR,divide:an,electronMass:dR,factorial:gf,firstRadiation:hR,gravity:vR,inverseConductanceQuantum:gR,lusolve:pS,magneticFluxQuantum:yR,molarMassC12:xR,multinomial:bR,parse:Wa,permutations:wR,planckMass:DR,polynomialRoot:SR,resolve:XR,setSize:NR,simplifyConstant:DS,solveODE:AR,stirlingS2:dS,unit:MR,bellNumbers:CR,compile:NZ,eigs:hS,fermiCoupling:ER,gasConstant:TR,kldivergence:FR,mean:vS,molarVolume:_R,planckConstant:OR,quantileSeq:BR,simplifyCore:SS,variance:sx,classicalElectronRadius:PR,evaluate:NS,median:gS,simplify:fx,symbolicEqual:AZ,corr:IR,freqz:RR,leafCount:MZ,mad:qR,parser:CZ,rationalize:EZ,std:kR,zeta:LR,derivative:TZ,norm:ux,rotationMatrix:yS,help:FZ,planckTime:zR,schur:xS,rotate:UR,sylvester:bS,lyap:WR,config:Oe});ht(xf,yf,{filter:Dy({typed:te}),forEach:Sy({typed:te}),map:Ay({typed:te}),apply:by({isInteger:zn,typed:te}),or:Uy({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),and:zy({add:Lr,concat:Gr,equalScalar:Ir,matrix:$e,not:Uc,typed:te,zeros:ln}),concat:Oy({isInteger:zn,matrix:$e,typed:te}),max:My({config:Oe,larger:Fn,numeric:Ua,typed:te}),print:Ly({add:Lr,matrix:$e,typed:te,zeros:ln}),bitAnd:Wy({add:Lr,concat:Gr,equalScalar:Ir,matrix:$e,not:Uc,typed:te,zeros:ln}),diff:By({bignumber:ta,matrix:$e,number:Bi,subtract:Bt,typed:te}),min:Ey({config:Oe,numeric:Ua,smaller:Tn,typed:te}),subset:_y({add:Lr,matrix:$e,typed:te,zeros:ln}),bitOr:Yy({DenseMatrix:Fr,concat:Gr,equalScalar:Ir,matrix:$e,typed:te}),cumsum:qy({add:Lr,typed:te,unaryPlus:$y}),index:Ny({Index:bn,getMatrixDataType:Vy}),sum:Iy({add:Lr,config:Oe,numeric:Ua,typed:te}),range:Ty({bignumber:ta,matrix:$e,add:Lr,config:Oe,isPositive:Ho,larger:Fn,largerEq:Yc,smaller:Tn,smallerEq:Rs,typed:te}),row:Fy({Index:bn,matrix:$e,range:qs,typed:te}),column:wy({Index:bn,matrix:$e,range:qs,typed:te}),mean:Cy({add:Lr,divide:an,typed:te}),quantileSeq:Ry({add:Lr,bignumber:ta,compare:Vo,divide:an,isInteger:zn,larger:Fn,multiply:it,partitionSelect:$c,smaller:Tn,smallerEq:Rs,subtract:Bt,typed:te}),variance:ky({add:Lr,apply:Xy,divide:an,isNaN:pf,multiply:it,subtract:Bt,typed:te}),std:Py({map:$o,sqrt:za,typed:te,variance:sx})});ht(YR,{BigNumber:Ge,Complex:pt,Fraction:Wo,Matrix:kc,Node:_n,ObjectNode:bf,OperatorNode:oo,ParenthesisNode:ks,Range:OP,RelationalNode:HR,ResultSet:qD,ArrayNode:wf,BlockNode:$R,ConditionalNode:GR,ConstantNode:Qo,DenseMatrix:Fr,RangeNode:VR,Chain:wS,FunctionAssignmentNode:ZR,SparseMatrix:Pi,IndexNode:Df,ImmutableDenseMatrix:KD,Index:bn,AccessorNode:Sf,AssignmentNode:QR,FibonacciHeap:nS,Spa:uS,Unit:wr,SymbolNode:Xo,FunctionNode:Jo,Help:JR,Parser:KR});wS.createProxy(yf);var AS=PD;var n5=ma(Nm(),1);var e5=ma(jR(),1);function r5(e){var r=new e5.default;return e.on=r.on.bind(r),e.off=r.off.bind(r),e.once=r.once.bind(r),e.emit=r.emit.bind(r),e}function t5(e,r,t,n){function a(x,w){var C=arguments.length;if(C!==1&&C!==2)throw new ga("import",C,1,2);w||(w={});function b(O,_,E){if(Array.isArray(_))_.forEach(L=>b(O,L));else if(typeof _=="object")for(var T in _)Xe(_,T)&&b(O,_[T],T);else if(Ms(_)||E!==void 0){var R=Ms(_)?y(_)?_.fn+".transform":_.fn:E;if(Xe(O,R)&&O[R]!==_&&!w.silent)throw new Error('Cannot import "'+R+'" twice');O[R]=_}else if(!w.silent)throw new TypeError("Factory, Object, or Array expected")}var N={};b(N,x);for(var M in N)if(Xe(N,M)){var S=N[M];if(Ms(S))o(S,w);else if(u(S))i(M,S,w);else if(!w.silent)throw new TypeError("Factory, Object, or Array expected")}}function i(x,w,C){if(C.wrap&&typeof w=="function"&&(w=c(w)),m(w)&&(w=e(x,{[w.signature]:w})),e.isTypedFunction(t[x])&&e.isTypedFunction(w)){C.override?w=e(x,w.signatures):w=e(t[x],w),t[x]=w,delete n[x],s(x,w),t.emit("import",x,function(){return w});return}if(t[x]===void 0||C.override){t[x]=w,delete n[x],s(x,w),t.emit("import",x,function(){return w});return}if(!C.silent)throw new Error('Cannot import "'+x+'": already exists')}function s(x,w){w&&typeof w.transform=="function"?(t.expression.transform[x]=w.transform,d(x)&&(t.expression.mathWithTransform[x]=w.transform)):(delete t.expression.transform[x],d(x)&&(t.expression.mathWithTransform[x]=w))}function l(x){delete t.expression.transform[x],d(x)?t.expression.mathWithTransform[x]=t[x]:delete t.expression.mathWithTransform[x]}function c(x){var w=function(){for(var b=[],N=0,M=arguments.length;N2&&arguments[2]!==void 0?arguments[2]:x.fn;if(Jb(C,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(C));var b=y(x)?t.expression.transform:t,N=C in t.expression.transform,M=Xe(b,C)?b[C]:void 0,S=function(){var _={};x.dependencies.map(ew).forEach(T=>{if(Jb(T,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(T));T==="math"?_.math=t:T==="mathWithTransform"?_.mathWithTransform=t.expression.mathWithTransform:T==="classes"?_.classes=t:_[T]=t[T]});var E=x(_);if(E&&typeof E.transform=="function")throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(M===void 0||w.override)return E;if(e.isTypedFunction(M)&&e.isTypedFunction(E))return e(M,E);if(w.silent)return M;throw new Error('Cannot import "'+C+'": already exists')};!x.meta||x.meta.lazy!==!1?(Du(b,C,S),M&&N?l(C):(y(x)||h(x))&&Du(t.expression.mathWithTransform,C,()=>b[C])):(b[C]=S(),M&&N?l(C):(y(x)||h(x))&&Du(t.expression.mathWithTransform,C,()=>b[C])),n[C]=x,t.emit("import",C,S)}function u(x){return typeof x=="function"||typeof x=="number"||typeof x=="string"||typeof x=="boolean"||x===null||Ht(x)||Kt(x)||rr(x)||da(x)||Qe(x)||Array.isArray(x)}function m(x){return typeof x=="function"&&typeof x.signature=="string"}function d(x){return!Xe(v,x)}function h(x){return x.fn.indexOf(".")===-1&&!Xe(v,x.fn)&&(!x.meta||!x.meta.isClass)}function y(x){return x!==void 0&&x.meta!==void 0&&x.meta.isTransformFunction===!0||!1}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return a}function cx(e,r){var t=ht({},Ss,r);if(typeof Object.create!="function")throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var n=r5({isNumber:sr,isComplex:Kt,isBigNumber:rr,isFraction:da,isUnit:Ht,isString:St,isArray:Mr,isMatrix:Qe,isCollection:Nt,isDenseMatrix:Ji,isSparseMatrix:ha,isRange:Fo,isIndex:Mi,isBoolean:fm,isResultSet:cm,isHelp:xu,isFunction:lm,isDate:mm,isRegExp:pm,isObject:Ci,isNull:dm,isUndefined:hm,isAccessorNode:Ln,isArrayNode:jt,isAssignmentNode:vm,isBlockNode:gm,isConditionalNode:ym,isConstantNode:xr,isFunctionAssignmentNode:Oa,isFunctionNode:yn,isIndexNode:Jn,isNode:Nr,isObjectNode:Ei,isOperatorNode:ct,isParenthesisNode:en,isRangeNode:xm,isRelationalNode:bm,isSymbolNode:at,isChain:bu});n.config=ZA(t,n.emit),n.expression={transform:{},mathWithTransform:{config:n.config}};var a=[],i=[];function s(u){if(Ms(u))return u(n);var m=u[Object.keys(u)[0]];if(Ms(m))return m(n);if(!$A(u))throw console.warn("Factory object with properties \`type\`, \`name\`, and \`factory\` expected",u),new Error("Factory object with properties \`type\`, \`name\`, and \`factory\` expected");var d=a.indexOf(u),h;return d===-1?(u.math===!0?h=u.factory(n.type,t,s,n.typed,n):h=u.factory(n.type,t,s,n.typed),a.push(u),i.push(h)):h=i[d],h}var l={};function c(){for(var u=arguments.length,m=new Array(u),d=0;d{Ub(l).forEach(u=>{u&&u.meta&&u.meta.recreateOnConfigChange&&o(u,{override:!0})})}),n.create=cx.bind(null,e),n.factory=F,n.import(Ub(YA(e))),n.ArgumentsError=ga,n.DimensionError=pr,n.IndexError=tn,n}var LS=ma(um());var i5=ma(a5()),TS=class{constructor(){this.lang="en";this.all={en:{hintText:{dragDropModifierKeys:"Hold \${1} to Pin and \${2} to Copy",createListItem:"Select/Create List Item Frame",dragDropProperties:"Drag and drop properties to link them into the list",newItem:"+ New",selectNote:"Select Note...",newFrame:"New"},defaults:{spaceNote:"Current Note",spaceContext:"Current Space"},commands:{h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",columns:"Columns",tabs:"Tabs",button:"Button",label:"Label",column:"Column",idea:"New",group:"Group",paragraph:"Text",card:"Card",progress:"Progress",rating:"Rating",circularProgress:"Circular Progress",list:"Bullet List","ordered-list":"Numbered List",todo:"To-do List",quote:"Quote",internal:"Link to Note",context:"Embed Existing Context",flow:"Embed Note or Space",board:"New Board",divider:"Divider",note:"Note Block",link:"Web Link",callout:"Callout",bookmark:"Bookmark",table:"New Table",codeblock:"Code Block",toggle:"Toggle",emoji:"Emoji",image:"Image",newNote:"New Note",tag:"Tag",makeMenu:"Flow Menu",selectStyle:"Style",toggleKeyboard:"Toggle Keyboard",rows:"Rows",masonry:"Gallery"},styles:{bold:"Bold",italics:"Italics",strikethrough:"Strikethrough",code:"Code",link:"Web Link",blocklink:"Link to Note",textColor:"Text Color",highlight:"Highlight"},commandsSuggest:{noResult:"No result"},commandPalette:{enable:"Enable",disabled:"Disable",openFlow:"Open Flow Blocks in Selection",closeFlow:"Close Flow Blocks in Selection",toggleBold:"Toggle Bold",toggleItalics:"Toggle Italics",openSpaces:"Open Spaces",blink:"Blink",openFileContext:"Open Explorer",convertPathToSpace:"Convert to Space",revealFile:"Reveal File in Spaces",releaseNotes:"Release Notes",toggleBacklinks:"Toggle Backlinks",collapseAllFolders:"Collapse All Folders",addFileSpace:"Add File to Space",removeFileSpace:"Remove File from Space"},frames:{sections:{kit:"Kit",paths:"Paths"},label:{label:"Label",description:"Label"},note:{label:"Note",description:"Link to a note"},table:{label:"Table",description:"Table"},context:{label:"Context",description:"Display a context view from another space"},calendar:{label:"Calendar View"},field:{label:"Field",description:"Dynamic node that displays a value based on property type"},event:{label:"Event"},divider:{label:"Divider",description:"Divider to separate your content"},button:{label:"Button",description:"Buttons can perform actions and open links"},callout:{label:"Callout",description:"Callout to highlight important information"},toggle:{label:"Toggle",description:"Toggle to show/hide content"}},menu:{layout:"Layout",enterFlowState:"Enter Flow State",exitFlowState:"Exit Flow State",newView:"New View",calendarView:"Calendar View",dayView:"Day View",closeSpace:"Close Space",customView:"Custom View",detailsView:"Details View",catalogView:"Catalog View",galleryView:"Gallery View",deleteContext:"Delete Context",openSpace:"Open Space",revealInDefault:"Reveal in Finder",revealInExplorer:"Reveal in Explorer",setNone:"None",fileMetadataDescription:"This note only",openFilePane:"Open in a new pane",rename:"Rename",changeToFolderNote:"New Space from Note",moveFile:"Move file to...",moveFolder:"Move folder to...",duplicate:"Make a copy",edit:"Edit",delete:"Delete",getHelp:"Make.md Community",vault:"Vault",openVault:"Open Another Vault",openVaultInFolder:"Open Vault Folder",obSettings:"Obsidian Settings",commandPalette:"Command Palette",backToSpace:"Back to Spaces",collapseAllSections:"Collapse All Spaces",expandAllSections:"Expand All Spaces",collapseAllFolders:"Collapse All Folders",expandAllFolders:"Expand All Folders",spaceTitle:"Add/Remove in Space",home:"Home",waypoints:"Waypoints",none:"None",tableView:"Table View",cardView:"Card View",boardView:"Board View",listView:"List View",flowView:"Flow View",groupBy:"Group",sortBy:"Sort",filters:"Filters",newFilter:"New Filter",clearFilters:"Clear Filters",hide:"Hide",unhideFields:"Unhide All Properties",importDataview:"Import All Dataview Properties",saveAllProperties:"Save All Properties to Files",mergeProperties:"Merge Properties",removeFromSpace:"Unpin from Space",removeFromWaypoints:"Unpin from Waypoints",editCode:"Edit Code",editProperties:"Edit Properties",properties:"Properties",deleteProperty:"Delete Property",hideProperty:"Hide Property",unhideProperty:"Unhide Property",saveProperty:"Save Property",sortAscending:"Sort Ascending",sortDescending:"Sort Descending",deleteRow:"Delete Item",collapseAll:"Collapse All",customSort:"Custom Sort",groupSpaces:"Group Spaces",fileNameSortAlphaAsc:"File Name (A to Z)",fileNameSortAlphaDesc:"File Name (Z to A)",fileNameSortNumericalAsc:"File Name (1 to 9)",fileNameSortNumericalDesc:"File Name (9 to 1)",createdTimeSortAsc:"Created Time (new to old)",createdTimeSortDesc:"Created Time (old to new)",modifiedTimeSortAsc:"Modified Time (new to old)",modifiedTimeSortDesc:"Modified Time (old to new)",sizeSortAsc:"Size (smallest to largest)",sizeSortDesc:"Size (largest to smallest)",spaces:"Spaces",tags:"Tags",manageHiddenFiles:"Manage Hidden Files",manageActions:"Manage Actions",deleteSpace:"Delete",changeColor:"Change Color",changePropertyType:"Change Type",deleteFiles:"Delete Files",createFolderSpace:"Create Space from Folder",folder:"Folder",syncToContext:"Add Property to Context",setIcon:"Set Icon",copyEmbedLink:"Copy Embed Link",moveUp:"Move Up",moveDown:"Move Down",moveTo:"Move To",groupNodes:"Group Nodes",moveFrame:"Move Frame",renameFrame:"Rename Frame",deleteFrame:"Delete Frame",insertAbove:"Insert Above",insertBelow:"Insert Below"},editor:{rows:"Rows",columns:"Columns",catalog:"Catalog",gallery:"Gallery",grid:"Grid",scaleToFit:"Change to Fit",scaleToFill:"Change to Fill",fit:"Fit",strokeNone:"None",strokeSolid:"Solid",strokeDotted:"Dotted",strokeDashed:"Dashed",size:"Size",gap:"Gap",marginLeft:"Left",marginTop:"Top",marginRight:"Right",marginBottom:"Bottom",minimize:"Minimize",paddingLeft:"Left",paddingTop:"Top",paddingRight:"Right",paddingBottom:"Bottom",unlinkProperty:"Unlink Property",linkedProperty:"Linked Property",linkProperty:"Link Property",currentSpace:"Current Space",linkName:"\${1} Link",linkThumbnail:"\${1} Thumbnail",linkSticker:"\${1} Sticker",opacity:"Opacity",shadowSpread:"Spread",shadowBlur:"Blur",width:"Width",height:"Height",margin:"Margin",padding:"Padding",bold:"Bold",italic:"Italic",underline:"Underline",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",numberOfLines:"Lines",createVerticalSection:"Create Vertical Section",createHorizontalSection:"Create Horizontal Section",themeColors:"Theme Colors",uiColors:"UI Colors",hex:"Hex"},buttons:{add:"Add",alias:"Alias",addFilter:"Add Filter",loadMore:"Load More",addCondition:"Add Condition",customize:"Customize",moreOptions:"More Options",saveProperty:"Save Property",newNote:"New Note",changeIcon:"Change Sticker",removeIcon:"Remove Sticker",addIcon:"Add Sticker",addCover:"Add Cover",addDisplay:"Display Name",changeBanner:"Change Cover",changeBannerShort:"Cover",saveChanges:"Save Changes",removeBanner:"Remove Cover",rename:"Change Name",editFrame:"Edit Frame",saveSpace:"Save Space",createSpace:"New Space",createFolder:"New Folder",createNote:"New Note",createCanvas:"New Canvas",addIntoSpace:"New Pin",addSmartSearch:"Add Live Search",addItem:"Add Item",addProperty:"Add Property",editProperty:"Edit Property",addContext:"Add Context",cancel:"Cancel",search:"Search",delete:"Delete",toggleFlow:"Toggle Flow",openFlow:"Open Flow",hideFlow:"Hide Flow",openLink:"Open Link",addToSpace:"Add to Space",addToSpaceShort:"Pin",addTag:"Add Tag",tag:"Tag",syncFields:"Sync Properties",convertTable:"Convert to Markdown",cutTable:"Cut Table",deleteTable:"Delete From Note",blink:"Blink",addFile:"Add Item",merge:"Merge",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",deleteView:"Delete View",renameTable:"Rename Table",renameTag:"Rename Tag",createTag:"Create Tag",currentFolder:"Current Folder",sync:"Sync",pasteCSS:"Paste CSS",save:"Save",run:"Run"},metadataTypes:{fileName:"File Name",contexts:"Contexts",path:"Path",folder:"Folder",sticker:"Sticker",color:"Color",created:"Created",lastModified:"Last Modified",extension:"Extension",size:"Size",tags:"Tags",inlinks:"Linked Mentions",outlinks:"Links",label:"Label",fileMetadata:"File Metadata",frontmatter:"Frontmatter"},filterTypes:{contains:"contains",notContains:"does not contain",is:"is",isNot:"is not",before:"before",after:"on or after",anyOf:"is any of",noneOf:"is none of",checked:"is checked",unchecked:"is unchecked",isEmpty:"is empty",isNotEmpty:"is not empty",isSameDate:"is same date",isSameDateAsToday:"today"},sortTypes:{alphaAsc:"A to Z",alphaDesc:"Z to A",earliest:"Earliest",latest:"Latest",checkAsc:"Checked \\u2192 Unchecked",checkDesc:"Unchecked \\u2192 Checked",itemsAsc:"Least Items",itemsDesc:"Most Items"},properties:{defaultField:"Name",audio:{label:"Audio",description:"Audio"},text:{label:"Text",description:"Text field"},number:{label:"Number",description:"Number field with optional unit"},boolean:{label:"Yes/No",description:"Yes or No toggle to indicate the status"},date:{label:"Date",description:"Select a date from a calendar"},option:{label:"Option",description:"Select one or multiple option from a list"},file:{label:"File"},link:{label:"Link",description:"Link to another note or a website"},tags:{label:"Tags",description:"Use tags to quickly organize your items"},object:{label:"Object",description:"Store any complex objects"},context:{label:"Relation",description:"Connect to another context property and create a relation"},image:{label:"Image",description:"Select any image from your system or from the internet"},color:{label:"Color",description:"Use colors to label your items or status"},space:{label:"Context",description:"Link to a context"},icon:{label:"Sticker",description:"Use stickers to uniquely label your items or status"},super:{label:"Super Property",links:"Open Link",properties:"Update Property",api:"API",obsidianCommands:"Run Command",runCommand:"Run Command",performAction:"Perform Action",whenClicked:"When Clicked"},fileProperty:{name:"Name",label:"Formula",createdTime:"Created",modifiedTime:"Last Edited",sticker:"Sticker",links:"Links",tags:"Tags",spaces:"Spaces",extension:"Extension",size:"Size",preview:"Note Preview",parentFolder:"Folder",description:"Use a formula to dynamically display a property"}},views:{navigator:"Navigator",explorer:"Explorer",space:"Space"},subViews:{spaceItems:"Items",spaceContext:"Context",spaceLists:"Lists",spaceActions:"Actions",spaceTemplates:"Templates",smartSearch:"Live Searches",filesAndFolders:"Files and Folders"},labels:{duplicateTable:"Duplicate Table",pinned:"Pinned",live:"Pinned by Live Search",moveTable:"Move Table",editFormula:"Edit Formula",editObject:"Edit Object",properties:"Properties",newAction:"Action",newTable:"List",template:"Template",createFolder:"New Folder Name",rename:"Rename",createNew:"New",default:"Default",done:"Done",changeCoverShort:"Change",reposition:"Reposition",tables:"Tables",selectDateFormat:"Select/Type Date Format",renameSection:"Edit Space",createSection:"New Folder",createNote:"New Note",contextMaker:"Context Maker",select:"Select",pinnedItems:"Pinned Items",collapse:"Collapse",expand:"Expand",all:"All",none:"None",view:"View",findStickers:"Find Sticker",mergeProperties:"Merge Properties",placeholder:"Type '\${1}' for commands",notePlaceholder:"New Note for \${1}",itemsSelected:"\${1} Selected",selectNote:"Select Note",selectIcon:"Select Icon",selectImage:"Select Image",selectSpace:"Select Space",styleSmall:"Small",styleMedium:"Medium",styleLarge:"Large",hiddenFilePattern:"Name, Suffixes and Extension",hiddenFileSpecific:"Exclude specific files and folders",textPlaceholder:"Enter Text",noFile:"is not created yet. Click to create.",navigatorSearchPlaceholder:"Search by Text or Filters",blinkPlaceholder:"Quickly Search a File, Folder, Tag... Press Tab to Edit",searchPlaceholder:"Type to search...",contextItemSelectPlaceholder:"Find Item",linkItemSelectPlaceholder:"Find or Create Note",pinNotePlaceholder:"Select a Note or Space to Pin",optionItemSelectPlaceholder:"Select Option",viewItemSelectPlaceholder:"Select View",tagItemSelectPlaceholder:"Find Tag",spaceSelectPlaceholder:"Select any Folder or Tag",propertyItemSelectPlaceholder:"Select Property",sortItemSelectPlaceholder:"Select Sort",filterItemSelectPlaceholder:"Select Filter",imageSelectPlaceholder:"Select an image or paste a URL",imageNotFoundPlaceholder:"No Images Found",syncFrontmatterProperty:"Sync Frontmatter Property",newProperty:"New Property",newPropertyShort:"New Property",propertyType:"Type",propertyDynamic:"Dyanmic",propertyValueSpace:"Space",propertyValueProperty:"Property",propertyLookup:"Edit Formula",dateFormat:"Date Format",propertyFileProp:"Property",multiple:"Multiple",filesCount:"{$1} Files",hiddenFiles:"Hidden Files",addExtension:"Add Rule",saveView:"Save View",saveTable:"Save Table",renameView:"Rename View",renameTable:"Rename Table",syncMetadata:"Sync Metadata",syncProperties:"Sync Properties",selectContext:"Select Context",metadata:"Metadata",backlinks:"Backlinks",spaces:"Spaces",contexts:"Contexts",content:"Content",deleteSpace:"Delete Space",deleteFiles:"Delete Files",outgoingLinks:"Outgoing Links",moveTo:"Move to",addTo:"Pin to",copyTo:"Copy to",reorderIn:"Reorder in",border:"Border",corners:"Corners",color:"Color",backgroundColor:"Background",cornerRadius:"Radius",onClick:"On Click",layout:"Layout",element:"Element",name:"Name",display:"Display",alignment:"Alignment",margin:"Margin",padding:"Padding",gap:"Gap",width:"Width",height:"Height",opacity:"Opacity",shadow:"Shadow",shadowBlur:"Blur",shadowSpread:"Spread",typography:"Typography",layers:"Layers",fontSize:"Size",props:"Props",styles:"Styles",events:"Events",code:"Code",selectedLayers:"\${1} Layers"},descriptions:{spaceActions:"Create actions that runs when you press a button",spaceLists:"Create lists to track data and organize them in your space",spaceItems:"Add new items to the space or pin items to the space",spaceTemplates:"Create templates to quickly add items to your space",smartSearch:"Automatically pin notes to this space based on a set of searches",hiddenFileOptions:"Exclude any files and folders by name, suffix or extension.",deleteSpace:"Deleting the space will also delete the folder and its contents.",deleteFiles:"Delete \${1} files/folders and their contents?",addContext:"Contexts lets you connect properties from your tags",spaceProperties:"Define Properties for your Space Items",syncMetadata:"Select which fields from your notes to start syncing with the context.",syncProperties:"Contexts defines and syncs the same fields across your notes depending on their folder or tag.",selectContext:"Select which folder or tag context you want to sync the fields."},flowView:{emptyDoc:"Empty Document",itemsCount:" Items",emptyFolder:"This Folder is Empty"},notice:{duplicateFile:"Folder already contains note with same name",addedToSection:"Added to Space",fileExists:"File Already Exists",folderExists:"Folder Already Exists",noPropertyName:"Property Name is Required",duplicatePropertyName:"Duplicate Property Name",newSpaceName:"Enter a name for your space",duplicateSpaceName:"Space name already exists",cantConvertNoteToSpace:"The view is not a note",templateSaved:"Template saved to space: ",tableDeleted:"Table removed from note, you can find the table in the folder space"},settings:{layoutVertical:"Vertical",layoutHorizontal:"Horizontal",sectionSidebar:"Spaces",sectionEditor:"Maker Mode",sectionFlow:"Flow",sectionAdvanced:"Advanced",sectionDataview:"Dataview",sectionContext:"Context",sectionStickers:"Stickers",sectionNavigator:"Navigator",sectionDefault:"Default Spaces",sectionSpaceView:"Space View",sectionBlink:"Blink",sectionInlineContext:"Inline Context",sectionFlowBlock:"Flow Block",sectionFlowMenu:"Flow Menu",sectionFlowStyler:"Flow Styler",experimental:{name:"Experimental",desc:"Experimental features that are subject to change and may not be optimized for performance"},generateThumbnails:{name:"Generate Thumbnails",desc:"Create thumbnails for images to speed up performance"},minimalThemeFix:{name:"Minimal Theme Fix",description:"Apply fixes for the popular theme Minimal"},inlineStickerMenu:{name:"Inline Stickers",desc:"Add inline stickers by typing :"},openSpacesOnLaunch:{name:"Open Spaces as Default Tab",desc:"Open the Spaces tab when Obsidian launches"},defaultSpaceTemplate:{name:"Default Space Template",desc:"Select the default template for new spaces"},defaultDateFormat:{name:"Default Date Format",desc:"Set the default date format, example: yyyy-MM-dd (see https://date-fns.org/v2.30.0/docs/format)"},newNotePlaceholder:{name:"New Note Placeholder",desc:"Default name for new notes"},folderIndentationLines:{name:"Show Folder Indentation Lines",desc:"Turn on to show a line on the left of folders to indicate indentation"},folderNoteLocation:{name:"Folder Note Location Inside Folder",desc:"Turn on to have folder notes inside the folder, turn off to have it outside"},folderViewDefault:{name:"Show Folder Note by Default",desc:"Show the folder note by default when opening a folder"},internalLinkFlowEditor:{name:"Show Toggles to Open Flow Editor on Links",desc:"Turn on to toggle Flow Blocks directly in inline links"},internalLinkSticker:{name:"Show Stickers on Links",desc:"Turn on to toggle stickers shown directly by beside internal links"},syncContextToFrontmatter:{name:"Sync Context Fields to Frontmatter",desc:"Turn on to automatically save all context fields to frontmatter fields, not just existing frontmatter fields."},syncFormulaToFrontmatter:{name:"Sync Formula Fields to Frontmatter",desc:"Turn on to save calculated formula values to frontmatter fields."},inlineBacklinks:{name:"Show Inline Backlinks (Inline Context required)",desc:"Show editable backlinks at the bottom of your notes"},dataviewInlineContext:{name:"Show Dataview in Inline Context",desc:"Show dataview when inline context is enabled"},inlineContextExplorer:{name:"Inline Context",desc:"Display the context and a banner at the top of your notes"},inlineContextProperties:{name:"Inline Context Properties",desc:"Show the properties in the inline context"},inlineContextExpanded:{name:"Auto Expand Inline Context",desc:"Expand the inline context sections when opening a note"},inlineContextHorizontal:{name:"Inline Title and Sticker Layout",desc:"Layout for inline title and sticker in Inline Context"},hideFrontmatter:{name:"Hide Frontmatter Properties",desc:"Hide the frontmatter properties in inline context"},openFileContext:{name:"Auto Open Explorer",desc:"Automatically open explorer panel in the right panel"},folderNote:{name:"Enable Folder Note",desc:"Access the folder note in the folder page and hide the folder note from spaces"},folderNoteName:{name:"Folder Note Name",desc:"Name of the folder note, keep blank to use the same name as the folder"},expandFolder:{name:"Auto Expand Folder",desc:"Auto expand folders on click"},hoverPreview:{name:"Preview on Hover",desc:"Preview on Hover while holding Control/Command key"},activeFile:{name:"Reveal Active File",desc:"Automatically reveal the active file in Spaces"},contexts:{name:"Contexts",desc:"Contexts allows you to have full control over the metadata of your files"},spaces:{name:"Navigator",desc:"The navigator lets you create and organize your spaces"},spacesStickers:{name:"Stickers",desc:"Use Emojis to make it easier to find your notes"},spacesAlias:{name:"Alias",desc:"Use the alias metadata to show in Spaces"},spacesFileExplorerDual:{name:"Compatibility Mode",desc:"This will improve the compatibility of plugins while using Spaces"},spacesDeleteOption:{name:"Delete File Option",desc:"Select how you want files to be deleted"},spacesDeleteOptions:{permanant:"Delete Permanently",trash:"Move to Obsidian Trash","system-trash":"Move to System Trash"},flowState:{name:"Flow State",desc:"Toggle the flow state"},hideRibbon:{name:"App Ribbon",desc:"Show/hide the left menu aka. ribbon"},spaceView:{name:"Space View",desc:"Open the space view when you click on a space"},defaultSpaces:{name:"Default Spaces",desc:"Recommended spaces for quickly organizing your vault"},homeSpace:{name:"Home Space",desc:"An easy-to-access space where you can add/organize your other spaces"},tagSpaces:{name:"Tag Spaces",desc:"Automatically create spaces for each of your tags"},readableLineWidth:{name:"Readable Line Width",desc:"Use Readable Line Width"},sidebarTabs:{name:"Sidebar Tabs",desc:"Show/hide other sidebar tabs"},spacesPerformance:{name:"Performance Mode",desc:"Turn on performance mode for Spaces, may affect scrolling appearance. Requires Restart"},indexSVG:{name:"Use SVGs as Stickers",desc:"Use any svg file in your vault as a sticker"},inlineStyler:{name:"Flow Styler",desc:"Select text to add styling"},inlineStylerColor:{name:"Text and Highlight Colors \\u{1F9EA}",desc:"Select text color and highlight color, (this may change in the future because of the limitations with HTML and Obsidian)"},spaceRowHeight:{name:"Row Height",desc:"The height for each row in spaces (in pixels), default is 29"},contextPagination:{name:"Table View Pagination",desc:"Number of items per page in table view"},coverHeight:{name:"Cover Height",desc:"The height for the cover of the note or space, default is 200"},makeChar:{name:"Flow Menu Trigger",desc:"Character to open the Flow Menu"},mobileMakeBar:{name:"Flow Styler (Mobile)",desc:"Replaces the mobile toolbar"},editorMarkSans:{name:"Mark Sans \\u{1F9EA}",desc:"Use the editor without Markdown."},editorMakerMode:{name:"Flow (Beta)",desc:"An integrated and intuitive editor experience"},editorMakePlacholder:{name:"Flow Menu Hint Text",desc:"Show a hint text on how to open the Flow Menu Shortcut"},blink:{name:"Blink",desc:"A faster way to search and edit your notes"},editorMakeMenu:{name:"Flow Menu",desc:"Open the Flow menu to quickly add content"},editorMakeMenuTrigger:{name:"Flow Menu Shortcut",desc:"Trigger key to use flow menu"},editorFlowReplace:{name:"Flow Block",desc:"Open your internal links or toggle your embeds in the flow block."},editorFlowStyle:{name:"Flow Block Style",desc:"Select a theme for your flow block",seamless:"Seamless",classic:"Classic",minimal:"Minimal"}}}};this.lang="en";let r=i5.default.locale();["en"].includes(r)&&(this.lang=r)}get texts(){return this.all.en}},Br=new TS().texts;var FS=e=>e.lastIndexOf("/")!=-1?e.lastIndexOf(".")!=-1?MA(e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))):e.substring(e.lastIndexOf("/")+1):e.lastIndexOf(".")!=-1?e.substring(0,e.lastIndexOf(".")):e;var kZ=ma(um());var BZ=(e,r)=>{let t=n=>n=="builtin"?"Builtin":n=="api"?"Spaces":"Action";return[...(e.actionsIndex.get(r)??[]).map(n=>({name:n.schema.name,description:"Action",value:\`\${r}/#;\${n.schema.id}\`,section:"Action"}))??[],...[...e.cli.allCommands()].map(n=>({name:n.schema.name,description:t(n.schema.type),value:n.path,section:t(n.schema.type)}))]};var o5=({field:e,value:r})=>r=="ctime"?{value:"parseDate(prop('File')['metadata']['ctime'])",type:"date"}:{value:"",type:"string"},lx=(e,r,t,n)=>{let a=bc(e);if(a)return r=="fileprop"&&a.field?o5(a):(r=="option"&&a.source?.length>0&&(a.source=="$commands"?a.options=t.cli.allCommands():a.source=="$links"?a.options=t.spaceManager.allPaths().map(i=>({name:i,value:i})):a.source=="$super"?a.options=BZ(t,n):a.source=="$properties"&&(a.options=t.contextsIndex.get(n)?.contextTable?.cols?.map(i=>({name:i.name,value:i.name}))??[])),[...s5(r).configKeys??[],"alias","default"].reduce((i,s)=>({...i,[s]:a[s]}),{}));if(!r)return{};if(!a)if(r=="context")e?.length>0?a={space:e}:a={};else if(r.startsWith("date"))e?.length>0?a={format:e}:a={};else if(r.startsWith("fileprop"))if(e?.length>0){let[i,s]=e.split(".");a=o5({field:i,value:s})}else a={};else r.startsWith("option")&&(e?.length>0?a={options:gn(e).map(s=>({name:s,value:s}))}:a={});return a??{}};var s5=(e,r)=>r==Xn?Af.find(t=>t.type=="file"):r=="tags"?Af.find(t=>t.type=="tags-multi"):r=="aliases"?Af.find(t=>t.type=="option-multi"):r=="sticker"?Af.find(t=>e=="icon"):Af.find(t=>e==t.type)||Af.find(t=>e==t.multiType),Af=[{type:"unknown",label:"",restricted:!0,icon:"ui//file-question"},{type:"any",label:"",restricted:!0,icon:"ui//wildcard",multi:!0,multiType:"any-multi"},{type:"text",label:Br.properties.text.label,metadata:!0,icon:"ui//text",primative:!0,description:Br.properties.text.description},{type:"number",label:Br.properties.number.label,metadata:!0,icon:"ui//binary",configKeys:["unit"],primative:!0,description:Br.properties.number.description},{type:"boolean",label:Br.properties.boolean.label,metadata:!0,icon:"ui//check-square",primative:!0,description:Br.properties.boolean.description},{type:"date",label:Br.properties.date.label,metadata:!0,icon:"ui//calendar",configKeys:["format"],primative:!0,description:Br.properties.date.description},{type:"option",label:Br.properties.option.label,multi:!0,multiType:"option-multi",icon:"ui//list",configKeys:["options","source"],description:Br.properties.option.description},{type:"tags-multi",label:Br.properties.tags.label,icon:"ui//tags",description:Br.properties.tags.description},{type:"file",label:Br.properties.file.label,restricted:!0,icon:"ui//mk-make-h3"},{type:"fileprop",label:Br.properties.fileProperty.label,icon:"ui//formula",configKeys:["field","value","type"],description:Br.properties.fileProperty.description},{type:"link",label:Br.properties.link.label,multi:!0,multiType:"link-multi",metadata:!0,icon:"ui//file-text",primative:!0,description:Br.properties.link.description},{type:"context",label:Br.properties.context.label,icon:"ui//mk-make-note",multi:!0,multiType:"context-multi",configKeys:["space"],description:Br.properties.context.description},{type:"object",label:Br.properties.object.label,multi:!0,multiType:"object-multi",metadata:!0,icon:"ui//list-tree",configKeys:["type","typeName"],description:Br.properties.object.description},{type:"icon",label:Br.properties.icon.label,multi:!0,multiType:"icon-multi",icon:"ui//gem",restricted:!0,primative:!0,description:Br.properties.icon.description},{type:"image",label:Br.properties.image.label,multi:!0,multiType:"image-multi",metadata:!0,icon:"ui//mk-make-image",primative:!0,description:Br.properties.image.description},{type:"color",label:Br.properties.color.label,icon:"ui//mk-make-image",restricted:!0,description:Br.properties.color.description},{type:"space",label:Br.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Br.properties.space.description},{type:"table",label:Br.properties.space.label,icon:"ui//layout-grid",restricted:!0,description:Br.properties.space.description},{type:"super",label:Br.properties.super.label,icon:"ui//zap",restricted:!0,configKeys:["dynamic","field"]},{type:"input",label:Br.properties.super.label,icon:"ui//input",restricted:!0}];var li="files",dx={id:li,name:"Items",type:"db",primary:"true"},PZ="filesView",IZ={id:PZ,name:"All",type:"view",def:JSON.stringify({db:li,icon:"ui//file-stack"})},RZ="main",qZ=e=>({id:e,name:e,type:"frame",def:"",predicate:"",primary:"true"}),C4e={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[qZ(RZ),IZ]},mx={uniques:[],cols:["id","name","type","def","predicate","primary"],rows:[dx]},u5={uniques:["name,schemaId"],cols:["name","schemaId","type","value","attrs","hidden","unique","primary"]},px={...u5,rows:[{name:Xn,schemaId:li,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""},{name:Br.properties.fileProperty.createdTime,schemaId:li,type:"fileprop",value:Xn+".ctime",hidden:"",unique:"",attrs:"",primary:"true"}]};var E4e=[{name:Br.properties.defaultField,schemaId:"",type:"text",primary:"true"}],_S={...u5,rows:[{name:Xn,schemaId:li,type:"file",primary:"true",hidden:"",unique:"",attrs:"",value:""}]};var T4e={schema:dx,cols:px.rows,rows:[]},F4e={schema:dx,cols:px.rows,rows:[]},_4e={schema:dx,cols:_S.rows,rows:[]},f5=(e,r)=>e.filter(t=>r.find(n=>n.id==t.schemaId&&n.type=="db")).reduce((t,n)=>({...t,...t[n.schemaId]?{[n.schemaId]:{uniques:n.unique=="true"?[...t[n.schemaId].uniques,n.name]:t[n.schemaId].uniques,cols:[...t[n.schemaId].cols,n.name],rows:[]}}:{[n.schemaId]:{uniques:n.unique=="true"?[n.name]:[],cols:[n.name],rows:[]}}}),{});var O4e={m_schema:mx,m_fields:px,...f5(px.rows,mx.rows)},B4e={m_schema:mx,m_fields:_S,...f5(_S.rows,mx.rows)};var OS="spaces://$tags";var mRe={name:Br.menu.waypoints,readOnly:!1,path:"spaces://$waypoints",label:{name:Br.menu.waypoints,thumbnail:"",sticker:"ui//tags",color:""},type:"default"},pRe={name:Br.menu.tags,readOnly:!1,path:"spaces://$tags",label:{thumbnail:"",name:Br.menu.tags,sticker:"ui//tags",color:""},type:"default"},dRe={name:Br.menu.vault,readOnly:!1,path:"/",label:{thumbnail:"",name:Br.menu.vault,sticker:"ui//vault",color:""},type:"default"};var c5=(e,r,t,n,a,i,s)=>{if(!t)return"";let l=new Map;Object.keys(a).forEach(o=>l.set(o,a[o])),l.set("$properties",n),l.set("$paths",r),i&&l.set("$current",i);let c;try{e.evaluate("current = _current()",l),c=e.evaluate(t,l),c=Ds("",c)}catch(o){if(c="",s)throw o;console.log(i,t,o)}return c};var BS=e=>{let r=new Map;e.filter(s=>s.type=="fileprop"||s.name.startsWith("tags")).forEach(s=>{let{value:l}=lx(s.value,s.type),c=[];try{let u=Wa(l).filter(m=>m.type=="FunctionNode").filter(m=>m.fn.name=="prop"&&m.args[0].type=="ConstantNode").map(m=>m.args[0]?.value);c.push(...u)}catch{}let o=s.name;r.has(o)||r.set(o,new Set);for(let u of c){let m=u;m!==o&&r.get(o).add(m)}});let t=new Set,n=[],a=new Set,i=s=>{if(a.has(s))throw new Error("Circular dependency detected");if(!t.has(s)){a.add(s);let l=r.get(s)||new Set;for(let c of l)i(c);t.add(s),a.delete(s),n.push(s)}};for(let s of e)t.has(s.name)||i(s.name);return n},l5=(e,r,t,n,a,i)=>{if(!t)return{};let s=i??BS(n),l=r.get(t[Xn])?.metadata?.property??{},c=Object.keys(l).filter(m=>n.some(d=>d.name==m)).reduce((m,d)=>({...m,[d]:Ds(d,l[d])}),{}),o=s.map(m=>n.find(d=>d.name==m)).filter(m=>m&&(m.type=="fileprop"||m.name=="tags")),u=n.reduce((m,d)=>({...m,[d.name]:d}),{});return{...t,...c,...o.reduce((m,d)=>{let{value:h}=lx(d.value,d.type);return{...m,[d.name]:c5(e,r,h,u,{...t,...m},a)}},{})}};var m5=(e,r)=>{let t=e?gn(e):[],n=r?gn(r):[];return n.every(a=>t.some(i=>i==a))&&t.every(a=>n.some(i=>i==a))},Mf=(e,r)=>e==r,PS=(e,r)=>(e??"").length==0,IS=(e,r)=>(e??"").toLowerCase().includes((r??"").toLowerCase()),RS=(e,r)=>parseFloat(e)>parseFloat(r),qS=(e,r)=>parseInt(e){let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf()>=n.valueOf()},d5=(e,r)=>{let t=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e),n=isNaN(Date.parse(r))?new Date(parseInt(r)):new Date(r);return t.valueOf(){let t=e?gn(e):[],n=r?gn(r):[];return t.length==0?!1:n.some(a=>t.some(i=>i==a))},h5=(e,r)=>{if(!e)return!1;let t=new Date(\`\${e.toString().replace(".",":")}\`),n=new Date(\`\${r}\`);return t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()},v5=e=>{if(!e)return!1;let r=new Date(\`\${e.toString()}T00:00\`),t=new Date;return r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()};var Cf={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>!PS(e,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(e,r)=>PS(e,""),valueType:"none"},include:{fn:(e,r)=>IS(e,r),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(e,r)=>!IS(e,r),valueType:"text"},is:{type:["text"],fn:(e,r)=>Mf(e,r),valueType:"text"},isNot:{type:["text"],fn:(e,r)=>!Mf(e,r),valueType:"text"},equal:{type:["number"],fn:(e,r)=>Mf(e,r),valueType:"number"},isLink:{type:["link","context"],fn:(e,r)=>Mf(e,r),valueType:"link"},isNotLink:{type:["link","context"],fn:(e,r)=>!Mf(e,r),valueType:"link"},isGreatThan:{type:["number"],fn:(e,r)=>RS(e,r),valueType:"number"},isLessThan:{type:["number"],fn:(e,r)=>qS(e,r),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(e,r)=>!RS(e,r),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(e,r)=>!qS(e,r),valueType:"number"},dateBefore:{type:["date"],fn:(e,r)=>d5(e,r),valueType:"date"},dateAfter:{type:["date"],fn:(e,r)=>p5(e,r),valueType:"date"},isSameDate:{type:["date"],fn:(e,r)=>h5(e,r),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(e,r)=>v5(e,r),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>m5(e,r),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>kS(e,r),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(e,r)=>!kS(e,r),valueType:"list"},isTrue:{type:["boolean"],fn:(e,r)=>e=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(e,r)=>e!="true",valueType:"none"}};var zZ=(e,r,t)=>r.reduce((a,i)=>{let[s,l]=a,c=i.type=="context"?g5(l,i,t):i.type=="path"?x5(l,i,t):i.type=="frontmatter"?y5(l,i,t):b5(l,i,t),o=l.filter(u=>!c.includes(u));return[[...s,...c],o]},[[],e])[0],UZ=(e,r,t)=>r.reduce((n,a)=>a.type=="context"?g5(n,a,t):a.type=="path"?x5(n,a,t):a.type=="frontmatter"?y5(n,a,t):b5(n,a,t),e),g5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let[i,s]=r.field.split("."),l=a.metadata?.property;if(!a.spaces?.includes(i)||!l||!l[s])return!1;let c=!0;if(n){let o=r.fType=="property"?t[r.value]:r.value;c=n.fn(Ds(s,l[s]),o)}return c})},y5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=a.metadata?.property;if(!i||i[r.field]===void 0)return!1;let s=!0;if(n){let l=r.fType=="property"?t[r.value]:r.value;s=n.fn(Ds(r.field,i[r.field]),l)}return s})},x5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i="";r.field=="outlinks"?i=ws(a.outlinks??[]):r.field=="inlinks"?i=ws(a.metadata?.inlinks??[]):r.field=="tags"&&(i=ws(a.tags??[]));let s=!0;if(n){let l=r.fType=="property"?t[r.value]:r.value;s=n.fn(i,l)}return s})},b5=(e,r,t)=>{let n=Cf[r.fn];return!n||n.valueType!="none"&&r.value.length==0?[]:e.filter(a=>{let i=!0;if(n){let s=r.fType=="property"?t[r.value]:r.value;i=n.fn(a.metadata?.[r.type]?.[r.field],s)}return i})},w5=(e,r,t)=>e.reduce((a,i)=>!a||i.filters.length==0?!1:i.type=="any"?zZ([r],i.filters,t).length>0:UZ([r],i.filters,t).length>0,!0);var D5=(e,r)=>e.hiddenExtensions.some(t=>r.endsWith(t))||r.startsWith(e.spacesFolder+"/#")||e.hiddenFiles.some(t=>t==r);var S5=(e,r,t,n,a,i)=>{let s={};if(!e)return{changed:!1,cache:null};if(!r)return{changed:!1,cache:{path:e.path,schemas:[],outlinks:[],contexts:[],paths:[],contextTable:null,spaceMap:s,dbExists:!1}};let l=Object.values(r).map(N=>N.schema),c=r[li]?.rows?.map(N=>N[Xn])??[],o=t.filter(N=>!c.includes(N)),u=[...NA(t??[],c),...o],m=BS(r[li].cols),d=[...r[li].rows.filter(N=>t.includes(N[Xn])),...o.map(N=>({[Xn]:N}))].map(N=>l5(i,a,N,r[li].cols,a.get(e.path),m)),h={...r[li],rows:d},y=h.cols?.filter(N=>N.type.startsWith("context"))??[],v=h.cols?.filter(N=>N.type.startsWith("link"))??[],x=pa(y.map(N=>N.value));y.forEach(N=>{s[N.name]={},h.rows.forEach(M=>{gn(M[N.name]).forEach(S=>s[N.name][S]=[...s[N.name][S]??[],M[Xn]])})});let w=pa(h.rows.reduce((N,M)=>pa([...N,...[...y,...v].flatMap(S=>gn(M[S.name]).map(O=>wc(O)))]),[])),C={contextTable:h,path:e.path,contexts:x,outlinks:w,paths:u,schemas:l,spaceMap:s,dbExists:n},b=!1;return LS.default.isEqual(h,r)||(b=!0),{changed:b,cache:C}},N5=(e,r,t,n)=>{let a={};for(let[i,s]of e){let l=r.enableFolderNote?t.get(i)?.space.notePath??i:i,c=e.get(l)??s;if(!s)continue;let o=s?.parent??"",u=s?.type??"",m=s?.subtype??"",d=c?.label,h=n?.get(i),{changed:y,cache:v}=zS(i,r,t,c,d,u,m,o,h);a[i]={changed:y,cache:v}}return a},zS=(e,r,t,n,a,i,s,l,c)=>{let o=(W,k,q)=>W?.length>0||W?.length>0?W:k=="space"?q=="Spaces/Home"?"ui//home":q=="/"?"ui//vault":q.startsWith("spaces://")?"ui//tags":"ui//folder":"ui//file",u={label:n?.label,path:e,name:FS(e),readOnly:n?.readOnly},m=[],d=n?.tags?.map(W=>W)??[],h=D5(r,e),y=(W,k,q=new Set)=>{let K=[];for(let z of k){let oe=W.get(z)?.contexts??[];for(let le of oe)q.has(le)||(K.push(le),q.add(le),K.push(...y(W,[xc(le)],q)))}return K};if(t.has(l))for(let W of t.get(l).contexts??[])m.push(W);m.push(...d);let v=a?.name,x=n?.property?sm(n.property[r.fmKeyAlias]):[],w=o(a?.sticker,i,e),C=a?.color??"",b=n?.resolvedLinks??[],N=!1,M,S={...u,name:v,tags:pa(m),type:i,subtype:s,parent:l,label:{name:r.spacesUseAlias&&x?.length>0?x[0]:v,sticker:w,color:C,thumbnail:a?.thumbnail??"",preview:a?.preview??""},metadata:{...n},outlinks:b},O=[],_=[],E=[];s=="tag"&&O.push(OS);for(let W of m)O.push(xc(W));let T=new Set,R=(W,k)=>{if(!T.has(W)){if(T.add(W),k.dependencies?.length>0)for(let q of k.dependencies)t.has(q)&&R(q,t.get(q));if(k.space.notePath==e&&k.path!=k.space.notePath&&(N=!0,M=k.path,h=!0),s!="tag"&&s!="default"&&k.space&&k.space.path==l){O.push(W);return}if(k.metadata?.filters?.length>0&&w5(k.metadata.filters,{...S,spaces:O},k.properties)){O.push(W),E.push(W);return}if(k.metadata?.links?.length>0&&(k.metadata?.links??[]).find(K=>K==S.path)){O.push(W),_.push(W);return}}};for(let[W,k]of t)R(W,k);let L=y(t,O);O.push(...L.map(W=>xc(W))),S.tags.push(...L),N&&(S.metadata.spacePath=M);let H=h?{...S,spaces:[],hidden:h}:{...S,spaces:pa(O),linkedSpaces:_,liveSpaces:E,hidden:h},V=!0;return c&&LS.default.isEqual(H,c)&&(V=!1),{changed:V,cache:H}};function A5(e){let{path:r,settings:t,spacesCache:n,pathMetadata:a,label:i,type:s,subtype:l,parent:c,oldMetadata:o}=e;return zS(r,t,n,a,i,s,l,c,o)}function US(e,r){let{space:t,mdb:n,paths:a,dbExists:i,pathsIndex:s}=e;return S5(t,n,a,i,s,r)}function M5(e,r){let{map:t,pathsIndex:n}=e,a=new Map;for(let[i,s]of t)a.set(i,US({...s,pathsIndex:n},r));return a}function C5(e){let{pathCache:r,settings:t,spacesCache:n,oldMetadata:a}=e;return N5(r,t,n,a)}var WZ=self,YZ={...AS,createAdd:F("add",[],()=>function(r,t){return r+t}),createEqual:F("equal",[],()=>function(r,t){return r==t}),createUnequal:F("unequal",[],()=>function(r,t){return r!=t})},WS=cx(YZ);WS.import(Lb,{override:!0});WZ.onmessage=async e=>{let{payload:r,job:t}=e.data,n;t.type=="path"?n=A5(r):t.type=="context"?n=US(r,WS):t.type=="contexts"?n=M5(r,WS):t.type=="paths"&&(n=C5(r));try{postMessage({job:t,result:n})}catch(a){console.log(a),postMessage({job:t,result:{$error:\`Failed to index \${t.type} \${t.path}: \${a}\`}})}}; /*! * decimal.js v10.4.3 * An arbitrary-precision Decimal type for JavaScript. @@ -109724,9 +109777,9 @@ var Indexer = class { this.reloadQueue = []; this.reloadSet = /* @__PURE__ */ new Set(); this.callbacks = /* @__PURE__ */ new Map(); - for (let index2 = 0; index2 < numWorkers; index2++) { - const worker = new Worker2({ name: "Make.md Superstate Indexer " + (index2 + 1) }); - worker.onmessage = (evt) => this.finish(evt.data.job, evt.data.result, index2); + for (let index3 = 0; index3 < numWorkers; index3++) { + const worker = new Worker2({ name: "Make.md Superstate Indexer " + (index3 + 1) }); + worker.onmessage = (evt) => this.finish(evt.data.job, evt.data.result, index3); this.workers.push(worker); this.busy.push(false); } @@ -109750,20 +109803,20 @@ var Indexer = class { } return promise; } - finish(jerb, data2, index2) { + finish(jerb, data2, index3) { const jobKey = stringifyJob(jerb); const calls = [].concat(this.callbacks.get(jobKey) ?? []); this.reloadSet.delete(jobKey); this.callbacks.delete(jobKey); - this.busy[index2] = false; + this.busy[index3] = false; const job = this.reloadQueue.shift(); if (job !== void 0) - this.send(job, index2); + this.send(job, index3); if ("$error" in data2) { - for (const [_15, reject] of calls) + for (const [_16, reject] of calls) reject(data2["$error"]); } else { - for (const [callback, _15] of calls) + for (const [callback, _16] of calls) callback(data2); } } @@ -109880,14 +109933,14 @@ var Indexer = class { ); } nextAvailableWorker() { - const index2 = this.busy.indexOf(false); - return index2 == -1 ? void 0 : index2; + const index3 = this.busy.indexOf(false); + return index3 == -1 ? void 0 : index3; } }; // src/core/superstate/workers/search/search.worker.ts function Worker3() { - return inlineWorker('"use strict";function he(t){return Array.isArray(t)?t:typeof t=="string"?[t]:[]}var xe=(t,e)=>e.indexOf(t)>0?e.indexOf(t):e.length;function k(t){return k=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(t)}function x(t){if(t===null||t===!0||t===!1)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function f(t,e){if(e.length1?"s":"")+" required, but only "+e.length+" present")}function m(t){f(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||k(t)==="object"&&e==="[object Date]"?new Date(t.getTime()):typeof t=="number"||e==="[object Number]"?new Date(t):((typeof t=="string"||e==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn\'t accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function J(t,e){f(2,arguments);var r=m(t).getTime(),a=x(e);return new Date(r+a)}var Ke={};function T(){return Ke}function z(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}function K(t){return f(1,arguments),t instanceof Date||k(t)==="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Z(t){if(f(1,arguments),!K(t)&&typeof t!="number")return!1;var e=m(t);return!isNaN(Number(e))}function ee(t,e){f(2,arguments);var r=x(e);return J(t,-r)}var Ze=864e5;function te(t){f(1,arguments);var e=m(t),r=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var a=e.getTime(),n=r-a;return Math.floor(n/Ze)+1}function O(t){f(1,arguments);var e=1,r=m(t),a=r.getUTCDay(),n=(a=n.getTime()?r+1:e.getTime()>=i.getTime()?r:r-1}function re(t){f(1,arguments);var e=_(t),r=new Date(0);r.setUTCFullYear(e,0,4),r.setUTCHours(0,0,0,0);var a=O(r);return a}var et=6048e5;function ae(t){f(1,arguments);var e=m(t),r=O(e).getTime()-re(e).getTime();return Math.round(r/et)+1}function S(t,e){var r,a,n,o,i,s,d,l;f(1,arguments);var p=T(),c=x((r=(a=(n=(o=e?.weekStartsOn)!==null&&o!==void 0?o:e==null||(i=e.locale)===null||i===void 0||(s=i.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&n!==void 0?n:p.weekStartsOn)!==null&&a!==void 0?a:(d=p.locale)===null||d===void 0||(l=d.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&r!==void 0?r:0);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=m(t),g=h.getUTCDay(),v=(g=1&&g<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var v=new Date(0);v.setUTCFullYear(c+1,0,g),v.setUTCHours(0,0,0,0);var N=S(v,e),D=new Date(0);D.setUTCFullYear(c,0,g),D.setUTCHours(0,0,0,0);var E=S(D,e);return p.getTime()>=N.getTime()?c+1:p.getTime()>=E.getTime()?c:c-1}function ne(t,e){var r,a,n,o,i,s,d,l;f(1,arguments);var p=T(),c=x((r=(a=(n=(o=e?.firstWeekContainsDate)!==null&&o!==void 0?o:e==null||(i=e.locale)===null||i===void 0||(s=i.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&n!==void 0?n:p.firstWeekContainsDate)!==null&&a!==void 0?a:(d=p.locale)===null||d===void 0||(l=d.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&r!==void 0?r:1),h=L(t,e),g=new Date(0);g.setUTCFullYear(h,0,c),g.setUTCHours(0,0,0,0);var v=S(g,e);return v}var tt=6048e5;function oe(t,e){f(1,arguments);var r=m(t),a=S(r,e).getTime()-ne(r,e).getTime();return Math.round(a/tt)+1}function u(t,e){for(var r=t<0?"-":"",a=Math.abs(t).toString();a.length0?a:1-a;return u(r==="yy"?n%100:n,r.length)},M:function(e,r){var a=e.getUTCMonth();return r==="M"?String(a+1):u(a+1,2)},d:function(e,r){return u(e.getUTCDate(),r.length)},a:function(e,r){var a=e.getUTCHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h:function(e,r){return u(e.getUTCHours()%12||12,r.length)},H:function(e,r){return u(e.getUTCHours(),r.length)},m:function(e,r){return u(e.getUTCMinutes(),r.length)},s:function(e,r){return u(e.getUTCSeconds(),r.length)},S:function(e,r){var a=r.length,n=e.getUTCMilliseconds(),o=Math.floor(n*Math.pow(10,a-3));return u(o,r.length)}},b=rt;var F={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},at={G:function(e,r,a){var n=e.getUTCFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return a.era(n,{width:"abbreviated"});case"GGGGG":return a.era(n,{width:"narrow"});case"GGGG":default:return a.era(n,{width:"wide"})}},y:function(e,r,a){if(r==="yo"){var n=e.getUTCFullYear(),o=n>0?n:1-n;return a.ordinalNumber(o,{unit:"year"})}return b.y(e,r)},Y:function(e,r,a,n){var o=L(e,n),i=o>0?o:1-o;if(r==="YY"){var s=i%100;return u(s,2)}return r==="Yo"?a.ordinalNumber(i,{unit:"year"}):u(i,r.length)},R:function(e,r){var a=_(e);return u(a,r.length)},u:function(e,r){var a=e.getUTCFullYear();return u(a,r.length)},Q:function(e,r,a){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(r){case"Q":return String(n);case"QQ":return u(n,2);case"Qo":return a.ordinalNumber(n,{unit:"quarter"});case"QQQ":return a.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,r,a){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(r){case"q":return String(n);case"qq":return u(n,2);case"qo":return a.ordinalNumber(n,{unit:"quarter"});case"qqq":return a.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,r,a){var n=e.getUTCMonth();switch(r){case"M":case"MM":return b.M(e,r);case"Mo":return a.ordinalNumber(n+1,{unit:"month"});case"MMM":return a.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(n,{width:"wide",context:"formatting"})}},L:function(e,r,a){var n=e.getUTCMonth();switch(r){case"L":return String(n+1);case"LL":return u(n+1,2);case"Lo":return a.ordinalNumber(n+1,{unit:"month"});case"LLL":return a.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(n,{width:"wide",context:"standalone"})}},w:function(e,r,a,n){var o=oe(e,n);return r==="wo"?a.ordinalNumber(o,{unit:"week"}):u(o,r.length)},I:function(e,r,a){var n=ae(e);return r==="Io"?a.ordinalNumber(n,{unit:"week"}):u(n,r.length)},d:function(e,r,a){return r==="do"?a.ordinalNumber(e.getUTCDate(),{unit:"date"}):b.d(e,r)},D:function(e,r,a){var n=te(e);return r==="Do"?a.ordinalNumber(n,{unit:"dayOfYear"}):u(n,r.length)},E:function(e,r,a){var n=e.getUTCDay();switch(r){case"E":case"EE":case"EEE":return a.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(n,{width:"short",context:"formatting"});case"EEEE":default:return a.day(n,{width:"wide",context:"formatting"})}},e:function(e,r,a,n){var o=e.getUTCDay(),i=(o-n.weekStartsOn+8)%7||7;switch(r){case"e":return String(i);case"ee":return u(i,2);case"eo":return a.ordinalNumber(i,{unit:"day"});case"eee":return a.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(o,{width:"short",context:"formatting"});case"eeee":default:return a.day(o,{width:"wide",context:"formatting"})}},c:function(e,r,a,n){var o=e.getUTCDay(),i=(o-n.weekStartsOn+8)%7||7;switch(r){case"c":return String(i);case"cc":return u(i,r.length);case"co":return a.ordinalNumber(i,{unit:"day"});case"ccc":return a.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(o,{width:"narrow",context:"standalone"});case"cccccc":return a.day(o,{width:"short",context:"standalone"});case"cccc":default:return a.day(o,{width:"wide",context:"standalone"})}},i:function(e,r,a){var n=e.getUTCDay(),o=n===0?7:n;switch(r){case"i":return String(o);case"ii":return u(o,r.length);case"io":return a.ordinalNumber(o,{unit:"day"});case"iii":return a.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(n,{width:"short",context:"formatting"});case"iiii":default:return a.day(n,{width:"wide",context:"formatting"})}},a:function(e,r,a){var n=e.getUTCHours(),o=n/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,r,a){var n=e.getUTCHours(),o;switch(n===12?o=F.noon:n===0?o=F.midnight:o=n/12>=1?"pm":"am",r){case"b":case"bb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,r,a){var n=e.getUTCHours(),o;switch(n>=17?o=F.evening:n>=12?o=F.afternoon:n>=4?o=F.morning:o=F.night,r){case"B":case"BB":case"BBB":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,r,a){if(r==="ho"){var n=e.getUTCHours()%12;return n===0&&(n=12),a.ordinalNumber(n,{unit:"hour"})}return b.h(e,r)},H:function(e,r,a){return r==="Ho"?a.ordinalNumber(e.getUTCHours(),{unit:"hour"}):b.H(e,r)},K:function(e,r,a){var n=e.getUTCHours()%12;return r==="Ko"?a.ordinalNumber(n,{unit:"hour"}):u(n,r.length)},k:function(e,r,a){var n=e.getUTCHours();return n===0&&(n=24),r==="ko"?a.ordinalNumber(n,{unit:"hour"}):u(n,r.length)},m:function(e,r,a){return r==="mo"?a.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):b.m(e,r)},s:function(e,r,a){return r==="so"?a.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):b.s(e,r)},S:function(e,r){return b.S(e,r)},X:function(e,r,a,n){var o=n._originalDate||e,i=o.getTimezoneOffset();if(i===0)return"Z";switch(r){case"X":return be(i);case"XXXX":case"XX":return M(i);case"XXXXX":case"XXX":default:return M(i,":")}},x:function(e,r,a,n){var o=n._originalDate||e,i=o.getTimezoneOffset();switch(r){case"x":return be(i);case"xxxx":case"xx":return M(i);case"xxxxx":case"xxx":default:return M(i,":")}},O:function(e,r,a,n){var o=n._originalDate||e,i=o.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+ve(i,":");case"OOOO":default:return"GMT"+M(i,":")}},z:function(e,r,a,n){var o=n._originalDate||e,i=o.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+ve(i,":");case"zzzz":default:return"GMT"+M(i,":")}},t:function(e,r,a,n){var o=n._originalDate||e,i=Math.floor(o.getTime()/1e3);return u(i,r.length)},T:function(e,r,a,n){var o=n._originalDate||e,i=o.getTime();return u(i,r.length)}};function ve(t,e){var r=t>0?"-":"+",a=Math.abs(t),n=Math.floor(a/60),o=a%60;if(o===0)return r+String(n);var i=e||"";return r+String(n)+i+u(o,2)}function be(t,e){if(t%60===0){var r=t>0?"-":"+";return r+u(Math.abs(t)/60,2)}return M(t,e)}function M(t,e){var r=e||"",a=t>0?"-":"+",n=Math.abs(t),o=u(Math.floor(n/60),2),i=u(n%60,2);return a+o+r+i}var we=at;var Te=function(e,r){switch(e){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},Oe=function(e,r){switch(e){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},nt=function(e,r){var a=e.match(/(P+)(p+)?/)||[],n=a[1],o=a[2];if(!o)return Te(e,r);var i;switch(n){case"P":i=r.dateTime({width:"short"});break;case"PP":i=r.dateTime({width:"medium"});break;case"PPP":i=r.dateTime({width:"long"});break;case"PPPP":default:i=r.dateTime({width:"full"});break}return i.replace("{{date}}",Te(n,r)).replace("{{time}}",Oe(o,r))},ot={p:Oe,P:nt},Se=ot;var it=["D","DD"],st=["YY","YYYY"];function De(t){return it.indexOf(t)!==-1}function ke(t){return st.indexOf(t)!==-1}function ie(t,e,r){if(t==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var ut={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ft=function(e,r,a){var n,o=ut[e];return typeof o=="string"?n=o:r===1?n=o.one:n=o.other.replace("{{count}}",r.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+n:n+" ago":n},Me=ft;function $(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.width?String(e.width):t.defaultWidth,a=t.formats[r]||t.formats[t.defaultWidth];return a}}var lt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},dt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},mt={full:"{{date}} \'at\' {{time}}",long:"{{date}} \'at\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ct={date:$({formats:lt,defaultWidth:"full"}),time:$({formats:dt,defaultWidth:"full"}),dateTime:$({formats:mt,defaultWidth:"full"})},We=ct;var pt={lastWeek:"\'last\' eeee \'at\' p",yesterday:"\'yesterday at\' p",today:"\'today at\' p",tomorrow:"\'tomorrow at\' p",nextWeek:"eeee \'at\' p",other:"P"},gt=function(e,r,a,n){return pt[e]},Ce=gt;function W(t){return function(e,r){var a=r!=null&&r.context?String(r.context):"standalone",n;if(a==="formatting"&&t.formattingValues){var o=t.defaultFormattingWidth||t.defaultWidth,i=r!=null&&r.width?String(r.width):o;n=t.formattingValues[i]||t.formattingValues[o]}else{var s=t.defaultWidth,d=r!=null&&r.width?String(r.width):t.defaultWidth;n=t.values[d]||t.values[s]}var l=t.argumentCallback?t.argumentCallback(e):e;return n[l]}}var ht={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},xt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},vt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},bt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},wt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Tt=function(e,r){var a=Number(e),n=a%100;if(n>20||n<10)switch(n%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},Ot={ordinalNumber:Tt,era:W({values:ht,defaultWidth:"wide"}),quarter:W({values:xt,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:W({values:yt,defaultWidth:"wide"}),day:W({values:vt,defaultWidth:"wide"}),dayPeriod:W({values:bt,defaultWidth:"wide",formattingValues:wt,defaultFormattingWidth:"wide"})},Pe=Ot;function C(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.width,n=a&&t.matchPatterns[a]||t.matchPatterns[t.defaultMatchWidth],o=e.match(n);if(!o)return null;var i=o[0],s=a&&t.parsePatterns[a]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(s)?Dt(s,function(c){return c.test(i)}):St(s,function(c){return c.test(i)}),l;l=t.valueCallback?t.valueCallback(d):d,l=r.valueCallback?r.valueCallback(l):l;var p=e.slice(i.length);return{value:l,rest:p}}}function St(t,e){for(var r in t)if(t.hasOwnProperty(r)&&e(t[r]))return r}function Dt(t,e){for(var r=0;r1&&arguments[1]!==void 0?arguments[1]:{},a=e.match(t.matchPattern);if(!a)return null;var n=a[0],o=e.match(t.parsePattern);if(!o)return null;var i=t.valueCallback?t.valueCallback(o[0]):o[0];i=r.valueCallback?r.valueCallback(i):i;var s=e.slice(n.length);return{value:i,rest:s}}}var kt=/^(\\d+)(th|st|nd|rd)?/i,Mt=/\\d+/i,Wt={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ct={any:[/^b/i,/^(a|c)/i]},Pt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ft={any:[/1/i,/2/i,/3/i,/4/i]},It={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Yt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ut={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Nt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Et={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},At={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},qt={ordinalNumber:se({matchPattern:kt,parsePattern:Mt,valueCallback:function(e){return parseInt(e,10)}}),era:C({matchPatterns:Wt,defaultMatchWidth:"wide",parsePatterns:Ct,defaultParseWidth:"any"}),quarter:C({matchPatterns:Pt,defaultMatchWidth:"wide",parsePatterns:Ft,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:C({matchPatterns:It,defaultMatchWidth:"wide",parsePatterns:Yt,defaultParseWidth:"any"}),day:C({matchPatterns:Ut,defaultMatchWidth:"wide",parsePatterns:Nt,defaultParseWidth:"any"}),dayPeriod:C({matchPatterns:Et,defaultMatchWidth:"any",parsePatterns:At,defaultParseWidth:"any"})},Fe=qt;var _t={code:"en-US",formatDistance:Me,formatLong:We,formatRelative:Ce,localize:Pe,match:Fe,options:{weekStartsOn:0,firstWeekContainsDate:1}},Ie=_t;var Ye=Ie;var Lt=/[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|\'\'|\'(\'\'|[^\'])+(\'|$)|./g,$t=/P+p+|P+|p+|\'\'|\'(\'\'|[^\'])+(\'|$)|./g,Qt=/^\'([^]*?)\'?$/,jt=/\'\'/g,Ht=/[a-zA-Z]/;function H(t,e,r){var a,n,o,i,s,d,l,p,c,h,g,v,N,D,E,R,B,G;f(2,arguments);var Ge=String(e),A=T(),q=(a=(n=r?.locale)!==null&&n!==void 0?n:A.locale)!==null&&a!==void 0?a:Ye,V=x((o=(i=(s=(d=r?.firstWeekContainsDate)!==null&&d!==void 0?d:r==null||(l=r.locale)===null||l===void 0||(p=l.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&s!==void 0?s:A.firstWeekContainsDate)!==null&&i!==void 0?i:(c=A.locale)===null||c===void 0||(h=c.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&o!==void 0?o:1);if(!(V>=1&&V<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var X=x((g=(v=(N=(D=r?.weekStartsOn)!==null&&D!==void 0?D:r==null||(E=r.locale)===null||E===void 0||(R=E.options)===null||R===void 0?void 0:R.weekStartsOn)!==null&&N!==void 0?N:A.weekStartsOn)!==null&&v!==void 0?v:(B=A.locale)===null||B===void 0||(G=B.options)===null||G===void 0?void 0:G.weekStartsOn)!==null&&g!==void 0?g:0);if(!(X>=0&&X<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!q.localize)throw new RangeError("locale must contain localize property");if(!q.formatLong)throw new RangeError("locale must contain formatLong property");var Q=m(t);if(!Z(Q))throw new RangeError("Invalid time value");var Ve=z(Q),Xe=ee(Q,Ve),Je={firstWeekContainsDate:V,weekStartsOn:X,locale:q,_originalDate:Q},ze=Ge.match($t).map(function(y){var w=y[0];if(w==="p"||w==="P"){var j=Se[w];return j(y,q.formatLong)}return y}).join("").match(Lt).map(function(y){if(y==="\'\'")return"\'";var w=y[0];if(w==="\'")return Rt(y);var j=we[w];if(j)return!(r!=null&&r.useAdditionalWeekYearTokens)&&ke(y)&&ie(y,e,String(t)),!(r!=null&&r.useAdditionalDayOfYearTokens)&&De(y)&&ie(y,e,String(t)),j(Xe,y,q.localize,Je);if(w.match(Ht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return y}).join("");return ze}function Rt(t){var e=t.match(Qt);return e?e[1].replace(jt,"\'"):t}var Ue=t=>[...new Set(t)];var ue=(t,e)=>{if(t instanceof Date)return"date";if(typeof t=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(t)||t.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(t))return"date";if(e=="tag"||e=="tags")return"tags-multi";if(/\\[\\[.*?\\]\\]/.test(t))return"link"}else{if(typeof t=="number")return"number";if(typeof t=="boolean")return"boolean";if(t)if(Array.isArray(t)||typeof t=="string"&&t.indexOf(",")>-1){let r=Array.isArray(t)?t:[];if(typeof t=="string"&&t.indexOf(",")>-1&&(r=P(t)),e=="tag"||e=="tags")return"tags-multi";if(r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string")return"link";let a=Ue(r.map(n=>ue(n,e)));return a.length==1&&a[0]=="link"?"link-multi":a.some(n=>n=="object")?"object-multi":"option-multi"}else return t.isLuxonDateTime?"date":t.isLuxonDuration?"duration":t.type=="file"?"link":typeof t=="object"&&!Array.isArray(t)&&t!==null?"object":"unknown";else return"unknown"}return"text"};var Ne=t=>t.map(e=>e.replace(",","\\\\,")).join(", "),I=t=>JSON.stringify(t);var P=t=>t?.startsWith("[")?he(ye(t)):Bt(t),Bt=t=>(t?.replace("\\\\,",",")?.match(/(\\\\.|[^,])+/g)??[]).map(e=>e.trim()),le=(t,e)=>{switch(ue(e,t)){case"tags-multi":return e;case"object":case"object-multi":return JSON.stringify(e);case"number":return e.toString();case"boolean":return e?"true":"false";case"date":{if(e instanceof Date){let a=H(e,"yyyy-MM-dd");return typeof a=="string"?a:""}return typeof e!="string"?"":e}break;case"duration":return Ne(Object.keys(e.values).reduce((a,n)=>[...a,...e.values[n]>0?[e.values[n]+" "+n]:[]],[]));case"option-multi":case"link-multi":return typeof e=="string"?fe(e):I(e.map(a=>a?typeof a=="string"?fe(a):a.path?a.path:Array.isArray(e)&&a.length==1&&Array.isArray(a[0])&&a[0].length==1&&typeof a[0][0]=="string"?a[0][0]:JSON.stringify(a):""));case"link":return Array.isArray(e)&&e.length==1&&Array.isArray(e[0])&&e[0].length==1&&typeof e[0][0]=="string"?e[0][0]:typeof e=="string"?fe(e):e.path;case"text":case"tag":case"image":return e}return""};var ye=t=>{let e;try{e=JSON.parse(t)}catch{}return e};var fe=t=>{if(!t)return"";let e=/\\[\\[(.*?)\\]\\]/g.exec(t),r=e?.length>1?e[1].substring(0,xe("|",e[1])):t;return r||t};var Ee=(t,e)=>{let r=t?P(t):[],a=e?P(e):[];return a.every(n=>r.some(o=>o==n))&&r.every(n=>a.some(o=>o==n))},Y=(t,e)=>t==e,de=(t,e)=>(t??"").length==0,me=(t,e)=>(t??"").toLowerCase().includes((e??"").toLowerCase()),ce=(t,e)=>parseFloat(t)>parseFloat(e),pe=(t,e)=>parseInt(t){let r=isNaN(Date.parse(t))?new Date(parseInt(t)):new Date(t),a=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e);return r.valueOf()>=a.valueOf()},qe=(t,e)=>{let r=isNaN(Date.parse(t))?new Date(parseInt(t)):new Date(t),a=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e);return r.valueOf(){let r=t?P(t):[],a=e?P(e):[];return r.length==0?!1:a.some(n=>r.some(o=>o==n))},_e=(t,e)=>{if(!t)return!1;let r=new Date(`${t.toString().replace(".",":")}`),a=new Date(`${e}`);return r.getMonth()===a.getMonth()&&r.getDate()===a.getDate()},Le=t=>{if(!t)return!1;let e=new Date(`${t.toString()}T00:00`),r=new Date;return e.getMonth()===r.getMonth()&&e.getDate()===r.getDate()};var U={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(t,e)=>!de(t,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(t,e)=>de(t,""),valueType:"none"},include:{fn:(t,e)=>me(t,e),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(t,e)=>!me(t,e),valueType:"text"},is:{type:["text"],fn:(t,e)=>Y(t,e),valueType:"text"},isNot:{type:["text"],fn:(t,e)=>!Y(t,e),valueType:"text"},equal:{type:["number"],fn:(t,e)=>Y(t,e),valueType:"number"},isLink:{type:["link","context"],fn:(t,e)=>Y(t,e),valueType:"link"},isNotLink:{type:["link","context"],fn:(t,e)=>!Y(t,e),valueType:"link"},isGreatThan:{type:["number"],fn:(t,e)=>ce(t,e),valueType:"number"},isLessThan:{type:["number"],fn:(t,e)=>pe(t,e),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(t,e)=>!ce(t,e),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(t,e)=>!pe(t,e),valueType:"number"},dateBefore:{type:["date"],fn:(t,e)=>qe(t,e),valueType:"date"},dateAfter:{type:["date"],fn:(t,e)=>Ae(t,e),valueType:"date"},isSameDate:{type:["date"],fn:(t,e)=>_e(t,e),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(t,e)=>Le(t,e),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(t,e)=>Ee(t,e),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(t,e)=>ge(t,e),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(t,e)=>!ge(t,e),valueType:"list"},isTrue:{type:["boolean"],fn:(t,e)=>t=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(t,e)=>t!="true",valueType:"none"}};var Gt=(t,e,r)=>e.reduce((n,o)=>{let[i,s]=n,d=o.type=="context"?$e(s,o,r):o.type=="path"?je(s,o,r):o.type=="frontmatter"?Qe(s,o,r):He(s,o,r),l=s.filter(p=>!d.includes(p));return[[...i,...d],l]},[[],t])[0],Vt=(t,e,r)=>e.reduce((a,n)=>n.type=="context"?$e(a,n,r):n.type=="path"?je(a,n,r):n.type=="frontmatter"?Qe(a,n,r):He(a,n,r),t),$e=(t,e,r)=>{let a=U[e.fn];return!a||a.valueType!="none"&&e.value.length==0?[]:t.filter(n=>{let[o,i]=e.field.split("."),s=n.metadata?.property;if(!n.spaces?.includes(o)||!s||!s[i])return!1;let d=!0;if(a){let l=e.fType=="property"?r[e.value]:e.value;d=a.fn(le(i,s[i]),l)}return d})},Qe=(t,e,r)=>{let a=U[e.fn];return!a||a.valueType!="none"&&e.value.length==0?[]:t.filter(n=>{let o=n.metadata?.property;if(!o||o[e.field]===void 0)return!1;let i=!0;if(a){let s=e.fType=="property"?r[e.value]:e.value;i=a.fn(le(e.field,o[e.field]),s)}return i})},je=(t,e,r)=>{let a=U[e.fn];return!a||a.valueType!="none"&&e.value.length==0?[]:t.filter(n=>{let o="";e.field=="outlinks"?o=I(n.outlinks??[]):e.field=="inlinks"?o=I(n.inlinks??[]):e.field=="tags"&&(o=I(n.tags??[]));let i=!0;if(a){let s=e.fType=="property"?r[e.value]:e.value;i=a.fn(o,s)}return i})},He=(t,e,r)=>{let a=U[e.fn];return!a||a.valueType!="none"&&e.value.length==0?[]:t.filter(n=>{let o=!0;if(a){let i=e.fType=="property"?r[e.value]:e.value;o=a.fn(n.metadata?.[e.type]?.[e.field],i)}return o})},Re=(t,e,r)=>t.reduce((n,o)=>!n||o.filters.length==0?!1:o.type=="any"?Gt([e],o.filters,r).length>0:Vt([e],o.filters,r).length>0,!0);function Be(t){let{queries:e,pathsIndex:r,count:a}=t,n=[];for(let[o,i]of r)!i.hidden&&Re(e,i,{})&&n.push(i);return n.slice(0,a)}var Xt=self;Xt.onmessage=async t=>{let{payload:e,job:r}=t.data,a;r.type=="search"&&(a=Be(e));try{postMessage({job:r,result:a})}catch(n){console.log(n),postMessage({job:r,result:{$error:`Failed to run ${r.type} ${r.path}: ${n}`}})}};\n', { "name": "Superstate Search" }); + return inlineWorker('"use strict";function he(t){return Array.isArray(t)?t:typeof t=="string"?[t]:[]}var xe=(t,e)=>e.indexOf(t)>0?e.indexOf(t):e.length;function k(t){return k=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(t)}function x(t){if(t===null||t===!0||t===!1)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function f(t,e){if(e.length1?"s":"")+" required, but only "+e.length+" present")}function m(t){f(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||k(t)==="object"&&e==="[object Date]"?new Date(t.getTime()):typeof t=="number"||e==="[object Number]"?new Date(t):((typeof t=="string"||e==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn\'t accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function J(t,e){f(2,arguments);var r=m(t).getTime(),a=x(e);return new Date(r+a)}var Ke={};function T(){return Ke}function z(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}function K(t){return f(1,arguments),t instanceof Date||k(t)==="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Z(t){if(f(1,arguments),!K(t)&&typeof t!="number")return!1;var e=m(t);return!isNaN(Number(e))}function ee(t,e){f(2,arguments);var r=x(e);return J(t,-r)}var Ze=864e5;function te(t){f(1,arguments);var e=m(t),r=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var a=e.getTime(),n=r-a;return Math.floor(n/Ze)+1}function O(t){f(1,arguments);var e=1,r=m(t),a=r.getUTCDay(),n=(a=n.getTime()?r+1:e.getTime()>=i.getTime()?r:r-1}function re(t){f(1,arguments);var e=_(t),r=new Date(0);r.setUTCFullYear(e,0,4),r.setUTCHours(0,0,0,0);var a=O(r);return a}var et=6048e5;function ae(t){f(1,arguments);var e=m(t),r=O(e).getTime()-re(e).getTime();return Math.round(r/et)+1}function S(t,e){var r,a,n,o,i,s,d,l;f(1,arguments);var p=T(),c=x((r=(a=(n=(o=e?.weekStartsOn)!==null&&o!==void 0?o:e==null||(i=e.locale)===null||i===void 0||(s=i.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&n!==void 0?n:p.weekStartsOn)!==null&&a!==void 0?a:(d=p.locale)===null||d===void 0||(l=d.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&r!==void 0?r:0);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=m(t),g=h.getUTCDay(),v=(g=1&&g<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var v=new Date(0);v.setUTCFullYear(c+1,0,g),v.setUTCHours(0,0,0,0);var N=S(v,e),D=new Date(0);D.setUTCFullYear(c,0,g),D.setUTCHours(0,0,0,0);var E=S(D,e);return p.getTime()>=N.getTime()?c+1:p.getTime()>=E.getTime()?c:c-1}function ne(t,e){var r,a,n,o,i,s,d,l;f(1,arguments);var p=T(),c=x((r=(a=(n=(o=e?.firstWeekContainsDate)!==null&&o!==void 0?o:e==null||(i=e.locale)===null||i===void 0||(s=i.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&n!==void 0?n:p.firstWeekContainsDate)!==null&&a!==void 0?a:(d=p.locale)===null||d===void 0||(l=d.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&r!==void 0?r:1),h=L(t,e),g=new Date(0);g.setUTCFullYear(h,0,c),g.setUTCHours(0,0,0,0);var v=S(g,e);return v}var tt=6048e5;function oe(t,e){f(1,arguments);var r=m(t),a=S(r,e).getTime()-ne(r,e).getTime();return Math.round(a/tt)+1}function u(t,e){for(var r=t<0?"-":"",a=Math.abs(t).toString();a.length0?a:1-a;return u(r==="yy"?n%100:n,r.length)},M:function(e,r){var a=e.getUTCMonth();return r==="M"?String(a+1):u(a+1,2)},d:function(e,r){return u(e.getUTCDate(),r.length)},a:function(e,r){var a=e.getUTCHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h:function(e,r){return u(e.getUTCHours()%12||12,r.length)},H:function(e,r){return u(e.getUTCHours(),r.length)},m:function(e,r){return u(e.getUTCMinutes(),r.length)},s:function(e,r){return u(e.getUTCSeconds(),r.length)},S:function(e,r){var a=r.length,n=e.getUTCMilliseconds(),o=Math.floor(n*Math.pow(10,a-3));return u(o,r.length)}},b=rt;var F={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},at={G:function(e,r,a){var n=e.getUTCFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return a.era(n,{width:"abbreviated"});case"GGGGG":return a.era(n,{width:"narrow"});case"GGGG":default:return a.era(n,{width:"wide"})}},y:function(e,r,a){if(r==="yo"){var n=e.getUTCFullYear(),o=n>0?n:1-n;return a.ordinalNumber(o,{unit:"year"})}return b.y(e,r)},Y:function(e,r,a,n){var o=L(e,n),i=o>0?o:1-o;if(r==="YY"){var s=i%100;return u(s,2)}return r==="Yo"?a.ordinalNumber(i,{unit:"year"}):u(i,r.length)},R:function(e,r){var a=_(e);return u(a,r.length)},u:function(e,r){var a=e.getUTCFullYear();return u(a,r.length)},Q:function(e,r,a){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(r){case"Q":return String(n);case"QQ":return u(n,2);case"Qo":return a.ordinalNumber(n,{unit:"quarter"});case"QQQ":return a.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,r,a){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(r){case"q":return String(n);case"qq":return u(n,2);case"qo":return a.ordinalNumber(n,{unit:"quarter"});case"qqq":return a.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,r,a){var n=e.getUTCMonth();switch(r){case"M":case"MM":return b.M(e,r);case"Mo":return a.ordinalNumber(n+1,{unit:"month"});case"MMM":return a.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(n,{width:"wide",context:"formatting"})}},L:function(e,r,a){var n=e.getUTCMonth();switch(r){case"L":return String(n+1);case"LL":return u(n+1,2);case"Lo":return a.ordinalNumber(n+1,{unit:"month"});case"LLL":return a.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(n,{width:"wide",context:"standalone"})}},w:function(e,r,a,n){var o=oe(e,n);return r==="wo"?a.ordinalNumber(o,{unit:"week"}):u(o,r.length)},I:function(e,r,a){var n=ae(e);return r==="Io"?a.ordinalNumber(n,{unit:"week"}):u(n,r.length)},d:function(e,r,a){return r==="do"?a.ordinalNumber(e.getUTCDate(),{unit:"date"}):b.d(e,r)},D:function(e,r,a){var n=te(e);return r==="Do"?a.ordinalNumber(n,{unit:"dayOfYear"}):u(n,r.length)},E:function(e,r,a){var n=e.getUTCDay();switch(r){case"E":case"EE":case"EEE":return a.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(n,{width:"short",context:"formatting"});case"EEEE":default:return a.day(n,{width:"wide",context:"formatting"})}},e:function(e,r,a,n){var o=e.getUTCDay(),i=(o-n.weekStartsOn+8)%7||7;switch(r){case"e":return String(i);case"ee":return u(i,2);case"eo":return a.ordinalNumber(i,{unit:"day"});case"eee":return a.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(o,{width:"short",context:"formatting"});case"eeee":default:return a.day(o,{width:"wide",context:"formatting"})}},c:function(e,r,a,n){var o=e.getUTCDay(),i=(o-n.weekStartsOn+8)%7||7;switch(r){case"c":return String(i);case"cc":return u(i,r.length);case"co":return a.ordinalNumber(i,{unit:"day"});case"ccc":return a.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(o,{width:"narrow",context:"standalone"});case"cccccc":return a.day(o,{width:"short",context:"standalone"});case"cccc":default:return a.day(o,{width:"wide",context:"standalone"})}},i:function(e,r,a){var n=e.getUTCDay(),o=n===0?7:n;switch(r){case"i":return String(o);case"ii":return u(o,r.length);case"io":return a.ordinalNumber(o,{unit:"day"});case"iii":return a.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(n,{width:"short",context:"formatting"});case"iiii":default:return a.day(n,{width:"wide",context:"formatting"})}},a:function(e,r,a){var n=e.getUTCHours(),o=n/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,r,a){var n=e.getUTCHours(),o;switch(n===12?o=F.noon:n===0?o=F.midnight:o=n/12>=1?"pm":"am",r){case"b":case"bb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,r,a){var n=e.getUTCHours(),o;switch(n>=17?o=F.evening:n>=12?o=F.afternoon:n>=4?o=F.morning:o=F.night,r){case"B":case"BB":case"BBB":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,r,a){if(r==="ho"){var n=e.getUTCHours()%12;return n===0&&(n=12),a.ordinalNumber(n,{unit:"hour"})}return b.h(e,r)},H:function(e,r,a){return r==="Ho"?a.ordinalNumber(e.getUTCHours(),{unit:"hour"}):b.H(e,r)},K:function(e,r,a){var n=e.getUTCHours()%12;return r==="Ko"?a.ordinalNumber(n,{unit:"hour"}):u(n,r.length)},k:function(e,r,a){var n=e.getUTCHours();return n===0&&(n=24),r==="ko"?a.ordinalNumber(n,{unit:"hour"}):u(n,r.length)},m:function(e,r,a){return r==="mo"?a.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):b.m(e,r)},s:function(e,r,a){return r==="so"?a.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):b.s(e,r)},S:function(e,r){return b.S(e,r)},X:function(e,r,a,n){var o=n._originalDate||e,i=o.getTimezoneOffset();if(i===0)return"Z";switch(r){case"X":return be(i);case"XXXX":case"XX":return M(i);case"XXXXX":case"XXX":default:return M(i,":")}},x:function(e,r,a,n){var o=n._originalDate||e,i=o.getTimezoneOffset();switch(r){case"x":return be(i);case"xxxx":case"xx":return M(i);case"xxxxx":case"xxx":default:return M(i,":")}},O:function(e,r,a,n){var o=n._originalDate||e,i=o.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+ve(i,":");case"OOOO":default:return"GMT"+M(i,":")}},z:function(e,r,a,n){var o=n._originalDate||e,i=o.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+ve(i,":");case"zzzz":default:return"GMT"+M(i,":")}},t:function(e,r,a,n){var o=n._originalDate||e,i=Math.floor(o.getTime()/1e3);return u(i,r.length)},T:function(e,r,a,n){var o=n._originalDate||e,i=o.getTime();return u(i,r.length)}};function ve(t,e){var r=t>0?"-":"+",a=Math.abs(t),n=Math.floor(a/60),o=a%60;if(o===0)return r+String(n);var i=e||"";return r+String(n)+i+u(o,2)}function be(t,e){if(t%60===0){var r=t>0?"-":"+";return r+u(Math.abs(t)/60,2)}return M(t,e)}function M(t,e){var r=e||"",a=t>0?"-":"+",n=Math.abs(t),o=u(Math.floor(n/60),2),i=u(n%60,2);return a+o+r+i}var we=at;var Te=function(e,r){switch(e){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},Oe=function(e,r){switch(e){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},nt=function(e,r){var a=e.match(/(P+)(p+)?/)||[],n=a[1],o=a[2];if(!o)return Te(e,r);var i;switch(n){case"P":i=r.dateTime({width:"short"});break;case"PP":i=r.dateTime({width:"medium"});break;case"PPP":i=r.dateTime({width:"long"});break;case"PPPP":default:i=r.dateTime({width:"full"});break}return i.replace("{{date}}",Te(n,r)).replace("{{time}}",Oe(o,r))},ot={p:Oe,P:nt},Se=ot;var it=["D","DD"],st=["YY","YYYY"];function De(t){return it.indexOf(t)!==-1}function ke(t){return st.indexOf(t)!==-1}function ie(t,e,r){if(t==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var ut={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ft=function(e,r,a){var n,o=ut[e];return typeof o=="string"?n=o:r===1?n=o.one:n=o.other.replace("{{count}}",r.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+n:n+" ago":n},Me=ft;function $(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.width?String(e.width):t.defaultWidth,a=t.formats[r]||t.formats[t.defaultWidth];return a}}var lt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},dt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},mt={full:"{{date}} \'at\' {{time}}",long:"{{date}} \'at\' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ct={date:$({formats:lt,defaultWidth:"full"}),time:$({formats:dt,defaultWidth:"full"}),dateTime:$({formats:mt,defaultWidth:"full"})},We=ct;var pt={lastWeek:"\'last\' eeee \'at\' p",yesterday:"\'yesterday at\' p",today:"\'today at\' p",tomorrow:"\'tomorrow at\' p",nextWeek:"eeee \'at\' p",other:"P"},gt=function(e,r,a,n){return pt[e]},Ce=gt;function W(t){return function(e,r){var a=r!=null&&r.context?String(r.context):"standalone",n;if(a==="formatting"&&t.formattingValues){var o=t.defaultFormattingWidth||t.defaultWidth,i=r!=null&&r.width?String(r.width):o;n=t.formattingValues[i]||t.formattingValues[o]}else{var s=t.defaultWidth,d=r!=null&&r.width?String(r.width):t.defaultWidth;n=t.values[d]||t.values[s]}var l=t.argumentCallback?t.argumentCallback(e):e;return n[l]}}var ht={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},xt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},vt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},bt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},wt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Tt=function(e,r){var a=Number(e),n=a%100;if(n>20||n<10)switch(n%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},Ot={ordinalNumber:Tt,era:W({values:ht,defaultWidth:"wide"}),quarter:W({values:xt,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:W({values:yt,defaultWidth:"wide"}),day:W({values:vt,defaultWidth:"wide"}),dayPeriod:W({values:bt,defaultWidth:"wide",formattingValues:wt,defaultFormattingWidth:"wide"})},Pe=Ot;function C(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.width,n=a&&t.matchPatterns[a]||t.matchPatterns[t.defaultMatchWidth],o=e.match(n);if(!o)return null;var i=o[0],s=a&&t.parsePatterns[a]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(s)?Dt(s,function(c){return c.test(i)}):St(s,function(c){return c.test(i)}),l;l=t.valueCallback?t.valueCallback(d):d,l=r.valueCallback?r.valueCallback(l):l;var p=e.slice(i.length);return{value:l,rest:p}}}function St(t,e){for(var r in t)if(t.hasOwnProperty(r)&&e(t[r]))return r}function Dt(t,e){for(var r=0;r1&&arguments[1]!==void 0?arguments[1]:{},a=e.match(t.matchPattern);if(!a)return null;var n=a[0],o=e.match(t.parsePattern);if(!o)return null;var i=t.valueCallback?t.valueCallback(o[0]):o[0];i=r.valueCallback?r.valueCallback(i):i;var s=e.slice(n.length);return{value:i,rest:s}}}var kt=/^(\\d+)(th|st|nd|rd)?/i,Mt=/\\d+/i,Wt={narrow:/^(b|a)/i,abbreviated:/^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ct={any:[/^b/i,/^(a|c)/i]},Pt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ft={any:[/1/i,/2/i,/3/i,/4/i]},It={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Yt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ut={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Nt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Et={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},At={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},qt={ordinalNumber:se({matchPattern:kt,parsePattern:Mt,valueCallback:function(e){return parseInt(e,10)}}),era:C({matchPatterns:Wt,defaultMatchWidth:"wide",parsePatterns:Ct,defaultParseWidth:"any"}),quarter:C({matchPatterns:Pt,defaultMatchWidth:"wide",parsePatterns:Ft,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:C({matchPatterns:It,defaultMatchWidth:"wide",parsePatterns:Yt,defaultParseWidth:"any"}),day:C({matchPatterns:Ut,defaultMatchWidth:"wide",parsePatterns:Nt,defaultParseWidth:"any"}),dayPeriod:C({matchPatterns:Et,defaultMatchWidth:"any",parsePatterns:At,defaultParseWidth:"any"})},Fe=qt;var _t={code:"en-US",formatDistance:Me,formatLong:We,formatRelative:Ce,localize:Pe,match:Fe,options:{weekStartsOn:0,firstWeekContainsDate:1}},Ie=_t;var Ye=Ie;var Lt=/[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|\'\'|\'(\'\'|[^\'])+(\'|$)|./g,$t=/P+p+|P+|p+|\'\'|\'(\'\'|[^\'])+(\'|$)|./g,Qt=/^\'([^]*?)\'?$/,jt=/\'\'/g,Ht=/[a-zA-Z]/;function H(t,e,r){var a,n,o,i,s,d,l,p,c,h,g,v,N,D,E,R,B,G;f(2,arguments);var Ge=String(e),A=T(),q=(a=(n=r?.locale)!==null&&n!==void 0?n:A.locale)!==null&&a!==void 0?a:Ye,V=x((o=(i=(s=(d=r?.firstWeekContainsDate)!==null&&d!==void 0?d:r==null||(l=r.locale)===null||l===void 0||(p=l.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&s!==void 0?s:A.firstWeekContainsDate)!==null&&i!==void 0?i:(c=A.locale)===null||c===void 0||(h=c.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&o!==void 0?o:1);if(!(V>=1&&V<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var X=x((g=(v=(N=(D=r?.weekStartsOn)!==null&&D!==void 0?D:r==null||(E=r.locale)===null||E===void 0||(R=E.options)===null||R===void 0?void 0:R.weekStartsOn)!==null&&N!==void 0?N:A.weekStartsOn)!==null&&v!==void 0?v:(B=A.locale)===null||B===void 0||(G=B.options)===null||G===void 0?void 0:G.weekStartsOn)!==null&&g!==void 0?g:0);if(!(X>=0&&X<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!q.localize)throw new RangeError("locale must contain localize property");if(!q.formatLong)throw new RangeError("locale must contain formatLong property");var Q=m(t);if(!Z(Q))throw new RangeError("Invalid time value");var Ve=z(Q),Xe=ee(Q,Ve),Je={firstWeekContainsDate:V,weekStartsOn:X,locale:q,_originalDate:Q},ze=Ge.match($t).map(function(y){var w=y[0];if(w==="p"||w==="P"){var j=Se[w];return j(y,q.formatLong)}return y}).join("").match(Lt).map(function(y){if(y==="\'\'")return"\'";var w=y[0];if(w==="\'")return Rt(y);var j=we[w];if(j)return!(r!=null&&r.useAdditionalWeekYearTokens)&&ke(y)&&ie(y,e,String(t)),!(r!=null&&r.useAdditionalDayOfYearTokens)&&De(y)&&ie(y,e,String(t)),j(Xe,y,q.localize,Je);if(w.match(Ht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return y}).join("");return ze}function Rt(t){var e=t.match(Qt);return e?e[1].replace(jt,"\'"):t}var Ue=t=>[...new Set(t)];var ue=(t,e)=>{if(t instanceof Date)return"date";if(typeof t=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(t)||t.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(t))return"date";if(e=="tag"||e=="tags")return"tags-multi";if(/\\[\\[.*?\\]\\]/.test(t))return"link"}else{if(typeof t=="number")return"number";if(typeof t=="boolean")return"boolean";if(t)if(Array.isArray(t)||typeof t=="string"&&t.indexOf(",")>-1){let r=Array.isArray(t)?t:[];if(typeof t=="string"&&t.indexOf(",")>-1&&(r=P(t)),e=="tag"||e=="tags")return"tags-multi";if(r.length==1&&Array.isArray(r[0])&&r[0].length==1&&typeof r[0][0]=="string")return"link";let a=Ue(r.map(n=>ue(n,e)));return a.length==1&&a[0]=="link"?"link-multi":a.some(n=>n=="object")?"object-multi":"option-multi"}else return t.isLuxonDateTime?"date":t.isLuxonDuration?"duration":t.type=="file"?"link":typeof t=="object"&&!Array.isArray(t)&&t!==null?"object":"unknown";else return"unknown"}return"text"};var Ne=t=>t.map(e=>e.replace(",","\\\\,")).join(", "),I=t=>JSON.stringify(t);var P=t=>t?.startsWith("[")?he(ye(t)):Bt(t),Bt=t=>(t?.replace("\\\\,",",")?.match(/(\\\\.|[^,])+/g)??[]).map(e=>e.trim()),le=(t,e)=>{switch(ue(e,t)){case"tags-multi":return e;case"object":case"object-multi":return JSON.stringify(e);case"number":return e.toString();case"boolean":return e?"true":"false";case"date":{if(e instanceof Date){let a=H(e,"yyyy-MM-dd");return typeof a=="string"?a:""}return typeof e!="string"?"":e}break;case"duration":return Ne(Object.keys(e.values).reduce((a,n)=>[...a,...e.values[n]>0?[e.values[n]+" "+n]:[]],[]));case"option-multi":case"link-multi":return typeof e=="string"?fe(e):I(e.map(a=>a?typeof a=="string"?fe(a):a.path?a.path:Array.isArray(e)&&a.length==1&&Array.isArray(a[0])&&a[0].length==1&&typeof a[0][0]=="string"?a[0][0]:JSON.stringify(a):""));case"link":return Array.isArray(e)&&e.length==1&&Array.isArray(e[0])&&e[0].length==1&&typeof e[0][0]=="string"?e[0][0]:typeof e=="string"?fe(e):e.path;case"text":case"tag":case"image":return e}return""};var ye=t=>{let e;try{e=JSON.parse(t)}catch{}return e};var fe=t=>{if(!t)return"";let e=/\\[\\[(.*?)\\]\\]/g.exec(t),r=e?.length>1?e[1].substring(0,xe("|",e[1])):t;return r||t};var Ee=(t,e)=>{let r=t?P(t):[],a=e?P(e):[];return a.every(n=>r.some(o=>o==n))&&r.every(n=>a.some(o=>o==n))},Y=(t,e)=>t==e,de=(t,e)=>(t??"").length==0,me=(t,e)=>(t??"").toLowerCase().includes((e??"").toLowerCase()),ce=(t,e)=>parseFloat(t)>parseFloat(e),pe=(t,e)=>parseInt(t){let r=isNaN(Date.parse(t))?new Date(parseInt(t)):new Date(t),a=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e);return r.valueOf()>=a.valueOf()},qe=(t,e)=>{let r=isNaN(Date.parse(t))?new Date(parseInt(t)):new Date(t),a=isNaN(Date.parse(e))?new Date(parseInt(e)):new Date(e);return r.valueOf(){let r=t?P(t):[],a=e?P(e):[];return r.length==0?!1:a.some(n=>r.some(o=>o==n))},_e=(t,e)=>{if(!t)return!1;let r=new Date(`${t.toString().replace(".",":")}`),a=new Date(`${e}`);return r.getMonth()===a.getMonth()&&r.getDate()===a.getDate()},Le=t=>{if(!t)return!1;let e=new Date(`${t.toString()}T00:00`),r=new Date;return e.getMonth()===r.getMonth()&&e.getDate()===r.getDate()};var U={isNotEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(t,e)=>!de(t,""),valueType:"none"},isEmpty:{type:["text","file","number","option","option-multi","link","link-multi","image"],fn:(t,e)=>de(t,""),valueType:"none"},include:{fn:(t,e)=>me(t,e),type:["text","file","link","image"],valueType:"text"},notInclude:{type:["text","file","link","image"],fn:(t,e)=>!me(t,e),valueType:"text"},is:{type:["text"],fn:(t,e)=>Y(t,e),valueType:"text"},isNot:{type:["text"],fn:(t,e)=>!Y(t,e),valueType:"text"},equal:{type:["number"],fn:(t,e)=>Y(t,e),valueType:"number"},isLink:{type:["link","context"],fn:(t,e)=>Y(t,e),valueType:"link"},isNotLink:{type:["link","context"],fn:(t,e)=>!Y(t,e),valueType:"link"},isGreatThan:{type:["number"],fn:(t,e)=>ce(t,e),valueType:"number"},isLessThan:{type:["number"],fn:(t,e)=>pe(t,e),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(t,e)=>!ce(t,e),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(t,e)=>!pe(t,e),valueType:"number"},dateBefore:{type:["date"],fn:(t,e)=>qe(t,e),valueType:"date"},dateAfter:{type:["date"],fn:(t,e)=>Ae(t,e),valueType:"date"},isSameDate:{type:["date"],fn:(t,e)=>_e(t,e),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(t,e)=>Le(t,e),valueType:"none"},isExactList:{type:["option","option-multi","link-multi","context-multi","tags-multi"],fn:(t,e)=>Ee(t,e),valueType:"list"},isAnyInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(t,e)=>ge(t,e),valueType:"list"},isNoneInList:{type:["option","context","link","option-multi","link-multi","context-multi","tags-multi"],fn:(t,e)=>!ge(t,e),valueType:"list"},isTrue:{type:["boolean"],fn:(t,e)=>t=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(t,e)=>t!="true",valueType:"none"}};var Gt=(t,e,r)=>e.reduce((n,o)=>{let[i,s]=n,d=o.type=="context"?$e(s,o,r):o.type=="path"?je(s,o,r):o.type=="frontmatter"?Qe(s,o,r):He(s,o,r),l=s.filter(p=>!d.includes(p));return[[...i,...d],l]},[[],t])[0],Vt=(t,e,r)=>e.reduce((a,n)=>n.type=="context"?$e(a,n,r):n.type=="path"?je(a,n,r):n.type=="frontmatter"?Qe(a,n,r):He(a,n,r),t),$e=(t,e,r)=>{let a=U[e.fn];return!a||a.valueType!="none"&&e.value.length==0?[]:t.filter(n=>{let[o,i]=e.field.split("."),s=n.metadata?.property;if(!n.spaces?.includes(o)||!s||!s[i])return!1;let d=!0;if(a){let l=e.fType=="property"?r[e.value]:e.value;d=a.fn(le(i,s[i]),l)}return d})},Qe=(t,e,r)=>{let a=U[e.fn];return!a||a.valueType!="none"&&e.value.length==0?[]:t.filter(n=>{let o=n.metadata?.property;if(!o||o[e.field]===void 0)return!1;let i=!0;if(a){let s=e.fType=="property"?r[e.value]:e.value;i=a.fn(le(e.field,o[e.field]),s)}return i})},je=(t,e,r)=>{let a=U[e.fn];return!a||a.valueType!="none"&&e.value.length==0?[]:t.filter(n=>{let o="";e.field=="outlinks"?o=I(n.outlinks??[]):e.field=="inlinks"?o=I(n.metadata?.inlinks??[]):e.field=="tags"&&(o=I(n.tags??[]));let i=!0;if(a){let s=e.fType=="property"?r[e.value]:e.value;i=a.fn(o,s)}return i})},He=(t,e,r)=>{let a=U[e.fn];return!a||a.valueType!="none"&&e.value.length==0?[]:t.filter(n=>{let o=!0;if(a){let i=e.fType=="property"?r[e.value]:e.value;o=a.fn(n.metadata?.[e.type]?.[e.field],i)}return o})},Re=(t,e,r)=>t.reduce((n,o)=>!n||o.filters.length==0?!1:o.type=="any"?Gt([e],o.filters,r).length>0:Vt([e],o.filters,r).length>0,!0);function Be(t){let{queries:e,pathsIndex:r,count:a}=t,n=[];for(let[o,i]of r)!i.hidden&&Re(e,i,{})&&n.push(i);return n.slice(0,a)}var Xt=self;Xt.onmessage=async t=>{let{payload:e,job:r}=t.data,a;r.type=="search"&&(a=Be(e));try{postMessage({job:r,result:a})}catch(n){console.log(n),postMessage({job:r,result:{$error:`Failed to run ${r.type} ${r.path}: ${n}`}})}};\n', { "name": "Superstate Search" }); } // src/core/superstate/workers/search/search.ts @@ -109900,9 +109953,9 @@ var Searcher = class { this.reloadQueue = []; this.reloadSet = /* @__PURE__ */ new Set(); this.callbacks = /* @__PURE__ */ new Map(); - for (let index2 = 0; index2 < numWorkers; index2++) { - const worker = new Worker3({ name: "Make.md Superstate Indexer " + (index2 + 1) }); - worker.onmessage = (evt) => this.finish(evt.data.job, evt.data.result, index2); + for (let index3 = 0; index3 < numWorkers; index3++) { + const worker = new Worker3({ name: "Make.md Superstate Indexer " + (index3 + 1) }); + worker.onmessage = (evt) => this.finish(evt.data.job, evt.data.result, index3); this.workers.push(worker); this.busy.push(false); } @@ -109926,20 +109979,20 @@ var Searcher = class { } return promise; } - finish(jerb, data2, index2) { + finish(jerb, data2, index3) { const jobKey = stringifyJob(jerb); const calls = [].concat(this.callbacks.get(jobKey) ?? []); this.reloadSet.delete(jobKey); this.callbacks.delete(jobKey); - this.busy[index2] = false; + this.busy[index3] = false; const job = this.reloadQueue.shift(); if (job !== void 0) - this.send(job, index2); + this.send(job, index3); if ("$error" in data2) { - for (const [_15, reject] of calls) + for (const [_16, reject] of calls) reject(data2["$error"]); } else { - for (const [callback, _15] of calls) + for (const [callback, _16] of calls) callback(data2); } } @@ -109962,8 +110015,8 @@ var Searcher = class { ); } nextAvailableWorker() { - const index2 = this.busy.indexOf(false); - return index2 == -1 ? void 0 : index2; + const index3 = this.busy.indexOf(false); + return index3 == -1 ? void 0 : index3; } }; @@ -110044,6 +110097,7 @@ var Superstate6 = class { this.spacesMap = new IndexMap(); this.linksMap = new IndexMap(); this.tagsMap = new IndexMap(); + this.liveSpaceLinkMap = new IndexMap(); this.iconsCache = /* @__PURE__ */ new Map(); this.imagesCache = /* @__PURE__ */ new Map(); this.contextStateQueue = Promise.resolve(); @@ -110317,7 +110371,7 @@ var Superstate6 = class { const allContextsWithFile = pathState.spaces.map((f3) => this.spacesIndex.get(f3)?.space).filter((f3) => f3); this.addToContextStateQueue(() => updateContextWithProperties(this, path2, allContextsWithFile).then(() => { allContextsWithFile.forEach((f3) => { - this.dispatchEvent("contextStateUpdated", { path: f3.path }); + this.dispatchEvent("spaceStateUpdated", { path: f3.path }); }); })); this.dispatchEvent("pathStateUpdated", { path: path2 }); @@ -110453,7 +110507,7 @@ var Superstate6 = class { } this.contextsIndex.set(path2, cache2); const pathState = this.pathsIndex.get(path2); - if (cache2.dbExists && !pathState.readOnly) { + if (pathState && cache2.dbExists && !pathState.readOnly) { if (this.settings.syncFormulaToFrontmatter) { const allRows = cache2.contextTable?.rows ?? []; const allColumns = cache2.contextTable?.cols ?? []; @@ -110585,6 +110639,7 @@ var Superstate6 = class { const sortable = spaceSort.field == "rank" || !spaceSort; const contexts = metadata?.contexts ?? []; const dependencies314 = uniq((metadata.filters ?? []).flatMap((f2) => f2.filters).flatMap((f2) => f2.type == "context" ? [f2.field.split(".")[0]] : f2.type == "path" && f2.field == "space" ? parseMultiString(f2.value) : [])); + const linkDependencies = uniq((metadata.filters ?? []).flatMap((f2) => f2.filters).flatMap((f2) => f2.type.startsWith("link") ? parseMultiString(f2.value) : [])); if (type == "tag" && this.settings.autoAddContextsToSubtags) { const parentTags = getAllParentTags(space2.name); contexts.push(...parentTags); @@ -111724,27 +111779,27 @@ function createKeyId(key2) { function get(obj, path2) { let list = []; let arr = false; - const deepGet = (obj2, path3, index2) => { + const deepGet = (obj2, path3, index3) => { if (!isDefined(obj2)) { return; } - if (!path3[index2]) { + if (!path3[index3]) { list.push(obj2); } else { - let key2 = path3[index2]; + let key2 = path3[index3]; const value = obj2[key2]; if (!isDefined(value)) { return; } - if (index2 === path3.length - 1 && (isString4(value) || isNumber3(value) || isBoolean2(value))) { + if (index3 === path3.length - 1 && (isString4(value) || isNumber3(value) || isBoolean2(value))) { list.push(toString3(value)); } else if (isArray4(value)) { arr = true; for (let i4 = 0, len = value.length; i4 < len; i4 += 1) { - deepGet(value[i4], path3, index2 + 1); + deepGet(value[i4], path3, index3 + 1); } } else if (path3.length) { - deepGet(value, path3, index2 + 1); + deepGet(value, path3, index3 + 1); } } }; @@ -111994,20 +112049,20 @@ function search(text2, pattern, patternAlphabet, { let bestLocation = expectedLocation; const computeMatches = minMatchCharLength > 1 || includeMatches; const matchMask = computeMatches ? Array(textLen) : []; - let index2; - while ((index2 = text2.indexOf(pattern, bestLocation)) > -1) { + let index3; + while ((index3 = text2.indexOf(pattern, bestLocation)) > -1) { let score2 = computeScore$1(pattern, { - currentLocation: index2, + currentLocation: index3, expectedLocation, distance: distance2, ignoreLocation }); currentThreshold = Math.min(score2, currentThreshold); - bestLocation = index2 + patternLen; + bestLocation = index3 + patternLen; if (computeMatches) { let i4 = 0; while (i4 < patternLen) { - matchMask[index2 + i4] = 1; + matchMask[index3 + i4] = 1; i4 += 1; } } @@ -112259,8 +112314,8 @@ var InverseExactMatch = class extends BaseMatch { return /^!(.*)$/; } search(text2) { - const index2 = text2.indexOf(this.pattern); - const isMatch2 = index2 === -1; + const index3 = text2.indexOf(this.pattern); + const isMatch2 = index3 === -1; return { isMatch: isMatch2, score: isMatch2 ? 0 : 1, @@ -112407,12 +112462,12 @@ var IncludeMatch = class extends BaseMatch { } search(text2) { let location = 0; - let index2; + let index3; const indices = []; const patternLen = this.pattern.length; - while ((index2 = text2.indexOf(this.pattern, location)) > -1) { - location = index2 + patternLen; - indices.push([index2, location - 1]); + while ((index3 = text2.indexOf(this.pattern, location)) > -1) { + location = index3 + patternLen; + indices.push([index3, location - 1]); } const isMatch2 = !!indices.length; return { @@ -112493,7 +112548,7 @@ var ExtendedSearch = class { this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase(); this.query = parseQuery(this.pattern, this.options); } - static condition(_15, options) { + static condition(_16, options) { return options.useExtendedSearch; } searchIn(text2) { @@ -112685,20 +112740,20 @@ function format7(results, docs, { }); } var Fuse = class { - constructor(docs, options = {}, index2) { + constructor(docs, options = {}, index3) { this.options = { ...Config, ...options }; if (this.options.useExtendedSearch && false) { throw new Error(EXTENDED_SEARCH_UNAVAILABLE); } this._keyStore = new KeyStore(this.options.keys); - this.setCollection(docs, index2); + this.setCollection(docs, index3); } - setCollection(docs, index2) { + setCollection(docs, index3) { this._docs = docs; - if (index2 && !(index2 instanceof FuseIndex)) { + if (index3 && !(index3 instanceof FuseIndex)) { throw new Error(INCORRECT_INDEX_TYPE); } - this._myIndex = index2 || createIndex2(this.options.keys, this._docs, { + this._myIndex = index3 || createIndex2(this.options.keys, this._docs, { getFn: this.options.getFn, fieldNormWeight: this.options.fieldNormWeight }); @@ -112916,7 +112971,7 @@ var STYLE_PROPS = [ ]; var SelectMenuSearch = (0, import_react58.forwardRef)( (props, input) => { - const { classNames: classNames16, inputAttributes, inputEventHandlers, index: index2 } = props; + const { classNames: classNames17, inputAttributes, inputEventHandlers, index: index3 } = props; const sizer = (0, import_react58.useRef)(null); const [inputWidth, setInputWidth] = (0, import_react58.useState)(null); const [placeholderText, setPlaceholderText] = (0, import_react58.useState)(""); @@ -112946,14 +113001,14 @@ var SelectMenuSearch = (0, import_react58.forwardRef)( } }; return /* @__PURE__ */ import_react58.default.createElement("div", { - className: classNames16.searchWrapper + className: classNames17.searchWrapper }, /* @__PURE__ */ import_react58.default.createElement("input", { ...inputAttributes, ...inputEventHandlers, ref: input, value: props.query, placeholder: placeholderText, - className: classNames16.searchInput, + className: classNames17.searchInput, role: "combobox", style: { width: "100%" }, onClick: (e5) => e5.stopPropagation() @@ -113077,13 +113132,13 @@ var SelectMenuInput = (props) => { }); }; var SelectMenuSuggestions = (props) => { - const options = props.options.map((item, index2) => { - const key2 = `${props.id}-${index2}`; - const className = item.type == -1 /* Separator */ ? "mk-menu-separator" : item.type == 2 /* Input */ ? "mk-menu-input" : item.type == 5 /* Custom */ ? "mk-menu-custom" : `mk-menu-option ${props.index === index2 && props.classNames.suggestionActive} ${item.disabled && props.classNames.suggestionDisabled}`; + const options = props.options.map((item, index3) => { + const key2 = `${props.id}-${index3}`; + const className = item.type == -1 /* Separator */ ? "mk-menu-separator" : item.type == 2 /* Input */ ? "mk-menu-input" : item.type == 5 /* Custom */ ? "mk-menu-custom" : `mk-menu-option ${props.index === index3 && props.classNames.suggestionActive} ${item.disabled && props.classNames.suggestionDisabled}`; return /* @__PURE__ */ import_react61.default.createElement("div", { ref: (ref2) => { if (props.refs?.current) - props.refs.current[index2] = ref2; + props.refs.current[index3] = ref2; }, onMouseDown: (e5) => { if (!props.isDisclosureMenu) @@ -113092,7 +113147,7 @@ var SelectMenuSuggestions = (props) => { }, onClick: (e5) => { if (item.onSubmenu && props.openSubmenu) { - const el = props.refs?.current[index2].getBoundingClientRect(); + const el = props.refs?.current[index3].getBoundingClientRect(); props.openSubmenu( item.onSubmenu(el, () => { if (props.onHide) { @@ -113134,7 +113189,7 @@ var SelectMenuSuggestions = (props) => { ui: props.ui, item, query: props.query, - active: index2 == props.index, + active: index3 == props.index, onMoreOption: props.moreOption, onDeleteOption: props.deleteOption })); @@ -113225,10 +113280,10 @@ var defaultProps = { var findMatchIndex = (options, query) => { return options.findIndex((option) => matchExact(query).test(option.name)); }; -var pressDelimiter = (props, query, index2, options, addTag2, modifiers) => { +var pressDelimiter = (props, query, index3, options, addTag2, modifiers) => { if (query.length >= props.minQueryLength) { const match2 = findMatchIndex(options, query); - const _index = index2 === -1 ? match2 : index2; + const _index = index3 === -1 ? match2 : index3; const tag2 = _index > -1 ? options[_index] : null; if (tag2) { addTag2(tag2, modifiers); @@ -113287,7 +113342,7 @@ var SelectMenuComponent = import_react62.default.forwardRef( const [section, setSection] = (0, import_react62.useState)(""); const [query, setQuery] = (0, import_react62.useState)(""); const [focused, setFocused] = (0, import_react62.useState)(false); - const [index2, setIndex] = (0, import_react62.useState)(0); + const [index3, setIndex] = (0, import_react62.useState)(0); const onComposition = (0, import_react62.useRef)(false); (0, import_react62.useEffect)(() => { if (ref2) { @@ -113323,7 +113378,7 @@ var SelectMenuComponent = import_react62.default.forwardRef( props.onInput(_query); } if (_query.length === query.length + 1 && props.delimiters.indexOf(query.slice(-1)) > -1) { - pressDelimiter(props, query, index2, options, addTag2, {}); + pressDelimiter(props, query, index3, options, addTag2, {}); } else if (_query !== query) { setQuery(_query); } @@ -113333,10 +113388,10 @@ var SelectMenuComponent = import_react62.default.forwardRef( return; } if (props.delimiters.indexOf(e5.key) > -1) { - if (query || index2 > -1) { + if (query || index3 > -1) { e5.preventDefault(); } - pressDelimiter(props, query, index2, options, addTag2, { + pressDelimiter(props, query, index3, options, addTag2, { ctrlKey: e5.ctrlKey, metaKey: e5.metaKey, altKey: e5.altKey, @@ -113372,11 +113427,11 @@ var SelectMenuComponent = import_react62.default.forwardRef( props.onFocus(); } }; - const onDeleteTag = (index3, event) => { + const onDeleteTag = (index4, event) => { if (container.current) { focusNextElement(container.current, event.currentTarget); } - deleteTag(index3); + deleteTag(index4); }; const addTag2 = (tag2, modifiers) => { if (tag2.disabled) { @@ -113401,7 +113456,7 @@ var SelectMenuComponent = import_react62.default.forwardRef( const pressUpKey = (e5) => { e5.preventDefault(); const size2 = options.length - 1; - const newIndex = index2 <= 0 ? size2 : index2 - 1; + const newIndex = index3 <= 0 ? size2 : index3 - 1; if (options[newIndex].disabled) { setIndex(newIndex <= 0 ? size2 : newIndex - 1); } else { @@ -113411,7 +113466,7 @@ var SelectMenuComponent = import_react62.default.forwardRef( const pressDownKey = (e5) => { e5.preventDefault(); const size2 = options.length - 1; - const newIndex = index2 >= size2 ? 0 : index2 + 1; + const newIndex = index3 >= size2 ? 0 : index3 + 1; if (options[newIndex].disabled) { setIndex(newIndex >= size2 ? 0 : newIndex + 1); } else { @@ -113461,14 +113516,14 @@ var SelectMenuComponent = import_react62.default.forwardRef( return () => { props.ui.inputManager.off("keydown", onKeyDown); }; - }, [options, index2]); + }, [options, index3]); const expanded = focused && query.length >= props.minQueryLength; - const classNames16 = Object.assign({}, CLASS_NAMES, props.classNames); + const classNames17 = Object.assign({}, CLASS_NAMES, props.classNames); if (props.wrapperClass) { - classNames16.root = `${classNames16.root} ${props.wrapperClass}`; + classNames17.root = `${classNames17.root} ${props.wrapperClass}`; } - const rootClassNames = [classNames16.root]; - focused && rootClassNames.push(classNames16.rootFocused); + const rootClassNames = [classNames17.root]; + focused && rootClassNames.push(classNames17.rootFocused); const submenuRef = (0, import_react62.useRef)(null); const openSubmenu = (menu) => { if (submenuRef.current) { @@ -113483,25 +113538,25 @@ var SelectMenuComponent = import_react62.default.forwardRef( "--mk-menu-max-height": "200px" } : {} }, !props.suggestionsOnly ? /* @__PURE__ */ import_react62.default.createElement("div", { - className: classNames16.selected, + className: classNames17.selected, "aria-relevant": "additions removals", "aria-live": "polite" }, props.tags.length > 0 && /* @__PURE__ */ import_react62.default.createElement("div", { - className: classNames16.selectedTagWrapper + className: classNames17.selectedTagWrapper }, props.tags.map((tag2, i4) => /* @__PURE__ */ import_react62.default.createElement(SelectMenuPill_default, { key: i4, tag: tag2, - classNames: classNames16, + classNames: classNames17, onDelete: (e5) => onDeleteTag(i4, e5) }))), /* @__PURE__ */ import_react62.default.createElement("div", { - className: classNames16.search + className: classNames17.search }, /* @__PURE__ */ import_react62.default.createElement(SelectMenuInput_default, { ui: props.ui, ref: inputRef, query, - index: index2, + index: index3, id: props.id, - classNames: classNames16, + classNames: classNames17, inputAttributes: props.inputAttributes, inputEventHandlers, expanded, @@ -113525,10 +113580,10 @@ var SelectMenuComponent = import_react62.default.forwardRef( options, query, setIndex, - index: index2, + index: index3, onHide: props.onHide, id: props.id, - classNames: classNames16, + classNames: classNames17, expanded, selectOption: addTag2, allowNew: props.allowNew, @@ -113573,7 +113628,7 @@ var SelectMenu = import_react63.default.forwardRef( ); const onDelete = (0, import_react63.useCallback)( (tagIndex) => { - const newTags = tags5.filter((_15, i4) => i4 !== tagIndex); + const newTags = tags5.filter((_16, i4) => i4 !== tagIndex); setTags(newTags); if (props.saveOptions) props.saveOptions( @@ -113899,7 +113954,7 @@ var PropertiesView = (props) => { editable: false, value: [], options, - saveOptions: (_15, value) => { + saveOptions: (_16, value) => { saveMetadata(property, value[0]); }, placeholder: i18n_default.labels.spaceSelectPlaceholder, @@ -113938,7 +113993,7 @@ var PropertiesView = (props) => { multi: false, editable: false, searchable: false, - saveOptions: (_15, v2) => selectedType(v2, key2), + saveOptions: (_16, v2) => selectedType(v2, key2), value: [], showAll: true, options: fieldTypes.filter((f2) => f2.metadata).map((f2, i4) => ({ @@ -114060,10 +114115,10 @@ var PropertiesView = (props) => { }), contextTable: {}, source: pathState.path - }))) : excludeKeys.length > 0 ? /* @__PURE__ */ import_react65.default.createElement("style", null, `${excludeKeys.map((f2) => `.metadata-property[data-property-key="${f2}"]`).join(", ")} + }))) : /* @__PURE__ */ import_react65.default.createElement(import_react65.default.Fragment, null), excludeKeys.length > 0 && /* @__PURE__ */ import_react65.default.createElement("style", null, `${excludeKeys.map((f2) => `.metadata-property[data-property-key="${f2}"]`).join(", ")} { display: none; - }`) : /* @__PURE__ */ import_react65.default.createElement(import_react65.default.Fragment, null)); + }`)); }; // src/core/react/components/SpaceEditor/LiveFilters.tsx @@ -114629,9 +114684,9 @@ var FilterBar = (props) => { colsHidden: [] }); }; - const removeFilter = (filter4, index2) => { + const removeFilter = (filter4, index3) => { const pred = predicate ?? defaultPredicateForSchema(dbSchema); - const newFilters = [...pred.filters.filter((f2, i4) => i4 != index2)]; + const newFilters = [...pred.filters.filter((f2, i4) => i4 != index3)]; savePredicate({ filters: newFilters }); @@ -114912,7 +114967,7 @@ var FilterBar = (props) => { windowFromDocument(e5.view.document) ); }; - const addSort = (_15, sort2) => { + const addSort = (_16, sort2) => { const field = sort2[0]; const fieldObject = filteredCols.find((f2) => f2.name + f2.table == field); const fieldType = fieldTypeForField(fieldObject); @@ -114930,7 +114985,7 @@ var FilterBar = (props) => { }); } }; - const saveGroupBy = (_15, groupBy2) => { + const saveGroupBy = (_16, groupBy2) => { savePredicate({ groupBy: groupBy2 }); @@ -114968,7 +115023,7 @@ var FilterBar = (props) => { }; const changeSortMenu = (e5, sort2) => { const offset2 = e5.target.getBoundingClientRect(); - const saveSort = (_15, newType) => { + const saveSort = (_16, newType) => { const type = newType[0]; const newSort = { ...sort2, @@ -115005,9 +115060,9 @@ var FilterBar = (props) => { windowFromDocument(e5.view.document) ); }; - const changeFilterMenu = (e5, filter4, index2) => { + const changeFilterMenu = (e5, filter4, index3) => { const offset2 = e5.target.getBoundingClientRect(); - const saveFilter = (_15, newType) => { + const saveFilter = (_16, newType) => { const type = newType[0]; const newFilter = { ...filter4, @@ -115016,7 +115071,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }; @@ -115109,7 +115164,7 @@ var FilterBar = (props) => { } }; const saveNewField = (source2, field) => { - saveColumn({ ...field, table: "" }); + return saveColumn({ ...field, table: "" }); }; const saveContexts = (spacePath, contexts) => { const space2 = props.superstate.spacesIndex.get(spacePath); @@ -115136,7 +115191,7 @@ var FilterBar = (props) => { editable: true, value: [], options: f2.map((m4) => ({ name: m4, value: m4 })), - saveOptions: (_15, value) => addTag2(value[0]), + saveOptions: (_16, value) => addTag2(value[0]), placeholder: i18n_default.labels.contextItemSelectPlaceholder, searchable: true, showAll: true @@ -115218,7 +115273,7 @@ var FilterBar = (props) => { { superstate: props.superstate, rect: offset3, - editable: true, + editable: f2.primary != "true", win, options: [], field: f2, @@ -115323,13 +115378,13 @@ var FilterBar = (props) => { onHide ); }; - const selectFilterValue = (e5, filter4, index2) => { + const selectFilterValue = (e5, filter4, index3) => { switch (filter4.fType ?? filterFnTypes[filter4.fn].valueType) { case "property": { savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? filter4 : s4 + (s4, i4) => i4 == index3 ? filter4 : s4 ) }); } @@ -115339,7 +115394,7 @@ var FilterBar = (props) => { { savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? filter4 : s4 + (s4, i4) => i4 == index3 ? filter4 : s4 ) }); } @@ -115352,7 +115407,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }; @@ -115395,7 +115450,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }, @@ -115414,7 +115469,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }; @@ -115441,7 +115496,7 @@ var FilterBar = (props) => { }; savePredicate({ filters: (predicate?.filters ?? []).map( - (s4, i4) => i4 == index2 ? newFilter : s4 + (s4, i4) => i4 == index3 ? newFilter : s4 ) }); }; @@ -115614,7 +115669,7 @@ var FilterBar = (props) => { value: f3.name, section: f3.type })), - saveOptions: (_15, value) => selectFilterValue( + saveOptions: (_16, value) => selectFilterValue( e5, { ...f2, @@ -115804,7 +115859,7 @@ var SpaceQuery = (props) => { value: f2, name: f2 })); - } else if (fieldType.startsWith("links")) { + } else if (fieldType.startsWith("link")) { options = props.superstate.spaceManager.allPaths().map((f2) => ({ name: pathNameToString(f2), value: f2, @@ -115986,7 +116041,7 @@ var SpaceQuery = (props) => { name: f2 == "any" ? "or" : "and", value: f2 })), - saveOptions: (_15, value) => setGroupType(i4, value[0]), + saveOptions: (_16, value) => setGroupType(i4, value[0]), searchable: false, showAll: true }, @@ -116005,7 +116060,7 @@ var SpaceQuery = (props) => { editable: true, value: [], options: _filters.map((f2) => ({ name: filterFnLabels[f2], value: f2 })), - saveOptions: (_15, value) => setDefFilterFn(value[0], i4, k2), + saveOptions: (_16, value) => setDefFilterFn(value[0], i4, k2), placeholder: i18n_default.labels.contextItemSelectPlaceholder, searchable: true, showAll: true @@ -116028,7 +116083,7 @@ var SpaceQuery = (props) => { section: f2.type, description: f2.description })), - saveOptions: (_15, value) => setDefFilter(value[0], i4, k2), + saveOptions: (_16, value) => setDefFilter(value[0], i4, k2), placeholder: i18n_default.labels.contextItemSelectPlaceholder, searchable: true, showAll: true, @@ -116116,7 +116171,7 @@ var DefFilter = (props) => { value: f2.name, section: f2.type })), - saveOptions: (_15, value) => selectFilterValue( + saveOptions: (_16, value) => selectFilterValue( e5, { ...filter4, @@ -116874,7 +116929,7 @@ var SpaceTemplateProperty = (props) => { "bottom" ); }; - return templates.length > 0 ? props.compactMode ? /* @__PURE__ */ import_react78.default.createElement("div", { + return templates?.length > 0 ? props.compactMode ? /* @__PURE__ */ import_react78.default.createElement("div", { className: "mk-props-pill", onClick: () => setCollapsed((f2) => !f2) }, templates.length, " Templates") : /* @__PURE__ */ import_react78.default.createElement("div", { @@ -116994,9 +117049,10 @@ var HeaderPropertiesView = (props) => { const saveField = (source, field) => { if (source == "$fm") { saveNewProperty(props.superstate, pathState.path, field); - return; + return true; } props.superstate.spaceManager.addSpaceProperty(source, field); + return true; }; const newProperty = (e5, space2) => { const offset2 = e5.target.getBoundingClientRect(); @@ -117005,11 +117061,12 @@ var HeaderPropertiesView = (props) => { offset2, windowFromDocument(e5.view.document), { - spaces: [], + spaces: spacePathStates.map((f2) => f2.path), fields: [], saveField: (source, field) => saveField(space2, field), schemaId: defaultContextSchemaID, - contextPath: space2 + contextPath: space2, + fileMetadata: !isSpace } ); }; @@ -117151,15 +117208,15 @@ var HeaderPropertiesView = (props) => { contexts.forEach((f2) => { const row2 = f2.rows.find((f3) => f3[PathPropertyName] == pathState.path); f2.cols.filter((f3) => f3.primary != "true").forEach((g) => { - const index2 = properties3.findIndex((h3) => h3.property.name == g.name); - if (index2 == -1) { + const index3 = properties3.findIndex((h3) => h3.property.name == g.name); + if (index3 == -1) { properties3.push({ property: g, contexts: [f2.path], value: row2?.[g.name] ?? "" }); } else { - properties3[index2].contexts.push(f2.path); + properties3[index3].contexts.push(f2.path); } }); }, []); @@ -117381,20 +117438,20 @@ var Explorer = (props) => { readMode: false }, isSpace ? /* @__PURE__ */ import_react80.default.createElement(SpaceProvider, { superstate: props.superstate - }, /* @__PURE__ */ import_react80.default.createElement(PathContextView, { + }, /* @__PURE__ */ import_react80.default.createElement(ExplorerPathView, { superstate: props.superstate - })) : /* @__PURE__ */ import_react80.default.createElement(PathContextView, { + })) : /* @__PURE__ */ import_react80.default.createElement(ExplorerPathView, { superstate: props.superstate })); }; -var PathContextView = (props) => { +var ExplorerPathView = (props) => { const [openNodes, setOpenNodes] = (0, import_react80.useState)([]); const { pathState } = (0, import_react80.useContext)(PathContext); (0, import_react80.useEffect)(() => { pathState && setOpenNodes([pathState.path]); }, [pathState]); return /* @__PURE__ */ import_react80.default.createElement("div", { - className: "mk-path-context" + className: "mk-path-explorer" }, /* @__PURE__ */ import_react80.default.createElement("div", { className: "mk-path-context-properties" }, /* @__PURE__ */ import_react80.default.createElement("div", { @@ -118543,7 +118600,7 @@ var showNewFrameMenu = (rect, win, superstate, space2, addNode, options = { sear editable: false, value: [], options: selectOptions, - saveOptions: (_15, value) => insertNode(value[0]), + saveOptions: (_16, value) => insertNode(value[0]), searchable: options.searchable, showAll: true }, @@ -119512,7 +119569,7 @@ var TextSubmenu = (props) => { multi: false, editable: false, searchable: true, - saveOptions: (_15, v2) => { + saveOptions: (_16, v2) => { saveStyleValue("--font-text", `'${v2[0]}'`); }, value: [selectedNode.styles?.["--font-text"] ?? ""], @@ -120457,9 +120514,9 @@ var Tree2 = class { }; Tree2.empty = new Tree2(NodeType2.none, [], [], 0); var FlatBufferCursor2 = class { - constructor(buffer, index2) { + constructor(buffer, index3) { this.buffer = buffer; - this.index = index2; + this.index = index3; } get id() { return this.buffer[this.index - 4]; @@ -120494,24 +120551,24 @@ var TreeBuffer2 = class { } toString() { let result = []; - for (let index2 = 0; index2 < this.buffer.length; ) { - result.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + for (let index3 = 0; index3 < this.buffer.length; ) { + result.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result.join(","); } - childString(index2) { - let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3]; + childString(index3) { + let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3]; let type = this.set.types[id3], result = type.name; if (/\W/.test(result) && !type.isError) result = JSON.stringify(result); - index2 += 4; - if (endIndex == index2) + index3 += 4; + if (endIndex == index3) return result; let children = []; - while (index2 < endIndex) { - children.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + while (index3 < endIndex) { + children.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result + "(" + children.join(",") + ")"; } @@ -120591,10 +120648,10 @@ function resolveNode2(node, pos, side, overlays) { } } var TreeNode3 = class { - constructor(_tree, from, index2, _parent) { + constructor(_tree, from, index3, _parent) { this._tree = _tree; this.from = from; - this.index = index2; + this.index = index3; this._parent = _parent; } get type() { @@ -120615,9 +120672,9 @@ var TreeNode3 = class { if (next instanceof TreeBuffer2) { if (mode2 & IterMode2.ExcludeBuffers) continue; - let index2 = next.findChild(0, next.buffer.length, dir, pos - start, side); - if (index2 > -1) - return new BufferNode2(new BufferContext2(parent, next, i4, start), null, index2); + let index3 = next.findChild(0, next.buffer.length, dir, pos - start, side); + if (index3 > -1) + return new BufferNode2(new BufferContext2(parent, next, i4, start), null, index3); } else if (mode2 & IterMode2.IncludeAnonymous || (!next.type.isAnonymous || hasChild2(next))) { let mounted; if (!(mode2 & IterMode2.IgnoreMounts) && next.props && (mounted = next.prop(NodeProp2.mounted)) && !mounted.overlay) @@ -120741,19 +120798,19 @@ function matchNodeContext2(node, context, i4 = context.length - 1) { return true; } var BufferContext2 = class { - constructor(parent, buffer, index2, start) { + constructor(parent, buffer, index3, start) { this.parent = parent; this.buffer = buffer; - this.index = index2; + this.index = index3; this.start = start; } }; var BufferNode2 = class { - constructor(context, _parent, index2) { + constructor(context, _parent, index3) { this.context = context; this._parent = _parent; - this.index = index2; - this.type = context.buffer.set.types[context.buffer.buffer[index2]]; + this.index = index3; + this.type = context.buffer.set.types[context.buffer.buffer[index3]]; } get name() { return this.type.name; @@ -120766,8 +120823,8 @@ var BufferNode2 = class { } child(dir, pos, side) { let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode2(this.context, this, index2); + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode2(this.context, this, index3); } get firstChild() { return this.child(1, 0, 4); @@ -120785,8 +120842,8 @@ var BufferNode2 = class { if (mode2 & IterMode2.ExcludeBuffers) return null; let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode2(this.context, this, index2); + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode2(this.context, this, index3); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); @@ -120881,12 +120938,12 @@ var TreeCursor2 = class { this.to = node.to; return true; } - yieldBuf(index2, type) { - this.index = index2; + yieldBuf(index3, type) { + this.index = index3; let { start, buffer } = this.buffer; - this.type = type || buffer.set.types[buffer.buffer[index2]]; - this.from = start + buffer.buffer[index2 + 1]; - this.to = start + buffer.buffer[index2 + 2]; + this.type = type || buffer.set.types[buffer.buffer[index3]]; + this.from = start + buffer.buffer[index3 + 1]; + this.to = start + buffer.buffer[index3 + 2]; return true; } yield(node) { @@ -120906,11 +120963,11 @@ var TreeCursor2 = class { if (!this.buffer) return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); let { buffer } = this.buffer; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); - if (index2 < 0) + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); + if (index3 < 0) return false; this.stack.push(this.index); - return this.yieldBuf(index2); + return this.yieldBuf(index3); } firstChild() { return this.enterChild(1, 0, 4); @@ -120960,7 +121017,7 @@ var TreeCursor2 = class { return this.sibling(-1); } atLastNode(dir) { - let index2, parent, { buffer } = this; + let index3, parent, { buffer } = this; if (buffer) { if (dir > 0) { if (this.index < buffer.buffer.buffer.length) @@ -120970,13 +121027,13 @@ var TreeCursor2 = class { if (buffer.buffer.buffer[i4 + 3] < this.index) return false; } - ({ index: index2, parent } = buffer); + ({ index: index3, parent } = buffer); } else { - ({ index: index2, _parent: parent } = this._tree); + ({ index: index3, _parent: parent } = this._tree); } - for (; parent; { index: index2, _parent: parent } = parent) { - if (index2 > -1) - for (let i4 = index2 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { + for (; parent; { index: index3, _parent: parent } = parent) { + if (index3 > -1) + for (let i4 = index3 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { let child = parent._tree.children[i4]; if (this.mode & IterMode2.IncludeAnonymous || child instanceof TreeBuffer2 || !child.type.isAnonymous || hasChild2(child)) return false; @@ -121014,16 +121071,16 @@ var TreeCursor2 = class { let cache2 = this.bufferNode, result = null, depth = 0; if (cache2 && cache2.context == this.buffer) { scan: - for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) { + for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) { for (let c3 = cache2; c3; c3 = c3._parent) - if (c3.index == index2) { - if (index2 == this.index) + if (c3.index == index3) { + if (index3 == this.index) return c3; result = c3; depth = d4 + 1; break scan; } - index2 = this.stack[--d4]; + index3 = this.stack[--d4]; } } for (let i4 = depth; i4 < this.stack.length; i4++) @@ -121108,9 +121165,9 @@ function buildTree2(data2) { let startPos = start - parentStart; if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor2.pos - minPos, inRepeat))) { let data3 = new Uint16Array(buffer2.size - buffer2.skip); - let endPos = cursor2.pos - buffer2.size, index2 = data3.length; + let endPos = cursor2.pos - buffer2.size, index3 = data3.length; while (cursor2.pos > endPos) - index2 = copyToBuffer(buffer2.start, data3, index2); + index3 = copyToBuffer(buffer2.start, data3, index3); node = new TreeBuffer2(data3, end - buffer2.start, nodeSet2); startPos = buffer2.start - parentStart; } else { @@ -121221,26 +121278,26 @@ function buildTree2(data2) { } return result.size > 4 ? result : void 0; } - function copyToBuffer(bufferStart, buffer2, index2) { + function copyToBuffer(bufferStart, buffer2, index3) { let { id: id3, start, end, size: size2 } = cursor2; cursor2.next(); if (size2 >= 0 && id3 < minRepeatType) { - let startIndex = index2; + let startIndex = index3; if (size2 > 4) { let endPos = cursor2.pos - (size2 - 4); while (cursor2.pos > endPos) - index2 = copyToBuffer(bufferStart, buffer2, index2); + index3 = copyToBuffer(bufferStart, buffer2, index3); } - buffer2[--index2] = startIndex; - buffer2[--index2] = end - bufferStart; - buffer2[--index2] = start - bufferStart; - buffer2[--index2] = id3; + buffer2[--index3] = startIndex; + buffer2[--index3] = end - bufferStart; + buffer2[--index3] = start - bufferStart; + buffer2[--index3] = id3; } else if (size2 == -3) { contextHash = id3; } else if (size2 == -4) { lookAhead = id3; } - return index2; + return index3; } let children = [], positions = []; while (cursor2.pos > 0) @@ -121350,7 +121407,7 @@ var Stack = class { this.parent = parent; } toString() { - return `[${this.stack.filter((_15, i4) => i4 % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`; + return `[${this.stack.filter((_16, i4) => i4 % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`; } static start(p, state, pos = 0) { let cx = p.parser.context; @@ -121412,21 +121469,21 @@ var Stack = class { if (!isReduce || this.pos == end) { this.buffer.push(term, start, end, size2); } else { - let index2 = this.buffer.length; - if (index2 > 0 && this.buffer[index2 - 4] != 0) - while (index2 > 0 && this.buffer[index2 - 2] > end) { - this.buffer[index2] = this.buffer[index2 - 4]; - this.buffer[index2 + 1] = this.buffer[index2 - 3]; - this.buffer[index2 + 2] = this.buffer[index2 - 2]; - this.buffer[index2 + 3] = this.buffer[index2 - 1]; - index2 -= 4; + let index3 = this.buffer.length; + if (index3 > 0 && this.buffer[index3 - 4] != 0) + while (index3 > 0 && this.buffer[index3 - 2] > end) { + this.buffer[index3] = this.buffer[index3 - 4]; + this.buffer[index3 + 1] = this.buffer[index3 - 3]; + this.buffer[index3 + 2] = this.buffer[index3 - 2]; + this.buffer[index3 + 3] = this.buffer[index3 - 1]; + index3 -= 4; if (size2 > 4) size2 -= 4; } - this.buffer[index2] = term; - this.buffer[index2 + 1] = start; - this.buffer[index2 + 2] = end; - this.buffer[index2 + 3] = size2; + this.buffer[index3] = term; + this.buffer[index3 + 1] = start; + this.buffer[index3 + 2] = end; + this.buffer[index3 + 3] = size2; } } shift(action, next, nextEnd) { @@ -121458,15 +121515,15 @@ var Stack = class { this.shift(action, next, nextEnd); } useNode(value, next) { - let index2 = this.p.reused.length - 1; - if (index2 < 0 || this.p.reused[index2] != value) { + let index3 = this.p.reused.length - 1; + if (index3 < 0 || this.p.reused[index3] != value) { this.p.reused.push(value); - index2++; + index3++; } let start = this.pos; this.reducePos = this.pos = start + value.length; this.pushState(next, start); - this.buffer.push(index2, start, this.reducePos, -1); + this.buffer.push(index3, start, this.reducePos, -1); if (this.curContext) this.updateContext(this.curContext.tracker.reuse(this.curContext.context, value, this, this.p.stream.reset(this.pos - value.length))); } @@ -121657,10 +121714,10 @@ var SimulatedStack = class { } }; var StackBufferCursor = class { - constructor(stack, pos, index2) { + constructor(stack, pos, index3) { this.stack = stack; this.pos = pos; - this.index = index2; + this.index = index3; this.buffer = stack.buffer; if (this.index == 0) this.maybeNext(); @@ -121727,19 +121784,19 @@ var InputStream = class { this.readNext(); } resolveOffset(offset2, assoc) { - let range2 = this.range, index2 = this.rangeIndex; + let range2 = this.range, index3 = this.rangeIndex; let pos = this.pos + offset2; while (pos < range2.from) { - if (!index2) + if (!index3) return null; - let next = this.ranges[--index2]; + let next = this.ranges[--index3]; pos -= range2.from - next.to; range2 = next; } while (assoc < 0 ? pos > range2.to : pos >= range2.to) { - if (index2 == this.ranges.length - 1) + if (index3 == this.ranges.length - 1) return null; - let next = this.ranges[++index2]; + let next = this.ranges[++index3]; pos += next.from - range2.to; range2 = next; } @@ -121905,14 +121962,14 @@ function readToken2(data2, input, stack, group) { } for (let next = input.next, low = 0, high = data2[state + 2]; low < high; ) { let mid = low + high >> 1; - let index2 = accEnd + mid + (mid << 1); - let from = data2[index2], to2 = data2[index2 + 1]; + let index3 = accEnd + mid + (mid << 1); + let from = data2[index3], to2 = data2[index3 + 1]; if (next < from) high = mid; else if (next >= to2) low = mid + 1; else { - state = data2[index2 + 2]; + state = data2[index3 + 2]; input.advance(); continue scan; } @@ -122018,15 +122075,15 @@ var FragmentCursor = class { this.nextFragment(); return null; } - let top2 = this.trees[last], index2 = this.index[last]; - if (index2 == top2.children.length) { + let top2 = this.trees[last], index3 = this.index[last]; + if (index3 == top2.children.length) { this.trees.pop(); this.start.pop(); this.index.pop(); continue; } - let next = top2.children[index2]; - let start = this.start[last] + top2.positions[index2]; + let next = top2.children[index3]; + let start = this.start[last] + top2.positions[index3]; if (start > pos) { this.nextStart = start; return null; @@ -122061,7 +122118,7 @@ var TokenCache = class { this.tokens = []; this.mainToken = null; this.actions = []; - this.tokens = parser3.tokenizers.map((_15) => new CachedToken()); + this.tokens = parser3.tokenizers.map((_16) => new CachedToken()); } getActions(stack) { let actionIndex = 0; @@ -122137,16 +122194,16 @@ var TokenCache = class { token.end = Math.min(stack.p.stream.end, stack.pos + 1); } } - putAction(action, token, end, index2) { - for (let i4 = 0; i4 < index2; i4 += 3) + putAction(action, token, end, index3) { + for (let i4 = 0; i4 < index3; i4 += 3) if (this.actions[i4] == action) - return index2; - this.actions[index2++] = action; - this.actions[index2++] = token; - this.actions[index2++] = end; - return index2; + return index3; + this.actions[index3++] = action; + this.actions[index3++] = token; + this.actions[index3++] = end; + return index3; } - addActions(stack, token, end, index2) { + addActions(stack, token, end, index3) { let { state } = stack, { parser: parser3 } = stack.p, { data: data2 } = parser3; for (let set = 0; set < 2; set++) { for (let i4 = parser3.stateSlot(state, set ? 2 : 1); ; i4 += 3) { @@ -122154,16 +122211,16 @@ var TokenCache = class { if (data2[i4 + 1] == 1) { i4 = pair(data2, i4 + 2); } else { - if (index2 == 0 && data2[i4 + 1] == 2) - index2 = this.putAction(pair(data2, i4 + 2), token, end, index2); + if (index3 == 0 && data2[i4 + 1] == 2) + index3 = this.putAction(pair(data2, i4 + 2), token, end, index3); break; } } if (data2[i4] == token) - index2 = this.putAction(pair(data2, i4 + 1), token, end, index2); + index3 = this.putAction(pair(data2, i4 + 1), token, end, index3); } } - return index2; + return index3; } }; var Rec; @@ -123340,9 +123397,9 @@ var Tree3 = class { }; Tree3.empty = new Tree3(NodeType3.none, [], [], 0); var FlatBufferCursor3 = class { - constructor(buffer, index2) { + constructor(buffer, index3) { this.buffer = buffer; - this.index = index2; + this.index = index3; } get id() { return this.buffer[this.index - 4]; @@ -123377,24 +123434,24 @@ var TreeBuffer3 = class { } toString() { let result = []; - for (let index2 = 0; index2 < this.buffer.length; ) { - result.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + for (let index3 = 0; index3 < this.buffer.length; ) { + result.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result.join(","); } - childString(index2) { - let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3]; + childString(index3) { + let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3]; let type = this.set.types[id3], result = type.name; if (/\W/.test(result) && !type.isError) result = JSON.stringify(result); - index2 += 4; - if (endIndex == index2) + index3 += 4; + if (endIndex == index3) return result; let children = []; - while (index2 < endIndex) { - children.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + while (index3 < endIndex) { + children.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result + "(" + children.join(",") + ")"; } @@ -123474,10 +123531,10 @@ function resolveNode3(node, pos, side, overlays) { } } var TreeNode4 = class { - constructor(_tree, from, index2, _parent) { + constructor(_tree, from, index3, _parent) { this._tree = _tree; this.from = from; - this.index = index2; + this.index = index3; this._parent = _parent; } get type() { @@ -123498,9 +123555,9 @@ var TreeNode4 = class { if (next instanceof TreeBuffer3) { if (mode2 & IterMode3.ExcludeBuffers) continue; - let index2 = next.findChild(0, next.buffer.length, dir, pos - start, side); - if (index2 > -1) - return new BufferNode3(new BufferContext3(parent, next, i4, start), null, index2); + let index3 = next.findChild(0, next.buffer.length, dir, pos - start, side); + if (index3 > -1) + return new BufferNode3(new BufferContext3(parent, next, i4, start), null, index3); } else if (mode2 & IterMode3.IncludeAnonymous || (!next.type.isAnonymous || hasChild3(next))) { let mounted; if (!(mode2 & IterMode3.IgnoreMounts) && next.props && (mounted = next.prop(NodeProp3.mounted)) && !mounted.overlay) @@ -123624,19 +123681,19 @@ function matchNodeContext3(node, context, i4 = context.length - 1) { return true; } var BufferContext3 = class { - constructor(parent, buffer, index2, start) { + constructor(parent, buffer, index3, start) { this.parent = parent; this.buffer = buffer; - this.index = index2; + this.index = index3; this.start = start; } }; var BufferNode3 = class { - constructor(context, _parent, index2) { + constructor(context, _parent, index3) { this.context = context; this._parent = _parent; - this.index = index2; - this.type = context.buffer.set.types[context.buffer.buffer[index2]]; + this.index = index3; + this.type = context.buffer.set.types[context.buffer.buffer[index3]]; } get name() { return this.type.name; @@ -123649,8 +123706,8 @@ var BufferNode3 = class { } child(dir, pos, side) { let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode3(this.context, this, index2); + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode3(this.context, this, index3); } get firstChild() { return this.child(1, 0, 4); @@ -123668,8 +123725,8 @@ var BufferNode3 = class { if (mode2 & IterMode3.ExcludeBuffers) return null; let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode3(this.context, this, index2); + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode3(this.context, this, index3); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); @@ -123764,12 +123821,12 @@ var TreeCursor3 = class { this.to = node.to; return true; } - yieldBuf(index2, type) { - this.index = index2; + yieldBuf(index3, type) { + this.index = index3; let { start, buffer } = this.buffer; - this.type = type || buffer.set.types[buffer.buffer[index2]]; - this.from = start + buffer.buffer[index2 + 1]; - this.to = start + buffer.buffer[index2 + 2]; + this.type = type || buffer.set.types[buffer.buffer[index3]]; + this.from = start + buffer.buffer[index3 + 1]; + this.to = start + buffer.buffer[index3 + 2]; return true; } yield(node) { @@ -123789,11 +123846,11 @@ var TreeCursor3 = class { if (!this.buffer) return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); let { buffer } = this.buffer; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); - if (index2 < 0) + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); + if (index3 < 0) return false; this.stack.push(this.index); - return this.yieldBuf(index2); + return this.yieldBuf(index3); } firstChild() { return this.enterChild(1, 0, 4); @@ -123843,7 +123900,7 @@ var TreeCursor3 = class { return this.sibling(-1); } atLastNode(dir) { - let index2, parent, { buffer } = this; + let index3, parent, { buffer } = this; if (buffer) { if (dir > 0) { if (this.index < buffer.buffer.buffer.length) @@ -123853,13 +123910,13 @@ var TreeCursor3 = class { if (buffer.buffer.buffer[i4 + 3] < this.index) return false; } - ({ index: index2, parent } = buffer); + ({ index: index3, parent } = buffer); } else { - ({ index: index2, _parent: parent } = this._tree); + ({ index: index3, _parent: parent } = this._tree); } - for (; parent; { index: index2, _parent: parent } = parent) { - if (index2 > -1) - for (let i4 = index2 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { + for (; parent; { index: index3, _parent: parent } = parent) { + if (index3 > -1) + for (let i4 = index3 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { let child = parent._tree.children[i4]; if (this.mode & IterMode3.IncludeAnonymous || child instanceof TreeBuffer3 || !child.type.isAnonymous || hasChild3(child)) return false; @@ -123897,16 +123954,16 @@ var TreeCursor3 = class { let cache2 = this.bufferNode, result = null, depth = 0; if (cache2 && cache2.context == this.buffer) { scan: - for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) { + for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) { for (let c3 = cache2; c3; c3 = c3._parent) - if (c3.index == index2) { - if (index2 == this.index) + if (c3.index == index3) { + if (index3 == this.index) return c3; result = c3; depth = d4 + 1; break scan; } - index2 = this.stack[--d4]; + index3 = this.stack[--d4]; } } for (let i4 = depth; i4 < this.stack.length; i4++) @@ -123991,9 +124048,9 @@ function buildTree3(data2) { let startPos = start - parentStart; if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor2.pos - minPos, inRepeat))) { let data3 = new Uint16Array(buffer2.size - buffer2.skip); - let endPos = cursor2.pos - buffer2.size, index2 = data3.length; + let endPos = cursor2.pos - buffer2.size, index3 = data3.length; while (cursor2.pos > endPos) - index2 = copyToBuffer(buffer2.start, data3, index2); + index3 = copyToBuffer(buffer2.start, data3, index3); node = new TreeBuffer3(data3, end - buffer2.start, nodeSet2); startPos = buffer2.start - parentStart; } else { @@ -124104,26 +124161,26 @@ function buildTree3(data2) { } return result.size > 4 ? result : void 0; } - function copyToBuffer(bufferStart, buffer2, index2) { + function copyToBuffer(bufferStart, buffer2, index3) { let { id: id3, start, end, size: size2 } = cursor2; cursor2.next(); if (size2 >= 0 && id3 < minRepeatType) { - let startIndex = index2; + let startIndex = index3; if (size2 > 4) { let endPos = cursor2.pos - (size2 - 4); while (cursor2.pos > endPos) - index2 = copyToBuffer(bufferStart, buffer2, index2); + index3 = copyToBuffer(bufferStart, buffer2, index3); } - buffer2[--index2] = startIndex; - buffer2[--index2] = end - bufferStart; - buffer2[--index2] = start - bufferStart; - buffer2[--index2] = id3; + buffer2[--index3] = startIndex; + buffer2[--index3] = end - bufferStart; + buffer2[--index3] = start - bufferStart; + buffer2[--index3] = id3; } else if (size2 == -3) { contextHash = id3; } else if (size2 == -4) { lookAhead = id3; } - return index2; + return index3; } let children = [], positions = []; while (cursor2.pos > 0) @@ -124186,15 +124243,15 @@ var NodeWeakMap = class { constructor() { this.map = /* @__PURE__ */ new WeakMap(); } - setBuffer(buffer, index2, value) { + setBuffer(buffer, index3, value) { let inner = this.map.get(buffer); if (!inner) this.map.set(buffer, inner = /* @__PURE__ */ new Map()); - inner.set(index2, value); + inner.set(index3, value); } - getBuffer(buffer, index2) { + getBuffer(buffer, index3) { let inner = this.map.get(buffer); - return inner && inner.get(index2); + return inner && inner.get(index3); } set(node, value) { if (node instanceof BufferNode3) @@ -125412,9 +125469,9 @@ var Tree4 = class { }; Tree4.empty = new Tree4(NodeType4.none, [], [], 0); var FlatBufferCursor4 = class { - constructor(buffer, index2) { + constructor(buffer, index3) { this.buffer = buffer; - this.index = index2; + this.index = index3; } get id() { return this.buffer[this.index - 4]; @@ -125449,24 +125506,24 @@ var TreeBuffer4 = class { } toString() { let result = []; - for (let index2 = 0; index2 < this.buffer.length; ) { - result.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + for (let index3 = 0; index3 < this.buffer.length; ) { + result.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result.join(","); } - childString(index2) { - let id3 = this.buffer[index2], endIndex = this.buffer[index2 + 3]; + childString(index3) { + let id3 = this.buffer[index3], endIndex = this.buffer[index3 + 3]; let type = this.set.types[id3], result = type.name; if (/\W/.test(result) && !type.isError) result = JSON.stringify(result); - index2 += 4; - if (endIndex == index2) + index3 += 4; + if (endIndex == index3) return result; let children = []; - while (index2 < endIndex) { - children.push(this.childString(index2)); - index2 = this.buffer[index2 + 3]; + while (index3 < endIndex) { + children.push(this.childString(index3)); + index3 = this.buffer[index3 + 3]; } return result + "(" + children.join(",") + ")"; } @@ -125546,10 +125603,10 @@ function resolveNode4(node, pos, side, overlays) { } } var TreeNode5 = class { - constructor(_tree, from, index2, _parent) { + constructor(_tree, from, index3, _parent) { this._tree = _tree; this.from = from; - this.index = index2; + this.index = index3; this._parent = _parent; } get type() { @@ -125570,9 +125627,9 @@ var TreeNode5 = class { if (next instanceof TreeBuffer4) { if (mode2 & IterMode4.ExcludeBuffers) continue; - let index2 = next.findChild(0, next.buffer.length, dir, pos - start, side); - if (index2 > -1) - return new BufferNode4(new BufferContext4(parent, next, i4, start), null, index2); + let index3 = next.findChild(0, next.buffer.length, dir, pos - start, side); + if (index3 > -1) + return new BufferNode4(new BufferContext4(parent, next, i4, start), null, index3); } else if (mode2 & IterMode4.IncludeAnonymous || (!next.type.isAnonymous || hasChild4(next))) { let mounted; if (!(mode2 & IterMode4.IgnoreMounts) && next.props && (mounted = next.prop(NodeProp4.mounted)) && !mounted.overlay) @@ -125696,19 +125753,19 @@ function matchNodeContext4(node, context, i4 = context.length - 1) { return true; } var BufferContext4 = class { - constructor(parent, buffer, index2, start) { + constructor(parent, buffer, index3, start) { this.parent = parent; this.buffer = buffer; - this.index = index2; + this.index = index3; this.start = start; } }; var BufferNode4 = class { - constructor(context, _parent, index2) { + constructor(context, _parent, index3) { this.context = context; this._parent = _parent; - this.index = index2; - this.type = context.buffer.set.types[context.buffer.buffer[index2]]; + this.index = index3; + this.type = context.buffer.set.types[context.buffer.buffer[index3]]; } get name() { return this.type.name; @@ -125721,8 +125778,8 @@ var BufferNode4 = class { } child(dir, pos, side) { let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode4(this.context, this, index2); + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode4(this.context, this, index3); } get firstChild() { return this.child(1, 0, 4); @@ -125740,8 +125797,8 @@ var BufferNode4 = class { if (mode2 & IterMode4.ExcludeBuffers) return null; let { buffer } = this.context; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); - return index2 < 0 ? null : new BufferNode4(this.context, this, index2); + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); + return index3 < 0 ? null : new BufferNode4(this.context, this, index3); } get parent() { return this._parent || this.context.parent.nextSignificantParent(); @@ -125836,12 +125893,12 @@ var TreeCursor4 = class { this.to = node.to; return true; } - yieldBuf(index2, type) { - this.index = index2; + yieldBuf(index3, type) { + this.index = index3; let { start, buffer } = this.buffer; - this.type = type || buffer.set.types[buffer.buffer[index2]]; - this.from = start + buffer.buffer[index2 + 1]; - this.to = start + buffer.buffer[index2 + 2]; + this.type = type || buffer.set.types[buffer.buffer[index3]]; + this.from = start + buffer.buffer[index3 + 1]; + this.to = start + buffer.buffer[index3 + 2]; return true; } yield(node) { @@ -125861,11 +125918,11 @@ var TreeCursor4 = class { if (!this.buffer) return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); let { buffer } = this.buffer; - let index2 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); - if (index2 < 0) + let index3 = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); + if (index3 < 0) return false; this.stack.push(this.index); - return this.yieldBuf(index2); + return this.yieldBuf(index3); } firstChild() { return this.enterChild(1, 0, 4); @@ -125915,7 +125972,7 @@ var TreeCursor4 = class { return this.sibling(-1); } atLastNode(dir) { - let index2, parent, { buffer } = this; + let index3, parent, { buffer } = this; if (buffer) { if (dir > 0) { if (this.index < buffer.buffer.buffer.length) @@ -125925,13 +125982,13 @@ var TreeCursor4 = class { if (buffer.buffer.buffer[i4 + 3] < this.index) return false; } - ({ index: index2, parent } = buffer); + ({ index: index3, parent } = buffer); } else { - ({ index: index2, _parent: parent } = this._tree); + ({ index: index3, _parent: parent } = this._tree); } - for (; parent; { index: index2, _parent: parent } = parent) { - if (index2 > -1) - for (let i4 = index2 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { + for (; parent; { index: index3, _parent: parent } = parent) { + if (index3 > -1) + for (let i4 = index3 + dir, e5 = dir < 0 ? -1 : parent._tree.children.length; i4 != e5; i4 += dir) { let child = parent._tree.children[i4]; if (this.mode & IterMode4.IncludeAnonymous || child instanceof TreeBuffer4 || !child.type.isAnonymous || hasChild4(child)) return false; @@ -125969,16 +126026,16 @@ var TreeCursor4 = class { let cache2 = this.bufferNode, result = null, depth = 0; if (cache2 && cache2.context == this.buffer) { scan: - for (let index2 = this.index, d4 = this.stack.length; d4 >= 0; ) { + for (let index3 = this.index, d4 = this.stack.length; d4 >= 0; ) { for (let c3 = cache2; c3; c3 = c3._parent) - if (c3.index == index2) { - if (index2 == this.index) + if (c3.index == index3) { + if (index3 == this.index) return c3; result = c3; depth = d4 + 1; break scan; } - index2 = this.stack[--d4]; + index3 = this.stack[--d4]; } } for (let i4 = depth; i4 < this.stack.length; i4++) @@ -126063,9 +126120,9 @@ function buildTree4(data2) { let startPos = start - parentStart; if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor2.pos - minPos, inRepeat))) { let data3 = new Uint16Array(buffer2.size - buffer2.skip); - let endPos = cursor2.pos - buffer2.size, index2 = data3.length; + let endPos = cursor2.pos - buffer2.size, index3 = data3.length; while (cursor2.pos > endPos) - index2 = copyToBuffer(buffer2.start, data3, index2); + index3 = copyToBuffer(buffer2.start, data3, index3); node = new TreeBuffer4(data3, end - buffer2.start, nodeSet2); startPos = buffer2.start - parentStart; } else { @@ -126176,26 +126233,26 @@ function buildTree4(data2) { } return result.size > 4 ? result : void 0; } - function copyToBuffer(bufferStart, buffer2, index2) { + function copyToBuffer(bufferStart, buffer2, index3) { let { id: id3, start, end, size: size2 } = cursor2; cursor2.next(); if (size2 >= 0 && id3 < minRepeatType) { - let startIndex = index2; + let startIndex = index3; if (size2 > 4) { let endPos = cursor2.pos - (size2 - 4); while (cursor2.pos > endPos) - index2 = copyToBuffer(bufferStart, buffer2, index2); + index3 = copyToBuffer(bufferStart, buffer2, index3); } - buffer2[--index2] = startIndex; - buffer2[--index2] = end - bufferStart; - buffer2[--index2] = start - bufferStart; - buffer2[--index2] = id3; + buffer2[--index3] = startIndex; + buffer2[--index3] = end - bufferStart; + buffer2[--index3] = start - bufferStart; + buffer2[--index3] = id3; } else if (size2 == -3) { contextHash = id3; } else if (size2 == -4) { lookAhead = id3; } - return index2; + return index3; } let children = [], positions = []; while (cursor2.pos > 0) @@ -127948,6 +128005,7 @@ var SpaceCommand = (props) => { ...command, fields: [...command.fields, field] }); + return true; }; const deleteProperty2 = (field) => { saveCommand({ @@ -128853,7 +128911,7 @@ var import_react_dom5 = __toESM(require_react_dom()); var Suggester = (0, import_react121.forwardRef)( (props, outerRef) => { const ref2 = (0, import_react121.useRef)(null); - const [index2, setIndex] = (0, import_react121.useState)(0); + const [index3, setIndex] = (0, import_react121.useState)(0); const [isReady, setIsReady] = (0, import_react121.useState)(false); const menuRef = (0, import_react121.useRef)(null); const [pos, setPos] = (0, import_react121.useState)({ x: 0, y: 0 }); @@ -128911,7 +128969,7 @@ var Suggester = (0, import_react121.forwardRef)( } if (e5.key == "ArrowUp") { const size2 = props.suggestions.length - 1; - const newIndex = index2 < 0 ? size2 : index2 - 1; + const newIndex = index3 < 0 ? size2 : index3 - 1; if (props.suggestions[newIndex]?.disabled) { setIndex(newIndex < 0 ? size2 : newIndex - 1); } else { @@ -128921,7 +128979,7 @@ var Suggester = (0, import_react121.forwardRef)( } if (e5.key == "ArrowDown") { const size2 = props.suggestions.length - 1; - const newIndex = index2 >= size2 ? 0 : index2 + 1; + const newIndex = index3 >= size2 ? 0 : index3 + 1; if (props.suggestions[newIndex]?.disabled) { setIndex(newIndex >= size2 ? 0 : newIndex + 1); } else { @@ -128930,7 +128988,7 @@ var Suggester = (0, import_react121.forwardRef)( e5.preventDefault(); } if (e5.key == "Enter") { - props.onSelect(props.suggestions[index2]); + props.onSelect(props.suggestions[index3]); e5.preventDefault(); } }; @@ -129005,7 +129063,7 @@ var Suggester = (0, import_react121.forwardRef)( id: "", onHide: () => null, classNames: CLASS_NAMES2, - index: index2, + index: index3, setIndex, allowNew: false, ui: props.superstate.ui, @@ -130021,8 +130079,8 @@ var findClosestSnap = function(n3, snapArray, snapGap) { if (snapGap === void 0) { snapGap = 0; } - var closestGapIndex = snapArray.reduce(function(prev, curr, index2) { - return Math.abs(curr - n3) < Math.abs(snapArray[prev] - n3) ? index2 : prev; + var closestGapIndex = snapArray.reduce(function(prev, curr, index3) { + return Math.abs(curr - n3) < Math.abs(snapArray[prev] - n3) ? index3 : prev; }, 0); var gap = Math.abs(snapArray[closestGapIndex] - n3); return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n3; @@ -131754,10 +131812,10 @@ var FrameEditorInstance = (props) => { if (node) { const parent = findParent(instance.exec, node.id); if (parent) { - const index2 = parent.children.find((f2) => f2.id == node.id).node.rank; - if (index2 > 0) { + const index3 = parent.children.find((f2) => f2.id == node.id).node.rank; + if (index3 > 0) { select( - parent.children.find((f2) => f2.node.rank == index2 - 1)?.id + parent.children.find((f2) => f2.node.rank == index3 - 1)?.id ); } } @@ -131770,10 +131828,10 @@ var FrameEditorInstance = (props) => { if (node) { const parent = findParent(instance.exec, node.id); if (parent) { - const index2 = parent.children.find((f2) => f2.id == node.id).node.rank; - if (index2 < parent.children.length - 1) { + const index3 = parent.children.find((f2) => f2.id == node.id).node.rank; + if (index3 < parent.children.length - 1) { select( - parent.children.find((f2) => f2.node.rank == index2 + 1)?.id + parent.children.find((f2) => f2.node.rank == index3 + 1)?.id ); } } @@ -132496,17 +132554,26 @@ var Backlinks = (props) => { var import_react143 = __toESM(require_react()); // src/core/react/components/SpaceView/TitleComponent.tsx +var import_classnames9 = __toESM(require_classnames()); var import_react141 = __toESM(require_react()); var TitleComponent = (props) => { const { pathState } = (0, import_react141.useContext)(PathContext); const { spaceState } = (0, import_react141.useContext)(SpaceContext); + const aliases = pathState?.metadata.property?.aliases ?? []; const [aliasMode, setAliasMode] = (0, import_react141.useState)( - pathState.metadata.property?.alias?.length > 0 + props.superstate.settings.spacesUseAlias && aliases?.[0]?.length > 0 ); const name319 = (0, import_react141.useMemo)( - () => pathState ? props.superstate.settings.spacesUseAlias ? pathState?.label.name : pathState.subtype == "tag" ? stringFromTag(pathState?.name) : pathState?.name : null, - [pathState] + () => pathState ? aliasMode ? aliases?.[0] : pathState.subtype == "tag" ? stringFromTag(pathState?.name) : pathState?.name : null, + [pathState, aliasMode] ); + (0, import_react141.useEffect)(() => { + if (props.superstate.settings.spacesUseAlias && aliases?.[0]?.length > 0) { + setAliasMode(true); + } else { + setAliasMode(false); + } + }, [pathState]); const ref2 = (0, import_react141.useRef)(null); const contentEditable = !props.readOnly && spaceState?.type != "default"; const onBlur = (e5) => { @@ -132518,11 +132585,11 @@ var TitleComponent = (props) => { props.superstate.reloadSpaceByPath("/"); return; } - if (props.superstate.settings.spacesUseAlias || aliasMode) { + if (aliasMode) { updatePrimaryAlias( props.superstate, pathState.path, - pathState.metadata.aliases, + pathState.metadata?.property?.aliases, newValue ); } else { @@ -132625,6 +132692,13 @@ var TitleComponent = (props) => { dangerouslySetInnerHTML: { __html: name319 } + }), /* @__PURE__ */ import_react141.default.createElement("button", { + className: (0, import_classnames9.default)("mk-title-alias", aliasMode && "mk-active"), + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker("ui//alias") + }, + "aria-label": i18n_default.buttons.alias, + onClick: () => setAliasMode(!aliasMode) }))); }; @@ -132880,8 +132954,8 @@ var NavigatorContext = (0, import_react144.createContext)({ setSelectedPaths: import_lodash19.default.noop, activePath: null, setActivePath: import_lodash19.default.noop, - activeArea: 0, - setActiveArea: import_lodash19.default.noop, + activeFocus: 0, + setActiveFocus: import_lodash19.default.noop, activeViewSpaces: [], waypoints: [], setWaypoints: import_lodash19.default.noop, @@ -132889,57 +132963,57 @@ var NavigatorContext = (0, import_react144.createContext)({ closeActiveSpace: import_lodash19.default.noop, modifier: null, setModifier: import_lodash19.default.noop, - editArea: false, - setEditArea: import_lodash19.default.noop + editFocus: false, + setEditFocus: import_lodash19.default.noop }); var SidebarProvider = (props) => { const [modifier, setModifier] = (0, import_react144.useState)(null); const [dragPaths, setDragPaths] = (0, import_react144.useState)([]); const [selectedPaths, setSelectedPaths] = (0, import_react144.useState)([]); const [activePath, setActivePath] = (0, import_react144.useState)(null); - const [editArea, setEditArea] = (0, import_react144.useState)(false); + const [editFocus, setEditFocus] = (0, import_react144.useState)(false); const [waypoints, setWaypoints] = (0, import_react144.useState)( props.superstate.waypoints ); - const [activeArea, setActiveArea] = (0, import_react144.useState)( + const [activeFocus, setActiveFocus] = (0, import_react144.useState)( props.superstate.settings.currentWaypoint ); const [activeViewSpaces, setActiveViewSpaces] = (0, import_react144.useState)( - (props.superstate.waypoints[activeArea]?.paths ?? []).map((f2) => props.superstate.pathsIndex.get(f2)).filter((f2) => f2) + (props.superstate.waypoints[activeFocus]?.paths ?? []).map((f2) => props.superstate.pathsIndex.get(f2)).filter((f2) => f2) ); const setActiveViewSpaceByPath = (path2) => { - const newWaypoint = props.superstate.waypoints[activeArea] ?? { + const newWaypoint = props.superstate.waypoints[activeFocus] ?? { sticker: "", name: "Waypoint", paths: [] }; newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path2), path2]; - if (activeArea > props.superstate.waypoints.length) { + if (activeFocus > props.superstate.waypoints.length) { props.superstate.spaceManager.saveWaypoints([ ...props.superstate.waypoints, newWaypoint ]); } const newWaypoints = props.superstate.waypoints.map( - (f2, i4) => i4 == activeArea ? newWaypoint : f2 + (f2, i4) => i4 == activeFocus ? newWaypoint : f2 ); props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2)); }; const closeActiveViewSpace = (path2) => { - const newWaypoint = props.superstate.waypoints[activeArea] ?? { + const newWaypoint = props.superstate.waypoints[activeFocus] ?? { sticker: "", name: "Waypoint", paths: [] }; newWaypoint.paths = [...newWaypoint.paths.filter((f2) => f2 != path2)]; - if (activeArea > props.superstate.waypoints.length) { + if (activeFocus > props.superstate.waypoints.length) { props.superstate.spaceManager.saveWaypoints([ ...props.superstate.waypoints, newWaypoint ]); } const newWaypoints = props.superstate.waypoints.map( - (f2, i4) => i4 == activeArea ? newWaypoint : f2 + (f2, i4) => i4 == activeFocus ? newWaypoint : f2 ); props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f2) => f2)); }; @@ -132949,16 +133023,16 @@ var SidebarProvider = (props) => { const refreshSpaces = (payload) => { if (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths?.includes(payload.path)) { setActiveViewSpaces( - (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.pathsIndex.get(f2)) + (props.superstate.waypoints[props.superstate.settings.currentWaypoint]?.paths ?? []).map((f2) => props.superstate.pathsIndex.get(f2)).filter((f2) => f2) ); } }; const reloadPaths = () => { setWaypoints(props.superstate.waypoints); - const _activeArea = props.superstate.settings.currentWaypoint; - setActiveArea(_activeArea); + const _activeFocus = props.superstate.settings.currentWaypoint; + setActiveFocus(_activeFocus); setActiveViewSpaces( - (props.superstate.waypoints[_activeArea]?.paths ?? []).map((f2) => props.superstate.pathsIndex.get(f2)).filter((f2) => f2) + (props.superstate.waypoints[_activeFocus]?.paths ?? []).map((f2) => props.superstate.pathsIndex.get(f2)).filter((f2) => f2) ); }; (0, import_react144.useEffect)(() => { @@ -132993,11 +133067,11 @@ var SidebarProvider = (props) => { value: { dragPaths, setDragPaths, - activeArea, + activeFocus, selectedPaths, setSelectedPaths, activePath, - setActiveArea, + setActiveFocus, setActivePath, activeViewSpaces, waypoints, @@ -133006,8 +133080,8 @@ var SidebarProvider = (props) => { closeActiveSpace: closeActiveViewSpace, modifier, setModifier, - editArea, - setEditArea + editFocus, + setEditFocus } }, props.children); }; @@ -133117,53 +133191,53 @@ var normalizedAltName = () => window.navigator.platform.startsWith("Mac") ? "\u2 // src/core/react/components/Navigator/SpaceTree/SpaceTreeView.tsx var import_react149 = __toESM(require_react()); -// src/core/react/components/Navigator/SpaceTree/SpaceTreeAreaEditor.tsx -var import_classnames9 = __toESM(require_classnames()); +// src/core/react/components/Navigator/SpaceTree/NavigatorFocusEditor.tsx +var import_classnames10 = __toESM(require_classnames()); var import_react145 = __toESM(require_react()); -var SpaceAreaEditor = (props) => { +var FocusEditor = (props) => { const { saveActiveSpace, - editArea, - activeArea, + editFocus, + activeFocus, setWaypoints, waypoints, - setEditArea + setEditFocus } = (0, import_react145.useContext)(NavigatorContext); - const [area, setArea] = (0, import_react145.useState)(props.area); + const [focus, setFocus] = (0, import_react145.useState)(props.focus); (0, import_react145.useEffect)(() => { - setArea(props.area); - }, [props.area]); - return area && props.area ? props.area.name?.length == 0 || editArea ? /* @__PURE__ */ import_react145.default.createElement("div", { - className: "mk-path-tree-area" + setFocus(props.focus); + }, [props.focus]); + return focus && props.focus ? props.focus.name?.length == 0 || editFocus ? /* @__PURE__ */ import_react145.default.createElement("div", { + className: "mk-path-tree-focus" }, /* @__PURE__ */ import_react145.default.createElement("div", { - className: (0, import_classnames9.default)("mk-waypoints-item"), + className: (0, import_classnames10.default)("mk-waypoints-item"), dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker(area.sticker) + __html: props.superstate.ui.getSticker(focus.sticker) }, onClick: (e5) => props.superstate.ui.openPalette( (_props) => /* @__PURE__ */ import_react145.default.createElement(StickerModal_default, { ui: props.superstate.ui, hide: _props.hide, selectedSticker: (emoji) => { - setArea({ ...area, sticker: emoji }); + setFocus({ ...focus, sticker: emoji }); } }), windowFromDocument(e5.view.document) ) }), /* @__PURE__ */ import_react145.default.createElement("input", { - value: area.name, - onChange: (e5) => setArea({ ...area, name: e5.target.value }) + value: focus.name, + onChange: (e5) => setFocus({ ...focus, name: e5.target.value }) }), /* @__PURE__ */ import_react145.default.createElement("div", { className: "mk-button-group" }, /* @__PURE__ */ import_react145.default.createElement("button", { - onClick: () => props.saveArea(area) + onClick: () => props.saveFocus(focus) }, i18n_default.buttons.save), /* @__PURE__ */ import_react145.default.createElement("button", { onClick: () => { - if (props.area.name.length == 0) { - setWaypoints(waypoints.filter((f2, i4) => i4 != activeArea)); + if (props.focus.name.length == 0) { + setWaypoints(waypoints.filter((f2, i4) => i4 != activeFocus)); props.superstate.saveSettings(); } else { - setEditArea(false); + setEditFocus(false); } } }, i18n_default.buttons.cancel))) : /* @__PURE__ */ import_react145.default.createElement("div", { @@ -133198,7 +133272,7 @@ var SpaceAreaEditor = (props) => { }; // src/core/react/components/Navigator/SpaceTree/SpaceTreeItem.tsx -var import_classnames10 = __toESM(require_classnames()); +var import_classnames11 = __toESM(require_classnames()); var import_react147 = __toESM(require_react()); // node_modules/react-dropzone/dist/es/index.js @@ -133234,7 +133308,7 @@ function __awaiter(thisArg, _arguments, P3, generator) { }); } function __generator(thisArg, body) { - var _15 = { label: 0, sent: function() { + var _16 = { label: 0, sent: function() { if (t7[0] & 1) throw t7[1]; return t7[1]; @@ -133250,7 +133324,7 @@ function __generator(thisArg, body) { function step(op) { if (f2) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_15 = 0)), _15) + while (g && (g = 0, op[0] && (_16 = 0)), _16) try { if (f2 = 1, y3 && (t7 = op[0] & 2 ? y3["return"] : op[0] ? y3["throw"] || ((t7 = y3["return"]) && t7.call(y3), 0) : y3.next) && !(t7 = t7.call(y3, op[1])).done) return t7; @@ -133262,42 +133336,42 @@ function __generator(thisArg, body) { t7 = op; break; case 4: - _15.label++; + _16.label++; return { value: op[1], done: false }; case 5: - _15.label++; + _16.label++; y3 = op[1]; op = [0]; continue; case 7: - op = _15.ops.pop(); - _15.trys.pop(); + op = _16.ops.pop(); + _16.trys.pop(); continue; default: - if (!(t7 = _15.trys, t7 = t7.length > 0 && t7[t7.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _15 = 0; + if (!(t7 = _16.trys, t7 = t7.length > 0 && t7[t7.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _16 = 0; continue; } if (op[0] === 3 && (!t7 || op[1] > t7[0] && op[1] < t7[3])) { - _15.label = op[1]; + _16.label = op[1]; break; } - if (op[0] === 6 && _15.label < t7[1]) { - _15.label = t7[1]; + if (op[0] === 6 && _16.label < t7[1]) { + _16.label = t7[1]; t7 = op; break; } - if (t7 && _15.label < t7[2]) { - _15.label = t7[2]; - _15.ops.push(op); + if (t7 && _16.label < t7[2]) { + _16.label = t7[2]; + _16.ops.push(op); break; } if (t7[2]) - _15.ops.pop(); - _15.trys.pop(); + _16.ops.pop(); + _16.trys.pop(); continue; } - op = body.call(thisArg, _15); + op = body.call(thisArg, _16); } catch (e5) { op = [6, e5]; y3 = 0; @@ -134538,6 +134612,7 @@ var TreeItem = (props) => { const [pathState, setPathState] = (0, import_react147.useState)( superstate.pathsIndex.get(data2.item.path) ); + const pinType = pathState.linkedSpaces?.some((f2) => f2 == data2.space) ? 1 /* Linked */ : pathState.liveSpaces?.some((f2) => f2 == data2.space) ? 2 /* Live */ : 0 /* Default */; (0, import_react147.useEffect)( () => setPathState(superstate.pathsIndex.get(data2.item.path)), [data2.item.path] @@ -134718,10 +134793,9 @@ var TreeItem = (props) => { const isSpace = pathState?.type == "space"; const isFolder = pathState?.metadata?.isFolder || isSpace; const extension = pathState?.metadata?.file?.extension; - const isLink = pathState?.parent != data2.space; const spacing = data2.type == "group" ? 0 : indentationWidth * (depth - 1) + (data2.type == "space" ? 0 : isTouchScreen(props.superstate.ui) ? 30 : 20); return /* @__PURE__ */ import_react147.default.createElement(import_react147.default.Fragment, null, /* @__PURE__ */ import_react147.default.createElement("div", { - className: (0, import_classnames10.default)( + className: (0, import_classnames11.default)( "mk-tree-wrapper", data2.type == "group" ? "mk-tree-section" : "", clone5 && "mk-clone", @@ -134745,7 +134819,7 @@ var TreeItem = (props) => { ...dropProps, ...innerProps }, /* @__PURE__ */ import_react147.default.createElement("div", { - className: (0, import_classnames10.default)(isFolder ? "nav-folder" : "nav-file"), + className: (0, import_classnames11.default)(isFolder ? "nav-folder" : "nav-file"), style: { ...style, ...dragActive ? { pointerEvents: "none" } : {} @@ -134754,7 +134828,7 @@ var TreeItem = (props) => { }, /* @__PURE__ */ import_react147.default.createElement("input", { ...getInputProps() }), /* @__PURE__ */ import_react147.default.createElement("div", { - className: (0, import_classnames10.default)( + className: (0, import_classnames11.default)( "mk-tree-item", "tree-item-self", isFolder ? "nav-folder-title" : "nav-file-title", @@ -134764,7 +134838,11 @@ var TreeItem = (props) => { ), style: { "--spacing": `${spacing}px`, - "--childrenCount": `${data2.type == "space" && !collapsed ? childCount * spaceRowHeight(superstate, false) - 13 : 0}px` + "--childrenCount": `${data2.type == "space" && !collapsed ? childCount * spaceRowHeight( + superstate, + superstate.settings.spaceRowHeight, + false + ) - 13 : 0}px` }, "data-path": pathState?.path }, data2.type == "space" && /* @__PURE__ */ import_react147.default.createElement(CollapseToggle, { @@ -134793,7 +134871,14 @@ var TreeItem = (props) => { className: "nav-file-tag" }, extension), !clone5 && !pathState?.readOnly ? /* @__PURE__ */ import_react147.default.createElement("div", { className: "mk-folder-buttons" - }, /* @__PURE__ */ import_react147.default.createElement("button", { + }, pinType != 0 /* Default */ && /* @__PURE__ */ import_react147.default.createElement("div", { + "aria-label": pinType == 1 /* Linked */ ? i18n_default.labels.pinned : i18n_default.labels.live, + dangerouslySetInnerHTML: { + __html: superstate.ui.getSticker( + pinType == 1 /* Linked */ ? "ui//pin" : "ui//live" + ) + } + }), /* @__PURE__ */ import_react147.default.createElement("button", { "aria-label": i18n_default.buttons.moreOptions, onClick: (e5) => { contextMenu(e5); @@ -134829,7 +134914,7 @@ function memo4(getDeps, fn, opts) { if (opts.key && ((_a4 = opts.debug) == null ? void 0 : _a4.call(opts))) depTime = Date.now(); const newDeps = getDeps(); - const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep); + const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index3) => deps[index3] !== dep); if (!depsChanged) { return result; } @@ -134875,7 +134960,7 @@ function notUndefined(value, msg) { var approxEqual = (a4, b2) => Math.abs(a4 - b2) < 1; // node_modules/@tanstack/virtual-core/dist/esm/index.js -var defaultKeyExtractor = (index2) => index2; +var defaultKeyExtractor = (index3) => index3; var defaultRangeExtractor = (range2) => { const start = Math.max(range2.startIndex - range2.overscan, 0); const end = Math.min(range2.endIndex + range2.overscan, range2.count - 1); @@ -135129,10 +135214,10 @@ var Virtualizer = class { key: false } ); - this.getFurthestMeasurement = (measurements, index2) => { + this.getFurthestMeasurement = (measurements, index3) => { const furthestMeasurementsFound = /* @__PURE__ */ new Map(); const furthestMeasurements = /* @__PURE__ */ new Map(); - for (let m4 = index2 - 1; m4 >= 0; m4--) { + for (let m4 = index3 - 1; m4 >= 0; m4--) { const measurement = measurements[m4]; if (furthestMeasurementsFound.has(measurement.lane)) { continue; @@ -135299,7 +135384,7 @@ var Virtualizer = class { measurements[findNearestBinarySearch( 0, measurements.length - 1, - (index2) => notUndefined(measurements[index2]).start, + (index3) => notUndefined(measurements[index3]).start, offset2 )] ); @@ -135327,9 +135412,9 @@ var Virtualizer = class { const maxOffset = scrollSize - this.getSize(); return Math.max(Math.min(maxOffset, toOffset), 0); }; - this.getOffsetForIndex = (index2, align = "auto") => { - index2 = Math.max(0, Math.min(index2, this.options.count - 1)); - const measurement = notUndefined(this.getMeasurements()[index2]); + this.getOffsetForIndex = (index3, align = "auto") => { + index3 = Math.max(0, Math.min(index3, this.options.count - 1)); + const measurement = notUndefined(this.getMeasurements()[index3]); if (align === "auto") { if (measurement.end >= this.scrollOffset + this.getSize() - this.options.scrollPaddingEnd) { align = "end"; @@ -135361,29 +135446,29 @@ var Virtualizer = class { behavior }); }; - this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => { - index2 = Math.max(0, Math.min(index2, this.options.count - 1)); + this.scrollToIndex = (index3, { align: initialAlign = "auto", behavior } = {}) => { + index3 = Math.max(0, Math.min(index3, this.options.count - 1)); this.cancelScrollToIndex(); if (behavior === "smooth" && this.isDynamicMode()) { console.warn( "The `smooth` scroll behavior is not fully supported with dynamic size." ); } - const [toOffset, align] = this.getOffsetForIndex(index2, initialAlign); + const [toOffset, align] = this.getOffsetForIndex(index3, initialAlign); this._scrollToOffset(toOffset, { adjustments: void 0, behavior }); if (behavior !== "smooth" && this.isDynamicMode()) { this.scrollToIndexTimeoutId = setTimeout(() => { this.scrollToIndexTimeoutId = null; const elementInDOM = this.measureElementCache.has( - this.options.getItemKey(index2) + this.options.getItemKey(index3) ); if (elementInDOM) { - const [toOffset2] = this.getOffsetForIndex(index2, align); + const [toOffset2] = this.getOffsetForIndex(index3, align); if (!approxEqual(toOffset2, this.scrollOffset)) { - this.scrollToIndex(index2, { align, behavior }); + this.scrollToIndex(index3, { align, behavior }); } } else { - this.scrollToIndex(index2, { align, behavior }); + this.scrollToIndex(index3, { align, behavior }); } }); } @@ -135457,7 +135542,7 @@ function calculateRange({ scrollOffset }) { const count3 = measurements.length - 1; - const getOffset = (index2) => measurements[index2].start; + const getOffset = (index3) => measurements[index3].start; const startIndex = findNearestBinarySearch(0, count3, getOffset, scrollOffset); let endIndex = startIndex; while (endIndex < count3 && measurements[endIndex].end < scrollOffset + outerSize) { @@ -135525,33 +135610,33 @@ var VirtualizedList = import_react148.default.memo(function VirtualizedList2(pro count: flattenedTree.length, paddingEnd: 24, getScrollElement: () => parentRef.current, - estimateSize: import_react148.default.useCallback((index2) => rowHeights[index2], [rowHeights]), + estimateSize: import_react148.default.useCallback((index3) => rowHeights[index3], [rowHeights]), overscan: 0 }); vRef.current = rowVirtualizer; const { saveActiveSpace } = (0, import_react148.useContext)(NavigatorContext); - const dropIndicator = (index2) => { - return overIndex == index2 && projected && projected.insert; + const dropIndicator = (index3) => { + return overIndex == index3 && projected && projected.insert; }; - const highlighted = (index2) => { - if (!projected || !flattenedTree[index2] || !projected?.droppable) + const highlighted = (index3) => { + if (!projected || !flattenedTree[index3] || !projected?.droppable) return false; - return !projected.sortable && !projected.insert && flattenedTree[index2].parentId && flattenedTree[index2].parentId.startsWith(projected.parentId) || flattenedTree[index2].id == projected.parentId; + return !projected.sortable && !projected.insert && flattenedTree[index3].parentId && flattenedTree[index3].parentId.startsWith(projected.parentId) || flattenedTree[index3].id == projected.parentId; }; const heightBetweenIndex = (start, end) => { if (start > end) return rowHeights.slice(end, start).reduce((p, c3) => p + c3, 0); return -rowHeights.slice(start, end).reduce((p, c3) => p + c3, 0); }; - const calcYOffset = (index2) => { + const calcYOffset = (index3) => { if (!projected) return 0; if (projected.insert) { if (projected.copy && !projected.reorder) return 0; - if (index2 > activeIndex) { - return -rowHeights[index2]; - } else if (index2 == activeIndex) { + if (index3 > activeIndex) { + return -rowHeights[index3]; + } else if (index3 == activeIndex) { return heightBetweenIndex(overIndex, activeIndex); } else { return 0; @@ -135559,20 +135644,20 @@ var VirtualizedList = import_react148.default.memo(function VirtualizedList2(pro } else if (projected.sortable) { const targetIndex = overIndex < activeIndex ? overIndex : overIndex; if (projected.copy && !projected.reorder) { - if (index2 == activeIndex) { + if (index3 == activeIndex) { return heightBetweenIndex(targetIndex, activeIndex); - } else if (index2 >= targetIndex) { - return rowHeights[index2]; + } else if (index3 >= targetIndex) { + return rowHeights[index3]; } else { return 0; } } - if (index2 == activeIndex) { + if (index3 == activeIndex) { return heightBetweenIndex(targetIndex, activeIndex); - } else if (index2 > activeIndex && index2 <= targetIndex) { - return -rowHeights[index2]; - } else if (index2 < activeIndex && index2 >= targetIndex) { - return rowHeights[index2]; + } else if (index3 > activeIndex && index3 <= targetIndex) { + return -rowHeights[index3]; + } else if (index3 < activeIndex && index3 >= targetIndex) { + return rowHeights[index3]; } else { return 0; } @@ -135583,8 +135668,7 @@ var VirtualizedList = import_react148.default.memo(function VirtualizedList2(pro style: { width: `100%`, height: `100%`, - overflow: "auto", - "--spaceRowHeight": spaceRowHeight(superstate, false) + "px" + overflow: "auto" } }, /* @__PURE__ */ import_react148.default.createElement("div", { style: { @@ -135858,20 +135942,23 @@ var SpaceTreeComponent = (props) => { setActivePath, selectedPaths, setSelectedPaths, - activeArea, + activeFocus, waypoints, setWaypoints, dragPaths, setDragPaths, modifier, setModifier, - editArea, - setEditArea + editFocus, + setEditFocus } = (0, import_react149.useContext)(NavigatorContext); const [active, setActive2] = (0, import_react149.useState)(null); const [overId, setOverId] = (0, import_react149.useState)(null); const [flattenedTree, setFlattenedTree] = (0, import_react149.useState)([]); const nextTreeScrollPath = (0, import_react149.useRef)(null); + const [presetRowHeight, setPresetRowHeight] = (0, import_react149.useState)( + props.superstate.settings.spaceRowHeight + ); const [offset2, setOffset] = (0, import_react149.useState)({ x: 0, y: 0 }); const listRef = (0, import_react149.useRef)(null); const refreshableSpaces = (0, import_react149.useMemo)( @@ -135908,6 +135995,7 @@ var SpaceTreeComponent = (props) => { (0, import_react149.useEffect)(() => { const settingsChanged = () => { setExpandedSpaces(superstate.settings.expandedSpaces); + setPresetRowHeight(superstate.settings.spaceRowHeight); }; superstate.eventsDispatcher.addListener("settingsChanged", settingsChanged); return () => { @@ -135916,23 +136004,32 @@ var SpaceTreeComponent = (props) => { settingsChanged ); }; - }, [activeViewSpaces, active, setExpandedSpaces, setFlattenedTree]); + }, []); const revealPath = (0, import_react149.useCallback)( (path2) => { - if (!path2 || !activeViewSpaces?.some((f2) => f2.path == "/")) + const parentSpaces = activeViewSpaces?.filter( + (f2) => path2.startsWith(f2?.path) || f2?.path == "/" + ) ?? []; + if (!path2 || parentSpaces.length == 0) return; - const folders = path2.split("/"); - const openPaths = folders.reduce( - (p, c3, index2) => [ - ...p, - index2 == 0 ? "//" + c3 : p[index2] + "/" + folders.slice(0, index2 + 1).join("/") - ], - ["/"] - ).slice(0, -1); - const newOpenFolders = [ - ...expandedSpaces.filter((f2) => !openPaths.find((g) => g == f2)) ?? [], - ...openPaths - ]; + let newOpenFolders = expandedSpaces; + parentSpaces.forEach((space2) => { + const folders = path2.split("/"); + const pathLevel = space2.path.split("/").filter((f2) => f2.length > 0).length; + const openPaths = folders.reduce( + (p, c3, index3) => [ + ...p, + ...index3 < pathLevel ? [] : [ + index3 == 0 ? "//" + c3 : p[index3] + "/" + folders.slice(0, index3 + 1).join("/") + ] + ], + [space2.path] + ).slice(0, -1); + newOpenFolders = [ + ...newOpenFolders.filter((f2) => !openPaths.find((g) => g == f2)) ?? [], + ...openPaths + ]; + }); superstate.settings.expandedSpaces = newOpenFolders; nextTreeScrollPath.current = "/" + path2; superstate.saveSettings(); @@ -136154,7 +136251,9 @@ var SpaceTreeComponent = (props) => { } }; const rowHeights = (0, import_react149.useMemo)( - () => flattenedTree.map((f2) => spaceRowHeight(superstate, f2.type == "group")), + () => flattenedTree.map( + (f2) => spaceRowHeight(superstate, presetRowHeight, f2.type == "group") + ), [flattenedTree] ); return /* @__PURE__ */ import_react149.default.createElement("div", { @@ -136162,6 +136261,10 @@ var SpaceTreeComponent = (props) => { onDragEnter: () => dragEnter(), onDragLeave: () => dragLeave(), onDragOver: (e5) => e5.preventDefault(), + style: { + "--spaceRowHeight": spaceRowHeight(superstate, presetRowHeight, false) + "px", + "--spaceSectionHeight": spaceRowHeight(superstate, presetRowHeight, true) + "px" + }, onDrop: (e5) => { if (overId) { dragEnded(e5, overId); @@ -136169,14 +136272,14 @@ var SpaceTreeComponent = (props) => { resetState(); } } - }, flattenedTree.length == 1 || editArea ? /* @__PURE__ */ import_react149.default.createElement(SpaceAreaEditor, { + }, flattenedTree.length == 1 || editFocus ? /* @__PURE__ */ import_react149.default.createElement(FocusEditor, { superstate, - area: waypoints[activeArea], - saveArea: (area) => { - setEditArea(false); + focus: waypoints[activeFocus], + saveFocus: (focus) => { + setEditFocus(false); setWaypoints( waypoints.map((f2, i4) => { - return i4 == activeArea ? area : f2; + return i4 == activeFocus ? focus : f2; }) ); } @@ -136219,7 +136322,7 @@ var import_react153 = __toESM(require_react()); var import_react_error_boundary_cjs = __toESM(require_react_error_boundary_cjs(), 1); // src/core/react/components/Navigator/MainMenu.tsx -var import_classnames11 = __toESM(require_classnames()); +var import_classnames12 = __toESM(require_classnames()); var import_react150 = __toESM(require_react()); var MainMenu = (props) => { const { superstate } = props; @@ -136230,7 +136333,7 @@ var MainMenu = (props) => { }, /* @__PURE__ */ import_react150.default.createElement("div", { className: "mk-main-menu-inner" }, /* @__PURE__ */ import_react150.default.createElement("div", { - className: (0, import_classnames11.default)("mk-main-menu") + className: (0, import_classnames12.default)("mk-main-menu") }, /* @__PURE__ */ import_react150.default.createElement("div", { className: `mk-main-menu-button mk-main-menu-button-primary`, ref: ref2, @@ -136272,15 +136375,15 @@ var import_react152 = __toESM(require_react()); var import_react_dom9 = __toESM(require_react_dom()); // src/core/react/components/Navigator/Waypoints/Waypoint.tsx -var import_classnames12 = __toESM(require_classnames()); +var import_classnames13 = __toESM(require_classnames()); var import_react151 = __toESM(require_react()); var SortablePinnedSpaceItem = ({ id: id3, - index: index2, + index: index3, ...props }) => { return /* @__PURE__ */ import_react151.default.createElement(PinnedSpace, { - index: index2, + index: index3, ...props }); }; @@ -136296,19 +136399,19 @@ var PinnedSpace = (0, import_react151.forwardRef)( dragStart, dragOver, dragEnded, - index: index2 + index: index3 }, ref2) => { const innerRef = (0, import_react151.useRef)(null); const { activePath, waypoints, - setEditArea, + setEditFocus, setWaypoints, setModifier } = (0, import_react151.useContext)(NavigatorContext); const onDragStarted = (e5) => { if (dragStart && pin) { - dragStart(index2); + dragStart(index3); } }; const onDragEnded = (e5) => { @@ -136326,10 +136429,10 @@ var PinnedSpace = (0, import_react151.forwardRef)( onContextMenu: (e5) => { const menuOptions = [ { - name: "Edit Area", + name: "Edit Focus", icon: "ui//edit", onClick: (e6) => { - setEditArea(true); + setEditFocus(true); } }, { @@ -136337,7 +136440,7 @@ var PinnedSpace = (0, import_react151.forwardRef)( icon: "ui//close", value: "close", onClick: () => { - setWaypoints(waypoints.filter((f2, i4) => i4 != index2)); + setWaypoints(waypoints.filter((f2, i4) => i4 != index3)); superstate.saveSettings(); } } @@ -136351,7 +136454,7 @@ var PinnedSpace = (0, import_react151.forwardRef)( ref: innerRef, className: "mk-waypoint", onClick: (e5) => { - superstate.settings.currentWaypoint = index2; + superstate.settings.currentWaypoint = index3; superstate.saveSettings(); }, onDragOver: (e5) => { @@ -136362,17 +136465,17 @@ var PinnedSpace = (0, import_react151.forwardRef)( const rect = innerRef.current.getBoundingClientRect(); const x2 = e5.clientX - rect.left; if (dragOver && pin) - dragOver(index2, x2); + dragOver(index3, x2); }, ...innerProps }, /* @__PURE__ */ import_react151.default.createElement("div", { ref: ref2, "aria-label": pin.name, - className: (0, import_classnames12.default)( + className: (0, import_classnames13.default)( "mk-waypoints-item", "clickable-icon", "nav-action-button", - (superstate.settings.currentWaypoint == index2 || highlighted) && "mk-active", + (superstate.settings.currentWaypoint == index3 || highlighted) && "mk-active", indicator && "mk-indicator", clone5 && "mk-clone", ghost && "mk-ghost" @@ -136395,7 +136498,7 @@ var PinnedSpace = (0, import_react151.forwardRef)( ]); superstate.saveSettings(); }, - className: (0, import_classnames12.default)( + className: (0, import_classnames13.default)( "mk-waypoints-item", "clickable-icon", "nav-action-button", @@ -136549,21 +136652,21 @@ var SpaceSwitcher = (props) => { }; }); const width = isTouchScreen(props.superstate.ui) ? 48 : 32; - const calcXOffset = (index2) => { + const calcXOffset = (index3) => { if (!projected || projected.insert) return 0; const fromIndex = activeId; const targetIndex = overId; if (activeId === null) { - if (index2 >= targetIndex) + if (index3 >= targetIndex) return width; return 0; } - if (index2 == fromIndex) { + if (index3 == fromIndex) { return width * (targetIndex - fromIndex); - } else if (index2 > fromIndex && index2 <= targetIndex) { + } else if (index3 > fromIndex && index3 <= targetIndex) { return -width; - } else if (index2 < fromIndex && index2 >= targetIndex) { + } else if (index3 < fromIndex && index3 >= targetIndex) { return width; } else { return 0; @@ -137018,1058 +137121,1372 @@ var FlowEditorHover = (props) => { }) : /* @__PURE__ */ import_react158.default.createElement(import_react158.default.Fragment, null)); }; -// src/adapters/obsidian/ui/editors/FlowEditor.tsx +// src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx var import_obsidian = require("obsidian"); -var popovers = /* @__PURE__ */ new WeakMap(); -var mouseCoords = { x: 0, y: 0 }; -function nosuper(base2) { - const derived = function() { - return Object.setPrototypeOf(new import_obsidian.Component(), new.target.prototype); - }; - derived.prototype = base2.prototype; - return Object.setPrototypeOf(derived, base2); -} -var FlowEditor = class extends nosuper(import_obsidian.HoverPopover) { - constructor(parent, targetEl, plugin, waitTime, onShowCallback) { - super(); - this.targetEl = targetEl; - this.plugin = plugin; - this.onShowCallback = onShowCallback; - this.abortController = this.addChild(new import_obsidian.Component()); - this.detaching = false; - this.opening = false; - this.rootSplit = new import_obsidian.WorkspaceSplit( - this.plugin.app.workspace, - "vertical" - ); - this.targetRect = this.targetEl?.getBoundingClientRect(); - this.oldPopover = this.parent?.flowEditor; - this.document = this.targetEl?.ownerDocument ?? window.activeDocument ?? window.document; - this.id = genId(); - this.hoverEl = this.document.defaultView.createDiv({ - cls: "mk-floweditor mk-hover-popover", - attr: { id: "he" + this.id } - }); - if (waitTime === void 0) { - waitTime = 10; +var toggleFlowEditor = import_state12.Annotation.define(); +var cacheFlowEditorHeight = import_state12.Annotation.define(); +var preloadFlowEditor = import_state12.EditorState.transactionFilter.of( + (tr) => { + const newTrans = []; + const value = tr.state.field(flowEditorInfo, false); + if (value && !tr.annotation(toggleFlowEditor)) { + newTrans.push( + ...value.filter((f2) => f2.expandedState == 1).map((f2) => { + if (tr.state.field(flowTypeStateField, false) == "doc") { + return { + annotations: toggleFlowEditor.of([f2.id, 2]) + }; + } else { + return { + annotations: toggleFlowEditor.of([f2.id, 0]) + }; + } + }) + ); } - this.onTarget = true; - this.parent = parent; - this.waitTime = waitTime; - this.state = import_obsidian.PopoverState.Showing; - const { hoverEl } = this; - this.abortController.load(); - this.timer = window.setTimeout(this.show.bind(this), waitTime); - this.setActive = this._setActive.bind(this); - if (hoverEl) { - hoverEl.addEventListener("mousedown", this.setActive); - hoverEl.addEventListener("mousedown", (e5) => e5.stopPropagation()); + return [tr, ...newTrans]; + } +); +var internalLinkToggle = import_view14.ViewPlugin.fromClass( + class { + constructor(view) { + } + }, + { + eventHandlers: { + mousedown: (e5, view) => { + if (!e5.shiftKey) { + return; + } + const pos = view.posAtDOM(e5.target); + const { from: lineFrom, to: lineTo, text: text2 } = view.state.doc.lineAt(pos); + for (const match2 of text2.matchAll(/(?!!)\[\[([^\]]+)\]\]/g)) { + const stateField = view.state.field(flowEditorInfo, false); + const info = stateField.find( + (f2) => f2.to == lineFrom + match2.index + match2[1].length + 2 && pos >= f2.from && pos <= f2.to + ); + if (info) { + e5.preventDefault(); + view.dispatch({ + annotations: toggleFlowEditor.of([info.id, 2]) + }); + } + } + } } - popovers.set(this.hoverEl, this); - this.hoverEl.addClass("hover-editor"); - this.containerEl = this.hoverEl.createDiv("popover-content"); - this.setTitleBar(); - this.hoverEl.style.height = "auto"; - this.hoverEl.style.width = "100%"; - this.hoverEl.addEventListener("keydown", (e5) => e5.stopPropagation()); } - static activeWindows() { - const windows2 = [window]; - const { floatingSplit } = app.workspace; - if (floatingSplit) { - for (const split of floatingSplit.children) { - if (split.win) - windows2.push(split.win); +); +var internalLinkHover = (plugin) => hoverTooltip((view, pos, side) => { + const { from: lineFrom, to: lineTo } = view.state.doc.lineAt(pos); + let hovObject = null; + iterateTreeInSelection({ from: lineFrom, to: lineTo }, view.state, { + enter: ({ name: name319, from, to: to2 }) => { + if (name319.includes("hmd-internal-link") && pos <= to2 && pos >= from) { + const stateField = view.state.field(flowEditorInfo, false); + const info = stateField.find((f2) => f2.to == to2); + if (info) { + hovObject = { + pos, + end: to2, + above: true, + create(view2) { + const dom = document.createElement("div"); + dom.classList.add("mk-flow-hover"); + dom.classList.add("menu"); + const openHoverDiv = dom.createDiv(); + openHoverDiv.setAttribute( + "aria-label", + info.expandedState == 0 ? i18n_default.buttons.openFlow : i18n_default.buttons.hideFlow + ); + openHoverDiv.addEventListener("click", () => { + view2.dispatch({ + annotations: toggleFlowEditor.of([info.id, 2]) + }); + }); + const icon = openHoverDiv.createDiv(); + icon.innerHTML = plugin.superstate.ui.getSticker( + "ui//mk-ui-flow-hover" + ); + openHoverDiv.insertAdjacentText( + "beforeend", + info.expandedState == 0 ? i18n_default.buttons.openFlow : i18n_default.buttons.hideFlow + ); + return { dom }; + } + }; + return false; + } } } - return windows2; + }); + return hovObject; +}); +var flowEditorInfo = import_state12.StateField.define({ + create() { + return []; + }, + update(value, tr) { + const newValues = []; + const previous = value; + const usedContainers = []; + const str = tr.newDoc.sliceString(0); + const reverseExpandedState = (state) => { + const news = state != 2 /* Open */ ? 2 /* Open */ : 0 /* Closed */; + return news; + }; + for (const match2 of str.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)) { + const link = match2[1]; + const existingLinks = previous.filter((f2) => f2.link == link); + const offset2 = usedContainers.filter((f2) => f2 == link).length; + const existingInfo = existingLinks[offset2]; + const id3 = existingInfo ? existingInfo.id : genId(); + usedContainers.push(link); + const info = { + id: id3, + link: match2[1], + from: match2.index + 4, + to: match2.index + 4 + match2[1].length, + type: 1 /* Embed */, + height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, + expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + }; + newValues.push(info); + } + for (const match2 of str.matchAll(/\[\[([^\]]+)\]\]/g)) { + if (str.charAt(match2.index - 1) != "!") { + const link = match2[1]; + const existingLinks = previous.filter((f2) => f2.link == link); + const offset2 = usedContainers.filter((f2) => f2 == link).length; + const existingInfo = existingLinks[offset2]; + const id3 = existingInfo ? existingInfo.id : genId(); + usedContainers.push(link); + const info = { + id: id3, + link: match2[1], + from: match2.index + 2, + to: match2.index + 2 + match2[1].length, + type: 0 /* Link */, + height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, + expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0 + }; + newValues.push(info); + } else if (str.charAt(match2.index - 2) != "!") { + const link = match2[1]; + const existingLinks = previous.filter((f2) => f2.link == link); + const offset2 = usedContainers.filter((f2) => f2 == link).length; + const existingInfo = existingLinks[offset2]; + const id3 = existingInfo ? existingInfo.id : genId(); + usedContainers.push(link); + const info = { + id: id3, + link: match2[1], + from: match2.index + 3, + to: match2.index + 3 + match2[1].length, + type: 2 /* EmbedClosed */, + height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, + expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + }; + newValues.push(info); + } + } + newValues.sort(compareByField("from", true)); + return newValues; } - static containerForDocument(doc) { - if (doc !== document && app.workspace.floatingSplit) - for (const container of app.workspace.floatingSplit.children) { - if (container.doc === doc) - return container; +}); +var flowEditorRangeset = (state, plugin) => { + const builder = new import_state12.RangeSetBuilder(); + const infoFields = state.field(flowEditorInfo, false); + const values2 = []; + for (const info of infoFields) { + const { from, to: to2, type, expandedState } = info; + const lineFix = from - 3 == state.doc.lineAt(from).from && to2 + 2 == state.doc.lineAt(from).to; + if (type == 0 /* Link */) { + if (plugin.superstate.settings.internalLinkSticker) + values2.push({ + start: from - 2, + end: from - 2, + decoration: import_view14.Decoration.widget({ + widget: new LinkSticker(info, plugin), + side: -1 + }) + }); + if (plugin.superstate.settings.internalLinkClickFlow) + values2.push({ + start: to2 + 2, + end: to2 + 2, + decoration: import_view14.Decoration.widget({ + widget: new LinkExpand(info, plugin), + side: -1 + }) + }); + if (expandedState == 2 /* Open */) { + values2.push({ + start: to2 + 2, + end: to2 + 2, + decoration: flowEditorDecoration(info, plugin) + }); + } + } else if (expandedState == 2 /* Open */ && type == 1 /* Embed */) { + if (!(state.selection.main.from == from - 4 && state.selection.main.to == to2 + 2 || state.selection.main.from >= from - 3 && state.selection.main.to <= to2 + 1)) { + values2.push({ + start: from - 4, + end: from - 3, + decoration: flowEditorSelector(info, plugin) + }); + if (lineFix) { + values2.push({ + start: from - 3, + end: to2 + 2, + decoration: flowEditorWidgetDecoration(info, plugin) + }); + } else { + values2.push({ + start: from - 3, + end: to2 + 2, + decoration: flowEditorDecoration(info, plugin) + }); + } } - return app.workspace.rootSplit; + } } - static activePopovers() { - return this.activeWindows().flatMap(this.popoversForWindow); + values2.sort(compareByField("start", true)); + for (const value of values2) { + builder.add(value.start, value.end, value.decoration); } - static popoversForWindow(win) { - return Array.prototype.slice.call( - win?.document?.body.querySelectorAll(".mk-hover-popover") ?? [] - ).map((el) => popovers.get(el)).filter((he) => he); + const dec = builder.finish(); + return dec; +}; +var flowEditorField = (plugin) => import_state12.StateField.define({ + create(state) { + return flowEditorRangeset(state, plugin); + }, + update(value, tr) { + return flowEditorRangeset(tr.state, plugin); + }, + provide: (f2) => import_view14.EditorView.decorations.from(f2) +}); +var FlowEditorWidget = class extends import_view14.WidgetType { + constructor(info, plugin) { + super(); + this.info = info; + this.plugin = plugin; } - static forLeaf(leaf) { - const el = leaf && document.body.matchParent.call(leaf.containerEl, ".mk-hover-popover"); - return el ? popovers.get(el) : void 0; + eq(other) { + return other.info.id === this.info.id; } - onunload() { - this.hide(); + toDOM(view) { + const div2 = document.createElement("div"); + div2.classList.add("mk-floweditor-container"); + div2.setAttribute("id", "mk-flow-" + this.info.id); + const placeholder2 = div2.createDiv("mk-floweditor-placeholder"); + placeholder2.style.setProperty("height", this.info.height + "px"); + if (this.info.link && view.state.field(import_obsidian.editorInfoField, false)) { + const infoField = view.state.field(import_obsidian.editorInfoField, false); + const file = infoField.file; + const uri = this.plugin.superstate.spaceManager.uriByString( + this.info.link, + file?.path + ); + this.plugin.superstate.ui.openPath(uri.fullPath, false, div2); + } + return div2; } - _setActive() { - this.plugin.app.workspace.setActiveLeaf(this.leaves()[0], { focus: true }); + get estimatedHeight() { + return this.info.height; } - getDefaultMode() { - return this.parent?.view?.getMode ? this.parent.view.getMode() : "preview"; +}; +var LinkSticker = class extends import_view14.WidgetType { + constructor(info, plugin) { + super(); + this.info = info; + this.flowInfo = info; + this.plugin = plugin; } - updateLeaves() { - if (this.onTarget && this.targetEl && !this.document.contains(this.targetEl)) { - this.onTarget = false; - this.transition(); - } - let leafCount2 = 0; - this.plugin.app.workspace.iterateLeaves((leaf) => { - leafCount2++; - }, this.rootSplit); - if (leafCount2 === 0) { - this.hide(); - } else if (leafCount2 > 1) { + eq(other) { + return other.info.id === this.info.id; + } + toDOM(view) { + const div2 = document.createElement("div"); + div2.classList.add("mk-floweditor-sticker"); + const reactEl = this.plugin.ui.createRoot(div2); + if (this.info.link && view.state.field(import_obsidian.editorInfoField, false)) { + const infoField = view.state.field(import_obsidian.editorInfoField, false); + const file = infoField.file; + const uri = this.plugin.superstate.spaceManager.uriByString( + this.info.link, + file?.path + ); + reactEl.render( + /* @__PURE__ */ import_react159.default.createElement(PathStickerContainer, { + superstate: this.plugin.superstate, + path: uri.basePath + }) + ); } - this.hoverEl.setAttribute("data-leaf-count", leafCount2.toString()); + return div2; } - setTitleBar() { - this.titleEl = this.document.defaultView.createDiv("mk-flow-titlebar"); - this.containerEl.prepend(this.titleEl); +}; +var LinkExpand = class extends import_view14.WidgetType { + constructor(info, plugin) { + super(); + this.info = info; + this.flowInfo = info; + this.plugin = plugin; } - attachLeaf() { - this.rootSplit.getRoot = () => this.plugin.app.workspace[this.document === document ? "rootSplit" : "floatingSplit"]; - this.rootSplit.getContainer = () => FlowEditor.containerForDocument(this.document); - this.titleEl.insertAdjacentElement("afterend", this.rootSplit.containerEl); - const leaf = this.plugin.app.workspace.createLeafInParent( - this.rootSplit, - 0 - ); - leaf.isFlowBlock = true; - this.updateLeaves(); - return leaf; + eq(other) { + return other.info.id === this.info.id && other.info.expandedState == this.info.expandedState; } - onload() { - super.onload(); - this.registerEvent( - this.plugin.app.workspace.on("layout-change", this.updateLeaves, this) - ); - this.registerEvent( - app.workspace.on("layout-change", () => { - this.rootSplit.children.forEach((item, index2) => { - if (item instanceof import_obsidian.WorkspaceTabs) { - this.rootSplit.replaceChild(index2, item.children[0]); + toDOM(view) { + const div2 = document.createElement("div"); + div2.classList.add("mk-floweditor-toggle"); + const reactEl = this.plugin.ui.createRoot(div2); + if (this.info.link && view.state.field(import_obsidian.editorInfoField, false)) { + reactEl.render( + /* @__PURE__ */ import_react159.default.createElement(CollapseToggle, { + superstate: this.plugin.superstate, + collapsed: this.info.expandedState == 0, + onToggle: (collapsed) => { + view.dispatch({ + annotations: toggleFlowEditor.of([ + this.info.id, + collapsed ? 2 : 0 + ]) + }); } - }); - }) - ); + }) + ); + } + return div2; } - leaves() { - const leaves = []; - this.plugin.app.workspace.iterateLeaves((leaf) => { - leaves.push(leaf); - }, this.rootSplit); - return leaves; +}; +var FlowEditorSelector = class extends import_view14.WidgetType { + constructor(info, plugin) { + super(); + this.info = info; + this.flowInfo = info; + this.plugin = plugin; } - async onShow() { - const closeDelay = 600; - setTimeout(() => this.waitTime = closeDelay, closeDelay); - this.oldPopover?.hide(); - this.oldPopover = null; - this.hoverEl.classList.add("is-new"); - this.document.body.addEventListener( - "click", - () => { - this.hoverEl.classList.remove("is-new"); - }, - { once: true, capture: true } - ); - if (this.parent) { - this.parent.flowEditor = this; - this.parent.view.addChild(this); - } - await this.onShowCallback?.(this); - this.onShowCallback = void 0; - const viewHeaderEl = this.hoverEl.querySelector(".view-header"); - viewHeaderEl?.remove(); - const sizer = this.hoverEl.querySelector(".workspace-leaf"); - if (sizer) - this.hoverEl.appendChild(sizer); - const inlineTitle = this.hoverEl.querySelector(".inline-title"); - inlineTitle?.remove(); + eq(other) { + return other.info.id === this.info.id; } - transition() { - if (this.shouldShow()) { - if (this.state === import_obsidian.PopoverState.Hiding) { - this.state = import_obsidian.PopoverState.Shown; - clearTimeout(this.timer); - } - } else { - if (this.state === import_obsidian.PopoverState.Showing) { - this.hide(); - } else { - if (this.state === import_obsidian.PopoverState.Shown) { - this.state = import_obsidian.PopoverState.Hiding; - this.timer = window.setTimeout(() => { - if (this.shouldShow()) { - this.transition(); - } else { - this.hide(); - } - }, this.waitTime); - } - } + toDOM(view) { + const div2 = document.createElement("div"); + div2.classList.add("mk-floweditor-selector"); + const reactEl = this.plugin.ui.createRoot(div2); + if (this.info.link && view.state.field(import_obsidian.editorInfoField, false)) { + const infoField = view.state.field(import_obsidian.editorInfoField, false); + const file = infoField.file; + reactEl.render( + /* @__PURE__ */ import_react159.default.createElement(FlowEditorHover, { + app: this.plugin.app, + superstate: this.plugin.superstate, + toggle: true, + path: this.info.link, + source: file?.path, + toggleState: true, + view, + pos: { from: this.info.from, to: this.info.to }, + dom: div2 + }) + ); } + return div2; } - shouldShow() { - return this.shouldShowSelf() || this.shouldShowChild(); - } - shouldShowChild() { - return FlowEditor.activePopovers().some((popover) => { - if (popover !== this && popover.targetEl && this.hoverEl.contains(popover.targetEl)) { - return popover.shouldShow(); +}; +var flowEditorSelector = (info, plugin) => import_view14.Decoration.replace({ + widget: new FlowEditorSelector(info, plugin), + inclusive: true, + block: false +}); +var flowEditorDecoration = (info, plugin) => import_view14.Decoration.replace({ + widget: new FlowEditorWidget(info, plugin), + inclusive: true, + block: false +}); +var flowEditorWidgetDecoration = (info, plugin) => import_view14.Decoration.widget({ + widget: new FlowEditorWidget(info, plugin), + inclusiveStart: true, + block: true +}); + +// src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowViewUpdates.ts +var import_view15 = require("@codemirror/view"); +var flowViewUpdates = (plugin) => import_view15.EditorView.updateListener.of((v2) => { + if (v2.heightChanged) { + plugin.app.workspace.iterateRootLeaves((leaf) => { + const cm = leaf.view.editor?.cm; + if (cm && v2.view.dom == cm.dom && cm.state.field(flowTypeStateField, false)) { + if (leaf.containerEl.parentElement?.hasClass("workspace-tab-container")) { + if (cm.state.field(flowTypeStateField, false) != "doc") { + cm.dispatch({ + annotations: portalTypeAnnotation.of("doc") + }); + } + } } - return false; }); } - shouldShowSelf() { - return !this.detaching && !!(this.onTarget || this.state == import_obsidian.PopoverState.Shown || this.document.querySelector( - `body>.modal-container, body > #he${this.id} ~ .menu, body > #he${this.id} ~ .suggestion-container` - )); - } - show() { - if (!this.targetEl || this.document.body.contains(this.targetEl)) { - this.state = import_obsidian.PopoverState.Shown; - this.timer = 0; - this.shownPos = mouseCoords; - this.targetEl.replaceChildren(this.hoverEl); - this.onShow(); - app.workspace.onLayoutChange(); - this.load(); - } else { - this.hide(); - } - } - onHide() { - this.oldPopover = null; - if (this.parent?.flowEditor === this) { - this.parent.flowEditor = null; + if (v2.heightChanged) { + const flowID = v2.state.field(flowIDStateField, false); + if (flowID) { + plugin.app.workspace.iterateLeaves((leaf) => { + const cm = leaf.view.editor?.cm; + if (cm) { + const stateField = cm.state.field(flowEditorInfo, false); + if (stateField) { + if (stateField.find((f2) => f2.id == flowID)) { + cm.dispatch({ + annotations: cacheFlowEditorHeight.of([ + flowID, + v2.view.contentHeight + ]) + }); + } + } + } + }, plugin.app.workspace["rootSplit"]); } } - hide() { - this.onTarget = false; - this.detaching = true; - if (this.timer) { - clearTimeout(this.timer); - this.timer = 0; +}); + +// src/adapters/obsidian/ui/editors/markdownView/flowEditor/selectiveEditor.ts +var import_state13 = require("@codemirror/state"); +var import_view16 = require("@codemirror/view"); +var combinedRangeFacets = (rangeA, rangeB) => { + const startRange = !rangeA?.[0] ? rangeB[0] : !rangeB?.[0] ? rangeA[0] : Math.max(rangeA?.[0], rangeB?.[0]); + const endRange = !rangeA?.[1] ? rangeB[1] : !rangeB?.[1] ? rangeA[1] : Math.min(rangeA?.[1], rangeB?.[1]); + return [isNaN(startRange) ? null : startRange, isNaN(endRange) ? null : endRange]; +}; +var editableRange = import_state13.Annotation.define(); +var contentRange = import_state13.Annotation.define(); +var hiddenLine = import_view16.Decoration.replace({ inclusive: true, block: true }); +var hideLine = import_state13.StateField.define({ + create() { + return import_view16.Decoration.none; + }, + update(value, tr) { + const builder = new import_state13.RangeSetBuilder(); + const betterFacet = combinedRangeFacets(tr.state.field(selectiveLinesFacet, false), tr.state.field(frontmatterFacet, false)); + if (betterFacet?.[0] != null) { + const starterLine = Math.min( + tr.state.doc.lines, + betterFacet[0] + ); + builder.add( + tr.state.doc.line(1).from, + tr.state.doc.line(starterLine).from - 1, + hiddenLine + ); + if (tr.newDoc.lines != betterFacet[1]) + builder.add( + tr.state.doc.line( + Math.min(tr.newDoc.lines, betterFacet[1]) + ).to, + tr.state.doc.line(tr.newDoc.lines).to, + hiddenLine + ); } - this.hoverEl.hide(); - if (this.opening) - return; - const leaves = this.leaves(); - if (leaves.length) { - leaves.forEach((leaf) => { - leaf.detach(); - }); - } else { - this.parent = null; - this.abortController?.unload(); - this.abortController = void 0; - return this.nativeHide(); + const dec = builder.finish(); + return dec; + }, + provide: (f2) => import_view16.EditorView.decorations.from(f2) +}); +var frontmatterFacet = import_state13.StateField.define({ + create: () => [void 0, void 0], + update(value, tr) { + if (tr.annotation(contentRange)) { + if (tr.annotation(contentRange)[0]) { + return [ + tr.annotation(contentRange)[0], + Math.min(tr.state.doc.lines, tr.annotation(contentRange)[1]) + ]; + } + return tr.annotation(contentRange); } + return value; } - nativeHide() { - const { hoverEl, targetEl } = this; - this.state = import_obsidian.PopoverState.Hidden; - hoverEl.detach(); - if (targetEl) { - const parent = targetEl.matchParent(".mk-hover-popover"); - if (parent) - popovers.get(parent)?.transition(); +}); +var selectiveLinesFacet = import_state13.StateField.define({ + create: () => [void 0, void 0], + update(value, tr) { + if (tr.annotation(editableRange)) { + if (tr.annotation(editableRange)[0]) { + return [ + tr.annotation(editableRange)[0], + Math.min(tr.state.doc.lines, tr.annotation(editableRange)[1]) + ]; + } + return tr.annotation(editableRange); } - this.onHide(); - this.unload(); + return value; } - async openContext(file, openState, useLeaf) { - if (this.detaching) - return; - const leaf = useLeaf ?? this.attachLeaf(); - this.opening = true; - try { - await leaf.openFile(file, openState); - } catch (e5) { - console.error(e5); - } finally { - this.opening = false; - if (this.detaching) - this.hide(); +}); +var lineRangeToPosRange = (state, range2) => { + return { + from: state.doc.line(range2[0]).from, + to: state.doc.line(Math.min(state.doc.lines, range2[1])).to + }; +}; +var smartDelete = import_state13.EditorState.transactionFilter.of( + (tr) => { + if (tr.isUserEvent("delete") && !tr.annotation(import_state13.Transaction.userEvent).endsWith(".smart")) { + const initialSelections = tr.startState.selection.ranges.map((range2) => ({ + from: range2.from, + to: range2.to + })); + const betterFacet = combinedRangeFacets(tr.startState.field(selectiveLinesFacet, false), tr.startState.field(frontmatterFacet, false)); + if (initialSelections.length > 0 && betterFacet?.[0]) { + const posRange = lineRangeToPosRange( + tr.startState, + betterFacet + ); + if (tr.changes.touchesRange(0, posRange.from - 1)) { + const minFrom = Math.max(posRange.from, initialSelections[0].from); + const minTo = Math.min(posRange.to, initialSelections[0].to); + return [{ + changes: { + from: Math.min(minFrom, minTo), + to: Math.max(minFrom, minTo) + }, + annotations: import_state13.Transaction.userEvent.of( + `${tr.annotation(import_state13.Transaction.userEvent)}.smart` + ) + }]; + } + } } - return leaf; + return tr; } - async openFile(file, openState, useLeaf) { - if (this.detaching) - return; - const leaf = useLeaf ?? this.attachLeaf(); - this.opening = true; +); +var preventModifyTargetRanges = import_state13.EditorState.transactionFilter.of( + (tr) => { + const newTrans = []; try { - await leaf.openFile(file, openState); + const editableLines = tr.startState.field(selectiveLinesFacet, false); + const contentLines = tr.startState.field(frontmatterFacet, false); + const selectiveLines = combinedRangeFacets(editableLines, contentLines); + if (tr.isUserEvent("input") || tr.isUserEvent("delete") || tr.isUserEvent("move")) { + if (selectiveLines?.[0]) { + const posRange = lineRangeToPosRange( + tr.startState, + selectiveLines + ); + if (!tr.changes.touchesRange(posRange.from, posRange.to)) { + return []; + } + } + } + if (tr.state.doc.lines != tr.startState.doc.lines) { + const numberNewLines = tr.state.doc.lines - tr.startState.doc.lines; + if (selectiveLines?.[0]) { + const posRange = lineRangeToPosRange( + tr.startState, + selectiveLines + ); + if (tr.changes.touchesRange(0, posRange.from - 1)) { + const newAnnotations = []; + if (editableLines[0]) { + newAnnotations.push(editableRange.of([ + editableLines[0] + numberNewLines, + editableLines[1] + numberNewLines + ])); + } + if (contentLines[0]) { + newAnnotations.push(contentRange.of([ + contentLines[0] + numberNewLines, + contentLines[1] + numberNewLines + ])); + } + newTrans.push({ + annotations: newAnnotations + }); + } else if (tr.changes.touchesRange(posRange.from - 1, posRange.to)) { + const newAnnotations = []; + if (editableLines[0]) { + newAnnotations.push(editableRange.of([ + editableLines[0], + editableLines[1] + numberNewLines + ])); + } + if (contentLines[0]) { + newAnnotations.push(contentRange.of([ + contentLines[0], + contentLines[1] + numberNewLines + ])); + } + newTrans.push({ + annotations: newAnnotations + }); + } + } + } } catch (e5) { - console.error(e5); - } finally { - this.opening = false; - if (this.detaching) - this.hide(); + return []; } - return leaf; + return [tr, ...newTrans]; } - buildState(parentMode, eState) { - return { - active: false, - state: {}, - eState - }; +); +var readOnlyRangesExtension = [smartDelete, preventModifyTargetRanges]; +var editBlockExtensions = () => [ + readOnlyRangesExtension, + hideLine, + selectiveLinesFacet, + frontmatterFacet +]; + +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/inlineStyler.tsx +var import_state15 = require("@codemirror/state"); + +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/marks.ts +var import_state14 = require("@codemirror/state"); + +// src/adapters/obsidian/ui/editors/markdownView/obsidianSyntax.ts +var oMarks = [ + { + mark: "em", + formatting: "formatting-em", + altFormatting: "em_formatting_formatting-strong", + formatChar: "*" + }, + { + mark: "strong", + formatting: "formatting-strong", + formatChar: "**" + }, + { + mark: "strikethrough", + formatting: "formatting-strikethrough", + formatChar: "~~" + }, + { + mark: "inline-code", + formatting: "formatting-code", + formatChar: "`" } - buildEphemeralState(file, link) { - const cache2 = this.plugin.app.metadataCache.getFileCache(file); - const subpath = cache2 ? (0, import_obsidian.resolveSubpath)(cache2, link?.subpath || "") : void 0; - const eState = { subpath: link?.subpath }; - if (subpath) { - eState.line = subpath.start.line; - eState.startLoc = subpath.start; - eState.endLoc = subpath.end || void 0; +]; + +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/marks.ts +var toggleMark = import_state14.Annotation.define(); +var trimSpace = (pos, moveDirLeft, state) => { + if (moveDirLeft && state.sliceDoc(pos, pos + 1) == " ") + return pos + 1; + if (!moveDirLeft && state.sliceDoc(pos - 1, pos) == " ") + return pos - 1; + return pos; +}; +var newPosAfterFormatting = (pos, moveDirLeft, state) => { + const line = state.doc.lineAt(pos); + const start = moveDirLeft ? line.from : pos; + const end = moveDirLeft ? pos : line.to; + let newPos = start; + let lastFormatPos = start; + const exitFormatRange = false; + iterateTreeInSelection({ from: start, to: end }, state, { + enter: (node) => { + if (exitFormatRange) + return false; + if (node.name.includes("formatting")) { + if (!moveDirLeft && node.from > start) { + return false; + } + if (moveDirLeft) { + newPos = node.from; + lastFormatPos = node.to; + } else { + newPos = node.to; + } + } } - return eState; + }); + if (moveDirLeft && lastFormatPos < pos) { + newPos = pos; } + return newPos; }; - -// src/core/react/components/SpaceView/SpaceHeader.tsx -var import_react159 = __toESM(require_react()); -var SpaceHeader = (props) => { - const { readMode } = (0, import_react159.useContext)(PathContext); - const { spaceState } = (0, import_react159.useContext)(SpaceContext); - return /* @__PURE__ */ import_react159.default.createElement(import_react159.default.Fragment, null, /* @__PURE__ */ import_react159.default.createElement(BannerView, { - superstate: props.superstate - }), /* @__PURE__ */ import_react159.default.createElement("div", { - className: "mk-space-header" - }, /* @__PURE__ */ import_react159.default.createElement("div", { - className: "mk-path-context-label" - }, /* @__PURE__ */ import_react159.default.createElement(TitleComponent, { - superstate: props.superstate, - readOnly: readMode - })), spaceState?.type == "folder" && !readMode && props.superstate.settings.inlineContextProperties && /* @__PURE__ */ import_react159.default.createElement(HeaderPropertiesView, { - superstate: props.superstate, - collapseSpaces: true - }))); +var expandRange = (selection2, state) => { + const from = trimSpace( + newPosAfterFormatting(selection2.from, true, state), + true, + state + ); + const to2 = trimSpace( + newPosAfterFormatting(selection2.to, false, state), + false, + state + ); + return { from, to: to2 }; }; - -// node_modules/@air/react-drag-to-select/dist/index.modern.js -var import_react160 = __toESM(require_react(), 1); -var import_react_dom10 = __toESM(require_react_dom(), 1); -var import_react_style_object_to_css = __toESM(require_react_style_object_to_css(), 1); -function a3() { - return a3 = Object.assign ? Object.assign.bind() : function(e5) { - for (var t7 = 1; t7 < arguments.length; t7++) { - var n3 = arguments[t7]; - for (var r2 in n3) - Object.prototype.hasOwnProperty.call(n3, r2) && (e5[r2] = n3[r2]); +var addMarkAtPos = (pos, mark) => ({ + changes: { from: pos, to: pos, insert: mark.formatChar } +}); +var rangeIsMark = (state, mark, selection2) => posIsMark(selection2.from, state, mark.mark) && posIsMark(selection2.to, state, mark.mark); +var posIsMark = (pos, state, markString) => { + let isMark = false; + iterateTreeAtPos(pos, state, { + enter: ({ name: name319, from, to: to2 }) => { + if (nodeNameContainsMark(name319, markString)) + isMark = true; } - return e5; - }, a3.apply(this, arguments); -} -var s3 = ["style"]; -var d3 = (0, import_react160.forwardRef)((t7, u3) => { - let { style: d4 = {} } = t7, m4 = function(e5, t8) { - if (null == e5) - return {}; - var n3, r2, o2 = {}, l2 = Object.keys(e5); - for (r2 = 0; r2 < l2.length; r2++) - t8.indexOf(n3 = l2[r2]) >= 0 || (o2[n3] = e5[n3]); - return o2; - }(t7, s3); - const v2 = (0, import_react160.useRef)(null), f2 = (0, import_react160.useRef)(null), [, p] = (0, import_react160.useState)(0); - return (0, import_react160.useImperativeHandle)(u3, () => ({ getBoundingClientRect: () => { - var e5; - return null == (e5 = v2.current) ? void 0 : e5.getBoundingClientRect(); - }, getParentBoundingClientRect: () => { - var e5, t8; - return null == v2 || null == (e5 = v2.current) || null == (t8 = e5.parentElement) ? void 0 : t8.getBoundingClientRect(); - }, drawSelectionBox: (e5) => { - requestAnimationFrame(() => { - if (f2.current) { - const t8 = a3({ border: "1px solid #4C85D8", background: "rgba(155, 193, 239, 0.4)", position: "absolute", pointerEvents: "none" }, d4, { top: e5.top, left: e5.left, width: e5.width, height: e5.height }); - f2.current.style.cssText = (0, import_react_style_object_to_css.default)(t8); - } - }); - }, clearSelectionBox: () => { - requestAnimationFrame(() => { - f2.current && (f2.current.style.cssText = (0, import_react_style_object_to_css.default)({ top: 0, left: 0, width: 0, height: 0 })); - }); - } })), (0, import_react160.useEffect)(() => { - p((e5) => e5 + 1); - }, []), import_react160.default.createElement("div", { ref: v2 }, v2.current ? import_react_dom10.default.createPortal(import_react160.default.createElement("div", a3({ ref: f2 }, m4)), v2.current) : null); -}); -var m3 = (e5, t7) => e5.left <= t7.left + t7.width && e5.left + e5.width >= t7.left && e5.top <= t7.top + t7.height && e5.top + e5.height >= t7.top; -function v(t7) { - const { onSelectionChange: r2, onSelectionEnd: o2, onSelectionStart: c3, isEnabled: i4 = true, selectionProps: s4 = {}, eventsElement: m4, shouldStartSelecting: v2 } = t7 || {}, f2 = (0, import_react160.useRef)(null), { cancelCurrentSelection: p } = function({ containerRef: e5, onSelectionChange: t8, onSelectionStart: r3, onSelectionEnd: o3, isEnabled: c4 = true, eventsElement: i5, shouldStartSelecting: s5 }) { - const d4 = (0, import_react160.useRef)(null), m5 = (0, import_react160.useRef)(null), v3 = (0, import_react160.useRef)(false), f3 = (0, import_react160.useRef)(t8), p2 = (0, import_react160.useRef)(r3), h3 = (0, import_react160.useRef)(o3), g = (0, import_react160.useRef)(), y3 = (0, import_react160.useRef)(c4); - f3.current = (0, import_react160.useCallback)((e6) => { - g.current = t8 ? requestAnimationFrame(() => { - t8(e6); - }) : void 0; - }, [t8]), p2.current = r3, h3.current = o3, y3.current = c4; - const b2 = (0, import_react160.useCallback)(() => { - var t9; - d4.current = null, m5.current = null, v3.current = false, null == (t9 = e5.current) || t9.clearSelectionBox(), "number" == typeof g.current && cancelAnimationFrame(g.current); - }, [e5]), S3 = (0, import_react160.useCallback)((t9, n3) => { - var r4, o4, l2; - return n3 || (n3 = null == (l2 = e5.current) ? void 0 : l2.getParentBoundingClientRect()), { x: t9.clientX - ("number" == typeof (null == (r4 = n3) ? void 0 : r4.left) ? n3.left : 0), y: t9.clientY - ("number" == typeof (null == (o4 = n3) ? void 0 : o4.top) ? n3.top : 0) }; - }, [e5]), E2 = (0, import_react160.useCallback)((t9, n3) => { - if (d4.current && m5.current) { - if (!n3) - return; - const l2 = (({ startPoint: e6, endPoint: t10 }) => ({ left: Math.min(e6.x, t10.x), top: Math.min(e6.y, t10.y), width: Math.abs(e6.x - t10.x), height: Math.abs(e6.y - t10.y) }))({ startPoint: d4.current, endPoint: m5.current }), u3 = a3({}, l2, { top: l2.top + ((null == n3 ? void 0 : n3.top) || 0), left: l2.left + ((null == n3 ? void 0 : n3.left) || 0) }); - var r4; - (o4 = l2).width * o4.height > 10 ? (v3.current || (null != p2 && p2.current && p2.current(t9), v3.current = true), null == (r4 = e5.current) || r4.drawSelectionBox(l2), null == f3.current || f3.current(u3)) : v3.current && (null == f3.current || f3.current(u3)); - } else - b2(); - var o4; - }, [b2, e5]), w2 = (0, import_react160.useCallback)((t9) => { - var n3; - if (!d4.current) - return; - const r4 = null == (n3 = e5.current) ? void 0 : n3.getParentBoundingClientRect(); - m5.current = S3(t9, r4), E2(t9, r4); - }, [E2, S3, e5]), x2 = (0, import_react160.useCallback)((e6) => { - var t9; - 0 === e6.button && (m5.current && (null == h3.current || h3.current(e6)), b2(), document.body.style.removeProperty("user-select"), document.body.style.removeProperty("-webkit-user-select"), (i5 || document.body).removeEventListener("mousemove", w2), null == (t9 = window) || t9.removeEventListener("mouseup", x2)); - }, [i5, b2, w2]), C2 = (0, import_react160.useCallback)((e6) => { - if (0 === e6.button && y3.current) { - var t9; - if ("function" == typeof s5 && !s5(e6.target)) - return; - document.body.style.userSelect = "none", document.body.style.webkitUserSelect = "none", d4.current = S3(e6), (i5 || document.body).addEventListener("mousemove", w2), null == (t9 = window) || t9.addEventListener("mouseup", x2); - } - }, [i5, S3, w2, x2]); - return (0, import_react160.useEffect)(() => ((i5 || document.body).addEventListener("mousedown", C2), () => { - (i5 || document.body).removeEventListener("mousedown", C2), (i5 || document.body).removeEventListener("mousemove", w2), window.removeEventListener("mouseup", x2); - }), [i5, C2, w2, x2]), { cancelCurrentSelection: b2 }; - }({ containerRef: f2, onSelectionEnd: o2, onSelectionStart: c3, onSelectionChange: r2, isEnabled: i4, eventsElement: m4, shouldStartSelecting: v2 }); - return { cancelCurrentSelection: p, DragSelection: (0, import_react160.useCallback)(() => import_react160.default.createElement(d3, a3({ ref: f2 }, s4)), []) }; -} - -// src/core/react/components/SpaceView/SpaceOuter.tsx -var import_react161 = __toESM(require_react()); -var SpaceOuter = (0, import_react161.forwardRef)( - (props, ref2) => { - const [selectionBox, setSelectionBox] = (0, import_react161.useState)(); - const selectableItems = (0, import_react161.useRef)([]); - const { frameProperties } = (0, import_react161.useContext)(FramesEditorRootContext); - const { selectableNodeBounds, id: id3 } = (0, import_react161.useContext)(FrameInstanceContext); - const { selectMulti } = (0, import_react161.useContext)(FrameSelectionContext); - const { tableData } = (0, import_react161.useContext)(FramesMDBContext); - const [dragging, setDragging] = (0, import_react161.useState)(false); - const localRef = (0, import_react161.useRef)(null); - const [contexts, setContexts] = (0, import_react161.useState)({}); - const [frameProps, setFrameProps] = (0, import_react161.useState)({}); - const { pathState } = (0, import_react161.useContext)(PathContext); - const { spaceInfo } = (0, import_react161.useContext)(SpaceContext); - (0, import_react161.useEffect)(() => { - if (!spaceInfo) { - return; - } - const linkedNote = spaceInfo.notePath; - const refreshProps = () => { - if (tableData) { - const properties3 = { - ...pathState?.metadata?.property ?? {} - }; - const row2 = linkContextRow( - props.superstate.formulaContext, - props.superstate.pathsIndex, - properties3, - tableData?.cols ?? [], - pathState - ); - setFrameProps(row2); - } else { - const properties3 = { - ...pathState?.metadata?.property ?? {} - }; - setFrameProps(properties3); - } - if (!pathState) { - setContexts({}); - return; - } - const pathContexts = props.superstate.spacesMap.get(pathState.path) ?? /* @__PURE__ */ new Set(); - const contexts2 = [...pathContexts].reduce( - (p, c3) => { - const context = props.superstate.contextsIndex.get(c3)?.contextTable?.rows.find( - (f2) => f2[PathPropertyName] == pathState.path - ); - return context ? { ...p, [c3]: context } : p; - }, - { - $space: { - note: linkedNote, - space: pathState.path, - path: pathState.path - }, - $context: { - _keyValue: pathState.path, - _schema: "main" - }, - $properties: frameProperties + }); + return isMark; +}; +var nodeNameContainsMark = (name319, markString) => { + return name319.includes(markString); +}; +var edgeIsMark = (pos, state, mark) => posIsMark(pos, state, mark.mark); +var edgeIsMarkFormat = (pos, state, mark) => posIsMark(pos, state, mark.formatting) ? true : mark.altFormatting ? posIsMark(pos, state, mark.altFormatting) : false; +var transactionChangesForMark = (range2, mark, state) => { + const newTrans = []; + if (rangeIsMark(state, mark, range2)) { + if (edgeIsMarkFormat(range2.from, state, mark) && !edgeIsMarkFormat(range2.to, state, mark)) { + newTrans.push(addMarkAtPos(range2.to, mark)); + } + if (edgeIsMarkFormat(range2.to, state, mark) && !edgeIsMarkFormat(range2.from, state, mark)) { + newTrans.push(addMarkAtPos(range2.from, mark)); + } + } else if (edgeIsMark(range2.from, state, mark)) { + if (edgeIsMarkFormat(range2.from, state, mark) && !edgeIsMark(range2.from - 1, state, mark)) { + newTrans.push(addMarkAtPos(range2.from, mark)); + } + newTrans.push(addMarkAtPos(range2.to, mark)); + } else if (edgeIsMark(range2.to, state, mark)) { + if (edgeIsMarkFormat(range2.to, state, mark) && !edgeIsMark(range2.to + 1, state, mark)) { + newTrans.push(addMarkAtPos(range2.to, mark)); + } + newTrans.push(addMarkAtPos(range2.from, mark)); + } else { + newTrans.push(addMarkAtPos(range2.to, mark)); + newTrans.push(addMarkAtPos(range2.from, mark)); + } + return newTrans; +}; +var removeAllInternalMarks = (sel, state, mark) => { + const returnTrans = []; + iterateTreeInSelection({ from: sel.from, to: sel.to }, state, { + enter: ({ name: name319, from, to: to2 }) => { + if (nodeNameContainsMark(name319, mark.formatting) || (mark.altFormatting ? nodeNameContainsMark(name319, mark.altFormatting) : false)) + returnTrans.push({ + from, + to: from + mark.formatChar.length + }); + } + }); + return { + changes: returnTrans + }; +}; +var toggleMarkExtension = import_state14.EditorState.transactionFilter.of( + (tr) => { + if (!tr.annotation(toggleMark)) + return tr; + const markToggle = tr.annotation(toggleMark); + const mark = oMarks.find((f2) => f2.mark == markToggle); + if (!mark) { + return tr; + } + const selection2 = tr.startState.selection.main; + const newTrans = []; + if (selection2.head == selection2.anchor) { + if (tr.startState.sliceDoc( + selection2.head - mark.formatChar.length, + selection2.head + ) == mark.formatChar && tr.startState.sliceDoc( + selection2.head, + selection2.head + mark.formatChar.length + ) == mark.formatChar) { + newTrans.push({ + changes: { + from: selection2.head - mark.formatChar.length, + to: selection2.head + mark.formatChar.length } - ); - setContexts(contexts2); - }; - refreshProps(); - }, [spaceInfo, pathState, tableData]); - const propSetters = Object.keys(frameProps).reduce( - (p, c3) => ({ - ...p, - [c3]: (value) => { - setFrameProps((p2) => ({ ...p2, [c3]: value })); - saveProperties(props.superstate, pathState.path, { - [c3]: value - }); - } - }), - {} - ); - const onKeyDown = (e5) => { - if (e5.key === "Escape") { - props.superstate.ui.resetSelection(null); - } - }; - (0, import_react161.useEffect)(() => { - window.addEventListener("keydown", onKeyDown); - return () => { - window.removeEventListener("keydown", onKeyDown); - }; - }, []); - const { DragSelection } = v({ - eventsElement: localRef.current, - onSelectionChange: (box) => { - const scroller = localRef.current.parentElement; - const scrollAwareBox = { - ...box, - top: box.top + scroller.scrollTop, - left: box.left + scroller.scrollLeft - }; - setSelectionBox(scrollAwareBox); - const nodesToSelect = []; - Object.keys(selectableNodeBounds.current).forEach((item) => { - if (m3(scrollAwareBox, selectableNodeBounds.current[item])) { - nodesToSelect.push(item); + }); + } else { + newTrans.push({ + changes: { + from: selection2.head, + insert: mark.formatChar + mark.formatChar + }, + selection: { + anchor: selection2.head + mark.formatChar.length, + head: selection2.head + mark.formatChar.length } }); - selectMulti(nodesToSelect, false); - }, - onSelectionStart: () => { - setDragging(true); - }, - onSelectionEnd: (e5) => { - setTimeout(function() { - setDragging(false); - }, 100); - }, - selectionProps: { - style: { - backgroundColor: "hsla(var(--color-accent-hsl), 0.1)", - border: "2px solid var(--color-accent)", - borderRadius: 2, - opacity: 0.5 - } - }, - isEnabled: true, - shouldStartSelecting: (target) => { - if (target instanceof HTMLElement && (target.className.includes("mk-f-main") || target.className.includes("mk-space-outer"))) - return true; - return false; - } - }); - return /* @__PURE__ */ import_react161.default.createElement("div", { - className: "mk-space-body cm-line", - ref: (el) => { - localRef.current = el; - if (typeof ref2 == "function") - ref2(el); - else if (ref2 !== null) - ref2.current = el; } - }, /* @__PURE__ */ import_react161.default.createElement(DragSelection, null), spaceInfo.readOnly ? /* @__PURE__ */ import_react161.default.createElement(FrameInstanceProvider, { - id: id3 ?? "root", - superstate: props.superstate, - props: frameProps, - contexts, - propSetters, - editable: false - }, /* @__PURE__ */ import_react161.default.createElement(FrameInstanceView, { - superstate: props.superstate - })) : /* @__PURE__ */ import_react161.default.createElement(FrameInstanceProvider, { - id: id3 ?? "root", - superstate: props.superstate, - props: frameProps, - contexts, - propSetters, - editable: true - }, /* @__PURE__ */ import_react161.default.createElement(FrameEditorInstance, { - containerRef: props.containerRef, - superstate: props.superstate - }))); + return [tr, ...newTrans]; + } + const range2 = expandRange(selection2, tr.startState); + newTrans.push(removeAllInternalMarks(range2, tr.startState, mark)); + const newFrom = range2.from; + const newTo = range2.to; + newTrans.push(...transactionChangesForMark(range2, mark, tr.startState)); + return [tr, ...newTrans, { selection: { anchor: newFrom, head: newTo } }]; } ); -SpaceOuter.displayName = "SpaceOuter"; -var SpaceOuter_default = SpaceOuter; - -// src/core/react/components/SpaceView/SpaceInner.tsx -var import_react162 = __toESM(require_react()); -var SpaceInner = (props) => { - const ref2 = (0, import_react162.useRef)(null); - const { spaceState } = (0, import_react162.useContext)(SpaceContext); - return /* @__PURE__ */ import_react162.default.createElement(import_react162.default.Fragment, null, props.header && /* @__PURE__ */ import_react162.default.createElement(SpaceHeader, { - superstate: props.superstate - }), spaceState && /* @__PURE__ */ import_react162.default.createElement(SpaceOuter_default, { - superstate: props.superstate, - ref: ref2, - containerRef: ref2 - }), props.superstate.settings.inlineBacklinks && spaceState && /* @__PURE__ */ import_react162.default.createElement("div", { - className: "mk-space-footer" - }, /* @__PURE__ */ import_react162.default.createElement(Backlinks, { - superstate: props.superstate, - path: spaceState.space.notePath - }))); -}; -// src/adapters/obsidian/ui/editors/EmbedSpaceView.tsx +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/InlineMenu.tsx +var import_classnames14 = __toESM(require_classnames()); var import_obsidian2 = require("obsidian"); -var import_react163 = __toESM(require_react()); -var EMBED_SPACE_VIEW_TYPE = "mk-space-embed"; -var EmbedSpaceView = class extends import_obsidian2.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.navigation = true; - this.plugin = plugin; - } - getViewType() { - return EMBED_SPACE_VIEW_TYPE; - } - getDisplayText() { - return this.path; - } - async onClose() { - this.destroy(); - } - onunload() { - this.destroy(); - } - destroy() { - if (this.root) - this.root.unmount(); - } - async onOpen() { - this.destroy(); - } - async setState(state, result) { - this.path = state.path; - this.source = state.source; - this.constructInlineContext(); - await super.setState(state, result); - const title = pathDisplayName(this.path, this.plugin.superstate); - this.leaf.tabHeaderInnerTitleEl.innerText = title; - this.leaf.view.titleEl = title; - const headerEl = this.leaf.view.headerEl; - if (headerEl) { - headerEl.querySelector(".view-header-title").innerText = title; - } - return; - } - getState() { - const state = super.getState(); - state.path = this.path; - state.source = this.source; - return state; - } - constructInlineContext() { - this.destroy(); - this.root = this.plugin.ui.createRoot(this.contentEl); - if (this.root) { - this.root.render( - /* @__PURE__ */ import_react163.default.createElement(SpaceView, { - path: this.path, - superstate: this.plugin.superstate, - key: this.path, - readOnly: true - }, /* @__PURE__ */ import_react163.default.createElement(SpaceInner, { - superstate: this.plugin.superstate, - header: false - })) - ); - } else { - this.plugin.ui.manager.eventsDispatch.addOnceListener( - "windowReady", - () => { - this.constructInlineContext(); - } - ); - } - } -}; +var import_react161 = __toESM(require_react()); -// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx -var import_obsidian4 = require("obsidian"); -var import_react166 = __toESM(require_react()); +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/Mark.tsx +var import_react160 = __toESM(require_react()); +var Mark = (props) => { + const { i: i4, style, active, toggleMarkAction } = props; + return /* @__PURE__ */ import_react160.default.createElement("div", { + key: i4, + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.styles[style.label] : void 0, + className: `mk-mark ${style.mark && active ? "mk-mark-active" : ""}`, + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker(`ui//${style.icon}`) + }, + onMouseDown: (e5) => toggleMarkAction(e5, style) + }); +}; -// src/adapters/text/removemd.js -function removemd(md, options) { - options = options || {}; - options.listUnicodeChar = options.hasOwnProperty("listUnicodeChar") ? options.listUnicodeChar : false; - options.stripListLeaders = options.hasOwnProperty("stripListLeaders") ? options.stripListLeaders : true; - options.gfm = options.hasOwnProperty("gfm") ? options.gfm : true; - options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true; - options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false; - options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false; - options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : []; - var output = md || ""; - output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*/gm, ""); - try { - if (options.stripListLeaders) { - if (options.listUnicodeChar) - output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1"); - else - output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1"); - } - if (options.gfm) { - output = output.replace(/\n={2,}/g, "\n").replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/`{3}.*\n/g, ""); - } - if (options.abbr) { - output = output.replace(/\*\[.*\]:.*\n/, ""); - } - output = output.replace(/<[^>]*>/g, ""); - var htmlReplaceRegex = new RegExp("<[^>]*>", "g"); - if (options.htmlTagsToSkip.length > 0) { - var joinedHtmlTagsToSkip = "(?!" + options.htmlTagsToSkip.join("|") + ")"; - htmlReplaceRegex = new RegExp( - "<" + joinedHtmlTagsToSkip + "[^>]*>", - "ig" - ); - } - output = output.replace(htmlReplaceRegex, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "").replace(/\[([^\]]*?)\][\[\(].*?[\]\)]/g, options.replaceLinksWithURL ? "$2" : "$1").replace(/^(\n)?\s{0,3}>\s?/gm, "$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, "$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g, "$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, "$1$3$4$5").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/~(.*?)~/g, "$1"); - } catch (e5) { - console.error(e5); - return md; +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/styles/default.ts +var default_default = [ + { + label: "bold", + value: `****`, + insertOffset: 2, + icon: "mk-mark-strong", + mark: "strong" + }, + { + label: "italics", + value: "**", + insertOffset: 1, + icon: "mk-mark-em", + mark: "em" + }, + { + label: "strikethrough", + value: "~~~~", + insertOffset: 2, + icon: "mk-mark-strikethrough", + mark: "strikethrough" + }, + { + label: "code", + value: "``", + insertOffset: 1, + icon: "mk-mark-code", + mark: "inline-code" + }, + { + label: "link", + value: "[]()", + insertOffset: 1, + cursorOffset: 2, + icon: "mk-mark-link" } - return output; +]; + +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/styles/index.ts +function resolveStyles() { + return default_default; } -// src/adapters/text/textCacher.ts -var regexYaml = /^---\s*\n(.*?)\n?^---\s?/ms; -var textCacheExperimental = { - wordCount: (str) => { - const spaceDelimitedChars = /'’A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source; - const nonSpaceDelimitedWords = /\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/.source; - const nonSpaceDelimitedWordsOther = /[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5]{1}/.source; - const pattern = new RegExp( - [ - `(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${spaceDelimitedChars}])+`, - nonSpaceDelimitedWords, - nonSpaceDelimitedWordsOther - ].join("|"), - "g" - ); - return (str.replace(regexYaml, "").match(pattern) || []).length; - }, - preview: (str) => { - return removemd(str.replace(regexYaml, "")); - } +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/InlineMenu.tsx +var loadStylerIntoContainer = (el, plugin) => { + const root = plugin.ui.createRoot(el); + root.render( + /* @__PURE__ */ import_react161.default.createElement(InlineMenuComponent, { + mobile: true, + activeMarks: [], + plugin + }) + ); }; -var TextCacher = class { - constructor(plugin) { - this.plugin = plugin; - this.supportedFileTypes = ["md"]; - this.id = "text.make.md"; - this.plugin = plugin; - this.cache = /* @__PURE__ */ new Map(); - } - initiate(middleware) { - this.middleware = middleware; - this.middleware.eventDispatch.addListener("onModify", this.refreshCache.bind(this)); - } - refreshCache(payload) { - if (this.supportedFileTypes.find((type) => type == payload.file.extension)) - this.parseCache(payload.file, true); - } - async parseCache(file, refresh) { - if (!file) +var InlineMenuComponent = (props) => { + const [mode2, setMode] = (0, import_react161.useState)(props.mobile ? 0 : 1); + const [colorMode, setColorMode] = (0, import_react161.useState)(null); + const makeMenu = (e5) => { + e5.preventDefault(); + const cm = props.cm ?? getActiveCM(props.plugin); + if (!cm) return; - const contents = await this.plugin.app.vault.cachedRead(getAbstractFileAtPath(this.plugin.app, file.path)); - const updatedCache = {}; - Object.keys(textCacheExperimental).forEach((key2) => { - const runner = textCacheExperimental[key2]; - updatedCache[key2] = runner(contents); + const end = cm.state.selection.main.to; + const insertChars = cm.state.sliceDoc(end - 1, end) == cm.state.lineBreak ? props.plugin.superstate.settings.menuTriggerChar : cm.state.lineBreak + props.plugin.superstate.settings.menuTriggerChar; + cm.dispatch({ + changes: { + from: end, + to: end, + insert: insertChars + }, + selection: { + head: end + insertChars.length, + anchor: end + insertChars.length + } }); - this.cache.set(file.path, updatedCache); - this.middleware.updateFileCache(file.path, updatedCache, refresh); - } -}; - -// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx -var import_obsidian3 = require("obsidian"); -var import_classnames13 = __toESM(require_classnames()); -var import_react165 = __toESM(require_react()); - -// src/adapters/obsidian/filetypes/frontmatter/frontMatterKeys.ts -var frontMatterKeys = (fm) => { - return Object.keys(fm ?? {}).filter((f2) => f2 != "position"); -}; - -// src/adapters/obsidian/ui/editors/markdownView/RemoteMarkdownHeaderView.tsx -var import_react164 = __toESM(require_react()); -var RemoteMarkdownHeaderView = (props) => { - const { name: name319, fm } = props; - const [collapsed, setCollapsed] = (0, import_react164.useState)(false); - const tags5 = fm.tags ?? []; - const [values2, setValues] = (0, import_react164.useState)({}); - const [columns, setColumns] = (0, import_react164.useState)([]); - (0, import_react164.useEffect)(() => { - const newCols = []; - const newValues = {}; - const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)); - const cols = fmKeys.map((f2) => ({ - table: "", - name: f2, - schemaId: "", - type: yamlTypeToMDBType(detectPropertyType(fm[f2], f2)) - })); - if (fm) { - newCols.push(...cols); - Object.keys(fm).forEach((c3) => { - newValues[c3] = parseProperty(c3, fm[c3]); + }; + const toggleMarkAction = (e5, s4) => { + e5.preventDefault(); + const cm = props.cm ?? getActiveCM(props.plugin); + if (!cm) + return; + if (s4.mark) { + cm.dispatch({ + annotations: toggleMark.of(s4.mark) }); + return; } - setValues(newValues); - setColumns(newCols); - }, []); - const pathState = (0, import_react164.useMemo)( - () => ({ - name: name319, - path: name319, - readOnly: true, - type: "note", - label: { - sticker: fm.sticker, - color: fm.color, - name: name319 + const selection2 = cm.state.selection.main; + const selectedText = cm.state.sliceDoc(selection2.from, selection2.to); + cm.dispatch({ + changes: { + from: selection2.from, + to: selection2.to, + insert: s4.value.substring(0, s4.insertOffset) + selectedText + s4.value.substring(s4.insertOffset) }, - metadata: { - property: { - banner: fm.banner - } + selection: s4.cursorOffset ? { + anchor: selection2.from + s4.value.substring(0, s4.insertOffset).length + selectedText.length + s4.cursorOffset, + head: selection2.from + s4.value.substring(0, s4.insertOffset).length + selectedText.length + s4.cursorOffset + } : { + anchor: selection2.from + s4.value.substring(0, s4.insertOffset).length, + head: selection2.from + s4.value.substring(0, s4.insertOffset).length + selectedText.length } - }), - [fm, name319] - ); - return /* @__PURE__ */ import_react164.default.createElement(PathProvider, { - superstate: props.superstate, - path: props.name, - pathState, - readMode: true - }, pathState.metadata.property.banner && /* @__PURE__ */ import_react164.default.createElement(BannerView, { - superstate: props.superstate - }), /* @__PURE__ */ import_react164.default.createElement("div", { - className: "mk-path-context-component" - }, /* @__PURE__ */ import_react164.default.createElement("div", { - className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}` - }, /* @__PURE__ */ import_react164.default.createElement(import_react164.default.Fragment, null, fm.sticker ? /* @__PURE__ */ import_react164.default.createElement("div", { - className: "mk-header-icon" - }, /* @__PURE__ */ import_react164.default.createElement("div", { - className: `mk-path-icon` - }, /* @__PURE__ */ import_react164.default.createElement("div", { + }); + }; + const makeMode = () => /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null, /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.makeMenu : void 0, + onMouseDown: (e5) => { + makeMenu(e5); + }, + className: "mk-mark", dangerouslySetInnerHTML: { - __html: props.superstate.ui.getSticker(fm.sticker) + __html: props.plugin.superstate.ui.getSticker("ui//mk-make-slash") } - }))) : /* @__PURE__ */ import_react164.default.createElement(import_react164.default.Fragment, null), /* @__PURE__ */ import_react164.default.createElement("div", { - className: "mk-inline-title inline-title" - }, pathNameToString(name319))))), !collapsed ? /* @__PURE__ */ import_react164.default.createElement("div", { - className: "mk-path-context-component" - }, /* @__PURE__ */ import_react164.default.createElement(import_react164.default.Fragment, null, columns.map((f2, i4) => /* @__PURE__ */ import_react164.default.createElement(DataPropertyView, { - key: i4, - superstate: props.superstate, - initialValue: values2[f2.name], - row: {}, - column: { ...f2, table: "" }, - editMode: 2 /* EditModeView */, - updateValue: () => { + }), /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.selectStyle : void 0, + onMouseDown: () => { + setMode(1); }, - updateFieldValue: (fieldValue, value) => { + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//mk-make-style") + } + }), /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.image : void 0, + onMouseDown: () => { + const view = getActiveMarkdownView(props.plugin); + props.plugin.app.commands.commands["editor:attach-file"].editorCallback(view.editor, view); }, - contextTable: {} - })))) : /* @__PURE__ */ import_react164.default.createElement(import_react164.default.Fragment, null)); -}; - -// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx -var FileLinkViewComponent = (props) => { - const ref2 = (0, import_react165.useRef)(null); - const [markdown, setMarkdown] = (0, import_react165.useState)(""); - const [fm, setFM] = (0, import_react165.useState)({}); - (0, import_react165.useEffect)(() => { - if (ref2.current) { - import_obsidian3.MarkdownRenderer.render( - props.app, - markdown, - ref2.current, - props.path, - props.component + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//mk-make-attach") + } + }), /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.toggleKeyboard : void 0, + onMouseDown: () => { + const view = getActiveMarkdownView(props.plugin); + props.plugin.app.commands.commands["editor:indent-list"].editorCallback(view.editor, view); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//mk-make-indent") + } + }), /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.toggleKeyboard : void 0, + onMouseDown: () => { + const view = getActiveMarkdownView(props.plugin); + props.plugin.app.commands.commands["editor:unindent-list"].editorCallback(view.editor, view); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//mk-make-unindent") + } + }), /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.toggleKeyboard : void 0, + onMouseDown: () => { + const view = getActiveMarkdownView(props.plugin); + props.plugin.app.commands.commands["editor:toggle-keyboard"].editorCallback(view.editor, view); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//mk-make-keyboard") + } + })); + const colorsMode = () => /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null, /* @__PURE__ */ import_react161.default.createElement("div", { + className: "mk-mark", + onMouseDown: () => { + setColorMode(null); + setMode(1); + }, + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//mk-ui-close") + } + }), colors.map((c3, i4) => /* @__PURE__ */ import_react161.default.createElement("div", { + key: i4, + onMouseDown: () => { + setMode(1); + setColorMode(null); + const cm = props.cm ?? getActiveCM(props.plugin); + if (!cm) + return; + const selection2 = cm.state.selection.main; + const selectedText = cm.state.sliceDoc( + selection2.from, + selection2.to ); - const observer = new MutationObserver(() => { - const links = ref2.current.querySelectorAll("a"); - links.forEach((link) => { - if (link.getAttribute("href").endsWith(".md")) { - link.addEventListener("click", (event) => { - event.preventDefault(); - }); - } - }); + cm.dispatch({ + changes: { + from: selection2.from, + to: selection2.to, + insert: colorMode.prefix + c3[1] + colorMode.suffix + selectedText + colorMode.closeTag + } }); - observer.observe(ref2.current, { childList: true, subtree: true }); - return () => observer.disconnect(); + }, + className: "mk-color", + style: { background: c3[1] } + }))); + function getMarkdownListIndentLevel(line) { + const regex = /^(\s*)(-|\d+\.)\s+(\[[ x]\]\s+)?/; + const match2 = line.match(regex); + if (match2) { + return match2[1].length; } - }, [markdown]); - (0, import_react165.useEffect)(() => { - if (props.superstate.pathsIndex.get(props.path)) { - props.superstate.spaceManager.readPath(props.path).then((f2) => { - const match2 = f2.match(regexYaml); - if (match2) { - setMarkdown(f2.replace(match2[0], "")); - const yamlContent = match2[1]; - setFM((0, import_obsidian3.parseYaml)(yamlContent)); - } else { - setMarkdown(f2); + return -1; + } + function unindentText(text2, levels) { + const createIndentRegex = (count3) => { + return new RegExp(`^([\\t]|[ ]{2,4}){0,${count3}}`, "gm"); + }; + const regex = createIndentRegex(levels); + return text2.replace(regex, ""); + } + function removeListFormatting(text2) { + const regex = /^(\s*)([-*+]|\d+\.)\s+(\[[ x]\]\s+)?/gm; + return text2.replace(regex, ""); + } + const transformMultiline = async () => { + const firstLine = props.cm.state.doc.lineAt( + props.cm.state.selection.main.from + ); + const startIndent = getMarkdownListIndentLevel( + props.cm.state.sliceDoc(firstLine.from, firstLine.to) + ); + const lineStart = props.cm.state.doc.lineAt( + props.cm.state.selection.main.from + ).number; + const lineEnd = props.cm.state.doc.lineAt( + props.cm.state.selection.main.to + ).number; + const changes = []; + const infoField = props.cm.state.field(import_obsidian2.editorInfoField, false); + const file = infoField.file; + if (file) { + const space2 = props.plugin.superstate.spacesIndex.get(file.parent.path); + if (space2) { + for (let i4 = lineStart; i4 <= lineEnd; i4++) { + const line = props.cm.state.doc.line(i4); + const indentLevel = getMarkdownListIndentLevel(line.text); + const newText = removeListFormatting(line.text); + const space3 = props.plugin.superstate.spacesIndex.get( + file.parent.path + ); + const newFile = await newPathInSpace( + props.plugin.superstate, + space3, + "md", + newText, + true + ); + changes.push({ + from: line.to - newText.length, + to: line.to, + insert: `[[${newFile}|${newText}]]` + }); } - }); - return; + props.cm.dispatch({ + changes + }); + } } - props.superstate.spaceManager.pathExists(props.path).then((f2) => { - if (f2) { - props.superstate.spaceManager.readPath(props.path).then((f3) => { - const match2 = f3.match(regexYaml); - if (match2) { - setMarkdown(f3.replace(match2[0], "")); - const yamlContent = match2[1]; - setFM((0, import_obsidian3.parseYaml)(yamlContent)); - } else { - setMarkdown(f3); + }; + const linkText = (e5) => { + const rect = e5.currentTarget.getBoundingClientRect(); + showLinkMenu( + rect, + windowFromDocument(e5.view.document), + props.plugin.superstate, + (link) => { + const currentSelection = props.cm.state.selection.main; + const selectedText = props.cm.state.sliceDoc( + currentSelection.from, + currentSelection.to + ); + const changes = [ + { + from: currentSelection.from, + to: currentSelection.to, + insert: `[[${link}|${selectedText}]]` } + ]; + props.cm.dispatch({ + changes }); - } else { - fetch(props.path).then((res) => res.text()).then((f3) => { - const match2 = f3.match(regexYaml); - if (match2) { - setMarkdown(f3.replace(match2[0], "")); - const yamlContent = match2[1]; - setFM((0, import_obsidian3.parseYaml)(yamlContent)); - } else { - setMarkdown(f3); + } + ); + }; + const transformText = (collapseMode) => { + const currentLine = props.cm.state.doc.lineAt( + props.cm.state.selection.main.from + ); + const higherIndentLines = []; + let content5 = null; + if (collapseMode > 0) { + const currentLineIndex = props.cm.state.doc.lineAt( + props.cm.state.selection.main.from + ).number; + const indentLevel = getMarkdownListIndentLevel(currentLine.text); + let i4 = currentLineIndex + 1; + while (i4 <= props.cm.state.doc.lines) { + const currentLine2 = props.cm.state.doc.line(i4); + if (getMarkdownListIndentLevel(currentLine2.text) > indentLevel) { + higherIndentLines.push(currentLine2); + } + if (getMarkdownListIndentLevel(currentLine2.text) <= indentLevel) + break; + i4++; + } + if (collapseMode == 1) { + content5 = higherIndentLines.map((f2) => unindentText(f2.text, indentLevel + 1)).join("\n"); + } + } + const currentLineEnd = props.cm.state.selection.main.to; + const currentSelection = props.cm.state.selection.main; + const infoField = props.cm.state.field(import_obsidian2.editorInfoField, false); + const file = infoField.file; + const selectedText = props.cm.state.sliceDoc( + currentSelection.from, + currentSelection.to + ); + if (file) { + const space2 = props.plugin.superstate.spacesIndex.get(file.parent.path); + if (space2) { + const newPath = sanitizeFileName(selectedText).trim(); + newPathInSpace( + props.plugin.superstate, + space2, + "md", + newPath, + true, + content5 + ).then((f2) => { + if (f2) { + const changes = [ + { + from: currentSelection.from, + to: currentSelection.to, + insert: `[[${f2}|${selectedText}]]` + } + ]; + if (collapseMode == 1) { + changes.push({ + from: props.cm.state.doc.lineAt(currentSelection.from + 1).to, + to: props.cm.state.doc.line( + currentLine.number + higherIndentLines.length + ).to, + insert: "" + }); + } + props.cm.dispatch({ + changes + }); } }); } + } + }; + const marksMode = () => /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null, props.mobile ? /* @__PURE__ */ import_react161.default.createElement("div", { + className: "mk-mark", + onMouseDown: () => { + setMode(0); + }, + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//mk-ui-close") + } + }) : /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null), resolveStyles().map((s4, i4) => { + return /* @__PURE__ */ import_react161.default.createElement(Mark, { + plugin: props.plugin, + key: i4, + i: i4, + style: s4, + active: props.activeMarks.find((f2) => f2 == s4.mark) ? true : false, + toggleMarkAction }); - }, [props.path]); - return /* @__PURE__ */ import_react165.default.createElement("div", { - className: (0, import_classnames13.default)( - "markdown-preview-view markdown-rendered node-insert-event allow-fold-headings show-indentation-guide allow-fold-lists show-frontmatter", - props.superstate.settings.readableLineWidth ? "is-readable-line-width" : "" - ) - }, !props.flow && /* @__PURE__ */ import_react165.default.createElement("div", { - className: "mk-remote-header" - }, /* @__PURE__ */ import_react165.default.createElement(RemoteMarkdownHeaderView, { - superstate: props.superstate, - name: fm.name ?? pathToString(props.path), - fm - })), /* @__PURE__ */ import_react165.default.createElement("div", { - className: "markdown-preview-sizer markdown-preview-section", - ref: ref2 - })); -}; - -// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx -var LINK_VIEW_TYPE = "mk-uri-view"; -var FileLinkView = class extends import_obsidian4.ItemView { - constructor(leaf, app2, viewType, superstate) { - super(leaf); - this.superstate = superstate; - this.navigation = true; - this.flow = false; - this.app = app2; - this.viewType = viewType; - } - getViewType() { - return LINK_VIEW_TYPE; - } - getDisplayText() { - return this.path; - } - async onClose() { - this.destroy(); - } - destroy() { - if (this.root) - this.root.unmount(); - } - async onOpen() { - this.destroy(); - } - async setState(state, result) { - this.path = state.path; - this.flow = state.flow; - this.constructView(this.path); - const displayName = this.path; - await super.setState(state, result); - this.leaf.tabHeaderInnerTitleEl.innerText = displayName; - this.leaf.view.titleEl = displayName; - const headerEl = this.leaf.view.headerEl; - if (headerEl) { - headerEl.querySelector(".view-header-title").innerText = displayName; + }), /* @__PURE__ */ import_react161.default.createElement("div", { + className: "mk-divider" + }), /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": i18n_default.styles.blocklink, + onClick: (e5) => { + linkText(e5); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker( + "ui//mk-mark-blocklink" + ) } - result.history = true; - return; - } - getState() { - const state = super.getState(); - state.path = this.path; - state.flow = this.flow; - return state; - } - constructView(path2) { - this.destroy(); - this.root = this.superstate.ui.createRoot(this.contentEl); - this.root.render( - /* @__PURE__ */ import_react166.default.createElement("div", { - className: "markdown-reading-view" - }, /* @__PURE__ */ import_react166.default.createElement(FileLinkViewComponent, { - app: this.app, - component: this, - superstate: this.superstate, - path: path2, - flow: this.flow - })) - ); - } + }), /* @__PURE__ */ import_react161.default.createElement("div", { + className: "mk-mark-group" + }, /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": "New Note", + onMouseDown: () => { + transformText(0); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//new-note") + } + })), props.plugin.superstate.settings.inlineStylerColors ? /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null, /* @__PURE__ */ import_react161.default.createElement("div", { + className: "mk-divider" + }), /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.styles.textColor : void 0, + onMouseDown: () => { + setMode(2); + setColorMode({ + prefix: ``, + closeTag: "" + }); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker("ui//mk-mark-color") + } + }), /* @__PURE__ */ import_react161.default.createElement("div", { + "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.styles.highlight : void 0, + onMouseDown: () => { + setMode(2); + setColorMode({ + prefix: ``, + closeTag: "" + }); + }, + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: props.plugin.superstate.ui.getSticker( + "ui//mk-mark-highlight" + ) + } + })) : /* @__PURE__ */ import_react161.default.createElement(import_react161.default.Fragment, null)); + return /* @__PURE__ */ import_react161.default.createElement("div", { + className: (0, import_classnames14.default)("mk-style-menu", props.mobile ? "" : "menu"), + onMouseDown: (e5) => e5.preventDefault() + }, mode2 == 0 && props.mobile ? makeMode() : mode2 == 2 ? colorsMode() : marksMode()); }; -// src/adapters/obsidian/utils/file.ts -var import_obsidian7 = require("obsidian"); +// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/inlineStyler.tsx +var import_react162 = __toESM(require_react()); +var cursorTooltipField = (plugin) => import_state15.StateField.define({ + create: getCursorTooltips(plugin), + update(tooltips2, tr) { + if (!tr.docChanged && !tr.selection) + return tooltips2; + return getCursorTooltips(plugin)(tr.state); + }, + provide: (f2) => showTooltip.computeN([f2], (state) => state.field(f2)) +}); +var getCursorTooltips = (plugin) => (state) => { + return state.selection.ranges.filter((range2) => !range2.empty).map((range2) => { + const expandedRange = expandRange(range2, state); + const line = state.doc.lineAt(range2.head); + const activeMarks = oMarks.map((f2) => rangeIsMark(state, f2, expandedRange) ? f2.mark : "").filter((f2) => f2 != ""); + return { + pos: Math.min(range2.head, range2.anchor), + above: true, + strictSide: true, + arrow: false, + create: (view) => { + const dom = document.createElement("div"); + dom.className = "cm-tooltip-cursor"; + const reactElement = plugin.ui.createRoot(dom); + reactElement.render( + /* @__PURE__ */ import_react162.default.createElement(import_react162.default.Fragment, null, /* @__PURE__ */ import_react162.default.createElement(InlineMenuComponent, { + plugin, + cm: view, + activeMarks, + mobile: false + })) + ); + return { dom }; + } + }; + }); +}; +function cursorTooltip(plugin) { + return cursorTooltipField(plugin); +} -// src/core/react/components/System/SystemSettings.tsx -var import_react172 = __toESM(require_react()); +// src/adapters/obsidian/ui/editors/markdownView/placeholder.ts +var import_state16 = require("@codemirror/state"); +var import_view17 = require("@codemirror/view"); +var placeholderLine = (plugin) => import_view17.Decoration.line({ + attributes: { "data-ph": i18n_default.labels.placeholder.replace("${1}", plugin.superstate.settings.menuTriggerChar) }, + class: "mk-placeholder" +}); +var placeholderExtension = (plugin) => import_state16.StateField.define({ + create() { + return import_view17.Decoration.none; + }, + update(value, tr) { + const builder = new import_state16.RangeSetBuilder(); + const currentLine = tr.state.doc.lineAt(tr.state.selection.main.head); + if (currentLine?.length == 0) + builder.add(currentLine.from, currentLine.from, placeholderLine(plugin)); + const dec = builder.finish(); + return dec; + }, + provide: (f2) => import_view17.EditorView.decorations.from(f2) +}); -// src/core/assets/icons.ts -var uiIconSet = { - "rows": ``, - "close": ` - - `, - "flow-hover": ` - - `, - "folder": ` +// src/adapters/obsidian/ui/editors/markdownView/cmExtensions.ts +var cmExtensions = (plugin, mobile) => { + const extensions = [...editBlockExtensions()]; + if (plugin.superstate.settings.makerMode) { + extensions.push( + ...[toggleMarkExtension, tooltips({ parent: document.body })] + ); + if (!mobile && plugin.superstate.settings.inlineStyler) { + extensions.push(cursorTooltip(plugin)); + } + if (plugin.superstate.settings.flowMenuEnabled && plugin.superstate.settings.makeMenuPlaceholder) + extensions.push(placeholderExtension(plugin)); + if (plugin.superstate.settings.editorFlow) { + extensions.push( + flowTypeStateField, + preloadFlowEditor, + flowEditorField(plugin), + flowEditorInfo, + flowIDStateField, + flowViewUpdates(plugin) + ); + if (plugin.superstate.settings.internalLinkClickFlow) { + extensions.push(internalLinkToggle); + } else { + extensions.push(internalLinkHover(plugin)); + } + } + } + return extensions; +}; + +// src/core/react/components/System/SystemSettings.tsx +var import_react168 = __toESM(require_react()); + +// src/core/assets/icons.ts +var uiIconSet = { + "rows": ``, + "close": ` + + `, + "flow-hover": ` + + `, + "folder": ` `, "open-link": ` @@ -138317,62 +138734,84 @@ var uiIconSet = { `, "mk-mark-strong": ` - - + + + `, "mk-mark-em": ` - - `, + +`, "mk-mark-strikethrough": ` - - - + + + + `, "mk-mark-code": ` - - - - + + + + + `, "mk-mark-link": ` - - `, + + +`, "mk-mark-blocklink": ` - - - - - `, + + + + + +`, "mk-mark-highlight": ` - - - - - - `, - "mk-make-attach": ` - - - - - `, - "mk-make-keyboard": ` - - - - `, - "mk-make-slash": ` - - - - `, - "mk-make-style": ` - - `, + + + + + + +`, + "mk-make-attach": ` + + + + + +`, + "mk-make-keyboard": ` + + + + + + + + + + + + +`, + "mk-make-slash": ` + + + + + + +`, + "mk-make-style": ` + + + +`, "mk-mark-color": ` - - - `, + + + +`, "any": ` @@ -138808,20 +139247,21 @@ var uiIconSet = { "tabs": ``, "move": ``, "wildcard": ``, - "replace": `` + "replace": ``, + "alias": `` }; // src/core/react/components/System/IconsSet.tsx -var import_react167 = __toESM(require_react()); +var import_react163 = __toESM(require_react()); var IconSet = (props) => { - const [iconSets, setIconSets] = import_react167.default.useState([]); - const [icons, setIcons] = import_react167.default.useState([]); - (0, import_react167.useEffect)(() => { + const [iconSets, setIconSets] = import_react163.default.useState([]); + const [icons, setIcons] = import_react163.default.useState([]); + (0, import_react163.useEffect)(() => { Object.keys(uiIconSet).filter((f2, i4) => i4 < 10).forEach((icon) => { setIcons((f2) => [...f2, "ui//" + icon]); }); }, []); - return /* @__PURE__ */ import_react167.default.createElement("div", null, /* @__PURE__ */ import_react167.default.createElement("div", null, icons.map((c3, i4) => /* @__PURE__ */ import_react167.default.createElement("div", { + return /* @__PURE__ */ import_react163.default.createElement("div", null, /* @__PURE__ */ import_react163.default.createElement("div", null, icons.map((c3, i4) => /* @__PURE__ */ import_react163.default.createElement("div", { key: i4, className: "mk-icon-small", dangerouslySetInnerHTML: { @@ -138831,28 +139271,28 @@ var IconSet = (props) => { }; // src/core/react/components/System/ImageSet.tsx -var import_react168 = __toESM(require_react()); +var import_react164 = __toESM(require_react()); var ImageSet = (props) => { - const [images, setImages] = import_react168.default.useState([]); - const [currentSet, setCurrentSet] = import_react168.default.useState(null); + const [images, setImages] = import_react164.default.useState([]); + const [currentSet, setCurrentSet] = import_react164.default.useState(null); const addImage = (image) => { setImages([...images, image]); }; - return /* @__PURE__ */ import_react168.default.createElement("div", null); + return /* @__PURE__ */ import_react164.default.createElement("div", null); }; // src/core/react/components/System/MaterialsSet.tsx -var import_react169 = __toESM(require_react()); +var import_react165 = __toESM(require_react()); var MaterialsSet = (props) => { - const [materials, setMaterials] = import_react169.default.useState([]); - return /* @__PURE__ */ import_react169.default.createElement("div", null, /* @__PURE__ */ import_react169.default.createElement("div", null, colors.map((c3, i4) => /* @__PURE__ */ import_react169.default.createElement("div", { + const [materials, setMaterials] = import_react165.default.useState([]); + return /* @__PURE__ */ import_react165.default.createElement("div", null, /* @__PURE__ */ import_react165.default.createElement("div", null, colors.map((c3, i4) => /* @__PURE__ */ import_react165.default.createElement("div", { key: i4, "aria-label": c3[0], onMouseDown: () => { }, className: "mk-color", style: { background: c3[1] } - })), /* @__PURE__ */ import_react169.default.createElement("div", null, "Add")), /* @__PURE__ */ import_react169.default.createElement("div", null, colorsBase.map((c3, i4) => /* @__PURE__ */ import_react169.default.createElement("div", { + })), /* @__PURE__ */ import_react165.default.createElement("div", null, "Add")), /* @__PURE__ */ import_react165.default.createElement("div", null, colorsBase.map((c3, i4) => /* @__PURE__ */ import_react165.default.createElement("div", { key: i4, "aria-label": c3[0], onMouseDown: () => { @@ -138863,9 +139303,9 @@ var MaterialsSet = (props) => { }; // src/core/react/components/System/SystemActions.tsx -var import_react170 = __toESM(require_react()); +var import_react166 = __toESM(require_react()); var SystemActionsEditor = (props) => { - const [selectedCommand, setSelectedCommand] = (0, import_react170.useState)(); + const [selectedCommand, setSelectedCommand] = (0, import_react166.useState)(); const saveCommand = (command) => { props.superstate.spaceManager.saveSystemCommand( selectedCommand.library, @@ -138878,44 +139318,44 @@ var SystemActionsEditor = (props) => { null ); }; - return /* @__PURE__ */ import_react170.default.createElement("div", { + return /* @__PURE__ */ import_react166.default.createElement("div", { style: { display: "flex" } - }, selectedCommand && /* @__PURE__ */ import_react170.default.createElement("div", null, /* @__PURE__ */ import_react170.default.createElement(SpaceCommand, { + }, selectedCommand && /* @__PURE__ */ import_react166.default.createElement("div", null, /* @__PURE__ */ import_react166.default.createElement(SpaceCommand, { superstate: props.superstate, action: "spaces://$actions/" + selectedCommand.library + "/#;" + selectedCommand.command.schema.id }))); }; // src/core/react/components/System/Templates.tsx -var import_react171 = __toESM(require_react()); +var import_react167 = __toESM(require_react()); var Templates = (props) => { - return /* @__PURE__ */ import_react171.default.createElement("div", null, /* @__PURE__ */ import_react171.default.createElement("h1", null, "Templates")); + return /* @__PURE__ */ import_react167.default.createElement("div", null, /* @__PURE__ */ import_react167.default.createElement("h1", null, "Templates")); }; // src/core/react/components/System/SystemSettings.tsx var SystemSettings = (props) => { - const [tab, setTab] = (0, import_react172.useState)(0); - const [loadout, setLoadOut] = (0, import_react172.useState)(); + const [tab, setTab] = (0, import_react168.useState)(0); + const [loadout, setLoadOut] = (0, import_react168.useState)(); const loadouts = props.superstate.loadouts; - return /* @__PURE__ */ import_react172.default.createElement("div", null, /* @__PURE__ */ import_react172.default.createElement("div", { + return /* @__PURE__ */ import_react168.default.createElement("div", null, /* @__PURE__ */ import_react168.default.createElement("div", { style: { display: "flex", flexDirection: "column" } - }, "System Name", /* @__PURE__ */ import_react172.default.createElement("input", { + }, "System Name", /* @__PURE__ */ import_react168.default.createElement("input", { value: props.superstate.settings.systemName, onChange: (e5) => { props.superstate.settings.systemName = e5.target.value; } - }), /* @__PURE__ */ import_react172.default.createElement("div", null, /* @__PURE__ */ import_react172.default.createElement("h2", null, "Loadouts"), loadouts.map((l2, i4) => /* @__PURE__ */ import_react172.default.createElement("div", { + }), /* @__PURE__ */ import_react168.default.createElement("div", null, /* @__PURE__ */ import_react168.default.createElement("h2", null, "Loadouts"), loadouts.map((l2, i4) => /* @__PURE__ */ import_react168.default.createElement("div", { key: i4, onClick: () => { setLoadOut(l2); } - }, l2.name)), /* @__PURE__ */ import_react172.default.createElement("button", { + }, l2.name)), /* @__PURE__ */ import_react168.default.createElement("button", { dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//plus") }, onClick: (e5) => props.superstate.ui.openModal( "New Loadout", - (_props) => /* @__PURE__ */ import_react172.default.createElement(InputModal, { + (_props) => /* @__PURE__ */ import_react168.default.createElement(InputModal, { value: "", saveLabel: "Save", hide: _props.hide, @@ -138927,1801 +139367,456 @@ var SystemSettings = (props) => { }), windowFromDocument(e5.view.document) ) - })), /* @__PURE__ */ import_react172.default.createElement("div", null, "Appearance", /* @__PURE__ */ import_react172.default.createElement("h2", null, "Typography")), "Space View", /* @__PURE__ */ import_react172.default.createElement("p", null, "Font"), "Palette Default New Template", /* @__PURE__ */ import_react172.default.createElement(MaterialsSet, { + })), /* @__PURE__ */ import_react168.default.createElement("div", null, "Appearance", /* @__PURE__ */ import_react168.default.createElement("h2", null, "Typography")), "Space View", /* @__PURE__ */ import_react168.default.createElement("p", null, "Font"), "Palette Default New Template", /* @__PURE__ */ import_react168.default.createElement(MaterialsSet, { superstate: props.superstate - }), "Icons", /* @__PURE__ */ import_react172.default.createElement(IconSet, { + }), "Icons", /* @__PURE__ */ import_react168.default.createElement(IconSet, { superstate: props.superstate - }), "Images", /* @__PURE__ */ import_react172.default.createElement(ImageSet, { + }), "Images", /* @__PURE__ */ import_react168.default.createElement(ImageSet, { superstate: props.superstate - }), /* @__PURE__ */ import_react172.default.createElement(Templates, { + }), /* @__PURE__ */ import_react168.default.createElement(Templates, { superstate: props.superstate - }), /* @__PURE__ */ import_react172.default.createElement(SystemActionsEditor, { + }), /* @__PURE__ */ import_react168.default.createElement(SystemActionsEditor, { superstate: props.superstate }))); }; // src/adapters/obsidian/SpaceViewContainer.tsx -var import_obsidian5 = require("obsidian"); +var import_obsidian3 = require("obsidian"); var import_react173 = __toESM(require_react()); -var SPACE_VIEW_TYPE = "mk-space"; -var SpaceViewContainer = class extends import_obsidian5.ItemView { - constructor(leaf, superstate, ObsidianUI2, viewType) { - super(leaf); - this.navigation = true; - this.superstate = superstate; - this.viewType = viewType; - this.ui = ObsidianUI2; - } - getViewType() { - return SPACE_VIEW_TYPE; - } - getDisplayText() { - return pathDisplayName(this.path, this.superstate); - } - async onClose() { - this.destroy(); - } - destroy() { - this.superstate.eventsDispatcher.removeListener( - "spaceChanged", - this.changePath - ); - this.superstate.eventsDispatcher.removeListener( - "spaceDeleted", - this.closePath - ); - this.root?.unmount(); - } - async onOpen() { - this.destroy(); - } - changePath(payload) { - if (this.path == payload.path) { - this.leaf.setViewState({ - type: SPACE_VIEW_TYPE, - state: { path: payload.newPath } - }); - } - } - closePath(payload) { - if (this?.path == payload.path) { - this.leaf.setViewState({ - type: null - }); - } - } - async setState(state, result) { - this.path = state.path; - if (!this.path) - return; - this.constructNote(this.path); - const displayName = pathDisplayName(this.path, this.superstate); - const spaceCache = this.superstate.spacesIndex.get(this.path); - await super.setState(state, result); - this.leaf.tabHeaderInnerTitleEl.innerText = displayName; - this.leaf.view.titleEl = displayName; - const headerEl = this.leaf.view.headerEl; - if (headerEl && spaceCache) { - headerEl.querySelector(".view-header-title").innerText = displayName; - if (spaceCache.type == "folder") { - const titleParent = headerEl.querySelector(".view-header-title-parent"); - titleParent.innerHTML = ""; - const parentPaths = getParentFolderPaths(spaceCache.path); - if (titleParent) { - parentPaths.forEach((f2) => { - const breadcrumb = titleParent.createEl("span"); - breadcrumb.addClass("view-header-breadcrumb"); - breadcrumb.innerText = folderPathToString(f2); - breadcrumb.addEventListener( - "click", - () => this.superstate.ui.openPath(f2, false) - ); - const breadcrumbSeparator = titleParent.createEl("span"); - breadcrumbSeparator.addClass("view-header-breadcrumb-separator"); - breadcrumbSeparator.innerText = "/"; - }); - } - } - } - result.history = true; - return; - } - getState() { - const state = super.getState(); - state.path = this.path; - return state; - } - constructNote(path2) { - this.destroy(); - this.superstate.eventsDispatcher.addListener( - "spaceChanged", - this.changePath, - 0, - this - ); - this.superstate.eventsDispatcher.addListener( - "spaceDeleted", - this.closePath, - 0, - this - ); - this.root = this.ui.createRoot(this.contentEl); - if (this.root) { - this.root.render( - /* @__PURE__ */ import_react173.default.createElement("div", { - className: "mk-space-view" - }, path2 == "spaces://$settings" ? /* @__PURE__ */ import_react173.default.createElement(SystemSettings, { - superstate: this.superstate - }) : /* @__PURE__ */ import_react173.default.createElement(SpaceView, { - path: path2, - superstate: this.superstate, - key: path2, - readOnly: false - }, /* @__PURE__ */ import_react173.default.createElement("div", { - className: "mk-space-scroller markdown-source-view mod-cm6 is-readable-line-width" - }, /* @__PURE__ */ import_react173.default.createElement(SpaceInner, { - superstate: this.superstate, - header: true - })))) - ); - } else { - this.ui.manager.eventsDispatch.addOnceListener("windowReady", () => { - this.constructNote(path2); - }); - } - } -}; -// src/adapters/obsidian/ui/editors/SpaceFragmentViewComponent.tsx -var import_obsidian6 = require("obsidian"); -var import_react174 = __toESM(require_react()); -var SPACE_FRAGMENT_VIEW_TYPE = "mk-space-fragment"; -var SpaceFragmentView = class extends import_obsidian6.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.navigation = true; - this.plugin = plugin; - } - getViewType() { - return SPACE_FRAGMENT_VIEW_TYPE; - } - getDisplayText() { - return this.path; - } - async onClose() { - this.destroy(); - } - onunload() { - this.destroy(); - } - destroy() { - if (this.root) - this.root.unmount(); - } - async onOpen() { - this.destroy(); - } - async setState(state, result) { - this.path = state.path; - this.source = state.source; - this.flow = state.flow; - this.constructInlineContext(); - await super.setState(state, result); - const title = pathDisplayName(this.path, this.plugin.superstate); - this.leaf.tabHeaderInnerTitleEl.innerText = title; - this.leaf.view.titleEl = title; - const headerEl = this.leaf.view.headerEl; - if (headerEl) { - headerEl.querySelector(".view-header-title").innerText = title; - } - return; - } - getState() { - const state = super.getState(); - state.path = this.path; - state.source = this.source; - state.flow = this.flow; - return state; - } - constructInlineContext() { - this.destroy(); - this.root = this.plugin.ui.createRoot(this.contentEl); - if (this.root) { - if (this.flow) { - this.root.render( - /* @__PURE__ */ import_react174.default.createElement(SpaceFragmentViewComponent, { - id: this.path, - superstate: this.plugin.superstate, - path: this.path, - source: this.source, - showTitle: true - }) - ); - } else { - this.root.render( - /* @__PURE__ */ import_react174.default.createElement(SpaceFragmentWrapper, { - superstate: this.plugin.superstate, - path: this.path - }, /* @__PURE__ */ import_react174.default.createElement(SpaceFragmentViewComponent, { - id: this.path, - superstate: this.plugin.superstate, - path: this.path, - source: this.source - })) - ); - } - } else { - this.plugin.ui.manager.eventsDispatch.addOnceListener( - "windowReady", - () => { - this.constructInlineContext(); - } - ); - } - } +// src/core/react/components/SpaceView/SpaceHeader.tsx +var import_react169 = __toESM(require_react()); +var SpaceHeader = (props) => { + const { readMode } = (0, import_react169.useContext)(PathContext); + const { spaceState } = (0, import_react169.useContext)(SpaceContext); + return /* @__PURE__ */ import_react169.default.createElement(import_react169.default.Fragment, null, /* @__PURE__ */ import_react169.default.createElement(BannerView, { + superstate: props.superstate + }), /* @__PURE__ */ import_react169.default.createElement("div", { + className: "mk-space-header" + }, /* @__PURE__ */ import_react169.default.createElement("div", { + className: "mk-path-context-label" + }, /* @__PURE__ */ import_react169.default.createElement(TitleComponent, { + superstate: props.superstate, + readOnly: readMode + })), spaceState?.type == "folder" && !readMode && props.superstate.settings.inlineContextProperties && /* @__PURE__ */ import_react169.default.createElement(HeaderPropertiesView, { + superstate: props.superstate, + collapseSpaces: true + }))); }; -// src/adapters/obsidian/utils/file.ts -var tFileToAFile = (file) => { - if (!file) - return null; - if (file instanceof import_obsidian7.TFile && file.stat) { - return { - isFolder: false, - name: file.basename, - filename: file.name, - path: file.path, - parent: file.parent?.path, - extension: file.extension, - ...file.stat - }; - } - return { - isFolder: true, - name: file.name, - filename: file.name, - path: file.path, - parent: file.parent?.path - }; -}; -var defaultConfigFile = async (plugin) => { - return await plugin.app.vault.adapter.read( - (0, import_obsidian7.normalizePath)(plugin.app.vault.configDir + "/app.json") - ); -}; -var fileExtensionForFile = (path2) => path2?.indexOf(".") > 0 ? path2.split(".").pop() : "md"; -var fileNameForFile = (path2) => path2?.indexOf("/") > 0 ? path2.split("/").pop().split(".").shift() : path2.split(".").shift(); -var uniqueFileName = (oldName, name319, extension, folder) => { - let newName = sanitizeFileName(name319); - let uniqueName = false; - let append = 1; - while (!uniqueName) { - if (!folder.children.some((f2) => f2.name == `${newName}.${extension}` && f2.name != oldName)) { - uniqueName = true; - } else { - newName = `${newName} ${append}`; - append += 1; - } - } - return `${newName}.${extension}`; -}; -function getAllAbstractFilesInVault(app2) { - const files = []; - const rootFolder = app2.vault.getRoot(); - function recursiveFx(folder) { - for (const child of folder.children) { - if (child instanceof import_obsidian7.TFolder) { - const childFolder = child; - if (childFolder.children) - recursiveFx(childFolder); - } - files.push(child); +// node_modules/@air/react-drag-to-select/dist/index.modern.js +var import_react170 = __toESM(require_react(), 1); +var import_react_dom10 = __toESM(require_react_dom(), 1); +var import_react_style_object_to_css = __toESM(require_react_style_object_to_css(), 1); +function a3() { + return a3 = Object.assign ? Object.assign.bind() : function(e5) { + for (var t7 = 1; t7 < arguments.length; t7++) { + var n3 = arguments[t7]; + for (var r2 in n3) + Object.prototype.hasOwnProperty.call(n3, r2) && (e5[r2] = n3[r2]); } - } - recursiveFx(rootFolder); - files.push(rootFolder); - return files; + return e5; + }, a3.apply(this, arguments); } -var openPath = async (leaf, path2, plugin, flow) => { - const uri = plugin.superstate.spaceManager.uriByString(path2); - if (!uri) - return; - if (uri.scheme == "https" || uri.scheme == "http") { - if (plugin.superstate.spacesIndex.has(path2)) { - const viewType = SPACE_VIEW_TYPE; - plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path: path2, flow } - }); - return; - } else if (plugin.superstate.pathsIndex.has(path2)) { - const viewType = LINK_VIEW_TYPE; - plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path: path2, flow } - }); - return; - } - window.open(uri.fullPath, "_blank"); - return; - } - if (uri.scheme == "obsidian") { - await leaf.setViewState({ - type: uri.authority - }); - return; - } - if (uri.ref) { - const cache2 = plugin.superstate.pathsIndex.get(uri.path); - if (cache2?.type == "space" || uri.scheme == "spaces") { - if (flow && uri.ref == "main") { - await leaf.setViewState({ - type: EMBED_SPACE_VIEW_TYPE, - state: { path: uri.fullPath } - }); - } else { - await leaf.setViewState({ - type: SPACE_FRAGMENT_VIEW_TYPE, - state: { path: uri.fullPath, flow } - }); - } - return; - } - } - if (uri.scheme == "spaces") { - openTagContext(leaf, uri.authority, plugin.app); - return; - } - plugin.files.getFile(path2).then((f2) => { - if (f2) { - if (f2.isFolder) { - openTFolder(leaf, getAbstractFileAtPath(plugin.app, f2.path), plugin, flow); - } else if (f2) { - openTFile(leaf, getAbstractFileAtPath(plugin.app, f2.path), plugin.app); - } else { - return; - } - } else { - if (path2.contains("/")) { - const folder = removeTrailingSlashFromFolder(getParentPathFromString(path2)); - const spaceFolder = plugin.superstate.spacesIndex.get(folder); - if (spaceFolder) { - newPathInSpace( - plugin.superstate, - spaceFolder, - fileExtensionForFile(path2), - fileNameForFile(path2) - ); - } - } else { - defaultSpace(plugin.superstate, plugin.superstate.pathsIndex.get(plugin.superstate.ui.activePath)).then((f3) => { - if (f3) - newPathInSpace( - plugin.superstate, - f3, - fileExtensionForFile(path2), - fileNameForFile(path2) - ); - }); +var s3 = ["style"]; +var d3 = (0, import_react170.forwardRef)((t7, u3) => { + let { style: d4 = {} } = t7, m4 = function(e5, t8) { + if (null == e5) + return {}; + var n3, r2, o2 = {}, l2 = Object.keys(e5); + for (r2 = 0; r2 < l2.length; r2++) + t8.indexOf(n3 = l2[r2]) >= 0 || (o2[n3] = e5[n3]); + return o2; + }(t7, s3); + const v2 = (0, import_react170.useRef)(null), f2 = (0, import_react170.useRef)(null), [, p] = (0, import_react170.useState)(0); + return (0, import_react170.useImperativeHandle)(u3, () => ({ getBoundingClientRect: () => { + var e5; + return null == (e5 = v2.current) ? void 0 : e5.getBoundingClientRect(); + }, getParentBoundingClientRect: () => { + var e5, t8; + return null == v2 || null == (e5 = v2.current) || null == (t8 = e5.parentElement) ? void 0 : t8.getBoundingClientRect(); + }, drawSelectionBox: (e5) => { + requestAnimationFrame(() => { + if (f2.current) { + const t8 = a3({ border: "1px solid #4C85D8", background: "rgba(155, 193, 239, 0.4)", position: "absolute", pointerEvents: "none" }, d4, { top: e5.top, left: e5.left, width: e5.width, height: e5.height }); + f2.current.style.cssText = (0, import_react_style_object_to_css.default)(t8); } - } - }); -}; -var getLeaf = (app2, location) => { - let leaf; - if (location == "system" || location == "hover") { - return null; - } else if (location == "right") { - leaf = app2.workspace.getRightLeaf(false); - } else if (location == "left") { - leaf = app2.workspace.getLeftLeaf(false); - } else { - leaf = app2.workspace.getLeaf(location); - } - return leaf; -}; -var openURL = async (url, app2, location) => { - if (location == "system") { - window.open(url, "_blank"); - return; - } - const leaf = getLeaf(app2, location); - if (url.endsWith(".md")) { - const viewType = LINK_VIEW_TYPE; - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path: url } - }); - await app2.workspace.requestSaveLayout(); - } else if (url.endsWith(".mdb")) { - const viewType = SPACE_VIEW_TYPE; - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path: url } - }); - await app2.workspace.requestSaveLayout(); - } else { - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: EMBED_SPACE_VIEW_TYPE, - state: { path: url } }); - } - if (import_obsidian7.Platform.isMobile) { - app2.workspace.leftSplit.collapse(); - } -}; -var openTFile = async (leaf, file, app2) => { - if (!file) - return; - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.openFile(file); -}; -var openTFolder = async (leaf, file, plugin, flow) => { - if (!plugin.superstate.settings.spaceViewEnabled) { - if (!plugin.superstate.settings.enableFolderNote) { - return; - } - const space2 = plugin.superstate.spacesIndex.get(file.path)?.space.notePath; - if (!space2) - return; - const spaceFile = getAbstractFileAtPath(plugin.app, space2); - if (!spaceFile) - return; - plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); - leaf.openFile(spaceFile); - return; - } - if (flow) { - await leaf.setViewState({ - type: EMBED_SPACE_VIEW_TYPE, - state: { path: file.path } - }); - } else { - plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: SPACE_VIEW_TYPE, - state: { path: file.path } - }); - await plugin.app.workspace.requestSaveLayout(); - if (import_obsidian7.Platform.isMobile) { - plugin.app.workspace.leftSplit.collapse(); - } - } -}; -var openTagContext = async (leaf, tag2, app2) => { - const viewType = SPACE_VIEW_TYPE; - app2.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ type: viewType, state: { path: "spaces://" + tag2 } }); - await app2.workspace.requestSaveLayout(); - if (import_obsidian7.Platform.isMobile) { - app2.workspace.leftSplit.collapse(); - } -}; -var getAbstractFileAtPath = (app2, path2) => { - return app2.vault.getAbstractFileByPath(path2); -}; - -// src/adapters/obsidian/utils/flow/flowEditor.ts -var getLineRangeFromRef = (path2, ref2, plugin) => { - if (!ref2) { - return [void 0, void 0]; - } - const cache2 = plugin.app.metadataCache.getCache(path2); - if (!cache2) - return [void 0, void 0]; - const headings = cache2.headings; - const blocks = cache2.blocks; - const sections = cache2.sections; - if (blocks && ref2.charAt(0) == "^" && blocks[ref2.substring(1)]) { - return [ - blocks[ref2.substring(1)].position.start.line + 1, - blocks[ref2.substring(1)].position.end.line + 1 - ]; - } - const heading5 = headings?.find((f2) => f2.heading.replace("#", " ") == ref2); - if (heading5) { - const index2 = headings.findIndex((f2) => f2.heading == heading5.heading); - const level = headings[index2]?.level; - const nextIndex2 = headings.findIndex( - (f2, i4) => i4 > index2 && f2.level <= level - ); - const start = plugin.superstate.settings.editorFlowStyle == "classic" ? heading5.position.start.line + 1 : heading5.position.start.line + 2; - if (index2 < headings.length - 1 && nextIndex2 != -1) { - return [start, headings[nextIndex2].position.end.line]; - } - return [start, sections[sections.length - 1].position.end.line + 1]; - } - return [void 0, void 0]; -}; -var loadFlowEditorByDOM = (plugin, el, view, id3) => { - setTimeout(async () => { - let counter = 0; - while (!el.parentElement && counter++ <= 50) - await sleep(50); - if (!el.parentElement) - return; - let dom = el; - while (!dom.hasClass("mk-floweditor") && !dom.hasClass("workspace") && dom.parentElement) { - dom = dom.parentElement; - } - if (!dom.hasClass("mk-floweditor") && !dom.hasClass("workspace") && !(dom.nodeName == "HTML")) { - return; - } - setTimeout(async () => { - let leafFound = false; - if (plugin.app.workspace.activeEditor) { - if (plugin.app.workspace.activeEditor?.editor?.cm.dom == view.dom) { - leafFound = true; - plugin.app.workspace.iterateLeaves((leaf) => { - if (leaf.view.editor?.cm.dom == view.dom) { - loadFlowEditorsForLeafForID( - leaf, - plugin.app.workspace.activeEditor.editor.cm, - plugin.app.workspace.activeEditor.file?.path, - plugin, - id3 - ); - } - }, plugin.app.workspace["rootSplit"]); - } - } - if (!leafFound) { - plugin.app.workspace.iterateLeaves((leaf) => { - const cm = leaf.view.editor?.cm; - if (cm && view.dom == cm.dom) { - leafFound = true; - loadFlowEditorsForLeafForID( - leaf, - cm, - leaf.view.file?.path, - plugin, - id3 - ); - } - }, plugin.app.workspace["rootSplit"]); - } + }, clearSelectionBox: () => { + requestAnimationFrame(() => { + f2.current && (f2.current.style.cssText = (0, import_react_style_object_to_css.default)({ top: 0, left: 0, width: 0, height: 0 })); }); - }); -}; -var loadFlowEditorsForLeafForID = (leaf, cm, source, plugin, id3) => { - const stateField = cm.state.field(flowEditorInfo, false); - if (!stateField) - return; - const flowInfo = stateField.find((f2) => f2.id == id3); - if (flowInfo && flowInfo.expandedState == 2) { - loadFlowEditor(leaf, cm, flowInfo, source, plugin); - } -}; -var loadFlowEditor = async (leaf, cm, flowEditorInfo2, source, plugin) => { - const dom = cm.dom.querySelector( - "#mk-flow-" + flowEditorInfo2.id - ); - const path2 = plugin.superstate.spaceManager.uriByString(flowEditorInfo2.link, source); - const basePath = plugin.superstate.spaceManager.resolvePath(path2.basePath, source); - if (dom) { - const spaceCache = plugin.superstate.spacesIndex.get(path2.basePath); - if (spaceCache) { - if (!dom.hasAttribute("ready")) { - dom.setAttribute("ready", ""); - plugin.superstate.ui.openPath(path2.fullPath, false, dom); + } })), (0, import_react170.useEffect)(() => { + p((e5) => e5 + 1); + }, []), import_react170.default.createElement("div", { ref: v2 }, v2.current ? import_react_dom10.default.createPortal(import_react170.default.createElement("div", a3({ ref: f2 }, m4)), v2.current) : null); +}); +var m3 = (e5, t7) => e5.left <= t7.left + t7.width && e5.left + e5.width >= t7.left && e5.top <= t7.top + t7.height && e5.top + e5.height >= t7.top; +function v(t7) { + const { onSelectionChange: r2, onSelectionEnd: o2, onSelectionStart: c3, isEnabled: i4 = true, selectionProps: s4 = {}, eventsElement: m4, shouldStartSelecting: v2 } = t7 || {}, f2 = (0, import_react170.useRef)(null), { cancelCurrentSelection: p } = function({ containerRef: e5, onSelectionChange: t8, onSelectionStart: r3, onSelectionEnd: o3, isEnabled: c4 = true, eventsElement: i5, shouldStartSelecting: s5 }) { + const d4 = (0, import_react170.useRef)(null), m5 = (0, import_react170.useRef)(null), v3 = (0, import_react170.useRef)(false), f3 = (0, import_react170.useRef)(t8), p2 = (0, import_react170.useRef)(r3), h3 = (0, import_react170.useRef)(o3), g = (0, import_react170.useRef)(), y3 = (0, import_react170.useRef)(c4); + f3.current = (0, import_react170.useCallback)((e6) => { + g.current = t8 ? requestAnimationFrame(() => { + t8(e6); + }) : void 0; + }, [t8]), p2.current = r3, h3.current = o3, y3.current = c4; + const b2 = (0, import_react170.useCallback)(() => { + var t9; + d4.current = null, m5.current = null, v3.current = false, null == (t9 = e5.current) || t9.clearSelectionBox(), "number" == typeof g.current && cancelAnimationFrame(g.current); + }, [e5]), S3 = (0, import_react170.useCallback)((t9, n3) => { + var r4, o4, l2; + return n3 || (n3 = null == (l2 = e5.current) ? void 0 : l2.getParentBoundingClientRect()), { x: t9.clientX - ("number" == typeof (null == (r4 = n3) ? void 0 : r4.left) ? n3.left : 0), y: t9.clientY - ("number" == typeof (null == (o4 = n3) ? void 0 : o4.top) ? n3.top : 0) }; + }, [e5]), E2 = (0, import_react170.useCallback)((t9, n3) => { + if (d4.current && m5.current) { + if (!n3) + return; + const l2 = (({ startPoint: e6, endPoint: t10 }) => ({ left: Math.min(e6.x, t10.x), top: Math.min(e6.y, t10.y), width: Math.abs(e6.x - t10.x), height: Math.abs(e6.y - t10.y) }))({ startPoint: d4.current, endPoint: m5.current }), u3 = a3({}, l2, { top: l2.top + ((null == n3 ? void 0 : n3.top) || 0), left: l2.left + ((null == n3 ? void 0 : n3.left) || 0) }); + var r4; + (o4 = l2).width * o4.height > 10 ? (v3.current || (null != p2 && p2.current && p2.current(t9), v3.current = true), null == (r4 = e5.current) || r4.drawSelectionBox(l2), null == f3.current || f3.current(u3)) : v3.current && (null == f3.current || f3.current(u3)); + } else + b2(); + var o4; + }, [b2, e5]), w2 = (0, import_react170.useCallback)((t9) => { + var n3; + if (!d4.current) return; - } - } else { - const file = getAbstractFileAtPath(plugin.app, path2.basePath) ?? getAbstractFileAtPath(plugin.app, basePath); - if (file) { - const selectiveRange = getLineRangeFromRef(file.path, path2.refStr, plugin); - if (!dom.hasAttribute("ready")) { - dom.setAttribute("ready", ""); - plugin.superstate.ui.openPath(basePath, false, dom, { from: selectiveRange[0], to: selectiveRange[1] }); - } - } else { - dom.innerHTML = ""; - const createDiv = dom.createDiv("file-embed"); - createDiv.classList.add("mod-empty"); - const createFile = async (e5) => { - e5.stopPropagation(); - e5.stopImmediatePropagation(); - await plugin.files.newFile("/", basePath, "md"); - loadFlowEditor(leaf, cm, flowEditorInfo2, source, plugin); - }; - createDiv.setText(`"${basePath}" ` + i18n_default.labels.noFile); - createDiv.addEventListener("click", createFile); - } - } - } -}; -var openPathInElement = (plugin, parentLeaf, initiatingEl, fileName, onShowCallback) => { - const parent = parentLeaf ?? plugin.app.workspace.activeLeaf; - if (!initiatingEl) - initiatingEl = parent.containerEl; - const hoverPopover = new FlowEditor( - parent, - initiatingEl, - plugin, - void 0, - onShowCallback - ); - if (fileName) - hoverPopover.titleEl.textContent = fileName.substring( - 0, - fileName.lastIndexOf(".") - ); -}; - -// src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx -var import_obsidian8 = require("obsidian"); -var toggleFlowEditor = import_state12.Annotation.define(); -var cacheFlowEditorHeight = import_state12.Annotation.define(); -var preloadFlowEditor = import_state12.EditorState.transactionFilter.of( - (tr) => { - const newTrans = []; - const value = tr.state.field(flowEditorInfo, false); - if (value && !tr.annotation(toggleFlowEditor)) { - newTrans.push( - ...value.filter((f2) => f2.expandedState == 1).map((f2) => { - if (tr.state.field(flowTypeStateField, false) == "doc") { - return { - annotations: toggleFlowEditor.of([f2.id, 2]) - }; - } else { - return { - annotations: toggleFlowEditor.of([f2.id, 0]) - }; - } - }) - ); - } - return [tr, ...newTrans]; - } -); -var internalLinkToggle = import_view14.ViewPlugin.fromClass( - class { - constructor(view) { - } - }, - { - eventHandlers: { - mousedown: (e5, view) => { - if (!e5.shiftKey) { + const r4 = null == (n3 = e5.current) ? void 0 : n3.getParentBoundingClientRect(); + m5.current = S3(t9, r4), E2(t9, r4); + }, [E2, S3, e5]), x2 = (0, import_react170.useCallback)((e6) => { + var t9; + 0 === e6.button && (m5.current && (null == h3.current || h3.current(e6)), b2(), document.body.style.removeProperty("user-select"), document.body.style.removeProperty("-webkit-user-select"), (i5 || document.body).removeEventListener("mousemove", w2), null == (t9 = window) || t9.removeEventListener("mouseup", x2)); + }, [i5, b2, w2]), C2 = (0, import_react170.useCallback)((e6) => { + if (0 === e6.button && y3.current) { + var t9; + if ("function" == typeof s5 && !s5(e6.target)) return; - } - const pos = view.posAtDOM(e5.target); - const { from: lineFrom, to: lineTo, text: text2 } = view.state.doc.lineAt(pos); - for (const match2 of text2.matchAll(/(?!!)\[\[([^\]]+)\]\]/g)) { - const stateField = view.state.field(flowEditorInfo, false); - const info = stateField.find( - (f2) => f2.to == lineFrom + match2.index + match2[1].length + 2 && pos >= f2.from && pos <= f2.to - ); - if (info) { - e5.preventDefault(); - view.dispatch({ - annotations: toggleFlowEditor.of([info.id, 2]) - }); - } - } - } - } - } -); -var internalLinkHover = (plugin) => hoverTooltip((view, pos, side) => { - const { from: lineFrom, to: lineTo } = view.state.doc.lineAt(pos); - let hovObject = null; - iterateTreeInSelection({ from: lineFrom, to: lineTo }, view.state, { - enter: ({ name: name319, from, to: to2 }) => { - if (name319.includes("hmd-internal-link") && pos <= to2 && pos >= from) { - const stateField = view.state.field(flowEditorInfo, false); - const info = stateField.find((f2) => f2.to == to2); - if (info) { - hovObject = { - pos, - end: to2, - above: true, - create(view2) { - const dom = document.createElement("div"); - dom.classList.add("mk-flow-hover"); - dom.classList.add("menu"); - const openHoverDiv = dom.createDiv(); - openHoverDiv.setAttribute( - "aria-label", - info.expandedState == 0 ? i18n_default.buttons.openFlow : i18n_default.buttons.hideFlow - ); - openHoverDiv.addEventListener("click", () => { - view2.dispatch({ - annotations: toggleFlowEditor.of([info.id, 2]) - }); - }); - const icon = openHoverDiv.createDiv(); - icon.innerHTML = plugin.superstate.ui.getSticker( - "ui//mk-ui-flow-hover" - ); - openHoverDiv.insertAdjacentText( - "beforeend", - info.expandedState == 0 ? i18n_default.buttons.openFlow : i18n_default.buttons.hideFlow - ); - return { dom }; - } - }; - return false; - } - } - } - }); - return hovObject; -}); -var flowEditorInfo = import_state12.StateField.define({ - create() { - return []; - }, - update(value, tr) { - const newValues = []; - const previous = value; - const usedContainers = []; - const str = tr.newDoc.sliceString(0); - const reverseExpandedState = (state) => { - const news = state != 2 /* Open */ ? 2 /* Open */ : 0 /* Closed */; - return news; - }; - for (const match2 of str.matchAll(/(?:!\[!\[|!!\[\[)([^\]]+)\]\]/g)) { - const link = match2[1]; - const existingLinks = previous.filter((f2) => f2.link == link); - const offset2 = usedContainers.filter((f2) => f2 == link).length; - const existingInfo = existingLinks[offset2]; - const id3 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); - const info = { - id: id3, - link: match2[1], - from: match2.index + 4, - to: match2.index + 4 + match2[1].length, - type: 1 /* Embed */, - height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, - expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 - }; - newValues.push(info); - } - for (const match2 of str.matchAll(/\[\[([^\]]+)\]\]/g)) { - if (str.charAt(match2.index - 1) != "!") { - const link = match2[1]; - const existingLinks = previous.filter((f2) => f2.link == link); - const offset2 = usedContainers.filter((f2) => f2 == link).length; - const existingInfo = existingLinks[offset2]; - const id3 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); - const info = { - id: id3, - link: match2[1], - from: match2.index + 2, - to: match2.index + 2 + match2[1].length, - type: 0 /* Link */, - height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, - expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0 - }; - newValues.push(info); - } else if (str.charAt(match2.index - 2) != "!") { - const link = match2[1]; - const existingLinks = previous.filter((f2) => f2.link == link); - const offset2 = usedContainers.filter((f2) => f2 == link).length; - const existingInfo = existingLinks[offset2]; - const id3 = existingInfo ? existingInfo.id : genId(); - usedContainers.push(link); - const info = { - id: id3, - link: match2[1], - from: match2.index + 3, - to: match2.index + 3 + match2[1].length, - type: 2 /* EmbedClosed */, - height: existingInfo ? tr.annotation(cacheFlowEditorHeight)?.[0] == id3 && tr.annotation(cacheFlowEditorHeight)?.[1] != 0 ? tr.annotation(cacheFlowEditorHeight)?.[1] : existingInfo.height : -1, - expandedState: existingInfo ? tr.annotation(toggleFlowEditor)?.[0] == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 - }; - newValues.push(info); - } - } - newValues.sort(compareByField("from", true)); - return newValues; - } -}); -var flowEditorRangeset = (state, plugin) => { - const builder = new import_state12.RangeSetBuilder(); - const infoFields = state.field(flowEditorInfo, false); - const values2 = []; - for (const info of infoFields) { - const { from, to: to2, type, expandedState } = info; - const lineFix = from - 3 == state.doc.lineAt(from).from && to2 + 2 == state.doc.lineAt(from).to; - if (type == 0 /* Link */) { - if (plugin.superstate.settings.internalLinkSticker) - values2.push({ - start: from - 2, - end: from - 2, - decoration: import_view14.Decoration.widget({ - widget: new LinkSticker(info, plugin), - side: -1 - }) - }); - if (plugin.superstate.settings.internalLinkClickFlow) - values2.push({ - start: to2 + 2, - end: to2 + 2, - decoration: import_view14.Decoration.widget({ - widget: new LinkExpand(info, plugin), - side: -1 - }) - }); - if (expandedState == 2 /* Open */) { - values2.push({ - start: to2 + 2, - end: to2 + 2, - decoration: flowEditorDecoration(info, plugin) - }); - } - } else if (expandedState == 2 /* Open */ && type == 1 /* Embed */) { - if (!(state.selection.main.from == from - 4 && state.selection.main.to == to2 + 2 || state.selection.main.from >= from - 3 && state.selection.main.to <= to2 + 1)) { - values2.push({ - start: from - 4, - end: from - 3, - decoration: flowEditorSelector(info, plugin) - }); - if (lineFix) { - values2.push({ - start: from - 3, - end: to2 + 2, - decoration: flowEditorWidgetDecoration(info, plugin) - }); - } else { - values2.push({ - start: from - 3, - end: to2 + 2, - decoration: flowEditorDecoration(info, plugin) - }); - } - } - } - } - values2.sort(compareByField("start", true)); - for (const value of values2) { - builder.add(value.start, value.end, value.decoration); - } - const dec = builder.finish(); - return dec; -}; -var flowEditorField = (plugin) => import_state12.StateField.define({ - create(state) { - return flowEditorRangeset(state, plugin); - }, - update(value, tr) { - return flowEditorRangeset(tr.state, plugin); - }, - provide: (f2) => import_view14.EditorView.decorations.from(f2) -}); -var FlowEditorWidget = class extends import_view14.WidgetType { - constructor(info, plugin) { - super(); - this.info = info; - this.plugin = plugin; - } - eq(other) { - return other.info.id === this.info.id; - } - toDOM(view) { - const div2 = document.createElement("div"); - div2.classList.add("mk-floweditor-container"); - div2.setAttribute("id", "mk-flow-" + this.info.id); - const placeholder2 = div2.createDiv("mk-floweditor-placeholder"); - placeholder2.style.setProperty("height", this.info.height + "px"); - loadFlowEditorByDOM(this.plugin, div2, view, this.info.id); - return div2; - } - get estimatedHeight() { - return this.info.height; - } -}; -var LinkSticker = class extends import_view14.WidgetType { - constructor(info, plugin) { - super(); - this.info = info; - this.flowInfo = info; - this.plugin = plugin; - } - eq(other) { - return other.info.id === this.info.id; - } - toDOM(view) { - const div2 = document.createElement("div"); - div2.classList.add("mk-floweditor-sticker"); - const reactEl = this.plugin.ui.createRoot(div2); - if (this.info.link && view.state.field(import_obsidian8.editorInfoField, false)) { - const infoField = view.state.field(import_obsidian8.editorInfoField, false); - const file = infoField.file; - const uri = this.plugin.superstate.spaceManager.uriByString( - this.info.link, - file.path - ); - reactEl.render( - /* @__PURE__ */ import_react175.default.createElement(PathStickerContainer, { - superstate: this.plugin.superstate, - path: uri.basePath - }) - ); - } - return div2; - } -}; -var LinkExpand = class extends import_view14.WidgetType { - constructor(info, plugin) { - super(); - this.info = info; - this.flowInfo = info; - this.plugin = plugin; - } - eq(other) { - return other.info.id === this.info.id && other.info.expandedState == this.info.expandedState; - } - toDOM(view) { - const div2 = document.createElement("div"); - div2.classList.add("mk-floweditor-toggle"); - const reactEl = this.plugin.ui.createRoot(div2); - if (this.info.link && view.state.field(import_obsidian8.editorInfoField, false)) { - reactEl.render( - /* @__PURE__ */ import_react175.default.createElement(CollapseToggle, { - superstate: this.plugin.superstate, - collapsed: this.info.expandedState == 0, - onToggle: (collapsed) => { - view.dispatch({ - annotations: toggleFlowEditor.of([ - this.info.id, - collapsed ? 2 : 0 - ]) - }); - } - }) - ); - } - return div2; - } -}; -var FlowEditorSelector = class extends import_view14.WidgetType { - constructor(info, plugin) { - super(); - this.info = info; - this.flowInfo = info; - this.plugin = plugin; - } - eq(other) { - return other.info.id === this.info.id; - } - toDOM(view) { - const div2 = document.createElement("div"); - div2.classList.add("mk-floweditor-selector"); - const reactEl = this.plugin.ui.createRoot(div2); - if (this.info.link && view.state.field(import_obsidian8.editorInfoField, false)) { - const infoField = view.state.field(import_obsidian8.editorInfoField, false); - const file = infoField.file; - reactEl.render( - /* @__PURE__ */ import_react175.default.createElement(FlowEditorHover, { - app: this.plugin.app, - superstate: this.plugin.superstate, - toggle: true, - path: this.info.link, - source: file?.path, - toggleState: true, - view, - pos: { from: this.info.from, to: this.info.to }, - dom: div2 - }) - ); - } - return div2; - } -}; -var flowEditorSelector = (info, plugin) => import_view14.Decoration.replace({ - widget: new FlowEditorSelector(info, plugin), - inclusive: true, - block: false -}); -var flowEditorDecoration = (info, plugin) => import_view14.Decoration.replace({ - widget: new FlowEditorWidget(info, plugin), - inclusive: true, - block: false -}); -var flowEditorWidgetDecoration = (info, plugin) => import_view14.Decoration.widget({ - widget: new FlowEditorWidget(info, plugin), - inclusiveStart: true, - block: true -}); - -// src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowViewUpdates.ts -var import_view15 = require("@codemirror/view"); -var flowViewUpdates = (plugin) => import_view15.EditorView.updateListener.of((v2) => { - if (v2.heightChanged) { - plugin.app.workspace.iterateRootLeaves((leaf) => { - const cm = leaf.view.editor?.cm; - if (cm && v2.view.dom == cm.dom && cm.state.field(flowTypeStateField, false)) { - if (leaf.containerEl.parentElement?.hasClass("workspace-tab-container")) { - if (cm.state.field(flowTypeStateField, false) != "doc") { - cm.dispatch({ - annotations: portalTypeAnnotation.of("doc") - }); - } - } + document.body.style.userSelect = "none", document.body.style.webkitUserSelect = "none", d4.current = S3(e6), (i5 || document.body).addEventListener("mousemove", w2), null == (t9 = window) || t9.addEventListener("mouseup", x2); } - }); - } - if (v2.heightChanged) { - const flowID = v2.state.field(flowIDStateField, false); - if (flowID) { - plugin.app.workspace.iterateLeaves((leaf) => { - const cm = leaf.view.editor?.cm; - if (cm) { - const stateField = cm.state.field(flowEditorInfo, false); - if (stateField) { - if (stateField.find((f2) => f2.id == flowID)) { - cm.dispatch({ - annotations: cacheFlowEditorHeight.of([ - flowID, - v2.view.contentHeight - ]) - }); - } - } - } - }, plugin.app.workspace["rootSplit"]); - } - } -}); + }, [i5, S3, w2, x2]); + return (0, import_react170.useEffect)(() => ((i5 || document.body).addEventListener("mousedown", C2), () => { + (i5 || document.body).removeEventListener("mousedown", C2), (i5 || document.body).removeEventListener("mousemove", w2), window.removeEventListener("mouseup", x2); + }), [i5, C2, w2, x2]), { cancelCurrentSelection: b2 }; + }({ containerRef: f2, onSelectionEnd: o2, onSelectionStart: c3, onSelectionChange: r2, isEnabled: i4, eventsElement: m4, shouldStartSelecting: v2 }); + return { cancelCurrentSelection: p, DragSelection: (0, import_react170.useCallback)(() => import_react170.default.createElement(d3, a3({ ref: f2 }, s4)), []) }; +} -// src/adapters/obsidian/ui/editors/markdownView/flowEditor/selectiveEditor.ts -var import_state13 = require("@codemirror/state"); -var import_view16 = require("@codemirror/view"); -var combinedRangeFacets = (rangeA, rangeB) => { - const startRange = !rangeA?.[0] ? rangeB[0] : !rangeB?.[0] ? rangeA[0] : Math.max(rangeA?.[0], rangeB?.[0]); - const endRange = !rangeA?.[1] ? rangeB[1] : !rangeB?.[1] ? rangeA[1] : Math.min(rangeA?.[1], rangeB?.[1]); - return [isNaN(startRange) ? null : startRange, isNaN(endRange) ? null : endRange]; -}; -var editableRange = import_state13.Annotation.define(); -var contentRange = import_state13.Annotation.define(); -var hiddenLine = import_view16.Decoration.replace({ inclusive: true, block: true }); -var hideLine = import_state13.StateField.define({ - create() { - return import_view16.Decoration.none; - }, - update(value, tr) { - const builder = new import_state13.RangeSetBuilder(); - const betterFacet = combinedRangeFacets(tr.state.field(selectiveLinesFacet, false), tr.state.field(frontmatterFacet, false)); - if (betterFacet?.[0] != null) { - const starterLine = Math.min( - tr.state.doc.lines, - betterFacet[0] - ); - builder.add( - tr.state.doc.line(1).from, - tr.state.doc.line(starterLine).from - 1, - hiddenLine - ); - if (tr.newDoc.lines != betterFacet[1]) - builder.add( - tr.state.doc.line( - Math.min(tr.newDoc.lines, betterFacet[1]) - ).to, - tr.state.doc.line(tr.newDoc.lines).to, - hiddenLine - ); - } - const dec = builder.finish(); - return dec; - }, - provide: (f2) => import_view16.EditorView.decorations.from(f2) -}); -var frontmatterFacet = import_state13.StateField.define({ - create: () => [void 0, void 0], - update(value, tr) { - if (tr.annotation(contentRange)) { - if (tr.annotation(contentRange)[0]) { - return [ - tr.annotation(contentRange)[0], - Math.min(tr.state.doc.lines, tr.annotation(contentRange)[1]) - ]; - } - return tr.annotation(contentRange); - } - return value; - } -}); -var selectiveLinesFacet = import_state13.StateField.define({ - create: () => [void 0, void 0], - update(value, tr) { - if (tr.annotation(editableRange)) { - if (tr.annotation(editableRange)[0]) { - return [ - tr.annotation(editableRange)[0], - Math.min(tr.state.doc.lines, tr.annotation(editableRange)[1]) - ]; - } - return tr.annotation(editableRange); - } - return value; - } -}); -var lineRangeToPosRange = (state, range2) => { - return { - from: state.doc.line(range2[0]).from, - to: state.doc.line(Math.min(state.doc.lines, range2[1])).to - }; -}; -var smartDelete = import_state13.EditorState.transactionFilter.of( - (tr) => { - if (tr.isUserEvent("delete") && !tr.annotation(import_state13.Transaction.userEvent).endsWith(".smart")) { - const initialSelections = tr.startState.selection.ranges.map((range2) => ({ - from: range2.from, - to: range2.to - })); - const betterFacet = combinedRangeFacets(tr.startState.field(selectiveLinesFacet, false), tr.startState.field(frontmatterFacet, false)); - if (initialSelections.length > 0 && betterFacet?.[0]) { - const posRange = lineRangeToPosRange( - tr.startState, - betterFacet - ); - if (tr.changes.touchesRange(0, posRange.from - 1)) { - const minFrom = Math.max(posRange.from, initialSelections[0].from); - const minTo = Math.min(posRange.to, initialSelections[0].to); - return [{ - changes: { - from: Math.min(minFrom, minTo), - to: Math.max(minFrom, minTo) - }, - annotations: import_state13.Transaction.userEvent.of( - `${tr.annotation(import_state13.Transaction.userEvent)}.smart` - ) - }]; - } - } - } - return tr; - } -); -var preventModifyTargetRanges = import_state13.EditorState.transactionFilter.of( - (tr) => { - const newTrans = []; - try { - const editableLines = tr.startState.field(selectiveLinesFacet, false); - const contentLines = tr.startState.field(frontmatterFacet, false); - const selectiveLines = combinedRangeFacets(editableLines, contentLines); - if (tr.isUserEvent("input") || tr.isUserEvent("delete") || tr.isUserEvent("move")) { - if (selectiveLines?.[0]) { - const posRange = lineRangeToPosRange( - tr.startState, - selectiveLines - ); - if (!tr.changes.touchesRange(posRange.from, posRange.to)) { - return []; - } - } +// src/core/react/components/SpaceView/SpaceOuter.tsx +var import_react171 = __toESM(require_react()); +var SpaceOuter = (0, import_react171.forwardRef)( + (props, ref2) => { + const [selectionBox, setSelectionBox] = (0, import_react171.useState)(); + const selectableItems = (0, import_react171.useRef)([]); + const { frameProperties } = (0, import_react171.useContext)(FramesEditorRootContext); + const { selectableNodeBounds, id: id3 } = (0, import_react171.useContext)(FrameInstanceContext); + const { selectMulti } = (0, import_react171.useContext)(FrameSelectionContext); + const { tableData } = (0, import_react171.useContext)(FramesMDBContext); + const [dragging, setDragging] = (0, import_react171.useState)(false); + const localRef = (0, import_react171.useRef)(null); + const [contexts, setContexts] = (0, import_react171.useState)({}); + const [frameProps, setFrameProps] = (0, import_react171.useState)({}); + const { pathState } = (0, import_react171.useContext)(PathContext); + const { spaceInfo } = (0, import_react171.useContext)(SpaceContext); + (0, import_react171.useEffect)(() => { + if (!spaceInfo) { + return; } - if (tr.state.doc.lines != tr.startState.doc.lines) { - const numberNewLines = tr.state.doc.lines - tr.startState.doc.lines; - if (selectiveLines?.[0]) { - const posRange = lineRangeToPosRange( - tr.startState, - selectiveLines + const linkedNote = spaceInfo.notePath; + const refreshProps = () => { + if (tableData) { + const properties3 = { + ...pathState?.metadata?.property ?? {} + }; + const row2 = linkContextRow( + props.superstate.formulaContext, + props.superstate.pathsIndex, + properties3, + tableData?.cols ?? [], + pathState ); - if (tr.changes.touchesRange(0, posRange.from - 1)) { - const newAnnotations = []; - if (editableLines[0]) { - newAnnotations.push(editableRange.of([ - editableLines[0] + numberNewLines, - editableLines[1] + numberNewLines - ])); - } - if (contentLines[0]) { - newAnnotations.push(contentRange.of([ - contentLines[0] + numberNewLines, - contentLines[1] + numberNewLines - ])); - } - newTrans.push({ - annotations: newAnnotations - }); - } else if (tr.changes.touchesRange(posRange.from - 1, posRange.to)) { - const newAnnotations = []; - if (editableLines[0]) { - newAnnotations.push(editableRange.of([ - editableLines[0], - editableLines[1] + numberNewLines - ])); - } - if (contentLines[0]) { - newAnnotations.push(contentRange.of([ - contentLines[0], - contentLines[1] + numberNewLines - ])); - } - newTrans.push({ - annotations: newAnnotations - }); - } - } - } - } catch (e5) { - return []; - } - return [tr, ...newTrans]; - } -); -var readOnlyRangesExtension = [smartDelete, preventModifyTargetRanges]; -var editBlockExtensions = () => [ - readOnlyRangesExtension, - hideLine, - selectiveLinesFacet, - frontmatterFacet -]; - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/inlineStyler.tsx -var import_state15 = require("@codemirror/state"); - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/marks.ts -var import_state14 = require("@codemirror/state"); - -// src/adapters/obsidian/ui/editors/markdownView/obsidianSyntax.ts -var oMarks = [ - { - mark: "em", - formatting: "formatting-em", - altFormatting: "em_formatting_formatting-strong", - formatChar: "*" - }, - { - mark: "strong", - formatting: "formatting-strong", - formatChar: "**" - }, - { - mark: "strikethrough", - formatting: "formatting-strikethrough", - formatChar: "~~" - }, - { - mark: "inline-code", - formatting: "formatting-code", - formatChar: "`" - } -]; - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/marks.ts -var toggleMark = import_state14.Annotation.define(); -var trimSpace = (pos, moveDirLeft, state) => { - if (moveDirLeft && state.sliceDoc(pos, pos + 1) == " ") - return pos + 1; - if (!moveDirLeft && state.sliceDoc(pos - 1, pos) == " ") - return pos - 1; - return pos; -}; -var newPosAfterFormatting = (pos, moveDirLeft, state) => { - const line = state.doc.lineAt(pos); - const start = moveDirLeft ? line.from : pos; - const end = moveDirLeft ? pos : line.to; - let newPos = start; - let lastFormatPos = start; - const exitFormatRange = false; - iterateTreeInSelection({ from: start, to: end }, state, { - enter: (node) => { - if (exitFormatRange) - return false; - if (node.name.includes("formatting")) { - if (!moveDirLeft && node.from > start) { - return false; - } - if (moveDirLeft) { - newPos = node.from; - lastFormatPos = node.to; + setFrameProps(row2); } else { - newPos = node.to; + const properties3 = { + ...pathState?.metadata?.property ?? {} + }; + setFrameProps(properties3); } - } - } - }); - if (moveDirLeft && lastFormatPos < pos) { - newPos = pos; - } - return newPos; -}; -var expandRange = (selection2, state) => { - const from = trimSpace( - newPosAfterFormatting(selection2.from, true, state), - true, - state - ); - const to2 = trimSpace( - newPosAfterFormatting(selection2.to, false, state), - false, - state - ); - return { from, to: to2 }; -}; -var addMarkAtPos = (pos, mark) => ({ - changes: { from: pos, to: pos, insert: mark.formatChar } -}); -var rangeIsMark = (state, mark, selection2) => posIsMark(selection2.from, state, mark.mark) && posIsMark(selection2.to, state, mark.mark); -var posIsMark = (pos, state, markString) => { - let isMark = false; - iterateTreeAtPos(pos, state, { - enter: ({ name: name319, from, to: to2 }) => { - if (nodeNameContainsMark(name319, markString)) - isMark = true; - } - }); - return isMark; -}; -var nodeNameContainsMark = (name319, markString) => { - return name319.includes(markString); -}; -var edgeIsMark = (pos, state, mark) => posIsMark(pos, state, mark.mark); -var edgeIsMarkFormat = (pos, state, mark) => posIsMark(pos, state, mark.formatting) ? true : mark.altFormatting ? posIsMark(pos, state, mark.altFormatting) : false; -var transactionChangesForMark = (range2, mark, state) => { - const newTrans = []; - if (rangeIsMark(state, mark, range2)) { - if (edgeIsMarkFormat(range2.from, state, mark) && !edgeIsMarkFormat(range2.to, state, mark)) { - newTrans.push(addMarkAtPos(range2.to, mark)); - } - if (edgeIsMarkFormat(range2.to, state, mark) && !edgeIsMarkFormat(range2.from, state, mark)) { - newTrans.push(addMarkAtPos(range2.from, mark)); - } - } else if (edgeIsMark(range2.from, state, mark)) { - if (edgeIsMarkFormat(range2.from, state, mark) && !edgeIsMark(range2.from - 1, state, mark)) { - newTrans.push(addMarkAtPos(range2.from, mark)); - } - newTrans.push(addMarkAtPos(range2.to, mark)); - } else if (edgeIsMark(range2.to, state, mark)) { - if (edgeIsMarkFormat(range2.to, state, mark) && !edgeIsMark(range2.to + 1, state, mark)) { - newTrans.push(addMarkAtPos(range2.to, mark)); - } - newTrans.push(addMarkAtPos(range2.from, mark)); - } else { - newTrans.push(addMarkAtPos(range2.to, mark)); - newTrans.push(addMarkAtPos(range2.from, mark)); - } - return newTrans; -}; -var removeAllInternalMarks = (sel, state, mark) => { - const returnTrans = []; - iterateTreeInSelection({ from: sel.from, to: sel.to }, state, { - enter: ({ name: name319, from, to: to2 }) => { - if (nodeNameContainsMark(name319, mark.formatting) || (mark.altFormatting ? nodeNameContainsMark(name319, mark.altFormatting) : false)) - returnTrans.push({ - from, - to: from + mark.formatChar.length - }); - } - }); - return { - changes: returnTrans - }; -}; -var toggleMarkExtension = import_state14.EditorState.transactionFilter.of( - (tr) => { - if (!tr.annotation(toggleMark)) - return tr; - const markToggle = tr.annotation(toggleMark); - const mark = oMarks.find((f2) => f2.mark == markToggle); - if (!mark) { - return tr; - } - const selection2 = tr.startState.selection.main; - const newTrans = []; - if (selection2.head == selection2.anchor) { - if (tr.startState.sliceDoc( - selection2.head - mark.formatChar.length, - selection2.head - ) == mark.formatChar && tr.startState.sliceDoc( - selection2.head, - selection2.head + mark.formatChar.length - ) == mark.formatChar) { - newTrans.push({ - changes: { - from: selection2.head - mark.formatChar.length, - to: selection2.head + mark.formatChar.length - } - }); - } else { - newTrans.push({ - changes: { - from: selection2.head, - insert: mark.formatChar + mark.formatChar - }, - selection: { - anchor: selection2.head + mark.formatChar.length, - head: selection2.head + mark.formatChar.length - } - }); - } - return [tr, ...newTrans]; - } - const range2 = expandRange(selection2, tr.startState); - newTrans.push(removeAllInternalMarks(range2, tr.startState, mark)); - const newFrom = range2.from; - const newTo = range2.to; - newTrans.push(...transactionChangesForMark(range2, mark, tr.startState)); - return [tr, ...newTrans, { selection: { anchor: newFrom, head: newTo } }]; - } -); - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/InlineMenu.tsx -var import_classnames14 = __toESM(require_classnames()); -var import_react177 = __toESM(require_react()); - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/Mark.tsx -var import_react176 = __toESM(require_react()); -var Mark = (props) => { - const { i: i4, style, active, toggleMarkAction } = props; - return /* @__PURE__ */ import_react176.default.createElement("div", { - key: i4, - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.styles[style.label] : void 0, - className: `mk-mark ${style.mark && active ? "mk-mark-active" : ""}`, - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker(`ui//${style.icon}`) - }, - onMouseDown: (e5) => toggleMarkAction(e5, style) - }); -}; - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/styles/default.ts -var default_default = [ - { - label: "bold", - value: `****`, - insertOffset: 2, - icon: "mk-mark-strong", - mark: "strong" - }, - { - label: "italics", - value: "**", - insertOffset: 1, - icon: "mk-mark-em", - mark: "em" - }, - { - label: "strikethrough", - value: "~~~~", - insertOffset: 2, - icon: "mk-mark-strikethrough", - mark: "strikethrough" - }, - { - label: "code", - value: "``", - insertOffset: 1, - icon: "mk-mark-code", - mark: "inline-code" - }, - { - label: "link", - value: "[]()", - insertOffset: 1, - cursorOffset: 2, - icon: "mk-mark-link" - }, - { - label: "blocklink", - value: "[[]]", - insertOffset: 2, - icon: "mk-mark-blocklink" - } -]; - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/styles/index.ts -function resolveStyles() { - return default_default; -} - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/InlineMenu.tsx -var loadStylerIntoContainer = (el, plugin) => { - const root = plugin.ui.createRoot(el); - root.render( - /* @__PURE__ */ import_react177.default.createElement(InlineMenuComponent, { - mobile: true, - activeMarks: [], - plugin - }) - ); -}; -var InlineMenuComponent = (props) => { - const [mode2, setMode] = (0, import_react177.useState)(props.mobile ? 0 : 1); - const [colorMode, setColorMode] = (0, import_react177.useState)(null); - const makeMenu = (e5) => { - e5.preventDefault(); - const cm = props.cm ?? getActiveCM(props.plugin); - if (!cm) - return; - const end = cm.state.selection.main.to; - const insertChars = cm.state.sliceDoc(end - 1, end) == cm.state.lineBreak ? props.plugin.superstate.settings.menuTriggerChar : cm.state.lineBreak + props.plugin.superstate.settings.menuTriggerChar; - cm.dispatch({ - changes: { - from: end, - to: end, - insert: insertChars - }, - selection: { - head: end + insertChars.length, - anchor: end + insertChars.length - } - }); - }; - const toggleMarkAction = (e5, s4) => { - e5.preventDefault(); - const cm = props.cm ?? getActiveCM(props.plugin); - if (!cm) - return; - if (s4.mark) { - cm.dispatch({ - annotations: toggleMark.of(s4.mark) - }); - return; - } - const selection2 = cm.state.selection.main; - const selectedText = cm.state.sliceDoc(selection2.from, selection2.to); - cm.dispatch({ - changes: { - from: selection2.from, - to: selection2.to, - insert: s4.value.substring(0, s4.insertOffset) + selectedText + s4.value.substring(s4.insertOffset) - }, - selection: s4.cursorOffset ? { - anchor: selection2.from + s4.value.substring(0, s4.insertOffset).length + selectedText.length + s4.cursorOffset, - head: selection2.from + s4.value.substring(0, s4.insertOffset).length + selectedText.length + s4.cursorOffset - } : { - anchor: selection2.from + s4.value.substring(0, s4.insertOffset).length, - head: selection2.from + s4.value.substring(0, s4.insertOffset).length + selectedText.length - } - }); - }; - const makeMode = () => /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, /* @__PURE__ */ import_react177.default.createElement("div", { - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.makeMenu : void 0, - onMouseDown: (e5) => { - makeMenu(e5); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-make-slash") - } - }), /* @__PURE__ */ import_react177.default.createElement("div", { - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.selectStyle : void 0, - onMouseDown: () => { - setMode(1); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-make-style") - } - }), /* @__PURE__ */ import_react177.default.createElement("div", { - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.image : void 0, - onMouseDown: () => { - const view = getActiveMarkdownView(props.plugin); - props.plugin.app.commands.commands["editor:attach-file"].editorCallback(view.editor, view); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-make-attach") - } - }), /* @__PURE__ */ import_react177.default.createElement("div", { - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.toggleKeyboard : void 0, - onMouseDown: () => { - const view = getActiveMarkdownView(props.plugin); - props.plugin.app.commands.commands["editor:indent-list"].editorCallback(view.editor, view); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-make-indent") - } - }), /* @__PURE__ */ import_react177.default.createElement("div", { - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.toggleKeyboard : void 0, - onMouseDown: () => { - const view = getActiveMarkdownView(props.plugin); - props.plugin.app.commands.commands["editor:unindent-list"].editorCallback(view.editor, view); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-make-unindent") - } - }), /* @__PURE__ */ import_react177.default.createElement("div", { - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.commands.toggleKeyboard : void 0, - onMouseDown: () => { - const view = getActiveMarkdownView(props.plugin); - props.plugin.app.commands.commands["editor:toggle-keyboard"].editorCallback(view.editor, view); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-make-keyboard") - } - })); - const colorsMode = () => /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, /* @__PURE__ */ import_react177.default.createElement("div", { - className: "mk-mark", - onMouseDown: () => { - setColorMode(null); - setMode(1); - }, - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-ui-close") - } - }), colors.map((c3, i4) => /* @__PURE__ */ import_react177.default.createElement("div", { - key: i4, - onMouseDown: () => { - setMode(1); - setColorMode(null); - const cm = props.cm ?? getActiveCM(props.plugin); - if (!cm) - return; - const selection2 = cm.state.selection.main; - const selectedText = cm.state.sliceDoc( - selection2.from, - selection2.to - ); - cm.dispatch({ - changes: { - from: selection2.from, - to: selection2.to, - insert: colorMode.prefix + c3[1] + colorMode.suffix + selectedText + colorMode.closeTag + if (!pathState) { + setContexts({}); + return; } - }); - }, - className: "mk-color", - style: { background: c3[1] } - }))); - const marksMode = () => /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, props.mobile ? /* @__PURE__ */ import_react177.default.createElement("div", { - className: "mk-mark", - onMouseDown: () => { - setMode(0); - }, - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-ui-close") - } - }) : /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null), resolveStyles().map((s4, i4) => { - return /* @__PURE__ */ import_react177.default.createElement(Mark, { - plugin: props.plugin, - key: i4, - i: i4, - style: s4, - active: props.activeMarks.find((f2) => f2 == s4.mark) ? true : false, - toggleMarkAction - }); - }), props.plugin.superstate.settings.inlineStylerColors ? /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, /* @__PURE__ */ import_react177.default.createElement("div", { - className: "mk-divider" - }), /* @__PURE__ */ import_react177.default.createElement("div", { - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.styles.textColor : void 0, - onMouseDown: () => { - setMode(2); - setColorMode({ - prefix: ``, - closeTag: "" - }); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker("ui//mk-mark-color") - } - }), /* @__PURE__ */ import_react177.default.createElement("div", { - "aria-label": !isTouchScreen(props.plugin.superstate.ui) ? i18n_default.styles.highlight : void 0, - onMouseDown: () => { - setMode(2); - setColorMode({ - prefix: ``, - closeTag: "" - }); - }, - className: "mk-mark", - dangerouslySetInnerHTML: { - __html: props.plugin.superstate.ui.getSticker( - "ui//mk-mark-highlight" - ) - } - })) : /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null)); - return /* @__PURE__ */ import_react177.default.createElement("div", { - className: (0, import_classnames14.default)("mk-style-menu", props.mobile ? "" : "menu"), - onMouseDown: (e5) => e5.preventDefault() - }, mode2 == 0 && props.mobile ? makeMode() : mode2 == 2 ? colorsMode() : marksMode()); -}; - -// src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/inlineStyler.tsx -var import_react178 = __toESM(require_react()); -var cursorTooltipField = (plugin) => import_state15.StateField.define({ - create: getCursorTooltips(plugin), - update(tooltips2, tr) { - if (!tr.docChanged && !tr.selection) - return tooltips2; - return getCursorTooltips(plugin)(tr.state); - }, - provide: (f2) => showTooltip.computeN([f2], (state) => state.field(f2)) -}); -var getCursorTooltips = (plugin) => (state) => { - return state.selection.ranges.filter((range2) => !range2.empty).map((range2) => { - const expandedRange = expandRange(range2, state); - const line = state.doc.lineAt(range2.head); - const activeMarks = oMarks.map((f2) => rangeIsMark(state, f2, expandedRange) ? f2.mark : "").filter((f2) => f2 != ""); - return { - pos: Math.min(range2.head, range2.anchor), - above: true, - strictSide: true, - arrow: false, - create: (view) => { - const dom = document.createElement("div"); - dom.className = "cm-tooltip-cursor"; - const reactElement = plugin.ui.createRoot(dom); - reactElement.render( - /* @__PURE__ */ import_react178.default.createElement(import_react178.default.Fragment, null, /* @__PURE__ */ import_react178.default.createElement(InlineMenuComponent, { - plugin, - cm: view, - activeMarks, - mobile: false - })) + const pathContexts = props.superstate.spacesMap.get(pathState.path) ?? /* @__PURE__ */ new Set(); + const contexts2 = [...pathContexts].reduce( + (p, c3) => { + const context = props.superstate.contextsIndex.get(c3)?.contextTable?.rows.find( + (f2) => f2[PathPropertyName] == pathState.path + ); + return context ? { ...p, [c3]: context } : p; + }, + { + $space: { + note: linkedNote, + space: pathState.path, + path: pathState.path + }, + $context: { + _keyValue: pathState.path, + _schema: "main" + }, + $properties: frameProperties + } ); - return { dom }; + setContexts(contexts2); + }; + refreshProps(); + }, [spaceInfo, pathState, tableData]); + const propSetters = Object.keys(frameProps).reduce( + (p, c3) => ({ + ...p, + [c3]: (value) => { + setFrameProps((p2) => ({ ...p2, [c3]: value })); + saveProperties(props.superstate, pathState.path, { + [c3]: value + }); + } + }), + {} + ); + const onKeyDown = (e5) => { + if (e5.key === "Escape") { + props.superstate.ui.resetSelection(null); } }; - }); -}; -function cursorTooltip(plugin) { - return cursorTooltipField(plugin); -} + (0, import_react171.useEffect)(() => { + window.addEventListener("keydown", onKeyDown); + return () => { + window.removeEventListener("keydown", onKeyDown); + }; + }, []); + const { DragSelection } = v({ + eventsElement: localRef.current, + onSelectionChange: (box) => { + const scroller = localRef.current.parentElement; + const scrollAwareBox = { + ...box, + top: box.top + scroller.scrollTop, + left: box.left + scroller.scrollLeft + }; + setSelectionBox(scrollAwareBox); + const nodesToSelect = []; + Object.keys(selectableNodeBounds.current).forEach((item) => { + if (m3(scrollAwareBox, selectableNodeBounds.current[item])) { + nodesToSelect.push(item); + } + }); + selectMulti(nodesToSelect, false); + }, + onSelectionStart: () => { + setDragging(true); + }, + onSelectionEnd: (e5) => { + setTimeout(function() { + setDragging(false); + }, 100); + }, + selectionProps: { + style: { + backgroundColor: "hsla(var(--color-accent-hsl), 0.1)", + border: "2px solid var(--color-accent)", + borderRadius: 2, + opacity: 0.5 + } + }, + isEnabled: true, + shouldStartSelecting: (target) => { + if (target instanceof HTMLElement && (target.className.includes("mk-f-main") || target.className.includes("mk-space-outer"))) + return true; + return false; + } + }); + return /* @__PURE__ */ import_react171.default.createElement("div", { + className: "mk-space-body cm-line", + ref: (el) => { + localRef.current = el; + if (typeof ref2 == "function") + ref2(el); + else if (ref2 !== null) + ref2.current = el; + } + }, /* @__PURE__ */ import_react171.default.createElement(DragSelection, null), spaceInfo.readOnly ? /* @__PURE__ */ import_react171.default.createElement(FrameInstanceProvider, { + id: id3 ?? "root", + superstate: props.superstate, + props: frameProps, + contexts, + propSetters, + editable: false + }, /* @__PURE__ */ import_react171.default.createElement(FrameInstanceView, { + superstate: props.superstate + })) : /* @__PURE__ */ import_react171.default.createElement(FrameInstanceProvider, { + id: id3 ?? "root", + superstate: props.superstate, + props: frameProps, + contexts, + propSetters, + editable: true + }, /* @__PURE__ */ import_react171.default.createElement(FrameEditorInstance, { + containerRef: props.containerRef, + superstate: props.superstate + }))); + } +); +SpaceOuter.displayName = "SpaceOuter"; +var SpaceOuter_default = SpaceOuter; -// src/adapters/obsidian/ui/editors/markdownView/placeholder.ts -var import_state16 = require("@codemirror/state"); -var import_view17 = require("@codemirror/view"); -var placeholderLine = (plugin) => import_view17.Decoration.line({ - attributes: { "data-ph": i18n_default.labels.placeholder.replace("${1}", plugin.superstate.settings.menuTriggerChar) }, - class: "mk-placeholder" -}); -var placeholderExtension = (plugin) => import_state16.StateField.define({ - create() { - return import_view17.Decoration.none; - }, - update(value, tr) { - const builder = new import_state16.RangeSetBuilder(); - const currentLine = tr.state.doc.lineAt(tr.state.selection.main.head); - if (currentLine?.length == 0) - builder.add(currentLine.from, currentLine.from, placeholderLine(plugin)); - const dec = builder.finish(); - return dec; - }, - provide: (f2) => import_view17.EditorView.decorations.from(f2) -}); +// src/core/react/components/SpaceView/SpaceInner.tsx +var import_react172 = __toESM(require_react()); +var SpaceInner = (props) => { + const ref2 = (0, import_react172.useRef)(null); + const { spaceState } = (0, import_react172.useContext)(SpaceContext); + return /* @__PURE__ */ import_react172.default.createElement(import_react172.default.Fragment, null, props.header && /* @__PURE__ */ import_react172.default.createElement(SpaceHeader, { + superstate: props.superstate + }), spaceState && /* @__PURE__ */ import_react172.default.createElement(SpaceOuter_default, { + superstate: props.superstate, + ref: ref2, + containerRef: ref2 + }), props.superstate.settings.inlineBacklinks && spaceState && /* @__PURE__ */ import_react172.default.createElement("div", { + className: "mk-space-footer" + }, /* @__PURE__ */ import_react172.default.createElement(Backlinks, { + superstate: props.superstate, + path: spaceState.space.notePath + }))); +}; -// src/adapters/obsidian/ui/editors/markdownView/cmExtensions.ts -var cmExtensions = (plugin, mobile) => { - const extensions = [...editBlockExtensions()]; - if (plugin.superstate.settings.makerMode) { - extensions.push( - ...[toggleMarkExtension, tooltips({ parent: document.body })] +// src/adapters/obsidian/SpaceViewContainer.tsx +var SPACE_VIEW_TYPE = "mk-space"; +var SpaceViewContainer = class extends import_obsidian3.ItemView { + constructor(leaf, superstate, ObsidianUI2, viewType) { + super(leaf); + this.navigation = true; + this.superstate = superstate; + this.viewType = viewType; + this.ui = ObsidianUI2; + } + getViewType() { + return SPACE_VIEW_TYPE; + } + getDisplayText() { + return pathDisplayName(this.path, this.superstate); + } + async onClose() { + this.destroy(); + } + destroy() { + this.superstate.eventsDispatcher.removeListener( + "spaceChanged", + this.changePath ); - if (!mobile && plugin.superstate.settings.inlineStyler) { - extensions.push(cursorTooltip(plugin)); + this.superstate.eventsDispatcher.removeListener( + "spaceDeleted", + this.closePath + ); + this.root?.unmount(); + } + async onOpen() { + this.destroy(); + } + changePath(payload) { + if (this.path == payload.path) { + this.leaf.setViewState({ + type: SPACE_VIEW_TYPE, + state: { path: payload.newPath } + }); } - if (plugin.superstate.settings.flowMenuEnabled && plugin.superstate.settings.makeMenuPlaceholder) - extensions.push(placeholderExtension(plugin)); - if (plugin.superstate.settings.editorFlow) { - extensions.push( - flowTypeStateField, - preloadFlowEditor, - flowEditorField(plugin), - flowEditorInfo, - flowIDStateField, - flowViewUpdates(plugin) - ); - if (plugin.superstate.settings.internalLinkClickFlow) { - extensions.push(internalLinkToggle); - } else { - extensions.push(internalLinkHover(plugin)); + } + closePath(payload) { + if (this?.path == payload.path) { + this.leaf.setViewState({ + type: null + }); + } + } + async setState(state, result) { + this.path = state.path; + if (!this.path) + return; + this.constructNote(this.path); + const displayName = pathDisplayName(this.path, this.superstate); + const spaceCache = this.superstate.spacesIndex.get(this.path); + await super.setState(state, result); + this.leaf.tabHeaderInnerTitleEl.innerText = displayName; + this.leaf.view.titleEl = displayName; + const headerEl = this.leaf.view.headerEl; + if (headerEl && spaceCache) { + headerEl.querySelector(".view-header-title").innerText = displayName; + if (spaceCache.type == "folder") { + const titleParent = headerEl.querySelector(".view-header-title-parent"); + titleParent.innerHTML = ""; + const parentPaths = getParentFolderPaths(spaceCache.path); + if (titleParent) { + parentPaths.forEach((f2) => { + const breadcrumb = titleParent.createEl("span"); + breadcrumb.addClass("view-header-breadcrumb"); + breadcrumb.innerText = folderPathToString(f2); + breadcrumb.addEventListener( + "click", + () => this.superstate.ui.openPath(f2, false) + ); + const breadcrumbSeparator = titleParent.createEl("span"); + breadcrumbSeparator.addClass("view-header-breadcrumb-separator"); + breadcrumbSeparator.innerText = "/"; + }); + } } } + result.history = true; + return; + } + getState() { + const state = super.getState(); + state.path = this.path; + return state; + } + constructNote(path2) { + this.destroy(); + this.superstate.eventsDispatcher.addListener( + "spaceChanged", + this.changePath, + 0, + this + ); + this.superstate.eventsDispatcher.addListener( + "spaceDeleted", + this.closePath, + 0, + this + ); + this.root = this.ui.createRoot(this.contentEl); + if (this.root) { + this.root.render( + /* @__PURE__ */ import_react173.default.createElement("div", { + className: "mk-space-view" + }, path2 == "spaces://$settings" ? /* @__PURE__ */ import_react173.default.createElement(SystemSettings, { + superstate: this.superstate + }) : /* @__PURE__ */ import_react173.default.createElement(SpaceView, { + path: path2, + superstate: this.superstate, + key: path2, + readOnly: false + }, /* @__PURE__ */ import_react173.default.createElement("div", { + className: "mk-space-scroller markdown-source-view mod-cm6 is-readable-line-width" + }, /* @__PURE__ */ import_react173.default.createElement(SpaceInner, { + superstate: this.superstate, + header: true + })))) + ); + } else { + this.ui.manager.eventsDispatch.addOnceListener("windowReady", () => { + this.constructNote(path2); + }); + } } - return extensions; }; // src/adapters/obsidian/utils/flow/markdownPost.tsx -var import_react179 = __toESM(require_react()); +var import_react174 = __toESM(require_react()); var getCMFromElement = (el, app2) => { let dom = el; while (!dom.hasClass("cm-editor") && dom.parentElement) { @@ -140748,7 +139843,7 @@ var replaceAllTables = (plugin, el, ctx) => { const link = match2[1]; const reactEl = plugin.ui.createRoot(element.parentElement); reactEl.render( - /* @__PURE__ */ import_react179.default.createElement(NoteView, { + /* @__PURE__ */ import_react174.default.createElement(NoteView, { load: true, superstate: plugin.superstate, path: link @@ -140799,16 +139894,16 @@ var replaceAllEmbed = (el, ctx, superstate, app2) => { const reactEl = superstate.ui.createRoot(div2); const cm = getCMFromElement(el, app2); const pos = cm?.posAtDOM(dom); - const index2 = [ + const index3 = [ ...Array.from(dom.parentElement?.childNodes ?? []) ].indexOf(dom); - if (index2 == -1) + if (index3 == -1) return; - const nextDom = dom.parentElement.childNodes[index2]; + const nextDom = dom.parentElement.childNodes[index3]; const endPos = cm?.posAtDOM(nextDom); if (ctx.sourcePath) reactEl.render( - /* @__PURE__ */ import_react179.default.createElement(FlowEditorHover, { + /* @__PURE__ */ import_react174.default.createElement(FlowEditorHover, { app: app2, toggle: true, path: ctx.sourcePath, @@ -140864,6 +139959,7 @@ var DEFAULT_SETTINGS = { bannerHeight: 200, spacesDisablePatch: false, folderNoteInsideFolder: true, + folderNoteName: "", sidebarTabs: true, showRibbon: true, deleteFileOption: "trash", @@ -140889,6 +139985,7 @@ var DEFAULT_SETTINGS = { inlineContextNameLayout: "vertical", waypoints: ["/"], spacesUseAlias: false, + flowState: false, fmKeyAlias: "aliases", fmKeyBanner: "banner", fmKeyColor: "color", @@ -140914,15 +140011,17 @@ var DEFAULT_SETTINGS = { systemName: "Vault", defaultSpaceTemplate: "", selectedKit: "default", - actionMaxSteps: 100 + actionMaxSteps: 100, + contextPagination: 25, + searchWorker: true }; // src/main.ts -var import_obsidian27 = require("obsidian"); +var import_obsidian28 = require("obsidian"); // src/adapters/obsidian/settings.ts -var import_obsidian9 = require("obsidian"); -var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { +var import_obsidian4 = require("obsidian"); +var MakeMDPluginSettingsTab = class extends import_obsidian4.PluginSettingTab { constructor(app2, plugin) { super(app2, plugin); this.plugin = plugin; @@ -140937,7 +140036,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { const { containerEl } = this; containerEl.innerHTML = ""; containerEl.createEl("h1", { text: i18n_default.settings.sectionSidebar }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.spaces.name).setDesc(i18n_default.settings.spaces.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.spaces.name).setDesc(i18n_default.settings.spaces.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.navigatorEnabled).onChange((value) => { this.plugin.superstate.settings.navigatorEnabled = value; this.plugin.saveSettings(); @@ -140950,118 +140049,123 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { this.refreshView(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.tagSpaces.name).setDesc(i18n_default.settings.tagSpaces.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.tagSpaces.name).setDesc(i18n_default.settings.tagSpaces.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.enableDefaultSpaces).onChange((value) => { this.plugin.superstate.settings.enableDefaultSpaces = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.spacesStickers.name).setDesc(i18n_default.settings.spacesStickers.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.spacesStickers.name).setDesc(i18n_default.settings.spacesStickers.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.spacesStickers).onChange((value) => { this.plugin.superstate.settings.spacesStickers = value; this.plugin.saveSettings(); this.refreshView(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.spaceView.name).setDesc(i18n_default.settings.spaceView.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.spaceView.name).setDesc(i18n_default.settings.spaceView.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.spaceViewEnabled).onChange((value) => { this.plugin.superstate.settings.spaceViewEnabled = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.folderNote.name).setDesc(i18n_default.settings.folderNote.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.folderNote.name).setDesc(i18n_default.settings.folderNote.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.enableFolderNote).onChange((value) => { this.plugin.superstate.settings.enableFolderNote = value; this.plugin.saveSettings(); }) ); + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.folderNoteName.name).setDesc(i18n_default.settings.folderNoteName.desc).addText((text2) => { + text2.setValue(this.plugin.superstate.settings.folderNoteName).setPlaceholder("Folder Name").onChange(async (value) => { + this.plugin.superstate.settings.folderNoteName = value; + await this.plugin.saveSettings(); + }); + }); if (this.plugin.superstate.settings.spacesEnabled) { containerEl.createEl("h3", { text: i18n_default.settings.sectionNavigator }); const spaceAppearances = containerEl.createEl("div"); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.sidebarTabs.name).setDesc(i18n_default.settings.sidebarTabs.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.sidebarTabs.name).setDesc(i18n_default.settings.sidebarTabs.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.sidebarTabs).onChange((value) => { this.plugin.superstate.settings.sidebarTabs = value; this.plugin.saveSettings(); document.body.classList.toggle("mk-hide-tabs", !value); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.hideRibbon.name).setDesc(i18n_default.settings.hideRibbon.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.hideRibbon.name).setDesc(i18n_default.settings.hideRibbon.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.showRibbon).onChange((value) => { this.plugin.superstate.settings.showRibbon = value; this.plugin.saveSettings(); document.body.classList.toggle("mk-hide-ribbon", !value); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.folderIndentationLines.name).setDesc(i18n_default.settings.folderIndentationLines.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.folderIndentationLines.name).setDesc(i18n_default.settings.folderIndentationLines.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.folderIndentationLines).onChange((value) => { this.plugin.superstate.settings.folderIndentationLines = value; this.plugin.saveSettings(); document.body.classList.toggle("mk-folder-lines", value); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.spacesAlias.name).setDesc(i18n_default.settings.spacesAlias.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.spacesAlias.name).setDesc(i18n_default.settings.spacesAlias.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.spacesUseAlias).onChange((value) => { this.plugin.superstate.settings.spacesUseAlias = value; this.plugin.saveSettings(); this.refreshView(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.readableLineWidth.name).setDesc(i18n_default.settings.readableLineWidth.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.readableLineWidth.name).setDesc(i18n_default.settings.readableLineWidth.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.readableLineWidth).onChange((value) => { this.plugin.superstate.settings.readableLineWidth = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.openSpacesOnLaunch.name).setDesc(i18n_default.settings.openSpacesOnLaunch.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.openSpacesOnLaunch.name).setDesc(i18n_default.settings.openSpacesOnLaunch.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.openSpacesOnLaunch).onChange((value) => { this.plugin.superstate.settings.openSpacesOnLaunch = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addText((text2) => { - text2.setValue(this.plugin.superstate.settings.spaceRowHeight.toString()).onChange(async (value) => { - text2.setValue(parseInt(value).toString()); - this.plugin.superstate.settings.spaceRowHeight = parseInt(value); - await this.plugin.saveSettings(); + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addSlider((text2) => { + text2.setValue(this.plugin.superstate.settings.spaceRowHeight).setDynamicTooltip().setLimits(20, 40, 1).onChange(async (value) => { + this.plugin.superstate.settings.spaceRowHeight = value; + this.plugin.saveSettings(); }); }); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.expandFolder.name).setDesc(i18n_default.settings.expandFolder.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.expandFolder.name).setDesc(i18n_default.settings.expandFolder.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.expandFolderOnClick).onChange((value) => { this.plugin.superstate.settings.expandFolderOnClick = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.hoverPreview.name).setDesc(i18n_default.settings.hoverPreview.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.hoverPreview.name).setDesc(i18n_default.settings.hoverPreview.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.filePreviewOnHover).onChange((value) => { this.plugin.superstate.settings.filePreviewOnHover = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.activeFile.name).setDesc(i18n_default.settings.activeFile.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.activeFile.name).setDesc(i18n_default.settings.activeFile.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.revealActiveFile).onChange((value) => { this.plugin.superstate.settings.revealActiveFile = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.spacesFileExplorerDual.name).setDesc(i18n_default.settings.spacesFileExplorerDual.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.spacesFileExplorerDual.name).setDesc(i18n_default.settings.spacesFileExplorerDual.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.spacesDisablePatch).onChange((value) => { this.plugin.superstate.settings.spacesDisablePatch = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.spacesPerformance.name).setDesc(i18n_default.settings.spacesPerformance.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.spacesPerformance.name).setDesc(i18n_default.settings.spacesPerformance.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.spacesPerformance).onChange((value) => { this.plugin.superstate.settings.spacesPerformance = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.generateThumbnails.name).setDesc(i18n_default.settings.generateThumbnails.desc).addToggle( + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.generateThumbnails.name).setDesc(i18n_default.settings.generateThumbnails.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.imageThumbnails).onChange((value) => { this.plugin.superstate.settings.imageThumbnails = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(spaceAppearances).setName(i18n_default.settings.spacesDeleteOption.name).setDesc(i18n_default.settings.spacesDeleteOption.desc).addDropdown((dropdown) => { + new import_obsidian4.Setting(spaceAppearances).setName(i18n_default.settings.spacesDeleteOption.name).setDesc(i18n_default.settings.spacesDeleteOption.desc).addDropdown((dropdown) => { dropdown.addOption( "permanent", i18n_default.settings.spacesDeleteOptions.permanant @@ -141077,7 +140181,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { this.plugin.saveSettings(); }); }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.newNotePlaceholder.name).setDesc(i18n_default.settings.newNotePlaceholder.desc).addText((text2) => { + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.newNotePlaceholder.name).setDesc(i18n_default.settings.newNotePlaceholder.desc).addText((text2) => { text2.setValue(this.plugin.superstate.settings.newNotePlaceholder).onChange(async (value) => { this.plugin.superstate.settings.newNotePlaceholder = value; await this.plugin.saveSettings(); @@ -141086,14 +140190,14 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { } if (this.plugin.superstate.settings.spacesStickers) { containerEl.createEl("h3", { text: i18n_default.settings.sectionStickers }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.indexSVG.name).setDesc(i18n_default.settings.indexSVG.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.indexSVG.name).setDesc(i18n_default.settings.indexSVG.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.indexSVG).onChange((value) => { this.plugin.superstate.settings.indexSVG = value; this.plugin.saveSettings(); }) ); } - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.coverHeight.name).setDesc(i18n_default.settings.coverHeight.desc).addText((text2) => { + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.coverHeight.name).setDesc(i18n_default.settings.coverHeight.desc).addText((text2) => { text2.setValue(this.plugin.superstate.settings.bannerHeight.toString()).onChange(async (value) => { text2.setValue(parseInt(value).toString()); this.plugin.superstate.settings.bannerHeight = parseInt(value); @@ -141102,13 +140206,13 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { }); if (this.plugin.superstate.settings.spaceViewEnabled) { containerEl.createEl("h3", { text: i18n_default.settings.sectionSpaceView }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.defaultSpaceTemplate.name).setDesc(i18n_default.settings.defaultSpaceTemplate.desc).addText((text2) => { + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.defaultSpaceTemplate.name).setDesc(i18n_default.settings.defaultSpaceTemplate.desc).addText((text2) => { text2.setValue(this.plugin.superstate.settings.defaultSpaceTemplate).onChange(async (value) => { this.plugin.superstate.settings.defaultSpaceTemplate = value; await this.plugin.saveSettings(); }); }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.minimalThemeFix.name).setDesc(i18n_default.settings.minimalThemeFix.description).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.minimalThemeFix.name).setDesc(i18n_default.settings.minimalThemeFix.description).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.minimalFix).onChange((value) => { this.plugin.superstate.settings.minimalFix = value; this.plugin.saveSettings(); @@ -141117,40 +140221,46 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { ); } containerEl.createEl("h1", { text: i18n_default.settings.sectionContext }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.contexts.name).setDesc(i18n_default.settings.contexts.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.contexts.name).setDesc(i18n_default.settings.contexts.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.contextEnabled).onChange((value) => { this.plugin.superstate.settings.contextEnabled = value; this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text2) => { + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.contextPagination.name).setDesc(i18n_default.settings.contextPagination.desc).addText((text2) => { + text2.setValue(this.plugin.superstate.settings.contextPagination.toString()).onChange(async (value) => { + this.plugin.superstate.settings.contextPagination = parseInt(value); + await this.plugin.saveSettings(); + }); + }); + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text2) => { text2.setValue(this.plugin.superstate.settings.defaultDateFormat).onChange(async (value) => { this.plugin.superstate.settings.defaultDateFormat = value; await this.plugin.saveSettings(); }); }); containerEl.createEl("h3", { text: i18n_default.settings.sectionAdvanced }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.openFileContext.name).setDesc(i18n_default.settings.openFileContext.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.openFileContext.name).setDesc(i18n_default.settings.openFileContext.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.autoOpenFileContext).onChange((value) => { this.plugin.superstate.settings.autoOpenFileContext = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.syncContextToFrontmatter.name).setDesc(i18n_default.settings.syncContextToFrontmatter.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.syncContextToFrontmatter.name).setDesc(i18n_default.settings.syncContextToFrontmatter.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.saveAllContextToFrontmatter).onChange((value) => { this.plugin.superstate.settings.saveAllContextToFrontmatter = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.syncFormulaToFrontmatter.name).setDesc(i18n_default.settings.syncFormulaToFrontmatter.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.syncFormulaToFrontmatter.name).setDesc(i18n_default.settings.syncFormulaToFrontmatter.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.syncFormulaToFrontmatter).onChange((value) => { this.plugin.superstate.settings.syncFormulaToFrontmatter = value; this.plugin.saveSettings(); }) ); containerEl.createEl("h1", { text: i18n_default.settings.sectionBlink }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.blink.name).setDesc(i18n_default.settings.blink.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.blink.name).setDesc(i18n_default.settings.blink.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.blinkEnabled).onChange(async (value) => { this.plugin.superstate.settings.blinkEnabled = value; await this.plugin.saveSettings(); @@ -141158,7 +140268,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { }) ); containerEl.createEl("h1", { text: i18n_default.settings.sectionFlow }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.editorMakerMode.name).setDesc(i18n_default.settings.editorMakerMode.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.editorMakerMode.name).setDesc(i18n_default.settings.editorMakerMode.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.makerMode).onChange((value) => { this.plugin.superstate.settings.makerMode = value; this.plugin.saveSettings(); @@ -141167,27 +140277,27 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { ); if (this.plugin.superstate.settings.makerMode) { containerEl.createEl("h3", { text: i18n_default.settings.sectionInlineContext }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.inlineContextExplorer.name).setDesc(i18n_default.settings.inlineContextExplorer.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.inlineContextExplorer.name).setDesc(i18n_default.settings.inlineContextExplorer.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.inlineContext).onChange((value) => { this.plugin.superstate.settings.inlineContext = value; this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.inlineContextProperties.name).setDesc(i18n_default.settings.inlineContextProperties.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.inlineContextProperties.name).setDesc(i18n_default.settings.inlineContextProperties.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.inlineContextProperties).onChange((value) => { this.plugin.superstate.settings.inlineContextProperties = value; this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.inlineContextExpanded.name).setDesc(i18n_default.settings.inlineContextExpanded.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.inlineContextExpanded.name).setDesc(i18n_default.settings.inlineContextExpanded.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.inlineContextSectionsExpanded).onChange((value) => { this.plugin.superstate.settings.inlineContextSectionsExpanded = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.inlineContextHorizontal.name).setDesc(i18n_default.settings.inlineContextHorizontal.desc).addDropdown((dropdown) => { + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.inlineContextHorizontal.name).setDesc(i18n_default.settings.inlineContextHorizontal.desc).addDropdown((dropdown) => { dropdown.addOption("vertical", i18n_default.settings.layoutVertical); dropdown.addOption("horizontal", i18n_default.settings.layoutHorizontal); dropdown.setValue(this.plugin.superstate.settings.inlineContextNameLayout); @@ -141196,20 +140306,20 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { this.plugin.saveSettings(); }); }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.hideFrontmatter.name).setDesc(i18n_default.settings.hideFrontmatter.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.hideFrontmatter.name).setDesc(i18n_default.settings.hideFrontmatter.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.hideFrontmatter).onChange(async (value) => { this.plugin.superstate.settings.hideFrontmatter = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.dataviewInlineContext.name).setDesc(i18n_default.settings.dataviewInlineContext.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.dataviewInlineContext.name).setDesc(i18n_default.settings.dataviewInlineContext.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.dataviewInlineContext).onChange((value) => { this.plugin.superstate.settings.dataviewInlineContext = value; this.plugin.saveSettings(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.inlineBacklinks.name).setDesc(i18n_default.settings.inlineBacklinks.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.inlineBacklinks.name).setDesc(i18n_default.settings.inlineBacklinks.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.inlineBacklinks).onChange(async (value) => { this.plugin.superstate.settings.inlineBacklinks = value; await this.plugin.saveSettings(); @@ -141217,28 +140327,28 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { }) ); containerEl.createEl("h3", { text: i18n_default.settings.sectionFlow }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.editorFlowReplace.name).setDesc(i18n_default.settings.editorFlowReplace.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.editorFlowReplace.name).setDesc(i18n_default.settings.editorFlowReplace.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.editorFlow).onChange((value) => { this.plugin.superstate.settings.editorFlow = value; this.plugin.saveSettings(); this.refreshView(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.internalLinkFlowEditor.name).setDesc(i18n_default.settings.internalLinkFlowEditor.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.internalLinkFlowEditor.name).setDesc(i18n_default.settings.internalLinkFlowEditor.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.internalLinkClickFlow).onChange(async (value) => { this.plugin.superstate.settings.internalLinkClickFlow = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.internalLinkSticker.name).setDesc(i18n_default.settings.internalLinkSticker.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.internalLinkSticker.name).setDesc(i18n_default.settings.internalLinkSticker.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.internalLinkSticker).onChange(async (value) => { this.plugin.superstate.settings.internalLinkSticker = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.editorFlowStyle.name).setDesc(i18n_default.settings.editorFlowStyle.desc).addDropdown((dropdown) => { + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.editorFlowStyle.name).setDesc(i18n_default.settings.editorFlowStyle.desc).addDropdown((dropdown) => { dropdown.addOption("classic", i18n_default.settings.editorFlowStyle.classic); dropdown.addOption("seamless", i18n_default.settings.editorFlowStyle.seamless); dropdown.addOption("minimal", i18n_default.settings.editorFlowStyle.minimal); @@ -141256,14 +140366,14 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { }); }); containerEl.createEl("h3", { text: i18n_default.settings.sectionFlowMenu }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.editorMakeMenu.name).setDesc(i18n_default.settings.editorMakeMenu.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.editorMakeMenu.name).setDesc(i18n_default.settings.editorMakeMenu.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.flowMenuEnabled).onChange(async (value) => { this.plugin.superstate.settings.flowMenuEnabled = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text2) => { + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text2) => { text2.setValue(this.plugin.superstate.settings.menuTriggerChar).onChange(async (value) => { if (value.length < 1) { text2.setValue(this.plugin.superstate.settings.menuTriggerChar); @@ -141278,7 +140388,7 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { await this.plugin.saveSettings(); }); }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.editorMakePlacholder.name).setDesc(i18n_default.settings.editorMakePlacholder.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.editorMakePlacholder.name).setDesc(i18n_default.settings.editorMakePlacholder.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.makeMenuPlaceholder).onChange(async (value) => { this.plugin.superstate.settings.makeMenuPlaceholder = value; await this.plugin.saveSettings(); @@ -141286,28 +140396,28 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { }) ); containerEl.createEl("h3", { text: i18n_default.settings.sectionFlowStyler }); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.inlineStyler.name).setDesc(i18n_default.settings.inlineStyler.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.inlineStyler.name).setDesc(i18n_default.settings.inlineStyler.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.inlineStyler).onChange(async (value) => { this.plugin.superstate.settings.inlineStyler = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.inlineStickerMenu.name).setDesc(i18n_default.settings.inlineStickerMenu.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.inlineStickerMenu.name).setDesc(i18n_default.settings.inlineStickerMenu.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.inlineStickerMenu).onChange(async (value) => { this.plugin.superstate.settings.inlineStickerMenu = value; await this.plugin.saveSettings(); this.plugin.reloadExtensions(false); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.inlineStylerColor.name).setDesc(i18n_default.settings.inlineStylerColor.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.inlineStylerColor.name).setDesc(i18n_default.settings.inlineStylerColor.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.inlineStylerColors).onChange((value) => { this.plugin.superstate.settings.inlineStylerColors = value; this.plugin.saveSettings(); this.refreshView(); }) ); - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.mobileMakeBar.name).setDesc(i18n_default.settings.mobileMakeBar.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.mobileMakeBar.name).setDesc(i18n_default.settings.mobileMakeBar.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.mobileMakeBar).onChange((value) => { this.plugin.superstate.settings.mobileMakeBar = value; this.plugin.saveSettings(); @@ -141315,7 +140425,13 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { }) ); } - new import_obsidian9.Setting(containerEl).setName(i18n_default.settings.experimental.name).setDesc(i18n_default.settings.experimental.desc).addToggle( + new import_obsidian4.Setting(containerEl).setName("Perform Search in Background").setDesc("Perform search in background to prevent lag").addToggle( + (toggle) => toggle.setValue(this.plugin.superstate.settings.searchWorker).onChange((value) => { + this.plugin.superstate.settings.searchWorker = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian4.Setting(containerEl).setName(i18n_default.settings.experimental.name).setDesc(i18n_default.settings.experimental.desc).addToggle( (toggle) => toggle.setValue(this.plugin.superstate.settings.experimental).onChange((value) => { this.plugin.superstate.settings.experimental = value; this.plugin.saveSettings(); @@ -141326,12 +140442,12 @@ var MakeMDPluginSettingsTab = class extends import_obsidian9.PluginSettingTab { }; // src/adapters/obsidian/ui/navigator/NavigatorView.tsx -var import_obsidian10 = require("obsidian"); -var import_react180 = __toESM(require_react()); +var import_obsidian5 = require("obsidian"); +var import_react175 = __toESM(require_react()); var FILE_TREE_VIEW_TYPE = "mk-path-view"; var VIEW_DISPLAY_TEXT = "Spaces"; var ICON = "layout-grid"; -var FileTreeView = class extends import_obsidian10.ItemView { +var FileTreeView = class extends import_obsidian5.ItemView { constructor(leaf, superstate, ui) { super(leaf); this.navigation = false; @@ -141339,7 +140455,7 @@ var FileTreeView = class extends import_obsidian10.ItemView { this.ui = ui; } revealInFolder(file) { - if (file instanceof import_obsidian10.TFolder) { + if (file instanceof import_obsidian5.TFolder) { this.leaf.view.app.workspace.activeLeaf.setViewState({ type: SPACE_VIEW_TYPE, state: { path: file.path } @@ -141380,7 +140496,7 @@ var FileTreeView = class extends import_obsidian10.ItemView { this.destroy(); this.root = this.ui.createRoot(this.contentEl); if (this.root) { - this.root.render(/* @__PURE__ */ import_react180.default.createElement(Navigator, { + this.root.render(/* @__PURE__ */ import_react175.default.createElement(Navigator, { superstate: this.superstate })); } else { @@ -141392,7 +140508,7 @@ var FileTreeView = class extends import_obsidian10.ItemView { }; // src/adapters/obsidian/replaceMobileMainMenu.tsx -var import_react181 = __toESM(require_react()); +var import_react176 = __toESM(require_react()); var replaceMobileMainMenu = (superstate) => { if (isTouchScreen(superstate.ui)) { const header = app.workspace.containerEl.querySelector( @@ -141401,15 +140517,768 @@ var replaceMobileMainMenu = (superstate) => { header.innerHTML = ""; const reactEl = superstate.ui.createRoot(header); reactEl.render( - /* @__PURE__ */ import_react181.default.createElement(SidebarProvider, { + /* @__PURE__ */ import_react176.default.createElement(SidebarProvider, { superstate - }, /* @__PURE__ */ import_react181.default.createElement(MainMenu, { + }, /* @__PURE__ */ import_react176.default.createElement(MainMenu, { superstate })) ); } }; +// src/adapters/obsidian/ui/editors/EmbedSpaceView.tsx +var import_obsidian6 = require("obsidian"); +var import_react177 = __toESM(require_react()); +var EMBED_SPACE_VIEW_TYPE = "mk-space-embed"; +var EmbedSpaceView = class extends import_obsidian6.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.navigation = true; + this.plugin = plugin; + } + getViewType() { + return EMBED_SPACE_VIEW_TYPE; + } + getDisplayText() { + return this.path; + } + async onClose() { + this.destroy(); + } + onunload() { + this.destroy(); + } + destroy() { + if (this.root) + this.root.unmount(); + } + async onOpen() { + this.destroy(); + } + async setState(state, result) { + this.path = state.path; + this.source = state.source; + this.constructInlineContext(); + await super.setState(state, result); + const title = pathDisplayName(this.path, this.plugin.superstate); + this.leaf.tabHeaderInnerTitleEl.innerText = title; + this.leaf.view.titleEl = title; + const headerEl = this.leaf.view.headerEl; + if (headerEl) { + headerEl.querySelector(".view-header-title").innerText = title; + } + return; + } + getState() { + const state = super.getState(); + state.path = this.path; + state.source = this.source; + return state; + } + constructInlineContext() { + this.destroy(); + this.root = this.plugin.ui.createRoot(this.contentEl); + if (this.root) { + this.root.render( + /* @__PURE__ */ import_react177.default.createElement(SpaceView, { + path: this.path, + superstate: this.plugin.superstate, + key: this.path, + readOnly: true + }, /* @__PURE__ */ import_react177.default.createElement(SpaceInner, { + superstate: this.plugin.superstate, + header: false + })) + ); + } else { + this.plugin.ui.manager.eventsDispatch.addOnceListener( + "windowReady", + () => { + this.constructInlineContext(); + } + ); + } + } +}; + +// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx +var import_obsidian8 = require("obsidian"); +var import_react180 = __toESM(require_react()); + +// src/adapters/text/removemd.js +function removemd(md, options) { + options = options || {}; + options.listUnicodeChar = options.hasOwnProperty("listUnicodeChar") ? options.listUnicodeChar : false; + options.stripListLeaders = options.hasOwnProperty("stripListLeaders") ? options.stripListLeaders : true; + options.gfm = options.hasOwnProperty("gfm") ? options.gfm : true; + options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true; + options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false; + options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false; + options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : []; + var output = md || ""; + output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*/gm, ""); + try { + if (options.stripListLeaders) { + if (options.listUnicodeChar) + output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1"); + else + output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1"); + } + if (options.gfm) { + output = output.replace(/\n={2,}/g, "\n").replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/`{3}.*\n/g, ""); + } + if (options.abbr) { + output = output.replace(/\*\[.*\]:.*\n/, ""); + } + output = output.replace(/<[^>]*>/g, ""); + var htmlReplaceRegex = new RegExp("<[^>]*>", "g"); + if (options.htmlTagsToSkip.length > 0) { + var joinedHtmlTagsToSkip = "(?!" + options.htmlTagsToSkip.join("|") + ")"; + htmlReplaceRegex = new RegExp( + "<" + joinedHtmlTagsToSkip + "[^>]*>", + "ig" + ); + } + output = output.replace(htmlReplaceRegex, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "").replace(/\[([^\]]*?)\][\[\(].*?[\]\)]/g, options.replaceLinksWithURL ? "$2" : "$1").replace(/^(\n)?\s{0,3}>\s?/gm, "$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, "$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g, "$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, "$1$3$4$5").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/~(.*?)~/g, "$1"); + } catch (e5) { + console.error(e5); + return md; + } + return output; +} + +// src/adapters/text/textCacher.ts +var regexYaml = /^---\s*\n(.*?)\n?^---\s?/ms; +var textCacheExperimental = { + wordCount: (str) => { + const spaceDelimitedChars = /'’A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source; + const nonSpaceDelimitedWords = /\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/.source; + const nonSpaceDelimitedWordsOther = /[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5]{1}/.source; + const pattern = new RegExp( + [ + `(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${spaceDelimitedChars}])+`, + nonSpaceDelimitedWords, + nonSpaceDelimitedWordsOther + ].join("|"), + "g" + ); + return (str.replace(regexYaml, "").match(pattern) || []).length; + }, + preview: (str) => { + return removemd(str.replace(regexYaml, "")); + } +}; +var TextCacher = class { + constructor(plugin) { + this.plugin = plugin; + this.supportedFileTypes = ["md"]; + this.id = "text.make.md"; + this.plugin = plugin; + this.cache = /* @__PURE__ */ new Map(); + } + initiate(middleware) { + this.middleware = middleware; + this.middleware.eventDispatch.addListener("onModify", this.refreshCache.bind(this)); + } + refreshCache(payload) { + if (this.supportedFileTypes.find((type) => type == payload.file.extension)) + this.parseCache(payload.file, true); + } + async parseCache(file, refresh) { + if (!file) + return; + const contents = await this.plugin.app.vault.cachedRead(getAbstractFileAtPath(this.plugin.app, file.path)); + const updatedCache = {}; + Object.keys(textCacheExperimental).forEach((key2) => { + const runner = textCacheExperimental[key2]; + updatedCache[key2] = runner(contents); + }); + this.cache.set(file.path, updatedCache); + this.middleware.updateFileCache(file.path, updatedCache, refresh); + } +}; + +// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx +var import_obsidian7 = require("obsidian"); +var import_classnames15 = __toESM(require_classnames()); +var import_react179 = __toESM(require_react()); + +// src/adapters/obsidian/filetypes/frontmatter/frontMatterKeys.ts +var frontMatterKeys = (fm) => { + return Object.keys(fm ?? {}).filter((f2) => f2 != "position"); +}; + +// src/adapters/obsidian/ui/editors/markdownView/RemoteMarkdownHeaderView.tsx +var import_react178 = __toESM(require_react()); +var RemoteMarkdownHeaderView = (props) => { + const { name: name319, fm } = props; + const [collapsed, setCollapsed] = (0, import_react178.useState)(false); + const tags5 = fm.tags ?? []; + const [values2, setValues] = (0, import_react178.useState)({}); + const [columns, setColumns] = (0, import_react178.useState)([]); + (0, import_react178.useEffect)(() => { + const newCols = []; + const newValues = {}; + const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)); + const cols = fmKeys.map((f2) => ({ + table: "", + name: f2, + schemaId: "", + type: yamlTypeToMDBType(detectPropertyType(fm[f2], f2)) + })); + if (fm) { + newCols.push(...cols); + Object.keys(fm).forEach((c3) => { + newValues[c3] = parseProperty(c3, fm[c3]); + }); + } + setValues(newValues); + setColumns(newCols); + }, []); + const pathState = (0, import_react178.useMemo)( + () => ({ + name: name319, + path: name319, + readOnly: true, + type: "note", + label: { + sticker: fm.sticker, + color: fm.color, + name: name319 + }, + metadata: { + property: { + banner: fm.banner + } + } + }), + [fm, name319] + ); + return /* @__PURE__ */ import_react178.default.createElement(PathProvider, { + superstate: props.superstate, + path: props.name, + pathState, + readMode: true + }, pathState.metadata.property.banner && /* @__PURE__ */ import_react178.default.createElement(BannerView, { + superstate: props.superstate + }), /* @__PURE__ */ import_react178.default.createElement("div", { + className: "mk-path-context-component" + }, /* @__PURE__ */ import_react178.default.createElement("div", { + className: `mk-path-context-label ${props.superstate.settings.inlineContextNameLayout == "horizontal" ? "mk-path-context-file-horizontal" : ""}` + }, /* @__PURE__ */ import_react178.default.createElement(import_react178.default.Fragment, null, fm.sticker ? /* @__PURE__ */ import_react178.default.createElement("div", { + className: "mk-header-icon" + }, /* @__PURE__ */ import_react178.default.createElement("div", { + className: `mk-path-icon` + }, /* @__PURE__ */ import_react178.default.createElement("div", { + dangerouslySetInnerHTML: { + __html: props.superstate.ui.getSticker(fm.sticker) + } + }))) : /* @__PURE__ */ import_react178.default.createElement(import_react178.default.Fragment, null), /* @__PURE__ */ import_react178.default.createElement("div", { + className: "mk-inline-title inline-title" + }, pathNameToString(name319))))), !collapsed ? /* @__PURE__ */ import_react178.default.createElement("div", { + className: "mk-path-context-component" + }, /* @__PURE__ */ import_react178.default.createElement(import_react178.default.Fragment, null, columns.map((f2, i4) => /* @__PURE__ */ import_react178.default.createElement(DataPropertyView, { + key: i4, + superstate: props.superstate, + initialValue: values2[f2.name], + row: {}, + column: { ...f2, table: "" }, + editMode: 2 /* EditModeView */, + updateValue: () => { + }, + updateFieldValue: (fieldValue, value) => { + }, + contextTable: {} + })))) : /* @__PURE__ */ import_react178.default.createElement(import_react178.default.Fragment, null)); +}; + +// src/adapters/obsidian/ui/editors/markdownView/FileLinkViewComponent.tsx +var FileLinkViewComponent = (props) => { + const ref2 = (0, import_react179.useRef)(null); + const [markdown, setMarkdown] = (0, import_react179.useState)(""); + const [fm, setFM] = (0, import_react179.useState)({}); + (0, import_react179.useEffect)(() => { + if (ref2.current) { + import_obsidian7.MarkdownRenderer.render( + props.app, + markdown, + ref2.current, + props.path, + props.component + ); + const observer = new MutationObserver(() => { + const links = ref2.current.querySelectorAll("a"); + links.forEach((link) => { + if (link.getAttribute("href").endsWith(".md")) { + link.addEventListener("click", (event) => { + event.preventDefault(); + }); + } + }); + }); + observer.observe(ref2.current, { childList: true, subtree: true }); + return () => observer.disconnect(); + } + }, [markdown]); + (0, import_react179.useEffect)(() => { + if (props.superstate.pathsIndex.get(props.path)) { + props.superstate.spaceManager.readPath(props.path).then((f2) => { + const match2 = f2.match(regexYaml); + if (match2) { + setMarkdown(f2.replace(match2[0], "")); + const yamlContent = match2[1]; + setFM((0, import_obsidian7.parseYaml)(yamlContent)); + } else { + setMarkdown(f2); + } + }); + return; + } + props.superstate.spaceManager.pathExists(props.path).then((f2) => { + if (f2) { + props.superstate.spaceManager.readPath(props.path).then((f3) => { + const match2 = f3.match(regexYaml); + if (match2) { + setMarkdown(f3.replace(match2[0], "")); + const yamlContent = match2[1]; + setFM((0, import_obsidian7.parseYaml)(yamlContent)); + } else { + setMarkdown(f3); + } + }); + } else { + fetch(props.path).then((res) => res.text()).then((f3) => { + const match2 = f3.match(regexYaml); + if (match2) { + setMarkdown(f3.replace(match2[0], "")); + const yamlContent = match2[1]; + setFM((0, import_obsidian7.parseYaml)(yamlContent)); + } else { + setMarkdown(f3); + } + }); + } + }); + }, [props.path]); + return /* @__PURE__ */ import_react179.default.createElement("div", { + className: (0, import_classnames15.default)( + "markdown-preview-view markdown-rendered node-insert-event allow-fold-headings show-indentation-guide allow-fold-lists show-frontmatter", + props.superstate.settings.readableLineWidth ? "is-readable-line-width" : "" + ) + }, !props.flow && /* @__PURE__ */ import_react179.default.createElement("div", { + className: "mk-remote-header" + }, /* @__PURE__ */ import_react179.default.createElement(RemoteMarkdownHeaderView, { + superstate: props.superstate, + name: fm.name ?? pathToString(props.path), + fm + })), /* @__PURE__ */ import_react179.default.createElement("div", { + className: "markdown-preview-sizer markdown-preview-section", + ref: ref2 + })); +}; + +// src/adapters/obsidian/ui/editors/markdownView/FileView.tsx +var LINK_VIEW_TYPE = "mk-uri-view"; +var FileLinkView = class extends import_obsidian8.ItemView { + constructor(leaf, app2, viewType, superstate) { + super(leaf); + this.superstate = superstate; + this.navigation = true; + this.flow = false; + this.app = app2; + this.viewType = viewType; + } + getViewType() { + return LINK_VIEW_TYPE; + } + getDisplayText() { + return this.path; + } + async onClose() { + this.destroy(); + } + destroy() { + if (this.root) + this.root.unmount(); + } + async onOpen() { + this.destroy(); + } + async setState(state, result) { + this.path = state.path; + this.flow = state.flow; + this.constructView(this.path); + const displayName = this.path; + await super.setState(state, result); + this.leaf.tabHeaderInnerTitleEl.innerText = displayName; + this.leaf.view.titleEl = displayName; + const headerEl = this.leaf.view.headerEl; + if (headerEl) { + headerEl.querySelector(".view-header-title").innerText = displayName; + } + result.history = true; + return; + } + getState() { + const state = super.getState(); + state.path = this.path; + state.flow = this.flow; + return state; + } + constructView(path2) { + this.destroy(); + this.root = this.superstate.ui.createRoot(this.contentEl); + this.root.render( + /* @__PURE__ */ import_react180.default.createElement("div", { + className: "markdown-reading-view" + }, /* @__PURE__ */ import_react180.default.createElement(FileLinkViewComponent, { + app: this.app, + component: this, + superstate: this.superstate, + path: path2, + flow: this.flow + })) + ); + } +}; + +// src/adapters/obsidian/utils/file.ts +var import_obsidian10 = require("obsidian"); + +// src/adapters/obsidian/ui/editors/SpaceFragmentViewComponent.tsx +var import_obsidian9 = require("obsidian"); +var import_react181 = __toESM(require_react()); +var SPACE_FRAGMENT_VIEW_TYPE = "mk-space-fragment"; +var SpaceFragmentView = class extends import_obsidian9.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.navigation = true; + this.plugin = plugin; + } + getViewType() { + return SPACE_FRAGMENT_VIEW_TYPE; + } + getDisplayText() { + return this.path; + } + async onClose() { + this.destroy(); + } + onunload() { + this.destroy(); + } + destroy() { + if (this.root) + this.root.unmount(); + } + async onOpen() { + this.destroy(); + } + async setState(state, result) { + this.path = state.path; + this.source = state.source; + this.flow = state.flow; + this.constructInlineContext(); + await super.setState(state, result); + const title = pathDisplayName(this.path, this.plugin.superstate); + this.leaf.tabHeaderInnerTitleEl.innerText = title; + this.leaf.view.titleEl = title; + const headerEl = this.leaf.view.headerEl; + if (headerEl) { + headerEl.querySelector(".view-header-title").innerText = title; + } + return; + } + getState() { + const state = super.getState(); + state.path = this.path; + state.source = this.source; + state.flow = this.flow; + return state; + } + constructInlineContext() { + this.destroy(); + this.root = this.plugin.ui.createRoot(this.contentEl); + if (this.root) { + if (this.flow) { + this.root.render( + /* @__PURE__ */ import_react181.default.createElement(SpaceFragmentViewComponent, { + id: this.path, + superstate: this.plugin.superstate, + path: this.path, + source: this.source, + showTitle: true + }) + ); + } else { + this.root.render( + /* @__PURE__ */ import_react181.default.createElement(SpaceFragmentWrapper, { + superstate: this.plugin.superstate, + path: this.path + }, /* @__PURE__ */ import_react181.default.createElement(SpaceFragmentViewComponent, { + id: this.path, + superstate: this.plugin.superstate, + path: this.path, + source: this.source + })) + ); + } + } else { + this.plugin.ui.manager.eventsDispatch.addOnceListener( + "windowReady", + () => { + this.constructInlineContext(); + } + ); + } + } +}; + +// src/adapters/obsidian/utils/file.ts +var tFileToAFile = (file) => { + if (!file) + return null; + if (file instanceof import_obsidian10.TFile && file.stat) { + return { + isFolder: false, + name: file.basename, + filename: file.name, + path: file.path, + parent: file.parent?.path, + extension: file.extension, + ...file.stat + }; + } + return { + isFolder: true, + name: file.name, + filename: file.name, + path: file.path, + parent: file.parent?.path + }; +}; +var defaultConfigFile = async (plugin) => { + return await plugin.app.vault.adapter.read( + (0, import_obsidian10.normalizePath)(plugin.app.vault.configDir + "/app.json") + ); +}; +var fileExtensionForFile = (path2) => path2?.indexOf(".") > 0 ? path2.split(".").pop() : "md"; +var fileNameForFile = (path2) => path2?.indexOf("/") > 0 ? path2.split("/").pop().split(".").shift() : path2.split(".").shift(); +var uniqueFileName = (oldName, name319, extension, folder) => { + let newName = sanitizeFileName(name319); + let uniqueName = false; + let append = 1; + while (!uniqueName) { + if (!folder.children.some((f2) => f2.name == `${newName}.${extension}` && f2.name != oldName)) { + uniqueName = true; + } else { + newName = `${newName} ${append}`; + append += 1; + } + } + return `${newName}.${extension}`; +}; +function getAllAbstractFilesInVault(app2) { + const files = []; + const rootFolder = app2.vault.getRoot(); + function recursiveFx(folder) { + for (const child of folder.children) { + if (child instanceof import_obsidian10.TFolder) { + const childFolder = child; + if (childFolder.children) + recursiveFx(childFolder); + } + files.push(child); + } + } + recursiveFx(rootFolder); + files.push(rootFolder); + return files; +} +var openPath = async (leaf, path2, plugin, flow) => { + const uri = plugin.superstate.spaceManager.uriByString(path2); + if (!uri) + return; + if (uri.scheme == "https" || uri.scheme == "http") { + if (plugin.superstate.spacesIndex.has(path2)) { + const viewType = SPACE_VIEW_TYPE; + plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: path2, flow } + }); + return; + } else if (plugin.superstate.pathsIndex.has(path2)) { + const viewType = LINK_VIEW_TYPE; + plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: path2, flow } + }); + return; + } + window.open(uri.fullPath, "_blank"); + return; + } + if (uri.scheme == "obsidian") { + await leaf.setViewState({ + type: uri.authority + }); + return; + } + if (uri.ref) { + const cache2 = plugin.superstate.pathsIndex.get(uri.path); + if (cache2?.type == "space" || uri.scheme == "spaces") { + if (flow && uri.ref == "main") { + await leaf.setViewState({ + type: EMBED_SPACE_VIEW_TYPE, + state: { path: uri.fullPath } + }); + } else { + await leaf.setViewState({ + type: SPACE_FRAGMENT_VIEW_TYPE, + state: { path: uri.fullPath, flow } + }); + } + return; + } + } + if (uri.scheme == "spaces") { + openTagContext(leaf, uri.authority, plugin.app); + return; + } + plugin.files.getFile(path2).then((f2) => { + if (f2) { + if (f2.isFolder) { + openTFolder(leaf, getAbstractFileAtPath(plugin.app, f2.path), plugin, flow); + } else if (f2) { + openTFile(leaf, getAbstractFileAtPath(plugin.app, f2.path), plugin.app); + } else { + return; + } + } else { + if (path2.contains("/")) { + const folder = removeTrailingSlashFromFolder(getParentPathFromString(path2)); + const spaceFolder = plugin.superstate.spacesIndex.get(folder); + if (spaceFolder) { + newPathInSpace( + plugin.superstate, + spaceFolder, + fileExtensionForFile(path2), + fileNameForFile(path2) + ); + } + } else { + defaultSpace(plugin.superstate, plugin.superstate.pathsIndex.get(plugin.superstate.ui.activePath)).then((f3) => { + if (f3) + newPathInSpace( + plugin.superstate, + f3, + fileExtensionForFile(path2), + fileNameForFile(path2) + ); + }); + } + } + }); +}; +var getLeaf = (app2, location) => { + let leaf; + if (location == "system" || location == "hover") { + return null; + } else if (location == "right") { + leaf = app2.workspace.getRightLeaf(false); + } else if (location == "left") { + leaf = app2.workspace.getLeftLeaf(false); + } else { + leaf = app2.workspace.getLeaf(location); + } + return leaf; +}; +var openURL = async (url, app2, location) => { + if (location == "system") { + window.open(url, "_blank"); + return; + } + const leaf = getLeaf(app2, location); + if (url.endsWith(".md")) { + const viewType = LINK_VIEW_TYPE; + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: url } + }); + await app2.workspace.requestSaveLayout(); + } else if (url.endsWith(".mdb")) { + const viewType = SPACE_VIEW_TYPE; + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path: url } + }); + await app2.workspace.requestSaveLayout(); + } else { + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: EMBED_SPACE_VIEW_TYPE, + state: { path: url } + }); + } + if (import_obsidian10.Platform.isMobile) { + app2.workspace.leftSplit.collapse(); + } +}; +var openTFile = async (leaf, file, app2) => { + if (!file) + return; + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.openFile(file); +}; +var openTFolder = async (leaf, file, plugin, flow) => { + if (!plugin.superstate.settings.spaceViewEnabled) { + if (!plugin.superstate.settings.enableFolderNote) { + return; + } + const space2 = plugin.superstate.spacesIndex.get(file.path)?.space.notePath; + if (!space2) + return; + const spaceFile = getAbstractFileAtPath(plugin.app, space2); + if (!spaceFile) + return; + plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); + leaf.openFile(spaceFile); + return; + } + if (flow) { + await leaf.setViewState({ + type: EMBED_SPACE_VIEW_TYPE, + state: { path: file.path } + }); + } else { + plugin.app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: SPACE_VIEW_TYPE, + state: { path: file.path } + }); + await plugin.app.workspace.requestSaveLayout(); + if (import_obsidian10.Platform.isMobile) { + plugin.app.workspace.leftSplit.collapse(); + } + } +}; +var openTagContext = async (leaf, tag2, app2) => { + const viewType = SPACE_VIEW_TYPE; + app2.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ type: viewType, state: { path: "spaces://" + tag2 } }); + await app2.workspace.requestSaveLayout(); + if (import_obsidian10.Platform.isMobile) { + app2.workspace.leftSplit.collapse(); + } +}; +var getAbstractFileAtPath = (app2, path2) => { + return app2.vault.getAbstractFileByPath(path2); +}; + // src/adapters/obsidian/ui/editors/MDBFileViewer.tsx var import_obsidian11 = require("obsidian"); var import_react182 = __toESM(require_react()); @@ -142617,6 +142486,321 @@ var lucideIcons = [ "zoom-out" ]; +// src/adapters/obsidian/ui/editors/FlowEditor.tsx +var import_obsidian15 = require("obsidian"); +var popovers = /* @__PURE__ */ new WeakMap(); +var mouseCoords = { x: 0, y: 0 }; +function nosuper(base2) { + const derived = function() { + return Object.setPrototypeOf(new import_obsidian15.Component(), new.target.prototype); + }; + derived.prototype = base2.prototype; + return Object.setPrototypeOf(derived, base2); +} +var FlowEditor = class extends nosuper(import_obsidian15.HoverPopover) { + constructor(parent, targetEl, plugin, waitTime, onShowCallback) { + super(); + this.targetEl = targetEl; + this.plugin = plugin; + this.onShowCallback = onShowCallback; + this.abortController = this.addChild(new import_obsidian15.Component()); + this.detaching = false; + this.opening = false; + this.rootSplit = new import_obsidian15.WorkspaceSplit( + this.plugin.app.workspace, + "vertical" + ); + this.targetRect = this.targetEl?.getBoundingClientRect(); + this.oldPopover = this.parent?.flowEditor; + this.document = this.targetEl?.ownerDocument ?? window.activeDocument ?? window.document; + this.id = genId(); + this.hoverEl = this.document.defaultView.createDiv({ + cls: "mk-floweditor mk-hover-popover", + attr: { id: "he" + this.id } + }); + if (waitTime === void 0) { + waitTime = 10; + } + this.onTarget = true; + this.parent = parent; + this.waitTime = waitTime; + this.state = import_obsidian15.PopoverState.Showing; + const { hoverEl } = this; + this.abortController.load(); + this.timer = window.setTimeout(this.show.bind(this), waitTime); + this.setActive = this._setActive.bind(this); + if (hoverEl) { + hoverEl.addEventListener("mousedown", this.setActive); + hoverEl.addEventListener("mousedown", (e5) => e5.stopPropagation()); + } + popovers.set(this.hoverEl, this); + this.hoverEl.addClass("hover-editor"); + this.containerEl = this.hoverEl.createDiv("popover-content"); + this.setTitleBar(); + this.hoverEl.style.height = "auto"; + this.hoverEl.style.width = "100%"; + this.hoverEl.addEventListener("keydown", (e5) => e5.stopPropagation()); + } + static activeWindows() { + const windows2 = [window]; + const { floatingSplit } = app.workspace; + if (floatingSplit) { + for (const split of floatingSplit.children) { + if (split.win) + windows2.push(split.win); + } + } + return windows2; + } + static containerForDocument(app2, doc) { + if (doc !== document && app2.workspace.floatingSplit) + for (const container of app2.workspace.floatingSplit.children) { + if (container.doc === doc) + return container; + } + return app2.workspace.rootSplit; + } + static activePopovers() { + return this.activeWindows().flatMap(this.popoversForWindow); + } + static popoversForWindow(win) { + return Array.prototype.slice.call( + win?.document?.body.querySelectorAll(".mk-hover-popover") ?? [] + ).map((el) => popovers.get(el)).filter((he) => he); + } + static forLeaf(leaf) { + const el = leaf && document.body.matchParent.call(leaf.containerEl, ".mk-hover-popover"); + return el ? popovers.get(el) : void 0; + } + onunload() { + this.hide(); + } + _setActive() { + this.plugin.app.workspace.setActiveLeaf(this.leaves()[0], { focus: true }); + } + getDefaultMode() { + return this.parent?.view?.getMode ? this.parent.view.getMode() : "preview"; + } + updateLeaves() { + if (this.onTarget && this.targetEl && !this.document.contains(this.targetEl)) { + this.onTarget = false; + this.transition(); + } + let leafCount2 = 0; + this.plugin.app.workspace.iterateLeaves((leaf) => { + leafCount2++; + }, this.rootSplit); + if (leafCount2 === 0) { + this.hide(); + } else if (leafCount2 > 1) { + } + this.hoverEl.setAttribute("data-leaf-count", leafCount2.toString()); + } + setTitleBar() { + this.titleEl = this.document.defaultView.createDiv("mk-flow-titlebar"); + this.containerEl.prepend(this.titleEl); + } + attachLeaf() { + this.rootSplit.getRoot = () => this.plugin.app.workspace[this.document === document ? "rootSplit" : "floatingSplit"]; + this.rootSplit.getContainer = () => FlowEditor.containerForDocument(this.plugin.app, this.document); + this.titleEl.insertAdjacentElement("afterend", this.rootSplit.containerEl); + const leaf = this.plugin.app.workspace.createLeafInParent( + this.rootSplit, + 0 + ); + leaf.isFlowBlock = true; + this.updateLeaves(); + return leaf; + } + onload() { + super.onload(); + this.registerEvent( + this.plugin.app.workspace.on("layout-change", this.updateLeaves, this) + ); + this.registerEvent( + app.workspace.on("layout-change", () => { + this.rootSplit.children.forEach((item, index3) => { + if (item instanceof import_obsidian15.WorkspaceTabs) { + this.rootSplit.replaceChild(index3, item.children[0]); + } + }); + }) + ); + } + leaves() { + const leaves = []; + this.plugin.app.workspace.iterateLeaves((leaf) => { + leaves.push(leaf); + }, this.rootSplit); + return leaves; + } + async onShow() { + const closeDelay = 600; + setTimeout(() => this.waitTime = closeDelay, closeDelay); + this.oldPopover?.hide(); + this.oldPopover = null; + this.hoverEl.classList.add("is-new"); + this.document.body.addEventListener( + "click", + () => { + this.hoverEl.classList.remove("is-new"); + }, + { once: true, capture: true } + ); + if (this.parent) { + this.parent.flowEditor = this; + this.parent.view.addChild(this); + } + await this.onShowCallback?.(this); + this.onShowCallback = void 0; + const viewHeaderEl = this.hoverEl.querySelector(".view-header"); + viewHeaderEl?.remove(); + const sizer = this.hoverEl.querySelector(".workspace-leaf"); + if (sizer) + this.hoverEl.appendChild(sizer); + const inlineTitle = this.hoverEl.querySelector(".inline-title"); + inlineTitle?.remove(); + } + transition() { + if (this.shouldShow()) { + if (this.state === import_obsidian15.PopoverState.Hiding) { + this.state = import_obsidian15.PopoverState.Shown; + clearTimeout(this.timer); + } + } else { + if (this.state === import_obsidian15.PopoverState.Showing) { + this.hide(); + } else { + if (this.state === import_obsidian15.PopoverState.Shown) { + this.state = import_obsidian15.PopoverState.Hiding; + this.timer = window.setTimeout(() => { + if (this.shouldShow()) { + this.transition(); + } else { + this.hide(); + } + }, this.waitTime); + } + } + } + } + shouldShow() { + return this.shouldShowSelf() || this.shouldShowChild(); + } + shouldShowChild() { + return FlowEditor.activePopovers().some((popover) => { + if (popover !== this && popover.targetEl && this.hoverEl.contains(popover.targetEl)) { + return popover.shouldShow(); + } + return false; + }); + } + shouldShowSelf() { + return !this.detaching && !!(this.onTarget || this.state == import_obsidian15.PopoverState.Shown || this.document.querySelector( + `body>.modal-container, body > #he${this.id} ~ .menu, body > #he${this.id} ~ .suggestion-container` + )); + } + show() { + this.state = import_obsidian15.PopoverState.Shown; + this.timer = 0; + this.shownPos = mouseCoords; + this.targetEl.replaceChildren(this.hoverEl); + this.onShow(); + app.workspace.onLayoutChange(); + this.load(); + } + onHide() { + this.oldPopover = null; + if (this.parent?.flowEditor === this) { + this.parent.flowEditor = null; + } + } + hide() { + this.onTarget = false; + this.detaching = true; + if (this.timer) { + clearTimeout(this.timer); + this.timer = 0; + } + this.hoverEl.hide(); + if (this.opening) + return; + const leaves = this.leaves(); + if (leaves.length) { + leaves.forEach((leaf) => { + leaf.detach(); + }); + } else { + this.parent = null; + this.abortController?.unload(); + this.abortController = void 0; + return this.nativeHide(); + } + } + nativeHide() { + const { hoverEl, targetEl } = this; + this.state = import_obsidian15.PopoverState.Hidden; + hoverEl.detach(); + if (targetEl) { + const parent = targetEl.matchParent(".mk-hover-popover"); + if (parent) + popovers.get(parent)?.transition(); + } + this.onHide(); + this.unload(); + } + async openContext(file, openState, useLeaf) { + if (this.detaching) + return; + const leaf = useLeaf ?? this.attachLeaf(); + this.opening = true; + try { + await leaf.openFile(file, openState); + } catch (e5) { + console.error(e5); + } finally { + this.opening = false; + if (this.detaching) + this.hide(); + } + return leaf; + } + async openFile(file, openState, useLeaf) { + if (this.detaching) + return; + const leaf = useLeaf ?? this.attachLeaf(); + this.opening = true; + try { + await leaf.openFile(file, openState); + } catch (e5) { + console.error(e5); + } finally { + this.opening = false; + if (this.detaching) + this.hide(); + } + return leaf; + } + buildState(parentMode, eState) { + return { + active: false, + state: {}, + eState + }; + } + buildEphemeralState(file, link) { + const cache2 = this.plugin.app.metadataCache.getFileCache(file); + const subpath = cache2 ? (0, import_obsidian15.resolveSubpath)(cache2, link?.subpath || "") : void 0; + const eState = { subpath: link?.subpath }; + if (subpath) { + eState.line = subpath.start.line; + eState.startLoc = subpath.start; + eState.endLoc = subpath.end || void 0; + } + return eState; + } +}; + // node_modules/monkey-around/mjs/index.js function around(obj, factories) { const removers = Object.keys(factories).map((key2) => around1(obj, key2, factories[key2])); @@ -142652,10 +142836,10 @@ function around1(obj, method, createWrapper) { } // src/adapters/obsidian/utils/patches.ts -var import_obsidian15 = require("obsidian"); +var import_obsidian16 = require("obsidian"); var patchFilesPlugin = (plugin) => { plugin.register( - around(import_obsidian15.Workspace.prototype, { + around(import_obsidian16.Workspace.prototype, { getLeavesOfType(old) { return function(type) { if (type == "file-explorer") { @@ -142669,7 +142853,7 @@ var patchFilesPlugin = (plugin) => { }; var patchWorkspace = (plugin) => { let layoutChanging = false; - const uninstaller = around(import_obsidian15.Workspace.prototype, { + const uninstaller = around(import_obsidian16.Workspace.prototype, { changeLayout(old) { return async function(workspace) { layoutChanging = true; @@ -142680,6 +142864,30 @@ var patchWorkspace = (plugin) => { } }; }, + getLeaf(old) { + return function(newLeaf, direction) { + let leaf = old.call(this, newLeaf, direction); + if (leaf.isFlowBlock) { + let foundLeaf = false; + plugin.app.workspace.iterateLeaves((_leaf) => { + if (_leaf.flowEditor) { + _leaf.flowEditor.leaves().forEach((l2) => { + if (l2.id == leaf.id) { + foundLeaf = true; + leaf = _leaf; + return; + } + }); + if (foundLeaf) + return true; + } + leaf = _leaf; + return; + }, plugin.app.workspace["rootSplit"]); + } + return leaf; + }; + }, iterateLeaves(old) { return function(arg1, arg2) { if (old.call(this, arg1, arg2)) @@ -142690,7 +142898,7 @@ var patchWorkspace = (plugin) => { return false; if (layoutChanging) return false; - if (parent === plugin.app.workspace.rootSplit || import_obsidian15.WorkspaceContainer && parent instanceof import_obsidian15.WorkspaceContainer) { + if (parent === plugin.app.workspace.rootSplit || import_obsidian16.WorkspaceContainer && parent instanceof import_obsidian16.WorkspaceContainer) { for (const popover of FlowEditor.popoversForWindow( parent.win )) { @@ -142701,6 +142909,15 @@ var patchWorkspace = (plugin) => { return false; }; }, + openLinkText(old) { + return function openLinkText(linkText, sourcePath, newLeaf, openViewState) { + if (linkText.startsWith("spaces://")) { + plugin.ui.openPath(linkText, newLeaf); + return; + } + return old.call(this, linkText, sourcePath, newLeaf, openViewState); + }; + }, setActiveLeaf(old) { return function setActiveLeaf(leaf, params) { if (leaf.view.getViewType() == "markdown") { @@ -142926,7 +143143,7 @@ var dbResultsToDBTables = (res) => { cols: c3.columns, rows: c3 ? c3.values.map( (r2) => c3.columns.reduce( - (prev, curr, index2) => ({ ...prev, [curr]: r2[index2] }), + (prev, curr, index3) => ({ ...prev, [curr]: r2[index3] }), {} ) ) : [] @@ -143040,7 +143257,7 @@ var saveDBToPath = async (plugin, path2, tables, mdb = true) => { if (mdb) { let mdbStruct = []; try { - mdbStruct = dbResultsToDBTables(db.exec(`SELECT name FROM sqlite_master WHERE type='table' AND name='m_schema' OR name='m_fields';`))[0].rows; + mdbStruct = dbResultsToDBTables(db.exec(`SELECT name FROM sqlite_master WHERE type='table' AND name='m_schema' OR name='m_fields';`))[0]?.rows ?? []; } catch (e5) { console.log(e5); } @@ -143561,14 +143778,14 @@ var MDBFileTypeAdapter = class { var import_lodash22 = __toESM(require_lodash()); // src/adapters/obsidian/filesystem/indexCurrentFileTree.ts -var import_obsidian16 = require("obsidian"); +var import_obsidian17 = require("obsidian"); var indexCurrentFileTree = (plugin, vaultDB) => { const treeItems = getAllAbstractFilesInVault(plugin.app).map((file) => ({ ...vaultDB.find((f2) => f2.path == file.path) ?? {}, path: file.path, parent: file.parent?.path, - created: file instanceof import_obsidian16.TFile ? file.stat.ctime.toString() : void 0, - folder: file instanceof import_obsidian16.TFolder ? "true" : "false" + created: file instanceof import_obsidian17.TFile ? file.stat.ctime.toString() : void 0, + folder: file instanceof import_obsidian17.TFolder ? "true" : "false" })); return { vault: { @@ -143589,7 +143806,7 @@ var rebuildIndex = async (filesystem, plugin, save) => { }; // src/adapters/obsidian/utils/tags.ts -var import_obsidian17 = require("obsidian"); +var import_obsidian18 = require("obsidian"); var tagKeys = ["tags"]; var loadTags = (app2, settings) => { const folder = settings.spacesFolder == "" ? app2.vault.getRoot() : getAbstractFileAtPath( @@ -143599,14 +143816,14 @@ var loadTags = (app2, settings) => { return uniq([ ...Object.keys(app2.metadataCache.getTags()).map((f2) => f2.toLowerCase()), ...folder?.children.filter( - (f2) => f2 instanceof import_obsidian17.TFolder && f2.name.charAt(0) == "#" + (f2) => f2 instanceof import_obsidian18.TFolder && f2.name.charAt(0) == "#" ).map((f2) => tagPathToTag(f2.name)) ?? [] ]); }; var tagExists = (currentCache, findTag) => { let currentTags = []; - if ((0, import_obsidian17.getAllTags)(currentCache)) { - currentTags = (0, import_obsidian17.getAllTags)(currentCache); + if ((0, import_obsidian18.getAllTags)(currentCache)) { + currentTags = (0, import_obsidian18.getAllTags)(currentCache); } return currentTags.find((tag2) => tag2.toLowerCase() == findTag.toLowerCase()) ? true : false; }; @@ -143769,7 +143986,7 @@ var editTagInFileBody = async (plugin, oldTag, newTag, positions, file) => { // src/adapters/obsidian/filesystem/filesystem.ts var import_lodash25 = __toESM(require_lodash()); -var import_obsidian19 = require("obsidian"); +var import_obsidian20 = require("obsidian"); // src/adapters/mdb/localCache/localCache.ts var import_lodash23 = __toESM(require_lodash()); @@ -143826,7 +144043,7 @@ var LocalStorageCache = class { async remove(path2, type) { if (!this.db) return; - await deleteFromDB(this.db, type, `path='${path2}'`); + await deleteFromDB(this.db, type, `path='${sanitizeSQLStatement(path2)}'`); this.debounceSaveSpaceDatabase(); return; } @@ -143921,13 +144138,13 @@ var MobileCachePersister = class { }; // src/adapters/obsidian/filetypes/frontmatter/fm.ts -var import_obsidian18 = require("obsidian"); +var import_obsidian19 = require("obsidian"); var getAllFrontmatterKeys = (plugin) => { return uniq(getAllAbstractFilesInVault(plugin.app).flatMap((f2) => Object.keys(frontMatterForFile(app, f2) ?? {}) ?? []).filter((f2) => !FMSpaceKeys(plugin.superstate.settings).includes(f2))); }; var frontMatterForFile = (app2, file) => { let currentCache; - if (file instanceof import_obsidian18.TFile && app2.metadataCache.getFileCache(file) !== null) { + if (file instanceof import_obsidian19.TFile && app2.metadataCache.getFileCache(file) !== null) { currentCache = app2.metadataCache.getFileCache(file); } return currentCache?.frontmatter; @@ -143941,7 +144158,7 @@ var ObsidianFileSystem = class { this.vaultDBCache = []; this.cache = /* @__PURE__ */ new Map(); this.vaultQueue = Promise.resolve(); - this.spacesDBPath = (0, import_obsidian19.normalizePath)( + this.spacesDBPath = (0, import_obsidian20.normalizePath)( this.plugin.app.vault.configDir + "/plugins/make-md/Spaces.mdb" ); this.debounceSaveSpaceDatabase = (0, import_lodash25.debounce)( @@ -143957,7 +144174,7 @@ var ObsidianFileSystem = class { if (!file) return; this.addToVaultQueue(async () => { - const folder = file instanceof import_obsidian19.TFolder; + const folder = file instanceof import_obsidian20.TFolder; const parent = file.parent; await this.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: [...this.vaultDBCache, { path: file.path, @@ -143989,7 +144206,7 @@ var ObsidianFileSystem = class { if (!file) return; this.addToVaultQueue(async () => { - if (file instanceof import_obsidian19.TFolder) { + if (file instanceof import_obsidian20.TFolder) { const newVaultRows = this.vaultDBCache.filter((f2) => f2.path != file.path && !f2.parent.startsWith(file.path)); await this.saveSpacesDatabaseToDisk({ vault: { ...vaultSchema, rows: newVaultRows } }); } else { @@ -144003,7 +144220,7 @@ var ObsidianFileSystem = class { if (!file) return; this.addToVaultQueue(async () => { - if (file instanceof import_obsidian19.TFolder) { + if (file instanceof import_obsidian20.TFolder) { const newVaultRows = this.vaultDBCache.map((f2) => f2.path == oldPath ? { ...f2, path: file.path, @@ -144039,7 +144256,7 @@ var ObsidianFileSystem = class { }; this.middleware = middleware; this.plugin = plugin; - if (import_obsidian19.Platform.isMobile) { + if (import_obsidian20.Platform.isMobile) { this.persister = new MobileCachePersister(".makemd/fileCache.mdc", this.plugin.mdbFileAdapter, ["file"]); } else { this.persister = new LocalStorageCache(".makemd/fileCache.mdc", this.plugin.mdbFileAdapter, ["file"]); @@ -144200,7 +144417,7 @@ var ObsidianFileSystem = class { this.middleware.updateFileCache(path2, { label: { ...file.label, [label]: content5 } }, true); } async saveSpacesDatabaseToDisk(tables, save = true) { - if (await this.plugin.files.fileExists((0, import_obsidian19.normalizePath)(this.spacesDBPath)) && !this.vaultDBLoaded) { + if (await this.plugin.files.fileExists((0, import_obsidian20.normalizePath)(this.spacesDBPath)) && !this.vaultDBLoaded) { return; } this.vaultDBLoaded = true; @@ -144217,7 +144434,7 @@ var ObsidianFileSystem = class { if (!path2) return path2; const file = this.plugin.app.vault.getAbstractFileByPath(path2); - if (file instanceof import_obsidian19.TFile) { + if (file instanceof import_obsidian20.TFile) { return this.plugin.app.vault.getResourcePath(file); } else if (path2.match(urlRegex)) { return path2; @@ -144436,7 +144653,8 @@ var ObsidianCanvasFiletypeAdapter = class { }; // src/adapters/obsidian/filetypes/markdownAdapter.ts -var import_obsidian20 = require("obsidian"); +var import_obsidian21 = require("obsidian"); +var import_lodash26 = __toESM(require_lodash()); var ObsidianMarkdownFiletypeAdapter = class { constructor(plugin) { this.plugin = plugin; @@ -144448,6 +144666,7 @@ var ObsidianMarkdownFiletypeAdapter = class { initiate(middleware) { this.middleware = middleware; this.cache = /* @__PURE__ */ new Map(); + this.linksMap = new IndexMap(); } metadataChange(file) { this.parseCache(tFileToAFile(file), true); @@ -144459,6 +144678,15 @@ var ObsidianMarkdownFiletypeAdapter = class { if (!fCache) return; const rt = []; + let resolved = this.app.metadataCache.resolvedLinks; + let incoming = new Set(this.linksMap.getInverse(file.path)); + const currentCache = this.cache.get(file.path); + if (!currentCache) { + for (let [key2, value] of Object.entries(resolved)) { + if (file.path in value) + incoming.add(key2); + } + } if (fCache && fCache.tags) rt.push(...fCache.tags?.map((f2) => f2.tag) ?? []); if (fCache && fCache.frontmatter?.tags) @@ -144471,9 +144699,11 @@ var ObsidianMarkdownFiletypeAdapter = class { ); const contents = await this.plugin.app.vault.cachedRead(getAbstractFileAtPath(this.plugin.app, file.path)); const links = fCache.links?.map((f2) => this.plugin.app.metadataCache.getFirstLinkpathDest(f2.link, file.path)?.path).filter((f2) => f2); + this.linksMap.set(file.path, new Set(links)); const updatedCache = { ...fCache, resolvedLinks: links ?? [], + inlinks: Array.from(incoming), tags: rt, property: fCache.frontmatter, tasks: fCache.listItems?.filter((f2) => f2.task).map((f2) => contents.slice(f2.position.start.offset, f2.position.end.offset)) ?? [], @@ -144485,6 +144715,17 @@ var ObsidianMarkdownFiletypeAdapter = class { preview: contents.slice(fCache.frontmatterPosition?.end.offset ?? 0, 1e3) } }; + if (currentCache) { + if (!import_lodash26.default.isEqual(currentCache.resolvedLinks, updatedCache.resolvedLinks)) { + const newLinks = updatedCache.resolvedLinks.filter((f2) => !currentCache.resolvedLinks.includes(f2)); + const removedLinks = currentCache.resolvedLinks.filter((f2) => !updatedCache.resolvedLinks.includes(f2)); + for (const link of [...newLinks, ...removedLinks]) { + const file2 = this.plugin.app.vault.getAbstractFileByPath(link); + if (file2 && file2 instanceof import_obsidian21.TFile) + this.metadataChange(file2); + } + } + } this.cache.set(file.path, updatedCache); this.middleware.updateFileCache(file.path, updatedCache, refresh); } @@ -144549,7 +144790,7 @@ var ObsidianMarkdownFiletypeAdapter = class { parentFolder = getAbstractFileAtPath(this.app, parent); } return this.app.fileManager.createNewMarkdownFile( - parentFolder ? parentFolder instanceof import_obsidian20.TFolder ? parentFolder : parentFolder.parent : this.app.vault.getRoot(), + parentFolder ? parentFolder instanceof import_obsidian21.TFolder ? parentFolder : parentFolder.parent : this.app.vault.getRoot(), name319 ).then(async (f2) => { if (content5) { @@ -144561,7 +144802,7 @@ var ObsidianMarkdownFiletypeAdapter = class { async saveContent(file, fragmentType, fragmentId, content5) { if (fragmentType == "label") { const afile = this.app.vault.getAbstractFileByPath(file.path); - if (afile && afile instanceof import_obsidian20.TFile) { + if (afile && afile instanceof import_obsidian21.TFile) { if (this.app.fileManager.processFrontMatter) { await this.app.fileManager.processFrontMatter(afile, (frontmatter) => { if (fragmentId == "sticker") { @@ -144577,7 +144818,7 @@ var ObsidianMarkdownFiletypeAdapter = class { } if (fragmentType == "frontmatter" || fragmentType == "property") { const afile = this.app.vault.getAbstractFileByPath(file.path); - if (afile && afile instanceof import_obsidian20.TFile) { + if (afile && afile instanceof import_obsidian21.TFile) { if (this.app.fileManager.processFrontMatter) { await this.app.fileManager.processFrontMatter(afile, (frontmatter) => { const newFrontmatter = content5(frontmatter); @@ -144595,7 +144836,7 @@ var ObsidianMarkdownFiletypeAdapter = class { async deleteContent(file, fragmentType, fragmentId) { if (fragmentType == "frontmatter" || fragmentType == "property") { const afile = this.app.vault.getAbstractFileByPath(file.path); - if (afile && afile instanceof import_obsidian20.TFile) { + if (afile && afile instanceof import_obsidian21.TFile) { if (this.app.fileManager.processFrontMatter) { return this.app.fileManager.processFrontMatter(afile, (frontmatter) => { delete frontmatter[fragmentId]; @@ -144635,7 +144876,7 @@ var stickerFromString = (sticker, plugin) => { }; // src/adapters/obsidian/ui/editors/markdownView/menus/MakeMenu/MakeMenu.tsx -var import_obsidian21 = require("obsidian"); +var import_obsidian22 = require("obsidian"); var import_react187 = __toESM(require_react()); // src/adapters/obsidian/ui/editors/markdownView/menus/MakeMenu/commands/default.ts @@ -144750,7 +144991,7 @@ function resolveCommands(plugin) { } // src/adapters/obsidian/ui/editors/markdownView/menus/MakeMenu/MakeMenu.tsx -var MakeMenu = class extends import_obsidian21.EditorSuggest { +var MakeMenu = class extends import_obsidian22.EditorSuggest { constructor(app2, plugin) { super(app2); this.inCmd = false; @@ -144920,7 +145161,7 @@ var MakeMenu = class extends import_obsidian21.EditorSuggest { }; // src/adapters/obsidian/ui/editors/markdownView/menus/StickerMenu.tsx -var import_obsidian22 = require("obsidian"); +var import_obsidian23 = require("obsidian"); var import_react188 = __toESM(require_react()); // src/schemas/emoji.ts @@ -150316,7 +150557,7 @@ var emojis = { }; // src/adapters/obsidian/ui/editors/markdownView/menus/StickerMenu.tsx -var StickerMenu = class extends import_obsidian22.EditorSuggest { +var StickerMenu = class extends import_obsidian23.EditorSuggest { constructor(app2, plugin) { super(app2); this.inCmd = false; @@ -150398,29 +150639,35 @@ var registerEditorMenus = (plugin) => { }; // src/adapters/obsidian/ui/ui.tsx -var import_obsidian24 = require("obsidian"); +var import_obsidian25 = require("obsidian"); var import_react195 = __toESM(require_react()); var import_client = __toESM(require_client()); -// src/adapters/obsidian/utils/leaf.ts -var workspaceLeafForDom = (app2, dom) => { - const leafDom = dom.closest(".workspace-leaf"); - let foundLeaf; - app2.workspace.iterateLeaves((leaf) => { - if (leaf.containerEl == leafDom) { - foundLeaf = leaf; - return true; - } - }, app2.workspace["rootSplit"]); - return foundLeaf; +// src/adapters/obsidian/utils/flow/flowEditor.ts +var openPathInElement = (plugin, parentLeaf, initiatingEl, fileName, onShowCallback) => { + const parent = parentLeaf ?? plugin.app.workspace.getLeaf(); + if (!initiatingEl) + initiatingEl = parent.containerEl; + const hoverPopover = new FlowEditor( + parent, + initiatingEl, + plugin, + void 0, + onShowCallback + ); + if (fileName) + hoverPopover.titleEl.textContent = fileName.substring( + 0, + fileName.lastIndexOf(".") + ); }; // src/adapters/obsidian/utils/modifyTabSticker.ts -var import_obsidian23 = require("obsidian"); +var import_obsidian24 = require("obsidian"); var modifyTabSticker = (plugin) => { if (!plugin.superstate.settings.spacesStickers) return; - let leaf = plugin.app.workspace.getActiveViewOfType(import_obsidian23.MarkdownView)?.leaf; + let leaf = plugin.app.workspace.getActiveViewOfType(import_obsidian24.MarkdownView)?.leaf; if (leaf) { const file = plugin.app.workspace.getActiveFile(); if (!file) @@ -150709,7 +150956,7 @@ var HiddenPaths = (props) => { superstate.saveSettings(); superstate.initializePaths(); }; - const saveFile = (_15, value) => { + const saveFile = (_16, value) => { superstate.settings.hiddenFiles = [ ...superstate.settings.hiddenFiles, ...value @@ -150717,14 +150964,14 @@ var HiddenPaths = (props) => { superstate.saveSettings(); superstate.initializePaths(); }; - const removeExtension = (index2) => { - superstate.settings.hiddenExtensions = superstate.settings.hiddenExtensions.filter((f2, i4) => i4 != index2); + const removeExtension = (index3) => { + superstate.settings.hiddenExtensions = superstate.settings.hiddenExtensions.filter((f2, i4) => i4 != index3); superstate.saveSettings(); superstate.initializePaths(); }; - const removeItem = (index2) => { + const removeItem = (index3) => { superstate.settings.hiddenFiles = superstate.settings.hiddenFiles.filter( - (f2, i4) => i4 != index2 + (f2, i4) => i4 != index3 ); superstate.saveSettings(); superstate.initializePaths(); @@ -150780,8 +151027,8 @@ var HiddenPaths = (props) => { className: "setting-item setting-item-heading" }, i18n_default.labels.hiddenFilePattern), /* @__PURE__ */ import_react193.default.createElement("div", { className: "setting-item-description" - }, i18n_default.descriptions.hiddenFileOptions), /* @__PURE__ */ import_react193.default.createElement("div", null, hiddenExtensions.map((f2, index2) => /* @__PURE__ */ import_react193.default.createElement("div", { - key: index2, + }, i18n_default.descriptions.hiddenFileOptions), /* @__PURE__ */ import_react193.default.createElement("div", null, hiddenExtensions.map((f2, index3) => /* @__PURE__ */ import_react193.default.createElement("div", { + key: index3, className: "mobile-option-setting-item" }, /* @__PURE__ */ import_react193.default.createElement("span", { className: "mobile-option-setting-item-name" @@ -150791,7 +151038,7 @@ var HiddenPaths = (props) => { dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//close") }, - onClick: () => removeExtension(index2) + onClick: () => removeExtension(index3) })))), /* @__PURE__ */ import_react193.default.createElement("div", { className: "setting-item" }, /* @__PURE__ */ import_react193.default.createElement("input", { @@ -150804,8 +151051,8 @@ var HiddenPaths = (props) => { className: "setting-item setting-item-heading" }, i18n_default.subViews.filesAndFolders), /* @__PURE__ */ import_react193.default.createElement("div", { className: "setting-item-description" - }, i18n_default.labels.hiddenFileSpecific), /* @__PURE__ */ import_react193.default.createElement("div", null, hiddenPaths.map((f2, index2) => /* @__PURE__ */ import_react193.default.createElement("div", { - key: index2, + }, i18n_default.labels.hiddenFileSpecific), /* @__PURE__ */ import_react193.default.createElement("div", null, hiddenPaths.map((f2, index3) => /* @__PURE__ */ import_react193.default.createElement("div", { + key: index3, className: "mobile-option-setting-item" }, /* @__PURE__ */ import_react193.default.createElement("span", { className: "mobile-option-setting-item-name" @@ -150815,7 +151062,7 @@ var HiddenPaths = (props) => { dangerouslySetInnerHTML: { __html: props.superstate.ui.getSticker("ui//close") }, - onClick: () => removeItem(index2) + onClick: () => removeItem(index3) })))), /* @__PURE__ */ import_react193.default.createElement("div", { className: "setting-item" }, /* @__PURE__ */ import_react193.default.createElement("button", { @@ -150832,6 +151079,14 @@ var showMainMenu = (el, superstate, app2) => { superstate.settings.expandedSpaces = newSections; superstate.saveSettings(); }; + const toggleFlowState = () => { + superstate.settings.flowState = !superstate.settings.flowState; + superstate.saveSettings(); + document.body.classList.toggle( + "mk-flow-state", + superstate.settings.flowState + ); + }; const isMobile = app2.workspace.leftSplit && isTouchScreen(superstate.ui); const refreshLeafs = () => { const leafs2 = []; @@ -150839,16 +151094,17 @@ var showMainMenu = (el, superstate, app2) => { if (isMobile) { const mobileDrawer = app2.workspace.leftSplit; const leaves = mobileDrawer.children; - const index2 = leaves.reduce((p, c3, i4) => { + const index3 = leaves.reduce((p, c3, i4) => { return c3.getViewState().type == FILE_TREE_VIEW_TYPE ? i4 : p; }, -1); - spaceActive2 = index2 == mobileDrawer.currentTab; - leafs2.push(...leaves.filter((l2, i4) => i4 != index2)); + spaceActive2 = index3 == mobileDrawer.currentTab; + leafs2.push(...leaves.filter((l2, i4) => i4 != index3)); } return { leafs: leafs2, spaceActive: spaceActive2 }; }; const { spaceActive, leafs } = refreshLeafs(); const menuOptions = []; + menuOptions.push(menuSeparator); menuOptions.push({ name: i18n_default.menu.collapseAllSections, icon: "ui//chevrons-down-up", @@ -150974,10 +151230,10 @@ var ObsidianUI = class { return stickerFromString(icon, this.plugin); }; this.getOS = () => { - return import_obsidian24.Platform.isMacOS ? "mac" : import_obsidian24.Platform.isWin ? "windows" : import_obsidian24.Platform.isLinux ? "linux" : import_obsidian24.Platform.isIosApp ? "ios" : import_obsidian24.Platform.isAndroidApp ? "android" : "unknown"; + return import_obsidian25.Platform.isMacOS ? "mac" : import_obsidian25.Platform.isWin ? "windows" : import_obsidian25.Platform.isLinux ? "linux" : import_obsidian25.Platform.isIosApp ? "ios" : import_obsidian25.Platform.isAndroidApp ? "android" : "unknown"; }; this.openToast = (content5) => { - new import_obsidian24.Notice(content5); + new import_obsidian25.Notice(content5); }; this.openPalette = (modal, win, className) => { return showModal({ @@ -151008,7 +151264,7 @@ var ObsidianUI = class { const file = getAbstractFileAtPath(this.plugin.app, path2); if (!file) return; - if (file instanceof import_obsidian24.TFile) { + if (file instanceof import_obsidian25.TFile) { const dragData = this.plugin.app.dragManager.dragFile( e5.nativeEvent, file @@ -151057,7 +151313,7 @@ var ObsidianUI = class { type: "lucide", keywords: f2, value: f2, - html: (0, import_obsidian24.getIcon)(f2).outerHTML + html: (0, import_obsidian25.getIcon)(f2).outerHTML })); const allCustom = [ ...this.plugin.superstate.iconsCache.keys() @@ -151084,7 +151340,7 @@ var ObsidianUI = class { }; this.getUIPath = (path2, thumbnail) => { const file = this.plugin.app.vault.getAbstractFileByPath(path2); - if (file instanceof import_obsidian24.TFile) { + if (file instanceof import_obsidian25.TFile) { if (thumbnail) { const thumb = this.plugin.superstate.pathsIndex.get(file.path)?.label?.thumbnail; if (thumb) { @@ -151104,7 +151360,7 @@ var ObsidianUI = class { }; this.viewsByPath = (path2) => { const abstractFile = getAbstractFileAtPath(this.plugin.app, path2); - if (abstractFile instanceof import_obsidian24.TFile) { + if (abstractFile instanceof import_obsidian25.TFile) { return this.plugin.app.workspace.getLeavesOfType("markdown").filter((f2) => { return f2.view.file?.path == path2; }).map((f2) => { @@ -151146,12 +151402,12 @@ var ObsidianUI = class { } else if (source) { openPathInElement( this.plugin, - workspaceLeafForDom(this.plugin.app, source), + this.plugin.app.workspace.getLeaf(), source, null, async (editor) => { const leaf2 = editor.attachLeaf(); - if (this.plugin.app.vault.getAbstractFileByPath(path2) instanceof import_obsidian24.TFile) { + if (this.plugin.app.vault.getAbstractFileByPath(path2) instanceof import_obsidian25.TFile) { await leaf2.openFile( this.plugin.app.vault.getAbstractFileByPath(path2) ); @@ -151178,10 +151434,10 @@ var ObsidianUI = class { openPath(leaf, path2, this.plugin); }; this.primaryInteractionType = () => { - return import_obsidian24.Platform.isMobile ? 0 /* Touch */ : 1 /* Mouse */; + return import_obsidian25.Platform.isMobile ? 0 /* Touch */ : 1 /* Mouse */; }; this.getScreenType = () => { - return import_obsidian24.Platform.isMobileApp ? 0 /* Phone */ : import_obsidian24.Platform.isTablet ? 2 /* Tablet */ : 1 /* Desktop */; + return import_obsidian25.Platform.isMobileApp ? 0 /* Phone */ : import_obsidian25.Platform.isTablet ? 2 /* Tablet */ : 1 /* Desktop */; }; const newDiv = document.createElement("div"); document.body.appendChild(newDiv); @@ -151353,15 +151609,29 @@ var CLIManager = class { var import_react197 = __toESM(require_react()); // src/core/react/components/Blink/BlinkComponent.tsx -var import_lodash26 = __toESM(require_lodash()); +var import_lodash27 = __toESM(require_lodash()); var import_react196 = __toESM(require_react()); -var import_classnames15 = __toESM(require_classnames()); +var import_classnames16 = __toESM(require_classnames()); + +// src/core/superstate/workers/search/impl.ts +function searchPath(payload) { + const { queries, pathsIndex, count: count3 } = payload; + const paths = []; + for (const [k2, f2] of pathsIndex) { + if (!f2.hidden && pathByDef(queries, f2, {})) { + paths.push(f2); + } + } + return paths.slice(0, count3); +} + +// src/core/react/components/Blink/BlinkComponent.tsx var BlinkComponent = (props) => { const [previewPath, setPreviewPath] = (0, import_react196.useState)(null); const [showBlink, setShowBlink] = (0, import_react196.useState)(false); const [showFilters, setShowFilters] = (0, import_react196.useState)(false); const [query, setQuery] = (0, import_react196.useState)(""); - const [index2, setIndex] = (0, import_react196.useState)(0); + const [index3, setIndex] = (0, import_react196.useState)(0); const onChange = (query2) => { setQuery(query2); }; @@ -151397,6 +151667,22 @@ var BlinkComponent = (props) => { setFilteredPaths(recentPaths); return; } + if (!props.superstate.settings.searchWorker) { + const results = searchPath({ + queries: _queries, + count: 10, + pathsIndex: props.superstate.pathsIndex + }); + setFilteredPaths([ + ...results.map((f2) => ({ + name: f2.name, + icon: f2.label.sticker, + description: f2.subtype == "tag" || f2.subtype == "default" ? null : f2.path, + value: f2.path + })) + ]); + return; + } props.superstate.searcher.run({ type: "search", path: path2, @@ -151412,14 +151698,14 @@ var BlinkComponent = (props) => { ]) ); }; - (0, import_lodash26.debounce)(() => runQuery(query, queries), 300)(); + (0, import_lodash27.debounce)(() => runQuery(query, queries), 300)(); }, [query, queries]); (0, import_react196.useEffect)(() => { - const path2 = suggestions[index2]?.value; + const path2 = suggestions[index3]?.value; if (!path2 || path2 == previewPath) return; - setPreviewPath(suggestions[index2]?.value); - }, [index2, suggestions]); + setPreviewPath(suggestions[index3]?.value); + }, [index3, suggestions]); const selectItem = (item, e5) => { if (!item) return; @@ -151428,7 +151714,7 @@ var BlinkComponent = (props) => { props.hide(); return; } - if (props.mode == 0 /* Search */ && !showBlink) { + if (!showBlink) { props.superstate.ui.openPath(item.value); props.hide(); return; @@ -151450,7 +151736,7 @@ var BlinkComponent = (props) => { } if (e5.key == "ArrowUp") { const size2 = 0; - const newIndex = index2 <= size2 ? suggestions.length - 1 : index2 - 1; + const newIndex = index3 <= size2 ? suggestions.length - 1 : index3 - 1; if (suggestions.length == 0) return; if (suggestions[newIndex].disabled) { @@ -151462,7 +151748,7 @@ var BlinkComponent = (props) => { } if (e5.key == "ArrowDown") { const size2 = suggestions.length - 1; - const newIndex = index2 >= size2 ? 0 : index2 + 1; + const newIndex = index3 >= size2 ? 0 : index3 + 1; if (suggestions[newIndex].disabled) { setIndex(newIndex >= size2 ? 0 : newIndex + 1); } else { @@ -151473,7 +151759,7 @@ var BlinkComponent = (props) => { } if (e5.key == "Enter") { props.superstate.ui.openPath( - suggestions[index2].value, + suggestions[index3].value, e5.ctrlKey || e5.metaKey ? e5.altKey ? "split" : "tab" : false ); props.hide(); @@ -151543,9 +151829,9 @@ var BlinkComponent = (props) => { className: "mk-blink-suggestions" }, suggestions.map((f2, i4) => /* @__PURE__ */ import_react196.default.createElement("div", { key: i4, - className: (0, import_classnames15.default)( + className: (0, import_classnames16.default)( "mk-blink-suggestion", - index2 == i4 && "mk-active" + index3 == i4 && "mk-active" ), onClick: (e5) => selectItem(f2, e5) }, /* @__PURE__ */ import_react196.default.createElement("div", { @@ -151611,11 +151897,12 @@ var openBlinkModal = (superstate, mode2, win, onSelect) => { // src/core/test/TestComponent.tsx var import_react198 = __toESM(require_react()); -var openTestModal = (superstate) => { +var openTestModal = (plugin) => { + const superstate = plugin.superstate; superstate.ui.openModal( "Tests", (props) => /* @__PURE__ */ import_react198.default.createElement(TestComponent, { - superstate + plugin }), window ); @@ -151640,7 +151927,7 @@ var TestToggleSection = (props) => { }, props.section), expanded && /* @__PURE__ */ import_react198.default.createElement("div", null, props.children)); }; var TestComponent = (props) => { - const { superstate } = props; + const superstate = props.plugin.superstate; const [space2, setSpace] = (0, import_react198.useState)(null); const [path2, setPath] = (0, import_react198.useState)(null); const [sticker, setSticker] = (0, import_react198.useState)(null); @@ -151667,7 +151954,12 @@ var TestComponent = (props) => { return /* @__PURE__ */ import_react198.default.createElement("div", { className: "mk-layout-row", style: { fontSize: "10px" } - }, /* @__PURE__ */ import_react198.default.createElement("div", null, /* @__PURE__ */ import_react198.default.createElement(TestInputComponent, { + }, /* @__PURE__ */ import_react198.default.createElement("div", null, /* @__PURE__ */ import_react198.default.createElement(InlineMenuComponent, { + plugin: props.plugin, + cm: null, + activeMarks: [], + mobile: false + }), /* @__PURE__ */ import_react198.default.createElement(TestInputComponent, { action: (value) => setOutput( JSON.stringify(superstate.spaceManager.uriByString(value)) ) @@ -151727,7 +152019,7 @@ var TestComponent = (props) => { }, "Rename Space"), /* @__PURE__ */ import_react198.default.createElement(TestInputComponent, { action: (value) => removeSpace(superstate, value) }, "Delete Space"), /* @__PURE__ */ import_react198.default.createElement(TestInputComponent, { - action: (value) => saveSpaceMetadataValue(props.superstate, space2.path, "contexts", [ + action: (value) => saveSpaceMetadataValue(superstate, space2.path, "contexts", [ value ]) }, "Set Space Context"), /* @__PURE__ */ import_react198.default.createElement(TestInputComponent, { @@ -151777,7 +152069,7 @@ var TestComponent = (props) => { }; // src/adapters/image/imageAdapter.ts -var import_obsidian25 = require("obsidian"); +var import_obsidian26 = require("obsidian"); var import_pica = __toESM(require_pica()); var hashCode = (str) => { let hash = 0; @@ -151838,7 +152130,7 @@ var ImageFileTypeAdapter = class { let thumbnail = file.path; if (this.plugin.superstate.settings.imageThumbnails) { if (!await this.middleware.fileExists(thumbnailPath)) { - if (!import_obsidian25.Platform.isMobile) { + if (!import_obsidian26.Platform.isMobile) { const thumbnailResult = await this.generateThumnail(file, thumbnailPath); if (thumbnailResult) { thumbnail = thumbnailPath; @@ -151975,7 +152267,7 @@ var JSONFiletypeAdapter = class { }; // src/adapters/obsidian/ui/kit/kits.ts -var import_obsidian26 = require("obsidian"); +var import_obsidian27 = require("obsidian"); var installSpaceTemplate = async (plugin, superstate, space2, template2) => { if (template2.type === "folder") { if (template2.content) @@ -152194,7 +152486,7 @@ var exportSpaceKit = async (plugin, superstate, space2, root) => { const match2 = defContent.match(regexYaml); if (match2) { const yamlContent = match2[1]; - properties3 = (0, import_obsidian26.parseYaml)(yamlContent); + properties3 = (0, import_obsidian27.parseYaml)(yamlContent); } } if (defContent) { @@ -152657,7 +152949,7 @@ var WebSpaceAdapter = class { // src/main.ts var makeMDVersion = 0.999; -var MakeMDPlugin = class extends import_obsidian27.Plugin { +var MakeMDPlugin = class extends import_obsidian28.Plugin { constructor() { super(...arguments); this.debouncedRefresh = () => null; @@ -152771,7 +153063,7 @@ var MakeMDPlugin = class extends import_obsidian27.Plugin { openBlinkModal(superstate, 1 /* Blink */, win); } testPage() { - openTestModal(this.superstate); + openTestModal(this); } toggleBold() { const cm = getActiveCM(this); @@ -152867,8 +153159,8 @@ var MakeMDPlugin = class extends import_obsidian27.Plugin { convertPathToSpace() { const activeLeaf = this.app.workspace.activeLeaf; if (activeLeaf?.view.getViewType() == "markdown") { - const view = this.app.workspace.getActiveViewOfType(import_obsidian27.MarkdownView); - if (view instanceof import_obsidian27.MarkdownView && view.file instanceof import_obsidian27.TFile) { + const view = this.app.workspace.getActiveViewOfType(import_obsidian28.MarkdownView); + if (view instanceof import_obsidian28.MarkdownView && view.file instanceof import_obsidian28.TFile) { convertPathToSpace(this.superstate, view.file.path, true); } } else { @@ -152881,7 +153173,7 @@ var MakeMDPlugin = class extends import_obsidian27.Plugin { } getActiveFile() { let filePath = null; - let leaf = this.app.workspace.getActiveViewOfType(import_obsidian27.MarkdownView)?.leaf; + let leaf = this.app.workspace.getActiveViewOfType(import_obsidian28.MarkdownView)?.leaf; if (!leaf) { leaf = this.app.workspace.getActiveViewOfType(SpaceViewContainer)?.leaf; } @@ -152900,7 +153192,7 @@ var MakeMDPlugin = class extends import_obsidian27.Plugin { } activeFileChange() { const path2 = this.getActiveFile(); - if (this.superstate.settings.enableFolderNote) { + if (this.superstate.settings.enableFolderNote && this.superstate.settings.spaceViewEnabled) { if (this.superstate.spacesIndex.has(path2)) { const space2 = this.superstate.spacesIndex.get(path2); const leaf = this.app.workspace.getLeaf(); @@ -153083,8 +153375,8 @@ var MakeMDPlugin = class extends import_obsidian27.Plugin { this.registerMarkdownPostProcessor((element, context) => { const removeAllFlowMarks = (el) => { const embeds = el.querySelectorAll(".internal-embed.markdown-embed"); - for (let index2 = 0; index2 < embeds.length; index2++) { - const embed = embeds.item(index2); + for (let index3 = 0; index3 < embeds.length; index3++) { + const embed = embeds.item(index3); if (embed.previousSibling && embed.previousSibling.textContent.slice(-1) == "!") embed.previousSibling.textContent = embed.previousSibling.textContent.slice(0, -1); } @@ -153115,7 +153407,7 @@ var MakeMDPlugin = class extends import_obsidian27.Plugin { const start = Date.now(); this.mdbFileAdapter = new MDBFileTypeAdapter(this); this.files = FilesystemMiddleware.create(); - this.obsidianAdapter = new ObsidianFileSystem(this, this.files, (0, import_obsidian27.normalizePath)( + this.obsidianAdapter = new ObsidianFileSystem(this, this.files, (0, import_obsidian28.normalizePath)( this.app.vault.configDir + "/plugins/make-md/Spaces.mdb" )); this.files.initiateFileSystemAdapter(this.obsidianAdapter, true); @@ -153145,11 +153437,11 @@ var MakeMDPlugin = class extends import_obsidian27.Plugin { this.files.initiateFiletypeAdapter(new TextCacher(this)); this.superstate.spaceManager.addSpaceAdapter(filesystemCosmoform, true); this.superstate.spaceManager.addSpaceAdapter(webSpaceAdapter); - (0, import_obsidian27.addIcon)("mk-logo", mkLogo); + (0, import_obsidian28.addIcon)("mk-logo", mkLogo); this.superstate.saveSettings = () => this.saveSettings(); this.loadViews(); let cachePersister; - if (import_obsidian27.Platform.isMobile) { + if (import_obsidian28.Platform.isMobile) { cachePersister = new MobileCachePersister(".makemd/superstate.mdc", this.mdbFileAdapter, ["path", "space", "frame", "context", "icon"]); } else { cachePersister = new LocalStorageCache(".makemd/superstate.mdc", this.mdbFileAdapter, ["path", "space", "frame", "context", "icon"]); diff --git a/manifest.json b/manifest.json index 5377346..71f2e87 100755 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "make-md", "name": "MAKE.md", - "version": "0.9.992", + "version": "0.9.993", "minAppVersion": "0.16.0", "description": "Make.md brings powerful and modern note-taking features to Obsidian. Capture, organize and connect information with more flexibility without any code.", "author": "MAKE.md", diff --git a/src/adapters/mdb/db/db.ts b/src/adapters/mdb/db/db.ts index 263ada0..632e323 100644 --- a/src/adapters/mdb/db/db.ts +++ b/src/adapters/mdb/db/db.ts @@ -364,7 +364,7 @@ export const saveDBToPath = async ( if (mdb) { let mdbStruct : DBRows = [] try { - mdbStruct = dbResultsToDBTables(db.exec(`SELECT name FROM sqlite_master WHERE type='table' AND name='m_schema' OR name='m_fields';`))[0].rows + mdbStruct = dbResultsToDBTables(db.exec(`SELECT name FROM sqlite_master WHERE type='table' AND name='m_schema' OR name='m_fields';`))[0]?.rows ?? [] } catch (e) { console.log(e); } diff --git a/src/adapters/mdb/localCache/localCache.ts b/src/adapters/mdb/localCache/localCache.ts index f8a4253..8b7ab91 100644 --- a/src/adapters/mdb/localCache/localCache.ts +++ b/src/adapters/mdb/localCache/localCache.ts @@ -5,6 +5,7 @@ import { debounce } from "lodash"; import { CacheDBSchema } from "schemas/cache"; import { Database } from "sql.js"; import { DBRow, DBTables } from "types/mdb"; +import { sanitizeSQLStatement } from "utils/sanitizers"; import { LocalCachePersister } from "../../../core/middleware/types/persister"; /** Simpler wrapper for a file-backed cache for arbitrary metadata. */ @@ -50,7 +51,7 @@ public reset() { } public async remove(path: string, type: string): Promise { if (!this.db) return; - await deleteFromDB(this.db, type, `path='${path}'`) + await deleteFromDB(this.db, type, `path='${sanitizeSQLStatement(path)}'`) this.debounceSaveSpaceDatabase(); return; } diff --git a/src/adapters/obsidian/filetypes/markdownAdapter.ts b/src/adapters/obsidian/filetypes/markdownAdapter.ts index a075430..88e88fa 100644 --- a/src/adapters/obsidian/filetypes/markdownAdapter.ts +++ b/src/adapters/obsidian/filetypes/markdownAdapter.ts @@ -6,9 +6,12 @@ import { parseMultiDisplayString, parseProperty } from "utils/parsers"; import { getAbstractFileAtPath, tFileToAFile } from "../utils/file"; import { frontMatterForFile } from "./frontmatter/fm"; import { frontMatterKeys } from "./frontmatter/frontMatterKeys"; +import _ from "lodash"; +import { IndexMap } from "core/types/indexMap"; type CachedMetadataContentTypes = { resolvedLinks: string; + inlinks: string; links: string; embeds: string; tags: string[]; @@ -22,13 +25,14 @@ type CachedMetadataContentTypes = { label: string; } -type CleanCachedMetadata = Omit & { tags: string[], resolvedLinks: string[], label: PathLabel } +type CleanCachedMetadata = Omit & { tags: string[], resolvedLinks: string[], label: PathLabel, inlinks: string[] } export class ObsidianMarkdownFiletypeAdapter implements FileTypeAdapter { public id = "metadata.obsidian.md" public cache : Map; public supportedFileTypes = ['md']; + private linksMap: IndexMap; public middleware: FilesystemMiddleware; public app: App; public constructor (public plugin: MakeMDPlugin) { @@ -38,9 +42,11 @@ public app: App; public initiate (middleware: FilesystemMiddleware) { this.middleware = middleware; this.cache = new Map(); + this.linksMap = new IndexMap(); } public metadataChange (file: TFile) { + this.parseCache(tFileToAFile(file), true); } @@ -49,6 +55,14 @@ public app: App; const fCache = this.app.metadataCache.getCache(file.path); if (!fCache) return; const rt = []; + + let resolved = this.app.metadataCache.resolvedLinks; + let incoming = new Set(this.linksMap.getInverse(file.path)); + const currentCache = this.cache.get(file.path); + if (!currentCache) + {for (let [key, value] of Object.entries(resolved)) { + if (file.path in value) incoming.add(key); + }} if (fCache && fCache.tags) rt.push(...(fCache.tags?.map((f) => f.tag) ?? [])); if (fCache && fCache.frontmatter?.tags) @@ -75,8 +89,10 @@ public app: App; ); const contents = await this.plugin.app.vault.cachedRead(getAbstractFileAtPath(this.plugin.app, file.path)as TFile) const links = fCache.links?.map(f => this.plugin.app.metadataCache.getFirstLinkpathDest(f.link, file.path)?.path).filter(f => f) + this.linksMap.set(file.path, new Set(links)); const updatedCache = {...fCache, resolvedLinks: links ?? [], + inlinks: Array.from(incoming), tags: rt, property: fCache.frontmatter, tasks: fCache.listItems?.filter(f => f.task).map(f => contents.slice(f.position.start.offset, f.position.end.offset)) ?? [], @@ -87,6 +103,20 @@ public app: App; color: fCache.frontmatter?.[this.plugin.superstate.settings.fmKeyColor], preview: contents.slice(fCache.frontmatterPosition?.end.offset ?? 0, 1000) }} + + if (currentCache) { + + if (!_.isEqual(currentCache.resolvedLinks, updatedCache.resolvedLinks)) { + const newLinks = updatedCache.resolvedLinks.filter(f => !currentCache.resolvedLinks.includes(f)); + const removedLinks = currentCache.resolvedLinks.filter(f => !updatedCache.resolvedLinks.includes(f)); + for (const link of [...newLinks, ...removedLinks]) { + const file = this.plugin.app.vault.getAbstractFileByPath(link); + if (file && file instanceof TFile) + this.metadataChange(file) + } + + } + } this.cache.set(file.path, updatedCache); this.middleware.updateFileCache(file.path, updatedCache, refresh); } diff --git a/src/adapters/obsidian/settings.ts b/src/adapters/obsidian/settings.ts index 221acb1..51e20e7 100644 --- a/src/adapters/obsidian/settings.ts +++ b/src/adapters/obsidian/settings.ts @@ -88,6 +88,19 @@ export class MakeMDPluginSettingsTab extends PluginSettingTab { this.plugin.saveSettings(); }) ); + + new Setting(containerEl) + .setName(t.settings.folderNoteName.name) + .setDesc(t.settings.folderNoteName.desc) + .addText((text) => { + text + .setValue(this.plugin.superstate.settings.folderNoteName) + .setPlaceholder("Folder Name") + .onChange(async (value) => { + this.plugin.superstate.settings.folderNoteName = value; + await this.plugin.saveSettings(); + }); + }); @@ -117,6 +130,17 @@ export class MakeMDPluginSettingsTab extends PluginSettingTab { }) ); + // new Setting(spaceAppearances) + // .setName(t.settings.flowState.name) + // .setDesc(t.settings.flowState.desc) + // .addToggle((toggle) => + // toggle.setValue(this.plugin.superstate.settings.flowState).onChange((value) => { + // this.plugin.superstate.settings.flowState = value; + // this.plugin.saveSettings(); + // document.body.classList.toggle("mk-flow-state", !value); + // }) + // ); + new Setting(spaceAppearances) @@ -167,13 +191,15 @@ export class MakeMDPluginSettingsTab extends PluginSettingTab { new Setting(spaceAppearances) .setName(t.settings.spaceRowHeight.name) .setDesc(t.settings.spaceRowHeight.desc) - .addText((text) => { + .addSlider((text) => { text - .setValue(this.plugin.superstate.settings.spaceRowHeight.toString()) + .setValue(this.plugin.superstate.settings.spaceRowHeight) + .setDynamicTooltip() + .setLimits(20, 40, 1) .onChange(async (value) => { - text.setValue(parseInt(value).toString()); - this.plugin.superstate.settings.spaceRowHeight = parseInt(value); - await this.plugin.saveSettings(); + + this.plugin.superstate.settings.spaceRowHeight = value; + this.plugin.saveSettings(); }); }); @@ -354,6 +380,17 @@ containerEl.createEl("h3", { text: t.settings.sectionStickers }); }) ); new Setting(containerEl) + .setName(t.settings.contextPagination.name) + .setDesc(t.settings.contextPagination.desc) + .addText((text) => { + text + .setValue(this.plugin.superstate.settings.contextPagination.toString()) + .onChange(async (value) => { + this.plugin.superstate.settings.contextPagination = parseInt(value); + await this.plugin.saveSettings(); + }); + }); + new Setting(containerEl) .setName(t.settings.defaultDateFormat.name) .setDesc(t.settings.defaultDateFormat.desc) .addText((text) => { @@ -683,6 +720,17 @@ containerEl.createEl("h3", { text: t.settings.sectionStickers }); ); } new Setting(containerEl) + .setName("Perform Search in Background") + .setDesc("Perform search in background to prevent lag") + .addToggle((toggle) => + toggle + .setValue(this.plugin.superstate.settings.searchWorker) + .onChange((value) => { + this.plugin.superstate.settings.searchWorker = value; + this.plugin.saveSettings(); + }) + ); + new Setting(containerEl) .setName(t.settings.experimental.name) .setDesc(t.settings.experimental.desc) .addToggle((toggle) => diff --git a/src/adapters/obsidian/types/obsidian.d.ts b/src/adapters/obsidian/types/obsidian.d.ts index 1cf49a0..5fd629a 100644 --- a/src/adapters/obsidian/types/obsidian.d.ts +++ b/src/adapters/obsidian/types/obsidian.d.ts @@ -2,6 +2,12 @@ import { EditorView } from "@codemirror/view"; import { FlowEditorParent } from "adapters/obsidian/ui/editors/FlowEditor"; declare module "obsidian" { + export enum PopoverState { + Shown, + Hiding, + Hidden, + Showing + } interface Vault { getConfig(config: string): any } diff --git a/src/adapters/obsidian/ui/editors/FlowEditor.tsx b/src/adapters/obsidian/ui/editors/FlowEditor.tsx index a22b499..0519999 100644 --- a/src/adapters/obsidian/ui/editors/FlowEditor.tsx +++ b/src/adapters/obsidian/ui/editors/FlowEditor.tsx @@ -8,6 +8,7 @@ import MakeMDPlugin from "main"; import { + App, Component, EphemeralState, HoverPopover, @@ -100,7 +101,7 @@ export class FlowEditor extends nosuper(HoverPopover) { return windows; } - static containerForDocument(doc: Document) { + static containerForDocument(app: App, doc: Document) { if (doc !== document && app.workspace.floatingSplit) for (const container of app.workspace.floatingSplit.children) { if (container.doc === doc) return container; @@ -216,7 +217,7 @@ export class FlowEditor extends nosuper(HoverPopover) { this.document === document ? "rootSplit" : "floatingSplit" ]!; this.rootSplit.getContainer = () => - FlowEditor.containerForDocument(this.document); + FlowEditor.containerForDocument(this.plugin.app, this.document); this.titleEl.insertAdjacentElement("afterend", this.rootSplit.containerEl); const leaf = this.plugin.app.workspace.createLeafInParent( @@ -277,7 +278,6 @@ export class FlowEditor extends nosuper(HoverPopover) { this.parent.flowEditor = this; this.parent.view.addChild(this); } - await this.onShowCallback?.(this); this.onShowCallback = undefined; // only call it once const viewHeaderEl = this.hoverEl.querySelector(".view-header"); @@ -290,20 +290,15 @@ export class FlowEditor extends nosuper(HoverPopover) { transition() { if (this.shouldShow()) { - //@ts-ignore if (this.state === PopoverState.Hiding) { - //@ts-ignore this.state = PopoverState.Shown; clearTimeout(this.timer); } } else { - //@ts-ignore if (this.state === PopoverState.Showing) { this.hide(); } else { - //@ts-ignore if (this.state === PopoverState.Shown) { - //@ts-ignore this.state = PopoverState.Hiding; this.timer = window.setTimeout(() => { if (this.shouldShow()) { @@ -340,7 +335,6 @@ export class FlowEditor extends nosuper(HoverPopover) { !this.detaching && !!( this.onTarget || - //@ts-ignore this.state == PopoverState.Shown || this.document.querySelector( `body>.modal-container, body > #he${this.id} ~ .menu, body > #he${this.id} ~ .suggestion-container` @@ -350,18 +344,13 @@ export class FlowEditor extends nosuper(HoverPopover) { } show() { - if (!this.targetEl || this.document.body.contains(this.targetEl)) { - //@ts-ignore - this.state = PopoverState.Shown; - this.timer = 0; - this.shownPos = mouseCoords; - this.targetEl.replaceChildren(this.hoverEl); - this.onShow(); - app.workspace.onLayoutChange(); - this.load(); - } else { - this.hide(); - } + this.state = PopoverState.Shown; + this.timer = 0; + this.shownPos = mouseCoords; + this.targetEl.replaceChildren(this.hoverEl); + this.onShow(); + app.workspace.onLayoutChange(); + this.load(); } onHide() { @@ -414,7 +403,7 @@ export class FlowEditor extends nosuper(HoverPopover) { nativeHide() { const { hoverEl, targetEl } = this; - //@ts-ignore + this.state = PopoverState.Hidden; hoverEl.detach(); diff --git a/src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx b/src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx index 9202636..61e7809 100644 --- a/src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx +++ b/src/adapters/obsidian/ui/editors/markdownView/flowEditor/flowEditor.tsx @@ -22,7 +22,6 @@ import MakeMDPlugin from "main"; import { i18n } from "makemd-core"; import { FlowEditorHover } from "adapters/obsidian/ui/editors/markdownView/FlowEditorHover"; -import { loadFlowEditorByDOM } from "adapters/obsidian/utils/flow/flowEditor"; import { PathStickerContainer } from "core/react/components/UI/Stickers/PathSticker/PathSticker"; import { CollapseToggle } from "core/react/components/UI/Toggles/CollapseToggle"; import { compareByField } from "core/utils/tree"; @@ -364,7 +363,10 @@ export const flowEditorField = (plugin: MakeMDPlugin) => }); class FlowEditorWidget extends WidgetType { - constructor(readonly info: FlowEditorInfo, public plugin: MakeMDPlugin) { + constructor( + private readonly info: FlowEditorInfo, + public plugin: MakeMDPlugin + ) { super(); } @@ -379,7 +381,16 @@ class FlowEditorWidget extends WidgetType { div.setAttribute("id", "mk-flow-" + this.info.id); const placeholder = div.createDiv("mk-floweditor-placeholder"); placeholder.style.setProperty("height", this.info.height + "px"); - loadFlowEditorByDOM(this.plugin, div, view, this.info.id); + if (this.info.link && view.state.field(editorInfoField, false)) { + const infoField = view.state.field(editorInfoField, false); + const file = infoField.file; + const uri = this.plugin.superstate.spaceManager.uriByString( + this.info.link, + file?.path + ); + this.plugin.superstate.ui.openPath(uri.fullPath, false, div); + } + // loadFlowEditorByDOM(this.plugin, div, view, this.info.id); return div; } get estimatedHeight(): number { @@ -409,7 +420,7 @@ class LinkSticker extends WidgetType { const file = infoField.file; const uri = this.plugin.superstate.spaceManager.uriByString( this.info.link, - file.path + file?.path ); reactEl.render( ); + function getMarkdownListIndentLevel(line: string): number { + const regex = /^(\s*)(-|\d+\.)\s+(\[[ x]\]\s+)?/; + const match = line.match(regex); + + if (match) { + return match[1].length; + } + + return -1; // Return -1 if it's not a list item + } + function unindentText(text: string, levels: number) { + // Function to create a regex that matches spaces or tabs + const createIndentRegex = (count: number) => { + return new RegExp(`^([\\t]|[ ]{2,4}){0,${count}}`, "gm"); + }; + + const regex = createIndentRegex(levels); + + return text.replace(regex, ""); + } + function removeListFormatting(text: string) { + const regex = /^(\s*)([-*+]|\d+\.)\s+(\[[ x]\]\s+)?/gm; + return text.replace(regex, ""); + } + const transformMultiline = async () => { + const firstLine = props.cm.state.doc.lineAt( + props.cm.state.selection.main.from + ); + const startIndent = getMarkdownListIndentLevel( + props.cm.state.sliceDoc(firstLine.from, firstLine.to) + ); + const lineStart = props.cm.state.doc.lineAt( + props.cm.state.selection.main.from + ).number; + const lineEnd = props.cm.state.doc.lineAt( + props.cm.state.selection.main.to + ).number; + const changes = []; + const infoField = props.cm.state.field(editorInfoField, false); + const file = infoField.file; + if (file) { + const space = props.plugin.superstate.spacesIndex.get(file.parent.path); + if (space) { + for (let i = lineStart; i <= lineEnd; i++) { + const line = props.cm.state.doc.line(i); + const indentLevel = getMarkdownListIndentLevel(line.text); + const newText = removeListFormatting(line.text); + const space = props.plugin.superstate.spacesIndex.get( + file.parent.path + ); + const newFile = await newPathInSpace( + props.plugin.superstate, + space, + "md", + newText, + true + ); + changes.push({ + from: line.to - newText.length, + to: line.to, + insert: `[[${newFile}|${newText}]]`, + }); + } + props.cm.dispatch({ + changes: changes, + }); + } + } + }; + + const linkText = (e: React.MouseEvent) => { + const rect = e.currentTarget.getBoundingClientRect(); + showLinkMenu( + rect, + windowFromDocument(e.view.document), + props.plugin.superstate, + (link) => { + const currentSelection = props.cm.state.selection.main; + const selectedText = props.cm.state.sliceDoc( + currentSelection.from, + currentSelection.to + ); + const changes = [ + { + from: currentSelection.from, + to: currentSelection.to, + insert: `[[${link}|${selectedText}]]`, + }, + ]; + props.cm.dispatch({ + changes: changes, + }); + } + ); + }; + + const transformText = (collapseMode: number) => { + const currentLine = props.cm.state.doc.lineAt( + props.cm.state.selection.main.from + ); + const higherIndentLines = []; + let content = null; + if (collapseMode > 0) { + const currentLineIndex = props.cm.state.doc.lineAt( + props.cm.state.selection.main.from + ).number; + const indentLevel = getMarkdownListIndentLevel(currentLine.text); + + let i = currentLineIndex + 1; + while (i <= props.cm.state.doc.lines) { + const currentLine = props.cm.state.doc.line(i); + if (getMarkdownListIndentLevel(currentLine.text) > indentLevel) { + higherIndentLines.push(currentLine); + } + if (getMarkdownListIndentLevel(currentLine.text) <= indentLevel) break; + i++; + } + if (collapseMode == 1) { + content = higherIndentLines + .map((f) => unindentText(f.text, indentLevel + 1)) + .join("\n"); + } + } + + const currentLineEnd = props.cm.state.selection.main.to; + const currentSelection = props.cm.state.selection.main; + const infoField = props.cm.state.field(editorInfoField, false); + const file = infoField.file; + const selectedText = props.cm.state.sliceDoc( + currentSelection.from, + currentSelection.to + ); + if (file) { + const space = props.plugin.superstate.spacesIndex.get(file.parent.path); + if (space) { + const newPath = sanitizeFileName(selectedText).trim(); + newPathInSpace( + props.plugin.superstate, + space, + "md", + newPath, + true, + content + ).then((f) => { + if (f) { + const changes = [ + { + from: currentSelection.from, + to: currentSelection.to, + insert: `[[${f}|${selectedText}]]`, + }, + ]; + if (collapseMode == 1) { + changes.push({ + from: props.cm.state.doc.lineAt(currentSelection.from + 1).to, + to: props.cm.state.doc.line( + currentLine.number + higherIndentLines.length + ).to, + insert: "", + }); + } + props.cm.dispatch({ + changes: changes, + }); + } + }); + } + } + }; + const marksMode = () => ( <> {props.mobile ? ( @@ -283,6 +458,67 @@ export const InlineMenuComponent: React.FC<{ > ); })} +
+
{ + linkText(e); + }} + className="mk-mark" + dangerouslySetInnerHTML={{ + __html: props.plugin.superstate.ui.getSticker( + "ui//mk-mark-blocklink" + ), + }} + >
+
+
{ + transformText(0); + }} + className="mk-mark" + dangerouslySetInnerHTML={{ + __html: props.plugin.superstate.ui.getSticker("ui//new-note"), + }} + >
+ + {/*
{ + const menuOptions = [ + { + name: "Collapse List into Note", + icon: "ui//plus", + onClick: () => { + transformText(1); + }, + }, + { + name: "Collapse List into Notes", + icon: "ui//plus", + onClick: () => { + transformMultiline(); + }, + }, + ]; + const rect = e.currentTarget.getBoundingClientRect(); + props.plugin.superstate.ui.openMenu( + rect, + defaultMenu(props.plugin.superstate.ui, menuOptions), + windowFromDocument(e.view.document) + ); + }} + className="mk-mark-dropdown" + dangerouslySetInnerHTML={{ + __html: props.plugin.superstate.ui.getSticker("ui//collapse"), + }} + >
*/} +
{props.plugin.superstate.settings.inlineStylerColors ? ( <>
diff --git a/src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/styles/default.ts b/src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/styles/default.ts index df34c57..4a27fe6 100644 --- a/src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/styles/default.ts +++ b/src/adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/styles/default.ts @@ -34,10 +34,5 @@ export default [ cursorOffset: 2, icon: "mk-mark-link", }, - { - label: "blocklink", - value: "[[]]", - insertOffset: 2, - icon: "mk-mark-blocklink", - }, + ]; diff --git a/src/adapters/obsidian/ui/showMainMenu.tsx b/src/adapters/obsidian/ui/showMainMenu.tsx index 96c6875..1c82628 100644 --- a/src/adapters/obsidian/ui/showMainMenu.tsx +++ b/src/adapters/obsidian/ui/showMainMenu.tsx @@ -24,6 +24,15 @@ export const showMainMenu = ( superstate.saveSettings(); }; + const toggleFlowState = () => { + superstate.settings.flowState = !superstate.settings.flowState; + superstate.saveSettings(); + document.body.classList.toggle( + "mk-flow-state", + superstate.settings.flowState + ); + }; + const isMobile = app.workspace.leftSplit && isTouchScreen(superstate.ui); const refreshLeafs = () => { @@ -45,6 +54,16 @@ export const showMainMenu = ( const { spaceActive, leafs } = refreshLeafs(); const menuOptions: SelectOption[] = []; + // menuOptions.push({ + // name: superstate.settings.flowState + // ? i18n.menu.exitFlowState + // : i18n.menu.enterFlowState, + // icon: "ui//flow", + // onClick: () => { + // toggleFlowState(); + // }, + // }); + menuOptions.push(menuSeparator); menuOptions.push({ name: i18n.menu.collapseAllSections, icon: "ui//chevrons-down-up", diff --git a/src/adapters/obsidian/ui/ui.tsx b/src/adapters/obsidian/ui/ui.tsx index d952541..ba4e0de 100644 --- a/src/adapters/obsidian/ui/ui.tsx +++ b/src/adapters/obsidian/ui/ui.tsx @@ -17,7 +17,6 @@ import { urlRegex } from "utils/regex"; import { SPACE_VIEW_TYPE } from "../SpaceViewContainer"; import { getAbstractFileAtPath, getLeaf, openPath } from "../utils/file"; import { openPathInElement } from "../utils/flow/flowEditor"; -import { workspaceLeafForDom } from "../utils/leaf"; import { modifyTabSticker } from "../utils/modifyTabSticker"; import { WindowManager } from "./WindowManager"; import { flowIDAnnotation } from "./editors/markdownView/flowEditor/flowStateFields"; @@ -280,7 +279,7 @@ export class ObsidianUI implements UIAdapter { } else if (source) { openPathInElement( this.plugin, - workspaceLeafForDom(this.plugin.app, source), + this.plugin.app.workspace.getLeaf(), // workspaceLeafForDom(this.plugin.app, source), source, null, async (editor) => { diff --git a/src/adapters/obsidian/utils/file.ts b/src/adapters/obsidian/utils/file.ts index a92d3c1..f59b744 100644 --- a/src/adapters/obsidian/utils/file.ts +++ b/src/adapters/obsidian/utils/file.ts @@ -15,7 +15,6 @@ import { import { SPACE_VIEW_TYPE } from "adapters/obsidian/SpaceViewContainer"; import { defaultSpace, newPathInSpace } from "core/superstate/utils/spaces"; import { tagsSpacePath } from "core/types/space"; -import { spaceNotePathForSpacePath } from "core/utils/strings"; import { isTouchScreen } from "core/utils/ui/screen"; import { TargetLocation } from "types/path"; import { selectElementContents } from "utils/dom"; @@ -109,9 +108,11 @@ const newName = folderPathToString(newPath); if (spaceNote) renameFile(plugin, spaceNote, newName) } else if (plugin.superstate.settings.enableFolderNote) { + const oldSpaceInfo = plugin.superstate.spaceManager.spaceInfoForPath(oldPath); + const newSpaceInfo = plugin.superstate.spaceManager.spaceInfoForPath(newPath); await plugin.files.renameFile( - spaceNotePathForSpacePath(oldPath), - spaceNotePathForSpacePath(newPath) + oldSpaceInfo.notePath, + newSpaceInfo.notePath ); } } diff --git a/src/adapters/obsidian/utils/flow/flowEditor.ts b/src/adapters/obsidian/utils/flow/flowEditor.ts index 4816dc4..efaa26d 100644 --- a/src/adapters/obsidian/utils/flow/flowEditor.ts +++ b/src/adapters/obsidian/utils/flow/flowEditor.ts @@ -211,7 +211,7 @@ export const openPathInElement = ( fileName?: string, onShowCallback?: (leaf: FlowEditor) => Promise ) => { - const parent = (parentLeaf ?? plugin.app.workspace.activeLeaf) as unknown as FlowEditorParent; + const parent = (parentLeaf ?? plugin.app.workspace.getLeaf()) as unknown as FlowEditorParent; if (!initiatingEl) initiatingEl = parent.containerEl; const hoverPopover = new FlowEditor( parent, diff --git a/src/adapters/obsidian/utils/patches.ts b/src/adapters/obsidian/utils/patches.ts index 06fc6c3..51ea802 100644 --- a/src/adapters/obsidian/utils/patches.ts +++ b/src/adapters/obsidian/utils/patches.ts @@ -3,7 +3,7 @@ import { FILE_TREE_VIEW_TYPE } from "adapters/obsidian/ui/navigator/NavigatorVie import MakeMDPlugin from "main"; import { around } from "monkey-around"; import { - EphemeralState, ViewState, + EphemeralState, OpenViewState, PaneType, SplitDirection, ViewState, Workspace, WorkspaceContainer, WorkspaceItem, @@ -40,6 +40,35 @@ export const patchWorkspace = (plugin: MakeMDPlugin) => { }; }, + getLeaf(old) { + return function (newLeaf?: "split", direction?: SplitDirection) { + let leaf = old.call(this, newLeaf, direction); + + if (leaf.isFlowBlock) { + let foundLeaf = false; + plugin.app.workspace.iterateLeaves((_leaf) => { + //@ts-ignore + if (_leaf.flowEditor) { + //@ts-ignore + _leaf.flowEditor.leaves().forEach((l) => { + if (l.id == leaf.id) { + foundLeaf = true; + leaf = _leaf; + return; + } + }) + if (foundLeaf) return true; + } + leaf = _leaf + return; + + }, plugin.app.workspace["rootSplit"]!); + + } + + return leaf; + }; + }, iterateLeaves(old) { type leafIterator = (item: WorkspaceLeaf) => boolean | void; return function (arg1, arg2) { @@ -72,6 +101,15 @@ export const patchWorkspace = (plugin: MakeMDPlugin) => { return false; }; }, + openLinkText(old) { + return function openLinkText(linkText: string, sourcePath: string, newLeaf?: PaneType | boolean, openViewState?: OpenViewState) { + if (linkText.startsWith('spaces://')) { + plugin.ui.openPath(linkText, newLeaf); + return; + } + return old.call(this, linkText, sourcePath, newLeaf, openViewState); + }; + }, setActiveLeaf(old) { return function setActiveLeaf(leaf, params) { if (leaf.view.getViewType() == 'markdown') { @@ -93,6 +131,7 @@ export const patchWorkspace = (plugin: MakeMDPlugin) => { } }, getActiveViewOfType(old) { + return function getActiveViewOfType(type) { if (type.prototype?.getViewType && type.prototype.getViewType() == 'markdown') { diff --git a/src/core/assets/icons.ts b/src/core/assets/icons.ts index 937afc3..c0a2847 100644 --- a/src/core/assets/icons.ts +++ b/src/core/assets/icons.ts @@ -254,62 +254,84 @@ export const uiIconSet: Record = { `, "mk-mark-strong": ` - - + + + `, "mk-mark-em": ` - - `, + +`, "mk-mark-strikethrough": ` - - - + + + + `, "mk-mark-code": ` - - - - + + + + + `, "mk-mark-link": ` - - `, + + +`, "mk-mark-blocklink": ` - - - - - `, + + + + + +`, "mk-mark-highlight": ` - - - - - - `, - "mk-make-attach": ` - - - - - `, - "mk-make-keyboard": ` - - - - `, - "mk-make-slash": ` - - - - `, - "mk-make-style": ` - - `, + + + + + + +`, + "mk-make-attach": ` + + + + + +`, + "mk-make-keyboard": ` + + + + + + + + + + + + +`, + "mk-make-slash": ` + + + + + + +`, + "mk-make-style": ` + + + +`, "mk-mark-color": ` - - - `, + + + +`, 'any': ` @@ -745,5 +767,6 @@ export const uiIconSet: Record = { 'tabs': ``, 'move': ``, 'wildcard': ``, -'replace': `` +'replace': ``, +'alias': `` }; \ No newline at end of file diff --git a/src/core/i18n.ts b/src/core/i18n.ts index c1a001f..5bf500d 100644 --- a/src/core/i18n.ts +++ b/src/core/i18n.ts @@ -144,8 +144,11 @@ class T { }, menu: { layout: "Layout", + enterFlowState: "Enter Flow State", + exitFlowState: "Exit Flow State", newView: "New View", calendarView: "Calendar View", + dayView: "Day View", closeSpace: "Close Space", customView: "Custom View", detailsView: "Details View", @@ -298,7 +301,9 @@ class T { }, buttons: { add: "Add", + alias: "Alias", addFilter: "Add Filter", + loadMore: "Load More", addCondition: "Add Condition", customize: "Customize", moreOptions: "More Options", @@ -504,6 +509,8 @@ class T { }, labels: { duplicateTable: "Duplicate Table", + pinned: "Pinned", + live: "Pinned by Live Search", moveTable: "Move Table", editFormula: "Edit Formula", editObject: "Edit Object", @@ -776,6 +783,10 @@ class T { name: "Enable Folder Note", desc: "Access the folder note in the folder page and hide the folder note from spaces", }, + folderNoteName: { + name: "Folder Note Name", + desc: "Name of the folder note, keep blank to use the same name as the folder", + }, expandFolder: { name: "Auto Expand Folder", desc: "Auto expand folders on click", @@ -819,6 +830,10 @@ class T { trash: "Move to Obsidian Trash", "system-trash": "Move to System Trash", }, + flowState: { + name: "Flow State", + desc: "Toggle the flow state", + }, hideRibbon: { name: "App Ribbon", desc: `Show/hide the left menu aka. ribbon`, @@ -866,9 +881,13 @@ class T { spaceRowHeight: { name: "Row Height", - desc: "The height for each row in spaces (in pixels), default is 28", + desc: "The height for each row in spaces (in pixels), default is 29", }, + contextPagination: { + name: "Table View Pagination", + desc: "Number of items per page in table view", + }, coverHeight: { name: "Cover Height", desc: "The height for the cover of the note or space, default is 200", diff --git a/src/core/react/components/Blink/BlinkComponent.tsx b/src/core/react/components/Blink/BlinkComponent.tsx index 6bf2a0c..9d902bc 100644 --- a/src/core/react/components/Blink/BlinkComponent.tsx +++ b/src/core/react/components/Blink/BlinkComponent.tsx @@ -11,6 +11,7 @@ import { i18n } from "makemd-core"; import React, { useEffect, useMemo, useState } from "react"; import classNames from "classnames"; +import { searchPath } from "core/superstate/workers/search/impl"; import { PathView } from "../PathView/PathView"; import { SpaceQuery } from "../SpaceEditor/SpaceQuery"; import { PathCrumb } from "../UI/Crumbs/PathCrumb"; @@ -69,6 +70,24 @@ export const BlinkComponent = (props: { setFilteredPaths(recentPaths); return; } + + if (!props.superstate.settings.searchWorker) { + const results = searchPath({ + queries: _queries, + count: 10, + pathsIndex: props.superstate.pathsIndex, + }); + setFilteredPaths([ + ...results.map((f) => ({ + name: f.name, + icon: f.label.sticker, + description: + f.subtype == "tag" || f.subtype == "default" ? null : f.path, + value: f.path, + })), + ]); + return; + } props.superstate.searcher .run({ type: "search", @@ -104,7 +123,7 @@ export const BlinkComponent = (props: { props.hide(); return; } - if (props.mode == BlinkMode.Search && !showBlink) { + if (!showBlink) { props.superstate.ui.openPath(item.value); props.hide(); return; diff --git a/src/core/react/components/Explorer/Explorer.tsx b/src/core/react/components/Explorer/Explorer.tsx index 0ffff78..7e01981 100644 --- a/src/core/react/components/Explorer/Explorer.tsx +++ b/src/core/react/components/Explorer/Explorer.tsx @@ -248,16 +248,16 @@ export const Explorer = (props: { superstate: Superstate }) => { > {isSpace ? ( - + ) : ( - + )} ); }; -export const PathContextView = (props: { superstate: Superstate }) => { +export const ExplorerPathView = (props: { superstate: Superstate }) => { const [openNodes, setOpenNodes] = useState([]); const { pathState } = useContext(PathContext); useEffect(() => { @@ -265,7 +265,7 @@ export const PathContextView = (props: { superstate: Superstate }) => { }, [pathState]); return ( -
+
{ diff --git a/src/core/react/components/Explorer/PropertiesView.tsx b/src/core/react/components/Explorer/PropertiesView.tsx index 2ecc55b..fa24f62 100644 --- a/src/core/react/components/Explorer/PropertiesView.tsx +++ b/src/core/react/components/Explorer/PropertiesView.tsx @@ -375,7 +375,10 @@ export const PropertiesView = (props: { > ))} - ) : excludeKeys.length > 0 ? ( + ) : ( + <> + )} + {excludeKeys.length > 0 && ( - ) : ( - <> )} ); diff --git a/src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx b/src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx index 9b66ec6..40a8bfe 100644 --- a/src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx +++ b/src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx @@ -86,9 +86,10 @@ export const NoteActionBar = (props: { superstate: Superstate }) => { newPropertyInFrame({ ...field, schemaId: mainFrameID }); } - return; + return true; } props.superstate.spaceManager.addSpaceProperty(source, field); + return true; }; const showContextMenu = (e: React.MouseEvent) => { showSpaceContextMenu(props.superstate, pathState, e, null, null); diff --git a/src/core/react/components/Navigator/SpaceTree/SpaceTreeAreaEditor.tsx b/src/core/react/components/Navigator/SpaceTree/NavigatorFocusEditor.tsx similarity index 76% rename from src/core/react/components/Navigator/SpaceTree/SpaceTreeAreaEditor.tsx rename to src/core/react/components/Navigator/SpaceTree/NavigatorFocusEditor.tsx index a4d7810..39b7b25 100644 --- a/src/core/react/components/Navigator/SpaceTree/SpaceTreeAreaEditor.tsx +++ b/src/core/react/components/Navigator/SpaceTree/NavigatorFocusEditor.tsx @@ -1,36 +1,36 @@ import classNames from "classnames"; import { NavigatorContext } from "core/react/context/SidebarContext"; import { createSpace } from "core/superstate/utils/spaces"; -import { Area } from "core/types/area"; +import { Focus } from "core/types/focus"; import { i18n, Superstate } from "makemd-core"; import React, { useContext, useEffect, useState } from "react"; import { windowFromDocument } from "utils/dom"; import { showSpacesMenu } from "../../UI/Menus/properties/selectSpaceMenu"; import StickerModal from "../../UI/Modals/StickerModal"; -export const SpaceAreaEditor = (props: { +export const FocusEditor = (props: { superstate: Superstate; - area: Area; - saveArea: (area: Area) => void; + focus: Focus; + saveFocus: (focus: Focus) => void; }) => { const { saveActiveSpace, - editArea, - activeArea, + editFocus: editFocus, + activeFocus: activeFocus, setWaypoints, waypoints, - setEditArea, + setEditFocus: setEditFocus, } = useContext(NavigatorContext); - const [area, setArea] = useState(props.area); + const [focus, setFocus] = useState(props.focus); useEffect(() => { - setArea(props.area); - }, [props.area]); - return area && props.area ? ( - props.area.name?.length == 0 || editArea ? ( -
+ setFocus(props.focus); + }, [props.focus]); + return focus && props.focus ? ( + props.focus.name?.length == 0 || editFocus ? ( +
props.superstate.ui.openPalette( @@ -39,7 +39,7 @@ export const SpaceAreaEditor = (props: { ui={props.superstate.ui} hide={_props.hide} selectedSticker={(emoji) => { - setArea({ ...area, sticker: emoji }); + setFocus({ ...focus, sticker: emoji }); }} /> ), @@ -48,20 +48,20 @@ export const SpaceAreaEditor = (props: { } >
setArea({ ...area, name: e.target.value })} + value={focus.name} + onChange={(e) => setFocus({ ...focus, name: e.target.value })} >
- - -
- -
-
- {props.contexts.map((f, i) => ( -
0 - ? ({ - "--tag-background": - contextProperties[f].path?.label?.color, - "--tag-color": "var(--color-white)", - } as React.CSSProperties) - : {} - } - > -
- {f} -
{ - props.saveContexts(props.contexts.filter((g) => g != f)); - }} - >
-
- ))} -
-
- - {items.map((value, index) => { - return ( - - props.saveColumn(field, value) - } - cols={items} - colsHidden={props.colsHidden} - hideColumn={props.hideColumn} - delColumn={props.delColumn} - > - ); - })} - -
- {props.contexts.map((f, i) => ( -
-
- {contextProperties[f]?.cols - .filter((f) => f.primary != "true") - .map((g, h) => ( - - props.saveColumn(field, g) - } - cols={contextProperties[f].cols} - colsHidden={props.colsHidden} - hideColumn={props.hideColumn} - delColumn={props.delColumn} - > - ))} -
-
- ))} -
-
- {createPortal( - - {activeId ? ( - f.id == activeId).id} - field={items.find((f) => f.id == activeId)} - superstate={props.superstate} - cols={items} - colsHidden={props.colsHidden} - > - ) : null} - , - document.body - )} - - ); -}; - -import { CSS } from "@dnd-kit/utilities"; -import i18n from "core/i18n"; -import { showNewPropertyMenu } from "core/react/components/UI/Menus/contexts/newSpacePropertyMenu"; -import { - selectPropertyTypeMenu, - showPropertyMenu, -} from "core/react/components/UI/Menus/contexts/spacePropertyMenu"; -import { SpaceContext } from "core/react/context/SpaceContext"; -import { Superstate } from "core/superstate/superstate"; -import { PathState, SpaceState } from "core/types/superstate"; -import { tagSpacePathFromTag } from "core/utils/strings"; -import { createPortal } from "react-dom"; -import { defaultContextSchemaID, stickerForField } from "schemas/mdb"; -import { SpaceProperty, SpaceTableColumn } from "types/mdb"; -import { windowFromDocument } from "utils/dom"; -import { ensureTag } from "utils/tags"; - -function SortableItem(props: { - id: string; - field: SpaceTableColumn; - superstate: Superstate; - cols: SpaceTableColumn[]; - colsHidden: string[]; - hideColumn?: (column: SpaceTableColumn, hidden: boolean) => void; - delColumn?: (column: SpaceTableColumn) => void; - saveColumn?: (column: SpaceTableColumn, oldColumn?: SpaceTableColumn) => void; -}) { - const { spaceInfo } = useContext(SpaceContext); - const { field } = props; - - const saveField = (field: SpaceTableColumn, oldField: SpaceTableColumn) => { - if (field.name.length > 0) { - if ( - field.name != oldField.name || - field.type != oldField.type || - field.value != oldField.value || - field.attrs != oldField.attrs - ) { - const saveResult = props.saveColumn(field, oldField); - } - } - }; - - const { attributes, listeners, setNodeRef, transform, transition } = - useSortable({ id: props.id }); - - const style = { - transform: CSS.Transform.toString(transform), - transition, - }; - const icon = stickerForField(props.field); - - const selectedType = (_: string[], value: string[]) => { - const newField = { - ...props.field, - type: value[0], - }; - props.saveColumn(newField); - }; - return ( -
-
{ - selectPropertyTypeMenu(e, props.superstate.ui, selectedType); - }} - >
- {props.field.name} - -
{ - const offset = (e.target as HTMLElement).getBoundingClientRect(); - - showPropertyMenu({ - superstate: props.superstate, - rect: offset, - win: windowFromDocument(e.view.document), - editable: true, - options: [], - field, - fields: props.cols, - contextPath: spaceInfo?.path, - saveField: (newField) => saveField(newField, field), - hide: props.hideColumn, - deleteColumn: props.delColumn, - hidden: props.colsHidden.includes(field.name + field.table), - }); - }} - >
-
- ); -} diff --git a/src/core/react/components/SpaceEditor/SpaceQuery.tsx b/src/core/react/components/SpaceEditor/SpaceQuery.tsx index 6761503..6624c31 100644 --- a/src/core/react/components/SpaceEditor/SpaceQuery.tsx +++ b/src/core/react/components/SpaceEditor/SpaceQuery.tsx @@ -120,6 +120,7 @@ export const SpaceQuery = (props: { } case "list": { + const fieldType = filter.fType; const saveOptions = (options: string[], values: string[]) => { saveFilterValue(serializeMultiString(values)); @@ -138,7 +139,7 @@ export const SpaceQuery = (props: { value: f, name: f, })); - } else if (fieldType.startsWith("links")) { + } else if (fieldType.startsWith("link")) { options = props.superstate.spaceManager.allPaths().map((f) => ({ name: pathNameToString(f), value: f, diff --git a/src/core/react/components/SpaceEditor/SpaceTemplateProperty.tsx b/src/core/react/components/SpaceEditor/SpaceTemplateProperty.tsx index 8ca6158..aeefca2 100644 --- a/src/core/react/components/SpaceEditor/SpaceTemplateProperty.tsx +++ b/src/core/react/components/SpaceEditor/SpaceTemplateProperty.tsx @@ -98,7 +98,7 @@ export const SpaceTemplateProperty = (props: { "bottom" ); }; - return templates.length > 0 ? ( + return templates?.length > 0 ? ( props.compactMode ? (
setCollapsed((f) => !f)}> {templates.length} Templates diff --git a/src/core/react/components/SpaceView/Contexts/DataTypeView/DataPropertyView.tsx b/src/core/react/components/SpaceView/Contexts/DataTypeView/DataPropertyView.tsx index dc73206..736a227 100644 --- a/src/core/react/components/SpaceView/Contexts/DataTypeView/DataPropertyView.tsx +++ b/src/core/react/components/SpaceView/Contexts/DataTypeView/DataPropertyView.tsx @@ -70,6 +70,7 @@ export const DataPropertyView = (props: DataPropertyViewProps) => { [field.name]: "", } ); + return true; }, fileMetadata: true, } diff --git a/src/core/react/components/SpaceView/Contexts/DataTypeView/ObjectCell.tsx b/src/core/react/components/SpaceView/Contexts/DataTypeView/ObjectCell.tsx index cfa1847..c97cc2c 100644 --- a/src/core/react/components/SpaceView/Contexts/DataTypeView/ObjectCell.tsx +++ b/src/core/react/components/SpaceView/Contexts/DataTypeView/ObjectCell.tsx @@ -491,6 +491,7 @@ export const ObjectEditorModal = ( [field.name]: "", } ); + return true }, fileMetadata: true, } diff --git a/src/core/react/components/SpaceView/Contexts/FilterBar/FilterBar.tsx b/src/core/react/components/SpaceView/Contexts/FilterBar/FilterBar.tsx index b664a19..e8911c9 100644 --- a/src/core/react/components/SpaceView/Contexts/FilterBar/FilterBar.tsx +++ b/src/core/react/components/SpaceView/Contexts/FilterBar/FilterBar.tsx @@ -277,6 +277,14 @@ export const FilterBar = (props: { // listGroup: "spaces://$kit/#*dateGroup", // listItem: "spaces://$kit/#*eventItem", // }, + // calendarDay: { + // name: i18n.menu.dayView, + // icon: "ui//calendar", + // view: "list", + // listView: "spaces://$kit/#*calendarView", + // listGroup: "spaces://$kit/#*dateGroup", + // listItem: "spaces://$kit/#*eventItem", + // }, }; const showLayoutMenu = (e: React.MouseEvent) => { const offset = (e.target as HTMLElement).getBoundingClientRect(); @@ -726,7 +734,7 @@ export const FilterBar = (props: { }; const saveNewField = (source: string, field: SpaceProperty) => { - saveColumn({ ...field, table: "" }); + return saveColumn({ ...field, table: "" }); }; const saveContexts = (spacePath: string, contexts: string[]) => { @@ -851,7 +859,7 @@ export const FilterBar = (props: { { superstate: props.superstate, rect: offset, - editable: true, + editable: f.primary != "true", win, options: [], field: f, diff --git a/src/core/react/components/SpaceView/Contexts/SpaceEditor/HeaderPropertiesView.tsx b/src/core/react/components/SpaceView/Contexts/SpaceEditor/HeaderPropertiesView.tsx index c6ee64f..8001355 100644 --- a/src/core/react/components/SpaceView/Contexts/SpaceEditor/HeaderPropertiesView.tsx +++ b/src/core/react/components/SpaceView/Contexts/SpaceEditor/HeaderPropertiesView.tsx @@ -128,9 +128,10 @@ export const HeaderPropertiesView = (props: { const saveField = (source: string, field: SpaceProperty) => { if (source == "$fm") { saveNewProperty(props.superstate, pathState.path, field); - return; + return true; } props.superstate.spaceManager.addSpaceProperty(source, field); + return true; }; const newProperty = (e: React.MouseEvent, space: string) => { @@ -141,12 +142,13 @@ export const HeaderPropertiesView = (props: { offset, windowFromDocument(e.view.document), { - spaces: [], + spaces: spacePathStates.map((f) => f.path), fields: [], saveField: (source: string, field: SpaceProperty) => saveField(space, field), schemaId: defaultContextSchemaID, contextPath: space, + fileMetadata: !isSpace, } ); }; diff --git a/src/core/react/components/SpaceView/Contexts/TableView/ColumnHeader.tsx b/src/core/react/components/SpaceView/Contexts/TableView/ColumnHeader.tsx index 190677b..19a480d 100644 --- a/src/core/react/components/SpaceView/Contexts/TableView/ColumnHeader.tsx +++ b/src/core/react/components/SpaceView/Contexts/TableView/ColumnHeader.tsx @@ -6,7 +6,9 @@ import { ContextEditorContext } from "core/react/context/ContextEditorContext"; import { SpaceContext } from "core/react/context/SpaceContext"; import { useCombinedRefs } from "core/react/hooks/useCombinedRef"; import { Superstate } from "core/superstate/superstate"; +import { PathPropertyName } from "core/types/context"; import { optionValuesForColumn } from "core/utils/contexts/optionValuesForColumn"; +import { nameForField } from "core/utils/frames/frames"; import React, { useContext, useEffect, useRef, useState } from "react"; import { stickerForField } from "schemas/mdb"; import { SpaceTableColumn } from "types/mdb"; @@ -121,7 +123,9 @@ export const ColumnHeader = (props: { { spaces: spaceCache?.contexts ?? [], fields: cols, - saveField: (source, field) => newColumn({ ...field, table: source }), + saveField: (source, field) => { + return newColumn({ ...field, table: source }) + }, schemaId: tableData.schema.id, contextPath: spaceInfo.path, } @@ -142,7 +146,7 @@ export const ColumnHeader = (props: { superstate: props.superstate, rect: offset, win: windowFromDocument(e.view.document), - editable: props.editable, + editable: field.name != PathPropertyName, options, field, fields: cols, @@ -178,7 +182,7 @@ export const ColumnHeader = (props: { ), }} >
-
{field.name}
+
{nameForField(field, props.superstate)}
) : ( "+" diff --git a/src/core/react/components/SpaceView/Contexts/TableView/TableView.tsx b/src/core/react/components/SpaceView/Contexts/TableView/TableView.tsx index ded3653..4c34afc 100644 --- a/src/core/react/components/SpaceView/Contexts/TableView/TableView.tsx +++ b/src/core/react/components/SpaceView/Contexts/TableView/TableView.tsx @@ -128,9 +128,10 @@ export const TableView = (props: { superstate: Superstate }) => { updateValue, } = useContext(ContextEditorContext); + const pageSize = props.superstate.settings.contextPagination ?? 25; const [pagination, setPagination] = React.useState({ pageIndex: 0, - pageSize: 10, + pageSize: pageSize, }); const [activeId, setActiveId] = useState(null); const [lastSelectedIndex, setLastSelectedIndex] = useState(null); @@ -761,9 +762,11 @@ export const TableView = (props: { superstate: Superstate }) => { table.setPageSize(pagination.pageSize + 25)} + onClick={() => + table.setPageSize(pagination.pageSize + pageSize) + } > - Load More + {i18n.buttons.loadMore} )} diff --git a/src/core/react/components/SpaceView/TitleComponent.tsx b/src/core/react/components/SpaceView/TitleComponent.tsx index 45ab7cd..64d8de5 100644 --- a/src/core/react/components/SpaceView/TitleComponent.tsx +++ b/src/core/react/components/SpaceView/TitleComponent.tsx @@ -1,3 +1,4 @@ +import classNames from "classnames"; import { PathStickerContainer } from "core/react/components/UI/Stickers/PathSticker/PathSticker"; import { PathContext } from "core/react/context/PathContext"; import { SpaceContext } from "core/react/context/SpaceContext"; @@ -22,20 +23,30 @@ export const TitleComponent = (props: { const { pathState } = useContext(PathContext); const { spaceState } = useContext(SpaceContext); + const aliases: string[] = pathState?.metadata.property?.aliases ?? []; const [aliasMode, setAliasMode] = useState( - pathState.metadata.property?.alias?.length > 0 + props.superstate.settings.spacesUseAlias && aliases?.[0]?.length > 0 ); const name = useMemo( () => pathState - ? props.superstate.settings.spacesUseAlias - ? pathState?.label.name + ? aliasMode + ? aliases?.[0] : pathState.subtype == "tag" ? stringFromTag(pathState?.name) : pathState?.name : null, - [pathState] + [pathState, aliasMode] ); + + useEffect(() => { + if (props.superstate.settings.spacesUseAlias && aliases?.[0]?.length > 0) { + setAliasMode(true); + } else { + setAliasMode(false); + } + }, [pathState]); + const ref = useRef(null); const contentEditable = !props.readOnly && spaceState?.type != "default"; @@ -49,11 +60,11 @@ export const TitleComponent = (props: { props.superstate.reloadSpaceByPath("/"); return; } - if (props.superstate.settings.spacesUseAlias || aliasMode) { + if (aliasMode) { updatePrimaryAlias( props.superstate, pathState.path, - pathState.metadata.aliases, + pathState.metadata?.property?.aliases, newValue ); } else { @@ -199,6 +210,14 @@ export const TitleComponent = (props: { __html: name, }} >
+
) diff --git a/src/core/react/components/UI/Menus/contexts/newSpacePropertyMenu.tsx b/src/core/react/components/UI/Menus/contexts/newSpacePropertyMenu.tsx index 33898f2..c2d849e 100644 --- a/src/core/react/components/UI/Menus/contexts/newSpacePropertyMenu.tsx +++ b/src/core/react/components/UI/Menus/contexts/newSpacePropertyMenu.tsx @@ -13,7 +13,7 @@ export type NewPropertyMenuProps = { type?: string; spaces: string[]; fields: SpaceTableColumn[]; - saveField: (source: string, field: SpaceProperty) => void; + saveField: (source: string, field: SpaceProperty) => boolean; schemaId?: string; contextPath?: string; fileMetadata?: boolean; @@ -47,7 +47,10 @@ const NewPropertyMenuComponent = ( value: "$fm", }); } - if (props.contextPath) { + if ( + props.contextPath && + (!props.fileMetadata || props.contextPath != "$fm") + ) { options.push({ name: folderPathToString(props.contextPath), value: "", @@ -133,13 +136,13 @@ const NewPropertyMenuComponent = ( props.superstate.ui.notify(i18n.notice.noPropertyName); return; } - props.saveField(fieldSource, { + const result = props.saveField(fieldSource, { name: fieldName, type: fieldType, value: fieldValue, schemaId: props.schemaId, }); - props.hide(); + if (result) props.hide(); }; const onKeyDown = (e: React.KeyboardEvent) => { if (e.key == "Enter") { diff --git a/src/core/react/components/UI/Menus/contexts/spacePropertyMenu.tsx b/src/core/react/components/UI/Menus/contexts/spacePropertyMenu.tsx index f646dfa..8514de3 100644 --- a/src/core/react/components/UI/Menus/contexts/spacePropertyMenu.tsx +++ b/src/core/react/components/UI/Menus/contexts/spacePropertyMenu.tsx @@ -18,6 +18,8 @@ import { menuSeparator, } from "../menu/SelectionMenu"; import { PropertyValueComponent } from "./PropertyValue"; +import { safelyParseJSON } from "utils/parsers"; +import { nameForField } from "core/utils/frames/frames"; export const selectPropertyTypeMenu = ( e: React.MouseEvent, @@ -176,16 +178,27 @@ export const showPropertyMenu = ( hidden, } = props; + const saveName = (value: string) => { + if (!editable) { + const fieldValue = safelyParseJSON(field.value); + saveField({ ...field, value: JSON.stringify({ + ...fieldValue, + alias: value, + }) }); + return; + } + saveField({ ...field, name: value }); + } const menuOptions: SelectOption[] = []; - if (editable) { + menuOptions.push( - menuInput(field?.name ?? "", (value) => - saveField({ ...field, name: value }) + menuInput(nameForField(field, props.superstate) ?? "", (value) => + saveName(value) ) ); menuOptions.push(menuSeparator); - + if (editable) { menuOptions.push({ name: "", type: SelectOptionType.Custom, @@ -200,7 +213,7 @@ export const showPropertyMenu = ( > ), }); - + } menuOptions.push(menuSeparator); menuOptions.push({ @@ -222,7 +235,7 @@ export const showPropertyMenu = ( }, }); menuOptions.push(menuSeparator); - } + const sortableString = normalizedSortForType(field.type, false); if (sortableString && sortColumn) { @@ -247,7 +260,7 @@ export const showPropertyMenu = ( }, }); } - if (editable) { + menuOptions.push(menuSeparator); if (hide) { if (!hidden) { @@ -268,6 +281,7 @@ export const showPropertyMenu = ( }); } } + if (editable) { if (editCode) { menuOptions.push({ name: i18n.menu.editCode, diff --git a/src/core/react/components/UI/Menus/navigator/pathContextMenu.tsx b/src/core/react/components/UI/Menus/navigator/pathContextMenu.tsx index 70e3c3f..db38625 100644 --- a/src/core/react/components/UI/Menus/navigator/pathContextMenu.tsx +++ b/src/core/react/components/UI/Menus/navigator/pathContextMenu.tsx @@ -229,6 +229,8 @@ export const showPathContextMenu = ( icon: "ui//pin", onClick: (e) => { const offset = (e.target as HTMLButtonElement).getBoundingClientRect(); + const menuOptions = []; + const paths = [...superstate.spacesMap.get(path)]; showSpacesMenu( offset, windowFromDocument(e.view.document), @@ -336,7 +338,8 @@ export const showPathContextMenu = ( onClick: (e) => { superstate.spaceManager.copyPath( path, - `${cache.parent}/${cache.name} 1.${cache.type}` + `${cache.parent}`, + `${cache.name}` ); }, }); diff --git a/src/core/react/context/SidebarContext.tsx b/src/core/react/context/SidebarContext.tsx index d092e79..52dc014 100644 --- a/src/core/react/context/SidebarContext.tsx +++ b/src/core/react/context/SidebarContext.tsx @@ -1,7 +1,7 @@ import { DropModifiers } from "core/react/components/Navigator/SpaceTree/SpaceTreeItem"; import { Superstate } from "core/superstate/superstate"; import { TreeNode } from "core/superstate/utils/spaces"; -import { Area } from "core/types/area"; +import { Focus } from "core/types/focus"; import { PathState } from "core/types/superstate"; import _ from "lodash"; import React, { createContext, useEffect, useState } from "react"; @@ -14,16 +14,16 @@ type NavigatorContextProps = { activePath: string; setActivePath: React.Dispatch>; activeViewSpaces: PathState[]; - activeArea: number; - setActiveArea: React.Dispatch>; - waypoints: Area[]; - setWaypoints: (paths: Area[]) => void; + activeFocus: number; + setActiveFocus: React.Dispatch>; + waypoints: Focus[]; + setWaypoints: (paths: Focus[]) => void; saveActiveSpace: (path: string) => void; closeActiveSpace: (path: string) => void; modifier: DropModifiers; setModifier: React.Dispatch>; - editArea: boolean; - setEditArea: React.Dispatch>; + editFocus: boolean; + setEditFocus: React.Dispatch>; }; export const NavigatorContext = createContext({ @@ -33,8 +33,8 @@ export const NavigatorContext = createContext({ setSelectedPaths: _.noop, activePath: null, setActivePath: _.noop, - activeArea: 0, - setActiveArea: _.noop, + activeFocus: 0, + setActiveFocus: _.noop, activeViewSpaces: [], waypoints: [], setWaypoints: _.noop, @@ -42,8 +42,8 @@ export const NavigatorContext = createContext({ closeActiveSpace: _.noop, modifier: null, setModifier: _.noop, - editArea: false, - setEditArea: _.noop, + editFocus: false, + setEditFocus: _.noop, }); export const SidebarProvider: React.FC< @@ -53,60 +53,60 @@ export const SidebarProvider: React.FC< const [dragPaths, setDragPaths] = useState([]); const [selectedPaths, setSelectedPaths] = useState([]); const [activePath, setActivePath] = useState(null); - const [editArea, setEditArea] = useState(false); - const [waypoints, setWaypoints] = useState( + const [editFocus, setEditFocus] = useState(false); + const [waypoints, setWaypoints] = useState( props.superstate.waypoints ); - const [activeArea, setActiveArea] = useState( + const [activeFocus, setActiveFocus] = useState( props.superstate.settings.currentWaypoint ); const [activeViewSpaces, setActiveViewSpaces] = useState( - (props.superstate.waypoints[activeArea]?.paths ?? []) + (props.superstate.waypoints[activeFocus]?.paths ?? []) .map((f) => props.superstate.pathsIndex.get(f)) .filter((f) => f) ); const setActiveViewSpaceByPath = (path: string) => { - const newWaypoint = props.superstate.waypoints[activeArea] ?? { + const newWaypoint = props.superstate.waypoints[activeFocus] ?? { sticker: "", name: "Waypoint", paths: [], }; newWaypoint.paths = [...newWaypoint.paths.filter((f) => f != path), path]; - if (activeArea > props.superstate.waypoints.length) { + if (activeFocus > props.superstate.waypoints.length) { props.superstate.spaceManager.saveWaypoints([ ...props.superstate.waypoints, newWaypoint, ]); } const newWaypoints = props.superstate.waypoints.map((f, i) => - i == activeArea ? newWaypoint : f + i == activeFocus ? newWaypoint : f ); props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f) => f)); }; const closeActiveViewSpace = (path: string) => { - const newWaypoint = props.superstate.waypoints[activeArea] ?? { + const newWaypoint = props.superstate.waypoints[activeFocus] ?? { sticker: "", name: "Waypoint", paths: [], }; newWaypoint.paths = [...newWaypoint.paths.filter((f) => f != path)]; - if (activeArea > props.superstate.waypoints.length) { + if (activeFocus > props.superstate.waypoints.length) { props.superstate.spaceManager.saveWaypoints([ ...props.superstate.waypoints, newWaypoint, ]); } const newWaypoints = props.superstate.waypoints.map((f, i) => - i == activeArea ? newWaypoint : f + i == activeFocus ? newWaypoint : f ); props.superstate.spaceManager.saveWaypoints(newWaypoints.filter((f) => f)); }; - const saveWaypoints = (paths: Area[]) => { + const saveWaypoints = (paths: Focus[]) => { props.superstate.spaceManager.saveWaypoints(paths.filter((f) => f)); }; @@ -120,16 +120,18 @@ export const SidebarProvider: React.FC< ( props.superstate.waypoints[props.superstate.settings.currentWaypoint] ?.paths ?? [] - ).map((f) => props.superstate.pathsIndex.get(f)) + ) + .map((f) => props.superstate.pathsIndex.get(f)) + .filter((f) => f) ); } }; const reloadPaths = () => { setWaypoints(props.superstate.waypoints); - const _activeArea = props.superstate.settings.currentWaypoint; - setActiveArea(_activeArea); + const _activeFocus = props.superstate.settings.currentWaypoint; + setActiveFocus(_activeFocus); setActiveViewSpaces( - (props.superstate.waypoints[_activeArea]?.paths ?? []) + (props.superstate.waypoints[_activeFocus]?.paths ?? []) .map((f) => props.superstate.pathsIndex.get(f)) .filter((f) => f) ); @@ -168,11 +170,11 @@ export const SidebarProvider: React.FC< value={{ dragPaths, setDragPaths, - activeArea, + activeFocus: activeFocus, selectedPaths: selectedPaths, setSelectedPaths: setSelectedPaths, activePath: activePath, - setActiveArea: setActiveArea, + setActiveFocus: setActiveFocus, setActivePath: setActivePath, activeViewSpaces, waypoints, @@ -181,8 +183,8 @@ export const SidebarProvider: React.FC< closeActiveSpace: closeActiveViewSpace, modifier, setModifier, - editArea, - setEditArea, + editFocus: editFocus, + setEditFocus: setEditFocus, }} > {props.children} diff --git a/src/core/schemas/settings.ts b/src/core/schemas/settings.ts index 396d771..6c0ab37 100644 --- a/src/core/schemas/settings.ts +++ b/src/core/schemas/settings.ts @@ -41,6 +41,7 @@ export const DEFAULT_SETTINGS: MakeMDSettings = { bannerHeight: 200, spacesDisablePatch: false, folderNoteInsideFolder: true, + folderNoteName: "", sidebarTabs: true, showRibbon: true, deleteFileOption: "trash", @@ -66,6 +67,7 @@ export const DEFAULT_SETTINGS: MakeMDSettings = { inlineContextNameLayout: "vertical", waypoints: ['/'], spacesUseAlias: false, + flowState: false, fmKeyAlias: 'aliases', fmKeyBanner: 'banner', fmKeyColor: 'color', @@ -92,4 +94,6 @@ export const DEFAULT_SETTINGS: MakeMDSettings = { defaultSpaceTemplate: "", selectedKit: "default", actionMaxSteps: 100, + contextPagination: 25, + searchWorker: true, }; diff --git a/src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts b/src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts index b72e0c6..55df452 100644 --- a/src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts +++ b/src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts @@ -7,7 +7,7 @@ import { AFile, PathLabel } from "core/middleware/types/afile"; import { DefaultFolderNoteMDBTables, DefaultMDBTables } from "core/react/components/SpaceView/Frames/DefaultFrames/DefaultFrames"; import { fileSystemSpaceInfoByPath, fileSystemSpaceInfoFromFolder, fileSystemSpaceInfoFromTag } from "core/spaceManager/filesystemAdapter/spaceInfo"; import { parseSpaceMetadata, spaceContextsKey, spaceFilterKey, spaceLinksKey, spaceSortKey, spaceTemplateKey, spaceTemplateNameKey } from "core/superstate/utils/spaces"; -import { Area } from "core/types/area"; +import { Focus } from "core/types/focus"; import { SpaceDefinition, tagsSpacePath } from "core/types/space"; import { linkContextRow, propertyDependencies } from "core/utils/contexts/linkContextRow"; import { runFormulaWithContext } from "core/utils/formula/parser"; @@ -59,7 +59,7 @@ export class FilesystemSpaceAdapter implements SpaceAdapter { public deleteTemplate (path: string, space: string) { return this.deletePath(`${space}/.space/templates/${path}`) } - public async readWaypoints () : Promise { + public async readWaypoints () : Promise { if (!await this.fileSystem.fileExists(defaultSpaceFolder)) { await this.fileSystem.createFolder(defaultSpaceFolder) } @@ -68,7 +68,7 @@ export class FilesystemSpaceAdapter implements SpaceAdapter { } return this.fileSystem.readTextFromFile(defaultWaypointsFile).then(f => ensureArray(safelyParseJSON(f))) } - public async saveWaypoints (waypoints: Area[]) { + public async saveWaypoints (waypoints: Focus[]) { if (!await this.fileSystem.fileExists(defaultSpaceFolder)) { await this.fileSystem.createFolder(defaultSpaceFolder) } diff --git a/src/core/spaceManager/filesystemAdapter/spaceInfo.ts b/src/core/spaceManager/filesystemAdapter/spaceInfo.ts index 04589fc..9d30b2d 100644 --- a/src/core/spaceManager/filesystemAdapter/spaceInfo.ts +++ b/src/core/spaceManager/filesystemAdapter/spaceInfo.ts @@ -98,6 +98,7 @@ export const fileSystemSpaceInfoFromFolder = ( }; } const folderName = folderPathToString(folder); + const folderNoteName = manager.superstate.settings.folderNoteName; return { name: folderName, @@ -106,7 +107,7 @@ export const fileSystemSpaceInfoFromFolder = ( readOnly: readOnly, folderPath: folder, defPath: folder + "/.space/def.json", - notePath: folder + "/" + folderName + ".md", + notePath: folder + "/" + (folderNoteName.length > 0 ? folderNoteName : folderName) + ".md", dbPath: spaceFolderPathFromSpace(folder + "/", manager) + manager.superstate.settings.folderContextFile + ".mdb", framePath: spaceFolderPathFromSpace(folder + diff --git a/src/core/spaceManager/spaceManager.ts b/src/core/spaceManager/spaceManager.ts index 58d80c7..c042311 100644 --- a/src/core/spaceManager/spaceManager.ts +++ b/src/core/spaceManager/spaceManager.ts @@ -1,7 +1,7 @@ import { PathLabel } from "core/middleware/types/afile"; import { Superstate } from "core/superstate/superstate"; import { ActionInstance } from "core/types/actions"; -import { Area } from "core/types/area"; +import { Focus } from "core/types/focus"; import { SpaceDefinition, SpaceType, tagsSpacePath } from "core/types/space"; import { parseURI } from "core/utils/uri"; import { Command, CommandResult, Library } from "types/commands"; @@ -117,8 +117,8 @@ export abstract class SpaceAdapter { public saveSpaceTemplate: (frames: MDBFrames, name: string) => Promise; public childrenForPath: (path: string, type?: string) => Promise; - public readWaypoints: () => Promise; - public saveWaypoints: (waypoints: Area[]) => Promise; + public readWaypoints: () => Promise; + public saveWaypoints: (waypoints: Focus[]) => Promise; public readTemplates: (path: string) => Promise; public saveTemplate: (path: string, space: string) => Promise; public deleteTemplate: (path: string, space: string) => Promise; @@ -504,7 +504,7 @@ export class SpaceManager { public readWaypoints () { return this.primarySpaceAdapter.readWaypoints(); } - public saveWaypoints (waypoints: Area[]) { + public saveWaypoints (waypoints: Focus[]) { this.superstate.waypoints = waypoints; this.superstate.dispatchEvent("superstateUpdated", null) return this.primarySpaceAdapter.saveWaypoints(waypoints); diff --git a/src/core/spaceManager/webAdapter/webAdapter.ts b/src/core/spaceManager/webAdapter/webAdapter.ts index 6bb9394..ceec796 100644 --- a/src/core/spaceManager/webAdapter/webAdapter.ts +++ b/src/core/spaceManager/webAdapter/webAdapter.ts @@ -1,7 +1,7 @@ import { PathLabel } from "core/middleware/types/afile"; -import { Area } from "core/types/area"; +import { Focus } from "core/types/focus"; import { SpaceDefinition } from "core/types/space"; import { defaultContextSchemaID } from "schemas/mdb"; import { Command, CommandResult, Library } from "types/commands"; @@ -49,10 +49,10 @@ export class WebSpaceAdapter implements SpaceAdapter { public deleteTemplate (path: string, space: string) : Promise { return } - public async readWaypoints () : Promise { + public async readWaypoints () : Promise { return [] } - public async saveWaypoints (waypoints: Area[]) { + public async saveWaypoints (waypoints: Focus[]) { return } diff --git a/src/core/superstate/api.ts b/src/core/superstate/api.ts index 8b21731..d94616c 100644 --- a/src/core/superstate/api.ts +++ b/src/core/superstate/api.ts @@ -179,7 +179,8 @@ update: (property: string, value: string, path: string, saveState: (state: any) { if (row) saveProperties(this.superstate, f, { - ...row + ...row, + [PathPropertyName]: f }) }) } else { diff --git a/src/core/superstate/cacheParsers.ts b/src/core/superstate/cacheParsers.ts index 1472a54..0f78cda 100644 --- a/src/core/superstate/cacheParsers.ts +++ b/src/core/superstate/cacheParsers.ts @@ -155,7 +155,7 @@ export const parseMetadata = (path: string, settings: MakeMDSettings, spacesCach tags.push(...fileTags) const name = label?.name; - const aliases = pathCache?.properties ? ensureArray(pathCache.properties[settings.fmKeyAlias]) : []; + const aliases = pathCache?.property ? ensureArray(pathCache.property[settings.fmKeyAlias]) : []; const sticker = defaultSticker(label?.sticker, type, path); const color = label?.color ?? ''; @@ -168,11 +168,11 @@ export const parseMetadata = (path: string, settings: MakeMDSettings, spacesCach ...cache, name, tags: uniq(tags), - type: type, + type: type, subtype, parent, label: { - name, + name: settings.spacesUseAlias && aliases?.length > 0 ? aliases[0] : name, sticker, color, thumbnail: label?.thumbnail ?? '', @@ -185,6 +185,8 @@ export const parseMetadata = (path: string, settings: MakeMDSettings, spacesCach } const spaces : string[] = []; + const linkedSpaces : string[] = []; + const liveSpaces : string[] = []; if (subtype == 'tag') { spaces.push(tagsSpacePath) } @@ -216,6 +218,7 @@ export const parseMetadata = (path: string, settings: MakeMDSettings, spacesCach if (space.metadata?.filters?.length > 0) { if (pathByDef(space.metadata.filters, {...pathState, spaces}, space.properties)) { spaces.push(s); + liveSpaces.push(s); return; } } @@ -223,6 +226,7 @@ export const parseMetadata = (path: string, settings: MakeMDSettings, spacesCach const spaceItem = (space.metadata?.links ?? []).find(f => f == pathState.path); if (spaceItem) { spaces.push(s); + linkedSpaces.push(s); return; } } @@ -241,7 +245,7 @@ export const parseMetadata = (path: string, settings: MakeMDSettings, spacesCach { pathState.metadata.spacePath = spacePath; } - const metadata : PathState = hidden ? {...pathState, spaces: [], hidden: hidden} : {...pathState, spaces: uniq(spaces), hidden }; + const metadata : PathState = hidden ? {...pathState, spaces: [], hidden: hidden} : {...pathState, spaces: uniq(spaces), linkedSpaces, liveSpaces, hidden }; let changed = true; if (oldMetadata && _.isEqual(metadata, oldMetadata)) { diff --git a/src/core/superstate/superstate.ts b/src/core/superstate/superstate.ts index 8e11e68..397a9fe 100644 --- a/src/core/superstate/superstate.ts +++ b/src/core/superstate/superstate.ts @@ -5,8 +5,8 @@ import { UIManager } from "core/middleware/ui"; import { fileSystemSpaceInfoFromTag } from "core/spaceManager/filesystemAdapter/spaceInfo"; import { SpaceManager } from "core/spaceManager/spaceManager"; import { saveProperties, saveSpaceCache, saveSpaceMetadataValue } from "core/superstate/utils/spaces"; -import { Area } from "core/types/area"; import { PathPropertyName } from "core/types/context"; +import { Focus } from "core/types/focus"; import { IndexMap } from "core/types/indexMap"; import { MakeMDSettings } from "core/types/settings"; import { SpaceDefinition, SpaceType, tagsSpacePath } from "core/types/space"; @@ -134,6 +134,7 @@ public api: API; public spacesMap: IndexMap //file to space mapping public linksMap: IndexMap //link between paths public tagsMap: IndexMap //file to tag mapping + public liveSpaceLinkMap: IndexMap //Workers public allMetadata: Record void, spaceManager: SpaceManager, uiManager: UIManager, commandsManager: CLIManager) { this.eventsDispatcher= new EventDispatcher(); @@ -190,6 +191,7 @@ public api: API; this.spacesMap = new IndexMap(); this.linksMap = new IndexMap(); this.tagsMap = new IndexMap(); + this.liveSpaceLinkMap = new IndexMap(); //Initiate Persistance this.iconsCache = new Map(); @@ -421,7 +423,7 @@ public api: API; public async initializeWaypoints() { const allWaypoints = await this.spaceManager.readWaypoints(); if (allWaypoints.length == 0 && this.settings.waypoints.length > 0) { - let newWaypoints : Area[] = this.settings.waypoints.map(f => { + let newWaypoints : Focus[] = this.settings.waypoints.map(f => { return {name: this.pathsIndex.get(f)?.label.name, paths: [f], sticker: f == 'spaces://$tags' ? 'ui//tags' : this.pathsIndex.get(f)?.label?.sticker} }) if (newWaypoints.length == 0) { @@ -530,6 +532,7 @@ public api: API; public onMetadataChange(path: string) { + if (!this.pathsIndex.has(path)) {return} this.reloadPath(path).then(f => @@ -543,7 +546,7 @@ public api: API; const allContextsWithFile = pathState.spaces.map(f => this.spacesIndex.get(f)?.space).filter(f => f); this.addToContextStateQueue(() => updateContextWithProperties(this, path, allContextsWithFile).then(() => { allContextsWithFile.forEach(f => { - this.dispatchEvent("contextStateUpdated", {path: f.path}) + this.dispatchEvent("spaceStateUpdated", {path: f.path}) }) })); this.dispatchEvent("pathStateUpdated", {path: path}) @@ -717,7 +720,7 @@ public api: API; if (!changed) { return false } this.contextsIndex.set(path, cache); const pathState = this.pathsIndex.get(path); - if (cache.dbExists && !pathState.readOnly) { + if (pathState && cache.dbExists && !pathState.readOnly) { if (this.settings.syncFormulaToFrontmatter) { const allRows = cache.contextTable?.rows ?? []; const allColumns = cache.contextTable?.cols ?? []; @@ -870,6 +873,7 @@ public async updateSpaceMetadata (spacePath: string, metadata: SpaceDefinition) const contexts : string[] = metadata?.contexts ?? [] const dependencies = uniq((metadata.filters ?? []).flatMap(f => f.filters).flatMap(f => f.type == 'context' ? [f.field.split('.')[0]] : f.type == 'path' && f.field == 'space' ? parseMultiString(f.value) : [])); + const linkDependencies = uniq((metadata.filters ?? []).flatMap(f => f.filters).flatMap(f => f.type.startsWith('link') ? parseMultiString(f.value) : [])); if (type == 'tag' && this.settings.autoAddContextsToSubtags) { const parentTags = getAllParentTags(space.name); contexts.push(...parentTags) diff --git a/src/core/superstate/utils/spaces.ts b/src/core/superstate/utils/spaces.ts index 1290078..76323f9 100644 --- a/src/core/superstate/utils/spaces.ts +++ b/src/core/superstate/utils/spaces.ts @@ -198,8 +198,9 @@ export const pathStateToTreeNode = ( type: 'file', }); -export const spaceRowHeight = (superstate: Superstate, section: boolean) => { - return isTouchScreen(superstate.ui) ? 40 : section ? superstate.settings.spaceRowHeight + 10 : superstate.settings.spaceRowHeight; +export const spaceRowHeight = (superstate: Superstate, preset: number, section: boolean) => { + const spaceHeight = preset ?? 29; + return isTouchScreen(superstate.ui) ? 40 : section ? spaceHeight + 10 : spaceHeight; } export const spaceSortFn = diff --git a/src/core/superstate/workers/search/impl.ts b/src/core/superstate/workers/search/impl.ts index 36b2b8d..65d7b3b 100644 --- a/src/core/superstate/workers/search/impl.ts +++ b/src/core/superstate/workers/search/impl.ts @@ -1,9 +1,10 @@ +import { SpaceDefGroup } from "core/types/space"; import { PathState } from "core/types/superstate"; import { pathByDef } from "core/utils/spaces/query"; -export function searchPath (payload: { queries: [], pathsIndex: Map, count: number}) { +export function searchPath (payload: { queries: SpaceDefGroup[], pathsIndex: Map, count: number}) { const { queries, pathsIndex, count } = payload; const paths = []; diff --git a/src/core/test/TestComponent.tsx b/src/core/test/TestComponent.tsx index e3c800d..2979f83 100644 --- a/src/core/test/TestComponent.tsx +++ b/src/core/test/TestComponent.tsx @@ -1,4 +1,5 @@ import * as acorn from "acorn"; +import { InlineMenuComponent } from "adapters/obsidian/ui/editors/markdownView/menus/inlineStylerView/InlineMenu"; import ImageModal from "core/react/components/UI/Modals/ImageModal"; import StickerModal from "core/react/components/UI/Modals/StickerModal"; import { @@ -16,13 +17,14 @@ import { import { PathState, SpaceState } from "core/types/superstate"; import { movePath } from "core/utils/uri"; -import { Superstate } from "makemd-core"; +import MakeMDPlugin from "main"; import React, { PropsWithChildren, useEffect, useState } from "react"; -export const openTestModal = (superstate: Superstate) => { +export const openTestModal = (plugin: MakeMDPlugin) => { + const superstate = plugin.superstate; superstate.ui.openModal( "Tests", - (props) => , + (props) => , window ); }; @@ -63,8 +65,8 @@ export const TestToggleSection = (
); }; -export const TestComponent = (props: { superstate: Superstate }) => { - const { superstate } = props; +export const TestComponent = (props: { plugin: MakeMDPlugin }) => { + const superstate = props.plugin.superstate; const [space, setSpace] = useState(null); const [path, setPath] = useState(null); const [sticker, setSticker] = useState(null); @@ -91,6 +93,12 @@ export const TestComponent = (props: { superstate: Superstate }) => { return (
+ setOutput( @@ -219,7 +227,7 @@ export const TestComponent = (props: { superstate: Superstate }) => { - saveSpaceMetadataValue(props.superstate, space.path, "contexts", [ + saveSpaceMetadataValue(superstate, space.path, "contexts", [ value, ]) } diff --git a/src/core/types/area.ts b/src/core/types/focus.ts similarity index 73% rename from src/core/types/area.ts rename to src/core/types/focus.ts index e2d1624..46ab261 100644 --- a/src/core/types/area.ts +++ b/src/core/types/focus.ts @@ -1,4 +1,4 @@ -export type Area = { +export type Focus = { name: string; paths: string[]; sticker: string; diff --git a/src/core/types/settings.ts b/src/core/types/settings.ts index 82fd973..e812435 100644 --- a/src/core/types/settings.ts +++ b/src/core/types/settings.ts @@ -10,6 +10,7 @@ export interface MakeMDSettings { markSans: boolean; flowMenuEnabled: boolean; makeMenuPlaceholder: boolean; + flowState: boolean; inlineStyler: boolean; mobileMakeBar: boolean; inlineStylerColors: boolean; @@ -43,6 +44,7 @@ export interface MakeMDSettings { folderContextFile: string; folderFrameFile: string; folderNoteInsideFolder: boolean; + folderNoteName: string; enableFolderNote: boolean; folderIndentationLines: boolean; revealActiveFile: boolean; @@ -92,4 +94,6 @@ syncFormulaToFrontmatter: boolean; defaultSpaceTemplate: string; selectedKit: string; actionMaxSteps: number; + contextPagination: number; + searchWorker: boolean; } diff --git a/src/core/types/space.ts b/src/core/types/space.ts index 8306b87..27b9a56 100644 --- a/src/core/types/space.ts +++ b/src/core/types/space.ts @@ -8,7 +8,7 @@ import { PathState, SpaceState } from "./superstate" -export const FMMetadataKeys = (settings: MakeMDSettings) => [ settings.fmKeyBanner, settings.fmKeySticker, settings.fmKeyColor, settings.fmKeyBanner, settings.fmKeyBannerOffset] +export const FMMetadataKeys = (settings: MakeMDSettings) => [ settings.fmKeyAlias, settings.fmKeyBanner, settings.fmKeySticker, settings.fmKeyColor, settings.fmKeyBanner, settings.fmKeyBannerOffset] export type SpaceSort = { field: string, asc: boolean, diff --git a/src/core/types/superstate.ts b/src/core/types/superstate.ts index 7a1c853..cb777a9 100644 --- a/src/core/types/superstate.ts +++ b/src/core/types/superstate.ts @@ -69,6 +69,8 @@ export type PathState = { properties?: Record hidden?: boolean spaces?: string[] + linkedSpaces?: string[] + liveSpaces?: string[] tags?: string[] inlinks?: string[] outlinks?: string[] diff --git a/src/core/utils/formula/formulas.ts b/src/core/utils/formula/formulas.ts index 63c93af..702891a 100644 --- a/src/core/utils/formula/formulas.ts +++ b/src/core/utils/formula/formulas.ts @@ -604,6 +604,11 @@ const current = (args: MathNode[], math: any, scope: Map) => { } current.rawArgs = true; +const index = (args: MathNode[], math: any, scope: Map) => { + return scope?.get("$index"); +} +index.rawArgs = true; + const find = (args: MathNode[], math: any, scope: Map) => { if (args.length !== 2) { return ""; @@ -613,9 +618,10 @@ const find = (args: MathNode[], math: any, scope: Map) => { : args[0]; if (Array.isArray(arr)) { - return arr.find((f) => { + return arr.find((f, i) => { scope.set("$current", f); - math.evaluate("current = _current()", scope) + scope.set("$index", i); + math.evaluate("current = _current(); index = _index()", scope) const value = args[1].compile().evaluate ? args[1].compile().evaluate(scope) : args[1]; @@ -635,9 +641,10 @@ const findIndex = (args: MathNode[], math: any, scope: Map) => { : args[0]; if (Array.isArray(arr)) { - return arr.findIndex((f) => { + return arr.findIndex((f, i) => { scope.set("$current", f); - math.evaluate("current = _current()", scope) + scope.set("$index", i); + math.evaluate("current = _current(); index = _index()", scope) const value = args[1].compile().evaluate ? args[1].compile().evaluate(scope) : args[1]; @@ -656,9 +663,10 @@ const filter = (args: MathNode[], math: any, scope: Map) => { ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.filter((f) => { + return arr.filter((f, i) => { scope.set("$current", f); - math.evaluate("current = _current()", scope) + scope.set("$index", i); + math.evaluate("current = _current(); index = _index()", scope) return args[1].compile().evaluate(scope); }); } @@ -676,9 +684,10 @@ const map = (args: MathNode[], math: any, scope: Map) => { : args[0]; if (Array.isArray(arr)) { - return arr.map((f) => { + return arr.map((f, i) => { scope.set("$current", f); - math.evaluate("current = _current()", scope); + scope.set("$index", i); + math.evaluate("current = _current(); index = _index()", scope) const result = args[1].compile().evaluate(scope); return result; @@ -696,9 +705,10 @@ const some = (args: MathNode[], math: any, scope: Map) => { ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.some((f) => { + return arr.some((f, i) => { scope.set("$current", f); - math.evaluate("current = _current()", scope) + scope.set("$index", i); + math.evaluate("current = _current(); index = _index()", scope) return args[1].compile().evaluate(scope); }); } @@ -714,9 +724,10 @@ const every = (args: MathNode[], math: any, scope: Map) => { ? args[0].compile().evaluate(scope) : args[0]; if (Array.isArray(arr)) { - return arr.every((f) => { + return arr.every((f, i) => { scope.set("$current", f); - math.evaluate("current = _current()", scope) + scope.set("$index", i); + math.evaluate("current = _current(); index = _index()", scope) return args[1].compile().evaluate(scope); }); } @@ -812,6 +823,7 @@ const format = (arg: any) =>{ export const formulas = { "prop": prop, "_current": current, + "_index": index, "slice": (str: string, start: number, end: number) => { str = format(str); return str.slice(start, end); @@ -925,38 +937,38 @@ export const formulas = { }, "dateRange": (arr: Date[], type: string) => { const diff = Math.abs(Math.max(...arr.map(f => f.getTime())) - Math.min(...arr.map(f => f.getTime()))); - if (type === "days") return diff / (1000 * 60 * 60 * 24); - if (type === "months") return diff / (1000 * 60 * 60 * 24 * 30); - if (type === "years") return diff / (1000 * 60 * 60 * 24 * 365); - if (type === "hours") return diff / (1000 * 60 * 60); - if (type === "minutes") return diff / (1000 * 60); - if (type === "seconds") return diff / 1000; - if (type === "weeks") return diff / (1000 * 60 * 60 * 24 * 7); - if (type === "quarters") return diff / (1000 * 60 * 60 * 24 * 30 * 3); + if (type.startsWith("day")) return diff / (1000 * 60 * 60 * 24); + if (type.startsWith("month")) return diff / (1000 * 60 * 60 * 24 * 30); + if (type.startsWith("year")) return diff / (1000 * 60 * 60 * 24 * 365); + if (type.startsWith("hour")) return diff / (1000 * 60 * 60); + if (type.startsWith("minute")) return diff / (1000 * 60); + if (type.startsWith("second")) return diff / 1000; + if (type.startsWith("week")) return diff / (1000 * 60 * 60 * 24 * 7); + if (type.startsWith("quarter")) return diff / (1000 * 60 * 60 * 24 * 30 * 3); return diff / (1000 * 60 * 60 * 24); }, "dateAdd": (newDate: Date, amount: number, type: string) => { - if (type === "days") newDate.setDate(newDate.getDate() + amount); - if (type === "months") newDate.setMonth(newDate.getMonth() + amount); - if (type === "years") newDate.setFullYear(newDate.getFullYear() + amount); - if (type === 'quarters') newDate.setMonth(newDate.getMonth() + amount * 3); - if (type === 'weeks') newDate.setDate(newDate.getDate() + amount * 7); - if (type === "hours") newDate.setHours(newDate.getHours() + amount); - if (type === "minutes") newDate.setMinutes(newDate.getMinutes() + amount); - if (type === "seconds") newDate.setSeconds(newDate.getSeconds() + amount); + if (type.startsWith("day")) newDate.setDate(newDate.getDate() + amount); + if (type.startsWith("month")) newDate.setMonth(newDate.getMonth() + amount); + if (type.startsWith("year")) newDate.setFullYear(newDate.getFullYear() + amount); + if (type.startsWith('quarter')) newDate.setMonth(newDate.getMonth() + amount * 3); + if (type.startsWith('week')) newDate.setDate(newDate.getDate() + amount * 7); + if (type.startsWith("hour")) newDate.setHours(newDate.getHours() + amount); + if (type.startsWith("minute")) newDate.setMinutes(newDate.getMinutes() + amount); + if (type.startsWith("second")) newDate.setSeconds(newDate.getSeconds() + amount); return newDate; }, "dateSubtract": (newDate: Date, amount: number, type: string) => { - if (type === "days") newDate.setDate(newDate.getDate() - amount); - if (type === "months") newDate.setMonth(newDate.getMonth() - amount); - if (type === "years") newDate.setFullYear(newDate.getFullYear() - amount); - if (type === 'quarters') newDate.setMonth(newDate.getMonth() - amount * 3); - if (type === 'weeks') newDate.setDate(newDate.getDate() - amount * 7); - if (type === "hours") newDate.setHours(newDate.getHours() - amount); - if (type === "minutes") newDate.setMinutes(newDate.getMinutes() - amount); - if (type === "seconds") newDate.setSeconds(newDate.getSeconds() - amount); + if (type.startsWith("day")) newDate.setDate(newDate.getDate() - amount); + if (type.startsWith("month")) newDate.setMonth(newDate.getMonth() - amount); + if (type.startsWith("year")) newDate.setFullYear(newDate.getFullYear() - amount); + if (type.startsWith('quarter')) newDate.setMonth(newDate.getMonth() - amount * 3); + if (type.startsWith('week')) newDate.setDate(newDate.getDate() - amount * 7); + if (type.startsWith("hour")) newDate.setHours(newDate.getHours() - amount); + if (type.startsWith("minute")) newDate.setMinutes(newDate.getMinutes() - amount); + if (type.startsWith("second")) newDate.setSeconds(newDate.getSeconds() - amount); return newDate; }, "dateBetween": (current: Date, end: Date, format: string) => { diff --git a/src/core/utils/spaces/query.ts b/src/core/utils/spaces/query.ts index 0a24671..fe8ae42 100644 --- a/src/core/utils/spaces/query.ts +++ b/src/core/utils/spaces/query.ts @@ -74,12 +74,13 @@ const filterPathCache = (paths: PathState[], def: SpaceDefFilter, props: Record< if (!filterFn || (filterFn.valueType != 'none' && def.value.length == 0)) { return []; } + return paths.filter(f => { let value = ''; if (def.field == 'outlinks') { value = serializeMultiString(f.outlinks ?? []) } else if (def.field == 'inlinks') { - value = serializeMultiString(f.inlinks ?? []) + value = serializeMultiString(f.metadata?.inlinks ?? []) } else if (def.field == 'tags') { value = serializeMultiString(f.tags ?? []); } @@ -88,7 +89,9 @@ const filterPathCache = (paths: PathState[], def: SpaceDefFilter, props: Record< if (filterFn) { const defValue = (def.fType == 'property') ? props[def.value] : def.value; + result = filterFn.fn(value, defValue); + } return result; }); diff --git a/src/core/utils/strings.ts b/src/core/utils/strings.ts index 9caea18..90bee9c 100644 --- a/src/core/utils/strings.ts +++ b/src/core/utils/strings.ts @@ -1,6 +1,5 @@ import { Superstate } from "core/superstate/superstate"; import { safelyParseJSON } from "utils/parsers"; -import { pathToString } from "utils/path"; export const defaultString = (value: any, string: string) => { if (!value || value.length == 0) return string; @@ -90,6 +89,6 @@ export const pathToParentPath = (path: string) => removeLeadingSlash(path.substring(0, path.lastIndexOf("/"))) || path; -export const spaceNotePathForSpacePath = (spacePath: string) => spacePath+"/"+pathToString(spacePath)+".md" + diff --git a/src/css/Editor/Flow/FlowEditor.css b/src/css/Editor/Flow/FlowEditor.css index 94764c4..da862fa 100644 --- a/src/css/Editor/Flow/FlowEditor.css +++ b/src/css/Editor/Flow/FlowEditor.css @@ -218,6 +218,7 @@ div:not(.mk-flowspace-editor) > } .mk-floweditor > .workspace-leaf > .workspace-leaf-content, .mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content, .mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > .mod-cm6 > .cm-editor > .cm-scroller { overflow: visible !important; + height: auto; } .mk-floweditor-container > .mk-floweditor { diff --git a/src/css/Editor/Flow/FlowState.css b/src/css/Editor/Flow/FlowState.css new file mode 100644 index 0000000..4f48d67 --- /dev/null +++ b/src/css/Editor/Flow/FlowState.css @@ -0,0 +1,33 @@ +.mk-flow-state +.workspace-tab-header-container-inner { +display: none; +} +.mk-flow-state .workspace-ribbon { + display: none; + } + body:not(.is-mobile).mk-flow-state .workspace-split.mod-left-split .workspace-sidedock-vault-profile { + transform: translateY(-100%); + transition: transform 1000ms linear; + } + body.mk-flow-state { + --tab-container-background: var(--background-primary) !important; + --titlebar-background-focused: var(--background-primary) !important; + --divider-color: transparent !important; + --tab-outline-color: transparent !important; + + } + + .mk-flow-state .workspace-tabs .workspace-leaf { + background: var(--background-primary) !important; + } + + .mk-flow-state .view-header { + transform: translateY(-100%); + max-height: 0; + transition: transform 1000ms linear; + transition: + } + + body.mk-flow-state div { + transition: background-color 1000ms linear; + } \ No newline at end of file diff --git a/src/css/Menus/InlineMenu.css b/src/css/Menus/InlineMenu.css index 1018eda..ae6a873 100644 --- a/src/css/Menus/InlineMenu.css +++ b/src/css/Menus/InlineMenu.css @@ -2,10 +2,17 @@ body:not(.is-mobile) .mk-style-menu { margin-left: -80px; } +.mk-style-menu .mk-divider { + border-left: thin solid var(--mk-ui-divider); + width: 1px; + height: 24px; +} + .mk-style-menu { display: flex; - padding: 0; + padding: 4px; margin-top: -50px; + align-items: center; } .is-mobile .mk-style-menu svg { @@ -30,12 +37,36 @@ body:not(.is-mobile) .mk-style-menu { border-radius: 4px; display: flex; } +.mk-style-menu .mk-mark { + width: 24px; + height: 24px; + padding: 6px; +} +.mk-style-menu .mk-mark svg { + width: 12px; + height: 12px; +} .mk-mark div { display: flex; } +.mk-mark-group { + display: flex; +} +.mk-mark-dropdown { + padding: 2px; + border-radius: 4px; + display: flex; + align-items: center; +} + +.mk-mark-dropdown svg { + width: 12px; + height: 12px; + transform: rotate(90deg) +} -.mk-style-menu .mk-mark:hover { +.mk-style-menu .mk-mark:hover, .mk-style-menu .mk-mark-dropdown:hover { background: var(--mk-ui-background-hover); } diff --git a/src/css/Panels/FileContext.css b/src/css/Panels/FileContext.css index 3807643..2462a18 100644 --- a/src/css/Panels/FileContext.css +++ b/src/css/Panels/FileContext.css @@ -1,4 +1,4 @@ -.mk-path-context { +.mk-path-explorer { display: flex; flex-direction: column; --file-context-spacing: 4px; @@ -61,7 +61,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit margin-top: 8px; padding-top: 0 !important; margin-bottom: 0; - width: auto; + width: 100%; } .mk-inline-title { @@ -183,9 +183,14 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit justify-content: center; } +.mk-path-explorer .mk-path-context-row { + flex-direction: column; +} +.mk-path-explorer .mk-path-context-value { + margin-left: 24px; +} - -.mk-path-context .mk-path-context-field { +.mk-path-explorer .mk-path-context-field { max-width: 120px; min-width: 120px; } @@ -218,7 +223,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit background-color: var(--bullet-color); transition: transform 75ms ease-out; } -.mk-path-context .mk-cell-text { +.mk-path-explorer .mk-cell-text { background: var(var(--mk-ui-active-hover)) !important; } @@ -285,7 +290,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit box-shadow: none !important; } -.mk-path-context .mk-path-context-title { +.mk-path-explorer .mk-path-context-title { --icon-size: 14px; font-size: 14px; } @@ -328,7 +333,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit height: unset !important; } -.mk-path-context .mk-tag-selector { +.mk-path-explorer .mk-tag-selector { padding: 0 !important; } .mk-space-icon { @@ -341,7 +346,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit padding: 8px; } -.mk-path-context .mk-path-context-backlink { +.mk-path-explorer .mk-path-context-backlink { border: thin solid var(--mk-ui-border); border-radius: 8px; box-shadow: var(--mk-shadow-card) @@ -494,7 +499,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit pointer-events: none; } -.mk-path-context .inline-title { +.mk-path-explorer .inline-title { font-size: 18px; margin-bottom: 0; } diff --git a/src/css/Panels/Navigator/FileTree.css b/src/css/Panels/Navigator/FileTree.css index 68794fb..4d34a03 100644 --- a/src/css/Panels/Navigator/FileTree.css +++ b/src/css/Panels/Navigator/FileTree.css @@ -104,7 +104,7 @@ body.is-mobile .sidebar-toggle-button { /* flex-direction: column-reverse; */ } -.mk-path-tree-area { +.mk-path-tree-focus { display: flex; flex-direction: column; align-items: center; @@ -113,7 +113,7 @@ body.is-mobile .sidebar-toggle-button { height: 100%; } -.mk-path-tree-area input { +.mk-path-tree-focus input { width: 60%; padding: 8px; border: none; diff --git a/src/css/Panels/Navigator/Navigator.css b/src/css/Panels/Navigator/Navigator.css index cde3675..f247291 100644 --- a/src/css/Panels/Navigator/Navigator.css +++ b/src/css/Panels/Navigator/Navigator.css @@ -107,12 +107,12 @@ margin-left: 6px; } .mk-tree-section { - margin-top: 6px; - height: 32px; + margin-top: 4px; + height: var(--spaceSectionHeight); } .mk-tree-section .mk-tree-item { - height: 32px; + height: var(--spaceRowHeight);; padding-left: 4px; } .mk-tree-section .is-active.mk-tree-item, .mk-tree-section .mk-tree-item:hover { @@ -155,6 +155,7 @@ opacity: 1; font-size: 13px; line-height: 1.3; gap: 2px; + height: var(--spaceRowHeight); } @@ -178,7 +179,7 @@ opacity: 1; .mk-inline-button, -.mk-folder-buttons button { +.mk-folder-buttons button, .mk-folder-buttons div { background: none; border: 0; box-shadow: none; @@ -234,6 +235,10 @@ body:not(.is-mobile) .mk-tree-wrapper:hover .mk-drag-handle { display: flex; } +.mk-folder-buttons div { + align-items: center; + justify-content: center; +} body:not(.is-mobile) .mk-tree-wrapper .mk-path-link { opacity: 0; } @@ -242,10 +247,12 @@ body:not(.is-mobile) .mk-tree-wrapper:hover .mk-path-link { opacity: 1; } -body:not(.is-mobile) .mk-tree-wrapper .mk-folder-buttons button { +body:not(.is-mobile) .mk-tree-wrapper .mk-folder-buttons button, +body:not(.is-mobile) .mk-tree-wrapper .mk-folder-buttons div { display: none; } -body:not(.is-mobile) .mk-tree-wrapper:hover .mk-folder-buttons button{ +body:not(.is-mobile) .mk-tree-wrapper:hover .mk-folder-buttons button, +body:not(.is-mobile) .mk-tree-wrapper:hover .mk-folder-buttons div{ display: flex; } body:not(.is-mobile) .mk-tree-wrapper .mk-folder-buttons { diff --git a/src/css/SpaceViewer/SpaceView.css b/src/css/SpaceViewer/SpaceView.css index 27af7fa..c6444aa 100644 --- a/src/css/SpaceViewer/SpaceView.css +++ b/src/css/SpaceViewer/SpaceView.css @@ -44,8 +44,10 @@ body:not(.mk-readable-line) { { width: 100%; display: flex; + align-items: center; gap: 4px; + position: relative; } .mk-title-container .mk-title-prefix { display: flex; @@ -57,6 +59,34 @@ body:not(.mk-readable-line) { .mk-title-container span{ flex: 1; } + + +.mk-title-container:hover .mk-title-alias, .mk-title-alias:hover { + opacity: 1; +} + +button.mk-title-alias { + opacity: 0; + background: none; + border: 0; + box-shadow: none; + margin: 0; + height: 100%; + width: 30px; + padding: 0 !important; + position: absolute; + left: -30px; + color: var(--mk-ui-text-tertiary); +} +.mk-title-alias svg { + width: 12px; + height: 12px; + margin-top: 8px; + +} +.mk-title-alias.mk-active { + color: var(--mk-ui-active) +} .mk-context-header { display: flex; flex-direction: column; diff --git a/src/main.ts b/src/main.ts index 5d3a7c2..6908b3f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -95,6 +95,7 @@ import "css/Editor/Actions/Actions.css"; import "css/Editor/Context/ContextList.css"; import "css/Editor/Context/FilterBar.css"; import "css/Editor/Flow/FlowEditor.css"; +import "css/Editor/Flow/FlowState.css"; import "css/Editor/Flow/Properties.css"; import "css/Editor/Frames/Insert.css"; import "css/Editor/Frames/Node.css"; @@ -192,7 +193,7 @@ export default class MakeMDPlugin extends Plugin { } testPage() { - openTestModal(this.superstate); + openTestModal(this); } toggleBold() { @@ -283,6 +284,7 @@ loadViews () { if (this.superstate.settings.spacesEnabled) { document.body.classList.toggle("mk-hide-tabs", !this.superstate.settings.sidebarTabs); document.body.classList.toggle("mk-hide-ribbon", !this.superstate.settings.showRibbon); + // document.body.classList.toggle("mk-flow-state", this.superstate.settings.flowState); document.body.classList.toggle( "mk-folder-lines", this.superstate.settings.folderIndentationLines @@ -355,7 +357,7 @@ loadViews () { const path = this.getActiveFile(); - if (this.superstate.settings.enableFolderNote) { + if (this.superstate.settings.enableFolderNote && this.superstate.settings.spaceViewEnabled) { if (this.superstate.spacesIndex.has(path)) { const space = this.superstate.spacesIndex.get(path) const leaf = this.app.workspace.getLeaf(); diff --git a/styles.css b/styles.css index af4506c..a4e3bfe 100644 --- a/styles.css +++ b/styles.css @@ -870,6 +870,7 @@ div:not(.mk-flowspace-editor) > .mk-floweditor .cm-content { .mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content, .mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > .mod-cm6 > .cm-editor > .cm-scroller { overflow: visible !important; + height: auto; } .mk-floweditor-container > .mk-floweditor { border: thin solid transparent; @@ -961,6 +962,36 @@ button.mk-hover-button { padding-bottom: 10px !important; } +/* src/css/Editor/Flow/FlowState.css */ +.mk-flow-state .workspace-tab-header-container-inner { + display: none; +} +.mk-flow-state .workspace-ribbon { + display: none; +} +body:not(.is-mobile).mk-flow-state .workspace-split.mod-left-split .workspace-sidedock-vault-profile { + transform: translateY(-100%); + transition: transform 1000ms linear; +} +body.mk-flow-state { + --tab-container-background: var(--background-primary) !important; + --titlebar-background-focused: var(--background-primary) !important; + --divider-color: transparent !important; + --tab-outline-color: transparent !important; +} +.mk-flow-state .workspace-tabs .workspace-leaf { + background: var(--background-primary) !important; +} +.mk-flow-state .view-header { + transform: translateY(-100%); + max-height: 0; + transition: transform 1000ms linear; + transition:; +} +body.mk-flow-state div { + transition: background-color 1000ms linear; +} + /* src/css/Editor/Flow/Properties.css */ .mk-props-contexts { display: flex; @@ -1745,10 +1776,16 @@ button.mk-date-picker-day:not(.mk-date-picker-selected):hover { body:not(.is-mobile) .mk-style-menu { margin-left: -80px; } +.mk-style-menu .mk-divider { + border-left: thin solid var(--mk-ui-divider); + width: 1px; + height: 24px; +} .mk-style-menu { display: flex; - padding: 0; + padding: 4px; margin-top: -50px; + align-items: center; } .is-mobile .mk-style-menu svg { width: 32px; @@ -1770,10 +1807,34 @@ body:not(.is-mobile) .mk-style-menu { border-radius: 4px; display: flex; } +.mk-style-menu .mk-mark { + width: 24px; + height: 24px; + padding: 6px; +} +.mk-style-menu .mk-mark svg { + width: 12px; + height: 12px; +} .mk-mark div { display: flex; } -.mk-style-menu .mk-mark:hover { +.mk-mark-group { + display: flex; +} +.mk-mark-dropdown { + padding: 2px; + border-radius: 4px; + display: flex; + align-items: center; +} +.mk-mark-dropdown svg { + width: 12px; + height: 12px; + transform: rotate(90deg); +} +.mk-style-menu .mk-mark:hover, +.mk-style-menu .mk-mark-dropdown:hover { background: var(--mk-ui-background-hover); } .mk-style-menu .mk-mark-active { @@ -2714,7 +2775,7 @@ body:not(.is-mobile) .mk-main-menu-button:hover { } /* src/css/Panels/FileContext.css */ -.mk-path-context { +.mk-path-explorer { display: flex; flex-direction: column; --file-context-spacing: 4px; @@ -2773,7 +2834,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit margin-top: 8px; padding-top: 0 !important; margin-bottom: 0; - width: auto; + width: 100%; } .mk-inline-title { margin-top: 8px; @@ -2875,7 +2936,13 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit text-align: center; justify-content: center; } -.mk-path-context .mk-path-context-field { +.mk-path-explorer .mk-path-context-row { + flex-direction: column; +} +.mk-path-explorer .mk-path-context-value { + margin-left: 24px; +} +.mk-path-explorer .mk-path-context-field { max-width: 120px; min-width: 120px; } @@ -2907,7 +2974,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit background-color: var(--bullet-color); transition: transform 75ms ease-out; } -.mk-path-context .mk-cell-text { +.mk-path-explorer .mk-cell-text { background: var(var(--mk-ui-active-hover)) !important; } .mk-path-preview { @@ -2967,7 +3034,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit .mk-path-context-value input[type=number]:focus { box-shadow: none !important; } -.mk-path-context .mk-path-context-title { +.mk-path-explorer .mk-path-context-title { --icon-size: 14px; font-size: 14px; } @@ -3005,7 +3072,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit box-shadow: none !important; height: unset !important; } -.mk-path-context .mk-tag-selector { +.mk-path-explorer .mk-tag-selector { padding: 0 !important; } .mk-space-icon { @@ -3016,7 +3083,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit background: var(--mk-ui-background); padding: 8px; } -.mk-path-context .mk-path-context-backlink { +.mk-path-explorer .mk-path-context-backlink { border: thin solid var(--mk-ui-border); border-radius: 8px; box-shadow: var(--mk-shadow-card); @@ -3140,7 +3207,7 @@ body .markdown-source-view.mod-cm6.mod-cm6.is-readable-line-width .mk-inline-tit min-height: var(--mk-header-height) !important; pointer-events: none; } -.mk-path-context .inline-title { +.mk-path-explorer .inline-title { font-size: 18px; margin-bottom: 0; } @@ -3299,7 +3366,7 @@ body.is-mobile .sidebar-toggle-button { } .is-mobile .mk-sidebar { } -.mk-path-tree-area { +.mk-path-tree-focus { display: flex; flex-direction: column; align-items: center; @@ -3307,7 +3374,7 @@ body.is-mobile .sidebar-toggle-button { justify-content: center; height: 100%; } -.mk-path-tree-area input { +.mk-path-tree-focus input { width: 60%; padding: 8px; border: none; @@ -3443,11 +3510,11 @@ body.is-mobile .sidebar-toggle-button { .mk-nav-button { } .mk-tree-section { - margin-top: 6px; - height: 32px; + margin-top: 4px; + height: var(--spaceSectionHeight); } .mk-tree-section .mk-tree-item { - height: 32px; + height: var(--spaceRowHeight); padding-left: 4px; } .mk-tree-section .is-active.mk-tree-item, @@ -3489,6 +3556,7 @@ body.is-mobile .sidebar-toggle-button { font-size: 13px; line-height: 1.3; gap: 2px; + height: var(--spaceRowHeight); } .is-mobile .mk-tree-item { height: 38px; @@ -3504,7 +3572,8 @@ body.is-mobile .sidebar-toggle-button { background: var(--nav-item-background-active) !important; } .mk-inline-button, -.mk-folder-buttons button { +.mk-folder-buttons button, +.mk-folder-buttons div { background: none; border: 0; box-shadow: none; @@ -3553,16 +3622,22 @@ body:not(.is-mobile) .mk-tree-wrapper:hover .mk-drag-handle { .is-mobile .mk-folder-buttons { display: flex; } +.mk-folder-buttons div { + align-items: center; + justify-content: center; +} body:not(.is-mobile) .mk-tree-wrapper .mk-path-link { opacity: 0; } body:not(.is-mobile) .mk-tree-wrapper:hover .mk-path-link { opacity: 1; } -body:not(.is-mobile) .mk-tree-wrapper .mk-folder-buttons button { +body:not(.is-mobile) .mk-tree-wrapper .mk-folder-buttons button, +body:not(.is-mobile) .mk-tree-wrapper .mk-folder-buttons div { display: none; } -body:not(.is-mobile) .mk-tree-wrapper:hover .mk-folder-buttons button { +body:not(.is-mobile) .mk-tree-wrapper:hover .mk-folder-buttons button, +body:not(.is-mobile) .mk-tree-wrapper:hover .mk-folder-buttons div { display: flex; } body:not(.is-mobile) .mk-tree-wrapper .mk-folder-buttons { @@ -4248,6 +4323,7 @@ body:not(.mk-readable-line) { display: flex; align-items: center; gap: 4px; + position: relative; } .mk-title-container .mk-title-prefix { display: flex; @@ -4259,6 +4335,31 @@ body:not(.mk-readable-line) { .mk-title-container span { flex: 1; } +.mk-title-container:hover .mk-title-alias, +.mk-title-alias:hover { + opacity: 1; +} +button.mk-title-alias { + opacity: 0; + background: none; + border: 0; + box-shadow: none; + margin: 0; + height: 100%; + width: 30px; + padding: 0 !important; + position: absolute; + left: -30px; + color: var(--mk-ui-text-tertiary); +} +.mk-title-alias svg { + width: 12px; + height: 12px; + margin-top: 8px; +} +.mk-title-alias.mk-active { + color: var(--mk-ui-active); +} .mk-context-header { display: flex; flex-direction: column;